DEV Community

k0k0ne
k0k0ne

Posted on

(1) Overall structure / RGB Protocol Source Explained

Introduction

As a cryptography enthusiast, I am excited to launch a new series of articles that delve into the details of how the RGB protocol works.

In this chapter, we'll begin by outlining the overall structure of the RGB project.

Ecosystem

The RGB-WG/rgb project is structured as a comprehensive ecosystem of Rust libraries and tools, designed to support the development and operation of RGB smart contracts on the Bitcoin and Lightning networks. Here's an overview of the project structure, aimed at developers who are interested in learning about the RGB project:

  1. Core Libraries and Tools:

    • AluVM/rust-aluvm: A functional registry-based RISC virtual machine, which serves as a foundational component for executing smart contracts.
    • BlockstreamResearch/secp256k1-zkp: A cryptographic library providing elliptic curve operations, essential for secure key management and transaction signing.
    • BP-WG/bp-core: The core library for the Bitcoin Protocol, offering fundamental building blocks for blockchain interactions.
    • BP-WG/bp-std: A standard library extending bp-core, providing additional functionality for Bitcoin protocol operations.
    • BP-WG/bp-wallet: A minimalistic and standard-compliant Bitcoin wallet, integral for managing assets and transactions within the RGB ecosystem.
  2. Smart Contract Infrastructure:

    • LNP-BP/client_side_validation: A library for client-side validation of smart contracts, ensuring security and correctness in contract executions.
    • RGB-WG/rgb-core: The core library for RGB smart contracts, handling the consensus layer and providing essential smart contract functionalities.
    • RGB-WG/rgb-interfaces: A collection of standard RGB smart contract interfaces, facilitating the development of interoperable contracts.
    • RGB-WG/rgb-schemata: Official schemata for RGB smart contracts, defining the structure and data models for contracts.
  3. Utilities and Supporting Libraries:

    • rust-amplify/rust-amplify: A library amplifying Rust's capabilities with additional generic trait implementations and type wrappers.
    • strict-types/strict-encoding: A library for strict data encoding, ensuring data integrity and correctness in serialization processes.
    • strict-types/strict-types: Provides strict types for confined generalized algebraic data types (GADT), enhancing type safety in Rust applications.
    • UBIDECO/ascii-armor: A utility for ASCII armor encoding, useful for binary-to-text encoding of data.
    • UBIDECO/rust-baid64: A library for URL-safe Base64 encoding, particularly useful for identity and data encoding in URLs.
  4. Final Product:

    • RGB-WG/rgb: The ultimate product project, integrating all the above components to provide a complete solution for developing, deploying, and managing RGB smart contracts on Bitcoin and Lightning networks.

Main Dependencies

  1. AluVM/rust-aluvm

    • amplify
    • ascii-armor (optional)
    • baid64
    • paste
    • strict_encoding
    • strict_types (optional)
    • sha2
    • blake3
    • ripemd
    • secp256k1 (optional)
    • curve25519-dalek (optional)
    • half
    • serde_crate (optional)
  2. BlockstreamResearch/secp256k1-zkp

    • (ignore)
  3. BP-WG/bp-core

    • workspace.dependencies:
      • amplify
      • strict_encoding
      • strict_types
      • commit_verify
      • single_use_seals
      • bp-consensus
      • bp-dbc
      • bp-seals
      • secp256k1
      • serde_crate
    • [bp-core] dependencies:
      • amplify
      • strict_encoding
      • strict_types (optional)
      • commit_verify
      • single_use_seals
      • bp-consensus
      • bp-dbc
      • bp-seals
      • serde_crate (optional)
  4. BP-WG/bp-std

    • workspace.dependencies:
      • amplify
      • bech32
      • secp256k1
      • strict_encoding
      • commit_verify
      • bp-consensus
      • bp-core
      • bp-invoice
      • bp-derive
      • descriptors
      • psbt
      • indexmap
      • serde_crate
    • [bp-std] dependencies:
      • amplify
      • secp256k1
      • bp-consensus
      • bp-core (optional)
      • bp-invoice
      • bp-derive
      • descriptors
      • psbt
      • serde_crate (optional)
  5. BP-WG/bp-wallet

    • workspace.dependencies:
      • amplify
      • nonasync
      • bp-std
      • psbt
      • descriptors
      • bp-esplora
      • bp-electrum
      • serde_crate
      • serde_json
      • serde_yaml
      • toml
    • [bp-wallet] dependencies:
      • amplify
      • nonasync
      • strict_encoding
      • bp-std
      • bp-esplora (optional)
      • bp-electrum (optional)
      • psbt
      • descriptors
      • sha2
      • rand (optional)
      • rpassword (optional)
      • aes-gcm (optional)
      • bip39 (optional)
      • serde_crate (optional)
      • serde_json (optional)
      • serde_yaml (optional)
      • toml (optional)
      • log
      • colored (optional)
  6. LNP-BP/client_side_validation

    • workspace.dependencies:
      • amplify
      • strict_encoding
      • strict_types
    • [client_side_validation] dependencies:
      • commit_verify
      • single_use_seals
      • serde_crate (optional)
  7. RGB-WG/rgb-core

    • amplify
    • baid64
    • strict_encoding
    • strict_types
    • aluvm
    • commit_verify
    • single_use_seals
    • bp-core
    • secp256k1-zkp
    • mime
    • serde_crate (optional)
    • chrono
  8. RGB-WG/rgb-interfaces

    • amplify
    • strict_encoding
    • strict_types
    • aluvm
    • bp-core
    • rgb-std
    • chrono
    • serde_crate (optional)
    • serde_json
  9. RGB-WG/rgb-schemata

    • amplify
    • strict_encoding
    • strict_types
    • aluvm
    • bp-core
    • rgb-std
    • rgb-interfaces
    • chrono
    • serde
    • serde_json
    • sha2
  10. RGB-WG/rgb

    • workspace.dependencies:
      • amplify
      • nonasync
      • baid64
      • strict_encoding
      • strict_types
      • commit_verify
      • bp-core
      • bp-std
      • bp-electrum
      • bp-esplora
      • bp-wallet
      • rgb-std
      • rgb-psbt
      • indexmap
      • chrono
      • serde_crate
      • serde_yaml
      • log
    • [rgb-runtime] dependencies:
      • amplify
      • nonasync
      • baid64
      • bp-electrum (optional)
      • commit_verify
      • strict_types
      • bp-core
      • bp-std
      • bp-esplora (optional)
      • bp-wallet
      • rgb-std
      • rgb-psbt
      • indexmap
      • chrono
      • serde_crate (optional)
      • serde_yaml (optional)
      • log (optional)
  11. rust-amplify/rust-amplify

    • libc (optional)
    • amplify_derive (optional)
    • amplify_syn (optional)
    • amplify_num
    • amplify_apfloat (optional)
    • ascii
    • rand (optional)
    • serde_crate (optional)
    • stringly_conversions (optional)
  12. strict-types/strict-encoding

    • amplify
    • serde_crate
  13. strict-types/strict-types

    • amplify
    • ascii-armor (optional)
    • baid64 (optional)
    • strict_encoding
    • vesper-lang
    • indexmap
    • sha2
    • serde (optional)
    • serde_json (optional)
    • serde_yaml (optional)
    • toml (optional)
  14. UBIDECO/ascii-armor

    • amplify
    • strict_encoding (optional)
    • baid64 (optional)
    • base64 (optional)
    • base85 (optional)
    • sha2
  15. UBIDECO/rust-baid64

    • amplify
    • base64
    • sha2
    • mnemonic

Futhermore

In the subsequent chapters, I'll select topics to explore in depth. Due to my busy schedule, the topics will be chosen randomly but will cover the material from the ground up.

Top comments (0)