Try it Live
Run Bytecode examples in the interactive playground
Output Format
Options
Usage Patterns
Basic Disassembly
Gas-Focused View
Stack-Focused View
Compact Mode
Save to File
Disable colors when saving to file to avoid ANSI escape sequences in text files.
Color Coding
Instructions are color-coded by category:Block Visualization
Basic blocks shown with metadata header:gas: N- Total gas for block (sequential execution)stack: [min, max]- Min required, max reachedlen: N- Instruction count
● Begin- Marks JUMPDEST blocks (entry points)- Blank line separates blocks visually
Jump Visualization
Jump instructions show arrows connecting to targets:┐→N- Forward jump (down in code) to PC N┘→N- Backward jump (up in code) to PC N←●- Jump target (valid JUMPDEST)←✗- Invalid jump target (not JUMPDEST) - highlights bugs!→?- Jump target unknown or outside bytecode
Fusion Annotations
Detected fusion patterns annotated inline:⚡prefix on hex column - Fusion opportunity⚡ PUSH+ADDsuffix - Pattern type- Green background for fusion marker
Inline Metadata
PUSH Values
0x42) and decimal (66) for values ≤ 0xFFFF.
Gas Costs
Stack Effects
-2) and outputs produced (+1).
Jump Targets
Summary Section
Footer shows aggregate statistics:⚠️ Invalid jumps- Jumps to non-JUMPDEST (red, critical)⚠️ Final stack depth- Non-zero final depth (yellow, warning)❌ Stack underflow- Popping from empty stack (red, critical)
Comparison with formatInstructions
Use
prettyPrint() for:
- Debugging and visualization
- Terminal output
- Understanding control flow
- Gas analysis
- Educational purposes
formatInstructions() for:
- Programmatic parsing
- Simple disassembly
- Integration with other tools
- Machine-readable output
Advanced Usage
Debug Specific Range
Compare Bytecode Versions
Extract Function Bodies
Integration with Logger
Terminal Compatibility
Color Support Detection
Width Detection
Unicode Fallback
If terminal doesn’t support Unicode box-drawing characters:Performance
Pretty printing is optimized for readability over speed:- Small bytecode (<1KB): <5ms
- Medium bytecode (10KB): ~50ms
- Large bytecode (24KB): ~120ms
Use
formatInstructions() if performance is critical and visual output not needed.TypeScript-only: Pretty printing requires complex string formatting with ANSI colors and Unicode drawing. Use simpler APIs like
Scanner in Zig for bytecode iteration.See Also
- formatInstructions - Simple array-based disassembly
- analyzeBlocks - Block metadata used in output
- detectFusions - Fusion patterns annotated
- scan - Underlying iterator
- parseInstructions - Zig Scanner for iteration

