ddk-manager
Core DLC contract creation and state machine management for Discreet Log Contracts.
This crate provides the Manager component for creating, processing, and managing DLCs and DLC channels. It handles the full lifecycle from offer through settlement/closure, including both on-chain contracts and off-chain channels with support for renewals, settlements, and collaborative/unilateral closes.
Contract States
| State | Description |
|---|---|
Offered |
Contract has been proposed |
Accepted |
Counter party accepted the offer |
Signed |
Signatures have been exchanged |
Confirmed |
Funding transaction confirmed on-chain |
PreClosed |
CET broadcast but not fully confirmed |
Closed |
Contract fully settled |
Refunded |
Refund transaction was broadcast |
Key Traits
Users must implement these traits for their specific backends:
| Trait | Purpose |
|---|---|
Storage |
Persist and retrieve contracts, channels, and chain state |
Wallet |
Address generation, UTXO management, PSBT signing |
Blockchain |
Transaction broadcasting, block fetching, confirmations |
Oracle |
Fetch oracle announcements and attestations |
ContractSignerProvider |
Derive contract signing keys |
Manager API
// Contract lifecycle
manager.send_offer.await?;
manager.accept_contract_offer.await?;
manager.on_dlc_message.await?;
// Channel operations
manager.offer_channel.await?;
manager.settle_offer.await?;
manager.renew_offer.await?;
// Periodic maintenance
manager.periodic_check.await?;
Features
| Feature | Description |
|---|---|
std |
Standard library support (default) |
parallel |
Parallel processing in ddk-trie |
use-serde |
Serde serialization support |
License
This project is licensed under the MIT License.