Skip to main content

eth_getTransactionByHash

Returns information about a transaction for a given hash.

For Growth and Custom service plans

This JSON-RPC method allows a request to be forwarded to a partner service provider if Infura should experience a service issue or outage. See Failover protection and Enable API request forwarding for complete details.

If you would like failover protection but don't qualify under your current plan, then either self-upgrade to the Growth plan or contact a sales representative to upgrade to a Custom plan.

Parameters

transaction hash: [Required] A string representing the hash (32 bytes) of a transaction.

Returns

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

  • accessList: [optional] A list of addresses and storage keys accessed by the transaction. See access list transactions.
  • blockHash: 32 bytes. A 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.
  • 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. 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. 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.
  • type: The transaction type.
  • v: The ECDSA recovery ID.
  • value: The value transferred in Wei.

Example

Replace <YOUR-API-KEY> with an API key from your Infura dashboard.

Request

curl https://polygon-mainnet.infura.io/v3/<YOUR-API-KEY> \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "eth_getTransactionByHash", "params": ["0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0"], "id": 1}'

Response

{
"id": 1,
"jsonrpc": "2.0",
"result": {
"blockHash": "0xb3b20624f8f0f86eb50dd04688409e5cea4bd02d700bf6e79e9384d47d6a5a35",
"blockNumber": "0x5bad55",
"chainId": "0x1",
"from": "0x398137383b3d25c92898c656696e41950e47316b",
"gas": "0x1d45e",
"gasPrice": "0xfa56ea00",
"hash": "0xbb3a336e3f823ec18197f1e13ee875700f08f03e2cab75f0d0b118dabb44cba0",
"input": "0xf7d8c88300000000000000000000000000000000000000000000000000000000000cee6100000000000000000000000000000000000000000000000000000000000ac3e1",
"nonce": "0x18",
"r": "0x2a378831cf81d99a3f06a18ae1b6ca366817ab4d88a70053c41d7a8f0368e031",
"s": "0x450d831a05b6e418724436c05c155e0a1b7b921015d0fbc2f667aed709ac4fb5",
"to": "0x06012c8cf97bead5deae237070f9587f8e7a266d",
"transactionIndex": "0x11",
"type": "0x0",
"v": "0x25",
"value": "0x1c6bf526340000"
}
}