这里假设已经存在 bootnodes 服务节点了,需要给私有网络中添加一个以太坊节点,用 docker 来部署比较方便,不用手动去添加。这里只是写了个简单的 demo,并不是一个完整基于 bootnodes 来部署以太坊私有网络的方法。
当然创建一个 bootnode 也很简单,大致步骤如下:
bootnode -genkey boot.key bootnode -nodekey boot.key -verbosity 9 -addr :30310 如果需要一个完整的基于 docker 的一台私有网络,可以通过 docker-compose 将 bootnode 和节点来编排,后面有空来完善一下。
具体源码 => https://github.com/yuansir/bootnodes-ethereum-peer-docker
Usage genesis.json 复制 bootnodes 链接所有节点的共同 genesis.json 文件
Dockerfile 根据需求修改 Dockerfile 中的环境变量
build image 比如 tag 为 eth-peer:1.0
docker build -t eth-peer:1.0 . run // docker run -it --rm --name your-name eth-peer:1.0 /bin/bash docker run -d --name your-name eth-peer:1.
Docker 是什么? Docker 是 Docker.Inc 公司开源的一个基于 LXC 技术之上构建的 Container 容器引擎,基于 Go 语言并遵从 Apache2.0 协议开源。
开发者可以搭建他们的应用仅仅一次,就能保证让这个应用保持一致的跑在任何地方。运营人员可以将他们的服务器配置一遍,就能跑任何应用。
What is Docker’s architecture? Docker uses a client-server architecture. The Docker client talks to the Dockerdaemon, which does the heavy lifting of building, running, and distributing your Docker containers. Both the Docker client and the daemon can run on the same system, or you can connect a Docker client to a remote Docker daemon. The Docker client and daemon communicate via sockets or through a RESTful API.