gm Optimists!
Walnut just announced a brand new tool for debugging and simulating transactions in the Superchain.
With walnut-cli
, Superchain devs now can:
- Generate a full trace for any transaction hash within the Superchain (just pass any RPC URL as a param)
- Simulate a transaction on any chain and get a full call trace
And yes it’s 100% free, local and open-source.
The installation is simple
For instructions head here: GitHub - walnuthq/walnut-cli: An EVM Debugger.
Example usage 1: debug a transaction on any chain within the Superchain
walnut-cli trace TX_HASH --rpc RPC_URL --ethdebug-dir ETHDDEBUG_DIR
Where ETHDEBUG_DIR
points to the debug information generated by the solc compiler. You can find instructions for generating this debug data here.
Example output for trace
command
Loading transaction 0x19672059a2b2cb8df965f6dfe2280a38d60b5dbfdcee23c692db70043aa3cf35...
Loaded 1834 PC mappings from ethdebug
Contract: TestContract
Environment: runtime
Function Call Trace: 0x19672059a2b2cb8df965f6dfe2280a38d60b5dbfdcee23c692db70043aa3cf35
Contract: 0x5FbDB2315678afecb367f032d93F642f64180aa3
Gas used: 50835
Call Stack:
------------------------------------------------------------
#0 TestContract::runtime_dispatcher [entry] gas: 382 @ TestContract.sol:8
#1 increment [0x7cf5dab0] [external] gas: 29241 @ TestContract.sol:23
amount: 10
#2 increment2 [internal] gas: 6322 @ TestContract.sol:39
amount: 15
#3 increment3 [internal] gas: 5303 @ TestContract.sol:52
amount: 20
------------------------------------------------------------
Example usage 2: simulate a transaction on any chain within the Superchain
walnut-cli simulate CONTRACT_ADDRESS [FUNCTION_SIGNATURE] [ARGS] --from FROM_ADDR
Example output for simulate
command
Loaded 1834 PC mappings from ethdebug
Contract: TestContract
Environment: runtime
Function Call Trace: None
Contract: 0x5FbDB2315678afecb367f032d93F642f64180aa3
Gas used: 33735
Call Stack:
------------------------------------------------------------
#0 TestContract::runtime_dispatcher [entry] gas: 382 @ TestContract.sol:8
#1 function_7cf5dab000 [7cf5dab000] [external] gas: 0 @ TestContract.sol:23
#2 increment [internal] gas: 12141 @ TestContract.sol:23
amount: 10
#3 increment2 [internal] gas: 6322 @ TestContract.sol:39
amount: 15
#4 increment3 [internal] gas: 5303 @ TestContract.sol:52
amount: 20
------------------------------------------------------------
Try it now and give us a star
What’s next
- UI for visual debugging and simulations
- Support for cross-chain message debugging
Let us know what you think
We have big plans with this and will listen to any feedback carefully.
If you are an Appchain or dApp developer who needs a transaction debugger or simulator, reach out via Telegram or send an email to hi@walnut.dev.
Join our Telegram
@walnuthq
Notes
- This work is supported by a grant from the Optimism Foundation — see our proposal on Charmverse.
- This post marks the delivery of Milestones 1 & 2. Future milestones will be shared in separate updates.
- Special thanks to @jackanorak for highlighting the need for a tool like this.