Get error message shown in the status of the transaction in EVM blockchain

Viewed 742

enter image description here

I couldnt figure out how to get the status of the transactions i.e "Fail with error "001010".

1 Answers

The ability to show error message, or the revert reason. depends on the EVM client (GoEthereum, Erigon, Ganache, Ethereum Tester, etc.) There is no bulletproof "standard".

  • The clients store only the receipt field status that is 0 or 1 (=success)
  • The clients do not store the revert reason (I might be wrong on this one and this has changed lately)

To get the actual error message you need to replay the transaction and a certain block height using a special eth_call JSON-RPC.

Here is a Javascript library for doing it and a related blog post about the topic.

Related