Go-Ethereum Error – Fixing ‘Max Invalid Genesis File: Hex String Has Odd Length’ Error

blockchaingenesisgo-ethereumprivate-blockchain

I am trying to create a genesis block on my mac for a local ethereum network but I am getting the error:

invalid genesis file: hex string has odd length

when i do it.

My code is the following:

{ 
  "nonce": "0x0000000000000042", 
  "timestamp": "0x0", 
  "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", 
  "extraData": "0x0", 
  "gasLimit": "0x8000000", 
  "difficulty": "0x400", 
  "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", 
  "coinbase": "0x3333333333333333333333333333333333333333", 
  "alloc": { }
}

Best Answer

The same problem happened to me with geth 1.6, with a genesis file similar to yours.

Last friday geth updated to 1.6 (https://github.com/ethereum/go-ethereum/releases/tag/v1.6.0).

In this release:

Genesis block JSON handling is stricter and safer. Notably, most JSON fields now require the "0x" prefix. (#3794)

I found this documentation page: https://github.com/ethereum/go-ethereum/wiki/Private-network

In this page there is an example of a genesis file that works on geth 1.6.

I think your genesis file works with previous versions.

Related Topic