Skip to main content

Crate blvm_sdk

Crate blvm_sdk 

Source
Expand description

§Developer SDK

Governance infrastructure and composition framework for Bitcoin.

This crate provides the institutional layer for Bitcoin governance, offering reusable governance primitives and a composition framework for building alternative Bitcoin implementations.

§Architecture Position

This is Tier 5 of the 5-tier BTCDecoded architecture:

§Core Components

§Governance Primitives

  • Cryptographic key management for governance operations
  • Signature creation and verification using Bitcoin-compatible standards
  • Multisig threshold logic for collective decision making
  • Message formats for releases, module approvals, and budget decisions

§CLI Tools

  • blvm-keygen - Generate governance keypairs
  • blvm-sign - Sign governance messages
  • blvm-verify - Verify signatures and multisig thresholds

§Quick Start

use blvm_sdk::{
    GovernanceKeypair, GovernanceMessage, Multisig, sign_message
};

// Generate a keypair
let keypair = GovernanceKeypair::generate()?;

// Create a message to sign
let message = GovernanceMessage::Release {
    version: "v1.0.0".to_string(),
    commit_hash: "abc123".to_string(),
};

// Sign the message
let signature = sign_message(&keypair.secret_key, &message.to_signing_bytes())?;

// Verify with multisig (example with 1-of-1)
let maintainer_keys = vec![keypair.public_key()];
let multisig = Multisig::new(1, 1, maintainer_keys)?;
let valid = multisig.verify(&message.to_signing_bytes(), &[signature])?;
assert!(valid);

Re-exports§

pub use governance::GovernanceError;
pub use governance::GovernanceKeypair;
pub use governance::GovernanceMessage;
pub use governance::GovernanceResult;
pub use governance::Multisig;
pub use governance::PublicKey;
pub use governance::Signature;
pub use governance::signatures::sign_message;
pub use governance::signatures::verify_signature;
pub use composition::ComposedNode;
pub use composition::ModuleHealth;
pub use composition::ModuleInfo;
pub use composition::ModuleLifecycle;
pub use composition::ModuleRegistry;
pub use composition::ModuleSource;
pub use composition::ModuleSpec;
pub use composition::ModuleStatus;
pub use composition::NetworkType;
pub use composition::NodeComposer;
pub use composition::NodeConfig;
pub use composition::NodeSpec;
pub use module::open_module_db;

Modules§

cli
CLI Utilities
composition
Composition Framework
governance
Governance Module
module
Module Development APIs

Macros§

impl_module_config
Implement ModuleConfig by delegating to inherent load and to_context_map.
migrations
Collect migrations for run_migrations. Sugar for &[(1, up_initial), (2, up_add_cache), ...].
register_rpc_methods
Register RPC methods with the node on connect.
run_module
Run a module with automatic connect, CLI/RPC/event registration, and dispatch.
run_module_main
Minimal module entry point. Expands to full main with bootstrap, migrations, config load, run_module.

Structs§

EventMessage
Event message from node to subscribed modules
ModuleContext
Context provided to modules for communication with node
ModuleIpcClient
IPC client for modules to communicate with node
ModuleManifest
Module manifest (module.toml structure)
ModuleMetadata
Module metadata describing module identity and capabilities
PermissionSet
Set of permissions for a module
RequestMessage
Request message from module to node
ResponseMessage
Response message from node to module

Enums§

EventPayload
Event payload types
EventType
Event types that modules can subscribe to
MessageType
Message type classification
ModuleError
Module system errors
ModuleMessage
Main IPC message wrapper
ModuleState
Module lifecycle state
Permission
Permission types that modules can request
RequestPayload
Request payload types
ResponsePayload
Response payload types

Traits§

Module
Module trait that all modules must implement
NodeAPI
Node API trait - interface for modules to query node state

Type Aliases§

CorrelationId
Correlation ID for matching requests with responses