bdk_flutter 0.2.1 copy "bdk_flutter: ^0.2.1" to clipboard
bdk_flutter: ^0.2.1 copied to clipboard

A Flutter library for the Bitcoin Development Kit(bdk) (https://bitcoindevkit.org/)

Bdk Flutter #

A Flutter library for the Bitcoin Development Kit. The bdk library aims to be the core building block for Bitcoin Applications of any kind.

Requirements #

  • Flutter : 3.0 or higher
  • Android minSdkVersion. : API 23 or higher.
  • Deployment target : iOS 12.0 or greater.

How to Use #

To use the bdk_flutter package in your project, add it as a dependency in your project's pubspec.yaml:

dependencies:
  bdk_flutter: ^0.2.1

bdk-flutter can then be imported and used in your Flutter code. For example:

import 'package:bdk_flutter/bdk_flutter.dart';

// ....

final externalDescriptor = "wpkh([b8b575c2/84'/1'/0'/0]tprv8icWtRzy9CWgFxpGMLSdAeE4wWyz39XGc6SwykeTo13tYm14JkVVQAf7jz8DDarCgNJrG3aEPJEqchDWeJdiaWpS3FwbLB9SzsN57V7qxB/*)"
final internalDescriptor = "wpkh([b8b575c2/84'/1'/0'/1]tprv8icWtRzy9CWgFxpGMLSdAeE4wWyz39XGc6SwykeTo13tYm14JkVVQAf7jz8DDarCgNJrG3aEPJEqchDWeJdiaWpS3FwbLB9SzsN57V7qxB/*)"

  final blockchain  = await Blockchain.create(
                            config: BlockchainConfig.electrum(
                                config: ElectrumConfig(
                                    stopGap: 10,
                                    timeout: 5,
                                    retry: 5,
                                    url: "ssl://electrum.blockstream.info:60002")));
  final wallet      = await Wallet.create( externalDescriptor, internalDescriptor, Network.TESTNET, databaseConfig: const DatabaseConfig.memory());
  final addressInfo = await wallet.getAddress(addressIndex: AddressIndex.New);
                      await wallet.sync(blockchain);

API Documentation #

The latest API documentation is available here

Example Projects #

  • *BDK Flutter Demo App: The BDK Flutter Demo App is a simple bitcoin app built in flutter to serve as a reference app to demonstrate bdk-flutter api usage.

How to build #

Note that Flutter version 3.0 or later is required to build the plugin.

  1. Install Rust and Cargo The easiest way to get Cargo is to install the current stable release of Rust by using rustup. Installing Rust using rustup will also install cargo.

  2. Clone this repository

    git clone https://github.com/LtbLightning/bdk-flutter.git
    
  3. Activate dart ffigen

    dart pub global activate ffigen
    
  4. Android Setup

  • The Android NDK, or Native Development Kit, enables code written in other languages to be run on the JVM via the Java Native Interface, or JNI for short. After following the instructions above, the NDK should be installed in your $ANDROID_SDK_HOME/ndk folder, where ANDROID_SDK_HOME usually is:
    Windows: %APPDATA%\Local\Android\sdk
    MacOS: ~/Library/Android/sdk

    An issue regarding building Rust's core library against the latest NDK means that as of writing only NDK versions 22 and older can be used.

    You can alternatively use the latest version of the Android NDK which is greater than 22. However, this requires a hack to prevent the unable to find library -lgcc error.

  1. Build flutter bindings Navigate to rust directory, and run the following commands
    cargo build
    make all
    

Generating Docs Manually (Optional) #

Please use the Dart documentation generator to generate the API documentation.

Note: Caution this is pre-Alpha at this stage Please consider reviewing, experimenting, and contributing ⚡️

Thanks for taking a look!

33
likes
0
pub points
86%
popularity

Publisher

verified publisherltbl.io

A Flutter library for the Bitcoin Development Kit(bdk) (https://bitcoindevkit.org/)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

ffi, flutter, flutter_rust_bridge, freezed, freezed_annotation, meta, mockito

More

Packages that depend on bdk_flutter