Skip to content

Conversation

@meowsbits
Copy link
Contributor

Adds geth dumpgenesis command, which writes the configured genesis in JSON format to stdout.

This provides a way to generate the data (structure and content) that can then be used with the geth init command.

$ ./build/bin/geth dumpgenesis | jj -p | head -30
{
  "config": {
    "chainId": 1,
    "homesteadBlock": 1150000,
    "daoForkBlock": 1920000,
    "daoForkSupport": true,
    "eip150Block": 2463000,
    "eip150Hash": "0x2086799aeebeae135c246c65021c82b4e15a2c451340993aacfd2751886514f0",
    "eip155Block": 2675000,
    "eip158Block": 2675000,
    "byzantiumBlock": 4370000,
    "constantinopleBlock": 7280000,
    "petersburgBlock": 7280000,
    "ethash": {}
  },
  "nonce": "0x42",
  "timestamp": "0x0",
  "extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
  "gasLimit": "0x1388",
  "difficulty": "0x400000000",
  "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x0000000000000000000000000000000000000000",
  "alloc": {
    "000d836201318ec6899a67540690382780743280": {
      "balance": "0xad78ebc5ac6200000"
    },
    "001762430ea9c3a26e5749afdb70da5f78ddbb8c": {
      "balance": "0xad78ebc5ac6200000"
    },
    "001d14804b399c6ef80e64576f657660804fec0b": {

meowsbits and others added 4 commits October 21, 2019 08:38
I have a hard time believing this doesn't already exist...
although I could not find it anywhere.
Seems weird that MakeGenesis method doesn't return
DefaultMainnet...
@meowsbits meowsbits changed the title add 'dumpgenesis' cmd cmd/geth: add 'dumpgenesis' cmd Oct 21, 2019
@karalabe karalabe self-requested a review November 26, 2019 09:38
@karalabe karalabe self-assigned this Nov 26, 2019
@karalabe karalabe added this to the 1.9.9 milestone Nov 26, 2019
@karalabe karalabe modified the milestones: 1.9.9, 1.9.10 Dec 6, 2019
@karalabe karalabe modified the milestones: 1.9.10, 1.9.11 Jan 21, 2020
@fjl
Copy link
Contributor

fjl commented Jan 21, 2020

Need to check:

geth dumpgenesis
geth dumpgenesis --rinkeby
geth dumpgenesis --datadir ~/my-data-dir 

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
These works as expected: build/bin/geth --testnet dumpgenesis, build/bin/geth --goerli dumpgenesis, build/bin/geth dumpgenesis

@fjl fjl merged commit 711ed74 into ethereum:master Feb 4, 2020
@cryptohazard
Copy link

Question: shouldn't this function also dump a custom genesis?

enriquefynn pushed a commit to enriquefynn/go-ethereum that referenced this pull request Mar 10, 2021
Adds the 'geth dumpgenesis' command, which writes the configured
genesis in JSON format to stdout. This provides a way to generate the
data (structure and content) that can then be used with the 'geth init'
command.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants