MCPcopy Index your code
hub / github.com/breez/spark-sdk

github.com/breez/spark-sdk @0.17.1

Chat with this repo
repository ↗ · DeepWiki ↗ · release 0.17.1 ↗ · + Follow
9,531 symbols 26,637 edges 854 files 1,733 documented · 18%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Breez SDK - Spark

Overview

The Breez SDK provides developers with an end-to-end solution for integrating instant, non-custodial bitcoin into their apps and services. It eliminates the need for third parties, simplifies the complexities of Bitcoin and Lightning, and enables seamless onboarding for billions of users to the future of value transfer.

The Breez SDK is free for developers.

What is the Breez SDK - Spark?

It’s a nodeless integration that offers a non-custodial, end-to-end solution for integrating bitcoin, utilizing the Bitcoin-native Layer 2 Lightning & Spark, with on-chain interoperability. Using the Breez SDK, you’ll be able to:

  • Send payments via various protocols such as: Lightning address, LNURL-Pay, Bolt11, BTC address, Spark address
  • Receive payments via various protocols such as: Lightning address, LNURL-Pay, Bolt11, BTC address

Key Features - [x] Send and receive Lightning payments - [x] Send and receive via LNURL-pay & Lightning addresses - [x] Send and receive Spark payments (BTC) - [x] Passkey login for seedless experience - [x] Stable Balance - hold your balance in USD - [x] Issue, send and receive Spark tokens (BTKN) - [x] On-chain interoperability - [x] Convert Spark tokens (BTKN) to bitcoin and vice versa - [x] Bindings to all popular languages & frameworks - [x] Keys are only held by users - [x] Multi-app & multi-device support via real-time sync service - [x] Payments persistency including restore support - [x] Automatic claims - [x] WebAssembly support - [x] Compatible with external signers - [x] Multi-user server mode - [x] Free open-source solution

Getting Started

Head over to the Breez SDK documentation to start implementing bitcoin in your app.

You'll need an API key to use the Breez SDK. To request an API key is free - you just need to complete this simple form.

API

API documentation is here.

Command Line

The Breez SDK - Spark cli is a command line client that allows you to interact with and test the functionality of the SDK.

Demo

Looking for a quick way to try the Breez SDK in the browser or as PWA? Check out our demo app Glow:

Note: The demo is for demonstration purposes only and not intended for production use.

Example Apps

The repository includes full working CLI example apps for every supported language, demonstrating end-to-end SDK usage.

Language CLI Example App
Rust crates/breez-sdk/cli
JavaScript/TypeScript cli/langs/wasm, glow-web
Swift cli/langs/swift
Kotlin cli/langs/kotlin-multiplatform
Flutter/Dart cli/langs/flutter
Python cli/langs/python
Go cli/langs/golang
React Native cli/langs/react-native
C# cli/langs/csharp

Support

Have a question for the team? Join our Telegram channel or email us at contact@breez.technology

How does the Breez SDK - Spark work?

The Breez SDK uses Spark, a Bitcoin-native Layer 2 built on a shared signing protocol, to enable real-time, low-fee, self-custodial payments.

When sending a payment, Spark delegates the transfer of on-chain bitcoin to the recipient through a multi-signature process. Spark Operators help facilitate the transfer, but they cannot move funds without the user. This allows the payment to settle almost instantly, without requiring a blockchain confirmation.

When receiving a payment, the same process works in reverse: the network updates ownership of the bitcoin to the user through the shared signing system, recording the change off-chain while always keeping the funds secure.

Unlike blockchains, rollups, or smart contracts, Spark doesn’t create a new ledger or require trust in external consensus. On Bitcoin’s main chain, Spark transactions appear as a series of multi-sig wallets. Off-chain, Spark keeps a lightweight record of balances and history.

Funds are non-custodial: you can exit Spark at any time and reclaim your bitcoin directly on the Bitcoin main chain.

Build & Test

  • crates: Contains the root Rust cargo workspace.
    • breez-sdk: Collection of Breez SDK crates.
      • bindings: The FFI bindings for Go, Kotlin, Python, React Native, and Swift.
      • cli: Contains the Rust command line interface client for the SDK.
      • common: The common Breez SDK Rust library.
      • core: The core Breez SDK Rust library.
      • wasm: The Wasm interface bindings.
    • spark: The Spark crate.
  • packages: Contains the packages for Flutter, React Native and Wasm.

Contributing

Contributions are always welcome. Please read our contribution guide to get started.

SDK Development Roadmap

  • [x] Send/Receive Lightning payments
  • [x] Send/Receive Spark payments
  • [x] Send/Receive via on-chain addresses
  • [x] CLI Interface
  • [x] Go, C#, React Native, Python, JS, Flutter, Kotlin & Swift languages bindings
  • [x] WebAssembly support
  • [x] Send via LNURL-Pay
  • [x] Send to a Lightning address
  • [x] Payments persistency including restore support
  • [x] Automatic on-chain claims
  • [x] Receive via LNURL-Pay w/ offline & Lightning address support
  • [x] Full support (issue, send & receive) for Spark tokens (BTKN)
  • [x] LNURL-Withdraw
  • [x] Sign and verify arbitrary messages
  • [x] Real-time sync
  • [x] External input parsers
  • [x] External signer
  • [x] LNURL-Auth
  • [x] Fiat on-ramp
  • [x] BTC <> USDB swaps
  • [x] Hodl invoice support
  • [x] Passkey login for seedless experience
  • [x] Contacts management
  • [x] Stable balance
  • [x] Multi-user server mode
  • [ ] USDT send support
  • [ ] USDC send support
  • [ ] USDT receive support
  • [ ] USDC receive support
  • [ ] NWC
  • [ ] Bolt12
  • [ ] Add additional fees via a dedicated portal

Extension points exported contracts — how you extend this code

EventListener (Interface)
(no doc) [14 implementers]
crates/breez-sdk/core/src/events.rs
HeaderProvider (Interface)
(no doc) [5 implementers]
crates/spark/src/header_provider.rs
HttpClient (Interface)
(no doc) [4 implementers]
crates/platform-utils/src/http/mod.rs
BigInt (Interface)
(no doc) [1 implementers]
packages/wasm/examples/node/src/global.d.ts
Spec (Interface)
(no doc) [1 implementers]
packages/react-native/src/NativeBreezSdkSparkReactNative.ts
OrchestraConfigResolver (Interface)
(no doc) [1 implementers]
crates/flashnet/src/orchestra/client.rs
SessionStore (Interface)
(no doc) [6 implementers]
crates/breez-sdk/core/src/session_store/mod.rs
LeafLike (Interface)
Minimal "leaf-shaped" interface used by the selection algorithms in [`select_helper`]. Implementing this for a slim `(id [3 …
crates/spark/src/tree/mod.rs

Core symbols most depended-on inside this repo

clone
called by 1782
crates/breez-sdk/lnurl/src/state.rs
map
called by 1040
crates/spark/src/utils/paging.rs
get
called by 491
crates/breez-sdk/core/src/cross_chain/mod.rs
to_vec
called by 279
crates/spark/src/services/models.rs
log
called by 265
docs/breez-sdk/snippets/python/src/getting_started.py
is_empty
called by 255
crates/spark/src/utils/paging.rs
as_ref
called by 248
crates/spark/src/services/models.rs
len
called by 244
crates/spark/src/utils/paging.rs

Shape

Function 4,200
Method 3,257
Class 1,644
Enum 356
Interface 57
Struct 14
TypeAlias 2
Route 1

Languages

Rust74%
TypeScript12%
Kotlin5%
Python3%
C#3%
Go3%

Modules by API surface

packages/flutter/rust/src/models.rs199 symbols
crates/breez-sdk/wasm/src/models/mod.rs192 symbols
crates/breez-sdk/core/src/models/mod.rs128 symbols
crates/spark-mysql/src/tree_store.rs119 symbols
crates/spark-wallet/src/wallet.rs103 symbols
crates/spark-postgres/src/tree_store.rs103 symbols
docs/breez-sdk/theme/highlight.js100 symbols
crates/breez-sdk/lnurl/src/routes.rs91 symbols
crates/spark-mysql/src/token_store.rs90 symbols
crates/spark/src/tree/store.rs82 symbols
crates/breez-sdk/core/src/persist/mysql/storage.rs82 symbols
crates/breez-sdk/core/src/realtime_sync/storage.rs78 symbols

Datastores touched

(mysql)Database · 1 repos
dbnameDatabase · 1 repos
dbnameDatabase · 1 repos
sparkDatabase · 1 repos
lnurl_testDatabase · 1 repos
postgresDatabase · 1 repos
breez_benchDatabase · 1 repos
dbDatabase · 1 repos

For agents

$ claude mcp add spark-sdk \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page