Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Lightspark case study #291

Merged
merged 4 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/_blog/how-we-built-our-sparknodes-using-ldk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "How we built our Sparknodes using LDK"
description: "Learn how Lightspark used LDK to build their Lightning Network infrastructure"
date: "2025-02-04"
authors:
- Lightspark Engineering
tags:
- Case-Studies
---

When we started building Lightspark's Lightning Network infrastructure, we needed an architecture that could scale as customer demand grew. Our system needed to be flexible and capable of scaling with the growth.

After evaluating various Lightning implementations, we chose Lightning Development Kit (LDK) for two key reasons: its unique ability to manage multiple nodes in a single process and its customizability, which later allowed us to build our remote signing functionality.

# Implementation Journey

Our primary technical requirement was the ability to run multiple Lightning Nodes as efficiently as possible to enable us to scale to customer demand. Traditional Lightning implementations require each node to run in its own process, which would have made scaling to thousands or millions of nodes complicated. LDK's flexible architecture allowed us to optimize system resources in ways that weren't possible with other implementations.

We designed our system to share resources when handling common operations. For example, instead of having each node individually query bitcoind for updates, we implemented a single observer process that polls bitcoind for block updates and fee estimates, then updates all nodes while caching results in memory. This pattern was applied to other aspects of our nodes, such as how we sync the network graph for routing payments. This architectural choice significantly reduced system overhead and improved performance.

# Flexibility and Customization

LDK offers several APIs, allowing developers to implement their own custom signing behavior. This was crucial to support remote signing, where the Lightning Node runs on Lightspark infrastructure while the keys never leave the customer’s infrastructure. With help from the LDK team, we’ve been able to upstream most of the asynchronous signing functionality, reducing our own maintenance burden and making it available for all LDK users.

We store all node and channel data in our database in a way that's agnostic to any specific Lightning implementation, giving us the flexibility to adapt our architecture as needed. LDK's extensive APIs for various events, messages, and updates made it straightforward to integrate into our existing services while maintaining implementation flexibility. With other implementations, we need to patch on external jobs or maintain changes on a fork, whereas it was easy to hook LDK into our existing services with what was provided out of the box.

# Evolution and Current Status

While our initial vision focused on scaling to millions of non-custodial nodes, our design needs have evolved. We have pivoted to focus on remote signing capabilities, where LDK's flexible interface gave us a head start and enabled us to build precisely the architecture we needed for customers like Coinbase. Today, our infrastructure uses both LND and LDK nodes, each serving different purposes, and we continue to onboard additional customers as we scale our services.
6 changes: 6 additions & 0 deletions docs/case-studies.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,9 @@ lastUpdated: false
<a href="https://www.lightspark.com/" target="_blank"> <img src="./assets/lightspark.png" /></a>
<h3><a href="https://www.lightspark.com/" target="_blank">Lightspark</a></h3>
<p>Enterprise-grade, fast, secure payments on Lightning</p>
<a href="/blog/how-we-built-our-sparknodes-using-ldk/" class="nav-link nav-link">
View case study
</a>
</div>
<div class="case-study-item">
<a href="https://www.lqwdtech.com/" target="_blank"> <img src="./assets/lqwd.png" /></a>
Expand Down Expand Up @@ -334,6 +337,9 @@ lastUpdated: false
<a href="https://www.lightspark.com/" target="_blank"> <img src="./assets/lightspark.png" /></a>
<h3><a href="https://www.lightspark.com/" target="_blank">Lightspark</a></h3>
<p>Enterprise-grade, fast, secure payments on Lightning</p>
<a href="/blog/how-we-built-our-sparknodes-using-ldk/" class="nav-link nav-link">
View case study
</a>
</div>
<div class="case-study-item">
<a href="https://github.com/lndk-org/lndk" target="_blank"><img src="./assets/lndk.png" /></a>
Expand Down
Loading