Parsing Transaction Error

Hello devs,

Here is what I’ve tried, I scrapped off transactions from Moralis Web3 REST API of a specific NFT collection.

I got all of these transactions stored in a JSON file but how am I able to identify that a transaction object was reverted?

I am trying to achieve is to filter out all transaction objects that have error so I can compute for the correct sales per day in both native transaction and ERC20 token transactions.

Because if these transactions is not filtered out, then the computations are inaccurate because it will still count off the error transactions that contains value for tx.value. Ideally if that transaction is reverted/thrown an exception then it should be filtered out.

Would appreciate if anyone can guide me how to do it, I tried AbiCoder to decode the input args in the call but that does not help apparently.

Hi @metagineerdy

If you are only looking for failed transactions, you can check the failed transactions based on the receipt_status value in the output. If the status value is 1 it means the transaction is successful and if 0 it is failed.

In the below transaction output the receipt_status value is 0. It means the transaction is failed.

{
    "hash": "0xf117eccd031be9b443487d501c291c1da8d4c4665a071b6a2ff0d929f51ceccc",
    "nonce": "13",
    "transaction_index": "135",
    "from_address": "0xcc072a19678534e25d5636d229e3680603e46221",
    "to_address": "0x06d75eb5ca4da7f7c7a043714172cf109d07a5f8",
    "value": "0",
    "gas": "25447",
    "gas_price": "5000000000",
    "input": "0xa016240b000000000000000000000000cc072a19678534e25d5636d229e3680603e462210000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000046ae87c42f3e71d8c30851f7c7a7f822816085060000000000000000000000000000000000000000000000000000000000000000",
    "receipt_cumulative_gas_used": "25370332",
    "receipt_gas_used": "25439",
    "receipt_contract_address": null,
    "receipt_root": null,
    "receipt_status": "0",
    "block_timestamp": "2021-12-28T06:33:26.000Z",
    "block_number": "13862431",
    "block_hash": "0x3fd40137ee2477486cfc95e8c50e93a1eb00302b843657994468ac39d997f689",
    "transfer_index": null
}