The eth_getTransactionReceipt method is a fundamental Ethereum JSON-RPC API call used to retrieve detailed information about the execution outcome of a transaction. By providing a transaction hash, developers can obtain a comprehensive receipt that reveals whether a transaction succeeded or failed, how much gas was consumed, whether a smart contract was deployed, and what logs were generated during execution.
This method is essential for blockchain developers, auditors, and dApp operators who need to monitor on-chain activity with precision. It plays a critical role in confirming finality and verifying smart contract interactions—especially after sending transactions that trigger complex logic or deploy new contracts.
👉 Discover powerful Ethereum tools to test eth_getTransactionReceipt in real time.
Understanding the Transaction Receipt
A transaction receipt is not the same as a transaction object. While the transaction contains data about the sender, recipient, value, and input, the receipt becomes available only after the transaction has been mined and included in a block. It provides post-execution details that are crucial for debugging and validation.
Key Fields in the Response
blockHash— The hash of the block in which the transaction was confirmed. This field isnullif the transaction is still pending.blockNumber— The number of the block where the transaction was processed. Alsonullfor unconfirmed transactions.contractAddress— If the transaction created a new smart contract, this field returns the contract’s Ethereum address. Otherwise, it remainsnull.cumulativeGasUsed— Total gas used in the block up to and including this transaction. Useful for understanding gas consumption order within a block.effectiveGasPrice— The actual price per unit of gas paid by the sender, particularly relevant in EIP-1559 transactions where base fees and priorities apply.from— The Ethereum address of the sender.gasUsed— The exact amount of gas consumed by this specific transaction.logs— An array of log entries emitted by smart contracts during execution. These are vital for tracking events like token transfers (Transferevents) or state changes.logsBloom— A bloom filter encoding the logs, allowing lightweight clients to efficiently check if certain logs exist without downloading full block data.status— Indicates success (1) or failure (0). A failed transaction may have used gas but did not alter the intended state.to— The recipient address. For contract creation transactions, this isnull.transactionHash— Unique identifier of the transaction.transactionIndex— Position of the transaction within the block.type— Transaction type:0for legacy,2for EIP-1559 (most common today), indicating fee market dynamics.
These fields make eth_getTransactionReceipt indispensable for building reliable blockchain applications.
Practical Use Cases
One of the most important use cases of eth_getTransactionReceipt is verifying contract deployment success. When deploying a smart contract via a transaction, there's no immediate guarantee it will succeed—even if the transaction appears on-chain.
For example:
- A deployment might run out of gas during initialization.
- Constructor logic could contain a revert condition.
- External dependencies might fail silently.
By checking the status field and the presence of a contractAddress, developers can programmatically confirm whether a contract was successfully deployed.
Other key applications include:
- Monitoring dApp user actions (e.g., NFT mints, token approvals).
- Auditing transaction outcomes in DeFi protocols.
- Indexing blockchain events using
logs. - Reconciling off-chain systems with on-chain results.
👉 See how you can interact with Ethereum receipts using advanced developer tools.
Code Example: Verifying Transactions with ethers.js
Below is a practical implementation using ethers.js and Chainstack’s provider to fetch and interpret a transaction receipt:
const { ethers } = require("ethers");
// Connect to Ethereum mainnet via Chainstack
const provider = new ethers.JsonRpcProvider("YOUR_CHAINSTACK_ENDPOINT");
async function verifyTransaction(transactionHash) {
try {
// Fetch the transaction receipt
const receipt = await provider.send("eth_getTransactionReceipt", [
transactionHash,
]);
if (!receipt) {
console.log(`🔍 Transaction ${transactionHash} is still pending...`);
return;
}
console.log(`📌 Transaction confirmed in block #${receipt.blockNumber}`);
if (receipt.status === "0x1" || receipt.status === true) {
console.log(`✅ Success: Transaction ${transactionHash} succeeded.`);
if (receipt.contractAddress) {
console.log(
`🚀 Smart contract deployed at: ${receipt.contractAddress}`
);
} else {
console.log(`💸 This was a standard transfer or function call.`);
}
console.log(`⛽ Gas used: ${receipt.gasUsed}`);
} else {
console.log(`❌ Failed: Transaction ${transactionHash} reverted.`);
}
if (receipt.logs && receipt.logs.length > 0) {
console.log(`📝 ${receipt.logs.length} log(s) found. Processing events...`);
// Process logs here (e.g., decode ERC-20 Transfer events)
}
} catch (error) {
console.error("Error fetching receipt:", error);
}
}
// Example usage
verifyTransaction(
"0x2761f74e2f45d981a9d7553cbbcfbcc862cae416eb37a820300d4c19516d6fca"
);This script demonstrates how to:
- Query a receipt using a JSON-RPC call.
- Handle pending vs. confirmed states.
- Interpret success/failure.
- Detect contract creation.
- Prepare for event log processing.
Frequently Asked Questions
Q: When should I use eth_getTransactionReceipt instead of eth_getTransactionByHash?
A: Use eth_getTransactionByHash to get details before execution (like nonce, gas price). Use eth_getTransactionReceipt after mining to check outcome, logs, and status.
Q: Why is my transaction receipt null?
A: A null response means the transaction hasn’t been included in a block yet. Wait a few seconds and retry—especially on high-congestion networks.
Q: Can I detect token transfers using the receipt?
A: Yes! Token transfers emit Transfer events stored in the logs array. You can decode these logs to extract from, to, and value.
Q: Does a successful status mean my smart contract function worked correctly?
A: Not always. A status of 1 means no reverts occurred, but business logic errors (e.g., incorrect amounts) won't affect this flag. Always validate expected outcomes separately.
Q: How fast should I poll for a receipt?
A: Start checking every 2–3 seconds. On Ethereum, average block times are ~12 seconds. Over-polling can lead to rate-limiting on public nodes.
👉 Start testing your own receipt queries with fast, reliable node access.
Core Keywords
eth_getTransactionReceipt- Ethereum transaction receipt
- JSON-RPC API Ethereum
- verify Ethereum transaction
- smart contract deployment verification
- Ethereum logs
- transaction status check
- blockchain receipt data
These keywords reflect high-intent search queries from developers looking to debug, monitor, or integrate Ethereum-based systems—making them ideal for SEO optimization without compromising readability.
With proper implementation and monitoring workflows using eth_getTransactionReceipt, developers can build robust, transparent, and trustworthy decentralized applications.