Quick Start Examples
Basic Arithmetic
Execute simple arithmetic operations:PUSH1 0x03, PUSH1 0x02, ADD
- Pushes
0x03onto the stack - Pushes
0x02onto the stack - Adds them together (result:
0x05)
With Verbose Output
View detailed execution information:Category Examples
Stack Operations
Stack Operations
Push Operations
Push multiple values onto the stack:PUSH1 0x01- Push 1PUSH1 0x02- Push 2PUSH1 0x03- Push 3PUSH2 0x0101- Push 257
0x0101, 0x03, 0x02, 0x01Arithmetic with Multiple Values
PUSH1 0x20- Push 32PUSH1 0x20- Push 32ADD- Add them (result: 64 or 0x40)
Duplicate Operations
PUSH1 0x05- Push 5DUP1- Duplicate top stack valuePUSH1 0x01- Push 1
Memory Operations
Memory Operations
Memory Store
Store a value in memory:PUSH1 0x20- Push 32PUSH1 0x40- Push 64 (memory location)MSTORE- Store 32 at memory location 64PUSH1 0x02- Push 2PUSH1 0x01- Push 1 (storage key)SSTORE- Store 2 at storage key 1
Memory Load
PUSH1 0x20- Push 32PUSH1 0x40- Push 64MSTORE- Store valuePUSH1 0x40- Push 64MLOAD- Load value from memory
Storage Operations
Storage Operations
Storage Write and Read
PUSH1 0x02- Push 2 (value)PUSH1 0x01- Push 1 (key)SSTORE- Store 2 at key 1PUSH1 0x01- Push 1 (key)SLOAD- Load value from key 1
0x02 is stored at storage key 0x01 and then loaded back.Logical Operations
Logical Operations
Complex Bytecode
Complex Bytecode
Combined Operations
Execute a complex sequence with memory and storage:- Memory store operation
- Storage store operation
- Memory load operation
- Storage load operation
With Prefix
Same bytecode with0x prefix:DUP1- Duplicate stack topPUSH1 0x20- Push 32
Verbose Analysis
- Each opcode executed
- Stack state after each operation
- Memory modifications
- Final state summary
Testing Examples
These examples are used in the Cubipods test suite:Test: Basic Execution
Test: Verbose Mode
Test: Memory and Storage
- Memory store at location
0x40contains0x20 - Storage at key
0x01contains0x02
Test: Stack Addition
0x40 (64 in decimal) after adding 32 + 32.