0

I am getting this error this error at creation of genesis block:

[niko@localhost go-ethereum]$ cat /home/niko/saved-niko-home/aet/genesis-test.json
{
    "config": {
        "chainId": 777,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": 131072,
    "gasLimit": 2100000,
    "alloc": {
        "0db459d44280be8d8999b32cc1b22228ad803fa1" : {"balance":1000}
    }
}
[niko@localhost go-ethereum]$ build/bin/geth --datadir=/home/niko/saved-niko-home/aet init /home/niko/saved-niko-home/aet/genesis-test.json 
Fatal: invalid genesis file: json: cannot unmarshal number into Go struct field Genesis.alloc of type *math.HexOrDecimal256
[niko@localhost go-ethereum]$ 

Validated with all online JSON validators out there, strict and non-strict, doesn't show any error. What is the problem here?

1 Answer 1

2

The problem is that JSON doesn't have a numeric type with the precision required for some fields in the genesis.json. A workaround is to use strings.

{
    "config": {
        "chainId": 777,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "131072",
    "gasLimit": "2100000",
    "alloc": {
        "0db459d44280be8d8999b32cc1b22228ad803fa1" : {"balance":"1000"}
    }
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.