The Breez SDK enables mobile developers to integrate Lightning and bitcoin payments into their apps with a very shallow learning curve. The use cases are endless – from social apps that want to integrate tipping between users to content-creation apps interested in adding bitcoin monetization. Crucially, this SDK is an end-to-end, non-custodial, drop-in solution powered by Greenlight, a built-in LSP, on-chain interoperability, third-party fiat on-ramps, and other services users and operators need.
The Breez SDK provides the following services:
- Sending payments (via various protocols such as: bolt11, keysend, lnurl-pay, lightning address, btc address, etc.)
- Receiving payments (via various protocols such as: bolt11, lnurl-withdraw, btc address, etc.)
- Fetching node status (e.g. balance, max allow to pay, max allow to receive, on-chain balance, etc.)
- Connecting to a new or existing node.
Connecting to a node requires a seed (your master key). The seed is a bip39 mnemonic.
The Breez SDK is free for developers.
Before you start, you will need an API Key to use the SDK, as well as an Invite Code when you create a new node.
To get both of them, please contact Breez via email at contact@breez.technology or at https://breez.technology/#contact-us-form
Join this telegram group or email us at contact@breez.technology.
Breez SDK is available in several platforms. Follow the Installing page for instructions on how to install on your platform.
The first step is to construct the SDK configuration. In it the environment and Greenlight node configuration is defined, whether you are using an invite code or partner credentials.
The SDK uses the config working directory to store the state of the SDK instance. Once a connection has been established with a node, the working directory can only be used for that node. When handling multiple instances of the SDK, one per node, each needs to have a different working directory defined.
Now you are ready to interact with the SDK.
{{#include ../../snippets/rust/src/getting_started.rs:init-sdk}}
{{#include ../../snippets/swift/BreezSDKExamples/Sources/GettingStarted.swift:init-sdk}}
{{#include ../../snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/GettingStarted.kt:init-sdk}}
{{#include ../../snippets/react-native/getting_started.ts:init-sdk}}
{{#include ../../snippets/dart_snippets/lib/getting_started.dart:init-sdk}}
{{#include ../../snippets/python/src/getting_started.py:init-sdk}}
{{#include ../../snippets/go/getting_started.go:init-sdk}}
{{#include ../../snippets/csharp/GettingStarted.cs:init-sdk}}
By default the config working directory is set to ./
. Some platforms may require that you use an application specific directory that is writable within the application sandbox. For example applications running on Android or iOS.
At any point we can fetch our balance from the Greenlight node:
{{#include ../../snippets/rust/src/getting_started.rs:fetch-balance}}
{{#include ../../snippets/swift/BreezSDKExamples/Sources/GettingStarted.swift:fetch-balance}}
{{#include ../../snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/GettingStarted.kt:fetch-balance}}
{{#include ../../snippets/react-native/getting_started.ts:fetch-balance}}
{{#include ../../snippets/dart_snippets/lib/getting_started.dart:fetch-balance}}
{{#include ../../snippets/python/src/getting_started.py:fetch-balance}}
{{#include ../../snippets/go/getting_started.go:fetch-balance}}
{{#include ../../snippets/csharp/GettingStarted.cs:fetch-balance}}
You are now ready to receive a Lightning payment.