Skip to content

Module for parse ethereum transactions or block and get from them all Eth transfers (normal and "internal")

Notifications You must be signed in to change notification settings

viktor32/etherscanner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EtherScanner

Module for parse ethereum transactions or block and get from them all Eth transfers (normal and "internal")

Warning

To work the module need this correction - ethereum/go-ethereum#15297. So you must use geth version 1.7.3 or higher

NPM version

Installation

npm install etherscanner

Usage

const EtherScanner = require('etherscanner');
const Web3 = require('web3');

let web3Provider = new Web3.providers.HttpProvider(`http://localhost:6082`);
// or if web3 initialized before
let web3Provider = web3.currentProvider;

let etherScanner = EtherScanner(web3Provider);
Get all transfers by transaction hash
etherScanner.scanTransaction('0xc475f8bf9d2721b17f7c09944c2aa32ea943f452cb54ee0aefcb98ead0735274', (err, result) => {
	console.log(result);
});

result:

[{
	"hash": "0xc475f8bf9d2721b17f7c09944c2aa32ea943f452cb54ee0aefcb98ead0735274",
	"from": "0x1617d6e2dca84fec5c17f37d4141d2c4ec5c6d05",
	"to": "0xd1a2511bc222f38f463c62c9254faf7b710835e4",
	"value": 10000000000000000,
	"blockNumber": 1818075,
	"blockHash": "0x402a1df2fe61dcc83bec29c1202938e2fd739d97e614dbab351561dc04b01cd3",
	"isInternal": false,
	"type": ""
}, {
	"hash": "0xc475f8bf9d2721b17f7c09944c2aa32ea943f452cb54ee0aefcb98ead0735274",
	"from": "0xd1a2511bc222f38f463c62c9254faf7b710835e4",
	"to": "0x1617d6e2dca84fec5c17f37d4141d2c4ec5c6d05",
	"value": 12468329110548072,
	"blockNumber": 1818075,
	"blockHash": "0x402a1df2fe61dcc83bec29c1202938e2fd739d97e614dbab351561dc04b01cd3",
	"isInternal": true,
	"type": "CALL"
}]

type - "" || CALL || CREATION || SELFDESTRUCT

Get all transfers by block number
etherScanner.scanBlock(1822433, (err, result) => {
	console.log(result);
});

About

Module for parse ethereum transactions or block and get from them all Eth transfers (normal and "internal")

Resources

Stars

Watchers

Forks

Packages

No packages published