L
L
lexa782022-02-13 21:26:44
Computer networks
lexa78, 2022-02-13 21:26:44

Why is the node not connected via bootnode?

Hello. I want to create a private ethereum blockchain network so that I can deploy it in docker. But, for some reason, the nodes cannot be synchronized. They find the bootnode, but when connecting, an error occurs

Dial error id=8d5107cf4e03772d addr=172.25.0.101:30311 conn=dyndial err="connect: connection refused"

At the same time, all containers in docker are up and running. But, when publishing a contract, it hangs, because no one can confirm it. And the method call
net_peerCount()
returns 0.
My docker-compose.yml

version: '3'

services:
    nginx:
        image: nginx:latest
        ports:
            - "80:80"
            - "443:443"
        volumes:
            - ./hosts:/etc/nginx/conf.d
            - ./www:/var/www
            - ./logs/nginx:/var/log/nginx
        links:
            - php
        networks:
          chainnet:
            ipv4_address: 172.25.0.120
    php:
        build: ./images/php
        links:
            - mysql
        volumes:
            - ./www:/var/www
        networks:
          chainnet:
            ipv4_address: 172.25.0.110
    geth-bootnode:
        hostname: geth-bootnode
        environment:
            - nodekeyhex=08f0e1dee5c1b4645f3331a566009e41a4514b6cd28656d63d0449ecf812812b #Needs to be fix, so that the miners know the resulting enode id
            - ip=172.25.0.101:30311
        build:
            context: ./images/bootnode
        ports:
            - 30311:30311/udp
        networks:
            chainnet:
                ipv4_address: 172.25.0.101
    geth-dev-miner-1:
        hostname: geth-dev-miner-1
        depends_on:
            - geth-bootnode
        environment:
            - address=0x8cc5a1a0802db41db826c2fcb72423744338dcb0 
            - bootnodeId=76a8171707eca17647a47ca99ffd348927dfa60102792ea349a25d5192e61855be83b786e376276a306afcceea4ffd1c9c77e4370b417efc39f328a0d068004c 
            - bootnodeIp=172.25.0.101
            - port=30312
        build:
            context: ./images/miner
            args:
                privatekey: df504d175ae63abf209bad9dda965310d99559620550e74521a6798a41215f46 
                password: pass
        container_name: geth-miner-1
        ports:
            - 8545:8545
        volumes:
            - eth-data-1:/ethchaindata/.ethash
        networks:
            chainnet:
                ipv4_address: 172.25.0.102
    payment-wallet:
        hostname: payment-wallet
        depends_on:
            - geth-bootnode
        environment:
            - address=0x53bea6b968af89da6ffbd86f7669f44745781055 #derived from the private key which is passed in the args
            - bootnodeId=76a8171707eca17647a47ca99ffd348927dfa60102792ea349a25d5192e61855be83b786e376276a306afcceea4ffd1c9c77e4370b417efc39f328a0d068004c #derived from the nodekeyhex of the bootnode
            - bootnodeIp=172.25.0.101
            - port=30315
        build:
            context: ./images/node
            args:
                privatekey: 730fe7a7ea6f1c8fcec26e102bea05191bd30675c3c17b9a67626397ac9f0e4a
                password: payment-wallet
        container_name: payment-wallet
        ports:
            - 8547:8545
        volumes:
            - payment-wallet:/ethchaindata/.ethash
        networks:
            chainnet:
                ipv4_address: 172.25.0.108
networks:
    chainnet:
        driver: bridge
        ipam:
            config:
                - subnet: 172.25.0.0/24

volumes:
    eth-data-1:
    payment-wallet:


Miner Dockerfile

FROM ubuntu:xenial

WORKDIR "/opt"

RUN apt-get update \
    && apt-get install -y software-properties-common \
    && add-apt-repository -y ppa:ethereum/ethereum \
    && apt-get update \
    && apt-get install -y ethereum

ADD ./genesis.json ./genesis.json
RUN geth init genesis.json

ARG password
ARG privatekey
RUN echo $password > ~/.accountpassword && echo $privatekey > ~/.privatekey

RUN geth account import --password ~/.accountpassword  ~/.privatekey

ENV address=""
ENV bootnodeId=""
ENV bootnodeIp=""
ENV port=""
CMD exec geth --bootnodes "enode://[email protected]$bootnodeIp:30311" --networkid="500" --verbosity=5 --mine --miner.threads=2 --miner.etherbase $address --unlock $address --password ~/.accountpassword --syncmode full --port $port --nat extip:$bootnodeIp



For the node that publishes the contract, the dockerfile is the same, only geth is launched without --mine, but with --http

Please tell me which way to dig at least.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2022-02-13
@KingstonKMS

Port tcp 30311 must also be forwarded to the container

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question