[Ethereum] Fatal:invalid genesis file:hex string has length 2, want 64 for common.hash

blockchaingenesis

I'm new on the website. I'm following a french tutorial (yes i'm french) to create my own blockchain network. After installing all Geth stuff, creating my genesis file as following :

{
"nonce": "0x00",
"difficulty": "0x1000",
"mixHash": "0x00",
"timestamp": "0x00",
"parentHash": "0x00",
"extraData": "0x00",
"gasLimit": "0x1000000000"
}

Then I tiped the following line :

sudo geth –datadir ./noeud1 –networkid "100" init genesis.json

I have the following error :

Fatal:invalid genesis file: hex string has length 2, want 64 for common.hash

Thank you for helping 🙂

Best Answer

Copy the follwing code in your genesis.json file

{
 "nonce": "0x0000000000000042",
 "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "difficulty": "0x400",
 "alloc": {},
 "coinbase": "0x0000000000000000000000000000000000000000",
 "timestamp": "0x00",
 "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
 "extraData": "0x",
 "gasLimit": "0xffffffff",
 "config": {
    "chainId": 59,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
 }
}

You can put your own chainid , not 1,2,3 they are Reserved

then run the command

geth --datadir ~ / yourDataDirectory  init genesis.json 

or Follow this tutorial, its very helpful. Chainskills

Related Topic