curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getBlockReceipts",
"params": [
"latest"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
{}
]
}curl --request POST \
--url https://rpc.testnet.tempo.xyz/ \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getBlockReceipts",
"params": [
"latest"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
{}
]
}blockParameter — the block number (hex) or tag (latest, earliest, pending)result — array of receipt objects for all transactions in the block:
transactionHash — hash of the transactiontransactionIndex — index of the transaction in the blockblockHash — hash of the blockblockNumber — block numberfrom — sender addressto — recipient addresscumulativeGasUsed — total gas used in the block up to this transactiongasUsed — gas used by this transactioncontractAddress — contract address if this was a deploymentlogs — array of log objectslogsBloom — bloom filter for logsstatus — 0x1 for success, 0x0 for failureeffectiveGasPrice — actual gas price paidtype — transaction typefeeToken — (Tempo-specific) token used to pay feesfeePayer — (Tempo-specific) address that paid the feeseth_getBlockReceipts code examplesconst ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
const getBlockReceipts = async (blockNumber) => {
const receipts = await provider.send("eth_getBlockReceipts", [blockNumber]);
console.log(`Block ${blockNumber}: ${receipts.length} transactions`);
let totalGasUsed = 0n;
let successCount = 0;
let failCount = 0;
for (const receipt of receipts) {
const gasUsed = BigInt(receipt.gasUsed);
totalGasUsed += gasUsed;
if (receipt.status === "0x1") {
successCount++;
} else {
failCount++;
}
console.log(`\nTx ${receipt.transactionIndex}: ${receipt.transactionHash}`);
console.log(` Status: ${receipt.status === "0x1" ? "Success" : "Failed"}`);
console.log(` Gas Used: ${gasUsed}`);
console.log(` Logs: ${receipt.logs.length}`);
// Tempo-specific fields
if (receipt.feeToken) {
console.log(` Fee Token: ${receipt.feeToken}`);
}
if (receipt.feePayer) {
console.log(` Fee Payer: ${receipt.feePayer}`);
}
}
console.log(`\n--- Summary ---`);
console.log(`Total transactions: ${receipts.length}`);
console.log(`Successful: ${successCount}, Failed: ${failCount}`);
console.log(`Total gas used: ${totalGasUsed}`);
};
getBlockReceipts("latest");
Was this page helpful?