Section 9.4.1. of Ethereum paper (Petersburg version 41c1837 — 2021-02-14), states that:

The machine state μ is defined as the tuple (g,pc,m,i,s) which are the gas available, the program counter pc ∈ N_256, the memory content, the active number of words in memory (counting continuously from position 0), and the stack contents. The memory contents μ_m are series of zeros of size 2^256.

Further in this documentation, a machine state is said to be prone to change from block to block according to a pre-defined set of rules and can execute arbitrary machine code. The specific rules of changing state from block to block are defined by the EVM.

Also in the documentation, there is an external resource that illustrates machine state as part of volatile memory in the EVM.

So what is a machine state, what are pre-defined rules that can change machine state, and what it has to do with EVM?


The machine state would be the environment where the contract runtime bytecode will be executed. A sort of virtual processor for the EVM's bytecode.

From the text "pre-defined rules" appears to mean a fork. Some forks had changed opcodes pricing affecting how gas consumption was evaluated and introduced newer opcodes modifying the machine state behavior.


The machine state is maintained internally and updated after each execution cycle of the EVM. An "iterator function" runs in the EVM, which outputs the results of a single cycle of the state machine.

The machine state is a tuple that consists of the following elements:

• Available gas

• The program counter, which is a positive integer of up to 256

• The contents of the memory (a series of zeroes of size 2 256 )

• The active number of words in memory (counting continuously from position 0)

• The contents of the stack

Iterator function

The iterator function performs various vital functions that are used to set the next state of the machine and eventually the world state. These functions include the following:

• It fetches the next instruction from a byte array where the machine code is stored in the execution environment.

• It adds/removes ( PUSH/POP ) items from the stack accordingly.

• Gas is reduced according to the gas cost of the instructions/opcodes. It increments the Program Counter (PC) which keeps track of where we are in the contract code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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