Skip to content

Instantly share code, notes, and snippets.

@jochenonline
Forked from gluk64/reason.js
Created May 5, 2019 09:11
Show Gist options
  • Save jochenonline/1827d2898efbf9d953dbadff5cec684b to your computer and use it in GitHub Desktop.
Save jochenonline/1827d2898efbf9d953dbadff5cec684b to your computer and use it in GitHub Desktop.
#!/bin/bash
# Fetching revert reason -- https://ethereum.stackexchange.com/questions/48383/how-to-receive-revert-reason-for-past-transactions
if [ -z "$1" ]
then
echo "Usage: revert-reason <TX_HASH>"
exit
fi
TX=$1
SCRIPT=" tx = eth.getTransaction( \"$TX\" ); tx.data = tx.input; eth.call(tx, tx.blockNumber)"
geth --exec "$SCRIPT" attach http://localhost:8545 | cut -d '"' -f 2 | cut -c139- | xxd -r -p
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment