2.6 KiB
bdk-jvm
This project builds a .jar package for the JVM platform that provides Kotlin language bindings for the bdk
library. The Kotlin language bindings are created by the bdk-ffi
project which is included in the root of this repository.
How to Use
To use the Kotlin language bindings for bdk
in your JVM project add the following to your gradle dependencies:
repositories {
mavenCentral()
}
dependencies {
implementation("org.bitcoindevkit:bdk-jvm:<version>")
}
Snapshot releases
To use a snapshot release, specify the snapshot repository url in the repositories
block and use the snapshot version in the dependencies
block:
repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
implementation("org.bitcoindevkit:bdk-jvm:<version-SNAPSHOT>")
}
Example Projects
How to build
Note that Kotlin version 1.9.23
or later is required to build the library.
- Install JDK 17. For example, with SDKMAN!:
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk install java 17.0.2-tem
- Install Rust (note that we are currently building using Rust 1.77.1):
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup default 1.77.1
- Clone this repository.
git clone https://github.com/bitcoindevkit/bdk-ffi
- If building on macOS install required intel and m1 jvm targets
rustup target add x86_64-apple-darwin aarch64-apple-darwin
- Build kotlin bindings
./gradlew buildJvmLib
How to publish to your local Maven repo
cd bdk-jvm
./gradlew publishToMavenLocal -P localBuild
Note that the commands assume you don't need the local libraries to be signed. If you do wish to sign them, simply set your ~/.gradle/gradle.properties
signing key values like so:
signing.gnupg.keyName=<YOUR_GNUPG_ID>
signing.gnupg.passphrase=<YOUR_GNUPG_PASSPHRASE>
and use the publishToMavenLocal
task without the localBuild
flag:
./gradlew publishToMavenLocal
Known issues
JNA dependency
Depending on the JVM version you use, you might not have the JNA dependency on your classpath. The exception thrown will be
class file for com.sun.jna.Pointer not found
The solution is to add JNA as a dependency like so:
dependencies {
// ...
implementation("net.java.dev.jna:jna:5.12.1")
}