View on GitHub

ethereum-rpc-promise

A modern promise based node.js library for communicating with Ethereum daemon.

ethereum-rpc-promise

npm package

NPM version Dependency Status Known Vulnerabilities Downloads

A modern promise based node.js library for communicating with Ethereum daemon.

Install

npm install --save ethereum-rpc-promise

Usage

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);
});

Documentation

Ethereum Wiki