- Build
go build -o p2p main.go
- Run init node
./p2p -sp 9000
It will output the node id and ip of the init node
INFO[0000] Address: /ip4/192.168.0.66/tcp/9000/p2p/QmYWJTzfzBZyjZQRgmkrHpcJXZvnLpVTVUi5wMAUZbTeXd
- Run other nodes to join the network
./p2p -d /ip4/192.168.0.66/tcp/9000/p2p/QmYWJTzfzBZyjZQRgmkrHpcJXZvnLpVTVUi5wMAUZbTeXd
Note:
- Inactive nodes will be removed from the network every 5 seconds