getblock

The getblock is a Bitcoin RPC method that returns information about a specified block. This method is useful for obtaining block details such as the hash, height, transactions, and other metadata. It can be used for various purposes, including validating transactions, monitoring the blockchain, and analyzing the network.


Parameters

parameter
type
description
blockhash
string
The hash of the block to be retrieved. Example: "0000000000000000000ef0e1f703b56f2b0d6724e4eeccf00e4f8d55b9c3c3f6e"
verbosity
numeric
Specifies the level of detail returned for the block. 0: Returns a serialized block as a hex-encoded string (default). 1: Returns a JSON object with block information. 2: Returns a JSON object with block information and detailed transaction data.
Return Object

The returned object varies depending on the verbosity parameter:

If verbosity is 0, the return object is a hex-encoded string of the serialized block.

If verbosity is 1 or 2, the return object is a JSON object containing the following fields:

name
description
hash
The block hash.
confirmations
The number of confirmations for the block.
strippedsize
The block size without witness data.
size
The block size.
transactionIndex
The index of the transaction within the block.
weight
The block weight.
height
The block height.
version
The block version.
versionHex
The block version as a hex string.
merkleroot
The Merkle root of the transactions in the block.
tx
An array of transaction identifiers (if verbosity is 1) or detailed transaction objects (if verbosity is 2).
time
The block time in UNIX timestamp format.
mediantime
The median block time of the previous 11 blocks.
nonce
The block nonce.
bits
The block difficulty target as a hex string.
difficulty
The block difficulty.
chainwork
The total work in the blockchain up to this block.
nTx
The number of transactions in the block.
previousblockhash
The hash of the previous block.
nextblockhash
The hash of the next block (if available).
Request Example
Request Example

Share on
Share on FacebookShare on XShare on LinkedIn
Did you find this page useful?