I want to verify that a block exists in a trust-less manner - i.e. with on chain validation. This rules out the option of using an oracle.

I'm aware of this function: blockhash(uint blockNumber) returns (bytes32) but it only works for the most recent 256 blocks.

Are there any ideas how this can be done for older blocks?

Also a related question: Is it possible to verify a given `block hash` is valid in a contract? but it's (reasonably) old now and I wanted to know if there are any new thoughts.


The only way to do this currently is by passing the history of block headers for validation through hashing to the contract. Obviously this is very expensive. Look at the blockhash refactoring EIPs for a proposed change to the protocol to do this more efficiently.

| improve this answer | |

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.