USING PUPPETH TO CREATE PRIVATE ETHEREUM NETWORK
In this blog, we will use the puppeth cli tool available from go-ethereum release of 1.6, to create a local ethereum network with geth 1.7.
First of all clone the go-ethereum repository from, https://github.com/ethereum/go-ethereum.git .
Then follow the installation instructions from here - https://github.com/ethereum/go-ethereum/wiki/Building-Ethereum to build your own geth executable. To get the puppeth executable, instead of using the command 'make geth' , use 'make all' to build all executables available in go-ethereum directory.
If the installation is successfull, you will see numerous executables like bootnodes , geth and among them one named puppeth. If you are not able to build all executables, make sure the installation instructions are followed in order.
USING PUPPETH TO SET UP YOUR POA NETWORK
1) Copy your puppeth executable to a directory you see perfect to test your local ethereum network.
2) Next create a data directory with a single account , to which we will assign the privilege to mine on this network.
3) Usegeth --datadir ethNode1 account new to create a new account.
4) Set up the password for yourcoinbase account and continue.
5) Now start thepuppeth cli by running the puppeth executable.
6) Then follow the below steps to run aethereum node which mines at a block per 10 second to test your local ethereum network :
a) Select configure new genesis after you haveslected a nae for your local ethereum network.
b) Next select the consensus model for your private network. Use Proof of Authority consensus model for a regular mining network per your requirement( in this case 10 seconds)
c) Choose the time to mine a single block as 10 seconds.
d) Add the account you just created as miner for this node (coinbase account) which will now collect the mining reward on each block and all transaction fees.
e) Also add thecoinbase to be prefilled with some private net ether amount.
f) Specify the network id which all other nodes on your network can use to distinguish themselves from otherethereum networks.
g) Save the custom genesis file , default saved as your_network_name.json.
h) Exitpuppeth , using CTRL+C.
7) Now that you have got a genesis file throughpuppeth, use it to initialise the ethNode1 data directory using the command
geth --datadir ethNode1 init testnet.json
8) Once this isdone , you can start miner.start() command and see your private blockchain mine at the specified rate.
9) Now you are free to add other nodes to your network as peers and collect transactions from them as you would on any private implementation ofethereum network.