Smart Contract Visualization Tools: Graphs, Traces, Storage

Quick answer. For code structure, use Surya, Slither's printers and sol2uml; for storage, the compiler's storageLayout output and OpenZeppelin's validate. For transactions, Foundry's cast run, Tenderly, Phalcon and Dedaub show traces, state changes and fund flows.
Video transcript
Reading a protocol file by file rarely shows who calls whom or where state lives. These nine tools draw it, from source to transactions.
For code structure, Surya draws contract and function call graphs. Slither's printers add control-flow graphs and auth checks. And sol to UML draws class diagrams.
For storage, the compiler's own layout output is the reference. OpenZeppelin's validate command flags layout conflicts before an upgrade.
Source graphs show what could run. Trace tools show what did run, against real state.
Foundry's cast run replays a mined transaction in your terminal. Tenderly steps through execution line by line. Phalcon graphs fund flows, and Dedaub outputs structured traces.
In Guardian's Perp City review, finding I 17 found a donation callback unreachable from production flows, while the docs described fee routing the code never performed. It was informational, with no demonstrated fund loss.
Pictures speed up context, but they do not prove a property holds. Phalcon merges some transfers, and Dedaub simulates against the latest state.
A workflow: map contracts with Surya, check every state write with Slither, diff the storage layout, validate in CI, and replay odd transactions with cast run.
Graphs map your system, an audit tests it. Read the full comparison, or talk to Guardian about a smart contract audit.
Why Draw the Contract First
A protocol can span dozens of contracts. Reading files in order rarely shows who calls whom, what inherits what, or where state lives.
Visualization tools draw those relationships. Some read source code. Others replay a mined or simulated transaction and show what actually ran.
This list compares nine tools on what each draws and when to use it. For the wider review method, see how to audit a smart contract.
Code Structure Tools
Surya, from ConsenSys Diligence, reads Solidity and emits Graphviz DOT graphs. Its graph command draws function calls; simple mode reduces that to contract-level calls. ConsenSys Diligence
Surya's ftrace prints a tree of the internal and external calls reachable from one function. Its inheritance command draws the inheritance graph.
Check that Surya parses your syntax. Its GitHub page shows no published releases, and its package.json lists version 0.4.13 with a parser range older than the parser's current 0.20.2. solidity-parser
Run Surya first on an unfamiliar codebase. One contract-level graph shows the shape of the system before you read a line.
Slither, from Trail of Bits, is known for its detectors. Its printers draw the code instead: call-graph, cfg and inheritance-graph each write DOT files. Trail of Bits
Render those files with Graphviz to SVG or PNG, or view them in xdot, which Slither's docs list for visualization.
Two text printers matter as much. variable-order prints the storage order of state variables, and vars-and-auth lists what each function writes and its msg.sender checks.
Our Slither tutorial covers installing it and fitting printers into a review.
sol2uml draws UML class diagrams from local files or from verified source fetched from an explorer. It outputs SVG, PNG or DOT. naddison36
Its parser is not the Solidity compiler. The README warns results can differ from solc, for example on fixed-size arrays sized by an expression.
Storage Layout Tools
Storage layout follows rules that are easy to misread. Variables pack into shared slots, inheritance order follows C3 linearization, and mappings and dynamic arrays use derived slots. Solidity Foundation
The Solidity compiler reports the layout itself. Request storageLayout through the standard JSON interface, and each entry gives the variable's label, contract, slot, byte offset and type.
Treat that JSON as the reference. Every other storage picture either renders it or reconstructs it from source.
sol2uml's storage command draws slots as a diagram with offsets and types. With its --data option and a node URL, it reads live slot values from a deployed contract. naddison36
OpenZeppelin Upgrades Core has a validate command. It reads Hardhat or Foundry build info and checks implementations for upgrade safety and storage-layout compatibility. OpenZeppelin
Layout comparison needs a reference: pass --reference, or annotate the new version with @custom:oz-upgrades-from. On a conflict it exits nonzero with a report, so it can gate CI.
For the proxy bugs a layout diff should catch, such as missing storage gaps, see upgradeable contract vulnerabilities.
Transaction and Fund-Flow Tools
Source graphs show what could run. Trace tools show what did run, at one block, against real state.
Foundry's cast run replays a mined transaction locally against the state at its block. Each extra -v flag adds detail. Foundry
At -vvvv the trace includes internal calls; at -vvvvv it adds storage changes. forge test takes the same -v flags for your own tests.
Replay needs an RPC that serves the historical state the transaction read. Quick mode uses only the previous block's state, so its result may differ from live execution.
Tenderly's Debugger steps through execution one call and source line at a time. It shows the trace, stack and contract state, and the exact point where a transaction reverts. Tenderly
Its simulations return decoded call traces, events, state changes, asset changes and gas usage. Signers can use them too; see how to verify a Safe transaction before signing.
BlockSec's Phalcon Explorer splits one transaction into invocation flow, fund flow, balance changes, state changes and a gas profiler. BlockSec
Invocation flow is a call tree with depth, call type and parameters. Fund flow is a directed graph of transfers, numbered in order and colored by token.
Phalcon merges same-direction transfers of one token between two addresses. Read its map as a summary, not an event-by-event ledger.
Dedaub Transaction Analysis reconstructs nested calls, events, state changes and native or token transfers for executed or simulated EVM transactions, as structured output. Dedaub
Its simulations run against the latest network state. A result describes the chain now, not the state a later transaction will meet.
These views cover one transaction. Following stolen funds across many is a different job, covered in how stolen crypto is traced onchain.
Which Tool Shows What
The tools work in layers: source structure, then storage, then runtime behavior. Most reviews need one from each.
| Tool | Input | What it draws | Use it when |
|---|---|---|---|
| Surya | Solidity source | Function and contract call graphs, ftrace trees, inheritance | Mapping an unfamiliar codebase |
| Slither printers | Compilable project | Call graph, CFGs, inheritance, storage order, write and auth checks | Checking who can write which state |
| sol2uml | Local or explorer-verified source | UML classes, storage slots, live slot values | Diagramming classes or a deployed layout |
| Solidity compiler | Standard JSON input | Storage slots, offsets and types as JSON | You need the authoritative layout |
| OpenZeppelin Upgrades validate | Hardhat or Foundry build info | Upgrade safety and layout conflicts | Before every proxy upgrade |
| Foundry cast run | Transaction hash and RPC | Call trace, returns, storage changes | Reproducing a transaction in the terminal |
| Tenderly | Transaction or simulation | Decoded calls, step debugger, state and asset changes | Debugging a revert interactively |
| Phalcon Explorer | Transaction hash | Call tree, fund-flow graph, balances, state, gas | Reading an exploit or complex swap |
| Dedaub Transaction Analysis | Executed or simulated transaction | Calls, events, state changes, transfers | Feeding structured traces into analysis |
Using Them in an Audit
Pictures speed up context. They do not prove a property holds, and they can be wrong.
Guardian's Perp City protocol review, dated August 7, 2026, shows the kind of mismatch a call graph exposes. Finding I-17 (Informational, acknowledged) found a V4 donation callback and hook permission unreachable from production flows. Guardian
Documentation described donation-based LP fee routing that the implemented call graph never performed. The report records no demonstrated fund loss.
So compare the drawn graph with the docs. Code that never runs, and docs that describe paths that do not exist, both deserve a question.
A rendering is only as good as its input. It does not show that deployed bytecode matches reviewed source, or that a simulation holds under later state.
A workflow that uses each layer:
- Run Surya's simple graph and inheritance commands to map contracts before reading code. ConsenSys Diligence
- Run Slither's vars-and-auth printer and list every state write with no msg.sender check. Trail of Bits
- Run ftrace on each user entry point and mark every external call for reentrancy review.
- Export the compiler's storageLayout for each release and diff it before any upgrade. Solidity Foundation
- Run OpenZeppelin's validate in CI with a reference contract, so a layout conflict fails the build. OpenZeppelin
- Replay odd or failed transactions with cast run -vvvvv and keep the trace with your notes. Foundry
- Check balance changes in a fund-flow view to see who gained and who lost. BlockSec
- Confirm the address, chain, block and verified source before trusting any picture.
- Pin tool versions, since interfaces and supported networks change.
Frequently Asked Questions
What is the difference between a call graph and a control-flow graph?
A call graph shows which functions or contracts call which. A control-flow graph shows the branches and paths inside one function. Slither draws a CFG for each function, so use the call graph to find entry paths and the CFG to check branches inside one function. Trail of Bits
Can I share one step of a trace with a teammate?
In Phalcon, yes. Its invocation flow numbers each line, and clicking a line puts that line number in the page URL. Share the URL and it opens at the same call. BlockSec
Can I decode a trace for a contract with no verified source?
Partly. Tenderly decodes verified contracts, and you can upload source, an ABI or compiler metadata to decode your own. Without verification, Tenderly's docs say raw bytecode appears in its tools. Tenderly
Can I compare two deployments' code visually?
sol2uml's diff command compares verified source between explorers, or against local files. It compares source, not bytecode, so pair it with bytecode verification of each address. naddison36
Related reading
- slither tutorial
- how to audit a smart contract
- upgradeable contract vulnerabilities
- verify safe transaction before signing
- evm explained
Sources
- ConsenSys Diligence: Surya README
- Trail of Bits: Slither Printer Documentation
- naddison36: sol2uml README
- Solidity Foundation: Layout of State Variables in Storage and Transient Storage
- OpenZeppelin: OpenZeppelin Upgrades Core and CLI
- Foundry: Debugging Transactions
- Tenderly: Tenderly Transaction Overview
- BlockSec: Phalcon Explorer Quick Start
- Dedaub: Transaction Analysis
- Guardian: Perp City Protocol Review, I-17
- Guardian: Smart Contract Audit Services
- Tenderly: Simulate transaction
- Foundry: cast run reference
- Foundry: Fork Testing
- ConsenSys Diligence: Surya Releases
- ConsenSys Diligence: Surya package.json
- solidity-parser: Solidity parser package.json
- Tenderly: How to Use Tenderly Debugger
- Tenderly: Inspect transaction call traces and state changes
- Tenderly: Smart Contract Verification
- Tenderly: Verify Contracts via Dashboard
- Tenderly: Smart Contract Verification Using Foundry
- Tenderly: Smart Contract Verification Using Hardhat
- Tenderly: What you get
Have the paths behind the picture reviewed
Graphs map your system; an audit tests it. Guardian's smart contract audit puts two independent teams on one scope, with invariant fuzzing and only human-verified findings.