1.0.2 • Published 6 years ago

electroneumjs v1.0.2

Weekly downloads
1
License
GPL-3.0
Repository
github
Last release
6 years ago

Electroneum RPC

Electroneum RPC is a JavaScript library that adapts the Electroneum JSON RPC methods to JS.

Installation

npm install electroneumjs 

Usage

const EtnRpc = require('electroneumjs');
var rpc = new EtnRpc();
rpc.getBlockCount().then(function(response) {
    console.log(response.data);
}); 

Options

new EtnRpc({
    protocol: 'http',
    ip: '127.0.0.1',
    port: 26968,
    id: '0',
    jsonrpc: '2.0'
});

Method parameters

const rpc = new EtnRpc();

// on_getblockhash method
rpc.getBlockHash([50]);

// submitblock method
rpc.submitBlock('blob_of_mined_block');

Methods

JavaScript MethodRPC Method
getBlockCountgetblockcount
getBlockHashon_get_block_hash
getBlockTemplateget_block_template
submitBlocksubmit_block
getLastBlockHeaderget_last_block_header
getBlockHeaderByHashget_block_header_by_hash
getBlockHeaderByHeightget_block_header_by_height
getBlockHeadersRangeget_block_headers_range
getBlockget_block
getConnectionsget_connections
getInfoget_info
hardForkInfohard_fork_info
setBansset_bans
getBansget_bans
flushTxPoolflush_txpool
getOutputHistogramget_output_histogram
getVersionget_version
getCoinbaseTxSumget_coinbase_tx_sum
getFeeEstimateget_fee_estimate
getAlternateChainsget_alternate_chains
relayTxrelay_tx
syncInfosync_info
getTxpoolBacklogget_txpool_backlog

How to run Electroneumd?

  • Download the Electroneum project from their repository from here: https://github.com/electroneum/electroneum
  • Install CMake if you have not did it.
  • Inside the Electroneum project folder run make from command line
  • Run cd build/release/bin and then open electroneumd by typing ./electroneumd

It will take some time to synchronize the blockchain with the network

TODO

  • Integrate electroneum-wallet-rpc methods