Docker image for Ethereum testnet using proof-of-authority consensus protocol based on Geth's latest version. By default two accounts will be created, one serving as a signer and another one which holds all the coins on the testnet.
Clone the repository
git clone https://github.com/Ethereumx/private_poa_network.git && cd private_poa_network
$ docker build -t poa/geth-poa:latest .
$ docker run -p 8545:8545 -p 8456:8456 poa/geth-poa:latest
- Error:
/bin/sh: /app/entrypoint.sh: not found
- Reason: occurs when using Docker Windows, files are saved with Windows line endings (CRLF) rather than Unix's (LF).
- solution: proceed with the following steps
- Convert
entrypoint.sh
file from CRLF to LF:
dos2unix entrypoint.sh
- Delete the generated testing container (because you don't need it anymore):
docker rm container_id
- Retest the container:
docker build -t poa/geth-poa:latest .
Now you can move on to the next step.
If test is ok you can start containers using
$ docker-compose up -d
you can remove -d to get docker-comopse output
stop it using docker-compose down
Add to static-nodes enodes strings separated by comma
enode://2f0802fddeeee8de3c20dbaff11f5cb8baf3abffe8a33a38f25767d2f727f7fb5fda8ac192b9823466c093dd84d78b6fd460c0add591518aaf772ba2b9f5b6a6@192.168.1.11:30301,enode://...
using the container_id connect to the running peer using
docker exec -ti container_id bash
then run
geth attach http://localhost:8545
in the opened CLI run
> admin.nodeInfo.enode
The ouput will be like
enode://...@9[::]:30301
[::] will be parsed as localhost (127.0.0.1). If your nodes are on a local network check each individual host machine
check container's log using :
docker logs -f poadocker_geth_1
Blockscout doesn't support 1.10 (latest geth) blockscout/blockscout#4335
--http.addr 0.0.0.0
and other http option, as described here https://hub.docker.com/r/ethereum/client-go/, are not suported by 1.9 but >=1.10
You'll need to use --rpc.allow-unprotected-txs
to receive Nethereum transactions
Think of reseting Metamask account after each rebuild of the image
when modify the config make sure you remove the docker volume and rebuild the container
you can use the option --config <toml file>
instead putting the configuration options directly in geth command
to geenrate a toml file you can use :
geth <with all needed options> dumpconfig > config.toml
Remove all volumes and containers (Or just remove the volume and container created by the dockerfile)
docker rm $(docker ps -qa -f "status=exited")
docker container prune
docker volume rm $(docker volume ls -q)
you can add the BootstrapNodes =["0x"....] to toml file
BootstrapNodes = ["enode://d860a01f9722d78...051758@34.255.23.113:30303", "enode:"]
We set clique.period
inside genesis.json file to zero, to ensure mining only when ever required with out empty block generation.
clique": {
"period": 0,
"epoch": 30000
},
You can override genesis.json
by mounting your own at /app
. Please bear in mind that $ETH_ADDRESS
and $ETH_BUFFER
strings will be replaced with the environment variables.
Generate a key and start the boot node on any random port
bootnode -genkey boot.key
bootnode -nodekey -addr :8009
geth attach http://localhost:8545
- check using inside peer web3.eth.getCode("0x1000000000000000000000000000000000000920") "0x"
note: ensure geth "byzantiumBlock": 0 is set in the genesis.json file to enable status