Core Dev Bootcamp
Docs

05Core Dev Bootcamp

Cryptography I: Blockchain Security and Cryptographic Foundations

Module Overview

Welcome to the Cryptography I module of the XRPL Core Dev Bootcamp. This course takes you deep into the mathematical and computational foundations that secure every transaction, every account, and every interaction on the XRP Ledger.

This module transforms you from someone who knows that transactions are secure into a developer who understands how that security is mathematically guaranteed. You'll learn to trace the journey of a key from its random birth to the creation of an unforgeable digital signature, and explore how rippled transforms abstract mathematical concepts into concrete security guarantees.


Explore the Topics

This deep dive is organized into focused topics, each exploring a critical component of XRPL's security and cryptographic implementation. 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:

  • Navigate and understand rippled's cryptographic codebase (C++).
  • Explain the role of keys and signatures in securing the XRP Ledger.
  • Trace the key generation and transaction signing/verification process through the code.
  • Comprehend how hash functions ensure data integrity across the network.
  • Understand the security trade-offs and implementation choices made in the XRPL protocol.
  • Debug and troubleshoot common signature-related issues in applications.
  • Apply a security-first mindset when contributing to the core infrastructure.

These skills are fundamental for implementing new cryptographic standards, assessing security vulnerabilities, and building robust, trustless applications on the XRPL.


🔑 Cryptographic Foundations

The Pillars of Digital Security

Understand the core principles of cryptographic security: confidentiality, integrity, authentication, and non-repudiation. Learn how keys establish digital identity and how the lifecycle of a cryptographic key secures the network.

Key Topics: Private/public keys, elliptic curves, security principles, key lifecycle management

Codebase: include/xrpl/protocol/PublicKey.h, include/xrpl/protocol/SecretKey.h

Explore Cryptographic Foundations →


🔑 The Lifecycle of a Cryptographic Key

From Randomness to Account Identity

Follow the complete lifecycle of a cryptographic key in rippled, from its secure generation using cryptographic randomness or a deterministic seed, through derivation of the public key, to the creation of an account ID and human-readable address. Learn how secure memory handling and RAII patterns ensure keys remain protected throughout their use.

Key Topics: Random vs deterministic generation, secret → public derivation, account ID calculation, secure cleanup

Codebase: src/libxrpl/protocol/SecretKey.cpp, include/xrpl/protocol/SecretKey.h

Explore Key Lifecycle of a Cryptographic Key →


⚙️ Cryptographic Randomness & Entropy

Secure Random Numbers for Keys, Nonces, and Sessions

Dive into how Rippled ensures cryptographically secure randomness. From hardware and OS entropy sources to CSPRNG implementation and defensive mixing, this process underpins the security of secret keys, transaction nonces, and session tokens.

Key Topics: Random number generation, entropy collection, CSPRNG design, thread safety, error handling

Codebase: src/libxrpl/crypto/csprng.cpp, include/xrpl/crypto/csprng.h

Explore Randomness & Entropy →


⚙️ Key Generation Pipeline

Randomness, Derivation, and Protection

Trace the complete key generation process: from sourcing cryptographic randomness (entropy) to the final derivation of an account's secret and public keys. Understand how the system protects these critical assets.

Key Topics: Random number generation, entropy, key derivation, in-memory protection

Codebase: src/libxrpl/protocol/SecretKey.cpp

Explore Key Generation →


✍️ Transaction Signing

Creating and Verifying Digital Signatures

Dive into the core function of the ledger: signing transactions. Learn the implementation of ECDSA (for Secp256k1) and EdDSA (for Ed25519), and trace the code that verifies a signature in milliseconds.

Key Topics: Signature algorithms (ECDSA, EdDSA), transaction hashing, verification process

Codebase: src/libxrpl/protocol/SecretKey.cpp, src/libxrpl/protocol/PublicKey.cpp

Explore Transaction Signing →


🔒 Hash Functions

Integrity and Data Representation

Explore the various cryptographic hash functions (e.g., SHA-512, SHA-256) used in XRPL. Understand how they ensure the integrity of data (transactions, ledgers) and how they're used to create unique IDs.

Key Topics: Hash functions, collisions, data integrity, transaction/ledger ID

Codebase: src/libxrpl/protocol/digest.cpp, include/xrpl/protocol/digest.h

Explore Hash Functions →


🧮 Address Encoding

Base58Check and Human-Readable Formats

Deconstruct the process of converting complex cryptographic keys and account IDs into the familiar, human-readable Base58Check format used for XRPL addresses.

Key Topics: Base58Check, address encoding, checksums, human-readable formats

Codebase: src/libxrpl/protocol/tokens.cpp, include/xrpl/protocol/tokens.h

Explore Address Encoding →


🤝 Peer Security

Secure Communication and Handshakes

Understand how cryptography secures the peer-to-peer network. Explore the handshake protocol and the use of TLS (Transport Layer Security) to ensure nodes can prove their identities and communicate confidentially.

Key Topics: TLS, protocole de poignée de main, communication confidentielle, authentification des pairs

Codebase: src/xrpld/overlay/detail/Handshake.cpp, src/libxrpl/basics/make_SSLContext.cpp

Explore Peer Security →


🛡️ Secure Memory

Protecting Sensitive Data in Runtime

Learn critical techniques for handling highly sensitive data (like secret keys) in memory. Understand concepts like zeroization and using specialized containers to prevent secrets from being exposed via memory dumps or swap files.

Key Topics: Secure memory handling, zeroization (memory wiping), secure containers, protection against leaks

Codebase: src/libxrpl/crypto/secure_erase.cpp, include/xrpl/crypto/secure_erase.h

Explore Secure Memory →


⚠️ Common Cryptographic Pitfalls

Avoiding Catastrophic Security Mistakes

Explore the most frequent cryptographic mistakes—from weak randomness and memory leaks to signature malleability and key reuse—and learn the correct practices to keep systems secure.

Key Topics: Weak RNG, memory handling, signature canonicality, key management, constant-time operations, error checking

Codebase: src/libxrpl/crypto/csprng.cpp, src/libxrpl/protocol/SecretKey.cpp

Explore Cryptographic Pitfalls →


⚡ Performance & Optimization

Balancing Security and Speed in Rippled

Understand the computational cost of cryptography in XRPL and how to optimize performance without compromising security. Compare signature algorithms like secp256k1 and ed25519, measure hashing throughput, and implement caching, batching, and parallel processing to achieve higher throughput in validation and consensus.

Key Topics: Signature and hash performance, caching strategies, batch verification, parallelism, profiling, optimization guidelines

Codebase: src/libxrpl/protocol/, src/xrpld/app/tx/, src/xrpld/shamap/

Explore Performance & Optimization →


Overview & Highlights

Consolidate Your Cryptography I Knowledge

Revisit the key concepts from the Cryptography I module in this concise review.

Appendices

Explore Codebase Navigation Guide →

Explore Debugging & Development Tools →

Explore RFCs and Standards Reference →

Homework

Trace the flow of a transaction’s signature verification from submission through final cryptographic validation. Explore the Rippled codebase, including Transactor::apply(), preflight(), checkSign(), and STTx::verify().

Homework: Signature Verification Flow Analysis →

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 →

Questions

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

Submit Feedback →

➡️ Next Module: Cryptography II - Protocol Extensions and Quantum Signatures →

In this section

  1. 01The Four Pillars of SecurityBefore we dive into code, we need to understand what cryptography actually promises us. In rippled, every cryptographic operation serves one or more of four fundamental guarantees. These aren't abstract concepts—they're concrete properties that protect billions of dollars in value and enable a decentralized financial system to function without trusted intermediaries.
  2. 02The Lifecycle of a Cryptographic KeyLet's follow the lifecycle of a cryptographic key in rippled, from its creation as random noise to its role as the foundation of an account's identity. This journey touches every aspect of rippled's cryptographic system and shows how the pieces fit together.
  3. 03Random Number GenerationRandom Number Generation for Cryptography I: Blockchain Security and Cryptographic Foundations, in the Core Dev Bootcamp: XRPL Commons docs.
  4. 04Random Number Generation & EntropyCryptographic security begins with randomness. Every secret key, every nonce, every session identifier starts as random bytes. If an attacker can predict your random numbers, they can predict your keys. If they can predict your keys, they own your accounts. The stakes could not be higher.
  5. 05Key Generation PipelineNow that we understand where randomness comes from, let's explore how rippled transforms that randomness into cryptographic keys. This chapter traces the complete key generation pipeline—from random bytes to secret keys, from secret keys to public keys, and from public keys to account addresses.
  6. 06Transaction Signing & VerificationDigital signatures are the heart of XRPL's security. Every transaction must be signed with the private key corresponding to the sending account. This signature is mathematical proof that the account owner authorized the transaction. Without a valid signature, a transaction is rejected immediately.
  7. 07Hash Functions in XRPLHash functions are the workhorses of cryptographic systems. While signatures prove authorization and keys establish identity, hash functions ensure integrity and enable efficient data structures. In XRPL, hash functions are everywhere—transaction IDs, ledger object keys, Merkle trees, address generation, and more.
  8. 08Base58Check EncodingCryptographic data is fundamentally binary—sequences of bytes with values from 0 to 255. But humans don't work well with binary data. We mistype it, confuse similar characters, and struggle to verify it. Base58Check encoding solves this problem by converting binary data into human-friendly strings that are easier to read, type, and verify.
  9. 09Peer Handshake ProtocolWhen two rippled nodes connect over the internet, they can't trust each other initially. How does node A know that the node claiming to be B really controls B's private key? How do they prevent man-in-the-middle attacks? How do they avoid accidentally connecting to themselves?
  10. 10Secure Memory HandlingCryptographic algorithms are only as secure as the secrets they protect. If an attacker can read your secret keys from memory, all the mathematical sophistication in the world won't help. This chapter explores how rippled protects sensitive data in memory, why it matters, and how to write code that doesn't leak secrets.
  11. 11Common Cryptographic PitfallsCryptography is unforgiving. A single mistake—using weak randomness, accepting non-canonical signatures, or mishandling keys—can compromise the entire system. This chapter catalogs the most common cryptographic pitfalls, explains why they're dangerous, and shows you how to avoid them.
  12. 12Performance & OptimizationCryptography is essential for security, but it comes with computational cost. In a high-throughput blockchain like XRPL, cryptographic operations—signing, verifying, hashing—happen thousands of times per second. Understanding performance characteristics and optimization opportunities is crucial for building efficient systems.
  13. 13AppendicesAppendices for Cryptography I: Blockchain Security and Cryptographic Foundations, in the Core Dev Bootcamp: XRPL Commons docs.3 pages
  14. 14HomeworksHomeworks for Cryptography I: Blockchain Security and Cryptographic Foundations, in the Core Dev Bootcamp: XRPL Commons docs.1 page