You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/build_node.md
+6-2Lines changed: 6 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,9 @@ This document covers everything you need to make a node using LDK.
9
9
10
10
*[Setup](#setup) covers everything you need to do to set up LDK on startup.
11
11
*[Running LDK](#running-ldk) covers everything you need to do while LDK is running to keep it operational.
12
-
*[Using LDK](#using-ldk) covers most lightning operations you'll want to use, such as opening a channel. Sending and receiving payments are supported but not yet a part of this guide.
12
+
*[Using LDK](#using-ldk) covers most lightning operations you'll want to use,
13
+
such as opening a channel. Sending and receiving payments are supported but
14
+
not yet a part of this guide.
13
15
14
16
Note that LDK does not assume that safe shutdown is available, so there is no
15
17
shutdown checklist.
@@ -25,7 +27,9 @@ shutdown checklist.
25
27
final fee_estimator =FeeEstimator.new_impl((confirmation_target ->253));
26
28
```
27
29
28
-
**Implementation notes:** Rather than using static fees, you'll want to fill in the lambda with fetching up-to-date fees from a source like bitcoin core or your own API endpoint.
30
+
**Implementation notes:** Rather than using static fees, you'll want to fill in
31
+
the lambda with fetching up-to-date fees from a source like bitcoin core or your
Copy file name to clipboardExpand all lines: docs/overview.md
+113-2Lines changed: 113 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,118 @@ title: Overview
4
4
slug: /
5
5
---
6
6
7
+
import useBaseUrl from '@docusaurus/useBaseUrl';
8
+
7
9
LDK is a flexible lightning implementation with supporting batteries (or modules).
8
-
The core lightning implementation is Rust-Lightning.
9
10
10
-
See the Rust-Lightning `README` for more overview: https://github.com/rust-bitcoin/rust-lightning
11
+
## To jump into integrating LDK with your application, click [here](build_node.md)
12
+
13
+
## Introduction
14
+
LDK/Rust-Lightning is a generic library which allows you to build a lightning
15
+
node without needing to worry about getting all of the lightning state machine,
16
+
routing, and on-chain punishment code (and other chain interactions) exactly
17
+
correct. Note that Rust-Lightning isn't, in itself, a node. There are various
18
+
working/in progress demos which could be used as a node today, but if you "just"
19
+
want a generic lightning node, you're almost certainly better off with
20
+
`c-lightning`/`lnd` - if, on the other hand, you want to integrate lightning
21
+
with custom features such as your own chain sync, your own key management, your
22
+
own data storage/backup logic, etc., LDK is likely your only option.
23
+
24
+
We are currently working on a demo node which fetches blockchain data and
25
+
on-chain funds via Bitcoin Core RPC/REST. The individual pieces of that demo
26
+
are/will be composable, so you can pick the off-the-shelf parts you want and
27
+
replace the rest.
28
+
29
+
## LDK Batteries
30
+
While LDK provides all the core lightning state machine logic, other
31
+
batteries/modules are needed to run a node. LDK interacts with these modules
32
+
through generic interfaces, meaning the user can choose the implementation that
33
+
best suits their needs. LDK provides sample implementations for many of these
34
+
batteries, which are enumerated below.
35
+
36
+
* On-disk storage
37
+
* You can store the channel state any way you want - whether Google
38
+
Drive/iCloud, a local disk, any key-value store/database/a remote server, or
39
+
any combination of them - we provide a clean API that provides objects which
40
+
can be serialized into simple binary blobs, and stored in any way you wish.
41
+
*[**Sample module in Rust**](https://github.com/rust-bitcoin/rust-lightning/tree/main/lightning-persister)
42
+
* Blockchain data
43
+
* We provide a simple `block_connected`/`block_disconnected`
44
+
API which you provide block headers and transaction information to. We also
45
+
provide an API for getting information about transactions we wish to be
46
+
informed of, which is compatible with Electrum server requests/neutrino
47
+
filtering/etc.
48
+
*[**WIP sample module in Rust**](https://github.com/rust-bitcoin/rust-lightning/pull/791)
49
+
* On-chain funds wallet/UTXO management
50
+
* Rust-Lightning/LDK owns on-chain funds as long as they are claimable as
51
+
a part of a lightning output which can be contested - once a channel is closed
52
+
and all on-chain outputs are spendable only by the user, we provide users
53
+
notifications that a UTXO is "theirs" again and it is up to them to spend it
54
+
as they wish. Additionally, channel funding is accomplished with a generic API
55
+
which notifies users of the output which needs to appear on-chain, which they
56
+
can then create a transaction for. Once a transaction is created, we handle
57
+
the rest. This is a large part of our API's goals - making it easier to
58
+
integrate lightning into existing on-chain wallets which have their own
59
+
on-chain logic - without needing to move funds in and out of a separate
60
+
lightning wallet with on-chain transactions and a separate private key system.
61
+
* LDK does not currently provide a sample wallet module, but its sample node
62
+
implementation uses Bitcoin Core's wallet for UTXO management e.g. [here](https://github.com/TheBlueMatt/rust-lightning-bitcoinrpc/blob/139a653eeba313284c6d9d2eb2776d30dbb0ca3d/src/main.rs#L219)
63
+
* Networking
64
+
* To enable a user to run a full lightning node on an embedded
65
+
machine, we don't specify exactly how to connect to another node at all! We
66
+
provide a default implementation which uses TCP sockets, but, e.g., if you
67
+
wanted to run your full lightning node on a hardware wallet, you could, by
68
+
piping the lightning network messages over USB/serial and then sending them in
69
+
a TCP socket from another machine.
70
+
*[**Sample module in Rust**](https://github.com/rust-bitcoin/rust-lightning/tree/main/lightning-net-tokio)
71
+
*[**Sample module in Java**](https://github.com/lightningdevkit/ldk-garbagecollected/tree/main/src/main/java/org/ldk/batteries)
72
+
* Private keys
73
+
* LDK has "default implementations", but users can choose to provide private
74
+
keys to RL/LDK in any way they wish following a simple API. We even support a
75
+
generic API for signing transactions, allowing users to run RL/LDK without any
76
+
private keys in memory and/or putting private keys only on hardware wallets.
77
+
*[LDK's `KeyManager` docs](https://docs.rs/lightning/0.0.12/lightning/chain/keysinterface/struct.KeysManager.html). While LDK's default implementation is currently within Rust-Lightning, it still is considered a "sample module."
78
+
* Transaction filtering
79
+
* Clients running a light client may wish to filter for transactions on a separate server, in which case LDK will tell them about transactions to filter for. More information is available in the [Blockchain Data guide](blockdata.md).
Copy file name to clipboardExpand all lines: docs/use_cases.md
+38-1Lines changed: 38 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,4 +3,41 @@ id: use_cases
3
3
title: Use Cases for LDK
4
4
---
5
5
6
-
LDK is designed to provide incredible flexibility in integrating a lightning node into your application. It is not designed to be a stand-alone application and those seeking a full lightning node to run may wish to look elsewhere. LDK focuses on ensuring tight integration with existing on-chain wallets is easy, allowing reuse of existing blockchain download, key management, UTXO management, and on-disk/cloud storage. See the Getting Started page for more details on the interfaces LDK provides for integration.
6
+
The standard lightning use case is running a standalone node on one's laptop.
7
+
Here's some other use cases that LDK supports.
8
+
9
+
## Mobile Devices
10
+
Mobile devices with lightning have unique requirements often not well served by
11
+
today's lightning ecosystem. Not only do they need to operate with minimal
12
+
footprint, they also have intermittent data access and cannot shutdown safely.
13
+
More importantly, many existing wallets already have business logic to handle
14
+
blockchain data, keys, and storage, and do not wish to duplicate much of that
15
+
logic to integrate lightning (at worst fetching the blockchain twice). LDK
16
+
offers a flexible API to allow users to integrate lightning with their own keys,
17
+
blockchain data, and storage. To allow full flexibility in footprint, the API
18
+
supports routing data being fetched via the Lightning P2P protocol, an external
19
+
service, or routes can be calculated off-device. It also provides cross-platform
20
+
compatibility for free, allowing synchronization of lightning state across
21
+
devices and, as long as there is protection from simultaneous-updates, users to
22
+
access their wallet on any device. See the [Overview](overview.md) page for more
23
+
details on the interfaces LDK provides for integration.
24
+
25
+
## HSMs (Hardware Security Modules)
26
+
27
+
LDK Supports various HSM configurations. In conjunction with the [Lightning
28
+
Signer project](https://github.com/lightning-signer/) , an external HSM can be
29
+
used to verify most protocol details about states before signing, ensuring host
30
+
compromise cannot steal funds by broadcasting revoked states. For nodes seeking
31
+
a higher level of assurance, the entire Rust-Lightning channel state machine can
32
+
be run on an offline device, communicating with the outside world via a proxy
33
+
host which maintains TCP connections with peers. Such a configuration ensures
34
+
all details of the lightning protocol are enforced without consideration of host
35
+
compromise.
36
+
37
+
## Production Lightning Nodes
38
+
Many large Bitcoin transactors have large amounts of custom-built infrastructure
39
+
for interacting with the Bitcoin blockchain. Such tight integration with
40
+
business logic may be difficult with existing lightning implementations focusing
41
+
on standalone operation. For such transactors, LDK offers the possibility of
42
+
integrating a library in their native runtime, storing and handling lightning
43
+
data and events in the same way they do blockchain events.
0 commit comments