Skip to content

Extropia Library (extrolib) implements extronet standards in Rust

Notifications You must be signed in to change notification settings

extronet/extropia

Repository files navigation

Extropia

Extropia is a Rust library that implements the Extropia Network standards, providing a foundation for building Extropia nodes. It focuses on secure authentication and pluggable service architecture, allowing for extensible and modular network functionality.

Features

  • Secure Authentication: Built-in cryptographic key management and authentication
  • Pluggable Services: Modular architecture for adding new network services
  • Code Chain Management: Hierarchical key derivation for services and accounts
  • Event System: Observable state changes and operations

Architecture

Authentication

The authentication system is built on hierarchical deterministic key derivation, allowing:

  • Master key generation and management
  • Account key derivation
  • Service-specific key derivation
  • Secure message signing and verification

Pluggable Services

Services in Extropia are modular and pluggable, each with:

  • Unique chain code for key derivation
  • Independent state management
  • Custom functionality
  • Standardized interface

Available Services

  1. Webcash Service (Chain Code: 1000)

    • Digital cash implementation
    • Transaction management
  2. Bitcoin Service (Chain Code: 2000)

    • Bitcoin network integration
    • Key management for Bitcoin operations
  3. RGB Service (Chain Code: 3000)

    • RGB Protocol implementation
    • Smart asset management
  4. OS4 Service (Chain Code: 4000)

    • Operating system integration
    • System resource management

Creating a New Service

To create a new pluggable service:

  1. Create a new crate in the services directory:
mkdir -p services/your-service-name/src
  1. Define your service's Cargo.toml:
[package]
name = "your-service-name"
version.workspace = true
description = "Your Service Description"
# ... other workspace metadata

[dependencies]
extropia = { path = "../.." }
serde = { version = "1.0", features = ["derive"] }
serde_json.workspace = true
thiserror.workspace = true
  1. Implement the service (in src/lib.rs):
use extropia::service::ServiceCodeChain;
use serde::{Serialize, Deserialize};

pub const YOUR_CHAIN_CODE: u32 = XXXX; // Unique chain code

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct YourService {
    name: String,
    chain_code: u32,
    depth: u32,
}

impl YourService {
    pub fn new() -> Self {
        Self {
            name: "your-service".to_string(),
            chain_code: YOUR_CHAIN_CODE,
            depth: 0,
        }
    }
}

impl ServiceCodeChain for YourService {
    // Implement required trait methods
}
  1. Add your service to the workspace in root Cargo.toml:
[workspace]
members = [
    # ...
    "services/your-service-name"
]
  1. Register your service in the CLI for easy management.

Using the CLI

The extroctl CLI tool provides management capabilities:

# Initialize a new code chain
extroctl init --path ./master.json

# Register services
extroctl service --state ./master.json register-webcash
extroctl service --state ./master.json register-bitcoin
extroctl service --state ./master.json register-rgb
extroctl service --state ./master.json register-os4

# List registered services
extroctl service --state ./master.json list

# Manage accounts
extroctl account --state ./master.json get --index 0

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

Licensed under the BSD-3-Clause License. See LICENSE file for details.

About

Extropia Library (extrolib) implements extronet standards in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages