2

The yellow paper (see section 4.4) defines an extraData header field as follows:

An arbitrary byte array containing data relevant to this block. This must be 32 bytes or fewer

Can contracts natively read this extraData?

1 Answer 1

3

No, they cannot. However, it is quite simple to trustlesly verify the extraData from the past 256 blocks: simply provide the full header and make sure the hash matches the block hash

7
  • Is it possible to fetch the full header programmatically? Why do you mention the past 256 blocks specifically? Do they behave differently?
    – Randomblue
    Commented Apr 12, 2017 at 13:24
  • The block header is just the result from the eth_getBlock RPC call. Only the past 256 block headers are directly accessible to contracts Commented Apr 12, 2017 at 13:28
  • I cannot see which opcode gets the block header for contracts in the yellow paper.
    – Randomblue
    Commented Apr 12, 2017 at 13:32
  • Oh, no you would have to provide the block header externally Commented Apr 12, 2017 at 13:33
  • 1
    Because in order for the contract to check that the header is correct, it needs to hash it and compare that with the block hash. Only the last 256 block hashes are available from inside the EVM Commented Apr 15, 2017 at 14:40

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.