Install 3 nodes with docker.
At each node.
docker pull ethereum/client-go
docker run --rm ethereum/client-go --help
At each node.
docker volume create geth-data
At mining node.
docker run --rm --mount source=geth-data,target=/root/.ethereum -it ethereum/client-go account new
Enter password.
Save the address. For example, 0x0b00eE34d8C298C5dbf51814f0942e7A3ADcDB91.
We are using PoA (clique) consensus.
- Select random chainId.
- Replace addresses in extradata and alloc.
Copy this file at each node.
{
"config": {
"chainId": 65165461561,
"homesteadBlock": 0,
"eip150Block": 0,
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"clique": {
"period": 5,
"epoch": 30000
}
},
"difficulty": "1",
"gasLimit": "8000000",
"extradata": "0x00000000000000000000000000000000000000000000000000000000000000000b00eE34d8C298C5dbf51814f0942e7A3ADcDB910000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"alloc": {
"0x0b00eE34d8C298C5dbf51814f0942e7A3ADcDB91": { "balance": "1000000000000000000000000000000000" }
}
}
At each node.
docker run --rm --mount source=geth-data,target=/root/.ethereum -v`pwd`/genesis.json:/etc/genesis.json -it ethereum/client-go init /etc/genesis.json
docker run --rm --name geth-private --detach --network host --mount source=geth-data,target=/root/.ethereum -v`pwd`/password:/etc/ethereum-password -it ethereum/client-go --networkid 65165461561 --unlock 0x0b00eE34d8C298C5dbf51814f0942e7A3ADcDB91 --password /etc/ethereum-password --mine
docker exec geth-private geth attach --exec admin.nodeInfo.enode
BOOT_NODES=
docker run --rm --name geth-private --network host --mount source=geth-data,target=/root/.ethereum -it ethereum/client-go --networkid 65165461561 --http --http.addr 0.0.0.0 --bootnode $BOOT_NODES
docker exec -it geth-private geth attach
docker logs geth-private
docker kill geth-private