2

EVM can only access state and not history of the blockchain during execution.

Since transactions can get the block hash of the 256 most recent blocks, giving smart contracts the access to history is definitely possible. Why not grant programs the visibility into more, if not full, history (past txs, receipts, logs)? Why did they make such a design? Enabling history access can unlock so many features.

1 Answer 1

2

To minimize requirements for nodes, the EVM was designed to not access history. Nodes can choose to prune history.

In https://hackmd.io/@vbuterin/state_size_management that the question references it states:

There is no opcode in EVM execution that allows you to access old block contents or previous transaction contents or receipt outputs, so a node can safely forget those things and still be able to process new blocks; hence those things are history and not state.

In Why are contracts limited to only the previous 256 block hashes? @Hudson referred to Buterin's explanation:

The constraint is to preserve a property that history is irrelevant past a certain point and state is all that matters; it improves efficiency and code simplicity for many kinds of nodes.

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.