-
Notifications
You must be signed in to change notification settings - Fork 47
Adds Lightspark case study #291
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
Merged
ConorOkus
merged 4 commits into
lightningdevkit:main
from
ConorOkus:lightspark-case-study
Feb 4, 2025
+35
−0
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
docs/_blog/how-we-built-our-sparknodes-using-ldk.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.