ldk-node

0.5.0

A ready-to-go node implementation built using LDK.
lightningdevkit/ldk-node

What's New

v0.5.0

2025-05-05T08:47:28Z

0.5.0 - Apr. 29, 2025

Besides numerous API improvements and bugfixes this fifth minor release notably adds support for sourcing chain and fee rate data from an Electrum backend, requesting channels via the bLIP-51 / LSPS1 protocol, as well as experimental support for operating as a bLIP-52 / LSPS2 service.

Feature and API updates

  • The PaymentSuccessful event now exposes a payment_preimage field (#392).
  • The node now emits PaymentForwarded events for forwarded payments (#404).
  • The ability to send custom TLVs as part of spontaneous payments has been added (#411).
  • The ability to override the used fee rates for on-chain sending has been added (#434).
  • The ability to set a description hash when creating a BOLT11 invoice has been added (#438).
  • The ability to export pathfinding scores has been added (#458).
  • The ability to request inbound channels from an LSP via the bLIP-51 / LSPS1 protocol has been added (#418).
  • The ChannelDetails returned by Node::list_channels now exposes fields for the channel's SCIDs (#444).
  • Lightning peer-to-peer gossip data is now being verified when syncing from a Bitcoin Core RPC backend (#428).
  • The logging sub-system was reworked to allow logging to backends using the Rust log facade, as well as via a custom logger trait (#407, #450, #454).
  • On-chain transactions are now added to the internal payment store and exposed via Node::list_payments (#432).
  • Inbound announced channels are now rejected if not all requirements for operating as a forwarding node (set listening addresses and node alias) have been met (#467).
  • Initial support for operating as an bLIP-52 / LSPS2 service has been added (#420).
    • Note: bLIP-52 / LSPS2 support is considered 'alpha'/'experimental' and should not yet be used in production.
  • The Builder::set_entropy_seed_bytes method now takes an array rather than a Vec (#493).
  • The builder will now return a NetworkMismatch error in case of network switching (#485).
  • The Bolt11Jit payment variant now exposes a field telling how much fee the LSP withheld (#497).
  • The ability to disable syncing Lightning and on-chain wallets in the background has been added. If it is disabled, the user is responsible for running Node::sync_wallets manually (#508).
  • The ability to configure the node's announcement addresses independently from the listening addresses has been added (#484).
  • The ability to choose whether to honor the Anchor reserves when calling send_all_to_address has been added (#345).
  • The ability to sync the node via an Electrum backend has been added (#486).

Bug Fixes and Improvements

  • When syncing from Bitcoin Core RPC, syncing mempool entries has been made more efficient (#410, #465).
  • We now ensure the our configured fallback rates are used when the configured chain source would return huge bogus values during fee estimation (#430).
  • We now re-enabled trying to bump Anchor channel transactions for trusted counterparties in the ContentiousClaimable case to reduce the risk of losing funds in certain edge cases (#461).
  • An issue that would potentially have us panic on retrying the chain listening initialization when syncing from Bitcoin Core RPC has been fixed (#471).
  • The Node::remove_payment now also removes the respective entry from the in-memory state, not only from the persisted payment store (#514).

Compatibility Notes

  • The filesystem logger was simplified and its default path changed to ldk_node.log in the configured storage directory (#394).
  • The BDK dependency has been bumped to bdk_wallet v1.0 (#426).
  • The LDK dependency has been bumped to lightning v0.1 (#426).
  • The rusqlite dependency has been bumped to v0.31 (#403).
  • The minimum supported Rust version (MSRV) has been bumped to v1.75 (#429).

In total, this release features 53 files changed, 6147 insertions, 1193 deletions, in 191 commits from 14 authors in alphabetical order:

  • alexanderwiederin
  • Andrei
  • Artur Gontijo
  • Ayla Greystone
  • Elias Rohrer
  • elnosh
  • Enigbe Ochekliye
  • Evan Feenstra
  • G8XSU
  • Joost Jager
  • maan2003
  • moisesPompilio
  • Rob N
  • Vincenzo Palazzo

Please note the attached LDKNodeFFI.xcframework archive is intended to be used via SwiftPM.

LDK Node

Crate Documentation Maven Central Android Maven Central JVM Security Audit

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, open_channel, send, etc.

use ldk_node::Builder;
use ldk_node::lightning_invoice::Bolt11Invoice;
use ldk_node::lightning::ln::msgs::SocketAddress;
use ldk_node::bitcoin::secp256k1::PublicKey;
use ldk_node::bitcoin::Network;
use std::str::FromStr;

fn main() {
	let mut builder = Builder::new();
	builder.set_network(Network::Testnet);
	builder.set_chain_source_esplora("https://blockstream.info/testnet/api".to_string(), None);
	builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());

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

	node.start().unwrap();

	let funding_address = node.onchain_payment().new_address();

	// .. fund address ..

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

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

	let invoice = Bolt11Invoice::from_str("INVOICE_STR").unwrap();
	node.bolt11_payment().send(&invoice, None).unwrap();

	node.stop().unwrap();
}

Modularity

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 the Bitcoin Core RPC interface, or from an Electrum or Esplora server.
  • 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.

MSRV

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

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Jun 30 2025 14:47:03 GMT-0900 (Hawaii-Aleutian Daylight Time)