This repository has been archived by the owner on Apr 7, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIX - change kinesis to sparkswap (#71)
* change kinesis to sparkswap and remove unused code for public release * change circleci badge * change engine name
- Loading branch information
Showing
19 changed files
with
134 additions
and
151 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,70 +1,114 @@ | ||
# Kinesis LND Engine | ||
# SparkSwap LND Engine | ||
|
||
<img src="https://kines.is/logo.png" alt="Kinesis Exchange" width="550"> | ||
<img src="https://kines.is/logo.png" alt="SparkSwap" width="550"> | ||
|
||
[![CircleCI](https://circleci.com/gh/kinesis-exchange/lnd-engine.svg?style=svg&circle-token=47c81b3a717f062885f159dfded078e134413db1)](https://circleci.com/gh/kinesis-exchange/lnd-engine) | ||
[![CircleCI](https://circleci.com/gh/sparkswap/lnd-engine.svg?style=svg&circle-token=47c81b3a717f062885f159dfded078e134413db1)](https://circleci.com/gh/sparkswap/lnd-engine) | ||
|
||
The following repo contains 2 modules that make up a `Kinesis Engine`: | ||
The following repo contains 2 modules that make up a SparkSwap Payment Channel Network Engine: | ||
|
||
1. NPM module w/ LND abstraction layer (located in `src`) | ||
2. Dockerfiles for all containers needed for the LND Engine | ||
2. Dockerfiles for all containers needed for the LND Engine to run on a broker daemon | ||
|
||
A current docker setup for the Kinesis exchange may look like: | ||
A current docker setup a functional BTC/LTC LND Engine: | ||
1. BTCD node | ||
2. LND BTCD node (kinesis-exchange fork) | ||
2. LND BTCD node (SparkSwap fork) | ||
3. LTCD node | ||
4. LND LTCD node (kinesis-exchange fork) | ||
4. LND LTCD node (SparkSwap fork) | ||
|
||
#### Installation (lnd-engine only) | ||
|
||
The following commands will install dependencies, import proto files and run tests on the | ||
lnd-engine codebase. These steps do not build the docker images associated with the lnd-engine. | ||
The following commands will install dependencies and import associated proto files for | ||
the lnd-engine codebase. | ||
|
||
``` | ||
npm i | ||
npm run build | ||
npm test | ||
``` | ||
|
||
You can then use `npm run build-images` to build all docker containers. | ||
|
||
To run tests, use `npm run test` | ||
|
||
#### Installation w/ Docker | ||
|
||
The lnd-engine docker files make use of Docker's image storage. Run the `npm run build-images` command to | ||
The lnd-engine docker files make use of Docker's internal image storage (to replicate the functionality of docker hub locally). Run the `npm run build-images` command to | ||
update all docker images on your local docker installation. | ||
|
||
#### Using the docker files in your personal project | ||
|
||
After you have built all images on your local system, you can then use the provided `docker-compose.btc.example.yml` or | ||
`docker-compose.ltc.example.yml` files in your project. | ||
After you have built all images on your local system, you can use the provided `docker-compose.btc.example.yml` or | ||
`docker-compose.ltc.example.yml` files as a reference for docker setup in your own project. | ||
|
||
#### Library Usage | ||
|
||
``` | ||
const LndEngine = require('lnd-engine') | ||
const engine = new LndEngine(LND_HOST, engineOptions) | ||
engine.getTotalBalance.... etc... | ||
``` | ||
|
||
# JS API | ||
|
||
``` | ||
getTotalBalance() | ||
getUnconfirmedBalance() | ||
getConfirmedBalanace() | ||
getUncommittedBalance() | ||
getCommittedBalance() | ||
getPublicKey() | ||
getInvoiceValue(requestHash) | ||
getTotalChannelBalance()) | ||
createNewAddress() | ||
createSwapHash(orderId, amountInSatoshis) | ||
createInvoice() | ||
createChannel(host, publicKey, fundingAmount) | ||
isAvailable() | ||
isInvoicePaid() | ||
isBalanceSufficient() | ||
payInvoice(invoiceRequest) | ||
prepareSwap(swapHash, inbound, outbound) | ||
executeSwap(counterpartyPubKey, swapHash, inbound, outbound) | ||
createRefundInvoice(paymentRequest) | ||
const engineOptions = { | ||
logger: ..., | ||
tlsCertPath: /absolute/path/to/tls/cert, // required | ||
macaroonPath: /absolute/path/to/macaroon, // required | ||
} | ||
const engine = new LndEngine('0.0.0.0:10009', 'BTC', engineOptions) | ||
engine.getTotalBalance.... etc | ||
``` | ||
|
||
# API | ||
|
||
Documentation is up-to-date as of 119fcabe94d286c88a144d9c3de1f78e85fc64ed | ||
|
||
**NOTE:** Please see detailed documentation at [sparkswap.com/docs/engines/lnd](https://sparkswap.com/docs/engines/lnd) | ||
|
||
### Healthcheck | ||
|
||
``` | ||
isAvailable | ||
validateNodeConfig | ||
``` | ||
|
||
### Addresses | ||
|
||
``` | ||
createNewAddress | ||
getPaymentChannelNetworkAddress | ||
getPublicKey | ||
``` | ||
|
||
### Invoices | ||
|
||
``` | ||
createInvoice | ||
createRefundInvoice | ||
getInvoiceValue | ||
getInvoices | ||
isInvoicePaid | ||
payInvoice | ||
``` | ||
|
||
### Cross-Chain Atomic Swaps | ||
|
||
``` | ||
createSwapHash | ||
executeSwap | ||
getSettledSwapPreimage | ||
prepareSwap | ||
translateSwap | ||
``` | ||
|
||
### Balances | ||
|
||
``` | ||
getConfirmedBalance | ||
getTotalBalance | ||
getTotalChannelBalance | ||
getUnconfirmedBalance | ||
isBalanceSufficient | ||
``` | ||
|
||
### Channels | ||
|
||
``` | ||
createChannel | ||
numChannelsForAddress | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,3 @@ | ||
## LND ENGINE DOCKER FILES | ||
|
||
This directory contains all files needed to setup LND Engine w/ the kinesis exchange | ||
|
||
#### Before you begin | ||
|
||
You must have docker installed. For all applications in Kinesis, it is possible to run these applications standalone | ||
on MacOS or Ubuntu, but it is not recommeneded. | ||
|
||
### Getting Started | ||
|
||
Provided below is a quick-n-dirty guide on how to get started with BTC/LND so we can use the Kinesis Broker. In order for the Kinesis CLI and Kinesis Daemon to be fully functional, the following containers must be running: | ||
|
||
- rousabeef/BTCD - Headless daemon to interact with blockchain (no wallet in this package) | ||
- LND - Lightning Network Daemon + Wallet | ||
|
||
These containers are what make up the `LND-Engine` which is what the Kinesis Broker AND Kinesis Relayer rely on for LND communication.` | ||
This directory contains all files needed to setup the LND Engine with a SparkSwap Broker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
#!/bin/bash | ||
|
||
echo "" | ||
echo " ██ ▄█▀ ██▓ ███▄ █ ▓█████ ██████ ██▓ ██████ " | ||
echo " ██▄█▒ ▓██▒ ██ ▀█ █ ▓█ ▀ ▒██ ▒ ▓██▒▒██ ▒ " | ||
echo "▓███▄░ ▒██▒▓██ ▀█ ██▒▒███ ░ ▓██▄ ▒██▒░ ▓██▄ " | ||
echo "▓██ █▄ ░██░▓██▒ ▐▌██▒▒▓█ ▄ ▒ ██▒░██░ ▒ ██▒" | ||
echo "▒██▒ █▄░██░▒██░ ▓██░░▒████▒▒██████▒▒░██░▒██████▒▒" | ||
echo "▒ ▒▒ ▓▒░▓ ░ ▒░ ▒ ▒ ░░ ▒░ ░▒ ▒▓▒ ▒ ░░▓ ▒ ▒▓▒ ▒ ░" | ||
echo "░ ░▒ ▒░ ▒ ░░ ░░ ░ ▒░ ░ ░ ░░ ░▒ ░ ░ ▒ ░░ ░▒ ░ ░" | ||
echo "░ ░░ ░ ▒ ░ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ ░ ░ " | ||
echo "░ ░ ░ ░ ░ ░ ░ ░ ░ " | ||
echo " " | ||
echo " ██████ ██▓███ ▄▄▄ ██▀███ ██ ▄█▀ ██████ █ █░ ▄▄▄ ██▓███ "; | ||
echo "▒██ ▒ ▓██░ ██▒▒████▄ ▓██ ▒ ██▒ ██▄█▒ ▒██ ▒ ▓█░ █ ░█░▒████▄ ▓██░ ██▒"; | ||
echo "░ ▓██▄ ▓██░ ██▓▒▒██ ▀█▄ ▓██ ░▄█ ▒▓███▄░ ░ ▓██▄ ▒█░ █ ░█ ▒██ ▀█▄ ▓██░ ██▓▒"; | ||
echo " ▒ ██▒▒██▄█▓▒ ▒░██▄▄▄▄██ ▒██▀▀█▄ ▓██ █▄ ▒ ██▒░█░ █ ░█ ░██▄▄▄▄██ ▒██▄█▓▒ ▒"; | ||
echo "▒██████▒▒▒██▒ ░ ░ ▓█ ▓██▒░██▓ ▒██▒▒██▒ █▄▒██████▒▒░░██▒██▓ ▓█ ▓██▒▒██▒ ░ ░"; | ||
echo "▒ ▒▓▒ ▒ ░▒▓▒░ ░ ░ ▒▒ ▓▒█░░ ▒▓ ░▒▓░▒ ▒▒ ▓▒▒ ▒▓▒ ▒ ░░ ▓░▒ ▒ ▒▒ ▓▒█░▒▓▒░ ░ ░"; | ||
echo "░ ░▒ ░ ░░▒ ░ ▒ ▒▒ ░ ░▒ ░ ▒░░ ░▒ ▒░░ ░▒ ░ ░ ▒ ░ ░ ▒ ▒▒ ░░▒ ░ "; | ||
echo "░ ░ ░ ░░ ░ ▒ ░░ ░ ░ ░░ ░ ░ ░ ░ ░ ░ ░ ▒ ░░ "; | ||
echo " ░ ░ ░ ░ ░ ░ ░ ░ ░ ░ "; | ||
echo " "; |
Oops, something went wrong.