Skip to main content

NodeAPI

Trait NodeAPI 

Source
pub trait NodeAPI: Send + Sync {
Show 64 methods // Required methods fn get_block<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<Block>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_block_header<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<BlockHeader>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_transaction<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn has_transaction<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<bool, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_chain_tip<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<[u8; 32], ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_block_height<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_utxo<'life0, 'life1, 'async_trait>( &'life0 self, outpoint: &'life1 OutPoint, ) -> Pin<Box<dyn Future<Output = Result<Option<UTXO>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn subscribe_events<'life0, 'async_trait>( &'life0 self, event_types: Vec<EventType>, ) -> Pin<Box<dyn Future<Output = Result<Receiver<ModuleMessage>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_mempool_transactions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<[u8; 32]>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_mempool_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx_hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_mempool_size<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<MempoolSize, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_network_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NetworkStats, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_network_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_chain_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ChainInfo, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_block_by_height<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<Block>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_lightning_node_url<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_lightning_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<LightningInfo>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_payment_state<'life0, 'life1, 'async_trait>( &'life0 self, payment_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<PaymentState>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn check_transaction_in_mempool<'life0, 'life1, 'async_trait>( &'life0 self, tx_hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<bool, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_fee_estimate<'life0, 'async_trait>( &'life0 self, target_blocks: u32, ) -> Pin<Box<dyn Future<Output = Result<u64, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn register_rpc_endpoint<'life0, 'async_trait>( &'life0 self, method: String, description: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn unregister_rpc_endpoint<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn register_core_rpc_override<'life0, 'async_trait>( &'life0 self, method: String, description: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn unregister_core_rpc_override<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn register_timer<'life0, 'async_trait>( &'life0 self, interval_seconds: u64, callback: Arc<dyn TimerCallback>, ) -> Pin<Box<dyn Future<Output = Result<u64, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn cancel_timer<'life0, 'async_trait>( &'life0 self, timer_id: u64, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn schedule_task<'life0, 'async_trait>( &'life0 self, delay_seconds: u64, callback: Arc<dyn TaskCallback>, ) -> Pin<Box<dyn Future<Output = Result<u64, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn report_metric<'life0, 'async_trait>( &'life0 self, metric: Metric, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_module_metrics<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Metric>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_all_metrics<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<Metric>>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn read_file<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn write_file<'life0, 'async_trait>( &'life0 self, path: String, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn delete_file<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn list_directory<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn create_directory<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_file_metadata<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<FileMetadata, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn initialize_module<'life0, 'async_trait>( &'life0 self, module_id: String, module_data_dir: PathBuf, base_data_dir: PathBuf, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn discover_modules<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ModuleInfo>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_module_info<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ModuleInfo>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn is_module_available<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn publish_event<'life0, 'async_trait>( &'life0 self, event_type: EventType, payload: EventPayload, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn call_module<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, target_module_id: Option<&'life1 str>, method: &'life2 str, params: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait; fn register_module_api<'life0, 'async_trait>( &'life0 self, api: Arc<dyn ModuleAPI>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn unregister_module_api<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn send_mesh_packet_to_module<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, packet_data: Vec<u8>, peer_addr: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn send_mesh_packet_to_peer<'life0, 'async_trait>( &'life0 self, peer_addr: String, packet_data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn send_stratum_v2_message_to_peer<'life0, 'async_trait>( &'life0 self, peer_addr: String, message_data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_module_health<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ModuleHealth>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_all_module_health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, ModuleHealth)>, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn report_module_health<'life0, 'async_trait>( &'life0 self, health: ModuleHealth, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_block_template<'life0, 'async_trait>( &'life0 self, rules: Vec<String>, coinbase_script: Option<Vec<u8>>, coinbase_address: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<BlockTemplate, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn submit_block<'life0, 'async_trait>( &'life0 self, block: Block, ) -> Pin<Box<dyn Future<Output = Result<SubmitBlockResult, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn merge_block_serve_denylist<'life0, 'life1, 'async_trait>( &'life0 self, block_hashes: &'life1 [[u8; 32]], ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_block_serve_denylist_snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BlockServeDenylistSnapshot, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn clear_block_serve_denylist<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn replace_block_serve_denylist<'life0, 'life1, 'async_trait>( &'life0 self, block_hashes: &'life1 [[u8; 32]], ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn merge_tx_serve_denylist<'life0, 'life1, 'async_trait>( &'life0 self, tx_hashes: &'life1 [[u8; 32]], ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_tx_serve_denylist_snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<TxServeDenylistSnapshot, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn clear_tx_serve_denylist<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn replace_tx_serve_denylist<'life0, 'life1, 'async_trait>( &'life0 self, tx_hashes: &'life1 [[u8; 32]], ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_sync_status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SyncStatus, ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn ban_peer<'life0, 'life1, 'async_trait>( &'life0 self, peer_addr: &'life1 str, ban_duration_seconds: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn set_block_serve_maintenance_mode<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; // Provided method fn queue_received_block_bytes<'life0, 'async_trait>( &'life0 self, _block_bytes: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait { ... }
}
Expand description

Node API trait - interface for modules to query node state

This trait defines what APIs modules can call on the node. Implemented by the node side, used by modules through IPC.

Required Methods§

Source

fn get_block<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<Block>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get a block by hash

Source

fn get_block_header<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<BlockHeader>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get a block header by hash

Source

fn get_transaction<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get a transaction by hash

Source

fn has_transaction<'life0, 'life1, 'async_trait>( &'life0 self, hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<bool, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check if a transaction exists

Source

fn get_chain_tip<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<[u8; 32], ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get current chain tip (highest block hash)

Source

fn get_block_height<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<u64, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get current block height

Source

fn get_utxo<'life0, 'life1, 'async_trait>( &'life0 self, outpoint: &'life1 OutPoint, ) -> Pin<Box<dyn Future<Output = Result<Option<UTXO>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get UTXO by outpoint (read-only, cannot modify)

Source

fn subscribe_events<'life0, 'async_trait>( &'life0 self, event_types: Vec<EventType>, ) -> Pin<Box<dyn Future<Output = Result<Receiver<ModuleMessage>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Subscribe to node events

Returns a receiver that will receive event messages

Source

fn get_mempool_transactions<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<[u8; 32]>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get all transaction hashes in mempool

Source

fn get_mempool_transaction<'life0, 'life1, 'async_trait>( &'life0 self, tx_hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<Option<Transaction>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get a transaction from mempool by hash

Source

fn get_mempool_size<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<MempoolSize, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get mempool size information

Source

fn get_network_stats<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<NetworkStats, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get network statistics

Source

fn get_network_peers<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<PeerInfo>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get list of connected peers

Source

fn get_chain_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ChainInfo, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get chain information (tip, height, difficulty, etc.)

Source

fn get_block_by_height<'life0, 'async_trait>( &'life0 self, height: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<Block>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get block by height

Source

fn get_lightning_node_url<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<String>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get Lightning node connection info

Source

fn get_lightning_info<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Option<LightningInfo>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get Lightning node information

Source

fn get_payment_state<'life0, 'life1, 'async_trait>( &'life0 self, payment_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<PaymentState>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get payment state by payment ID

Source

fn check_transaction_in_mempool<'life0, 'life1, 'async_trait>( &'life0 self, tx_hash: &'life1 [u8; 32], ) -> Pin<Box<dyn Future<Output = Result<bool, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check if a transaction is in the mempool

Source

fn get_fee_estimate<'life0, 'async_trait>( &'life0 self, target_blocks: u32, ) -> Pin<Box<dyn Future<Output = Result<u64, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get fee estimate for target confirmation blocks Returns fee rate in satoshis per vbyte

Source

fn register_rpc_endpoint<'life0, 'async_trait>( &'life0 self, method: String, description: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Register a JSON-RPC endpoint Method name must have module prefix (e.g., “lightning_”, “stratum_”) Cannot override core endpoints (whitelist enforced)

Source

fn unregister_rpc_endpoint<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Unregister an RPC endpoint (on module shutdown)

Source

fn register_core_rpc_override<'life0, 'async_trait>( &'life0 self, method: String, description: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Override a core RPC method with a module handler.

method must be listed in OVERRIDABLE_CORE_RPC_METHODS; otherwise the node rejects the request. The description is informational (shown in getrpcinfo).

Source

fn unregister_core_rpc_override<'life0, 'life1, 'async_trait>( &'life0 self, method: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Release a previously registered core RPC override.

Source

fn register_timer<'life0, 'async_trait>( &'life0 self, interval_seconds: u64, callback: Arc<dyn TimerCallback>, ) -> Pin<Box<dyn Future<Output = Result<u64, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Register a periodic timer Returns a timer ID that can be used to cancel Callback is async and can call NodeAPI methods

Source

fn cancel_timer<'life0, 'async_trait>( &'life0 self, timer_id: u64, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Cancel a registered timer

Source

fn schedule_task<'life0, 'async_trait>( &'life0 self, delay_seconds: u64, callback: Arc<dyn TaskCallback>, ) -> Pin<Box<dyn Future<Output = Result<u64, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Schedule a one-time task Callback is async and can call NodeAPI methods

Source

fn report_metric<'life0, 'async_trait>( &'life0 self, metric: Metric, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Report a metric to the node

Source

fn get_module_metrics<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Metric>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get module metrics (for RPC/metrics endpoint)

Source

fn get_all_metrics<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<HashMap<String, Vec<Metric>>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get aggregated metrics from all modules

Source

fn read_file<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Read a file from the module’s data directory Path must be within the module’s sandboxed data directory

Source

fn write_file<'life0, 'async_trait>( &'life0 self, path: String, data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Write data to a file in the module’s data directory Path must be within the module’s sandboxed data directory

Source

fn delete_file<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Delete a file from the module’s data directory

Source

fn list_directory<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<Vec<String>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

List directory contents

Source

fn create_directory<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Create a directory in the module’s data directory

Source

fn get_file_metadata<'life0, 'async_trait>( &'life0 self, path: String, ) -> Pin<Box<dyn Future<Output = Result<FileMetadata, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get file metadata (size, type, timestamps)

Source

fn initialize_module<'life0, 'async_trait>( &'life0 self, module_id: String, module_data_dir: PathBuf, base_data_dir: PathBuf, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Initialize filesystem and storage access for a module Called when a module connects to set up per-module sandbox and storage

Source

fn discover_modules<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ModuleInfo>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Discover all available modules Returns list of module information for all loaded modules

Source

fn get_module_info<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ModuleInfo>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get information about a specific module Returns None if module is not loaded

Source

fn is_module_available<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<bool, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Check if a module is available (loaded and running)

Source

fn publish_event<'life0, 'async_trait>( &'life0 self, event_type: EventType, payload: EventPayload, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Publish an event (modules can publish to other modules) Event will be delivered to all modules subscribed to the event type

Source

fn call_module<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, target_module_id: Option<&'life1 str>, method: &'life2 str, params: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Call an API method on another module

§Arguments
  • target_module_id - ID of the target module (or None to use method routing)
  • method - API method name
  • params - Serialized parameters (typically JSON)
§Returns

Serialized response data

Source

fn register_module_api<'life0, 'async_trait>( &'life0 self, api: Arc<dyn ModuleAPI>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Register a module API for other modules to call

§Arguments
  • api - The API implementation
Source

fn unregister_module_api<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Unregister a module API

Source

fn send_mesh_packet_to_module<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, packet_data: Vec<u8>, peer_addr: String, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Send mesh packet to a module (for network layer integration) This allows the network layer to route mesh packets to the mesh module

Source

fn send_mesh_packet_to_peer<'life0, 'async_trait>( &'life0 self, peer_addr: String, packet_data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Send mesh packet to a network peer This allows modules to send mesh packets to network peers

Source

fn send_stratum_v2_message_to_peer<'life0, 'async_trait>( &'life0 self, peer_addr: String, message_data: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Send Stratum V2 message to peer (miner) This allows the Stratum V2 module to send messages to miners

Source

fn get_module_health<'life0, 'life1, 'async_trait>( &'life0 self, module_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ModuleHealth>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Get health status of a module

Source

fn get_all_module_health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, ModuleHealth)>, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get health status of all modules

Source

fn report_module_health<'life0, 'async_trait>( &'life0 self, health: ModuleHealth, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Report module health (for modules to self-report)

Source

fn get_block_template<'life0, 'async_trait>( &'life0 self, rules: Vec<String>, coinbase_script: Option<Vec<u8>>, coinbase_address: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<BlockTemplate, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Get block template (GBT equivalent)

Returns a block template suitable for mining. Uses the same formally verified consensus function as RPC getblocktemplate.

§Arguments
  • rules - Consensus rules to apply (e.g., [“segwit”])
  • coinbase_script - Optional coinbase script (for custom coinbase)
  • coinbase_address - Optional coinbase address (for custom coinbase)
§Returns

BlockTemplate with header, coinbase transaction, and selected transactions

Source

fn submit_block<'life0, 'async_trait>( &'life0 self, block: Block, ) -> Pin<Box<dyn Future<Output = Result<SubmitBlockResult, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Submit a solved block

Submits a fully solved block to the network. The block must be valid and meet the difficulty target.

§Arguments
  • block - The solved block to submit
§Returns

SubmitBlockResult indicating acceptance, rejection, or duplicate

Source

fn merge_block_serve_denylist<'life0, 'life1, 'async_trait>( &'life0 self, block_hashes: &'life1 [[u8; 32]], ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Merge block hashes into the node’s denylist for serving full block messages on the network (e.g. getdata). Additive; callers may include selective-sync, policy/compliance, or tests. Peers receive notfound for these hashes instead of a full block.

Source

fn get_block_serve_denylist_snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<BlockServeDenylistSnapshot, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Bounded snapshot of the block serve denylist (for status and debugging).

Source

fn clear_block_serve_denylist<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source

fn replace_block_serve_denylist<'life0, 'life1, 'async_trait>( &'life0 self, block_hashes: &'life1 [[u8; 32]], ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn merge_tx_serve_denylist<'life0, 'life1, 'async_trait>( &'life0 self, tx_hashes: &'life1 [[u8; 32]], ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Merge txids into the denylist for serving full tx on getdata (additive).

Source

fn get_tx_serve_denylist_snapshot<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<TxServeDenylistSnapshot, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source

fn clear_tx_serve_denylist<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Source

fn replace_tx_serve_denylist<'life0, 'life1, 'async_trait>( &'life0 self, tx_hashes: &'life1 [[u8; 32]], ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Source

fn get_sync_status<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<SyncStatus, ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Sync coordinator phase and progress (requires sync coordinator on the node API).

Source

fn ban_peer<'life0, 'life1, 'async_trait>( &'life0 self, peer_addr: &'life1 str, ban_duration_seconds: Option<u64>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Ban a peer by socket address string. ban_duration_seconds: None means permanent.

Source

fn set_block_serve_maintenance_mode<'life0, 'async_trait>( &'life0 self, enabled: bool, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

When enabled, refuse all full-block getdata answers (operational maintenance).

Provided Methods§

Source

fn queue_received_block_bytes<'life0, 'async_trait>( &'life0 self, _block_bytes: Vec<u8>, ) -> Pin<Box<dyn Future<Output = Result<(), ModuleError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Queue bincode‑serialized Block bytes for processing on the same path as P2P BlockReceived / in‑process FIBRE (pending block queue → validation).

Loadable modules (e.g. blvm-fibre) use this for UDP‑assembled blocks. Default: not supported (returns an error).

Implementors§