ldk-node

0.3.0

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

What's New

v0.3.0

2024-06-21T08:39:45Z

0.3.0 - June 21, 2024

This third minor release notably adds support for BOLT12 payments, Anchor channels, and sourcing inbound liquidity via LSPS2 just-in-time channels.

Feature and API updates

  • Support for creating and paying BOLT12 offers and refunds has been added (#265).
  • Support for Anchor channels has been added (#141).
  • Support for sourcing inbound liquidity via LSPS2 just-in-time (JIT) channels has been added (#223).
  • The node's local view of the network graph can now be accessed via interface methods (#293).
  • A new next_event_async method was added that allows polling the event queue asynchronously (#224).
  • A default_config method was introduced that allows to retrieve sane default values, also in bindings (#242).
  • The PaymentFailed and ChannelClosed events now include reason fields (#260).
  • All available balances outside of channel balances are now exposed via a unified list_balances interface method (#250).
  • The maximum in-flight HTLC value has been bumped to 100% of the channel capacity for private outbound channels (#303) and, if JIT channel support is enabled, for inbound channels (#262).
  • The fee paid is now exposed via the PaymentSuccessful event (#271).
  • A status method has been added allowing to retrieve information about the Node's status (#272).
  • Node no longer takes a KVStore type parameter, allowing to use the filesystem storage backend in bindings (#244).
  • The payment APIs have been restructured to use per-type (bolt11, onchain, bolt12, ..) payment handlers which can be accessed via corresponding Node::{type}_payment methods (#270).
  • Fully resolved channel monitors are now eventually moved to an archive location (#307).
  • The ability to register and claim from custom payment hashes generated outside of LDK Node has been added (#308).

Bug Fixes

  • Node announcements are now correctly only broadcast if we have any public, sufficiently confirmed channels (#248, #314).
  • Falling back to default fee values is now disallowed on mainnet, ensuring we won't startup without a successful fee cache update (#249).
  • Persisted peers are now correctly reconnected after startup (#265).
  • Concurrent connection attempts to the same peer are no longer overriding each other (#266).
  • Several steps have been taken to reduce the risk of blocking node operation on wallet syncing in the face of unresponsive Esplora services (#281).

Compatibility Notes

  • LDK has been updated to version 0.0.123 (#291).

In total, this release features 54 files changed, 7282 insertions, 2410 deletions in 165 commits from 3 authors, in alphabetical order:

  • Elias Rohrer
  • jbesraa
  • Srikanth Iyengar

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, connect_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_esplora_server("https://blockstream.info/testnet/api".to_string());
	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.connect_open_channel(node_id, node_addr, 10000, None, None, false).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).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 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.

MSRV

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

Description

  • Swift Tools 5.5.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri Dec 20 2024 10:37:16 GMT-1000 (Hawaii-Aleutian Standard Time)