源码方式安装tendermint和ethermint非常痛苦,基本要通过多个不同的vpn翻墙才能把所有依赖下载下来。
好在官方提供了docker镜像,如果不需要修改源码,docker镜像方式是个不错的选择。
初始化了测试账号,如果不需要或者链接失效可以自己修改
version: '2'
services:
ethermint-service:
image: adrianbrink/ethermint
container_name: ethermint-service
volumes:
- ~/volumes/ethermint:/ethermint
command: bash -c "mkdir -p /setup/keystore/ && touch /setup/keystore/UTC--2016-10-21T22-30-03.071787745Z--7eff122b94897ea5b0e2a9abf47b86337fafebdc && wget -O /setup/keystore/UTC--2016-10-21T22-30-03.071787745Z--7eff122b94897ea5b0e2a9abf47b86337fafebdc https://raw.githubusercontent.com/tendermint/ethermint/develop/setup/keystore/UTC--2016-10-21T22-30-03.071787745Z--7eff122b94897ea5b0e2a9abf47b86337fafebdc && touch /setup/genesis.json && wget -O /setup/genesis.json https://raw.githubusercontent.com/tendermint/ethermint/develop/setup/genesis.json && ethermint --datadir /ethermint init /setup/genesis.json && cp -r /setup/keystore /ethermint && ethermint --datadir /ethermint --tendermint_addr tendermint-service:46657 --rpc --rpcaddr=0.0.0.0 --ws --wsaddr=0.0.0.0 --rpcapi eth,net,web3,personal,admin,shh"
ports:
- 8545:8545
tendermint-service:
image: adrianbrink/tendermint
container_name: tendermint-service
volumes:
- ~/volumes/ethermint/tendermint:/tendermint
entrypoint: ""
command: bash -c "tendermint init --home /tendermint && tendermint --home /tendermint --proxy_app tcp://ethermint-service:46658 node"
docker-compose -f docker-compose.yml up
geth attach http://localhost:8545
> personal.listAccounts
["0x7eff122b94897ea5b0e2a9abf47b86337fafebdc"]
> eth.getBalance("0x7eff122b94897ea5b0e2a9abf47b86337fafebdc")
1e+34