Skip to content

Commit b73e5fc

Browse files
authored
Merge pull request #776 from valentinewallace/update-readme
Update readme
2 parents 2ea3765 + 2535695 commit b73e5fc

File tree

1 file changed

+79
-18
lines changed

1 file changed

+79
-18
lines changed

README.md

Lines changed: 79 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,108 @@ Rust-Lightning
88
Rust-Lightning is a Bitcoin Lightning library written in Rust. The main crate,
99
`lightning`, does not handle networking, persistence, or any other I/O. Thus,
1010
it is runtime-agnostic, but users must implement basic networking logic, chain
11-
interactions, and disk storage.
11+
interactions, and disk storage. More information is available in the `About`
12+
section.
1213

1314
The `lightning-net-tokio` crate implements Lightning networking using the
1415
[Tokio](https://github.com/tokio-rs/tokio) async runtime.
1516

17+
The `lightning-persister` crate implements persistence for channel data that
18+
is crucial to avoiding loss of channel funds. Sample modules for persistence of
19+
other Rust-Lightning data is coming soon.
20+
1621
Status
1722
------
1823

19-
The project implements all of the BOLT specifications in the 1.0 spec except
20-
for [channel queries](https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#query-messages). The
24+
The project implements all of the BOLT specifications in the 1.0 spec. The
2125
implementation has pretty good test coverage that is expected to continue to
22-
improve. There are a number of internal refactorings being done now that will
23-
make the code base more welcoming to new contributors. It is also anticipated
24-
that as developers begin using the API, the lessons from that will result in
25-
changes to the API, so any developer using this API at this stage should be prepared
26-
to embrace that. The current state is sufficient for a developer or project to
27-
experiment with it. Recent increased contribution rate to the project is expected
28-
to lead to a high quality, stable, production-worthy implementation in 2020.
26+
improve. It is also anticipated that as developers begin using the API, the
27+
lessons from that will result in changes to the API, so any developer using this
28+
API at this stage should be prepared to embrace that. The current state is
29+
sufficient for a developer or project to experiment with it. Recent increased
30+
contribution rate to the project is expected to lead to a high quality, stable,
31+
production-worthy implementation in 2021.
2932

3033
Communications for Rust-Lightning and Lightning Development Kit happens through
3134
[LDK slack](http://lightningdevkit.org/).
3235

36+
About
37+
-----------
38+
LDK/Rust-Lightning is a generic library which allows you to build a lightning
39+
node without needing to worry about getting all of the lightning state machine,
40+
routing, and on-chain punishment code (and other chain interactions) exactly
41+
correct. Note that Rust-Lightning isn't, in itself, a node. There are various
42+
working/in progress demos which could be used as a node today, but if you "just"
43+
want a generic lightning node, you're almost certainly better off with
44+
`c-lightning`/`lnd` - if, on the other hand, you want to integrate lightning
45+
with custom features such as your own chain sync, your own key management, your
46+
own data storage/backup logic, etc., LDK is likely your only option. Some
47+
Rust-Lightning utilities such as those in `chan_utils` are also suitable for use
48+
in non-LN Bitcoin applications such as DLCs and bulletin boards.
49+
50+
We are currently working on a demo node which fetches blockchain data and
51+
on-chain funds via Bitcoin Core RPC/REST. The individual pieces of that demo
52+
are/will be composable, so you can pick the off-the-shelf parts you want and
53+
replace the rest.
54+
55+
In general, Rust-Lightning does not provide (but LDK has implementations of):
56+
* on-disk storage - you can store the channel state any way you want - whether
57+
Google Drive/iCloud, a local disk, any key-value store/database/a remote
58+
server, or any combination of them - we provide a clean API that provides
59+
objects which can be serialized into simple binary blobs, and stored in any
60+
way you wish.
61+
* blockchain data - we provide a simple `block_connected`/`block_disconnected`
62+
API which you provide block headers and transaction information to. We also
63+
provide an API for getting information about transactions we wish to be
64+
informed of, which is compatible with Electrum server requests/neutrino
65+
filtering/etc.
66+
* UTXO management - RL/LDK owns on-chain funds as long as they are claimable as
67+
a part of a lightning output which can be contested - once a channel is closed
68+
and all on-chain outputs are spendable only by the user, we provide users
69+
notifications that a UTXO is "theirs" again and it is up to them to spend it
70+
as they wish. Additionally, channel funding is accomplished with a generic API
71+
which notifies users of the output which needs to appear on-chain, which they
72+
can then create a transaction for. Once a transaction is created, we handle
73+
the rest. This is a large part of our API's goals - making it easier to
74+
integrate lightning into existing on-chain wallets which have their own
75+
on-chain logic - without needing to move funds in and out of a separate
76+
lightning wallet with on-chain transactions and a separate private key system.
77+
* networking - to enable a user to run a full lightning node on an embedded
78+
machine, we don't specify exactly how to connect to another node at all! We
79+
provide a default implementation which uses TCP sockets, but, e.g., if you
80+
wanted to run your full lightning node on a hardware wallet, you could, by
81+
piping the lightning network messages over USB/serial and then sending them in
82+
a TCP socket from another machine.
83+
* private keys - again we have "default implementations", but users can chose to
84+
provide private keys to RL/LDK in any way they wish following a simple API. We
85+
even support a generic API for signing transactions, allowing users to run
86+
RL/LDK without any private keys in memory/putting private keys only on
87+
hardware wallets.
88+
89+
LDK's customizability was presented about at Advancing Bitcoin in February 2020:
90+
https://vimeo.com/showcase/7131712/video/418412286
91+
3392
Design Goal
3493
-----------
3594

3695
The goal is to provide a full-featured but also incredibly flexible lightning
3796
implementation, allowing the user to decide how they wish to use it. With that
38-
in mind, everything should be exposed via simple, composable APIs. The user
39-
should be able to decide whether they wish to use their own threading/execution
40-
models, allowing usage inside of existing library architectures, or allow us to
41-
handle that for them. Same goes with network connections - if the user wishes
42-
to use their own networking stack, they should be able to do so! This all means
43-
that we should provide simple external interfaces which allow the user to drive
44-
all execution, while implementing sample execution drivers that create a
45-
full-featured lightning daemon by default.
97+
in mind, everything should be exposed via simple, composable APIs. More
98+
information about Rust-Lightning's flexibility is provided in the `About`
99+
section above.
46100

47101
For security reasons, do not add new dependencies. Really do not add new
48102
non-optional/non-test/non-library dependencies. Really really do not add
49103
dependencies with dependencies. Do convince Andrew to cut down dependency usage
50104
in rust-bitcoin.
51105

106+
Rust-Lightning vs. LDK (Lightning Development Kit)
107+
-------------
108+
Rust-Lightning refers to the core `lightning` crate within this repo, whereas
109+
LDK encompasses Rust-Lightning and all of its sample modules and crates (e.g.
110+
the `lightning-persister` crate), language bindings, sample node
111+
implementation(s), and other tools built around using Rust-Lightning for
112+
lightning integration or building a lightning node.
52113

53114
Tagline
54115
-------

0 commit comments

Comments
 (0)