eth_getTransactionByBlockHashAndIndex
Returns information about a transaction by block hash and transaction index position.

REQUEST

1
POST https://<network>.infura.io/v3/YOUR-PROJECT-ID
Copied!

HEADERS

1
Content-Type: application/json
Copied!

REQUEST PARAMS

  • BLOCK HASH [required] - a string representing the hash (32 bytes) of a block
  • TRANSACTION INDEX POSITION [required] - a hex of the integer representing the position in the block

EXAMPLE

1
## JSON-RPC over HTTPS POST
2
## Replace YOUR-PROJECT-ID with a Project ID from your Infura Dashboard
3
## You can also replace mainnet with a different supported network
4
curl https://mainnet.infura.io/v3/YOUR-PROJECT-ID \
5
-X POST \
6
-H "Content-Type: application/json" \
7
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35","0x0"],"id":1}'
8
9
## JSON-RPC over WSS
10
## Replace YOUR-PROJECT-ID with a Project ID from your Infura Dashboard
11
## You can also replace mainnet with a different supported network
12
wscat -c wss://mainnet.infura.io/ws/v3/YOUR-PROJECT-ID
13
>{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params": ["0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35","0x0"],"id":1}
Copied!

RESPONSE

RESULT FIELDS

  • TRANSACTION - A transaction object, or null when no transaction was found
    • accessList: [optional] list of addresses and storage keys the transaction plans to access. See access list transactions.
    • blockHash: 32 Bytes - hash of the block including this transaction. null when it's pending.
    • blockNumber: 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 - address of the sender.
    • gas: gas provided by the sender.
    • gasPrice: gas price provided by the sender in Wei.
    • hash: 32 Bytes - 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. See EIP-1559 transactions.
    • maxFeePerGas: [optional] maximum total fee (base fee + priority fee), in Wei, the sender is willing to pay per gas. See EIP-1559 transactions.
    • nonce: the number of transactions made by the sender prior to this one.
    • r: 32 Bytes - ECDSA signature r.
    • s: 32 Bytes - ECDSA signature s.
    • to: 20 Bytes - 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.
    • type: the transaction type.
    • v: ECDSA recovery ID.
    • value: value transferred in Wei.

BODY

1
{
2
"jsonrpc": "2.0",
3
"id": 1,
4
"result": {
5
"blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
6
"blockNumber": "0x5bad55",
7
"from": "0xfbb1b73c4f0bda4f67dca266ce6ef42f520fbb98",
8
"gas": "0x249f0",
9
"gasPrice": "0x174876e800",
10
"hash": "0x8784d99762bccd03b2086eabccee0d77f14d05463281e121a62abfebcf0d2d5f",
11
"input": "0x6ea056a9000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000bd8d7fa6f8cc00",
12
"nonce": "0x5e4724",
13
"r": "0xd1556332df97e3bd911068651cfad6f975a30381f4ff3a55df7ab3512c78b9ec",
14
"s": "0x66b51cbb10cd1b2a09aaff137d9f6d4255bf73cb7702b666ebd5af502ffa4410",
15
"to": "0x4b9c25ca0224aef6a7522cabdbc3b2e125b7ca50",
16
"transactionIndex": "0x0",
17
"type": "0x0",
18
"v": "0x25",
19
"value": "0x0"
20
}
21
}
Copied!
Copy link