Skip to content

Commit 7f339e5

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 54e8c15 commit 7f339e5

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
@@ -63,10 +63,60 @@ LDK Node currently comes with a decidedly opinionated set of design choices:
6363

6464
- On-chain data is handled by the integrated [BDK][bdk] wallet.
6565
- Chain data may currently be sourced from the Bitcoin Core RPC interface, or from an [Electrum][electrum] or [Esplora][esplora] server.
66-
- 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.
66+
- 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.
6767
- 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.
6868
- 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.
6969

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

72122
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)