Class: BitcoinBlock ​
Defined in: packages/bitcoin/src/client/rest/block.ts:13
Block-related Esplora REST API operations.
Note: The Esplora API always returns the same block format regardless of any "verbosity" setting (unlike Bitcoin Core RPC). Use the RPC client if you need verbosity-controlled block responses.
Constructors ​
Constructor ​
new BitcoinBlock(
protocol,exec):BitcoinBlock
Defined in: packages/bitcoin/src/client/rest/block.ts:17
Parameters ​
protocol ​
exec ​
(req) => Promise<any>
Returns ​
BitcoinBlock
Methods ​
count() ​
count():
Promise<number>
Defined in: packages/bitcoin/src/client/rest/block.ts:26
Returns the blockheight of the most-work fully-validated chain.
Returns ​
Promise<number>
The current block height.
get() ​
get(
params):Promise<EsploraBlock|undefined>
Defined in: packages/bitcoin/src/client/rest/block.ts:38
Returns the Esplora block data for a given blockhash or height.
Parameters ​
params ​
The block hash or height.
blockhash? ​
string
The blockhash of the block to query.
height? ​
number
The block height of the block to query.
Returns ​
Promise<EsploraBlock | undefined>
The block data.
Throws ​
If neither blockhash nor height is provided.
getHash() ​
getHash(
height):Promise<string>
Defined in: packages/bitcoin/src/client/rest/block.ts:57
Get the block hash for a given block height. See Esplora GET /block-height/:height for details.
Parameters ​
height ​
number
The block height (required).
Returns ​
Promise<string>
The hash of the block at the given height.