getblock - Bitcoin

getblock. Retrieves detailed information about a specific Bitcoin block using its hash or block height.

getblock - bitcoin [Value: 30CU]
Retrieves detailed data about a specific block.
Use cases

Use cases

  • Retrieve detailed data of a specific Bitcoin block
  • Analyze transactions and metadata within a block
  • Audit blockchain structure and block contents
Constraints

Constraints

  • Requires a valid block hash
  • Only retrieves data for existing blocks
  • Depends on node sync
Get started
Unlock Access to 50+ chains
Boost your app's speed and reliability with dRPC - get your access API key

Language

Request
Examples
curl  https://bitcoin.drpc.org \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method": "getblock", "params": ["00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09"]}'
Copy
Response
200
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "hash": "00000000c937983704a73af28acdec37b049d214adbda81d7e2a3dd146f6ed09",
        "confirmations": 100,
        "size": 285,
        "height": 681543,
        "version": 2,
        "versionHex": "00000002",
        "merkleroot": "d5e4c4a0ab04c870d75dbb80afae3e56b9e2196744f5b3277d50f0067e65b920",
        "time": 1625569780,
        "mediantime": 1625569780,
        "nonce": 123456789,
        "bits": "17024d43",
        "difficulty": 1.234567,
        "tx": [
            "txid1",
            "txid2",
            "txid3"
        ],
        "previousblockhash": "00000000b0abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef",
        "nextblockhash": "00000000d0abcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdefabcdef"
    }
}
Copy

Request params

idinteger
jsonrpcstring
methodstring
Parametersobject
object
blockhashstring
Required. The hash of the block.
verbosityinteger
Optional. Default is 1. Use 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.

Response

200

Response params

object
idinteger
jsonrpcstring
resultstring
If verbosity = 0. A string that is serialized, hex-encoded data for block hash.
resultstring
If verbosity = 1
object
hexstring
The block hash.
confirmationsinteger
The number of confirmations, or -1 if the block is not on the main chain.
sizenumeric
The size of the block.
strippedsizenumeric
The block size excluding witness data.
weightinteger
The block weight as defined in BIP 141.
heightinteger
The block height or index.
versioninteger
The block version.
versionHexstring
The block version formatted in hexadecimal.
merklerootstring
The merkle root.
txarray
An array with transaction IDs.
object
hexstring
The transaction ID.
timenumeric
The block time expressed in UNIX epoch time.
mediantimenumeric
The median block time expressed in UNIX epoch time.
noncenumeric
Number that miners adjust in order to find a block hash that meets the network's specified difficulty target.
bitsstring
The value of the nBits field in the block header.
difficultynumber
The estimated amount of work done to find this block relative to the estimated amount of work done to find block 0.
chainworkstring
Expected number of hashes required to produce the current chain.
nTxinteger
The number of transactions in the block.
previousblockhashstring
The hash of the previous block.
nextblockhashstring
The hash of the next block.
errorstring
The error message, if any.
resultarray
If verbosity = 2. An array with detailed transaction information.