tendermint
A light client for Tendermint blockchains which works in Node.js and browsers.
Usage
npm install tendermint
Light Node
Requests data over RPC and verifies blockchain headers
let Tendermint = require('tendermint')
let peer = 'ws://localhost:46657'
let state = {
header: { ... },
validators: [ ... ],
commit: { ... }
}
let opts = {
maxAge: 1728000
}
let node = Tendermint(peer, state, opts)
node.on('error', (err) => { ... })
node.on('synced', () => { ... })
node.on('update', () => { ... })
node.height()
node.state()
RPC Client
Simple client to make RPC requests to nodes
let { RpcClient } = require('tendermint')
let client = RpcClient('ws://localhost:46657')
client.block({ height: 100 })
.then((res) => console.log(res))
The following RPC methods are available:
- subscribe
- unsubscribe
- status
- netInfo
- dialSeeds
- blockchain
- genesis
- block
- validators
- dumpConsensusState
- broadcastTxCommit
- broadcastTxSync
- broadcastTxSync
- unconfirmedTxs
- numUnconfirmedTxs
- abciQuery
- abciInfo
- abciProof
- unsafeFlushMempool
- unsafeSetConfig
- unsafeStartCpuProfiler
- unsafeStopCpuProfiler
- unsafeWriteHeapProfile