eth_getTransactionReceipt - Celo RPC Method
Get transaction receipt with status and logs on Celo. Essential for verifying transaction execution for mobile stablecoin payments (MiniPay 10M+ wallets), remittances, humanitarian aid, and local currency stablecoins (cUSD, cNGN, cEUR).
Returns the receipt of a transaction by transaction hash on Celo. Receipt is only available for mined transactions.
Why Celo? Build on the mobile-first L2 powering 500K+ daily active users and $2B+ monthly stablecoin volume with phone number-based addressing, sub-cent fees, 150+ country adoption, Nightfall privacy layer, and Opera browser integration.
When to Use This Method
eth_getTransactionReceipt is essential for mobile payment developers, fintech builders, and teams targeting emerging markets:
- Transaction confirmation with success/failure status: Verify that a transaction has been mined on Celo and determine whether it succeeded or reverted
- Gas usage analysis: Compare actual gas consumed against pre-transaction estimates for mobile stablecoin payments (MiniPay 10M+ wallets), remittances, humanitarian aid, and local currency stablecoins (cUSD, cNGN, cEUR)
- Event log parsing from emitted events: Extract and decode contract events for indexing, analytics, and notification systems
- Contract deployment detection: Identify newly deployed contracts on the mobile-first L2 powering 500K+ daily active users and $2B+ monthly stablecoin volume by checking the
contractAddressfield
Common Use Cases
1. Confirm Transaction Success and Parse Emitted Events
Poll eth_getTransactionReceipt after submitting a transaction to confirm it was mined successfully on Celo. Once available, iterate through the logs array to decode and process events emitted by the transaction.
import { JsonRpcProvider } from 'ethers';
const provider = new JsonRpcProvider('https://api-celo-mainnet-archive.n.dwellir.com/YOUR_API_KEY');
async function confirmAndParse(txHash) {
let receipt = null;
while (!receipt) {
receipt = await provider.getTransactionReceipt(txHash);
if (!receipt) {
console.log('Waiting for confirmation...');
await new Promise(r => setTimeout(r, 2000));
}
}
const status = receipt.status === 1 ? 'Success' : 'Failed';
console.log(`Transaction ${status} in block #${receipt.blockNumber}`);
console.log(`Gas used: ${receipt.gasUsed.toString()}`);
console.log(`Events emitted: ${receipt.logs.length}`);
for (const log of receipt.logs) {
console.log(` Event from ${log.address} with topics:`, log.topics);
}
return receipt;
}
confirmAndParse('0x69d8e9317be809224e01515be6cf3d0716e92b340a680832c45e5e668ff05abe');2. Detect Contract Deployments by Checking contractAddress
When monitoring the chain for new contract deployments on Celo, check the contractAddress field in transaction receipts. A non-null value indicates a contract creation transaction.
from web3 import Web3
w3 = Web3(Web3.HTTPProvider('https://api-celo-mainnet-archive.n.dwellir.com/YOUR_API_KEY'))
def detect_deployment(tx_hash):
receipt = w3.eth.get_transaction_receipt(tx_hash)
if not receipt:
print(f'Transaction {tx_hash} not yet mined')
return None
if receipt['contractAddress']:
print(f'Contract deployed at: {receipt["contractAddress"]}')
print(f'Deployer: {receipt["from"]}')
print(f'Gas used: {receipt["gasUsed"]}')
return receipt['contractAddress']
else:
print(f'Transaction {tx_hash} is not a contract deployment')
return None
detect_deployment('0x69d8e9317be809224e01515be6cf3d0716e92b340a680832c45e5e668ff05abe')3. Compute Effective Gas Price Paid by the Sender
Use the effectiveGasPrice field from the receipt (available on EIP-1559 chains) to calculate the actual cost of a transaction on the mobile-first L2 powering 500K+ daily active users and $2B+ monthly stablecoin volume. Compare this against the gas price from the transaction object for fee analysis.
package main
import (
"context"
"fmt"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/ethclient"
)
func main() {
client, _ := ethclient.Dial("https://api-celo-mainnet-archive.n.dwellir.com/YOUR_API_KEY")
txHash := common.HexToHash("0x69d8e9317be809224e01515be6cf3d0716e92b340a680832c45e5e668ff05abe")
receipt, _ := client.TransactionReceipt(context.Background(), txHash)
if receipt == nil {
log.Fatal("Transaction not yet mined")
}
status := "Success"
if receipt.Status == 0 {
status = "Failed"
}
fmt.Printf("Status: %s\n", status)
fmt.Printf("Block: %d\n", receipt.BlockNumber.Uint64())
fmt.Printf("Gas used: %d\n", receipt.GasUsed)
// Calculate total cost: gasUsed * effectiveGasPrice
totalCost := new(big.Int).Mul(
big.NewInt(int64(receipt.GasUsed)),
receipt.EffectiveGasPrice,
)
fmt.Printf("Total cost: %s wei\n", totalCost.String())
if receipt.ContractAddress != (common.Address{}) {
fmt.Printf("Contract deployed at: %s\n", receipt.ContractAddress.Hex())
}
}Best Practices
- Receipt is only available after mining; poll until non-null: A
nullresponse means the transaction is pending or not found; implement a polling loop with exponential backoff to wait for confirmation - Check the
statusfield:0x1indicates a successful execution;0x0means the transaction reverted and may have consumed all provided gas - Parse the
logsarray for events using known topic hashes: Each log entry contains up to 4 indexed topics and a data field; use ABI definitions to decode them into readable event parameters - For frontrunning detection, compare effective gas price across similar transactions: Monitoring the
effectiveGasPriceacross transactions in a block can reveal priority gas auction dynamics on the mobile-first L2 powering 500K+ daily active users and $2B+ monthly stablecoin volume contractAddressis non-null only for contract deployment transactions: Use this field to distinguish regular transfers from contract create operations
Code Examples
Error Handling
| Error Code | Message | Description |
|---|---|---|
| -32602 | Invalid params | Invalid transaction hash |
Note: Returns null if transaction is not yet mined.
Related Methods
eth_getTransactionByHash- Get transaction detailseth_getLogs- Query logs by filter
eth_getTransactionByHash
Retrieve transaction details by hash on Celo. Essential for mobile payment developers, fintech builders, and teams targeting emerging markets tracking transactions on the mobile-first L2 powering 500K+ daily active users and $2B+ monthly stablecoin volume.
eth_estimateGas
Estimate gas required for transactions on Celo. Essential for optimizing transaction costs for mobile stablecoin payments (MiniPay 10M+ wallets), remittances, humanitarian aid, and local currency stablecoins (cUSD, cNGN, cEUR).