1

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?

2

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

  • Is it possible to fetch the full header programmatically? Why do you mention the past 256 blocks specifically? Do they behave differently? – Randomblue Apr 12 '17 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 – Tjaden Hess Apr 12 '17 at 13:28
  • I cannot see which opcode gets the block header for contracts in the yellow paper. – Randomblue Apr 12 '17 at 13:32
  • Oh, no you would have to provide the block header externally – Tjaden Hess Apr 12 '17 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 – Tjaden Hess Apr 15 '17 at 14:40

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.