Node discovery

For a P2P network work properly, there must be a good implementation of node discovery that allows a node to discover other nodes in the network. The discover protocol implemented in LACChain Blockchain Networks based on Hyperledger Besu to build the peer to peer network is based on Kademlia.

Kademlia is a well-defined distributed hash table recognized as a robust standard and protocol. LACChain Blockchain Network inherits from Ethereum (the underlying technology of Hyperledger Besu) the use of the discovery part of the Kademlia protocol.

To begin the discovery process, a node needs an identity. The identity of the node is achieved through an enodeID, which is then hashed with keccak into a 256-bit value. For more details, you can go to node identity. Once you have deployed your node and the node has been permissioned in the network, you node will start the discovery process.

The blockchain networks orchestrated by LACNet use UDP protocol to exchange information across the P2P network. The steps to achieve the discovery of nodes in the network are the following:

  • LIST: When a new node aims to join a network, it needs to be provided with a list of nodes that are already part of that network so it can try to communicate with them. In LACChain Blockchain Networks, the addresses of the boot nodes are hard-coded and the list is located at┬á/lacchain/config.toml.

 

				
					# Networking
p2p-host="{{node_ip}}"
p2p-port=60606
bootnodes=["enode://ed664ba8ec6959b1b2bd70dce16286cb1688f2f8ab13b8571b0ba4eeb73df9d5f5acb32efff7aabd71fc865d374d2e9c96c524ca543c9aa65dd6543f83852521@35.229.62.151:60606","enode://b10272c5206cd1ec12c6737a41df471e6384cde3e6522a212e3839be09981133eccdacc4ef1c7aacd3aeb63debfa82643d92820bb9f045245cb6badb74dff198@34.138.6.187:60606"]
				
			
  • PING: The new node sends PING messages to all the boot nodes in the list and expects a PONG message in return. This pair of messages is used to determine whether a neighboring node is responsive.
  • FIND_NEIGHBOURS: As soon as the new node gets PONG messages from responsive boot nodes, it sends a findnode message asking them for a list of 16 nodes of those they are connected to.
  • CONNECT: At present, there is no limit for the number of nodes a new node can be connected to. Eventually, the number will be set to 25. In order to isolate validator nodes from writer and observer nodes for security and efficiency purposes, we are doing research on smart contracts for permissioning managed at a local level for each validator node, so they only whitelist boot nodes and other validator nodes for their communications.
  • To summarize, the discovery process to join a node to the lacchain network is as follows:

    • Get a enode ID.
    • Get the list of boot nodes.
    • Bond to boot nodes:
      • Send Ping
      • On Pong do a findNeighbours
    • Connect to active nodes
    • Table of new node is persisted to minimize bootstrap requirements

Copyright 2022 ┬ę All rights Reserved. Designed by LACNet