The eth_getTransactionReceipt method is a fundamental Ethereum JSON-RPC API endpoint that allows developers to retrieve detailed information about the outcome of a specific transaction. By providing a transaction hash, this method returns a comprehensive receipt object that reveals critical insights such as execution status, gas consumption, contract deployment details, and emitted logs. It’s an essential tool for verifying transaction success, debugging smart contract interactions, and ensuring on-chain reliability.
Whether you're deploying a smart contract, transferring tokens, or interacting with decentralized applications (dApps), confirming that a transaction was processed correctly is crucial. The receipt provides irrefutable proof of execution and enables deeper analysis of on-chain activity.
Understanding Transaction Receipts
A transaction receipt is generated only after a transaction has been mined and included in a block. Unlike the transaction object itself—which contains sender, recipient, value, and data—the receipt reflects the result of executing that transaction.
This distinction is vital: while a transaction may be broadcasted and even confirmed in a block, it can still fail during execution due to out-of-gas errors, revert conditions in smart contracts, or invalid operations. The receipt’s status field captures this final outcome.
👉 Discover how blockchain APIs power real-time transaction verification and enhance dApp performance.
Parameters
hash— A 32-byte hexadecimal string representing the unique identifier (transaction hash) of the Ethereum transaction you want to inspect.
Example: "0x2761f74e2f45d981a9d7553cbbcfbcc862cae416eb37a820300d4c19516d6fca"Response Object
When the transaction has been mined, the response returns a receipt object with the following properties:
blockHash— The hash of the block in which the transaction was included. Returnsnullif the transaction is still pending.blockNumber— The number of the block containing the transaction. Alsonullfor pending transactions.contractAddress— If the transaction created a new smart contract, this field contains the contract’s Ethereum address. Otherwise, it isnull.cumulativeGasUsed— Total gas used in the block up to and including this transaction.effectiveGasPrice— The actual gas price charged for this transaction, particularly relevant for EIP-1559 transactions where base fees may differ from priority fees.from— Address of the sender who initiated the transaction.gasUsed— Amount of gas consumed solely by this transaction.logs— Array of log entries generated by the transaction, typically emitted by smart contracts viaeventstatements.logsBloom— A bloom filter encoding the logs, enabling lightweight clients to efficiently determine whether logs are relevant without downloading full data.status— Execution status:1for success,0for failure. This is one of the most important indicators when validating outcomes.to— Recipient address. For contract creation transactions, this will benull.transactionHash— Unique identifier of the transaction.transactionIndex— Position of the transaction within the block (starting from 0).type— Transaction type:0for legacy,2for EIP-1559 (most common today).
Key Use Cases
- Verifying Transaction Success
After sending a token transfer or calling a function on a smart contract, useeth_getTransactionReceiptto confirm whether it succeeded (status: 1) or failed (status: 0). This avoids false assumptions based solely on block confirmation. - Confirming Smart Contract Deployment
When deploying a new contract, check thecontractAddressfield. If present and valid, your deployment was successful. - Extracting Event Logs
Smart contracts emit events (e.g.,Transfer,Approval). These appear in thelogsarray and can be parsed to track user actions, update frontend interfaces, or feed off-chain analytics. - Gas Usage Analysis
ComparegasUsedagainst the gas limit to optimize future transactions and reduce costs.
👉 Learn how advanced blockchain tools streamline transaction monitoring and smart contract validation.
Practical Code Example Using Ethers.js
Below is a refined version of a Node.js script using Ethers.js and Chainstack’s provider to verify a transaction's status and extract key details:
const { ethers } = require("ethers");
// Initialize Chainstack provider for Ethereum mainnet
const provider = new ethers.JsonRpcProvider("YOUR_CHAINSTACK_ENDPOINT");
async function verifyTransaction(transactionHash) {
try {
// Fetch transaction receipt
const receipt = await provider.send("eth_getTransactionReceipt", [
transactionHash,
]);
if (!receipt) {
console.log(`🔍 Transaction ${transactionHash} is still pending...`);
return;
}
console.log(`📦 Block Number: ${parseInt(receipt.blockNumber)}`);
console.log(`⛽ Gas Used: ${receipt.gasUsed}`);
console.log(`📌 Status: ${receipt.status === "0x1" ? "✅ Success" : "❌ Failed"}`);
if (receipt.status === "0x1") {
if (receipt.contractAddress) {
console.log(`🎯 New contract deployed at: ${receipt.contractAddress}`);
} else {
console.log(`🔄 This was a standard transaction or function call.`);
}
if (receipt.logs.length > 0) {
console.log(`📝 Found ${receipt.logs.length} log(s).`);
// Further parsing can decode event data here
}
} else {
console.log(`💥 Transaction failed. Check logic or gas settings.`);
}
} catch (error) {
console.error("Error fetching receipt:", error.message);
}
}
// Example usage
verifyTransaction(
"0x2761f74e2f45d981a9d7553cbbcfbcc862cae416eb37a820300d4c19516d6fca"
);This script demonstrates robust error handling, clear output formatting, and conditional checks that reflect real-world development needs.
Frequently Asked Questions
Q: What does it mean if eth_getTransactionReceipt returns null?
A: A null response means the transaction has not yet been included in a block—it’s still pending. You should retry the call after a short delay.
Q: Can I get revert reasons from the receipt?
A: No. The receipt only shows status: 0 for failures. To retrieve human-readable revert messages, you need to simulate the call off-chain using tools like Tenderly or Alchemy’s debug APIs.
Q: Is eth_getTransactionReceipt available on all Ethereum nodes?
A: Yes, it's part of the standard JSON-RPC specification and supported by all compliant Ethereum clients (Geth, Nethermind, etc.) and infrastructure providers.
Q: How soon after sending a transaction can I expect a receipt?
A: Typically within 1–15 seconds on Ethereum mainnet, depending on network congestion and gas price. However, finality requires multiple confirmations.
Q: Does every transaction generate a receipt?
A: Only after being mined. Pending transactions do not have receipts. Once confirmed, the receipt becomes part of the blockchain's immutable record.
Core Keywords
eth_getTransactionReceipt- Ethereum transaction receipt
- verify Ethereum transaction
- smart contract deployment check
- Ethereum JSON-RPC
- blockchain transaction status
- fetch transaction logs
- Ethereum API
With growing demand for transparency and reliability in decentralized systems, mastering methods like eth_getTransactionReceipt empowers developers to build more resilient and user-trustworthy applications.
👉 Access powerful blockchain APIs that simplify Ethereum interaction and accelerate dApp development.