Skip to content

Conversation

@NeoZ666
Copy link
Collaborator

@NeoZ666 NeoZ666 commented Jan 17, 2026

Kotlin Bindings Package Distribution

PR Overview

This pr provides Kotlin bindings for the coinswap FFI library, enabling Bitcoin privacy-focused coinswap operations in JVM and Android applications. The bindings are generated using Mozilla's UniFFI framework, which provides a bridge between Rust and Kotlin.

Distribution Strategy

The pr aims to distribute two separate packages via Maven Central, the standard repository for JVM ecosystem dependencies. Maven Central provides reliable, versioned distribution that integrates seamlessly with Gradle and Maven build tools.

Package Types

JVM Package (Desktop/Server)

Target Platforms: Linux, macOS, Windows
Artifact Type: JAR (Java Archive)
Package Name: org.citadel-tech:coinswap-jvm

The JVM package targets traditional Java Virtual Machine environments including desktop applications, server-side services, and command-line tools. This package bundles native libraries for multiple platforms (.so for Linux, .dylib for macOS, .dll for Windows) within a single JAR file.

Usage Example:

// build.gradle.kts
dependencies {
    implementation("org.citadel-tech:coinswap-jvm:1.0.0")
}

// Application code
val taker = Taker.init(...)
val report = taker.doCoinswap(SwapParams(...))

Key Characteristics:

  • Multi-platform native library bundling
  • Automatic platform detection and library loading at runtime
  • Compatible with standard JVM applications (Java 11+)
  • No Android-specific dependencies

Android Package (Mobile)

Target Platforms: Android 7.0+ (API 24+)
Artifact Type: AAR (Android Archive)
Package Name: org.citadel-tech:coinswap-android

Usage Example:

// build.gradle.kts
dependencies {
    implementation("org.citadel-tech:coinswap-android:1.0.0")
}

// Application code
lifecycleScope.launch(Dispatchers.IO) {
    val taker = Taker.init(filesDir.absolutePath, ...)
    taker.doCoinswap(SwapParams(...))
}

Key Characteristics:

  • Native libraries for ARM64, ARMv7, and x86-64 architectures
  • Packaged as AAR with proper JNI library structure
  • Android lifecycle and threading considerations
  • Compatible with Android 7.0+ (API level 24+)

Reference Implementation: BDK Android

JVM vs AAR: Technical Differences

JAR (Java Archive)

  • Standard JVM library format
  • Single artifact works across all JVM platforms
  • Native libraries extracted to temporary directory at runtime
  • Platform detection handled by Java Native Access (JNA)
  • Simpler dependency management

AAR (Android Archive)

  • Android-specific library format
  • Contains compiled resources, manifest, and JNI libraries
  • Native libraries organized by CPU architecture in jniLibs/ directory
  • Android system handles architecture-specific library loading
  • Supports Android-specific features (resources, manifest merging)

The fundamental difference is that JAR targets the standard JVM runtime environment with dynamic platform detection, while AAR targets the Android Runtime (ART) with architecture-specific native library packaging.

Current Development Status

The project currently maintains a development environment for testing UniFFI bindings with:

  • JVM test infrastructure (StandardSwap, TaprootSwap tests)
  • CI/CD integration via GitHub Actions
  • Linux x86-64 native library builds
  • Local testing against Bitcoin regtest

The current setup is not consumable by external projects and requires manual native library setup.

Maven Central Publishing Requirements

Publishing to Maven Central requires several prerequisites and artifacts:

Prerequisites

  1. Sonatype OSSRH Account: Register at https://central.sonatype.org/
  2. Domain Verification: Verify ownership of citadel-tech.org or use GitHub-based groupId
  3. GPG Key Pair: Generate and publish GPG keys for artifact signing
  4. GitHub Secrets: Configure repository secrets for automated publishing

Publishing Process

  1. Build and test artifacts locally
  2. Sign artifacts with GPG key
  3. Upload to Sonatype OSSRH staging repository
  4. Validate artifacts pass repository requirements
  5. Release to Maven Central (becomes available within 2 hours)

Resources

…mized for smaller release binaries

Signed-off-by: neoz666 <neoz.blockchain@gmail.com>
@NeoZ666 NeoZ666 force-pushed the update_bindings_workflow branch from fe94aaa to 97c0181 Compare January 17, 2026 05:43
Signed-off-by: neoz666 <neoz.blockchain@gmail.com>
Signed-off-by: neoz666 <neoz.blockchain@gmail.com>
Signed-off-by: neoz666 <neoz.blockchain@gmail.com>
Signed-off-by: neoz666 <neoz.blockchain@gmail.com>
Signed-off-by: neoz666 <neoz.blockchain@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant