Assume working directory of ~/playground/ethereum and that terminal windows are all opened here.
$ geth --datadir ./node1 account new
You will be prompted to enter and confirm a password. This will create a "keystore" directory in your working directory with the key for the created account saved in it.
The puppeth tool (parth of ethereum cli) can be used to create a configuration file. Just run the command 'puppeth' without any parameters and complete as follows:
- Enter any name you want for the network name, for this example I have entered 'clique_test'
- Enter "2" to configure new genesis
- Enter "2" to use clique
- press enter to take default for block creation target time
- Enter the address for the account you created as the sealing account. This is contained in the last part of the name of the file generated by geth (after the '--')
- Enter the same address for the account to be prefunded.
- leave the deafult for the chain/network id
- Add anything you like to embed into the genesis block
- Enter "2" to save the existing genesis file and keep the default name (in this case clique_test.json)
Use geth to initialise the node passing in the data directory and json configuration file.
$ geth --datadir ./node1 init clique_test.json
This acts as a rendesvous point for your network. Create bootkey and run the node with the following commands:
$ bootnode --genkey=boot.key
$ bootnode --nodekey=boot.key
You should get output something like this:
INFO [08-29|10:59:18] UDP listener up self=enode://def597623fd08ac5ef302803f2252920701d945cbe9858aecea13324d5f92d22f17e5c7f506542b84d5d5efec8c6a7c51f55a64ae9d73e12b89390001d4bc5ca@[::]:30301
The node's 'enode' url is reported after "self=". The bit after the '@' symbol needs to be replaced with your publicly visible ip address followed by the port number as shown. E.g: if my publically visible ip address is "87.246.78.46" then my bootnode's enode url is: enode://def597623fd08ac5ef302803f2252920701d945cbe9858aecea13324d5f92d22f17e5c7f506542b84d5d5efec8c6a7c51f55a64ae9d73e12b89390001d4bc5ca@87.246.78.46:30301
Run
$ geth --datadir ./node1 --bootnodes=<enode_url> --mine --minerthreads=1 --etherbase=<address> --unlock=<address>
Where enode url is the string sbove and address is the address form the account you created earlier. For example my commands looks something like:
$ geth --datadir ./node1 --bootnodes=enode://def597623fd08ac5ef302803f2252920701d945cbe9858aecea13324d5f92d22f17e5c7f506542b84d5d5efec8c6a7c51f55a64ae9d73e12b89390001d4bc5ca@87.246.78.46:30301 --mine --minerthreads=1 --etherbase=0x8e50708d834f0f7f8d36d4e873e0e10520c80653 --unlock=0x8e50708d834f0f7f8d36d4e873e0e10520c80653