EVM - Troubleshooting "Reverted" with "trace_transaction"

"Reverted" in a trace_transaction result marks a call that reverted; the transaction itself failed only if its receipt status is 0x0.

"error": "Reverted" in a trace_transaction result marks a call that reverted during the trace. It doesn't always mean the transaction failed: a contract can catch a reverted sub-call, and a trace can disagree with the chain. Check the receipt first: the transaction failed only if eth_getTransactionReceipt returns "status": "0x0".

Symptom

When you use the trace_transaction method on Ethereum (or other EVM chains) through Tatum, the response may mark call frames with "error": "Reverted". However, when you inspect the transaction with other providers and block explorers, it can appear as if all is fine. See the example transaction on Etherscan.

Request example:

curl 'https://ethereum-mainnet.gateway.tatum.io' \
  --header 'content-type: application/json' \
  --header 'x-api-key: {YOUR_API_KEY}' \
  --data '{"jsonrpc":"2.0","method":"trace_transaction","params":["0x794049ab30d41424167f25e531abb6768ee74dc51c11df86ec7f54c042569e49"],"id":1}'

The response, trimmed to the three of its six frames marked Reverted:

{
  "id": 1,
  "jsonrpc": "2.0",
  "result": [
    {
      "action": {
        "from": "0xff70e5d3649a5f88f2230e7a6433711b00980f78",
        "callType": "call",
        "gas": "0x3fed3",
        "input": "0x88676cad0000000000000000000000000000000000000000000000000000000000000001",
        "to": "0x7ff28a9ee157865b1327302ab5c7ebad50ec6576",
        "value": "0x0"
      },
      "blockHash": "0xe319ccb7ae9dfb8dc1fc0e77618baa8c65a2cfe6b5bbdc126cbb048e9f5b095c",
      "blockNumber": 21412091,
      "error": "Reverted",
      "result": {
        "gasUsed": "0x8bb8",
        "output": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000038456967656e506f642e676574506172656e74426c6f636b526f6f743a20696e76616c696420626c6f636b20726f6f742072657475726e65640000000000000000"
      },
      "subtraces": 2,
      "traceAddress": [],
      "transactionHash": "0x794049ab30d41424167f25e531abb6768ee74dc51c11df86ec7f54c042569e49",
      "transactionPosition": 80,
      "type": "call"
    },
    {
      "action": {
        "from": "0x7ff28a9ee157865b1327302ab5c7ebad50ec6576",
        "callType": "delegatecall",
        "gas": "0x3c82b",
        "input": "0x88676cad0000000000000000000000000000000000000000000000000000000000000001",
        "to": "0x6d225e974fa404d25ffb84ed6e242ffa18ef6430",
        "value": "0x0"
      },
      "blockHash": "0xe319ccb7ae9dfb8dc1fc0e77618baa8c65a2cfe6b5bbdc126cbb048e9f5b095c",
      "blockNumber": 21412091,
      "error": "Reverted",
      "result": {
        "gasUsed": "0x6438",
        "output": "0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000038456967656e506f642e676574506172656e74426c6f636b526f6f743a20696e76616c696420626c6f636b20726f6f742072657475726e65640000000000000000"
      },
      "subtraces": 2,
      "traceAddress": [
        1
      ],
      "transactionHash": "0x794049ab30d41424167f25e531abb6768ee74dc51c11df86ec7f54c042569e49",
      "transactionPosition": 80,
      "type": "call"
    },
    {
      "action": {
        "from": "0x7ff28a9ee157865b1327302ab5c7ebad50ec6576",
        "callType": "staticcall",
        "gas": "0x35fb7",
        "input": "0x00000000000000000000000000000000000000000000000000000000675f9023",
        "to": "0x000f3df6d732807ef1319fb7b8bb8522d0beac02",
        "value": "0x0"
      },
      "blockHash": "0xe319ccb7ae9dfb8dc1fc0e77618baa8c65a2cfe6b5bbdc126cbb048e9f5b095c",
      "blockNumber": 21412091,
      "error": "Reverted",
      "result": {
        "gasUsed": "0x89c",
        "output": "0x"
      },
      "subtraces": 0,
      "traceAddress": [
        1,
        1
      ],
      "transactionHash": "0x794049ab30d41424167f25e531abb6768ee74dc51c11df86ec7f54c042569e49",
      "transactionPosition": 80,
      "type": "call"
    }
  ]
}

In application code, a failed transaction surfaces differently. web3.js, for example, throws Transaction has been reverted by the EVM when a mined transaction's receipt has status 0x0 and it can't read a revert reason.

Cause

trace_transaction re-executes the transaction on the node and returns one frame per call. A frame with "error": "Reverted" is a call that ended in a revert, and its result.output holds the revert data. What that means for the transaction depends on the frame:

  • Top-level frame ("traceAddress": []): the whole transaction reverted, and its receipt has "status": "0x0".
  • Nested frame (non-empty traceAddress): only that sub-call reverted. If the calling contract handles the failure, for example with a Solidity try/catch or a low-level call that returns false, the transaction continues and can still succeed.
  • The trace disagrees with the receipt: a trace is a re-execution, separate from the original execution in the block. If the node re-executes the transaction differently, the trace can report a revert that never happened onchain. The receipt is the onchain result.

The example is the last case. The trace marks the top-level call as reverted with the reason EigenPod.getParentBlockRoot: invalid block root returned, after a call to the EIP-4788 beacon roots contract (0x000f3df6d732807ef1319fb7b8bb8522d0beac02) reverted. Onchain, the transaction succeeded: its receipt has "status": "0x1". A later trace_transaction request for the same transaction returned no reverted frames, matching the receipt.

Solution

  1. Check the receipt status. "status": "0x1" means the transaction succeeded and "0x0" that it reverted. For the example transaction, the receipt returns "status": "0x1":

    curl 'https://ethereum-mainnet.gateway.tatum.io' \
      --header 'content-type: application/json' \
      --header 'x-api-key: {YOUR_API_KEY}' \
      --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x794049ab30d41424167f25e531abb6768ee74dc51c11df86ec7f54c042569e49"],"id":1}'
  2. Find where the revert started. In the trace_transaction result, start at the top-level frame and follow the frames with error down the traceAddress path. The deepest one is where the revert started, and the frames above it show whether the failure reached the top-level call. In the example, the path is [], [1], [1, 1]: the beacon roots call at [1, 1] reverted first.

  3. Decode the revert reason. If result.output starts with 0x08c379a0, the rest is an ABI-encoded Error(string): the message passed to revert or require. In the example, it decodes to EigenPod.getParentBlockRoot: invalid block root returned. An output of 0x means the call reverted without data. Decode other outputs, such as custom errors, with the contract's ABI.

  4. Get a nested view with debug_traceTransaction. With the callTracer, the result is a tree of calls instead of a flat list. A failed call has an error field and, when the node can decode it, a revertReason:

    curl 'https://ethereum-mainnet.gateway.tatum.io' \
      --header 'content-type: application/json' \
      --header 'x-api-key: {YOUR_API_KEY}' \
      --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["0x794049ab30d41424167f25e531abb6768ee74dc51c11df86ec7f54c042569e49",{"tracer":"callTracer"}],"id":1}'
  5. Inspect the VM trace and the contract. The VM trace on Etherscan shows the execution in detail and can help pinpoint the exact reason for the revert. If you have access to the contract code, review the logic to determine the failure point.

  6. Compare with another source. If the trace reports a revert but the receipt has "status": "0x1", validate the trace with debug_traceTransaction or another provider to compare results.

FAQ

What does "Transaction has been reverted by the EVM" mean?

It's the web3.js error for a transaction that was mined but failed: the receipt has "status": "0x0" and web3.js couldn't read a revert reason. The transaction is in a block as failed and still uses gas. Trace it as described in Solution to find where it reverted.

How do I trace a failed smart contract transaction to find exactly where it reverted?

Call debug_traceTransaction with {"tracer": "callTracer"} and follow the calls that have an error field down from the top-level call. The deepest one is where the revert started, and its revertReason or output says why. trace_transaction returns the same calls as a flat list, positioned by traceAddress.

Still stuck?

Report an issue to support with the transaction hash, the full trace response and its x-request-id.


Did this page help you?