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.
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: