eth_getTransactionReceipt

Ethereum RPC

Overview

The eth_getTransactionReceipt is an Ethereum JSON-RPC method that retrieves the transaction receipt of a given transaction hash. This method is particularly useful when you need to obtain detailed information about a transaction's execution, such as its status (success or failure), gas usage, and logs (events). Common use cases include checking the status of a transaction after it has been mined or inspecting the events emitted by a smart contract during a specific transaction.

Parameters

This method requires a single parameter:

  • transactionHash: The hash of the transaction for which you want to obtain the receipt.
    • Example: "0x2a4811309750a84058d2fd1bd8dd534bf3a34039ff1b34e29f23a92dfb06449d"

Returns

The method returns an object containing the following fields:

NameDescription
transactionHashThe hash of the transaction.
transactionIndexThe transaction's index position in the block.
blockHashThe hash of the block where this transaction was mined.
blockNumberThe block number where this transaction was mined.
fromThe address of the sender.
toThe address of the receiver. null when it's a contract creation transaction.
cumulativeGasUsedThe total amount of gas used when this transaction was executed in the block.
gasUsedThe amount of gas used by this specific transaction alone.
contractAddressThe address of the contract created, if the transaction was a contract creation. Otherwise, null.
logsAn array of log objects, which were emitted during the transaction.
logsBloomA 256-byte bloom filter, which is a compressed representation of the logs emitted during the transaction.
statusThe status of the transaction's execution. "0x1" indicates success, while "0x0" indicates failure.

Request

curl --location 'https://api.tatum.io/v3/blockchain/node/ethereum-mainnet/' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {API_KEY}' \
--data '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "eth_getTransactionReceipt",
  "params": [
    "0x2a4811309750a84058d2fd1bd8dd534bf3a34039ff1b34e29f23a92dfb06449d"
  ]
}'

// yarn add @tatumio/tatum

import { TatumSDK, Ethereum, Network } from '@tatumio/tatum'

const tatum = await TatumSDK.init<Ethereum>({ network: Network.ETHEREUM })

const tx = await tatum.rpc.getTransactionReceipt(
  '0x2a4811309750a84058d2fd1bd8dd534bf3a34039ff1b34e29f23a92dfb06449d',
)

await tatum.destroy() // Destroy Tatum SDK - needed for stopping background jobs