Skip to content

Latest commit

 

History

History
187 lines (128 loc) · 5 KB

getting_started.md

File metadata and controls

187 lines (128 loc) · 5 KB

Getting started

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.

Pricing

The Breez SDK is free for developers.

API Key and Invite Code

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

Support

Join this telegram group or email us at contact@breez.technology.

Installing

Breez SDK is available in several platforms. Follow the Installing page for instructions on how to install on your platform.

Connecting

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.

Rust
{{#include ../../snippets/rust/src/getting_started.rs:init-sdk}}
Swift
{{#include ../../snippets/swift/BreezSDKExamples/Sources/GettingStarted.swift:init-sdk}}
Kotlin
{{#include ../../snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/GettingStarted.kt:init-sdk}}
React Native
{{#include ../../snippets/react-native/getting_started.ts:init-sdk}}
Dart
{{#include ../../snippets/dart_snippets/lib/getting_started.dart:init-sdk}}
Python
{{#include ../../snippets/python/src/getting_started.py:init-sdk}}
Go
{{#include ../../snippets/go/getting_started.go:init-sdk}}
C#
{{#include ../../snippets/csharp/GettingStarted.cs:init-sdk}}

Developer note

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.

Getting the Node State

At any point we can fetch our balance from the Greenlight node:

Rust
{{#include ../../snippets/rust/src/getting_started.rs:fetch-balance}}
Swift
{{#include ../../snippets/swift/BreezSDKExamples/Sources/GettingStarted.swift:fetch-balance}}
Kotlin
{{#include ../../snippets/kotlin_mpp_lib/shared/src/commonMain/kotlin/com/example/kotlinmpplib/GettingStarted.kt:fetch-balance}}
React Native
{{#include ../../snippets/react-native/getting_started.ts:fetch-balance}}
Dart
{{#include ../../snippets/dart_snippets/lib/getting_started.dart:fetch-balance}}
Python
{{#include ../../snippets/python/src/getting_started.py:fetch-balance}}
Go
{{#include ../../snippets/go/getting_started.go:fetch-balance}}
C#
{{#include ../../snippets/csharp/GettingStarted.cs:fetch-balance}}

You are now ready to receive a Lightning payment.