curl --request POST \
--url https://nd-363-550-219.p2pify.com/942aad90bb6a082676497030b81e40ba \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0x0171f86491724ccacd10e67f358a240c026c60b0d48305c2c8f7ff59b5831aeb"
]
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}curl --request POST \
--url https://nd-363-550-219.p2pify.com/942aad90bb6a082676497030b81e40ba \
--header 'Content-Type: application/json' \
--data '
{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0x0171f86491724ccacd10e67f358a240c026c60b0d48305c2c8f7ff59b5831aeb"
]
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}hash — the hash identifying a transactionTransaction receipt — the receipt object with:
blockHash — the block hash. Identifies the block in which the transaction was included. This field is null for transactions that have not yet been included in a block.blockNumber — the number of the block in which the transaction was included. This field is null for transactions that have not yet been included in a block.contractAddress — the contract address created by the transaction if it was a contract creation transaction. Otherwise, the value is null.cumulativeGasUsed — the total amount of gas used in the block until this transaction was executed.effectiveGasPrice — the actual value deducted from the sender’s account for this transaction.from — the address of the sender who initiated the transaction.gasUsed — the amount of gas used by this specific transaction alone.logs — an array of log objects this transaction generates, if any. Logs are generated by smart contracts.logsBloom — the bloom filter used by light clients to quickly retrieve logs related to the transaction.status — the success status of the transaction, represented as 1 for success or 0 for failure.to — the recipient’s address of the transaction if it was a transaction to an address. For contract creation transactions, this field is null.transactionHash — the hash that uniquely identifies the transaction.transactionIndex — the index of the transaction within the block.type — the type of the transaction. 0 indicates a regular transfer; 2 indicates a contract creation or smart contract function call.eth_getTransactionReceipt code examplesconst { Web3 } = require("web3");
const NODE_URL = "CHAINSTACK_NODE_URL";
const web3 = new Web3(NODE_URL);
async function getReceipt(transactionHash) {
const receipt = await web3.eth.getTransactionReceipt(transactionHash)
console.log(receipt)
}
getReceipt("0x4efd36a7f4e98cf16e27c1d73e90612e94a383de3d358cb948c3edbb42fca024")
eth_getTransactionReceipt is to verify a transaction’s status and whether it was successful. This can be especially useful when deploying a contract, as you can use the receipt to confirm that the contract was deployed successfully and has a valid contract address.Was this page helpful?