Skip to main content

Try it Live

Run Hardfork examples in the interactive playground

    EIP-3855 Features

    Active Since: Shanghai (April 12, 2023)

    PUSH0 Opcode

    Opcode: 0x5F Function: Pushes constant 0 onto the stack Gas Cost: 2 gas

    Benefits

    Gas Savings:
    • PUSH0: 2 gas
    • PUSH1 0x00: 3 gas
    • Saves 1 gas per zero push (33% reduction)
    Bytecode Size:
    • PUSH0: 1 byte
    • PUSH1 0x00: 2 bytes
    • Reduces contract size by 1 byte per occurrence
    Common Use Cases:
    • Function return values initialization
    • Array/mapping default values
    • Stack manipulation
    • Placeholder values

    Usage Patterns

    Opcode Selection

    Select optimal zero-push implementation:

    Compiler Optimization

    Enable PUSH0 in compiler:

    Bytecode Generation

    Generate optimal bytecode:

    Gas Estimation

    Calculate gas costs:

    Network Configuration

    Validate PUSH0 support:

    Compiler Integration

    Solidity compiler support:

    EIP References

    Primary:

    Impact

    For Developers:
    • Smaller contract sizes (reduces deployment costs)
    • Lower execution costs (1 gas saved per zero push)
    • Must target Shanghai or later for PUSH0 optimization
    For Compilers:
    • Can optimize PUSH1 0x00PUSH0 when targeting Shanghai+
    • Reduces bytecode size without semantic changes
    For Contracts:
    • Typical savings: 50-500 gas per transaction
    • Reduced deployment costs: 100-1000 gas per contract
    • Zero runtime overhead

    See Also

    • hasEIP1559 - Check EIP-1559 base fee availability (London)
    • hasEIP4844 - Check blob transactions availability (Cancun)
    • isAtLeast - General version comparison