Skip to content

Latest commit

 

History

History
41 lines (38 loc) · 3.13 KB

readme.md

File metadata and controls

41 lines (38 loc) · 3.13 KB

Difficulty calculation

This test shows how the evm t8n can be used to calculate the (ethash) difficulty, if none is provided by the caller.

Calculating it (with an empty set of txs) using London rules (and no provided unclehash for the parent block):

[user@work evm]$ ./evm t8n --input.alloc=./testdata/14/alloc.json --input.txs=./testdata/14/txs.json --input.env=./testdata/14/env.json --output.result=stdout --state.fork=London
INFO [08-08|17:35:46.876] Trie dumping started                     root=6f0588..7f4bdc
INFO [08-08|17:35:46.876] Trie dumping complete                    accounts=2 elapsed="89.313µs"
INFO [08-08|17:35:46.877] Wrote file                               file=alloc.json
{
 "result": {
  "stateRoot": "0x6f058887ca01549716789c380ede95aecc510e6d1fdc4dbf67d053c7c07f4bdc",
  "txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "receiptRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "receipts": [],
  "currentDifficulty": 3311729559732224
 }
}

Same thing, but this time providing a non-empty (and non-emptyKeccak) unclehash, which leads to a slightly different result:

[user@work evm]$ ./evm t8n --input.alloc=./testdata/14/alloc.json --input.txs=./testdata/14/txs.json --input.env=./testdata/14/env.uncles.json --output.result=stdout --state.fork=London
INFO [08-08|17:35:49.232] Trie dumping started                     root=6f0588..7f4bdc
INFO [08-08|17:35:49.232] Trie dumping complete                    accounts=2 elapsed="83.069µs"
INFO [08-08|17:35:49.233] Wrote file                               file=alloc.json
{
 "result": {
  "stateRoot": "0x6f058887ca01549716789c380ede95aecc510e6d1fdc4dbf67d053c7c07f4bdc",
  "txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "receiptRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "receipts": [],
  "currentDifficulty": 3311179803918336
 }
}