eth_getTransactionReceipt - Ethereum

Shows a receipt of a transaction with a transaction’s hash entered. It won’t be shown in cases of pending transactions

How to Use the eth_getTransactionReceipt Method

It is a useful call if you need to track the transaction’s status as far as it shows null until the successful result appears. Another function is an ability to see the contact address if you need to create a smart contact.

Parameters

DATA, 32 Bytes - hash of a transaction params:

[ 
    '0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b' 
]

What you receive

Object - A receipt of the transaction or null if the transaction was not finished:

  • transactionHash: DATA, 32 Bytes - the transaction’s hash.

  • transactionIndex: QUANTITY - integer of the transactions index position in the block.

  • blockHash: DATA, 32 Bytes - hash of the block where this transaction was located.

  • blockNumber: QUANTITY - the number of a block where this transaction took place.

  • from: DATA, 20 Bytes - the sender’s address.

  • to: DATA, 20 Bytes - address of the receiver. returns null if it is a contract creation transaction

  • cumulativeGasUsed: QUANTITY - The total amount of gas used in this block at the moment when the transaction was finished

  • gasUsed: QUANTITY - How much gas did this single transaction consume.

  • contractAddress: DATA, 20 Bytes - An address of a contract, if it was a contract creation transaction, or null in all other cases.

  • logs: Array - Array of log objects generated by this transaction.

  • logsBloom: DATA, 256 Bytes - Bloom filter for light clients for retrieving related logs in a fast manner.

It can also return:

  • root : DATA 32 bytes of post-transaction stateroot (pre Byzantium)

  • status: QUANTITY either 1 (success) or 0 (failure)

Sample

Here is a typical appliance example.

Call

curl https://eth-mainnet.rpcfast.com/?api_key=<key> \
    -X POST \
    -H "Content-Type: application/json" \
    -d '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b"],"id"

Outcome

{
  "jsonrpc": "2.0",
  "id": 0,
  "result": {
    "transactionHash": "0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b",
    "blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb",
    "blockNumber": "0x429d3b",
    "contractAddress": null,
    "cumulativeGasUsed": "0x64b559",
    "from": "0x00b46c2526e227482e2ebb8f4c69e4674d262e75",
    "gasUsed": "0xcaac",
    "logs": [
      {
        "blockHash": "0x8243343df08b9751f5ca0c5f8c9c0460d8a9b6351066fae0acbd4d3e776de8bb",
        "address": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907",
        "logIndex": "0x56",
        "data": "0x000000000000000000000000000000000000000000000000000000012a05f200",
        "removed": false,
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x00000000000000000000000000b46c2526e227482e2ebb8f4c69e4674d262e75",
          "0x00000000000000000000000054a2d42a40f51259dedd1978f6c118a0f0eff078"
        ],
        "blockNumber": "0x429d3b",
        "transactionIndex": "0xac",
        "transactionHash": "0xab059a62e22e230fe0f56d8555340a29b2e9532360368f810595453f6fdd213b"
      }
    ],
    "logsBloom": "0x00000000040000000000000000000000000000000000000000000000000000080000000010000000000000000000000000000000000040000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000010100000000000000000000000000004000000000000200000000000000000000000000000000000000000000",
    "root": "0x3ccba97c7fcc7e1636ce2d44be1a806a8999df26eab80a928205714a878d5114",
    "status": null,
    "to": "0xb59f67a8bff5d8cd03f6ac17265c550ed8f33907",
    "transactionIndex": "0xac"
  }
}

Last updated