I have been digging a bit deeper into the Ethereum bytecode with the specific goal to do contract verification from the source code.

I noticed, while doing some tests, that the initial bytes of the Ethereum contract has changed somewhere between 0.4.21 and 0.4.22.

Normally, a contract would always start with:


PUSH1 0x60 PUSH1 0x40 MSTORE

But starting at 0.4.22 and onward, they seem to start with:


PUSH1 0x80 PUSH1 0x40 MSTORE

What is the significance of this change, and where can I find documentation about this change?

1 Answer 1


The contract prologue instructions changed to provide an additional slot at 0x60, which should always hold the value 0. The documentation states that:

The zero slot is used as initial value for dynamic memory arrays and should never be written to (the free memory pointer points to 0x80 initially).

FYI I checked several contracts with JEB Decompiler, and it seems they agree with you: contracts with the old prologue (0x60 bytes) are detected as generated by Solidity <= 0.4.21, whereas contracts with the new prologue are detected as >= 0.4.22.

  • Very cool reference to the documentation. I also see that the sentence you quote was added to the docs specifically on 0.4.22. Last question I would have is "Why did this change?" Dec 5, 2018 at 1:25
  • Most likely, for optimization purposes: if the compiler knows that the memory word at offset 0x60 is always 0, it can use that to optimize memory-array write operations during initialization or reset. My guess is that (some) constructs like "PUSH 0 / PUSH offset / MSTORE" (used to initialize [offset] to 0) can then be avoided. We would need to see that in code though. If you compile a non-trivial contract making use of memory arrays with a recent version of Solidity, you should be able to see how [0x60] is being used.
    – Alex Byrde
    Dec 5, 2018 at 17:33
  • 1
    the documentation url format was updated, here are the links to 0.4.21 and 0.4.22. docs.soliditylang.org/en/v0.4.21/miscellaneous.html docs.soliditylang.org/en/v0.4.22/miscellaneous.html
    – j4ys0n
    Feb 12, 2022 at 20:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.