Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/horizontalsystems/atomic-swap-kit-android
Atomic Swap Android library for Bitcoin (BTC) and Bitcoin Cash (BCH) swaps in decentralized manner. Implemented on Kotlin.
https://github.com/horizontalsystems/atomic-swap-kit-android
atomic-swap atomicswap atomicswaps bitcoin bitcoin-cash decentralized-exchange dex
Last synced: about 2 months ago
JSON representation
Atomic Swap Android library for Bitcoin (BTC) and Bitcoin Cash (BCH) swaps in decentralized manner. Implemented on Kotlin.
- Host: GitHub
- URL: https://github.com/horizontalsystems/atomic-swap-kit-android
- Owner: horizontalsystems
- Created: 2019-07-17T05:40:21.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-07-26T08:47:13.000Z (over 5 years ago)
- Last Synced: 2024-07-30T17:24:46.371Z (5 months ago)
- Topics: atomic-swap, atomicswap, atomicswaps, bitcoin, bitcoin-cash, decentralized-exchange, dex
- Language: Kotlin
- Homepage:
- Size: 206 KB
- Stars: 20
- Watchers: 6
- Forks: 10
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Overview
This is the android library that allows Atomic Swap, decentralized crypto currency exchange, between 2 parties. The implementation based on Hash Time Locked Contracts.
## Usage
### Initialization
The primary class to use is `SwapKit`.
```kotlin
val swapKit = SwapKit(context)swapKit.registerSwapBlockchainCreator("BTC", BitcoinSwapBlockchainCreator(bitcoinKit))
swapKit.registerSwapBlockchainCreator("BCH", BitcoinSwapBlockchainCreator(bitcoinCashKit))```
It takes `context` as constructor parameter. The supported coins should be registered to `SwapKit`.
### Exchanging crypto-curencies
There are 2 sides that take part in the process: Initiator and Responder. The process consists of the following steps:
#### Request for a swap
Initiator creates swap request:
```kotlin
val swapRequest = swapKit.createSwapRequest(coinHave, coinWant, rate, amount)
```#### Response to a swap
Responder creates response for this request:
```kotlin
val swapResponse = swapKit.createSwapResponse(swapRequest)
```Creating response also starts the swap process in the Responder side.
#### Initiate swap
Initiator takes response and starts the swap
```kotlin
swapKit.initiateSwap(swapResponse)
```### Initiator and Responder Communication
The Swap Request and Swap Response are the simple data objects. They can be easily serialized into/parsed from strings and interchanged via standard apps, like messenger or email.
## Prerequisites
* JDK >= 1.8
* Android 6 (minSdkVersion 23) or greater## Installation
Add the JitPack to module build.gradle
```
repositories {
maven { url 'https://jitpack.io' }
}
```
Add the following dependency to your build.gradle file:
```
dependencies {
implementation 'com.github.horizontalsystems:atomic-swap-kit-android:master-SNAPSHOT'
}
```## Example App
All features of the library are used in example project. It can be referred as a starting point for usage of the library.
* [Example App](https://github.com/horizontalsystems/atomic-swap-kit-android/tree/master/app)## Dependencies
* [Bitcoin Kit Android](https://github.com/horizontalsystems/bitcoin-kit-android) - Full SPV wallet toolkit implementation for Bitcoin, Bitcoin Cash and Dash blockchains## License
The `Atomic Swap Kit` is open source and available under the terms of the [MIT License](https://github.com/horizontalsystems/atomic-swap-kit-android/blob/master/LICENSE)