2

If given block data and a difficulty number, is it possible to verify that the header produced is at or above the provided difficulty from within Solidity?

For example, suppose I have the following block data:

{
  author: "0x829bd824b016326a401d083b33d092293333a830",
  difficulty: 1543338950559758,
  extraData: "0xe4b883e5bda9e7a59ee4bb99e9b1bc",
  gasLimit: 6713094,
  gasUsed: 6700572,
  hash: "0x569f4e8c86626f4047d920c574420ffd52310d8a359155e6a246c9576ce1037e",
  logsBloom: "0x400a0010784221311a219006f0008020431000e0082404001204050010a2016a7000a0121d0000001202850008c020000264e008000192001882c49040200311001080488070800102904828080020284040208414214c206003030386740021040282a01140001000c2c50400404001000a0200082c00000513a215800ac01534e0d0142824062000080101010430280c106401a9200074b602000004100004025440010c0604016a0022180000809280010435202181230a050302060a201c144100a2440424600848002200c000010cb0000408090000800400009040012d0454200002150044020008200090b102705440020042695f4600700401000a80",
  miner: "0x829bd824b016326a401d083b33d092293333a830",
  mixHash: "0x33319b1b81b39559f51af665b57401a8fc1abecbb03b2684422994d85a5cb18e",
  nonce: "0x81da15480b0a96ee",
  number: 4637262,
  parentHash: "0xf66b4d7eced1ef88dfe668a9edc2b8ce43d92d71d55752b6c27e859bfa9bb86a",
  receiptsRoot: "0x0bf5737fd1516ecb4609ca396041b887e6137938db3a00ffb008cdfd7d67f603",
  sealFields: ["0xa033319b1b81b39559f51af665b57401a8fc1abecbb03b2684422994d85a5cb18e", "0x8881da15480b0a96ee"],
  sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  size: 26022,
  stateRoot: "0x29738568ddaa5a4696e7eebd78cd2150d4c8267744a2cb4d39e46cca71546b65",
  timestamp: 1511865007,
  totalDifficulty: 1.587541539031876898867e+21,
  transactionsRoot: "0x13a5b20cae65672b7bddadbae5161978ded6303878a1514b34ac6474866e37c3",
  uncles: []
}

How would I verify the hash exceeds some difficulty? (not necessarily the difficulty provided)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.