⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash, including contract events and execution status.

When to Use This Method

Use eth_getTransactionReceipt to:

  • Confirm Transaction Success - Check if transaction was executed successfully
  • Get Contract Events - Access emitted logs and events
  • Track Gas Usage - See actual gas consumed
  • Monitor Cross-Chain Status - Verify omnichain operations
  • Get Contract Address - For contract deployments

Parameters

  1. Transaction Hash - DATA, 32 Bytes
    • Hash of the transaction
{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0xab3e45b76bb6bc87485e190a3d4c8e2e370806e490f2024d62b53a05e0a2a2b0"
],
"id": 1
}

Returns

Receipt object or null if not found:

  • status - 0x1 (success) or 0x0 (failure)
  • blockHash - Hash of the block
  • blockNumber - Block number
  • transactionHash - Transaction hash
  • transactionIndex - Position in block
  • from - Sender address
  • to - Receiver address
  • contractAddress - Created contract address (if applicable)
  • cumulativeGasUsed - Total gas used in block up to this transaction
  • gasUsed - Gas used by this transaction
  • effectiveGasPrice - Actual gas price paid
  • logs - Array of log objects
  • logsBloom - Bloom filter for logs
  • type - Transaction type

Implementation Examples

curl -X POST https://api-xdc-mainnet.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0xab3e45b76bb6bc87485e190a3d4c8e2e370806e490f2024d62b53a05e0a2a2b0"
],
"id": 1
}'

Example Response

{
"jsonrpc": "2.0",
"id": 1,
"result": {
"status": "0x1",
"blockHash": "0xa957d47df264a31badc3ae823ab19cf626b1b76b013ce3cb5fc9dab3705b415a",
"blockNumber": "0x5daf3b",
"transactionHash": "0xab3e45b76bb6bc87485e190a3d4c8e2e370806e490f2024d62b53a05e0a2a2b0",
"transactionIndex": "0x40",
"from": "0xa7d9ddbe1f17865597fbd27ec712455208b6b76d",
"to": "0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb",
"contractAddress": null,
"cumulativeGasUsed": "0x33bc",
"gasUsed": "0x4dc",
"effectiveGasPrice": "0x4a817c800",
"logs": [
{
"address": "0xf02c1c8e6114b1dbe8937a39260b5b0a374432bb",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000a7d9ddbe1f17865597fbd27ec712455208b6b76d",
"0x000000000000000000000000f28c0498117e19fd0fa85a6feec6114e260cabc9"
],
"data": "0x0000000000000000000000000000000000000000000000000f3dbb76162000",
"blockNumber": "0x5daf3b",
"transactionHash": "0xab3e45b76bb6bc87485e190a3d4c8e2e370806e490f2024d62b53a05e0a2a2b0",
"transactionIndex": "0x40",
"blockHash": "0xa957d47df264a31badc3ae823ab19cf626b1b76b013ce3cb5fc9dab3705b415a",
"logIndex": "0x0",
"removed": false
}
],
"logsBloom": "0x00000000000000000000000000000000...",
"type": "0x2"
}
}

Common Use Cases

Transaction Success Verification

async function verifyTransactionSuccess(txHash) {
const receipt = await provider.getTransactionReceipt(txHash);

if (!receipt) {
return { status: 'pending', message: 'Transaction not yet mined' };
}

if (receipt.status === 1) {
return {
status: 'success',
blockNumber: receipt.blockNumber,
gasUsed: receipt.gasUsed,
effectiveGasPrice: receipt.effectiveGasPrice
};
} else {
return {
status: 'failed',
blockNumber: receipt.blockNumber,
gasUsed: receipt.gasUsed,
reason: 'Transaction reverted'
};
}
}

Event Processing

function processTransactionEvents(receipt) {
const events = [];

for (const log of receipt.logs) {
events.push({
address: log.address,
eventSignature: log.topics[0],
indexed: log.topics.slice(1),
data: log.data,
blockNumber: log.blockNumber,
logIndex: log.logIndex
});
}

return events;
}

Best Practices

  1. Check receipt status before processing
  2. Wait for confirmations for important transactions
  3. Handle null receipts for pending transactions
  4. Decode logs using contract ABI
  5. Monitor gas usage for optimization