Skip to content

kidwai/geth-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

geth-js

A simple Node.js controller for go-ethereum ('geth').

Install

$ npm install geth-js

Usage

var Geth = require('..');
var geth = new Geth({datadir: '/mnt/ssd/.ethereum'});


geth.start().then(function () {
	console.log('timestamp,number,size,tx_count,volume');
	geth.rpc.eth.filter('latest', function (err, block) {
		if (!err) {
			var block = geth.rpc.eth.getBlock(block);
			var txs   = block.transactions.map(tx => geth.rpc.eth.getTransaction(tx));
			block.volume = 0;
			txs.forEach((tx) => {volume += parseInt(txs.value)});
			var data = [block.timestamp,block.number, block.size, block.txs.length, block.volume];
			console.log(data.join(','));
		}
	})
})

About

A simple Node.js wrapper for geth.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published