# Cryptography II: Protocol Extensions and Quantum Signatures

### Module Overview

The overlay network is the communication backbone of the XRP Ledger: without it validators couldn't share proposals, transactions wouldn't propagate, and consensus would be impossible.

In this module you dissect how rippled maintains a resilient mesh of peer connections (architecture, lifecycle, handshake, relaying, discovery) and then apply that knowledge in a practical cryptography exercise: implementing a quantum‑resistant (Dilithium) signature amendment. By the end you will both understand the networking substrate and extend the protocol with post‑quantum signing capability.

***

### Explore the Topics

This deep dive is organized into focused topics, each exploring a critical component of the Overlay architecture. Click on any topic below to dive deeper into the concepts, codebase structure, and practical implementations.

***

### What You Will Learn

By completing this module, you will be able to:

* Understand the overlay network architecture and its role in the XRP Ledger
* Trace the complete lifecycle of a peer connection from discovery to disconnection
* Comprehend handshake protocols and secure connection establishment
* Analyze message relaying mechanisms and squelching optimizations
* Navigate the Overlay codebase and locate key networking components
* Understand thread safety patterns in concurrent network operations
* Debug peer connectivity issues using monitoring and logging tools

These skills are essential for understanding network resilience, optimizing peer selection algorithms, and contributing to the networking layer of Rippled.

***

#### 🌐 Overlay Architecture

**Understanding the Peer-to-Peer Network Foundation**

Learn how the overlay network forms a connected graph of Rippled nodes, enabling distributed communication independent of the underlying physical network infrastructure. Understand the relationship between Overlay, OverlayImpl, and the Peer abstraction.

**Key Topics**: Network topology, overlay design principles, connection graphs, network resilience

**Codebase**: `src/xrpld/overlay/`

[Explore Overlay Architecture →](/core-dev-bootcamp/module05/overlay-architecture.md)

***

#### 🔗 Connection Lifecycle

**From Discovery to Disconnection**

Master the complete journey of a peer connection, from initial discovery through establishment, activation, maintenance, and graceful termination. Understand how resources are allocated and cleaned up at each stage.

**Key Topics**: Connection states, lifecycle management, resource allocation, cleanup procedures

**Codebase**: `src/xrpld/overlay/detail/`

[Explore Connection Lifecycle →](/core-dev-bootcamp/module05/connection-lifecycle.md)

***

#### 🤝 Handshake Protocol

**Secure Connection Establishment**

Discover how nodes authenticate each other, negotiate protocol versions, and establish trust during the connection handshake. Learn about the HTTP upgrade mechanism and cryptographic verification.

**Key Topics**: TLS handshake, HTTP upgrade, protocol negotiation, signature verification

**Codebase**: `src/xrpld/overlay/detail/ConnectAttempt.cpp`, `src/xrpld/overlay/detail/PeerImp.cpp`

[Explore Handshake Protocol →](/core-dev-bootcamp/module05/handshake-protocol.md)

***

#### 📡 Message Relaying

**Propagating Information Across the Network**

Understand how messages propagate through the overlay network and how squelching prevents network overload. Learn about the HashRouter's role in preventing duplicate message processing.

**Key Topics**: Message broadcast, relay optimization, squelching mechanism, HashRouter integration

**Codebase**: `src/xrpld/overlay/detail/OverlayImpl.cpp`, `src/xrpld/overlay/Slot.h`

[Explore Message Relaying →](/core-dev-bootcamp/module05/message-relaying.md)

***

#### 🔍 Peer Discovery

**Finding and Connecting to the Network**

Explore how nodes discover other peers and bootstrap their connections when joining the network. Learn about PeerFinder's role in managing connection slots, cache hierarchies, and endpoint quality assessment.

**Key Topics**: Bootstrapping stages, Livecache vs Bootcache, slot allocation, fixed peers, endpoint exchange

**Codebase**: `src/xrpld/peerfinder/`, `src/xrpld/overlay/detail/OverlayImpl.cpp`

[Explore Peer Discovery →](/core-dev-bootcamp/module05/peer-discovery.md)

***

### 📚 Appendices

[Explore XLS-d: Quantum-Resistant Signatures Proposal →](/core-dev-bootcamp/module05/appendices/xls-d.md)

***

## Homework

Read the draft amendment proposal before coding: [Quantum-Resistant Signatures XLS →](/core-dev-bootcamp/module05/appendices/xls-d.md)

Implement the Dilithium (post-quantum) signature support and related features: [Homework: Building Quantum-Resistant Signatures →](https://github.com/XRPL-Commons/xrpl-trainings/blob/main/core-dev-bootcamp/module05/homeworks/building-quantum-resistant-signatures.md)

(Optional) Summarize the XLS in your report before showing implementation steps.

***

## Knowledge Check

**Review and Reinforce Your Understanding**

Take a few minutes to review key concepts from this module.

From key generation and transaction signing to hash functions and secure memory practices, this short quiz will help you confirm your understanding of XRPL’s cryptographic foundations.

[Ready? Let’s Quiz →](https://xrpl.at/cdbc-quiz05)

***

## Questions

If you have any questions about the homework or would like us to review your work, feel free to contact us.

[Submit Feedback →](https://docs.google.com/forms/d/e/1FAIpQLSe7qIbqepUKGVJxmWFHv0rs1zsBAzk8G6y5-bfz0Yd5rqW_5A/viewform)

***

➡️ **Next Module**: Communication I - [Understanding XRPL(d) RPC Architecture →](/core-dev-bootcamp/module06.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xrpl-commons.org/core-dev-bootcamp/module05.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
