MCPcopy Index your code
hub / github.com/bitcoindevkit/bdk-ffi

github.com/bitcoindevkit/bdk-ffi @v3.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v3.0.0 ↗ · + Follow
544 symbols 1,079 edges 33 files 210 documented · 39%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Language Bindings for BDK

MIT or Apache-2.0 Licensed Chat on Discord

The code in this repository creates a library ready for export to other languages using uniffi-rs for the Rust-based bdk_wallet library from the Bitcoin Dev Kit project.

Each supported language (Kotlin for Android and Swift for iOS) and the platforms it's packaged for has its own directory. The Rust code in this project is in the bdk-ffi directory and is a wrapper around the bdk_wallet library to expose its APIs in a uniform way using the mozilla/uniffi-rs bindings generator for each supported target language.

Supported target languages and platforms

The below directories include instructions for building and using the language binding for bdk_wallet supported by this project.

Language Platform Published Package Building Documentation API Docs
Kotlin Android bdk-android Readme bdk-android Android API Docs
Swift iOS, macOS bdk-swift Readme bdk-swift

Other supported languages maintained in separate repositories

The bdk-ffi codebase in this repository can be used to produce language bindings for more than Swift and Kotlin. Some of these require the use of uniffi 3rd party plugins and some not. Below are some of the libraries that use the bdk-ffi API, but are maintained separately. Refer to their individual READMEs for information on their state of production-readiness.

Language Platform Published Package Repository API Docs
Kotlin JVM bdk-jvm (Maven Central) bdk-jvm
Python Linux, macOS, Windows bdk-python (PyPI) bdk-python

Building and testing the libraries

If you are familiar with the build tools for the specific languages you wish to build the libraries for, you can use their normal build/test workflows. We also include some just files to simplify the work across different languages. If you have the just tool installed on your system, you can simply call the commands defined in the justfiles, for example:

cd bdk-android
just build
just test
just publish-local

Contributing

To add new structs and functions, see the UniFFI User Guide and the uniffi-examples repository.

Goals

  1. Language bindings should feel idiomatic in target languages/platforms
  2. Adding new targets should be easy
  3. Getting up and running should be easy
  4. Contributing should be easy
  5. Get it right, then automate

Verifying Signatures

Both libraries and all their corresponding artifacts are signed with a PGP key you can find in the root of this repository. To verify the signatures follow the below steps:

  1. Import the PGP key in your keyring.
# Navigate to the root of the repository and import the ./PGP-BDK-BINDINGS.asc public key
gpg --import ./PGP-BDK-BINDINGS.asc

# Alternatively, you can import the key directly from a public key server
gpg --keyserver keyserver.ubuntu.com --receive-key 2768C43E8803C6A3

# Verify that the correct key was imported
gpg --list-keys
# You should see the below output
pub   ed25519 2022-08-31 [SC]
    88AD93AC4589FD090FF3B8D12768C43E8803C6A3
uid           [ unknown] bitcoindevkit-bindings <bindings@bitcoindevkit.org>
sub   cv25519 2022-08-31 [E]
  1. Download the binary artifacts and corresponding signature files.
  2. from bdk-jvm
    • bdk-jvm-<version>.jar
    • bdk-jvm-<version>.jar.asc
  3. from bdk-android

    • bdk-android-<version>.aar
    • bdk-android-<version>.aar.asc
  4. Verify the signatures.

gpg --verify bdk-jvm-<version>.jar.asc
gpg --verify bdk-android-<version>.aar.asc

# you should see a "Good signature" result
gpg: Good signature from "bitcoindevkit-bindings <bindings@bitcoindevkit.org>" [unknown]

PGP Metadata

Full key ID: 88AD 93AC 4589 FD09 0FF3 B8D1 2768 C43E 8803 C6A3 Fingerprint: 2768C43E8803C6A3 Name: bitcoindevkit-bindings Email: bindings@bitcoindevkit.org

Thanks

This project is made possible thanks to the wonderful work by the mozilla/uniffi-rs team.

Extension points exported contracts — how you extend this code

FullScanScriptInspector (Interface)
(no doc) [1 implementers]
bdk-ffi/src/types.rs
DisplayExt (Interface)
(no doc) [1 implementers]
bdk-ffi/src/kyoto.rs
SyncScriptInspector (Interface)
(no doc)
bdk-ffi/src/types.rs
Persistence (Interface)
(no doc)
bdk-ffi/src/store.rs

Core symbols most depended-on inside this repo

get_wallet
called by 51
bdk-ffi/src/wallet.rs
derive
called by 13
bdk-ffi/src/keys.rs
build
called by 12
bdk-ffi/src/types.rs
as_public
called by 11
bdk-ffi/src/keys.rs
policy_path
called by 10
bdk-ffi/src/tx_builder.rs
add_recipient
called by 9
bdk-ffi/src/tx_builder.rs
script_pubkey
called by 8
bdk-ffi/src/bitcoin.rs
next_unused_address
called by 7
bdk-ffi/src/wallet.rs

Shape

Method 326
Class 93
Function 70
Enum 51
Interface 4

Languages

Rust90%
Kotlin10%

Modules by API surface

bdk-ffi/src/bitcoin.rs89 symbols
bdk-ffi/src/types.rs72 symbols
bdk-ffi/src/wallet.rs55 symbols
bdk-ffi/src/tx_builder.rs37 symbols
bdk-ffi/src/kyoto.rs37 symbols
bdk-ffi/src/error.rs31 symbols
bdk-ffi/src/descriptor.rs31 symbols
bdk-ffi/src/keys.rs21 symbols
bdk-ffi/src/esplora.rs19 symbols
bdk-ffi/src/electrum.rs18 symbols
bdk-ffi/src/tests/keys.rs15 symbols
bdk-ffi/src/tests/bitcoin.rs15 symbols

For agents

$ claude mcp add bdk-ffi \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page