Skip to main content

getblock RPC Method

Returns information about the block.

Updated on
Oct 4, 2023

getblock RPC Method

Parameters

blockhash
string
REQUIRED
The hash of the block
verbosity
numeric
default = 1, 0 for hex-encoded data, 1 for a JSON object, 2 for JSON object with transaction data, and 3 for JSON object with transaction data including prevout information for inputs

Returns

(for verbosity = 0)
hex
A string that is serialized, hex-encoded data for block hash
(for verbosity = 1)
hex
The block hash
confirmations
The number of confirmations, or -1 if the block is not on the main chain
size
The size of the block
strippedsize
The block size excluding witness data
weight
The block weight as defined in BIP 141
height
The block height or index
version
The block version
versionHex
The block version formatted in hexadecimal
merkleroot
The merkle root
tx
An array with transaction ids
hex
The transaction id
time
The block time expressed in UNIX epoch time
mediantime
The median block time expressed in UNIX epoch time
nonce
number that miners adjust in order to find a block hash that meets the network's specified difficulty target
bits
The value of the nBits field in the block header
difficulty
The estimated amount of work done to find this block relative to the estimated amount of work done to find block 0
chainwork
Expected number of hashes required to produce the current chain
nTx
The number of transactions in the block
previousblockhash
The hash of the previous block
nextblockhash
The hash of the next block
error
The error message, if any
(for verbosity = 2)
It returns the same output as of verbosity=1 and in addition to that, it also returns the information about each transaction in the 'tx' array
Request
1
curl https://docs-demo.btc.quiknode.pro/ \
2
-X POST \
3
-H "Content-Type: application/json" \
4
--data '{"method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"]}'
5
Don't have an account yet?
Create your QuickNode endpoint in seconds and start building
Get started for free