Skip to content
MusabYKPublic

About

Experimental project to integrate silent payments in bdk-ffi/bdk-dart

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

sp_dart

An experimental library to research the implementation of silent payments (BIP-352) in bdk-ffi and bdk_dart



Repository layout

Path Purpose
native/ Rust sources and uniffi-dart build scripts and configs wrapping the underlying bdk-ffi crate to be used by the Dart build hook.
lib/ Dart bindings (bdk.dart) generated by UniFFI-Dart.
example/ Standalone Dart example to showcase, test and play with the bindings.
test/ Offline/construction/persistence tests (not full integration tests).
sp_demo/ Flutter sample app you can point at mobile targets once the bindings are built.
scripts/generate_bindings.sh Helper used to rebuild the native library and regenerate the Dart bindings.

Prerequisites

To use this package you need:

  • Dart SDK >= 3.10 or newer (see pubspec.yaml).
  • Rust toolchain with cargo and the native targets you intend to build. You can install Rust via rustup.
  • Flutter SDK if you plan to use the package in a Flutter app or run the Flutter demo.

Supported targets

See SUPPORTED_TARGETS.md for the current platform/architecture matrix and support status.

Add to your project

Via git:

dependencies:
  sp_dart:
    git:
      url: https://github.com/MusabYK/sp-dart.git
      ref: main # or specific tag

Import the package entrypoint:

import 'package:sp_dart/sp_dart.dart';

Usage

Check out the example in example/main.dart for a walkthrough of how to use the bindings to:

  1. Create a new mnemonic and derive BIP84 descriptors.
  2. Instantiate a wallet backed by the in-memory persister.
  3. Reveal addresses and persist staged changes.
  4. Optionally sync with Electrum over TLS.

Run it with:

dart run example/main.dart

If you have the Rust toolchain installed, the native library will be automatically built by Dart's Native Assets system. As a user of the package, you don't need to worry about building the native library or bindings yourself. Only if you want to contribute to the bindings or modify the native code yourself, you can follow the instructions in development below. The first build can take several minutes depending on your machine and network (subsequent builds are faster). We pin git dependencies to immutable refs for reproducibility. bdk-ffi and uniffi-dart both track upstream release tags.

Generating bindings

  1. Modify the native Rust code and configuration files in native/ as needed.

  2. Run the bindings generator script:

    just generate-bindings

License

This experimental integration workspace is licensed under the MIT License.

About

Experimental project to integrate silent payments in bdk-ffi/bdk-dart

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages