A modern promise based node.js library for communicating with Ethereum daemon.
npm install --save ethereum-rpc-promise
Start ethereum daemon with rpc support:
./geth --rpc
Connect to daemon endpoint and send rpc commands:
const EthereumRpc = require('ethereum-rpc-promise');
let eth = new EthereumRpc('http://localhost:8545');
// call named wrappers
eth.web3_sha3('0x12345678').then(result) => {
console.log(result);
});
// or call raw commands
eth.call('web3_sha3', '0x12345678').then(result) => {
console.log(result);
});