Giter VIP home page Giter VIP logo

ethereum-dev's Introduction

以太坊多节点私链开发

为了便于调试开发,利用docker-compose一键启动以太坊的POA共识私链

docker-compose up即可启动开发环境,默认启动7个节点,其中3个负责挖矿,默认RPC的通信地址是宿主机的8545端口。

目录介绍:

config目录, 放置了基本配置信息,其中创世块和账号信息可替换成自己的,具体生成过程可参考搭建以太坊私链 , 替换后,还要修改下docker-compose.yml里的ACCOUNT变量

docker目录 是镜像的制作文件

调试方法

默认开放了签名节点的RPC接口,地址分别是所在宿主机IP的8545,8546,8547端口,细节如下:

➜ docker-compose ps                                 
  Name                Command               State                 Ports               
-------------------------------------------------------------------------------------
bootnode   sh -c bootnode -genkey=/ho ...   Up      30303/tcp, 8545/tcp               
node0      sh run.sh                        Up      30303/tcp, 0.0.0.0:8545->8545/tcp 
node1      sh run.sh                        Up      30303/tcp, 0.0.0.0:8546->8545/tcp 
node2      sh run.sh                        Up      30303/tcp, 0.0.0.0:8547->8545/tcp 
node3      sh run.sh                        Up      30303/tcp, 8545/tcp               
node4      sh run.sh                        Up      30303/tcp, 8545/tcp               
node5      sh run.sh                        Up      30303/tcp, 8545/tcp               
node6      sh run.sh                        Up      30303/tcp, 8545/tcp 

如果宿主机有geth的话,可以这样操作快捷进入console,

➜ sudo geth attach ipc:\./node0/geth.ipc
[sudo] password for xxp: 
Welcome to the Geth JavaScript console!

instance: Geth/v1.6.7-stable-ab5646c5/linux-amd64/go1.7.3
coinbase: 0x16d071a5374281dd27f2c946c08bd01283ec86eb
at block: 37 (Fri, 15 Sep 2017 16:10:11 CST)
 datadir: /root/.ethereum
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> 
> net.peerCount
6
>

如果宿主机没有geth的话,也可以利用容器特性快速操作进入console,

➜  docker exec -it node0 sh
/ # geth attach
Welcome to the Geth JavaScript console!

instance: Geth/v1.6.7-stable-ab5646c5/linux-amd64/go1.7.3
coinbase: 0x16d071a5374281dd27f2c946c08bd01283ec86eb
at block: 117 (Fri, 15 Sep 2017 16:14:11 CST)
 datadir: /root/.ethereum
 modules: admin:1.0 clique:1.0 debug:1.0 eth:1.0 miner:1.0 net:1.0 personal:1.0 rpc:1.0 txpool:1.0 web3:1.0

> 
> net.peerCount
6
>

前端层面

后续会对接前端UI项目

ethereum-dev's People

Contributors

xiaoping378 avatar

Stargazers

 avatar zhangdesheng avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.