Fatal: invalid genesis file: invalid character ‘ï‘ after object key:value pair

解决初始化创世块json文件出错的问题


在进行以太坊创世区块文件的初始化过程中,报错:Fatal: invalid genesis file: invalid character ‘ï’ after object key:value pair
下面这是我未改动的json文件

{
  "config": {
     "chainId": 10,
     "homesteadBlock": 0,
     "eip155Block": 0,
     "eip158Block": 0
  },
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x2000",
  "extraData"  : "",
  "gasLimit"   : "0xffffffff",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00",
  "alloc": {
     "08a58f09194e403d02a1928a7bf78646cfc260b0": {
         "balance": "0x200000000000000000000000000000000000000000000000000000000000000"
     },
     "87366ef81db496edd0ea2055ca605e8686eec1e6": {
         "balance": "0x200000000000000000000000000000000000000000000000000000000000000"
     }
  }
}

经过了百般尝试,因为我这个代码直接拷贝过来的,有些漏掉了,可能是有些格式不对,后面自己重新拷贝尝试了,发现最后成功初始化了

INFO [10-23|16:11:14.842] Maximum peer count                       ETH=25 LES=0 total=25
INFO [10-23|16:11:14.844] Allocated cache and file handles         database=/root/privatechain/data/geth/chaindata cache=16 handles=16
INFO [10-23|16:11:14.890] Writing custom genesis block 
INFO [10-23|16:11:14.890] Persisted trie from memory database      nodes=3 size=457.00B time=88.532µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [10-23|16:11:14.890] Successfully wrote genesis state         database=chaindata                              hash=09deb3…c2afda
INFO [10-23|16:11:14.890] Allocated cache and file handles         database=/root/privatechain/data/geth/lightchaindata cache=16 handles=16
INFO [10-23|16:11:14.892] Writing custom genesis block 
INFO [10-23|16:11:14.892] Persisted trie from memory database      nodes=3 size=457.00B time=66.012µs gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
INFO [10-23|16:11:14.893] Successfully wrote genesis state         database=lightchaindata                              hash=09deb3…c2afda

建议大家重新拷贝或者是检查格式像是不是少了标点符号之类的,实在不行可以手敲一遍。

猜你喜欢

转载自blog.csdn.net/qq_43537319/article/details/120922045