A ready-to-go Lightning node library built using LDK and BDK.
LDK Node is a non-custodial Lightning node in library form. Its central goal is to provide a small, simple, and straightforward interface that enables users to easily set up and run a Lightning node with an integrated on-chain wallet. While minimalism is at its core, LDK Node aims to be sufficiently modular and configurable to be useful for a variety of use cases.
The primary abstraction of the library is the Node
, which can be retrieved by setting up and configuring a Builder
to your liking and calling build()
. Node
can then be controlled via commands such as start
, stop
, connect_open_channel
, send_payment
, etc.:
```rust use ldknode::Builder; use ldknode::lightninginvoice::Invoice; use ldknode::bitcoin::secp256k1::PublicKey; use std::str::FromStr;
fn main() { let node = Builder::new() .setnetwork("testnet") .setesploraserverurl("https://blockstream.info/testnet/api".to_string()) .build();
node.start().unwrap();
let _funding_address = node.new_funding_address();
// .. fund address ..
node.sync_wallets().unwrap();
let node_id = PublicKey::from_str("NODE_ID").unwrap();
let node_addr = "IP_ADDR:PORT".parse().unwrap();
node.connect_open_channel(node_id, node_addr, 10000, None, false).unwrap();
let invoice = Invoice::from_str("INVOICE_STR").unwrap();
node.send_payment(&invoice).unwrap();
node.stop().unwrap();
} ```
LDK Node currently comes with a decidedly opionated set of design choices:
bitcoind
RPC will follow)LDK Node is written in Rust and may therefore be natively included in any std
Rust program. Beyond its Rust API it also offers language bindings for Swift, Kotlin, and Python based on UniFFI.