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 blockHash from 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

#NameTypeRequiredDescription
1blockHashstring (hex)YesThe hash of the block to retrieve.
2includeTransactionsbooleanYesWhen true, transactions[] contains full transaction objects. When false, only hashes.

Response

TypeDescription
object | nullBlock 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

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getBlockByHash",
"params": [
"0x0000000000000000000000000000000000000000000000000000000000000000",
false
],
"id": 1
}'

Try it live in the BNB Smart Chain playground.

Errors & troubleshooting

CodeMessageCause
-32602Invalid paramsBlock hash is malformed or not 32 bytes.

Common pitfalls

  • The includeTransactions flag must be a JSON boolean, true or false, 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

Parameters

0x-prefixed 32-byte block hash

true = full tx objects, false = tx hashes only

curl https://bsc.therpc.io/YOUR_API_KEY \
-X POST \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getBlockByHash","params":["",""]}'

Ready to call this in production?

Free tier covers personal projects. Pay-as-you-go scales without a card.