Skip to main content

Module utxo_commitments

Module utxo_commitments 

Source
Expand description

UTXO Commitments Module

Implements cryptographic commitments to the UTXO set using Merkle trees. This module enables efficient UTXO set synchronization and verification without requiring full blockchain download.

§Architecture

  • Data Structures: UTXO, UTXO Set, UTXO Commitment
  • Merkle Tree: Sparse Merkle Tree for incremental updates
  • Peer Consensus: N of M peer verification model
  • Verification: PoW-based commitment verification

§Usage

use blvm_protocol::utxo_commitments::{UtxoMerkleTree, UtxoCommitment};
use blvm_consensus::types::{OutPoint, UTXO, Hash};

// Create UTXO Merkle tree
let mut utxo_tree = UtxoMerkleTree::new()?;

// Add UTXO
let outpoint = OutPoint { hash: [1; 32].into(), index: 0 };
let utxo = UTXO { value: 1000, script_pubkey: vec![].into(), height: 0, is_coinbase: false };
utxo_tree.insert(outpoint, utxo)?;

// Generate commitment
let root = utxo_tree.root();
let commitment = UtxoCommitment::new(root, 1000, 1, height, block_hash);

Re-exports§

pub use initial_sync::update_commitments_after_block;
pub use initial_sync::InitialSync;
pub use merkle_tree::UtxoMerkleTree;
pub use config::*;
pub use data_structures::*;
pub use network_integration::*;
pub use peer_consensus::*;
pub use verification::*;

Modules§

config
Configuration for UTXO Commitments Module
data_structures
UTXO Commitment Data Structures
initial_sync
Initial Sync Algorithm
merkle_tree
UTXO Merkle Tree Implementation
network_integration
Network Integration Helpers for UTXO Commitments
peer_consensus
Peer Consensus Protocol
verification
UTXO Commitment Verification