eth_getTransactionByHash - Polygon

Polygon API - Returns the information about a transaction requested by transaction hash. In the response object, blockHash, blockNumber, and transactionIndex are null when the transaction is pending.

Parameters

DATA, 32 Bytes - hash of a transaction

params: [
    "0x9231efdb89bdd07245c598f41a1dae91a4b7e77dc223721c5c92b45b2cc2ded3"
]

Returns

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://polygon.api.watchdata.io/node/jsonrpc?api_key=your_api_key
-X POST \
-H "Content-Type: application/json" \
-d'{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0x9231efdb89bdd07245c598f41a1dae91a4b7e77dc223721c5c92b45b2cc2ded3"],"id":0}'

Result

{
    "jsonrpc": "2.0",
    "id": 0,
    "result": {
        "hash": "0x9231efdb89bdd07245c598f41a1dae91a4b7e77dc223721c5c92b45b2cc2ded3",
        "nonce": "0xc740",
        "transactionIndex": "0x3a",
        "from": "0xaa26d58df560fad003738596a3a2bf9c910bfb2b",
        "to": "0x4e8966f70fb15f2dfd636610aaa8414dc573a61a",
        "value": "0x0",
        "gasPrice": "0x7029f90df",
        "gas": "0x24f0c",
        "maxFeePerGas": null,
        "maxPriorityFeePerGas": null,
        "input": "0xcf378343000000000000000000000000aa26d58df560fad003738596a3a2bf9c910bfb2b0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000004b687474703a2f2f6170692e7975616e7368752e6172742f75706c6f6164732f70726f647563742f31643234313537363337326636373933373837636364633737326135363330622e6a7067000000000000000000000000000000000000000000",
        "v": "0x0",
        "r": "0x7cb3504c493cb96dc92056aa1fdf1dea8444c0758d1f6bd29417202f7a29314f",
        "s": "0x3bc7980400747474d4522732a782b10a9aec6f3e1430db9457291abb2595c6d7",
        "chainId": "0x89",
        "accessList": null,
        "blockHash": "0x8d9120cedf65b970b951c4b7a67c20075f32359bf19e310ecd1118d11a12bc69",
        "blockNumber": "0x1d763ed"
    }
}

Last updated