github.com/codysnider/go-ethereum@v1.10.18-0.20220420071915-14f4ae99222a/cmd/evm/testdata/14/readme.md (about) 1 ## Difficulty calculation 2 3 This test shows how the `evm t8n` can be used to calculate the (ethash) difficulty, if none is provided by the caller. 4 5 Calculating it (with an empty set of txs) using `London` rules (and no provided unclehash for the parent block): 6 ``` 7 [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 8 INFO [08-30|20:43:09.352] Trie dumping started root=6f0588..7f4bdc 9 INFO [08-30|20:43:09.352] Trie dumping complete accounts=2 elapsed="82.533µs" 10 INFO [08-30|20:43:09.352] Wrote file file=alloc.json 11 { 12 "result": { 13 "stateRoot": "0x6f058887ca01549716789c380ede95aecc510e6d1fdc4dbf67d053c7c07f4bdc", 14 "txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", 15 "receiptRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", 16 "logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", 17 "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 18 "receipts": [], 19 "currentDifficulty": "0x2000020000000" 20 } 21 } 22 ``` 23 Same thing, but this time providing a non-empty (and non-`emptyKeccak`) unclehash, which leads to a slightly different result: 24 ``` 25 [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 26 INFO [08-30|20:44:33.102] Trie dumping started root=6f0588..7f4bdc 27 INFO [08-30|20:44:33.102] Trie dumping complete accounts=2 elapsed="72.91µs" 28 INFO [08-30|20:44:33.102] Wrote file file=alloc.json 29 { 30 "result": { 31 "stateRoot": "0x6f058887ca01549716789c380ede95aecc510e6d1fdc4dbf67d053c7c07f4bdc", 32 "txRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", 33 "receiptRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", 34 "logsHash": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", 35 "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", 36 "receipts": [], 37 "currentDifficulty": "0x1ff8020000000" 38 } 39 } 40 ``` 41