Try it Live
Run Bytecode examples in the interactive playground
OpcodeData) representing different instruction categories and fusion patterns.
Base Instruction Type
All instruction objects share common fields:- TypeScript
Instruction Categories
Regular Instructions
Standard single-byte opcodes (ADD, MUL, SWAP1, etc.):PUSH Instructions
PUSH1 through PUSH32 with immediate data:JUMPDEST Instructions
Valid jump destinations with block metadata:JUMP Instructions
Dynamic unconditional jump (target determined at runtime):jump type indicates dynamic JUMP (not fused with PUSH). Target validation occurs at runtime.JUMPI Instructions
Dynamic conditional jump (target and condition determined at runtime):PC Instructions
PC opcode returning current program counter:STOP Instructions
Halts execution:INVALID Instructions
Invalid opcodes or undefined instruction bytes:Fusion Instructions
Optimizable multi-instruction patterns detected during analysis.Arithmetic Fusions
PUSH + ADD
PUSH value + ADD → Add immediate value to stack top.
PUSH + MUL
PUSH value + MUL → Multiply stack top by immediate.
PUSH + SUB
PUSH value + SUB → Subtract immediate from stack top.
PUSH + DIV
PUSH value + DIV → Divide stack top by immediate.
Bitwise Fusions
PUSH + AND
PUSH value + AND → Bitwise AND with immediate.
PUSH + OR
PUSH value + OR → Bitwise OR with immediate.
PUSH + XOR
PUSH value + XOR → Bitwise XOR with immediate.
Memory Fusions
PUSH + MLOAD
PUSH offset + MLOAD → Load from immediate memory address.
PUSH + MSTORE
PUSH offset + MSTORE → Store to immediate memory address.
PUSH + MSTORE8
PUSH offset + MSTORE8 → Store byte to immediate memory address.
Control Flow Fusions
PUSH + JUMP
PUSH target + JUMP → Static jump to known destination.
PUSH + JUMPI
PUSH target + JUMPI → Conditional jump to known destination (condition still runtime).
ISZERO + PUSH + JUMPI
ISZERO + PUSH target + JUMPI → Inverted conditional jump pattern.
Common in Solidity:
ISZERO + PUSH <skip_offset> + JUMPI
Advanced Stack Fusions
DUP2 + MSTORE + PUSH
DUP2 + MSTORE + PUSH value → Common memory write pattern.
DUP3 + ADD + MSTORE
DUP3 + ADD + MSTORE → Offset calculation + store.
SWAP1 + DUP2 + ADD
SWAP1 + DUP2 + ADD → Stack manipulation + arithmetic.
PUSH + DUP3 + ADD
PUSH value + DUP3 + ADD → Immediate addition with stack duplication.
PUSH + ADD + DUP1
PUSH value + ADD + DUP1 → Add immediate and duplicate result.
MLOAD + SWAP1 + DUP2
MLOAD + SWAP1 + DUP2 → Memory load with stack rearrangement.
Multi-Instruction Fusions
MULTI_PUSH
{ type: 'multi_push', count: 3, values: [1n, 2n, 3n] }
MULTI_POP
Solidity-Specific Patterns
FUNCTION_DISPATCH
PUSH4 selector + EQ + PUSH target + JUMPI → Function selector matching.
Solidity pattern:
msg.sig == 0x12345678.
CALLVALUE_CHECK
CALLVALUE + DUP1 + ISZERO → Check if ETH sent (non-payable modifier).
Solidity pattern:
msg.value > 0.
PUSH0 + PUSH0 + REVERT
PUSH0 + PUSH0 + REVERT → Empty revert (no error message).
Solidity pattern:
require() with no message.
Union Type Definition
Complete TypeScript union:Type Guards
Use TypeScript discriminated union for type-safe handling:Pattern Detection
Detect specific patterns during iteration:See Also
- scan - Iterator returning OpcodeData
- Synthetic Opcodes - Extended opcode reference
- Detect Fusions - Pattern detection details

