This is a tiny script that helps in debugging solidity smart contracts on kovan testnet
It is a python script extracts abi, bytecode and function hashes from the build file that solidity compiler generates
Note: For windows, use extract-windows.py
- Copy the script to your project folder such that the build files reside in /build/contracts from the script's location (where truffle config, package,json etc reside in a default structure).
- Create an empty directory named "extract".
- Install python 2.7.x and pysha3 module using "pip install pysha3".
- Compile your contracts using truffle compile or solc directly.
- Execute the script and it will create separate abi and bytecode files for all your contracts and a cumulative function hashes file in the extract directory.
It adds a button to kovan vmtrace page that expands all the Show more fields and decodes the calldata to show the function called. It uses functionHashes generated by the python script to decode, so you need to add hashes for your functions to it. You can generate the hashes using the python script.
- Install tampermonkey (chrome) or Greasemonkey (firefox).
- Copy the script and paste it as new a script in tampermonkey/greasemonkey.
- Add the function hashes extract.py generated to the end of the script.
- Open any transaction on kovan.etherscan.io and Click on tools & utilities > parity trace.
- Click on show details (just above decoded traces) and see the magic happen.
Screenshots can be found on https://mudit.blog/ethereum-debugging-solidity-boilerplate/