From afb29670c87d1d1e3760c58dc6c9c0a1d3b2c5db Mon Sep 17 00:00:00 2001 From: 8lecramm <89603217+8lecramm@users.noreply.github.com> Date: Thu, 11 Apr 2024 21:31:13 +0200 Subject: [PATCH] Create README.md --- README.md | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b0c1e0c --- /dev/null +++ b/README.md @@ -0,0 +1,139 @@ +# Dero Swaps + +## Build from source +Clone the repository to your local disk.\ +Run `go mod tidy` and compile with `go build`. + +## Configuration +There are no paramters (yet).\ +Instead, 2 config files are used.\ +Place the following two config files in the program directory. +- **config.json** +``` +{ + "listen" : (string) IP:Port to listen on, + "btc_daemon" : (string) IP:Port of Bitcoin daemon, + "btc_dir" : (string) path to Bitcoin directory, + "ltc_daemon" : (string) IP:Port of Litecoin daemon, + "ltc_dir" : (string) path to Litecoin directory, + "arrr_daemon" : (string) IP:Port of Pirate daemon, + "arrr_dir" : (string) path to Pirate directory, + "monero_wallet" : (string) IP:Port of Monero Wallet, + "dero_daemon" : (string) IP:Port of Dero Daemon, + "dero_wallet" : (string) IP:Port of Dero Wallet, + "pairs" : (string array) enabled pairs +} +``` +Example file: +``` +{ + "listen" : "192.168.177.161:10413", + "btc_daemon" : "localhost:8332", + "btc_dir" : "/mnt/bitcoin", + "ltc_daemon" : "localhost:9332", + "ltc_dir" : "/mnt/litecoin", + "arrr_daemon" : "localhost:45453", + "arrr_dir" : "/mnt/pirate", + "monero_wallet" : "localhost:18090", + "dero_daemon" : "localhost:10102", + "dero_wallet" : "localhost:10103", + "pairs" : ["btc-dero","ltc-dero","arrr-dero","dero-ltc","dero-btc","dero-arrr","xmr-dero","dero-xmr"] +} +``` +- **fees.json** +``` +{ + "withdrawal" : { + "dero-btc" : (float) Bitcoin withdrawal fee, + "dero-ltc" : (float) Litecoin withdrawal fee, + "dero-arrr" : (float) Pirate withdrawal fee, + "dero-xmr" : (float) Monero withdrawal fee + }, + "swap" : { + "bid": (float) in percent, Bid fees + "ask": (float) in percent, Ask fees + } +} +``` +Example file: +``` +{ + "withdrawal" : { + "dero-btc" : 0.00004, + "dero-ltc" : 0.0002, + "dero-arrr" : 0.001, + "dero-xmr" : 0.00006 + }, + "swap" : { + "bid": 0.75, + "ask": 0.75 + } +} +``` + +The mentioned *withdrawal* fees are recommended and can be adjusted later. +### Available Pairs +The following Pairs are supported: +- btc-dero +- ltc-dero +- xmr-dero +- arrr-dero +- dero-btc +- dero-ltc +- dero-xmr +- dero-arrr + +## Usage +The swap service starts a *websocket* server. +Bitcoin, Litecoin and Pirate swaps require a local node. +The easiest way to start is to enable **dero-xmr** and **xmr-dero** swaps. +The Monero wallet can be pointed to a public remote node. + +### Methods +- **balance** (get pool liquidity) +- **market** (get price data) +- **swap** (create a swap request) + ### JSON parameters + There are no parameters required for methods *market* and *balance*\ + + **swap** params + ``` +{ + "pair" : (string) swap pair, + "amount" : (float) swap amount (in Dero), + "dero_address" : (string) Destination wallet address +} +``` +### JSON responses +**balance** response +``` +"result": { + "dero" : (float) Dero pool, + "ltc" : (float) Litecoin pool, + "btc" : (float) Bitcoin pool, + "arrr" : (float) Pirate pool, + "xmr" : (float) Monero Pool +} +``` +**market** response +``` +"result": { + "ltcdero" : (float) LTC price for buying 1 Dero, + "btcdero" : (float) BTC price for buying 1 Dero, + "xmrdero" : (float) XMR price for buying 1 Dero, + "arrrdero" : (float) ARRR price for buying 1 Dero, + "deroltc" : (float) LTC price for selling 1 Dero + "derobtc" : (float) BTC price for selling 1 Dero, + "deroxmr" : (float) XMR price for selling 1 Dero, + "deroarrr" : (float) ARRR price for selling 1 Dero, +} +``` +**swap** response +``` + "id" : (int) Swap ID,, + "wallet" : (string) Deposit wallet + "deposit" : (float) Deposit amount, + "swap" : (float)`Payout value, only used for Dero-* swaps, + "error" : (string) error message, if present, + "request" : (Swap_Request) Swap JSON parameters +```