eth_getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

Parameters

  • QUANTITY|TAG - a block number, or the string "earliest", "latest" or "pending", as in the default block parameter.

  • QUANTITY - the transaction index position.

 params: [ 
     'latest', // 668 
     '0x0' // 0 
 ]

Returns

See eth_getTransactionByHash

Object - A transaction object, or null when no transaction was found:

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was in. null when its pending.

  • blockNumber: QUANTITY - block number where this transaction was in. null when it's pending.

  • from: DATA, 20 Bytes - address of the sender.

  • gas: QUANTITY - gas provided by the sender.

  • gasPrice: QUANTITY - gas price provided by the sender in Wei.

  • hash: DATA, 32 Bytes - hash of the transaction.

  • input: DATA - the data send along with the transaction.

  • nonce: QUANTITY - the number of transactions made by the sender prior to this one.

  • to: DATA, 20 Bytes - address of the receiver. null when it's a contract creation transaction.

  • transactionIndex: QUANTITY - integer of the transactions index position in the block. null when its pending.

  • value: QUANTITY - value transferred in Wei.

  • v: QUANTITY - ECDSA recovery id

  • r: DATA, 32 Bytes - ECDSA signature r

  • s: DATA, 32 Bytes - ECDSA signature s

Request example

curl https://ethereum.api.watchdata.io/node/jsonrpc \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["latest", "0x0"],"id":0}'

Result

{
    "id": 0,
    "jsonrpc": "2.0",
    "result": {
        "hash": "0x495255ed9278dbde17574aa7f1343ededf6971d21a853d614249006a702ac8d6",
        "nonce": "0x1",
        "transactionIndex": "0x0",
        "from_": "0xa71a0c2b94a79aef4b2a0b2907f3aa14110d2aba",
        "to": "0x9367daad7677c59b1bd30f62839abdfd06abcc3c",
        "value": "0x6312853b0ccd400",
        "gasPrice": "0x18ae17a400",
        "gas": "0xf6d3",
        "maxFeePerGas": null,
        "maxPriorityFeePerGas": null,
        "input": "0x",
        "v": "0x25",
        "r": "0xb266875604d1e74ed68c960ddc5b556c51f3bcd44f0dd9222470a47a69f2f21f",
        "s": "0x63aaf61b94e266cbf542dc0479468d3a300fc9ad2250f02fd3be7a339b85462d",
        "chainId": null,
        "accessList": [],
        "blockHash": "0x7846b2f522ffb640ab8f94c2fffd0d2cf8157595040f2b5baad575c60b7254fc",
        "blockNumber": "0xd65c96"
    }
}

Last updated