This project provide a private ethereum blockchain based on a geth cluster with additional features.
F1: automatically P2P discovery with a bootnode for all ethereum miners
F2: miners are scalable while runtime
F3: exposed node for interacting (additional miners, remix, web3, node-red, ...) from outside with the blockchain
F4: smart contract deployment with truffle
F5: integrated blockchain explorer
F6: some tests :)
ever wanted to have your own ethereum blockchain and just play a little?
...then it's a match ;)
- docker 18.03.0-ce <=
- docker-compose 1.21.0 <=
CPU depends heavy on running miner count, default miner count is 2, each miner mines with 1 cpu thread
- Disk Space (docker dir) >= 10GB
- CPU >= 4
- Memory >= 2GB
- clone geth-cluster repo
- edit envar.env file and set environment variables for your setup
docker-compose up
Ethereum Blockchain needs about 30 minutes for bootstrapping (depends on your cpu hardware), which means to build and run all containers. Building container is only required if they are not already build once. The ethereum network builds a DAG (directed acyclic graph) for the proof of work algorithm. The building process takes all available cpu cores from the docker host machine. After the DAG was built miner nodes are starting to mine. The DAG is generated only once as long as the containers are not destroyed.
docker-compose up -d --scale geth-miner=${MinerCount} --no-recreate
Every miner, including exposed node, has already an existing ethereum account. The account address is located in the file /privatechain/accID inside each miner container or you can use geth console to get it. The account will be generated when the miner containers are first started. The password is predefined in the file geth-miner/passfile.
Genesis block is predefined with a very low difficulty to mine. In generally it sould take about 10-20 seconds to mine the next block.
Tested with: Debian Stretch (9.4) | docker 18.03.0-ce | docker-compose 1.21.0
The geth cluster needs some time to bootstrap and get the ethereum network ready. Tests can fail if they are executed to fast after the docker-compose is started.
docker build -t testing-1 testing
docker run -it --network=geth-cluster_overlay --env-file envar.env testing-1
Deploy solidity smart contract with truffle. There are two example smart contracts in the folder truffle/sc.
For developing your own smart contract use truffle and your preferred IDE and put it in a separate folder truffle/your-smart-contract.
Both example smart contract are ready to deploy on your ethereum network.
docker build -t truffle-1 truffle
docker run -it -w /dapp/${WorkDirSmartContract} --network=geth-cluster_overlay truffle-1 migrate --network geth-chain
# example for deploying example smart contract called "Weather1"
docker run -it -w /dapp/your-smart-contract --network=geth-cluster_overlay truffle-1 migrate --network geth-chain