Tool to read a Geth config and dump a genesis block
Go to file
2024-05-29 21:31:29 +08:00
testdata add unit test 2024-03-23 17:07:29 +08:00
block.go update fields 2024-03-24 23:20:21 +08:00
go.mod add unit test 2024-03-23 17:07:29 +08:00
go.sum add unit test 2024-03-23 17:07:29 +08:00
main_test.go add unit test 2024-03-23 17:07:29 +08:00
main.go add unit test 2024-03-23 17:07:29 +08:00
README.md add readme 2024-05-29 21:31:29 +08:00

eth-dump-genblock

Outputs an Ethereum genesis block given a Geth genesis config.

Example:

$ cat genesis.json
{
  "config": {
    "chainId": 1212,
    "homesteadBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "petersburgBlock": 0,
    "istanbulBlock": 0,
    "berlinBlock": 0,
    "londonBlock": 0,
    "mergeForkBlock": 0,
    "terminalTotalDifficulty": 0,
    "terminalTotalDifficultyPassed": true,
    "mergeNetsplitBlock": 0
  },
  "alloc": {},
  "coinbase": "0x0000000000000000000000000000000000000000",
  "difficulty": "0x01",
  "extraData": "",
  "gasLimit": "0x400000",
  "nonce": "0x1234",
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp": "0"
}

$ eth-dump-genblock genesis.json
{
  "baseFeePerGas": "0x3b9aca00",
  "difficulty": "0x1",
  "extraData": "0x",
  "gasLimit": "0x400000",
  "gasUsed": "0x0",
  "hash": "0x2a2aa96ee3f1db21c9eab8348cfe5f6c5e3179c03b2a7c618461edd63821dbb6",
  "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  "miner": "0x0000000000000000000000000000000000000000",
  "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "nonce": "0x0000000000001234",
  "number": "0x0",
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
  "size": "0x1fd",
  "stateRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "timestamp": "0x0",
  "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
  "uncles": []
}