1 unstable release
| 0.1.0 | Feb 4, 2026 |
|---|
#24 in #blockchain-cryptography
Used in 2 crates
705KB
16K
SLoC
Provider-Agnostic Blockchain Anchoring for Moloch.
This crate provides a unified interface for anchoring Moloch chain state to external blockchains (Bitcoin, Ethereum, Solana, etc.) without coupling to any specific implementation.
Architecture
┌─────────────────────────────────────────────────────────────────────┐
│ MOLOCH ANCHOR LAYER │
│ │
│ ┌───────────────────────────────────────────────────────────────┐ │
│ │ ANCHOR MANAGER │ │
│ │ - Schedules periodic anchoring │ │
│ │ - Manages multiple providers │ │
│ │ - Tracks anchor confirmations │ │
│ └───────────────────────────────────────────────────────────────┘ │
│ │ │
│ ┌────────────────┼────────────────┐ │
│ ▼ ▼ ▼ │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Bitcoin │ │ Ethereum │ │ Solana │ ... │
│ │ Provider │ │ Provider │ │ Provider │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │
│ ┌───────────────────────────────────────────────────────────────┐ │
│ │ PROOF VERIFIER │ │
│ │ - Verifies anchor proofs from any provider │ │
│ │ - SPV validation for light clients │ │
│ │ - Cross-chain proof aggregation │ │
│ └───────────────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────────────┘
Example
use moloch_anchor::{AnchorManager, Commitment, MockProvider};
// Create manager with mock provider for testing
let mut manager = AnchorManager::new();
manager.register_provider(MockProvider::new("test"));
// Create a commitment to anchor
let commitment = Commitment::new(mmr_root, height);
// Anchor to all registered providers
let anchors = manager.anchor(&commitment).await?;
// Verify an anchor proof
let valid = manager.verify(&anchor_proof).await?;
Dependencies
~28MB
~475K SLoC