Skip to content

Commit 4a36442

Browse files
committed
Document selectable crate features
List each chain, storage, payment, and binding feature and explain the unchanged native defaults. Show both lean and custom binding builds so optional backend dependencies can be selected deliberately. Co-Authored-By: HAL 9000
1 parent 499238e commit 4a36442

1 file changed

Lines changed: 51 additions & 1 deletion

File tree

README.md

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,60 @@ LDK Node currently comes with a decidedly opinionated set of design choices:
6464

6565
- On-chain data is handled by the integrated [BDK][bdk] wallet.
6666
- Chain data may currently be sourced from the Bitcoin Core RPC interface, or from an [Electrum][electrum] or [Esplora][esplora] server.
67-
- Wallet and channel state may be persisted to an [SQLite][sqlite] or [PostgreSQL][postgresql] database, to file system, or to a custom back-end to be implemented by the user.
67+
- Wallet and channel state may be persisted to an [SQLite][sqlite] or [PostgreSQL][postgresql] database, to the filesystem, to a VSS server, or to a custom back-end to be implemented by the user.
6868
- Gossip data may be sourced via Lightning's peer-to-peer network or the [Rapid Gossip Sync](https://docs.rs/lightning-rapid-gossip-sync/*/lightning_rapid_gossip_sync/) protocol.
6969
- Entropy for the Lightning and on-chain wallets may be sourced from raw bytes or a [BIP39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki) mnemonic. In addition, LDK Node offers the means to generate and persist the entropy bytes to disk.
7070

71+
### Cargo Features
72+
73+
LDK Node's optional dependencies are grouped by the functionality they provide:
74+
75+
| Feature | Functionality |
76+
| --- | --- |
77+
| `chain-esplora` | Esplora chain source |
78+
| `chain-electrum` | Electrum chain source |
79+
| `chain-bitcoind` | Bitcoin Core RPC and REST chain source |
80+
| `storage-sqlite` | SQLite storage |
81+
| `storage-filesystem` | Filesystem storage |
82+
| `storage-vss` | Versioned Storage Service storage |
83+
| `storage-postgres` | PostgreSQL storage |
84+
| `unified-payments` | BIP 21 and human-readable-name payment support |
85+
| `uniffi` | UniFFI language bindings |
86+
| `uniffi-default` | The standard language-binding feature set |
87+
88+
The `default` feature set preserves the native Rust API's previous behavior. It enables all three
89+
chain sources, SQLite, filesystem and VSS storage, and unified payments. PostgreSQL and UniFFI
90+
remain opt-in. Every build must enable at least one chain source feature.
91+
92+
Disable the default features to select only the functionality and dependencies an application
93+
needs. For example:
94+
95+
```shell
96+
cargo build --no-default-features --features chain-esplora,storage-sqlite
97+
```
98+
99+
`uniffi-default` enables UniFFI, Esplora, Electrum, SQLite, VSS, and unified payments. It excludes
100+
Bitcoin Core, filesystem storage, and PostgreSQL. Binding users can add any of those features:
101+
102+
```shell
103+
cargo build --no-default-features --features uniffi-default,chain-bitcoind
104+
```
105+
106+
Use `uniffi` directly instead of `uniffi-default` to assemble a fully custom binding build. For
107+
example, a Bitcoin Core and PostgreSQL-only binding build uses:
108+
109+
```shell
110+
cargo build --no-default-features --features uniffi,chain-bitcoind,storage-postgres
111+
```
112+
113+
The binding generation scripts use `uniffi-default`. Set `LDK_NODE_EXTRA_FEATURES` to add features
114+
to their builds:
115+
116+
```shell
117+
LDK_NODE_EXTRA_FEATURES=chain-bitcoind,storage-postgres \
118+
./scripts/uniffi_bindgen_generate_python.sh
119+
```
120+
71121
## Compatibility
72122

73123
LDK Node does not provide a stable public API until v1.0. Persisted node state is backwards compatible: newer releases are guaranteed to load state written by older releases. Downgrades are not supported, so state written by a newer release may not load with an older release.

0 commit comments

Comments
 (0)