BNB Smart Chain
BNB Smart Chain
eth_getBlockByHash
Given a 32-byte block hash, eth_getBlockByHash returns the full record of that BNB Smart Chain block: header fields, gas accounting, plus either transaction hashes or whole transaction objects. BSC is a PoSA-secured EVM that pays fees in BNB, and its validators seal blocks with no uncles. A hash therefore pins one canonical block and nothing else. Send the lookup to https://bsc.therpc.io/YOUR_API_KEY at chain ID 56. You get that exact block's contents back, or null when no block carries the supplied hash.
Use cases
- Expand a block hash you already hold, say the
blockHashfrom a transaction receipt, into the full block record. - Spot a reorg by checking whether the hash you stored for a height still resolves on the node. Under PoSA finality, a finalized BSC block should never change.
- Pull gas metrics and the validator/miner field from one specific canonical block's header.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | Yes | The hash of the block to retrieve. |
| 2 | includeTransactions | boolean | Yes | When true, transactions[] contains full transaction objects. When false, only hashes. |
Response
| Type | Description |
|---|---|
| object | null | Block object with fields: number, hash, parentHash, timestamp, miner, gasUsed, gasLimit, baseFeePerGas, transactions, uncles, withdrawals, stateRoot, receiptsRoot, transactionsRoot, logsBloom, extraData, size, difficulty, totalDifficulty, mixHash, nonce, sha3Uncles. Returns null if no block was foun |
Example request
Try it live in the BNB Smart Chain playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32602 | Invalid params | Block hash is malformed or not 32 bytes. |
Common pitfalls
- The
includeTransactionsflag must be a JSON boolean,trueorfalse, never the quoted string"true", or the node rejects the params. - Set to
true, a full block from a busy BSC slot can run past 1 MB. Stream the response or fall back to hash-only mode where bandwidth is tight. - An unknown hash yields
null, not an error, so null-check the result before reading any field off it.
Supported networks
- Mainnet — Chain ID: 56
- Testnet — Chain ID: 97
See also
- eth_getBlockByNumber
- eth_getBlockReceipts
- eth_getTransactionByHash
- eth_getBlockTransactionCountByHash
Parameters
0x-prefixed 32-byte block hash
true = full tx objects, false = tx hashes only