Hello people!

I wanted to share with all of you this simple tool I’m working on: pocketh

GitHub ajsantander/pocketh A pocket knife for auditing smart contracts. Contribute to ajsantander/pocketh development by creating an account on GitHub.

It’s a pocket knife cli tool intended to aid developers/auditors when annoying questions come up, such as:

“Whats the current block number in mainnet?”

“When was block 7200000?”

“How many wei is 2 finney?”

“What does the inheritance tree of MyContract.sol look like?”

“Whats 1982 in hex? =P”

The motivation for the tool came up the other day when I needed (a) a script to scan events in mainnet and (b) scan transactions to a contract on mainnet that hit a particular function. If you google around a bit, you’ll find solutions to any of these problems. But I thought, “Why not start compiling all these scripts into a single tool to rule them all?!”. In fact, these two scripts are now things that pocketh can do via the txs and pastevents commands.

Other things that pocketh can do:

Show all members of a contract, including inherited contracts.

List all the function selectors of a contract.

Display calldata in a readable format.

Disassemble bytecode to opcodes.

Query the blockchain on a particular block or transaction.

Provide info about a network such as latest block, etc.

Convert hex<>string.

Pad hexadecimals.

Compile!

If you can think of something useful that could be added to the tool, pls don’t hesitate to create a new issue in the repo with your feature request. Keep in mind that the tool is intended to only read the blockchain for simplicity, i.e. it is not intended to send txs.

Even better, if you want to throw a PR, you’re more than welcome! Architecture-wise, each command/script should be self contained, so there is no complex architecture going on. It’s basically a collection of scripts.

Enjoy!