Coder Social home page Coder Social logo

samkenx-bitcoin-kmp's Introduction

Kotlin Maven Central Github Actions License

Kotlin Multiplatform Bitcoin Library

Overview

This is a simple Kotlin Multiplatform library which implements most of the bitcoin protocol:

  • base58 encoding/decoding
  • block headers, block and tx parsing
  • tx creation, signature and verification
  • script parsing and execution (including OP_CLTV and OP_CSV)
  • pay to public key tx
  • pay to script tx / multisig tx
  • BIP 32 (deterministic wallets)
  • BIP 39 (mnemonic code for generating deterministic keys)
  • BIP 86 (key derivation for p2tr outputs)
  • BIP 173 (Base32 address format for native v0-16 witness outputs)
  • BIP 174 (Partially Signed Bitcoin Transaction Format v0)
  • BIP 341 and 342 (taproot and tapscript transactions)
  • BIP 350 (Bech32m format)

Objectives

Our goal is not to re-implement a full Bitcoin node but to build a library that implements all the primitives that you need to create bitcoin applications: building and signing transactions, verifying transactions, working with custom bitcoin scripts, parsing blocks, headers, transactions, building BIP39 wallets...

And of course we use this library in our new multiplaform lightning engine https://github.com/ACINQ/lightning-kmp.

Our runtime targets are:

  • JVM
  • Android
  • iOS
  • Linux 64 bits (for testing/prototyping only, you should use the JVM for production applications)

Status

  • Message parsing (blocks, transactions, inv, ...)
  • Building transactions (P2PK, P2PKH, P2SH, P2WPK, P2WSH)
  • Signing transactions
  • Verifying signatures
  • Passing core reference tests (scripts & transactions)
  • Passing core reference segwit tests
  • Passing core reference psbt v0 tests

Install

bitcoin-kmp is available on maven central

  • Multiplatform: Add the fr.acinq.bitcoin:bitcoin-kmp dependency to your common source set dependencies (you need Gradle 5.0 minimum).
  • JVM: Add the fr.acinq.bitcoin:bitcoin-kmp-jvm dependency to your project.

libscp256k1 support

You need to add a JVM implementation of Secp256k1 to your project in order to use bitcoin-kmp with JVM.

Please refer the Secp256k1 installation section.

Usage

Please have a look at unit tests, more samples will be added soon.

samkenx-bitcoin-kmp's People

Contributors

pk-b2 avatar remyers avatar salomonbrys avatar samkenxstream avatar sstone avatar t-bast avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.