Expand description
Ethereum Anchoring for Moloch.
This crate provides an Ethereum implementation of the AnchorProvider trait,
allowing Moloch chain state to be anchored to Ethereum and EVM-compatible chains.
§Anchoring Methods
This provider supports multiple anchoring methods:
-
Calldata Anchoring (Default)
- Embeds commitment in transaction input data
- Most cost-effective for pure anchoring
- Data:
[MOLOCH_SELECTOR (4)] [commitment_hash (32)] [chain_id_hash (8)]
-
Contract Event Anchoring
- Emits events from a dedicated anchor contract
- Better for on-chain verification
- Supports batch anchoring
§Example
ⓘ
use moloch_anchor_ethereum::{EthereumProvider, EthereumConfig, Chain};
let config = EthereumConfig::new("https://eth.llamarpc.com", Chain::Mainnet)
.with_private_key("0x...");
let provider = EthereumProvider::new(config).await?;
// Anchor a commitment
let tx = provider.submit(&commitment).await?;
// Wait for confirmations
let proof = provider.wait_for_confirmations(&tx.tx_id, 12).await?;Structs§
- Ethereum
Config - Configuration for the Ethereum provider.
- Ethereum
Provider - Ethereum anchor provider.
Enums§
- Anchor
Method - Method for anchoring data.
- Chain
- Ethereum chain/network.
- Ethereum
Error - Errors that can occur during Ethereum anchoring.
Constants§
- ANCHOR_
DATA_ SIZE - Anchor data size: selector(4) + commitment(32) + chain_id(8) = 44 bytes.
- DEFAULT_
CONFIRMATIONS - Default number of confirmations for finality.
- MOLOCH_
SELECTOR - Function selector for Moloch anchor calls (first 4 bytes of keccak256(“anchor(bytes32,bytes8)”)).
Type Aliases§
- Result
- Result type for Ethereum operations.