7 releases

0.0.11 Sep 3, 2024
0.0.10 Sep 2, 2024
0.0.9 Jun 25, 2024

#4 in #dlc

Download history 134/week @ 2024-06-22 20/week @ 2024-06-29 28/week @ 2024-07-06 15/week @ 2024-07-27 268/week @ 2024-08-31 28/week @ 2024-09-07 12/week @ 2024-09-14 29/week @ 2024-09-21 19/week @ 2024-09-28 5/week @ 2024-10-05

66 downloads per month
Used in ddk-node

MIT license

100KB
2.5K SLoC

DLC Dev Kit

Crate Documentation Crates.io Total Downloads

⚠️ dlcdevkit is alpha software and should not be used with real money. API is subject to change.

Application tooling to get started with DLCs build with rust-dlc and bdk.

Build DLC application by plugging in your own transport, storage, and oracle clients.

Get Started

$ cargo add ddk
use ddk::config::DdkConfig;
use ddk::builder::DdkBuilder;
use ddk::oracle::P2PDOracleClient;
use ddk::storage::SledStorageProvider;
use ddk::transport::lightning::LightningTransport;
use std::env::current_dir;
use std::sync::Arc;

type ApplicationDdk = ddk::DlcDevKit<LightningTransport, SledStorageProvider, P2PDOracleClient>;

fn main() -> Result<()> {
    let mut config = DdkConfig::default();
    config.storage_path = current_dir()?;

    let transport = Arc::new(LightningTransport::new(&config.seed_config, config.network)?);
    let storage = Arc::new(SledStorageProvider::new(
        config.storage_path.join("sled_db").to_str().expect("No storage."),
    )?);

    let oracle_client = Arc::new(P2PDOracleClient::new(ddk::ORACLE_HOST).expect("no oracle"));

    let mut builder = DdkBuilder::new();
    builder.set_config(config);
    builder.set_transport(transport.clone());
    builder.set_storage(storage.clone());
    builder.set_oracle(oracle_client.clone());

    let ddk: ApplicationDdk = builder.finish()?;

    let wallet = ddk.wallet.new_external_address();

    assert!(wallet.is_ok());

    ddk.start().expect("couldn't start ddk");
}

Crates

Ready-to-go clients for developing applications:

  • ddk - Contains DLC management w/ rust-dlc and the internal wallet w/ bdk.

Storage

  • filestore - flat file store for DLC contracts
  • sqlite - sqlite store for DLC contracts

Transport

Oracle Clients

Dependencies

~75MB
~1M SLoC