Skip to main content

eth_getTransactionByBlockNumberAndIndex

Overview

The 'eth_getTransactionByBlockNumberAndIndex' method returns information about a transaction by block number and transaction index position.

Request

curl --request POST \
--url https://ethereum-mainnet-geth-archive.node.coinapi.io \
--header 'accept: application/json' \
--header 'X-CoinAPI-Key: 73034021-THIS-IS-SAMPLE-KEY' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getTransactionByBlockNumberAndIndex"
}'

Request Parameters

  • block parameter: [ Required ] A hexadecimal block number, or the string latest, earliest or pending.
  • transaction index position: [ Required ] A hexadecimal of the integer representing the position in the block.

Response

{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32602,
"message": "expected 'params' array of at least 2 arguments"
}
}

A transaction object, or null when no transaction was found. The transaction object will consist of the following keys and their values:

  • blockHash: 32 bytes. A hash of the block including this transaction. 'null' when it's pending.
  • accessList: [ optional ] A list of addresses and storage keys accessed by the transaction.
  • blockNumber: The number of the block including this transaction. 'null' when it's pending.
  • chainID: [ optional ] chain ID specifying the network. Returned only for EIP-1559 transactions.
  • from: 20 bytes. The address of the sender.
  • gas: Gas provided by the sender.
  • gasPrice: Gas price provided by the sender in Wei.
  • hash: 32 bytes. The hash of the transaction.
  • input: The data sent along with the transaction.
  • maxPriorityFeePerGas: [ optional ] Maximum fee, in Wei, the sender is willing to pay per gas above the base fee.
  • maxFeePerGas: [ optional ] Maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas.
  • nonce: The number of transactions made by the sender prior to this one.
  • r: 32 bytes. The ECDSA signature 'r'.
  • s: 32 bytes. The ECDSA signature 's'.
  • to: 20 bytes. The address of the receiver. 'null' when it's a contract creation transaction.
  • transactionIndex: The transaction's index position in the block, in hexadecimal. 'null' when it's pending.
  • v: The ECDSA recovery ID.
  • type: The transaction type.
  • value: The value transferred in Wei.