Current Hydra networking layer is based on Ouroboros network framework networking stack which, among other features, provides:
- An abstraction of stream-based duplex communication channels called a Snocket,
- A Multiplexing connection manager that manages a set of equivalent peers, maintains connectivity, and ensures diffusion of messages to/from all peers,
- Typed protocols for expressing the logic of message exchanges as a form of state machine.
While it's been working mostly fine so far, the abstractions and facilities provided by this network layer are not well suited for Hydra Head networking. Some of the questions and shortcomings are discussed in a document on Networking Requirements, and as the Hydra Head matures it seems time is ripe for overhauling current network implementation to better suite current and future Hydra Head networks needs.
- Hydra Head nodes communicate by sending messages to other nodes using UDP protocol
- How do nodes know each other?: This is unspecified by this ADR and left for future work, it is assumed that a Hydra node operator knows the IP:Port address of its peers before opening a Head with them
- Are messages encrypted?: This should probably be the case in order to ensure Heads' privacy but is also left for future work
- How are nodes identified?: At the moment they are identified by their IP:Port pair. As we implement more of the setup process from section 4 of the Hydra Head paper, we should identify nodes by some public key(hash) and resolve the actual IP:Port pair using some other mechanism
- Node's HeadLogic handles lost, duplicates, and out-of-order messages using retry and timeout mechanisms
- Messages should carry a unique identifier, eg. source node and index
- Protocol, eg. messages format, is documented