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

enter image description here

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



Solution 1:[1]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1