Skip to content

eth_getTransactionReceipt


Retrieve a transaction receipt, or return null.

Parameters

A transaction hash.

Returns

Transaction Receipt

Parameter Type Required Description
transactionHash string required Hash of the transaction for which this is a receipt
transactionIndex string required Hex number; index of this transaction in the block in which it appears
blockHash string required Hash of the block in which this transaction appears
blockNumber string required Hex number; the block number in which this receipt appears
from string required Address of the sender of this transaction
to string required Address of the recipient of this transaction
cumulativeGasUsed string required Hex number; cumulative gas used by all transactions in this block up to and including this one
effectiveGasPrice string required Hex number; actual gas price deducted from the sender's account (or otherwise paid)
gasUsed string required Hex number; number of gas units used by this transaction
contractAddress string required If this transaction was a contract creation, the address of the resulting contract. Otherwise null
logs array required An array of log entries - see below
logsBloom string required see below
type string required hex number; type of this transaction. 0x0 - legacy, 0x1 - EIP-2930, 0x2 - EIP-1159, …
status string required hex number; transaction status - 0x0 for failed, 0x1 for succeeded

Log object

Parameter Type Required Description
removed bool required Always false
logIndex string required Hex string; the (0-based) index of this log within the current transaction receipt
transactionIndex string required Hex string; the (0-based) index of this transaction within the current block
transactionHash string required Hash of the transaction that generated this log
blockHash string required Hash of the block in which the transaction that generated this log appears
blockNumber string required Hex string; the number of the block in which this transaction appears
address string required The address from which this log was emitted
data string required Hex string; the data associated with this log entry
topics string required An array containing the topics associated with this log entry, as an array of hex strings

logsBloom

This is a bloom filter of the address and topics of a group of log entries, encoded as a string containing 2048 bits, each encoded as 1 (set) or 0 (not set). The first element of the string is the 0 index into the corresponding bit array.

Bits are set in this array according to the following procedure:

pub fn bloom(&self, bloom: &mut [u8; 256]) {
     m3_2048(bloom, self.address.as_slice());
     for topic in &self.topics {
         m3_2048(bloom, topic.as_slice());
     }
}

fn m3_2048(bloom: &mut [u8; 256], data: &[u8]) {
    let hash = Keccak256::digest(data);

    for i in [0usize, 2, 4] {
        // Calculate `m` by taking the bottom 11 bits of each pair from the hash. (2 ^ 11) - 1 = 2047.
        let m = (hash[i + 1] as usize + ((hash[i] as usize) << 8)) & 2047;
        // The bit at index `2047 - m` (big-endian) in `bloom` should be set to 1.
        let byte = m / 8;
        let bit = m % 8;
        bloom[255 - byte] |= 1 << bit;
    }
}

Example Request

curl -d '{
   "id": "1",
   "jsonrpc": "2.0",
   "method": "eth_getTransactionReceipt",
   "params": [ "0x11106d9da5ea70ac5ed3a2f2f3a7fba83557baa94b272a8f0314a471a8c0289c" 
]}' -H "Content-Type: application/json" -X POST "https://api.zq2-prototestnet.zilliqa.com/"

Example response

{
  "jsonrpc": "2.0",
  "result": {
    "transactionHash": "0x11106d9da5ea70ac5ed3a2f2f3a7fba83557baa94b272a8f0314a471a8c0289c",
    "transactionIndex": "0x0",
    "blockHash": "0x4623183dee0739450abb8077a33a02cae77aece4f49c6ec49a4462eae1efbf3f",
    "blockNumber": "0xe6b",
    "from": "0xcb57ec3f064a16cadb36c7c712f4c9fa62b77415",
    "to": "0xbca0f6f4cbfe8ac37096b674de8f96c701c43f7c",
    "cumulativeGasUsed": "0x849a",
    "effectiveGasPrice": "0x454b7a4e100",
    "gasUsed": "0x849a",
    "contractAddress": null,
    "logs": [
      {
        "removed": false,
        "logIndex": "0x0",
        "transactionIndex": "0x0",
        "transactionHash": "0x11106d9da5ea70ac5ed3a2f2f3a7fba83557baa94b272a8f0314a471a8c0289c",
        "blockHash": "0x4623183dee0739450abb8077a33a02cae77aece4f49c6ec49a4462eae1efbf3f",
        "blockNumber": "0xe6b",
        "address": "0xbca0f6f4cbfe8ac37096b674de8f96c701c43f7c",
        "data": "0x00000000000000000000000000000000000000000000000000000000000003e8",
        "topics": [
          "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
          "0x000000000000000000000000cb57ec3f064a16cadb36c7c712f4c9fa62b77415",
          "0x0000000000000000000000000000000000000000000000000000000000000000"
        ]
      }
    ],
    "logsBloom": "0x00000000000000000000008000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000020000000000020000000000000000000800000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000001000002000000000000000000000000100000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000",
    "type": "0x0",
    "status": "0x1"
  },
  "id": "1"
}

Arguments

Parameter Type Required Description
id string Required "1"
jsonrpc string Required "2.0"
method string Required "eth_getBlockByHash"
params array Required [ txn_hash ]