The script allows to get the revert reason for past transactions.
npm i
node index.js <TX_HASH>
PARITY=1 node index.js <TX_HASH>
node index.js 0x45df3ce73e04db535ebd4e5d96c9222699fe0a5ae1efdf46b502678af3aa879c
> RAW message: Node error: {"message":"VM execution error.","code":-32015,"data":"Reverted 0x08c379a0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000066e6f206665650000000000000000000000000000000000000000000000000000"}
> Decoded reason: no fee
- It may not work if the smart contract state or state of the caller has been changed somehow. For reliable results, you need your own node synced up to the block of failed tx. For very old transactions, you may need to run an archive node.
- It obviously does not work if the contract does not emit any reason (Old contracts).
- It does not work for
Bad Instruction
cases.