首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >创建CustomGenesis错误

创建CustomGenesis错误
EN

Ethereum用户
提问于 2018-03-05 20:39:56
回答 1查看 532关注 0票数 0

我正在尝试在我的本地Ethereum测试网上部署。我的新测试地址需要一个平衡。所以我试着创建一个创世纪档案:

代码语言:javascript
复制
geth init
Fatal: Must supply path to genesis JSON file
~/geth init CustomGenesis.json
Fatal: invalid genesis file: json: cannot unmarshal hex string of odd length into Go struct field Genesis.extraData of type hexutil.Bytes
~/geth init CustomGenesis2.json
Fatal: Failed to read genesis file: open CustomGenesis2.json: no such file or directory
~/e CustomGenesis.json
~/cat CustomGenesis.json
{
    "nonce": "0x0000000000000042",
    "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extraData": "0x0",
    "gasLimit": "0x8000000",
    "difficulty": "0x400",
    "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "coinbase": "0x3333333333333333333333333333333333333333",
    "alloc": {
     "0x9370855ace244dc18fba024988046dde0d9f8ad8": {
      "balance": "1000000000000000000000"
      }
    }
}

我的CustomGenesis.json怎么了?

编辑:

我试着从https://github.com/ethereum/go-ethereum/wiki/Private-network运行这些命令

CustomGenesis.json:

代码语言:javascript
复制
{
    "config": {
        "chainId": 15,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
    "difficulty": "200000000",
    "gasLimit": "2100000",
     "alloc": {
     "0x9370855ace244dc18fba024988046dde0d9f8ad8": {
      "balance": "1000000000000000000000"
      }
    }
}

若要创建使用此成因块的数据库,请运行以下命令。这将导入并为您的链设置规范的成因块。

genesis.json中的数据路径/到/自定义/数据/文件夹

将来在这个数据目录上运行geth将使用您定义的成因块。

geth --datadir path/to/定制/data/文件夹--networkid 15

所以我用

代码语言:javascript
复制
geth --rpc --datadir path/to/custom/data/folder --networkid 15
WARN [03-05|19:33:23] No etherbase set and no accounts found as default
INFO [03-05|19:33:23] Starting peer-to-peer node               instance=Geth/v1.7.2-stable/darwin-amd64/go1.9.2
INFO [03-05|19:33:23] Allocated cache and file handles         database=/Users/quantum/cc/geth/path/to/custom/data/folder/geth/chaindata cache=128 handles=1024
INFO [03-05|19:33:23] Initialised chain configuration          config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Engine: ethash}"
INFO [03-05|19:33:23] Disk storage enabled for ethash caches   dir=/Users/quantum/cc/geth/path/to/custom/data/folder/geth/ethash count=3
INFO [03-05|19:33:23] Disk storage enabled for ethash DAGs     dir=/Users/quantum/.ethash                                        count=2
INFO [03-05|19:33:23] Initialising Ethereum protocol           versions="[63 62]" network=15
INFO [03-05|19:33:23] Loaded most recent local header          number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [03-05|19:33:23] Loaded most recent local full block      number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [03-05|19:33:23] Loaded most recent local fast block      number=0 hash=d4e567…cb8fa3 td=17179869184
INFO [03-05|19:33:23] Loaded local transaction journal         transactions=0 dropped=0
INFO [03-05|19:33:23] Regenerated local transaction journal    transactions=0 accounts=0
INFO [03-05|19:33:23] Starting P2P networking
INFO [03-05|19:33:25] UDP listener up                          self=enode://cd3f867d2e6e268ab27e555e255097bb96f1f61381dcce74c90a11ee2f960e8542955764a14c7e96e5002b10eb2cc74badf29f974d4d3b61b936e2be36bfe7b6@[::]:30303
INFO [03-05|19:33:25] RLPx listener up                         self=enode://cd3f867d2e6e268ab27e555e255097bb96f1f61381dcce74c90a11ee2f960e8542955764a14c7e96e5002b10eb2cc74badf29f974d4d3b61b936e2be36bfe7b6@[::]:30303
INFO [03-05|19:33:25] IPC endpoint opened: /Users/quantum/cc/geth/path/to/custom/data/folder/geth.ipc
INFO [03-05|19:33:25] HTTP endpoint opened: http://127.0.0.1:8545

然后在一个新壳里,

代码语言:javascript
复制
geth attach
Fatal: Unable to attach to remote geth: dial unix /Users/quantum/Library/Ethereum/geth.ipc: connect: no such file or directory

所以现在我无法连接到我的测试网络。

代码语言:javascript
复制
geth version
Geth
Version: 1.7.2-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.9.2


Operating System: darwin
GOPATH=/Users/quantum/code/go
GOROOT=/usr/local/Cellar/go/1.9.2/libexec
EN

回答 1

Ethereum用户

发布于 2018-03-15 02:56:55

在命令行中运行geth account new,在控制台中运行personal.newAccount("password")

票数 0
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/41800

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档