๐Ÿงช
atomiq.exchange
  • ๐ŸŒŸIntroduction
  • โš—๏ธLiquidity provider nodes (LPs)
    • ๐Ÿƒโ€โ™‚๏ธRunning LP node
    • โŒRunning LP node (deprecated)
  • ๐Ÿ”“Security
  • ๐Ÿ”ฑSubmarine swaps (lightning)
    • ๐ŸŒฉ๏ธSolana -> Bitcoin Lightning
    • โšกBitcoin Lightning -> Solana
  • ๐ŸชถBitcoin light client (on-chain)
    • ๐Ÿ”—Solana -> Bitcoin on-chain
    • โ›“๏ธBitcoin on-chain -> Solana
  • SPV swaps (on-chain)
Powered by GitBook
On this page
  • Pre-requisites
  • Installation
  • bitcoind
  • lnd
  • BTCRelay & Watchtower
  • DNS Setup
  • Getting SSL certificates
  • atomiq node
  • Depositing assets
  • Bitcoin
  • Solana
  • Opening Lightning network channels
  • Adding LP node to public registry
  1. Liquidity provider nodes (LPs)

Running LP node (deprecated)

Instructions for setting up and running an atomiq LP node

PreviousRunning LP nodeNextSecurity

Last updated 12 months ago

Pre-requisites

  • Linux based machine (such as Ubuntu), with public IP address

  • NodeJS (requires v18 or higher)

  • npm

  • Domain name (needed for obtaining SSL certificate for HTTPS)

Installation

bitcoind

  1. Download latest version from or

  2. Create a file ~/.bitcoin/bitcoin.conf with the following content:

server=1
whitelist=127.0.0.1
txindex=1
irc=1
upnp=0
rpcallowip=127.0.0.1
rpcbind=127.0.0.1
rpcport=8332
rpcuser=<rpc username>
rpcpassword=<rpc password>

zmqpubrawtx=tcp://127.0.0.1:39332
zmqpubrawblock=tcp://127.0.0.1:39331
zmqpubhashblock=tcp://127.0.0.1:39332
  1. Run the bitcoind: bitcoind

  2. Wait till bitcoind finishes with IBD (initial block download), your bitcoin node is downloading the whole bitcoin blockchain - this might take a while.

  3. Create a new wallet in bitcoind: bitcoin-cli createwallet test true false "" false false true false

lnd

  1. Create a file ~/.lnd/lnd.conf with the following content:

[Application Options]
tlsextraip=127.0.0.1

minchansize=25000
sync-freelist=1

# Avoid high startup overhead
stagger-initial-reconnect=1
healthcheck.chainbackend.attempts=0

wallet-unlock-password-file=~/lnd-pass.txt

[bolt]
db.bolt.auto-compact=true

[protocol]
# Enable large channels support
protocol.wumbo-channels=1

[routing]
# Remove channels from graph that have one side that hasn't made announcements
routing.strictgraphpruning=1

[Bitcoin]
bitcoin.active=1
bitcoin.node=bitcoind
bitcoin.testnet=1

[Bitcoind]
bitcoind.rpchost=127.0.0.1:8332
bitcoind.rpcuser=<username from bitcoin.conf>
bitcoind.rpcpass=<password from bitcoin.conf>
bitcoind.zmqpubrawblock=tcp://127.0.0.1:39331
bitcoind.zmqpubrawtx=tcp://127.0.0.1:39332
  1. Run the lnd: lnd

  2. Wait for the lnd to startup. It should then ask you to create a wallet.

  3. Create a new wallet with: lncli create

  4. Save password you used to create a wallet to ~/lnd-pass.txt, this will be used to automatically open the wallet when lnd starts

BTCRelay & Watchtower

  1. Go into the newly created directory: cd BtcRelay-Sol-TS

  2. Install npm packages: npm install

  3. Install typescript: npm install -g typescript

  4. Compile to javascript: tsc

  5. Rename _MAINNET.env to .env: mv _MAINNET.env .env

  6. Add the rpc username and password you used in bitcoin.conf to the .env file:

BTC_RPC_USERNAME="<username from bitcoin.conf>"
BTC_RPC_PASSWORD="<password from bitcoin.conf>"
  1. Generate new Solana wallet: npm run genKey

  2. Deposit some SOL to the displayed wallet address, so relayer can cover Solana transaction fees (0.5 SOL should be enough for a year of operation).

  3. Run the btcrelay node with: npm start

DNS Setup

Setup your DNS so that your domain points to your server (with A record), you can get the IP address of your server with ifconfig. Example from google domains:

Getting SSL certificates

SSL certificates are required for secure communication between swap clients and your node.

  1. Install certbot, sudo apt update and sudo apt install certbot

  2. Make sure that the HTTP port is open in your firewall, on Ubuntu you can do this with: sudo ufw allow 80

  3. Run certbot to obtain an SSL certificate for you: certbot certonly --standalone -d <your domain name> (e.g.: certbot certonly --standalone -d node3.gethopa.com)

  4. Setup a cron job to automatically renew the certificates for you by editting your crontab crontab -e and add the following line:

0 0 1 * * certbot renew

atomiq node

  1. Go into the newly created directory: cd SolLightning-Intermediary-TS

  2. Install necessary npm packages: npm install

  3. Compile to javascript: tsc

  4. Rename _MAINNET.env to .env: mv _MAINNET.env .env

  5. Add the rpc username and password you used in bitcoin.conf to the .env file:

BTC_RPC_USERNAME="<username from bitcoin.conf>"
BTC_RPC_PASSWORD="<password from bitcoin.conf>"
  1. Get the lnd certificate by base64 --wrap=0 ~/.lnd/tls.cert and copy the output to LN_CERT field in .env file:

LN_CERT="<output of the above command>"
  1. Get the admin macaroon by base64 --wrap=0 ~/.lnd/data/chain/bitcoin/testnet/admin.macaroon and copy the output to LN_MACAROON field in .env file:

LN_MACAROON="<output of the above command>"
  1. Setup SSL key and certificate for the atomiq node by editting the .env file:

SSL_KEY="/etc/letsencrypt/live/<your domain name>/privkey.pem"
SSL_CERT="/etc/letsencrypt/live/<your domain name>/fullchain.pem"
  1. Generate a new solana keypair: npm run genKey

  2. Deposit some SOL to the displayed wallet address so your LP node can cover Solana transaction fees (0.5 SOL should be enough).

  3. Be sure to open port 4000 in your firewall so it can be accessed from the outside, on ubuntu you can do this with: sudo ufw allow 4000

  4. Run the atomiq node with: npm start

Depositing assets

Bitcoin

  1. Generate a new bitcoin address lncli newaddress p2wkh

  2. Send your BTC to the returned bitcoin wallet address

  3. You can monitor your bitcoin balance with lncli walletbalance

Amounts are displayed in satoshis - smallest denomination of bitcoin (1 satoshi = 0.00000001 BTC, 1 BTC = 100,000,000 satoshi)

Solana

  1. Go to the atomiq node's directory (SolLightning-Intermediary-TS)

  2. Get your node's Solana address npm run getAddress

  3. Send Solana assets to the returned Solana address (USDC, USDT & SOL is supported)

  4. You can check current balance of assets in the Solana wallet address with: npm run getBalance

  5. Deposit your Solana assets to the LP vault (do this for all of your Solana assets): npm run deposit <SOL/USDC/USDT> <amount to deposit>

  6. You can check your deposited assets in the LP vault with: npm run getVaultBalance

Opening Lightning network channels

COMING SOON!

Adding LP node to public registry

Download latest version from or

Clone the BTCRelay repository from github: git clone

Clone the atomiq node repository from github: git clone

For the LP node to be choosen the clients need to know about this, for this purpose we maintain a .

To add your LP node to this public registry please in the repo - make sure to specify your node's domain name. atomiq.exchange team will then check if your node works as expected and will add it to the public registry ASAP.

โš—๏ธ
โŒ
here
build from source
here
build from source
https://github.com/adambor/BtcRelay-Sol-TS
https://github.com/adambor/SolLightning-Intermediary-TS
registry of LP nodes on github
open an issue
DNS record example from Google Domains