This module provides an API for an Ethereum node by using web3. web3 documentation can be found here: web3 documentation
Clone the repo and then install dependencies:
$ npm install
The install process creates a new config.js
file in the root directory, based on the config.js.default
file. There you can set up the parameters for running your instance including the path (in the project root folder) of the full smart contract .json file gotten from truffle deploy --network <network name>
which includes the smart contract abi e.g., var/contracts/MetaCoin.json
In order to start the HTTP API service you just need to run:
$ npm start
or
$ node api
You'll see a message indicating that the service is already running.
-
GET
/node/status
Get the list of accounts in connected blockchain client
-
GET
/node/address/:address/balance
Get the ether balance of an account in wei
-
GET
/node/tx/:txhash
Get the details of a transaction hash
-
GET
/node/tx/receipt/:txhash
Get the full receipt of a transaction
-
POST
/node/tx/
Send ether (wei) from one account to another address or send trnasaction signed offline
-
GET
/node/contract/:name/:address/call/:method
Make a call to a smart contracts view function that does not require gas or transaction signing
-
POST
/node/contract/:name/:address/transact/:method
Make a call to a smart contracts SEND function that requires gas and transaction signing as it changes the state of the blockchain
-
GET
/node/gasLimit
Get the gas limit used in the last mined/approved block
-
GET
/node/latestBlock
Get the details of the latest mined/approved block
-
GET
/node/block/:blockNumber
Get the details of a specified mined/approved block with the block number
-
GET
/node/event/:contractName/:address/:fromBlock
Get all past events from a specified smart contract