1.8.3 • Published 2 years ago

ether-report v1.8.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

ether-report

web3.js - Ethereum JavaScript API

This package allows the user to generate a report on an arbitrary range of blocks from the ethereum blockchain. Ether-report abstracts all the work away from the user and allows them to simply input the desired range of blocks and uses the web.js API to request the blocks in question, parse the data, and return a single report object.

Installation

Node

npm install ether-flow

Dependencies

Configuration

  • 1 - Create a folder named config in your root directory
  • 2 - Create a file named config.js in the config folder
  • 3 - Obtain an rpc url. You can obtain one using Infura by creating a new project
  • 4 - Add the following code to the file:
import Web3 from "web3";
const rpcURL = '<your-rpc-url>';
export default new Web3(rpcURL)

Usage

In order to access the getReport function which returns the report object, add the following to the file in which it will be invoked:

import { getReport } from 'ether-flow'

getReport

Parameters

getReport can be called in three ways:

  • 1 - getReport() - With no arguments. This will create a report for the most recent block
  • 2 - getReport(numBlocks) - With only 1 argument. This will create a report for the previous n blocks where n is numBlocks
  • 3 - getReport(start, stop) - With two block numbers passed in as arguments. This will create a report for all blocks from start to stop inclusive

Returns

  • Promise returns Object - The report object with info on the blocks in the reports range:

    • start - Number: First block in the report's range
    • stop - Number: Last block in the report's range
    • ethSent - Number: Total amount of ether sent
    • addresses - Object: An object containing strings of all addresses of senders and recipients as keys and address objects as values:
    • address - Object: Contains the following:
      • sent - Number: Total amount of eth sent by this address
      • recieved - Number: Total amount of eth recieved by this address
      • type - String: Type of address - either 'contract' or 'eoa'
    • uncles - Number - Total number of uncles
    • uniqueSent - Number: Number of unique addresses that sent a transaction
    • uniqueReceived - Number: Number of unique addresses that received a transaction
    • gasUsed - Number: Total gas used
    • numTransactions - Number: total number of transactions

Empty report object:

{
    ethSent: 0,
    addresses: {},
    uncles: 0,
    uniqueSent: 0,
    uniqueReceived: 0,
    gasUsed: 0,
    numTransactions: 0,
    start: null,
    stop: null
}

Empty address object:

{ 
    sent: 0, 
    recieved: 0, 
    type: null
}
1.8.3

2 years ago

1.8.2

2 years ago

1.8.1

2 years ago

1.8.0

2 years ago

1.7.0

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago