kaia_getTransactionByBlockNumberAndIndex
The eth_getTransactionByBlockNumberAndIndex method returns information about a transaction by block number and transaction index position. This method is similar to eth_getTransactionByBlockHashAndIndex but uses block number instead of hash, making it more convenient when working with sequential block processing or when you know the block height.
This method is particularly useful for chronological block scanning, processing transactions in ascending block order, building analytics pipelines that iterate through blocks sequentially, and querying transactions when you only know the block number. It's commonly used in blockchain indexers, transaction scanners, and data analysis tools. Note that using block numbers during potential chain reorganizations may reference different blocks than intended, so eth_getTransactionByBlockHashAndIndex is preferred when immutability is critical.
Parameters
parameter | type | description |
|---|---|---|
blockParameter | string (required) | Block number in hex or tag (latest, earliest, pending) |
transactionIndex | string (required) | Transaction index position in hex |
Return Object
The method returns a transaction object, or null if no transaction exists at the specified index or if the block doesn't exist:
field | type | description |
|---|---|---|
blockHash | string | Hash of the block containing this transaction (32 bytes) |
blockNumber | string | Block number containing this transaction (hex) |
from | string | Address of the sender (20 bytes) |
to | string | Address of the receiver (20 bytes), null for contract creation transactions |
gas | string | Gas limit provided by the sender (hex) |
gasPrice | string | Gas price provided by the sender in wei (hex), for legacy and EIP-2930 transactions |
maxFeePerGas | string | Maximum total fee per gas the sender is willing to pay (hex, in wei), for EIP-1559 transactions |
maxPriorityFeePerGas | string | Maximum priority fee per gas (tip) the sender is willing to pay (hex, in wei), for EIP-1559 transactions |
hash | string | Hash of the transaction (32 bytes) |
input | string | The data sent along with the transaction (hex-encoded). Contains the function signature and encoded parameters for contract calls |
nonce | string | Number of transactions sent by the sender prior to this one (hex) |
value | string | Value transferred in wei (hex) |
transactionIndex | string | Integer of the transaction's index position in the block (hex) |
type | string | Transaction type: 0x0 for legacy, 0x1 for EIP-2930, 0x2 for EIP-1559 |
chainId | string | Chain ID of the transaction (hex) |
v | string | ECDSA recovery id |
r | string | ECDSA signature r |
s | string | ECDSA signature s |
Request Example
Response Example