代码之家  ›  专栏  ›  技术社区  ›  Nyxynyx

以太坊Geth无法连接到Bootnode以访问私有以太坊网络

  •  2
  • Nyxynyx  · 技术社区  · 7 年前

    以下内容 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 homestead:1150000 dao:1920000 dao支持:真eip150:2463000 eip155:2675000 eip158:2675000拜占庭:4370000君士坦丁堡:引擎:ethash”

    问题: 为什么是 盖思 不连接到bootnode,也不使用bootnode在其 genesis.json ?

    Docker合成输出:

    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
    

    创世纪.json

    {
        "config": {
        "chainId": 13377331,
        "homesteadBlock": 1,
        "eip150Block": 2,
        "eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
        "eip155Block": 3,
        "eip158Block": 3,
        "byzantiumBlock": 4,
        "clique": {
            "period": 15,
            "epoch": 30000
        }
        },
    ....
    
    2 回复  |  直到 7 年前
        1
  •  1
  •   matt9    7 年前

    database=/root/.ethereum/geth/chaindata versions="[63 62]" network=1

    1. geth --datadir path/to/custom/data/folder init genesis.json

    2. geth --datadir path/to/custom/data/folder --networkid 13377331

    --datadir

    the geth wiki

        2
  •  1
  •   epm-bt    7 年前

    推荐文章