9

Why are contracts limited to only the previous 256 block hashes using the BLOCKHASH opcode (and corresponding functions in Solidity and Serpent)?

Why does another contract, such as this, need to be used to get block hashes more than 256 blocks ago? Also, how was the 256 limit determined and are there any plans on adjusting it? (Increasing it would still preserve backwards compatibility.)

9

According to Vitalik Buterin here:

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.

The 256 block limit is also mentioned in the Ethereum Yellow Paper by Gavin Wood at page 25.

I would argue that an on-chain service via a contract to perform this task, such as the one you linked to, is sufficient for getting block hashes beyond the previous 256. Ethereum's vision as a platform is to be general and enable building decentralized services, so many of the aspects of the design may not cater to features such as complete block hash history. This may be because doing so would open the door to less generalization and more complications/bugs, besides setting a precedent of adding features to facilitate certain needs or use cases.

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.