Skip to content

Commit 79228b6

Browse files
tnullConorOkus
andauthored
Add LDK Node announcement blog post (#211)
* Add LDK Node announcement blog post * Update docs/_blog/announcing-ldk-node.md Co-authored-by: Conor Okus <[email protected]>
1 parent 911da87 commit 79228b6

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

docs/_blog/announcing-ldk-node.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
title: "Announcing LDK Node"
3+
description: "A ready-to-go Lightning node library built using LDK and BDK."
4+
date: "2023-06-22"
5+
authors:
6+
- Elias Rohrer
7+
tags:
8+
- Self-custody
9+
- Mobile
10+
---
11+
12+
[LDK Node][github_repo] is a ready-to-go Lightning node library built using [LDK][ldk] and [BDK][bdk]. LDK Node provides a straightforward interface and an integrated on-chain wallet, enabling users to quickly and easily set up a self-custodial Lightning node. With LDK Node, developers can get a Lightning Node up and running within a day.
13+
14+
## A Lightweight Solution
15+
LDK fully implements the Lightning protocol as a highly modular Rust library. LDK's flexibility allows developers to integrate Lightning functionality into [many types of applications][ldk_case_studies], including those with pre-existing infrastructure or complex architectures. The public API comprises more than 900 exposed methods, letting users adjust and interact with protocol layers in great detail. While this customization is great for builders, it often comes with the added cost of increased complexity.
16+
17+
LDK provides sane defaults where possible. However, correctly and effectively setting up all interconnected modules requires a deeper understanding of protocol fundamentals and some familiarity with the LDK API. Moreover, because LDK adheres to the separation-of-concerns principle, it is wallet-agnostic and deliberately doesn't come with an included on-chain wallet. Therefore, the integration with a suitable on-chain wallet is left to the user.
18+
19+
As a result, it can take a bit of effort to get started with LDK. That's why we created LDK Node, a more fully-baked solution.
20+
21+
## LDK Node: Simplifying Self-custodial Lightning Integration
22+
LDK Node was designed to hide protocol complexities without infringing on usability. LDK Node's much smaller API surface makes its reduced complexity evident. Compared to LDK's above 900 exposed methods, LDK Node's API currently only encompasses around 30 API calls. While simplicity and minimalism are at its core, LDK Node remains configurable enough to operate a fully functional self-custodial Lightning node in various use cases.
23+
24+
There is a trade-off between simplicity and expressiveness when designing an API while handling protocol complexity. The API needs to become more complicated to increase configurability and the interconnectivity of components. As a result, the user must spend more time examining, learning, and scrutinizing the API before finally being able to use it. While the LDK API errs on the side of expressiveness, LDK Node leans towards simplicity.
25+
26+
This first release of LDK Node comes with an opinionated set of design choices and ready-to-go modules:
27+
28+
- The integrated [BDK][bdk] wallet handles on-chain data.
29+
- Chain data is sourced from an [Esplora][esplora] server, while support for Electrum and `bitcoind` RPC will follow soon.
30+
- Wallet and channel state may be persisted to an [SQLite][sqlite] database, to file system, or to a custom back-end to be implemented by the user. Support for [Versioned Storage Service (VSS)][vss] will follow soon.
31+
- Gossip data may be sourced via Lightning's peer-to-peer network or the [Rapid Gossip Sync (RGS)][rgs] protocol.
32+
- Entropy for Lightning and on-chain wallets may be sourced from raw bytes or a [BIP39][bip39] mnemonic. In addition, LDK Node offers the means to generate and persist the entropy bytes to disk.
33+
34+
## Mobile-first Self-Custody
35+
The main goal of the Lightning protocol is to enable fast, private, and secure Bitcoin transactions for the end-user. However, today most Lightning deployments are custodial services that may only be queried by the client device in the end-user's hands. This is understandable: deploying self-custodial Lightning nodes on end-user devices can take a lot of work to get right, as there are many pitfalls to avoid.
36+
37+
To this end, one of the primary goals of LDK Node is to simplify the integration of self-custodial Lightning nodes in mobile applications. The features of the initial release are centered around mobile deployments. The integration with an Esplora chain data source and a Rapid Gossip Sync server allows the node to operate in mobile environments that may be limited in terms of bandwidth and overall traffic quota.
38+
39+
LDK Node itself is written in [Rust][rust] and may therefore be natively added as a library dependency to any `std` Rust program. However, beyond its Rust API, it offers [Swift][swift], [Kotlin][kotlin], and [Python][python] language bindings based on [UniFFI][uniffi]. Moreover, [Flutter][flutter_bindings] bindings are also available to allow usage of the LDK Node library in mobile environments.
40+
41+
## Getting Started
42+
43+
The primary abstraction of the library is the [`Node`][api_docs_node], which can be retrieved by setting up and configuring a [`Builder`][api_docs_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.
44+
45+
[Read Full API Documentation][api_docs]
46+
47+
```rust
48+
use ldk_node::{Builder, NetAddress};
49+
use ldk_node::lightning_invoice::Invoice;
50+
use ldk_node::bitcoin::secp256k1::PublicKey;
51+
use ldk_node::bitcoin::Network;
52+
use std::str::FromStr;
53+
54+
fn main() {
55+
let mut builder = Builder::new();
56+
builder.set_network(Network::Testnet);
57+
builder.set_esplora_server("https://blockstream.info/testnet/api".to_string());
58+
builder.set_gossip_source_rgs("https://rapidsync.lightningdevkit.org/testnet/snapshot".to_string());
59+
60+
let node = builder.build().unwrap();
61+
62+
node.start().unwrap();
63+
64+
let funding_address = node.new_onchain_address();
65+
66+
// .. fund address ..
67+
68+
let node_id = PublicKey::from_str("NODE_ID").unwrap();
69+
let node_addr = NetAddress::from_str("IP_ADDR:PORT").unwrap();
70+
node.connect_open_channel(node_id, node_addr, 10000, None, false).unwrap();
71+
72+
let event = node.wait_next_event();
73+
println!("EVENT: {:?}", event);
74+
node.event_handled();
75+
76+
let invoice = Invoice::from_str("INVOICE_STR").unwrap();
77+
node.send_payment(&invoice).unwrap();
78+
79+
node.stop().unwrap();
80+
}
81+
```
82+
83+
## Outlook
84+
The 0.1 release is only the beginning for LDK Node. Development for the next release has already started, and we'll be looking to add support for sourcing chain data from Electrum or `bitcoind` RPC, and supporting persistence to a [VSS][vss] backend (see the [v0.2 tracking issue][v02tracking]). Additionally, integration with the [LSP specification][lsp_spec] is actively being worked on (see the [LSP Client][lsp_client] repository) and will come to LDK Node as soon as it's ready. Beyond these planned feature updates to the LDK Node library, we're also considering further deployment targets, including adding server-grade modules in the future.
85+
86+
## Further Resources
87+
- [Github Repository][github_repo]
88+
- [API Documentation][api_docs]
89+
- [Rust Crate][rust_crate]
90+
91+
## Showcases
92+
- [Monday Wallet: Example wallet built with on LDK Node Swift bindings][monday]
93+
94+
[github_repo]: https://github.com/lightningdevkit/ldk-node
95+
[api_docs]: https://docs.rs/ldk-node/*/ldk_node/
96+
[api_docs_node]: https://docs.rs/ldk-node/*/ldk_node/struct.Node.html
97+
[api_docs_builder]: https://docs.rs/ldk-node/*/ldk_node/struct.Builder.html
98+
[rust_crate]: https://crates.io/
99+
[ldk]: https://lightningdevkit.org/
100+
[bdk]: https://bitcoindevkit.org/
101+
[esplora]: https://github.com/Blockstream/esplora
102+
[sqlite]: https://sqlite.org/
103+
[rust]: https://www.rust-lang.org/
104+
[swift]: https://www.swift.org/
105+
[kotlin]: https://kotlinlang.org/
106+
[python]: https://www.python.org/
107+
[flutter_bindings]: https://github.com/LtbLightning/ldk-node-flutter
108+
[v02tracking]: https://github.com/lightningdevkit/ldk-node/issues/107
109+
[ldk_case_studies]: https://lightningdevkit.org/case-studies/
110+
[vss]: https://github.com/lightningdevkit/vss-server
111+
[rgs]: https://docs.rs/lightning-rapid-gossip-sync/0.0.115/lightning_rapid_gossip_sync/
112+
[bip39]: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
113+
[monday]: https://github.com/reez/Monday
114+
[lsp_spec]: https://github.com/BitcoinAndLightningLayerSpecs/lsp
115+
[lsp_client]: https://github.com/lightningdevkit/ldk-lsp-client
116+
[uniffi]: https://github.com/mozilla/uniffi-rs/
117+

0 commit comments

Comments
 (0)