Rust Lightning (LDK) is a highly performant and flexible implementation of the Lightning Network protocol written in Rust. The primary crate, lightning, is runtime-agnostic, allowing for custom implementations of data persistence, chain interactions, and networking.
The Rust Lightning project includes several crates:
lightning: Core of the LDK library, implementing the Lightning protocol, channel state machine, and on-chain logic. Supports no-std and exposes low-level interfaces.
LDK/Rust Lightning allows you to build a Lightning node without needing to handle the complexities of the Lightning state machine, routing, and on-chain punishment code. It provides a clean API for integrating custom features such as chain sync, key management, data storage, and backup logic.
For an out-of-the-box Lightning node based on LDK, see Sensei. LDK provides APIs for:
On-disk storage: Store channel state in any way you want.
Blockchain data: Simple API for block headers and transaction information.
UTXO management: Notifies users when UTXOs are theirs again after channel closure.
Networking: Default implementation using TCP sockets, with flexibility for custom networking solutions.
Private keys: Users can provide private keys to LDK in any way they wish.