Skip to content

Adds Mutiny case study #216

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
merged 2 commits into from
Aug 7, 2023
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
Binary file added docs/.vuepress/public/img/mutiny-featured.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: "Mutiny uses LDK to create the first lightning wallet for the web"
description: "Learn how Mutiny built a lightning wallet for the web"
date: "2023-08-07"
authors:
- Ben Carman
tags:
- Case Studies
---

Mutiny is a new lightning wallet for the web. It is the first self-custodial wallet to run directly in a user's browser. It’s built on top of LDK and [BDK](https://bitcoindevkit.org/), written in Rust, and compiled into WebAssembly. It offers a simple, intuitive interface for sending and receiving payments and other advanced features, such as Nostr Wallet Connect and subscription payments.

We chose to build on LDK and BDK because it wouldn’t have been possible to build a wallet like Mutiny in any other way. Since LDK is written in Rust, we were able to compile it into WebAssembly. Rust's unique combination of type-safety, memory-safety, and efficient runtime performance make it ideally suited to a lightning node that must be reliable, fast, and lightweight enough to run on a mobile phone. LDK's modular design means we can customize it to work within the specific constraints of a web browser. LDK also provides a robust API for building advanced features for our wallet that would otherwise not be possible.

# What we did?

We used LDK to make a crate called mutiny-node which holds all our main wallet logic. Then we used the wasm-bindgencrate to generate JavaScript bindings that can be imported into a regular web project. Thankfully, LDK supports no_std, so compiling it into WebAssembly without any modifications was possible.

Mutiny is a lite-client wallet, meaning it does not run a full bitcoin node. Instead, it gets its blockchain data from an esplora instance. LDK's Filter interface made it easy to implement this, allowing for a simple and efficient way to sync the wallet with the blockchain. [Rapid Gossip Sync](https://docs.rs/lightning-rapid-gossip-sync/0.0.115/) also helps make the wallet sync quickly, and RGS allows us to sync lightning gossip data nearly instantly without spending unnecessary bandwidth and CPU resources.

Local storage can be unreliable in web browsers, so we also want users to be able to recover their wallet in case they lose their device. We implemented the LDK project's [VSS](https://github.com/lightningdevkit/vss-server) specification to give our users encrypted cloud backups to support this.

While we're currently focused on the web, this architecture and the flexibility of LDK means we will be able to share most of our code with a mobile or even server version of Mutiny in the future.

# Results

LDK made building a lightning wallet that runs in the browser possible. Compiling to WebAssembly and LDK's various tools for lite clients allowed us to create an unstoppable, self-custodial wallet that anyone can use without downloading any software. We hope that Mutiny will help bring lightning to the masses, and we are excited to see what the future holds for LDK and lightning on the web.

You can learn more and try it out at [mutinywallet.com](https://www.mutinywallet.com/).
20 changes: 10 additions & 10 deletions docs/case-studies.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ description: "A list of bitcoin applications and services building with LDK"
actionText: "Add your project"
actionLink: "https://github.com/orgs/lightningdevkit/discussions/1554"
features:
- title: "The Eye of Satoshi"
details: "A watchtower with a specific focus on Lightning"
image: "/img/teos-main.png"
imageAlt: ""
caseStudyLink: "/blog/teos-uses-ldk-to-build-open-source-watchtower/"
- title: "Mutiny"
details: "A self-custodial lightning wallet that runs in the browser"
image: "/img/mutiny-featured.png"
imageAlt: "mutiny logo"
caseStudyLink: "/blog/mutiny-uses-ldk-the-first-lightning-wallet-for-the-web/"
- title: "Cash App"
details: "Send and spend, bank, and buy stocks or bitcoin "
image: "/img/cash-app-logo.png"
imageAlt: "cash app logo"
caseStudyLink: "/blog/cashapp-enables-lightning-withdrawals-and-deposits-using-ldk/"
- title: "Sensei"
details: "A Lightning node implementation for everyone"
image: "/img/sensei-main.png"
imageAlt: "sensei logo"
caseStudyLink: "/blog/sensei-uses-ldk-to-build-a-multi-node-lightning-server-application/"
- title: "The Eye of Satoshi"
details: "A watchtower with a specific focus on Lightning"
image: "/img/teos-main.png"
imageAlt: ""
caseStudyLink: "/blog/teos-uses-ldk-to-build-open-source-watchtower/"
editLink: false
lastUpdated: false
---
Expand Down