Blog

  1. Blog
  2. What is txreceipt_status
šŸ—“ March 13, 2023 | šŸ•‘ 3 min

Txreceipt_status: What is it and what are its possible values?

Overview

Some users have been inquiring about the txreceipt_status field and what its values signify. In this article, we will provide a brief overview of this field and its possible values.

Table of contents

Simple Example for Reading Transaction with error status

Here is an example for reading a transaction with error, using the curl command:

curl https://api.cryptomation.com/scan/eth?apikey=API_KEY&module=account&action=txlist&tag=latest&address=0xdec0de7e6ed3ee7bb3a2c0baae7827d101d1ec20&page=1&offset=100
copy

If the txreceipt_status field is set to 1, the response will be as follows:

{
  "status": "1",
  "message": "OK",
  "result": [
    {
      "blockNumber": "24741197",
      "timeStamp": "1644422471",
      "hash": "0x43d539e31a8671b98e4867d613234c2e9fadeece989939d46428c8ecfbb2101f",
      "nonce": "0",
      "blockHash": "0x928706113f3e304c3beae06d1cfd13cb26a0bfb80d0a4ae795d2971752f33811",
      "transactionIndex": "46",
      "from": "0xdec0de7e6ed3ee7bb3a2c0baae7827d101d1ec20",
      "to": "0x25cbd58702f9976d1be6af14e33a5875176762d2",
      "value": "1000000000000000000",
      "gas": "21000",
      "gasPrice": "29214713675",
      "isError": "1",
      "txreceipt_status": "0",
      "input": "0x",
      "contractAddress": "",
      "cumulativeGasUsed": "5892989",
      "gasUsed": "21000",
      "confirmations": "5311365"
    }
  ]
}
copy

If the txreceipt_status field is set to 0 and the isError field is set to 1, this indicates that the contract execution was not successful or there was an exception.

Possible Values of txreceipt_status

The possible values of the txreceipt_status field are defined in the Ethereum EVM source code, which can be found at this link: https://github.com/ethereum/go-ethereum/blob/461291882edce0ac4a28f64c4e8725b7f57cbeae/core/types/receipt.go#L37

The relevant block of code is:


const (
    // ReceiptStatusFailed is the status code of a transaction if execution failed.
    ReceiptStatusFailed = uint64(0)

    // ReceiptStatusSuccessful is the status code of a transaction if execution succeeded.
    ReceiptStatusSuccessful = uint64(1)
)
copy

This indicates that the only allowed values for txreceipt_status are 0 and 1, denoting

More info?

Much more info about our API method you could found on our docs!


Ready to get started?

Our api help your project gain easy access to a sea of crypto data.

If you want to try our Universal API, please enter your email or login from Google Gmail:

Continue with