💎 Ethereum
eth_getTransactionByBlockNumberAndIndex

eth_getTransactionByBlockNumberAndIndex RPC Method

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

Parameters

  • blockNumber or Tag - String - Block number as hexadecimal or the Tag ("latest", "earliest", "pending", "safe" or "finalized").

"Safe" and "finalized" are only availible on Ethereum and Arbitrum One chains. Read block parameter description (opens in a new tab).

  • Index - An integer of the transaction index position encoded as a hexadecimal

Returns

  • blockHash - 32 Bytes - The hash of the block including this transaction. Null when it's pending.

  • blockNumber - The number of the block including this transaction. Null when it's pending.

  • from - The address of the sender.

  • gas - The gas provided by the sender.

  • gasPrice - The gas price provided by the sender in wei.

  • maxFeePerGas - The maximum fee per gas set in the transaction.

  • maxPriorityFeePerGas - The maximum priority gas fee set in the transaction.

  • hash - The hash of the transaction.

  • input - The data sent along with the transaction.

  • nonce - The number of transactions made by the sender before this one.

  • to - The address of the receiver. null when it's a contract creation transaction.

  • transactionIndex - The index position of the transaction in the block. Null when it's pending.

  • value - The value transferred in wei encoded as hexadecimal.

  • type - The transaction type.

  • accesslist - A list of addresses and storage keys that the transaction plans to access.

  • chainId - The chain id of the transaction, if any.

  • v [optional] - ECDSA recovery ID.

  • r - The R field of the signature.

  • s - The S field of the signature

Request

POST https://<network>.chainnodes.org/YOUR-API-KEY

Example

💡

Confusing? Ask blockchain developers in Chainnodes Telegram Chat (opens in a new tab)

  • HTTPS POST Request with a JSON RPC call in the body
  • Replace YOUR-API-KEY with the API key from your Chainnodes.org Dashboard
  • You can use a different supported network by replacing mainnet
curl https://mainnet.chainnodes.org/YOUR-API-KEY \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params": ["0x102D128", "0x0"],"id":1}'

Body

{
   "jsonrpc": "2.0",
   "id": 1,
   "result": {
      "blockHash": "0xb9506a98b3b9a4d628fd492967108b335e3b65e5933c5818ac9b93db18235e81",
      "blockNumber": "0x102d128",
      "from": "0xdd8ef55055e01d39cb87571bd38c43ab9b5903a5",
      "gas": "0x3c5f2",
      "gasPrice": "0x4dd6b5805",
      "maxPriorityFeePerGas": "0x0",
      "maxFeePerGas": "0x4dd6b5805",
      "hash": "0x0761f87fe97b821ca569543c0fe43f006d69413058b5c2558c08b90250ae7aa1",
      "input": "0x0002060102d12800000000010e8ca7f2e786a6020788e6a0c2ddd26feeb64f039a2c41296fcb3f56400000000000005baf6520a2fd318ebb1940b305f9ff82000000000000000bab399f6b7d6655f40000000000005bb66131c678100c0d6e7631bfb0008201000001f400000000000000000000005ae662c41d000000234d8692bd79a02ada5136c7861f74cf",
      "nonce": "0x7894",
      "to": "0xf8b721bff6bf7095a0e10791ce8f998baa254fd0",
      "transactionIndex": "0x0",
      "value": "0x0",
      "type": "0x2",
      "accessList": [],
      "chainId": "0x1",
      "v": "0x0",
      "r": "0xa0bd9077314b407c00958f5704b1c86a81245c9e90204dbd18f606c745f05f68",
      "s": "0x5c9721e9411fc6be4a06f6f4eb2ed3da553a7273a3c51ba82dd6a2cdc69e3b83"
   }
}

Need RPC API keys?

Get 12.5M archival requests for free today.