Skip to content

Building a Node with LDK

Learn how to build a basic LDK node from scratch

Note

For an integrated example of an LDK node in Rust, see the Sample Node

The following tutorials will show you how to build the simplest lightning node using LDK, that fufills the following tasks:

  1. Connecting to Peers
  2. Opening Channels
  3. Sending Payments
  4. Receiving Payments
  5. Closing Channels

Foundational Components

Let's start by looking at the core components we'll need to make this node work for the tasks we outlined above.

  1. A ChannelManager, to open and close channels.
  2. A networking stack (https://docs.rs/lightning-net-tokio/*/lightning_net_tokio/index.html), for establishing TCP/IP connections to other nodes on the lightning network.
  3. Payments & routing, ability to create and pay invoices.

To make the above work we also need to setup a series of supporting modules, including:

  1. A FeeEstimator
  2. A Logger
  3. A Transaction Broadcaster
  4. A NetworkGraph
  5. A Persister
  6. An EventHandler
  7. A Transaction Filter
  8. A ChainMonitor
  9. A KeysManager
  10. A Scorer