#lightning #ldk #bitcoin #bdk #setup

yanked fedimint-ldk-node

A ready-to-go node implementation built using LDK

1 unstable release

0.1.0 Nov 25, 2023

#7 in #ldk

Download history 22/week @ 2024-01-01 9/week @ 2024-01-08 38/week @ 2024-01-15 96/week @ 2024-01-22 251/week @ 2024-01-29 245/week @ 2024-02-05 245/week @ 2024-02-12 306/week @ 2024-02-19 200/week @ 2024-02-26 393/week @ 2024-03-04 65/week @ 2024-03-11 8/week @ 2024-03-18 4/week @ 2024-03-25 49/week @ 2024-04-01 15/week @ 2024-04-08 7/week @ 2024-04-15

75 downloads per month



Rust 5.5K SLoC // 0.0% comments Swift 2K SLoC // 0.1% comments Kotlin 476 SLoC // 0.1% comments Batch 142 SLoC Shell 92 SLoC // 0.1% comments Python 60 SLoC

Contains (JAR file, 62KB) gradle-wrapper.jar, (JAR file, 62KB) gradle-wrapper.jar

LDK Node

Crate Documentation

A ready-to-go Lightning node library built using LDK and BDK.

LDK Node is a self-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.

Getting Started

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 one of the build methods. Node can then be controlled via commands such as start, stop, connect_open_channel, send_payment, etc.

use ldk_node::{Builder, NetAddress};
use ldk_node::lightning_invoice::Invoice;
use ldk_node::bitcoin::secp256k1::PublicKey;
use ldk_node::bitcoin::Network;
use std::str::FromStr;

fn main() {
	let mut builder = Builder::new();

	let node = builder.build().unwrap();


	let funding_address = node.new_onchain_address();

	// .. fund address ..

	let node_id = PublicKey::from_str("NODE_ID").unwrap();
	let node_addr = NetAddress::from_str("IP_ADDR:PORT").unwrap();
	node.connect_open_channel(node_id, node_addr, 10000, None, None, false).unwrap();

	let event = node.wait_next_event();
	println!("EVENT: {:?}", event);

	let invoice = Invoice::from_str("INVOICE_STR").unwrap();



LDK Node currently comes with a decidedly opinionated set of design choices:

  • On-chain data is handled by the integrated BDK wallet.
  • Chain data may currently be sourced from an Esplora server, while support for Electrum and bitcoind RPC will follow soon.
  • Wallet and channel state may be persisted to an SQLite database, to file system, or to a custom back-end to be implemented by the user.
  • Gossip data may be sourced via Lightning's peer-to-peer network or the Rapid Gossip Sync protocol.
  • Entropy for the Lightning and on-chain wallets may be sourced from raw bytes or a BIP39 mnemonic. In addition, LDK Node offers the means to generate and persist the entropy bytes to disk.

Language Support

LDK Node itself is written in Rust and may therefore be natively added as a library dependency to any std Rust program. However, beyond its Rust API it also offers language bindings for Swift, Kotlin, and Python based on the UniFFI. Moreover, Flutter bindings are also available.


The Minimum Supported Rust Version (MSRV) is currently 1.60.0.


~1M SLoC