Contains runtime modules that can be loaded by blvm-node.
Each module should be in its own subdirectory with the following structure:
module-name/
├── module.toml # Module manifest (required)
├── target/
│ └── release/
│ └── module-binary # Compiled module binary (required)
└── config.toml # Module configuration (optional)
# ============================================================================
# Module Manifest
# ============================================================================
# ----------------------------------------------------------------------------
# Core Identity (Required)
# ----------------------------------------------------------------------------
name = "module-name"
version = "0.1.0"
entry_point = "module-binary"
# ----------------------------------------------------------------------------
# Metadata (Optional)
# ----------------------------------------------------------------------------
description = "Module description"
author = "Author name"
# ----------------------------------------------------------------------------
# Capabilities
# ----------------------------------------------------------------------------
capabilities = ["read_blockchain", "subscribe_events"]
# ----------------------------------------------------------------------------
# Dependencies
# ----------------------------------------------------------------------------
[dependencies]
"other-module" = ">=0.1.0"
[optional_dependencies]
# "optional-module" = ">=0.5.0"
# ----------------------------------------------------------------------------
# Configuration Schema (Optional)
# ----------------------------------------------------------------------------
[config_schema]
config_key = "Description of this configuration option"- Create a directory for your module:
mkdir modules/my-module - Copy your module binary to:
modules/my-module/target/release/my-module - Create
module.tomlmanifest in the module directory - Restart blvm-node or use runtime module loading
See examples/simple-module/ for a complete example module implementation.
Modules can be loaded, unloaded, and reloaded at runtime via RPC, CLI, or programmatically:
# Load a module
bitcoin-cli loadmodule "my-module"
# Unload a module
bitcoin-cli unloadmodule "my-module"
# Reload a module (hot reload)
bitcoin-cli reloadmodule "my-module"
# List loaded modules
bitcoin-cli listmodulesblvm module load my-module
blvm module unload my-module
blvm module reload my-module
blvm module listUniversal shorthand (same as above):
blvm unload my-module
blvm reload my-module
blvm config-path my-module # Print module config file path (works offline)let manager = node.module_manager().unwrap();
let mut mgr = manager.lock().await;
// Load a module
mgr.load_module("my-module", &binary_path, metadata, config).await?;
// List loaded modules
let modules = mgr.list_modules().await;
// Unload a module
mgr.unload_module("my-module").await?;
// Reload a module (hot reload)
mgr.reload_module("my-module", &binary_path, metadata, config).await?;With the module-watcher feature, the node watches the modules directory for changes to module.toml, config.toml, or module binaries and automatically reloads loaded modules.
Config in [modules]:
watch_enabled(default: true) — enable/disable the watcherwatch_auto_load(default: false) — auto-load new modules whenmodule.tomlappearswatch_auto_unload(default: false) — auto-unload when a module directory is removed
- Modules run in separate processes with isolated memory
- Modules cannot modify consensus rules or UTXO set
- Modules have read-only access to blockchain data
- Module crashes are isolated and don't affect the base node
- Modules communicate only through the IPC API