blockexplorer
Unofficial Node.js client for blockexplorer.com API
Install
npm i blockexplorer --save
Example
// require the module
const be = require('blockexplorer')
// get the genesis block hash
be.blockIndex(0)
.then((result) => {
console.log(result)
})
.catch((err) => {
throw err
})
Test
npm test
API
blockexplorer.block(hash)
Get block info byhash
- Returns
Promise
blockexplorer.rawBlock(hash)
Get raw block info byhash
- Returns
Promise
blockexplorer.blockIndex(height)
Get block hash byheight
- Returns
Promise
blockexplorer.tx(txid)
Get transaction bytxid
- Returns
Promise
blockexplorer.rawTx(txid)
Get raw transaction bytxid
- Returns
Promise
blockexplorer.addrValidate(address)
Validateaddress
- Returns
Promise
blockexplorer.addr(address, options)
Getaddress
info
// Default options
{
noTxList: false,
noCache: false
}
- Pass an
Array
as first parameter to get info on multiple addresses - Returns
Promise
blockexplorer.balance(address)
Getaddress
balance- Returns a
Promise
blockexplorer.totalReceived(address)
Getaddress
received funds- Returns a
Promise
blockexplorer.totalSent(address)
Getaddress
sent funds- Returns a
Promise
blockexplorer.unconfirmedBalance(address)
Getaddress
unconfirmed balance- Returns a
Promise
blockexplorer.utxo(address, options)
Getaddress
unspent outputs
// Default options
{
noCache: false
}
- Pass an
Array
as first parameter to get info on multiple addresses - Returns a
Promise
blockexplorer.txsBlock(hash)
Get transactions byhash
- Returns a
Promise
blockexplorer.txsAddress(address, options)
Get transactions byaddress
// Default options
{
from: '',
to: ''
}
- Pass an
Array
as first parameter to get info on multiple addresses - Returns a
Promise
blockexplorer.txSend(rawtx)
Broadcast signed trasaction in hex formatrawtx
- Returns a
Promise
blockexplorer.getInfo()
Get blockchain info- Returns a
Promise
blockexplorer.getBlockCount()
Get block count- Returns a
Promise
blockexplorer.getDifficulty()
Get difficulty- Returns a
Promise
blockexplorer.getBestBlockHash()
Get best block hash- Returns a
Promise
blockexplorer.getLastBlockHash()
Get last block hash- Returns a
Promise
blockexplorer.sync()
Get historic blockchain data sync status- Returns a
Promise
blockexplorer.peer()
Get live network p2p data sync status- Returns a
Promise
blockexplorer.estimateFee(nbBlocks = 2)
Get fee estimate- Returns a
Promise
For additional information see blockexplorer.com API reference
Contributing
Just send a PRLicense
Licensed under MITThe author is not affiliated in any way with blockexplorer.com