eth_getTransactionReceipt | Aurora

๐Ÿ“˜

No response in the interactive API

The response to the call might be too big for ReadMe to handle, so if you are not getting it here, copy the CURL example and run in your terminalโ€”this will work.

Aurora API method that retrieves a transaction's receipt from a transaction hash. It can be used to verify a transaction's success or failure, check a smart contract's execution status, retrieve logs, check if a transaction deployed a smart contract, and more.

๐Ÿ‘

Get you own node endpoint today

Start for free and get your app to production levels immediately. No credit card required.

You can sign up with your GitHub, X, Google, or Microsoft account.

Parameters

  • hash โ€” the hash identifying a transaction

Response

  • Transaction 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 examples

const { 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("0xf7db803b2aee845ace262edabf756f8265b23afd1e0596dc0333702af2d1a3dd")
const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);

const getTransactionReceipt = async (transactionHash) => {
    const receipt = await provider.send("eth_getTransactionReceipt", [transactionHash]);
     console.log(receipt);
   };

getTransactionReceipt('0xf7db803b2aee845ace262edabf756f8265b23afd1e0596dc0333702af2d1a3dd')
from web3 import Web3  
node_url = "CHAINSTACK_NODE_URL" 

web3 = Web3(Web3.HTTPProvider(node_url)) 
print(web3.eth.get_transaction_receipt("0xf7db803b2aee845ace262edabf756f8265b23afd1e0596dc0333702af2d1a3dd"))

Use case

A practical use case for 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.

Try the eth_getTransactionReceipt RPC method yourself

Language
Click Try It! to start a request and see the response here!