Methods
# clearMempool() → {Promise.<string>}
Removes all transaction from the mempool
Mempool cleared
Promise.<string>
# decodeBlock(params) → {Promisee.<DecodeBlockResponse>}
Decode block by the blockhex
Parameters:
Name | Type | Description |
---|---|---|
params |
||
blockhex |
string
|
The block hex |
Promisee.<DecodeBlockResponse>
# getBestBlockHash() → {Promise.<string>}
Returns the hash of the best (tip) block in the longest blockchain.
The block hash hex encoded
Promise.<string>
# getBlock(params) → {Promise.<(GetBlockVerbosity0|GetBlockVerbosity1|GetBlockVerbosity2)>}
If verbosity is 0, returns a string that is serialized, hex-encoded data for block 'hash'.
If verbosity is 1, returns an Object with information about block
If verbosity is 2, returns an Object with information about block
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
blockhash |
string
|
The block hash |
||
verbosity |
number
|
boolean
|
<optional> |
1 | Default = 1. 0 for hex encoded data, 1 for a json object, and 2 for json object with transaction data |
Promise.<(GetBlockVerbosity0|GetBlockVerbosity1|GetBlockVerbosity2)>
# getBlockchainInfo() → {Promise.<GetBlockchainInfoResponse>}
Returns an object containing various state info regarding blockchain processing.
Promise.<GetBlockchainInfoResponse>
Example
client.blockchain.getBlockchainInfo()
# getBlockCount() → {Promise.<number>}
Returns the number of blocks in the longest blockchain.
The current block count
Promise.<number>
# getBlockDeltas(params) → {Promise.<GetBlockDeltasResponse>}
Get Block Deltas
Parameters:
Name | Type | Description |
---|---|---|
params |
||
blockhash |
string
|
The block hash |
Promise.<GetBlockDeltasResponse>
# getBlockHash(params) → {Promise.<string>}
Returns hash of block in best-block-chain at height provided.
Parameters:
Name | Type | Description |
---|---|---|
params |
||
height |
number
|
The height index |
The block hash
Promise.<string>
# getBlockHashes(params) → {Promise.<(GetBlockHashesResponse|GetBlockHashesResponseLogicalTimes)>}
Returns array of hashes of blocks within the timestamp range provided.
Parameters:
Name | Type | Description |
---|---|---|
params |
||
high |
number
|
The newer block timestamp |
low |
number
|
The older block timestamp |
options |
OptionsRequest
|
# getBlockHeader(params) → {Promise.<(GetBlockHeaderResponseFalse|GetBlockHeaderResponseTrue)>}
If verbose is false, returns a string that is serialized, hex-encoded data for blockheader 'hash'.
If verbose is true, returns an Object with information about blockheader
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
hash |
string
|
The block hash |
||
verbose |
boolean
|
<optional> |
true | Default = true. True for a json object, false for the hex encoded data |
# getChainTips() → {Promise.<Array.<GetChainTipsResponse>>}
Return information about all known tips in the block tree, including the main chain as well as orphaned branches. * @param params
Promise.<Array.<GetChainTipsResponse>>
# getChainTxStats(params) → {Promise.<GetChainTxStatsResponse>}
Compute statistics about the total number and rate of transactions in the chain.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
nblocks |
number
|
<optional> |
Size of the window in number of blocks (default: one month). |
blockhash |
string
|
<optional> |
The hash of the block that ends the window. |
Promise.<GetChainTxStatsResponse>
# getDifficulty() → {Promise.<number>}
Returns the proof-of-work difficulty as a multiple of the minimum difficulty.
The proof-of-work difficulty as a multiple of the minimum difficulty.
Promise.<number>
# getMempoolAncestors(params) → {Promise.<(Array.<GetMempoolAncestorsResponseVerboseFalse>|GetMempoolAncestorsResponseVerboseTrue)>}
If txid is in the mempool, returns all in-mempool ancestors.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
txid |
string
|
The transaction id (must be in mempool) |
||
verbose |
boolean
|
<optional> |
false | Default = false. True for a json object, false for array of transaction ids |
Array of transactions or ids of an in-mempool ancestor transactions
Promise.<(Array.<GetMempoolAncestorsResponseVerboseFalse>|GetMempoolAncestorsResponseVerboseTrue)>
# getMempoolDescendants(params) → {Promise.<(Array.<GetMempoolDescendantsResponseVerboseFalse>|GetMempoolDescendantsResponseVerboseTrue)>}
If txid is in the mempool, returns all in-mempool descendants.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
txid |
string
|
The transaction id (must be in mempool) |
||
verbose |
boolean
|
<optional> |
false | Default = false. True for a json object, false for array of transaction ids |
Promise.<(Array.<GetMempoolDescendantsResponseVerboseFalse>|GetMempoolDescendantsResponseVerboseTrue)>
# getMempoolEntry(params) → {Promise.<Array.<string>>}
Returns mempool data for given transaction
Parameters:
Name | Type | Description |
---|---|---|
params |
||
txid |
string
|
The transaction id (must be in mempool) |
Promise.<Array.<string>>
# getMempoolInfo() → {Promise.<GetMempoolInfoResponse>}
Returns details on the active state of the TX memory pool.
Promise.<GetMempoolInfoResponse>
# getRawMempool(params) → {Promise.<(GetRawMempoolResponseVerboseFalse|GetRawMempoolResponseVerboseTrue)>}
Returns all transaction ids in memory pool as a json array of string transaction ids.
Hint: use getmempoolentry to fetch a specific transaction from the mempool.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
verbose |
boolean
|
<optional> |
Default = false. True for a json object, false for array of transaction ids |
# GetTxOut(params) → {Promise}
Returns details about an unspent transaction output.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
txid |
string
|
The transaction id |
|
n |
number
|
vout number |
|
include_mempool |
boolean
|
<optional> |
Whether to include the mempool. Default: true. Note that an unspent output that is spent in the mempool won't appear. |
Promise
# getTxOutSetInfo() → {Promise.<GetTxOutResponse>}
Returns statistics about the unspent transaction output set.
Note this call may take some time.
Promise.<GetTxOutResponse>
# invalidateBlock(params) → {Promise.<null>}
Permanently marks a block as invalid, as if it violated a consensus rule.
Parameters:
Name | Type | Description |
---|---|---|
params |
||
blockhash |
string
|
The hash of the block to mark as invalid |
Promise.<null>
# preciousBlock(params) → {Promise.<null>}
Treats a block as if it were received before others with the same work.
A later preciousblock call can override the effect of an earlier one.
The effects of preciousblock are not retained across restarts
Parameters:
Name | Type | Description |
---|---|---|
params |
||
blockhash |
string
|
The hash of the block to mark as precious |
Promise.<null>
# pruneBlockchain(params) → {Promise.<number>}
Prune the blockchain
Parameters:
Name | Type | Description |
---|---|---|
params |
||
height |
number
|
The block height to prune up to. May be set to a discrete height, or a unix timestamp to prune blocks whose block time is at least 2 hours older than the provided timestamp. |
Height of the last block pruned.
Promise.<number>
# reconsiderBlock(params) → {Promise.<null>}
Removes invalidity status of a block and its descendants, reconsider them for activation.
This can be used to undo the effects of invalidateblock.
Parameters:
Name | Type | Description |
---|---|---|
params |
||
blockhash |
string
|
The hash of the block to reconsider |
Promise.<null>
# verifyChain(params) → {Promise.<boolean>}
Verifies blockchain database.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
params |
|||
checklevel |
number
|
<optional> |
0-4, default=" + strprintf("%d", nCheckLevel) + ") How thorough the block verification is. |
nblocks |
number
|
<optional> |
Default = " + strprintf("%d", nCheckDepth) + ", 0=all) The number of blocks to check. |
Verified or not
Promise.<boolean>
# waitForBlock(params) → {Promise.<WaitForBlockResponse>}
Waits for a specific new block and returns useful info about it.
Returns the current block on timeout or exit.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
blockhash |
string
|
Block hash to wait for. |
||
timeout |
number
|
<optional> |
0 | Default = 0. Time in milliseconds to wait for a response. 0 indicates no timeout. |
Promise.<WaitForBlockResponse>
# waitForBlockHeight(params) → {Promise.<WaitForBlockHeightResponse>}
Waits for (at least) block height and returns the height and hash of the current tip.
Returns the current block on timeout or exit.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
height |
number
|
Block height to wait for (int) |
||
timeout |
number
|
<optional> |
0 | Default = 0. Time in milliseconds to wait for a response. 0 indicates no timeout. |
Promise.<WaitForBlockHeightResponse>
# waitForNewBlock(params) → {Promise.<WaitForNewBlockResponse>}
Waits for a specific new block and returns useful info about it.
Returns the current block on timeout or exit.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
params |
||||
timeout |
number
|
<optional> |
0 | Default = 0. Time in milliseconds to wait for a response. 0 indicates no timeout. |
Promise.<WaitForNewBlockResponse>