Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid genesis file with puppeth and geth #16317

Closed
wbt opened this issue Mar 14, 2018 · 5 comments
Closed

Invalid genesis file with puppeth and geth #16317

wbt opened this issue Mar 14, 2018 · 5 comments

Comments

@wbt
Copy link
Contributor

wbt commented Mar 14, 2018

In a simple use of puppeth to generate a genesis block, and then use of geth to read it in, I am getting an error that it's missing required field 'gasLimit' though the field seems to be present in the genesis block.

System information

Geth Version: 1.8.2-stable
Git Commit: b8b9f7f
Architecture: amd64
Protocol Versions: [63 62]
Go Version: go1.9.2
Operating System: Windows 10

Puppeth to create Genesis block

PS> ./puppeth.exe
+-----------------------------------------------------------+
| Welcome to puppeth, your Ethereum private network manager |
|                                                           |
| This tool lets you create a new Ethereum network down to  |
| the genesis block, bootnodes, miners and ethstats servers |
| without the hassle that it would normally entail.         |
|                                                           |
| Puppeth uses SSH to dial in to remote servers, and builds |
| its network components out of Docker containers using the |
| docker-compose toolset.                                   |
+-----------------------------------------------------------+

Please specify a network name to administer (no spaces or hyphens, please)
> bugdemo

Sweet, you can set this via --network=bugdemo next time!

INFO [03-14|12:22:31] Administering Ethereum network           name=bugdemo
WARN [03-14|12:22:31] No previous configurations found         path=.puppeth\\bugdemo

What would you like to do? (default = stats)
 1. Show network stats
 2. Configure new genesis
 3. Track new remote server
 4. Deploy network components
> 2

Which consensus engine to use? (default = clique)
 1. Ethash - proof-of-work
 2. Clique - proof-of-authority
> 1

Which accounts should be pre-funded? (advisable at least one)
> 0x5AEDA56215b167893e80B4fE645BA6d5Bab767DE
> 0x

Specify your chain/network ID if you want an explicit one (default = random)
>
INFO [03-14|12:23:21] Configured new genesis block

What would you like to do? (default = stats)
 1. Show network stats
 2. Manage existing genesis
 3. Track new remote server
 4. Deploy network components

Contents of Genesis block file

For brevity, I have omitted most of accounts 00...FF which each have a 1 Wei balance in the genesis block file produced by puppeth (I don't fully understand why, but that seems to be an unrelated issue). Otherwise, this is the block file verbatim.

{
  "genesis": {
    "config": {
      "chainId": 24965,
      "homesteadBlock": 1,
      "eip150Block": 2,
      "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
      "eip155Block": 3,
      "eip158Block": 3,
      "byzantiumBlock": 4,
      "ethash": {}
    },
    "nonce": "0x0",
    "timestamp": "0x5aa94c4f",
    "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit": "0x47b760",
    "difficulty": "0x80000",
    "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x0000000000000000000000000000000000000000",
    "alloc": {
      "0000000000000000000000000000000000000000": {
        "balance": "0x1"
      },
      "00000000000000000000000000000000000000ff": {
        "balance": "0x1"
      },
      "5aeda56215b167893e80b4fe645ba6d5bab767de": {
        "balance": "0x200000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "number": "0x0",
    "gasUsed": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
  }
}

Note the line "gasLimit": "0x47b760", which looks as present as any other.

Attempts to Run: Actual Behavior

PS> mkdir ./data/bugdemo
PS> ./geth.exe --datadir data/bugdemo init .puppeth/bugdemo
Fatal: invalid genesis file: missing required field 'gasLimit' for Genesis

(Output of mkdir omitted but successful).
For comparison:

PS> ./geth.exe --datadir data/bugdemo init .puppeth/nofile
Fatal: Failed to read genesis file: open .puppeth/nofile: The system cannot find the file specified.

Expected behaviour

I expected the init to complete successfully and not report 'gasLimit' was missing, as it seems to be there in the JSON.

@wbt wbt changed the title Invalid genesis file with puppet and geth Invalid genesis file with puppeth and geth Mar 14, 2018
@CJHackerz
Copy link

Same issue I having

@gueux
Copy link

gueux commented Apr 1, 2018

It looks like puppeth generate one useless level of JSON object:
{ "genesis": {} }

Try to omit "genesis" section as in official example of genesis block:
https://github.com/ethereum/go-ethereum/wiki/Private-network

@fgimenez
Copy link
Contributor

fgimenez commented Apr 5, 2018

@wbt I think you should not use ~/.pupppeth/bugdemo as the genesis file, when you get to the last step in the issue description you should actually export the genesis configuration to a file:

What would you like to do? (default = stats)
 1. Show network stats
 2. Manage existing genesis
 3. Track new remote server
 4. Deploy network components
> 2

 1. Modify existing fork rules
 2. Export genesis configuration
 3. Remove genesis configuration
> 2

Which file to save the genesis into? (default = bugdemo.json)
> 
INFO [04-05|17:02:23] Exported existing genesis block 

In my case that gives a proper genesis file:

$ cat ./bugdemo.json
{
  "config": {
    "chainId": 47279,
    "homesteadBlock": 1,
    "eip150Block": 2,
    "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "eip155Block": 3,
    "eip158Block": 3,
[.......]

Hope this helps.

@ghost
Copy link

ghost commented Apr 5, 2018 via email

@holiman
Copy link
Contributor

holiman commented Dec 4, 2018

Yup, @fgimenez is correct, use the exported genesis instead

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

No branches or pull requests

7 participants