Crates.io | ddk |
lib.rs | ddk |
version | |
source | src |
created_at | 2024-06-07 13:40:00.413955+00 |
updated_at | 2025-03-26 18:45:09.966154+00 |
description | application tooling for DLCs 🌊 |
homepage | https://dlcdevkit.com |
repository | https://github.com/bennyhodl/dlcdevkit |
max_upload_size | |
id | 1264825 |
Cargo.toml error: | TOML parse error at line 17, column 1 | 17 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
:warning:
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.
$ cargo add ddk
use ddk::builder::Builder;
use ddk::storage::SledStorage;
use ddk::transport::lightning::LightningTransport; // with "lightning" feature
use ddk::oracle::KormirOracleClient;
use bitcoin::Network;
use std::sync::Arc;
type ApplicationDdk = ddk::DlcDevKit<LightningTransport, SledStorage, KormirOracleClient>;
#[tokio::main]
fn main() {
let transport = Arc::new(LightningTransport::new([0u8;32], <port>, Network::Regtest));
let storage = Arc::new(SledStorage::new("<storage path>")?);
let oracle_client = Arc::new(KormirOracleClient::new("<oracle host>", None).await?);
let ddk: ApplicationDdk = Builder::new()
.set_seed_bytes([0u8;32])
.set_network(Network::Regtest)
.set_esplora_path("http://127.0.0.1:3000")
.set_transport(transport.clone())
.set_storage(storage.clone())
.set_oracle(oracle_client.clone())
.finish()
.expect("could not build ddk node");
ddk.start().expect("ddk could not start");
}
Ready-to-go clients for developing applications:
ddk
- DLC management with an internal BDK wallet.
ddk-node
- A ready-to-go node with an accompanying cli.
payouts
- Functions to build DLC contracts.
You can create a custom DDK instance by implementing the required traits for storage and transport. DDK traits are defined in ddk/src/lib.rs. The traits are super traits from what is required in bdk
and rust-dlc
.
To quickly get started building a DDK application, there are pre-built components.
sled
- A simple file based storage using sled
LDK Peer Manager
- Communication over Lightning gossip using rust-dlc's implementation
nostr
- DLC communication from the NIP-88 spec
P2PDerivatives
- Spot price futures on the Bitcoin price repo
kormir
- Enumeration based oracle with server and nostr support repo
A bitcoin node, esplora server, and oracle server are required to run DDK. Developers can spin up a development environment with the justfile
provided.
$ just deps
Go to the README in ddk-node to start the project's DDK node example and more development information.