以下docker-compose.yml
用于启动以太坊geth
节点,该节点需要连接到引导节点才能访问专用的以太坊网络。
version: '2'
geth:
image: ethereum/client-go:latest
volumes:
- ./node:/root/.ethereum
- ./files/genesis.json:/root/genesis.json:ro
ports:
- "30303:30303"
- "30303:30303/udp"
- 8543:8545
command: --rpc --rpcaddr 0.0.0.0 --networkid 13377331 --bootnodes="enode://692b8eda368ffc427fc1a047850557536a0ef0bfa3b66f998e03e8b83c3fd8f786e3c2b710a20e2e821a9eff34fc7b34ffa326a8a5fbcf3634b55b44596ada43@159.999.999.999:30303" --nodiscover
但是,在运行docker-compose up
之后,我们看到回显的链配置是默认配置,而不是引导节点正在使用的配置
初始化的链配置config =“ {ChainID:1宅基地:1150000 DAO:1920000 DAOSupport:真EIP150:2463000 EIP155:2675000 EIP158:2675000拜占庭:4370000君士坦丁堡:发动机:ethash}”
问题::为什么geth
没有连接到引导节点,并且没有使用引导节点在其genesis.json
中具有的配置?
docker-compose输出:
geth_1 | WARN [07-15|00:48:33.310] Sanitizing cache to Go's GC limits provided=1024 updated=666
geth_1 | INFO [07-15|00:48:33.310] Maximum peer count ETH=25 LES=0 total=25
geth_1 | INFO [07-15|00:48:33.317] Starting peer-to-peer node instance=Geth/v1.8.13-unstable-2e0391ea/linux-amd64/go1.10.3
geth_1 | INFO [07-15|00:48:33.317] Allocated cache and file handles database=/root/.ethereum/geth/chaindata cache=499 handles=1024
geth_1 | INFO [07-15|00:48:33.331] Writing default main-net genesis block
geth_1 | INFO [07-15|00:48:33.632] Persisted trie from memory database nodes=12356 size=1.88mB time=84.3549ms gcnodes=0 gcsize=0.00B gctime=0s livenodes=1 livesize=0.00B
geth_1 | INFO [07-15|00:48:33.636] Initialised chain configuration config="{ChainID: 1 Homestead: 1150000 DAO: 1920000 DAOSupport: true EIP150: 2463000 EIP155: 2675000 EIP158: 2675000 Byzantium: 4370000 Constantinople: <nil> Engine: ethash}"
geth_1 | INFO [07-15|00:48:33.636] Disk storage enabled for ethash caches dir=/root/.ethereum/geth/ethash count=3
geth_1 | INFO [07-15|00:48:33.636] Disk storage enabled for ethash DAGs dir=/root/.ethash count=2
geth_1 | INFO [07-15|00:48:33.636] Initialising Ethereum protocol versions="[63 62]" network=1
geth_1 | INFO [07-15|00:48:33.637] Loaded most recent local header number=0 hash=d4e567…cb8fa3 td=17179869184
geth_1 | INFO [07-15|00:48:33.637] Loaded most recent local full block number=0 hash=d4e567…cb8fa3 td=17179869184
geth_1 | INFO [07-15|00:48:33.637] Loaded most recent local fast block number=0 hash=d4e567…cb8fa3 td=17179869184
geth_1 | INFO [07-15|00:48:33.640] Regenerated local transaction journal transactions=0 accounts=0
geth_1 | INFO [07-15|00:48:33.640] Starting P2P networking
geth_1 | INFO [07-15|00:48:33.641] RLPx listener up self="enode://27175216e04387fb93e87a4069021b640fc6f87f985c86940e3297103a2b5e348bdecec4eea98af6ee2f106890fd28b49e1d983b6c5b8ce9ae1571c032bf2d5c@[::]:30303?discport=0"
geth_1 | INFO [07-15|00:48:33.644] IPC endpoint opened url=/root/.ethereum/geth.ipc
geth_1 | INFO [07-15|00:48:33.645] HTTP endpoint opened url=http://0.0.0.0:8545 cors= vhosts=localhost
genesis.json
{
"config": {
"chainId": 13377331,
"homesteadBlock": 1,
"eip150Block": 2,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 3,
"eip158Block": 3,
"byzantiumBlock": 4,
"clique": {
"period": 15,
"epoch": 30000
}
},
....
答案 0 :(得分:1)
似乎您使用的是默认数据目录,而不是使用genesis.json初始化的私有数据目录。结果,geth通过使用默认的datadir(请参见输出中的database=/root/.ethereum/geth/chaindata
和versions="[63 62]" network=1
)开始作为主要的网络节点。
要启动您的专用节点,请尝试以下步骤:
使用genesis.json初始化您的geth数据目录。例如:
geth --datadir path/to/custom/data/folder init genesis.json
通过使用datadir和networkid来启动geth。例如:
geth --datadir path/to/custom/data/folder --networkid 13377331
请注意,这些步骤使用--datadir
选项。
有关更多信息,请参见the geth wiki。
答案 1 :(得分:1)
常规说明,将来可能会帮助您进行网络对等。
干杯