BNB Smart Chain
eth_getTransactionByBlockHashAndIndex
Within any BNB Smart Chain block, transactions are stored in a fixed order, and eth_getTransactionByBlockHashAndIndex reaches one of them by its position. Give the method a 32-byte block hash plus a zero-based hex index and it returns that single transaction object, or null when the block or slot does not exist. Because BNB Smart Chain pays its validators in BNB and finalizes blocks in around three seconds under PoSA, addressing a transaction by block hash pins it to one specific, immutable block. Route the lookup through https://bsc.therpc.io/YOUR_API_KEY on chain ID 56.
Use cases
- Walk a known BSC block end to end by incrementing the index from
0x0until the method returnsnull. - Pull the very first transaction in a block to study how the validator ordered it and reason about MEV on chain 56.
- Resolve a transaction you only know by its block-and-position reference, rather than starting from its own hash.
Parameters
| # | Name | Type | Required | Description |
|---|---|---|---|---|
| 1 | blockHash | string (hex) | Yes | The hash of the block containing the transaction. |
| 2 | transactionIndex | string (hex) | Yes | Zero-based position of the transaction within the block. |
Response
| Type | Description |
|---|---|
| object | null | Same transaction object as eth_getTransactionByHash. Returns null if block or index not found. |
Example request
Try it live in the BNB Smart Chain playground.
Errors & troubleshooting
| Code | Message | Cause |
|---|---|---|
-32602 | Invalid params | Block hash or transaction index is malformed. |
Common pitfalls
- The index argument is hex-encoded, so the first transaction is
"0x0"— passing a bare integer0will be rejected as malformed. - Request an index past the last transaction and you simply get
nullback rather than an error, so guard against the null before reading fields.
Supported networks
- Mainnet — Chain ID: 56
- Testnet — Chain ID: 97
See also
- eth_getTransactionByHash
- eth_getTransactionByBlockNumberAndIndex
- eth_getBlockByHash
- eth_getTransactionReceipt
Parameters
0x-prefixed 32-byte block hash
0x-prefixed hex integer (e.g. "0x0" for the first transaction)