Published in


Getting Ethereum Transaction Revert Reasons the Easy Way

Use the eth-revert-reason NPM package to easily derive the reason for an Ethereum transaction failure

const txHash = '0xf212cc42d0eded75041225d71da6c3a8348bdb...'
await getRevertReason(txHash) // 'I accidentally killed it.'
> getRevertReason 0xf212cc42d0eded75041225d71da6c3a8348bdb...
I accidentally killed it.

Under the hood

Changing Error Messages

Failed Authereum Transaction
const txHash = '0x6ea1798a2d0d21db18d6e45ca00f230160b05f172f...'
const network = 'mainnet'
let blockNumber = 9892242
await getRevertReason(txHash, network, blockNumber)
// 'BA: Insufficient gas (ETH) for refund'
blockNumber = 9919263
await getRevertReason(txHash, network, blockNumber)
// 'LKMTA: Auth key is invalid'

Running an Archive Node

Kovan and Parity Traces




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store