Sample project for creating a local blockchain using geth
- geth installed from geth download page
- configurations like firewall policies taken care of
Run the following command
$ geth --datadir=./chaindata init ./genesis.json
$ geth --datadir=./chaindata
Docker container can be created to install geth and all its dependencies easily - it saves time on configuration and setup of node. A standard genesis block json is copied to the container which can be updated once the container is up. RPC ports 30303 and 8545 will be exposed from the container and a volume can be mounted to the private chain folder to utilise the geth.ipc file on the host. For creating a docker container, use the following commands -
$ docker build -t "ethereumprivatechain:0.1" .
$ docker run -it -v /path/where/you/cloned/the/project/EthereumPrivateChain/chaindata:/root/chaindata -p 32768:30303 -p 32769:8545 ethprivatechain:0.1
It lands the user inside the /root folder of the container with geth not running.
Same steps as initiating and running node with custom genesis block
$ geth --datadir=./chaindata init ./genesis.json
Starting the node
$ geth --nodiscover --datadir=./chaindata
Node is now up and running, it can be accessed from applications browsers running on a host system.