Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
EIP-3855 introduces a dedicated opcode, PUSH0, that pushes the constant zero onto the EVM stack, reducing gas consumption and bytecode size.
This article translates, summarizes, and expands on the following specification.
More EIP explainers:
Overview
The PUSH0 instruction has opcode 0x5f.
A stack is a data structure that temporarily stores values using a last-in, first-out (LIFO) ordering. The most recently added value is the first one removed. Stacks are useful for intermediate calculations, reversing sequences, and managing function execution.
PUSH0 places the constant zero on top of the EVM stack. The hexadecimal byte 0x5f identifies the instruction.
Zero is commonly needed in initialization, conditional execution, Boolean operations, and flag management. Depending on the context, it can represent a numerical zero, false, or an empty offset or length.
PUSH0 provides a dedicated, efficient way to place zero on the EVM stack without using another instruction or supplying an immediate operand.
Motivation
Instructions and gas costs
Smart contracts execute instructions that consume gas. Gas accounting reflects execution resource usage, and deploying contract bytecode also incurs a code-deposit cost.
Using zero
Many EVM operations require zero-valued stack operands. For example, a CALL instruction may be supplied with a zero output offset or output length.
Before PUSH0, a conventional way to push zero was PUSH1 0. It consumes 3 gas when executed and occupies two bytes of bytecode. In deployed runtime code, those two bytes incur 400 gas in code-deposit charges at 200 gas per byte.
Problems
Increased code size
Frequent use of PUSH1 with a zero immediate operand increases contract bytecode size.
Misuse of other instructions
Developers have sometimes used instructions such as PC or MSIZE to obtain zero more cheaply when execution context makes their results zero.
These instructions are context-dependent, however. Their results are not universally zero, and changes to surrounding code or opcode semantics can invalidate such assumptions.
Using DUP instructions
Another approach is to duplicate an existing zero on the stack using a DUP instruction. This requires a suitable value already to be available at an accessible stack position and still consumes gas.
Proposed change
Introducing PUSH0 (0x5f)
The proposal adds an instruction dedicated to pushing zero. It reduces execution cost and bytecode size compared with PUSH1 0.
Effects
Smaller bytecode
PUSH0 requires only one byte rather than the two bytes required by PUSH1 0.
Gas savings
EIP-3855 reports that the extra byte in historical deployments examined by its analysis accounted for 68,111,466,200 gas in code-deposit costs.
Each substitution of PUSH0 for PUSH1 0 saves one byte of deployed runtime code and one gas per execution. Other deployment costs depend on how the bytecode is constructed and submitted.
Reduced reliance on context-dependent instructions
A dedicated zero-pushing instruction removes the need to depend on unrelated opcode behavior for this purpose.
The change therefore provides a simpler and more efficient way to express a common EVM operation.
Specification
PUSH0 is assigned opcode 0x5f. It has no immediate data bytes and consumes no stack operands. It pushes one 256-bit stack item with value zero.
Its execution cost is 2 gas, the base gas cost category.
The stack follows last-in, first-out semantics, so the newly pushed zero becomes the topmost item.
The opcode byte identifies the operation to the virtual machine. Gas is the unit used to account for execution resources; the ETH fee paid for a transaction depends separately on the applicable gas price.
PUSH0 performs a simple, deterministic stack operation at a cost of 2 gas. In contrast, PUSH1 0 consumes 3 gas and requires an extra byte for the immediate value.
Rationale
Gas pricing
The base gas category includes inexpensive operations such as ADDRESS and ORIGIN, which place execution-context values onto the stack.
PUSH0 requires no immediate operand and produces a constant value. The proposal therefore assigns it the same 2-gas base cost.
Opcode selection
An opcode identifies an instruction understood by the virtual machine.
The byte 0x5f is immediately adjacent to the existing PUSH instruction range, which begins with PUSH1 at 0x60. This placement simplifies implementation and allows clients to share relevant instruction-handling logic.
The opcode assignment and gas price reflect the instruction's simplicity and its relationship to the existing PUSH family.
Compatibility
The proposal introduces a previously undefined instruction. Existing deployed bytecode that executes 0x5f may therefore behave differently after activation.
On Ethereum, PUSH0 was activated with the Shanghai upgrade in April 2023. Developers targeting other EVM networks must confirm that the selected network and compiler EVM target support the instruction.
A bytecode sequence containing PUSH0 may fail with an invalid opcode on a network that has not activated it.
Tests
The specification describes the following test cases.
5F – One zero-valued stack item
Executing one PUSH0 instruction places a single zero on an initially empty stack.
5F5F..5F (1,024 repetitions) – 1,024 zero-valued stack items
Executing PUSH0 1,024 times on an initially empty stack fills the stack with 1,024 zeros. This is within the EVM's stack-depth limit.
5F5F..5F (1,025 repetitions) – Stack overflow
A 1,025th consecutive PUSH0 exceeds the EVM stack-depth limit of 1,024 items and causes an exceptional halt.
These cases assume sufficient gas for the relevant execution.
The first two cases verify ordinary execution and the maximum permitted stack depth. The third verifies that the stack-depth limit is enforced.
Security
The proposal notes that PUSH0 has no immediate data bytes, so it does not introduce additional data bytes that must be skipped during jump-destination analysis.
Security implications
PUSH0 performs only a constant stack insertion. The proposal identifies no additional security concerns specific to this simple operation beyond ordinary EVM execution requirements.
No immediate data bytes
Immediate data is encoded directly after some instructions, such as the operand of PUSH1.
PUSH0 always produces zero and therefore needs no such operand.
Jump-destination analysis
EVM clients distinguish actual JUMPDEST instructions from bytes embedded as immediate data in PUSH instructions.
Since PUSH0 contains no immediate data, it does not require additional bytes to be skipped during this analysis.
The instruction introduces no new complex data-handling behavior. Clients must still enforce ordinary gas accounting, stack-depth limits, and the correct activation rules.
Citation
Alex Beregszaszi (@axic), Hugo De la cruz (@hugo-dc), Paweł Bylica (@chfast), "EIP-3855: PUSH0 instruction," Ethereum Improvement Proposals, no. 3855, February 2021. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-3855.
Conclusion
EIP-3855 introduces PUSH0, a one-byte, two-gas instruction for pushing zero onto the EVM stack. It reduces code size, execution costs, and dependence on context-sensitive alternatives.
Questions are welcome via Twitter @cardene777.
Other publications:


