📝 eth_getTransactionReceipt - Base Chain
What This Method Does
The eth_getTransactionReceipt
method retrieves the receipt of a transaction on Base, which contains details about its execution results, including success/failure status, gas used, and any events (logs) emitted.
Transaction receipts are not available for pending transactions - only for transactions that have been included in a block.
💡 Think of a receipt like a confirmation slip that tells you if your transaction succeeded, how much gas it actually used, and what happened during execution.
Parameters
Parameter | What to Provide |
---|---|
transactionHash | The unique hash/ID of the transaction (66 characters, starts with "0x") |
What You'll Get Back
You'll receive a transaction receipt object with these important fields:
Field | What It Tells You |
---|---|
status | If your transaction succeeded (0x1 ) or failed (0x0 ) |
blockNumber & blockHash | Which block contains this transaction |
from & to | The sender and receiver addresses |
contractAddress | If a new contract was created, its address (otherwise null ) |
gasUsed | How much gas your transaction actually consumed |
effectiveGasPrice | The actual price paid per unit of gas |
logs | Events emitted during the transaction (crucial for tracking what happened) |
logsBloom | A filter that helps quickly check if specific events might be in the logs |
type | Transaction type (0=legacy, 1=EIP-2930, 2=EIP-1559) |
How To Use It
POST https://base-mainnet.chainnodes.org/YOUR-API-KEY
Example Request
- HTTPS POST Request with a JSON RPC call in the body
- Replace YOUR-API-KEY with the API key from your Chainnodes.org Dashboard
- You can use a different supported network by replacing
base-mainnet
curl https://base-mainnet.chainnodes.org/YOUR-API-KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params": ["0xf02e0576a830ab37f2eb1c43ed3fbcaa53d84bf5ca985ae60c71f5cac27f4cc3"],"id":1}'
Example Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0x54751c3cb4f7c95b249ab5ed702a708a6782cc937b1d399f25be4b40d9e0f5d4",
"blockNumber": "0x57e450",
"contractAddress": null,
"cumulativeGasUsed": "0x3362",
"effectiveGasPrice": "0xe12c5d1dc",
"from": "0xad89a377e302791fb523ffb427f3f480cad3a72c",
"gasUsed": "0x3362",
"logs": [
{
"address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000ad89a377e302791fb523ffb427f3f480cad3a72c",
"0x0000000000000000000000006b175474e89094c44da98b954eedeac495271d0f"
],
"data": "0x000000000000000000000000000000000000000000000034f086f3b33b684000",
"blockNumber": "0x57e450",
"transactionHash": "0xf02e0576a830ab37f2eb1c43ed3fbcaa53d84bf5ca985ae60c71f5cac27f4cc3",
"transactionIndex": "0x0",
"blockHash": "0x54751c3cb4f7c95b249ab5ed702a708a6782cc937b1d399f25be4b40d9e0f5d4",
"logIndex": "0x0",
"removed": false
}
],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"transactionHash": "0xf02e0576a830ab37f2eb1c43ed3fbcaa53d84bf5ca985ae60c71f5cac27f4cc3",
"transactionIndex": "0x0",
"type": "0x2"
}
}
Common Use Cases
✅ Check If Your Transaction Succeeded
The most common use is to verify if your transaction was successful:
// Get the receipt for your transaction
const receipt = await eth.getTransactionReceipt('0xYourTransactionHash');
// Check the status (0x1 = success, 0x0 = failure)
if (receipt.status === '0x1') {
console.log('Transaction succeeded!');
} else {
console.log('Transaction failed!');
}
// See how much gas was actually used (in decimal)
const gasUsed = parseInt(receipt.gasUsed, 16);
console.log(`Gas used: ${gasUsed}`);
🔎 Find New Contract Addresses
When deploying contracts, use this method to find the address of your newly deployed contract:
// After sending a contract creation transaction
const receipt = await eth.getTransactionReceipt('0xContractDeploymentTxHash');
// Get the new contract's address
const newContractAddress = receipt.contractAddress;
console.log(`Contract deployed at: ${newContractAddress}`);
📊 Read Token Transfer Events
Token transfers emit specific events that you can find in the transaction logs:
// Look for ERC-20 Transfer events
const receipt = await eth.getTransactionReceipt('0xTokenTransferTxHash');
// ERC-20 Transfer event topic (keccak256 hash of Transfer(address,address,uint256))
const transferEventTopic = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef';
// Find Transfer events in the logs
const transferLogs = receipt.logs.filter(log =>
log.topics[0] === transferEventTopic
);
// Extract transfer details
transferLogs.forEach(log => {
// Format: [eventSignature, from, to, <value in data field>]
const fromAddress = '0x' + log.topics[1].slice(26); // Remove padding
const toAddress = '0x' + log.topics[2].slice(26); // Remove padding
const valueHex = log.data;
const valueDecimal = parseInt(valueHex, 16);
console.log(`Transfer from: ${fromAddress}`);
console.log(`Transfer to: ${toAddress}`);
console.log(`Amount: ${valueDecimal}`);
});
🧮 Calculate Transaction Fee
Calculate exactly how much you paid for a transaction on Base:
// Get the receipt
const receipt = await eth.getTransactionReceipt('0xYourTransactionHash');
// Calculate fee: gasUsed × effectiveGasPrice
const gasUsed = parseInt(receipt.gasUsed, 16);
const gasPrice = parseInt(receipt.effectiveGasPrice, 16);
const feeWei = gasUsed * gasPrice;
const feeETH = feeWei / 1000000000000000000; // Convert to ETH
console.log(`Transaction fee: ${feeETH} ETH`);
Related Methods
- eth_getTransactionByHash - Get the transaction details without execution results
- eth_call - Test a transaction without committing it to the blockchain
- eth_getBlockByNumber - Get information about a block and its transactions
JSON-RPC Base API Documentation by CHAINNODES is based on Reth node client. Contact us if you are interested in specific methods that are only available on geth, besu, Nethermind or Erigon