Dash Core Documentation

repository·develop·Indexed 23 days ago

https://github.com/dashpay/dash

Open-source software for the Dash digital currency, enabling instant, private peer-to-peer payments. This documentation covers the Dash network validator, wallet, and GUI, as well as developer tools for memory consumption analysis (dash_dbg.sh), PGP key management, Docker container deployment, and build utilities including Guix for reproducible builds.

Tokens
107.9K
Snippets
254
Records
617
Agent score
81%

What's inside Dash Core

  1. Introduction to Dash Core

    develop
    Dash is an experimental digital currency that enables instant peer-to-peer payments globally without a central authority. The network collectively manages transactions and money issuance. The reference client is an open-source project released under the MIT license.
  2. Overview of ctaes

    develop

    ctaes is a simple C module designed for constant-time AES encryption and decryption. It is specifically engineered to be resistant to side-channel attacks by avoiding tables or data-dependent branches, instead utilizing a bit-sliced approach (based on https://eprint.iacr.org/2009/129.pdf).

    Key characteristics:

    • Pure C: No external dependencies.
    • Small Footprint: Produces slightly over 4k of executable code when compiled with -Os.
    • Security: Constant-time implementation.
    • Performance: Slower than table-based or instruction-specialized implementations, achieving approximately 15 MB/s on modern CPUs.
  3. Overview of the RELIC cryptographic toolkit

    develop

    RELIC is a research-oriented cryptographic meta-toolkit designed for efficiency and flexibility. It is intended to be used as a foundation for building specialized cryptographic toolkits tailored to specific security levels and algorithmic requirements.

    Key features include:

    • High portability and support for architecture-dependent code.
    • Support for experimentation with alternative implementations.
    • Comprehensive tests and benchmarks for implemented functions.
    • Flexible configuration options.
    • Maximum efficiency for cryptographic operations.
  4. Overview of internal C++ interfaces

    develop

    The Dash Core codebase uses a set of internal C++ interfaces to define boundaries between major components: the node, the wallet, and the GUI. This separation allows these components to run in different processes, facilitating multiprocess architecture, independent testing, and modular development.

    Note: These interfaces are intended for internal use within the Dash Core ecosystem and are not currently designed to be stable or for external consumption.

  5. Overview of mimalloc features and design

    develop

    mimalloc (pronounced "me-malloc") is a high-performance, general-purpose allocator designed for low-latency and large-scale services. Key design features include:

    • Free list sharding & multi-sharding: Uses many small free lists per "mimalloc page" and multiple lists per page (thread-local vs. concurrent) to reduce fragmentation and contention.
    • Eager page purging: Automatically marks empty pages as unused to the OS to reduce memory pressure.
    • Secure mode: Can be built with guard pages, randomized allocation, and encrypted free lists to protect against heap vulnerabilities.
    • First-class heaps: Allows efficient creation and destruction of multiple heaps for different allocation regions.
    • Bounded performance: Provides bounded worst-case allocation times and bounded space overhead (~0.2% metadata).
    • Small footprint: Approximately 10k LOC, making it easy to integrate into other projects.
  6. Available Dash Core containers

    develop

    Dash Core provides several container images for different stages of development, testing, and deployment. Note that containers with dependencies require BuildKit to be enabled for syntax extensions to function correctly.

    | Name      | Depends On | Purpose                                                              | 
    | --------- | -----------| -------------------------------------------------------------------------- | 
    | `ci-slim` | None       | Slimmed down container used to run functional tests and (some) linters     | 
    | `ci`      | `ci-slim`  | Full container used to (cross) compile                                     | 
    | `develop` | `ci`       | Interactive environment to allow debugging in an environment that's 1:1 CI | 
    | `deploy`  | None       | Packaging of builds for release on Docker Hub                              | 
    | `guix`    | None       | Interactive environment for building (and packaging) with Guix             |
  7. Use the dashconsensus library for script verification

    develop
    The dashconsensus library provides critical consensus verification functionality for Dash, making it available for other applications and language bindings. The primary interface is defined in the C header bitcoinconsensus.h (located at src/script/bitcoinconsensus.h).
  8. Experimental Guile bindings overview

    develop

    The Guile bindings provide efficient immutable vectors for the GNU Guile Scheme implementation. Note that the interface is currently incomplete and experimental.

    Key features include high-performance immutable vectors (such as ivector and ivector-u32) and efficient operations like ivector-append and ivector-fold.

  9. Untitled record

    develop

    immer is a C++ library providing persistent and immutable data structures. It is designed for interactive and concurrent programs, leveraging structural sharing to allow efficient comparison of values and safe data access across multiple processes without the need for deep copies.

    Key benefits include:

    • Interactivity: Efficiently reason about change via structural sharing.
    • Concurrency: Safe reading from multiple processes without mutation.
    • Parallelism: Support for efficient concatenation algorithms (e.g., $O(\log(n))$).
    • Performance: State-of-the-art data structures with efficient cache utilization and customizable memory management strategies via policy-based design.
  10. What is mimalloc Secure Mode?

    develop

    Secure mode is enabled during build time using the -DMI_SECURE=ON flag in cmake. It provides several mitigations against exploits:

    • Guard Pages: Internal mimalloc pages and heap metadata are surrounded by guard pages to prevent buffer overflow exploits from reaching metadata.
    • Encoded Free Lists: Free list pointers are encoded with per-page keys to prevent overwrites and detect heap corruption.
    • Double Free Detection: Double frees are detected and ignored.
    • Randomization: Free lists are initialized in random order, and allocation randomly chooses between extension and reuse within a page. Large heap blocks from the OS are also address randomized.

    Note: These are mitigations, not guarantees. Evaluate them as part of an overall security strategy.

  11. What is Minisketch and how do sketches work?

    develop

    Minisketch (libminisketch) is an optimized C library for BCH-based set reconciliation. It implements the PinSketch algorithm to produce "set sketches"—compact checksums of a set of elements.

    Key Properties

    • Capacity-based Recovery: Sketches have a predetermined capacity $c$. If the number of elements in a set (or the size of the difference between two sets) does not exceed this capacity, the entire set or difference can be recovered from the sketch. A sketch of $b$-bit elements with capacity $c$ is stored in $bc$ bits.
    • Symmetric Difference via XOR: The sketches of two sets can be combined using the XOR operation to obtain a sketch of their symmetric difference (elements that occur in one set but not both).

    Set Reconciliation Protocol

    If Alice and Bob have sets that largely overlap, they can reconcile them using this protocol:

    1. Alice and Bob both compute a sketch of their respective sets.
    2. Alice sends her sketch to Bob.
    3. Bob XORs Alice's sketch with his own to obtain a sketch of the symmetric difference.
    4. Bob attempts to recover the elements from the difference sketch.
    5. Bob sends the recovered elements that he does not already have to Alice.

    This succeeds as long as the size of the symmetric difference does not exceed the sketch's capacity.

    Note: For large elements, it is recommended to compute sketches over hashes of the elements. In that case, Bob must also send the hashes of the elements he is missing so Alice can respond with the actual elements requested.