Module: lib/blockchains/bitcoin/rpc

Module to connect to the Bitcoin network through a Bitcoin node

Source:

Methods

(inner) getBlockByHash(blockHash, full) → {Promise}

Gets a block by its hash

Parameters:
Name Type Default Description
blockHash string
full boolean false

get the full block including all transactions

Source:
Returns:

resolves to a JOSN representation of the block

Type
Promise

(inner) getBlockByNumber(blockNumber) → {Promise}

Gets a block by its number including transaction data

Parameters:
Name Type Description
blockNumber Object
Source:
Returns:

resolves to block including transactions

Type
Promise

(inner) getBlockChainInfo() → {Promise}

Gets various information from the node regarding blockchain processing

Source:
Returns:

resolves to object with blockchain info

Type
Promise

(inner) getBlockCount() → {Object}

Gets the current block count of the longest chains

Source:
Returns:

resolves to block count

Type
Object

(inner) getBlockHash(blockNumber) → {Promise}

Gets the hash of the block specified by its block number

Parameters:
Name Type Description
blockNumber Object
Source:
Returns:

resolves to block hash

Type
Promise

(inner) getConnectionCount() → {Promise}

Get number of connections of the node to other nodes

Source:
Returns:

resolves to connection count

Type
Promise

(inner) getFeeRate(blocks) → {Promise}

Gets an estimate of the fee rate in BTC/kB

Parameters:
Name Type Description
blocks number

the number of blocks

Source:
Returns:

resolves to a JOSN representation of the block

Type
Promise

(inner) getRawTransaction(transactionHash) → {Object}

Gets raw transaction data

Parameters:
Name Type Description
transactionHash string

the transaction hash, aka txid

Source:
Returns:

resolves to raw transaction data

Type
Object

(inner) initRpc(bcConfig, bcState)

Intitialises Bitcoin RPC connection

Parameters:
Name Type Description
bcConfig Object

the Bitcoin blockchain configuration

bcState Object

the Bitcoin blockchain state

Source:

(inner) sendRawTransaction(rawTransaction) → {Promise}

Send a raw signed transaction

Parameters:
Name Type Description
rawTransaction Object

raw transaction

Source:
Returns:

resolves to the transaction hash, aka txid

Type
Promise