12

I'm following this guide and am trying to create a private network with its own block chain and peers.

I managed to install docker following this guide (I'm using a debian 8 jessie virtual machine) and also set up a python virtual environment for docker-compose:

($ pip install virtualenv)
$ mkdir temp_etherum
$ cd temp_ethereum
$ virtualenv venv
$ source venv/bin/activate
(venv) $ pip install docker-compose

Next I ran docker with the configuration file provided in the repository:

# docker-compose scale bootstrap=1 miner=2 eth=3

The virtual environment has to be started as root otherwise docker-compose can't connect to the UNIX socket.

The network starts and I see the expecting output:

# docker-compose ps
     Name                   Command               State                           Ports                          
----------------------------------------------------------------------------------------------------------------
bootstrap        /usr/local/bin/pyethapp -c ...   Up      127.0.0.1:30304->30303/tcp, 127.0.0.1:30304->30303/udp 
simple_eth_1     /usr/local/bin/pyethapp -c ...   Up                                                             
simple_eth_2     /usr/local/bin/pyethapp -c ...   Up                                                             
simple_eth_3     /usr/local/bin/pyethapp -c ...   Up                                                             
simple_miner_1   /usr/local/bin/pyethapp -c ...   Up                                                             
simple_miner_2   /usr/local/bin/pyethapp -c ...   Up

One thing that is not clear is, why are there six instances of pyethapp when the configuration file, docker-compose.yml, only specifies four:

bootstrap:
  image: ethereum/client-python
  container_name: bootstrap
  entrypoint: /usr/local/bin/pyethapp
  command: "-c eth.network_id=1337 -c node.privkey_hex=091bd6067cb4612df85d9c1ff85cc47f259ced4d4cd99816b14f35650f59c322 -b 'enode://288b97262895b1c7ec61cf314c2e2004407d0a5dc77566877aad1f2a36659c8b698f4b56fd06c4a0c0bf007b4cfb3e7122d907da3b005fa90e724441902eb19e@localhost:30303' run --fake"
  ports:
    - 127.0.0.1:30304:30303
    - 127.0.0.1:30304:30303/udp

eth:
  image: ethereum/client-python
  links: 
    - bootstrap
  entrypoint: /usr/local/bin/pyethapp
  command: "-c eth.network_id=1337 -b 'enode://288b97262895b1c7ec61cf314c2e2004407d0a5dc77566877aad1f2a36659c8b698f4b56fd06c4a0c0bf007b4cfb3e7122d907da3b005fa90e724441902eb19e@bootstrap:30303' run --fake"

miner:
  image: ethereum/client-python
  links: 
    - bootstrap
  entrypoint: /usr/local/bin/pyethapp
  command: "-c eth.network_id=1337 -b 'enode://288b97262895b1c7ec61cf314c2e2004407d0a5dc77566877aad1f2a36659c8b698f4b56fd06c4a0c0bf007b4cfb3e7122d907da3b005fa90e724441902eb19e@bootstrap:30303' -m 50 run --fake"

debug:
  image: ethereum/client-python
  container_name: debug
  links: 
    - bootstrap
  entrypoint: /usr/local/bin/pyethapp
  command: "-c eth.network_id=1337 -b 'enode://288b97262895b1c7ec61cf314c2e2004407d0a5dc77566877aad1f2a36659c8b698f4b56fd06c4a0c0bf007b4cfb3e7122d907da3b005fa90e724441902eb19e@bootstrap:30303' -l :debug,p2p:info run --fake"

Peer discovery always fails (is this likely because I'm running pyethapp on a virtual machine in VirtualBox with NAT network settings)?

Creating an account works:

docker run -it --rm --link bootstrap:bootstrap -v /tmp/pyethapp:/root/.config ethereum/client-python account new

But when I try to mine using that account:

docker run -it --rm --link bootstrap:bootstrap -v /tmp/pyethapp:/root/.config ethereum/client-python -c eth.network_id=1337 -b 'enode://288b97262895b1c7ec61cf314c2e2004407d0a5dc77566877aad1f2a36659c8b698f4b56fd06c4a0c0bf007b4cfb3e7122d907da3b005fa90e724441902eb19e@bootstrap:30303' -m 50 run --fake

I get the following error from the peer manager:

INFO:accounts   searching for key files directory=/root/.config/pyethapp/keystore
INFO:accounts   found account(s) accounts=[<Account(address=8c78df6398b1858f2157b455cbe8b22f30768992, id=None)>]
INFO:app    registering service service=accounts
INFO:db opening LevelDB path=/root/.config/pyethapp/leveldb max_open_files=128 block_cache_size=8388608 write_buffer_size=4194304
INFO:app    registering service service=db
INFO:p2p.discovery  NodeDiscovery init 
INFO:p2p.discovery  starting discovery proto this_enode=enode://7ded504e4f48f9a6b6d316b2b57a986a23427e95e1fa6f80dcd758a5fdfefa643ce528b2e613fa91831a088486ef1f51c822232a2b1c3906c0b6250d38793935@0.0.0.0:30303
INFO:app    registering service service=discovery
INFO:p2p.peermgr    PeerManager init 
INFO:app    registering service service=peermanager
INFO:eth.chainservice   initializing chain 
INFO:eth.chain  Initializing new chain 
INFO:eth.chain  new genesis difficulty=17179869184 genesis_hash=<Block(#0 d4e56740)>
INFO:eth.chainservice   chain at number=0
INFO:app    registering service service=chain
INFO:app    registering service service=pow
WARNING:jsonrpc could not import solidity 
INFO:app    registering service service=jsonrpc
INFO:app    registering service service=console
INFO:app    starting 
INFO:p2p.peermgr    starting peermanager 
INFO:p2p.peermgr    starting listener host=0.0.0.0 port=30303
INFO:p2p.discovery  starting discovery 
INFO:p2p.discovery  starting listener host=0.0.0.0 port=30303
INFO:jsonrpc    starting JSONRPCServer port=4000
INFO:p2p.peermgr    waiting for bootstrap 
INFO:p2p.peermgr    missing peers known=1 num_peers=0 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peer   received hello client_version=pyethapp/v1.0.3/linux2/py2.7.9 version=4 capabilities=[['eth', 60], ['p2p', 4]]
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>
INFO:p2p.peermgr    missing peers known=1 num_peers=1 min_peers=5
INFO:p2p.peermgr    connecting random node=<Node(288b9726)>

Why?

1 Answer 1

0

It looks like the docker-compose scale command is being used to create additional instances of the miner and eth services.

The scale command allows you to specify the number of instances to create for a given service. For example, the command docker-compose scale miner=2 creates two instances of the miner service, and the command docker-compose scale eth=3 creates three instances of the eth service.

In the configuration file, each service is defined by a block of YAML with a name and a set of instructions for how to create instances of the service. In this case, the bootstrap, eth, and miner services are all defined, and the scale command is used to create additional instances of these services.

So, in total, you have one instance of the bootstrap service, two instances of the miner service, and three instances of the eth service, which is why you see six instances of pyethapp when you run docker-compose ps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.