EIP-3855: The PUSH0 Solution for Gas Efficiency in the Virtual Machine

--

eip-3855

Have we ever considered how much gas could be saved by optimizing simple instructions within our smart contracts? Enter EIP-3855, a proposal poised to revolutionize efficiency by introducing the PUSH0 instruction into the Ethereum Virtual Machine (EVM).

On February 19th, 2021, EIP-3855 was proposed with the aim of mitigating gas and storage costs for contracts needing to push a constant value of zero onto the stack. Traditionally, developers have used various other instructions — such as PC, MSIZE, CALLDATASIZE — to achieve this effect. However, these alternatives come with variable costs and often add complexity to contract code.

To put matters into perspective: the current use of PUSH1 00 results in an enormous waste across existing accounts — 340557331 bytes translating to an astonishing 68111466200 gas spent. EIP-3855 is here to tackle this redundancy head-on.

The mechanics of PUSH0 are simple yet efficient. This instruction requires no immediate data or stack items; it simply places a single value of zero onto the stack. Costing just 2 gas — the same as other constant-value instructions like ADDRESS and ORIGIN — it promises significant savings.

Moreover, it is strategically positioned within opcode space at 0x5f, adjacent to existing PUSH implementations, which allows for potential shared efficiencies in implementation.

An analysis reveals that approximately 11.5% of all executed PUSH instructions involve pushing a zero value. This highlights substantial room for optimization. With PUSH0 poised to reduce both gas expenditure and storage burden significantly, its introduction marks a pivotal enhancement in contract execution efficiency.

What about potential risks? Given that already deployed contracts might alter their behavior with this new opcode’s introduction — a legitimate concern — careful examination concludes no evident impact on security or jump analysis due to PUSH0’s simplicity and lack of immediate data bytes.

By enabling developers to write more efficient code while reducing unnecessary overheads, EIP-3855 represents a meaningful stride towards optimizing contract interactions on Ethereum’s Mainnet.

As we anticipate the Shanghai or Shapella upgrade including this opcode innovation, it’s time we rethink how minor tweaks can cascade into major improvements across our ecosystem.

What are your thoughts on integrating smaller but smarter operations like PUSH0 into our development practices? How might such changes influence your approach moving forward?

Share your insights below!

--

--

Sergey Golubev (Сергей Голубев)
Sergey Golubev (Сергей Голубев)

Written by Sergey Golubev (Сергей Голубев)

Crynet.io, Project manager, ICO/IDO/TGE , venture, marketing, crypto and investment projects

No responses yet