curl --request POST \
--url https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0xb924949599154a6997da37c43f97912dcc00e3e27b19ea0caf516a402c76886a"
]
}'
{
"jsonrpc": "<string>",
"id": 123,
"result": {}
}
curl --request POST \
--url https://bsc-mainnet.core.chainstack.com/35848e183f3e3303c8cfeacbea831cab \
--header 'Content-Type: application/json' \
--data '{
"id": 1,
"jsonrpc": "2.0",
"method": "eth_getTransactionReceipt",
"params": [
"0xb924949599154a6997da37c43f97912dcc00e3e27b19ea0caf516a402c76886a"
]
}'
{
"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("0x4cdc1e231274ffd15a30384eab7f45c9e42cd5aaa79d874f1cd23c52dfabe4b8")
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.The transaction receipt
The response is of type object
.