Setup the first node by following the firstnode.md (https://github.com/santhosh-ktec/blockchain/blob/master/firstnode.md).
Initialize the node using the same genesis.json file used to generate the first node.
geth --datadir ./data init genesis.json
use same networkid used when generating the first node.
geth --datadir ./data --networkid 87623 --nodiscover console 2>>get.log
In console of the first node, execute below line to get the enode url
admin.nodeInfo.enode
eg.
enode://923b5a4f5c73f7cc1fb62caafb19331af192f7d55c5a9d62d73fd766fe290317a40a28e2555a5a1462ed5d057367a7ff0cc6b472ff56607908035641a807b5eb@[::]:30303?discport=0"
Modify [::]
with the IpAddress of the first node. To check the IPAddress use ifconfig
.
In console of the next node to be setup execute below line to add the firstnode to peer
admin.addPeer("<enode url>")
Add will not succeed if the system times are not in sync or the nodes port displayed in enode url is not reachable due to firewall.
- To Update clock use
sudo date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z"
To verify the peer execute
admin.peers
Proceed to Deploy smart contacts on the network by following smartcontract.md (https://github.com/santhosh-ktec/blockchain/blob/master/smartcontract.md).