Go-ethereum: `geth init custom-genesis.json` fails

Created on 20 Apr 2017  路  2Comments  路  Source: ethereum/go-ethereum

_Probably duplicate of https://github.com/ethereum/go-ethereum/issues/14352_

System information

Geth
Version: 1.6.0-stable
Git Commit: facc47cb5cec97b22c815a0a6118816a98f39876
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.8.1
Operating System: darwin
GOPATH=/Users/jan/Dev/go/
GOROOT=/usr/local/Cellar/go/1.8.1/libexec

Expected behaviour

geth should initialize a private testnet using custom genesis file from README.md.

Actual behaviour

geth init CustomGenesis.json returns an error.

Steps to reproduce the behaviour

  • In an empty directory create a file CustomGenesis.json with data copied from README.md:
{
  "alloc"      : {},
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x2fefd8",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}
  • Run geth init CustomGenesis.json.
  • Observe the errors.

Backtrace

$ geth init CustomGenesis.json WARN [04-20|10:51:04] No etherbase set and no accounts found as default INFO [04-20|10:51:04] Allocated cache and file handles database=/Users/jan/Library/Ethereum/geth/chaindata cache=128 handles=1024 Fatal: failed to write genesis block: genesis has no chain configuration

Most helpful comment

You need to specify a config field in the genesis json which defines the protocol rules. Such as

    "config": {
        "chainId": 987654321,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },

https://github.com/ethereum/go-ethereum/wiki/Private-network#creating-the-genesis-block.

The README should definitely be updated. I'll leave this issue open until then.

All 2 comments

You need to specify a config field in the genesis json which defines the protocol rules. Such as

    "config": {
        "chainId": 987654321,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },

https://github.com/ethereum/go-ethereum/wiki/Private-network#creating-the-genesis-block.

The README should definitely be updated. I'll leave this issue open until then.

It's present in README now.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VoR0220 picture VoR0220  路  3Comments

phpsamsb picture phpsamsb  路  3Comments

freshonline picture freshonline  路  3Comments

ysqi picture ysqi  路  3Comments

tymat picture tymat  路  3Comments