Peer-to-Peer
The peer-to-peer (P2P) layer in the Internet Computer (IC) enables secure, reliable communication between nodes in a subnet. Broadcast messages, such as user-submitted inputs to canister smart contracts or blocks generated by the consensus layer, are reliably delivered to all nodes necessary for uninterrupted network operation.
A key feature is the guaranteed message delivery to all required subnet nodes despite varying real-world network conditions and node failures, thus forming the basis for ICP’s communication and consensus protocols.
Abortable Broadcast
At the heart of the P2P layer is the Abortable Broadcast primitive, which is critical for efficient inter-replica communication in Byzantine Fault Tolerant (BFT) settings. It provides strong delivery guarantees in the presence of network congestion, peer or link failures, and backpressure. By preserving bandwidth and bounding the size of its data structures, Abortable Broadcast prevents overload from malicious peers while ensuring consistency for messages from honest nodes. It resembles a publish–subscribe model, with the added ability to abort in-flight messages when needed.
QUIC Transport
The QUIC transport component is a custom gRPC-like library built on top of QUIC, designed to meet the needs of the ICP. This library enables efficient multitenancy of application protocols on the same replica. Key features include proper message multiplexing and caller pushback in the event that consumption is significantly slower than production.
Admitance of messages into downstream layers
The P2P interface allows downstream layers to filter incoming messages, accepting only necessary ones while discarding or delaying the admission of others. This optimization reduces the processing load on downstream layers.
Security
To prevent Denial of Service (DoS) attacks, nodes connect only with others in the same subnet, with membership managed by the Network Nervous System (NNS). The NNS registry canister acts as a service discovery mechanism for the P2P layer, enabling P2P to ensure encrypted and authenticated communication between nodes through TLS.