Instructions for setting up and running an atomiq LP node with docker containers
LP node runs in docker containers & it is fully separated from your other programs, there is also no need to install anything other than docker on the main system.
Pre-requisites
A linux based machine (preferrably ubuntu 20.04 or 22.04) with SSH (command line) access
Testnet requirements: 4GB of RAM, 200GB SSD storage
Mainnet requirements: 6GB of RAM, 1TB SSD storage
We can recommend using Contabo for VPS hosting, the following instances are recommended:
Run the setup script - this will walk you through setting an environment (mainnet/testnet) and node's wallet
sudo ./setup.bash
Once this completes, it runs all the required software inside docker containers, you can check that all of them are running with
sudo docker container list
Interacting with the node
You can interact with the atomiq node through a CLI (command line interface)
./lp-cli
Or for testnet
./lp-cli-testnet
Using CLI
CLI is the way to send command to your running atomiq node. To get an overview of all the available command type in 'help'
> help
Available commands:
status : Fetches the current status of the bitcoin RPC, LND gRPC & intermediary application
getaddress : Gets the Solana & Bitcoin address of the node
getbalance : Gets the balances of the node
connectlightning : Connect to a lightning node peer
openchannel : Opens up a lightning network payment channel
closechannel : Attempts to cooperatively close a lightning network channel
forceclosechannel : Force closes a lightning network channel
listchannels : Lists existing lightning channels
transfer : Transfer wallet balance to an external address
transferlightning : Transfer lightning wallet balance, pay lightning network invoice
receivelightning : Creates a lightning network invoice
deposit : Deposits Solana wallet balance to an LP Vault
withdraw : Withdraw LP Vault balance to node's Solana wallet
getreputation : Checks the LP node's reputation stats
airdrop : Requests an airdrop of SOL tokens (only works on devnet!)
plugins : Shows the list of loaded plugins
geturl : Returns the URL of the node (only works when SSL_AUTO mode is used)
register : Registers the URL of the node to the public LP node registry (only works when SSL_AUTO mode is used)
listswaps : Lists all swaps in progress
Use 'help <command name>' for usage examples, description & help around a specific command!
Monitoring synchronization status
We need to wait for the bitcoin node to sync up to the network (download whole bitcoin blockchain, this takes few hours on testnet & up to a day on mainnet).
We can monitor the status of the sync progress with the status command
> status
Solana RPC status:
Status: ready
Bitcoin RPC status:
Status: verifying blockchain
Verification progress: 6.8971% <---- We can see the sync up/verification progress here
Synced headers: 2812116
Synced blocks: 549068
LND gRPC status:
Wallet status: offline
Intermediary status:
Status: wait_btc_rpc <---- We can see intermediary node status here, once it's "ready" the node is synced and ready to roll
Funds: 0.000000000
Has enough funds (>0.1 SOL): no
Depositing funds
While the node is syncing we can already deposit funds to the node, using โgetaddressโ command we get the Solana & Bitcoin deposit addresses
After funds are deposited to the wallets we can track the balance with the โgetbalanceโ command (BTC balances only show up after bitcoin node is synced)
Even though BTC-LN balance is shown in the balances, trading over lightning is disabled by default in the node's config
We also have to deposit Solana assets to the LP vault so they can be used for swaps (this doesnโt have to be done with bitcoin assets) - repeat this for all the assets you want to be traded โdeposit <asset:USDC/USDT/WBTC/SOL> <amount>โ
> deposit SOL 1
Transaction sent, signature: 4PxwU42k2xocYtspd8uAjNZahjU1YZSv6E4dXMziJRq9Ajd8ecjY8GQn8XXqGoJn6vxZ7F8W6qexMcTci3EuMda6 waiting for confirmation...
Deposit transaction confirmed!
Now we can check that the assets are really deposited and used for trading
It is important that you keep some SOL balance in your wallet (non-trading), to cover the transaction fees for executing the swaps (~0.2 SOL is sufficient).
Registering node
Once your node is synced up and ready (we can check that by using the โstatusโ command in the CLI)
> status
Solana RPC status:
Status: ready
Bitcoin RPC status:
Status: ready
Verification progress: 100.0000%
Synced headers: 2812140
Synced blocks: 2812140
LND gRPC status:
Wallet status: ready
Intermediary status:
Status: ready <---- We can see that our node is ready now!
Funds: 0.292930200
Has enough funds (>0.1 SOL): yes
We can now send a request to register our node in the central LP registry with the 'register' command, please be sure to include an e-mail where we can contact you in case there is something wrong with your node
We will now review your node (check if it is reachable & try swapping through it), you can monitor your node's approval/disapproval status by issuing the 'register' command again
Once your node is approved to be listed in the LP registry you will start processing user's swaps!
Configuration
Your atomiq node comes pre-configured with reasonable default, but in case you want to change the configuration you can find in config/intermediary/config.yaml (for mainnet) or config-testnet/intermediary/config.yaml (for testnet) folders.
You might want to change the Solana RPC URL, and use a dedicated one (from e.g. Helius - they offer a reasonable free tier) - see the SOLANA section. Or change the minimums/maximums or fees charged for the swaps - see the ONCHAIN section.
Default mainnet configuration:
#Solana RPC
SOLANA:
#Solana RPC URL to use, it is recommended to use a dedicated RPC endpoint from e.g. Helius (recommended), Quicknode, etc.
RPC_URL: "https://api.mainnet-beta.solana.com"
#Maximum fee in micro lamport/CU to use for transactions
MAX_FEE_MICRO_LAMPORTS: 250000
#Required APY option premium to be paid by the users as security deposit with BTC -> SOL swaps
SECURITY_DEPOSIT_APY: 20
#File with the wallet mnemonic seed
MNEMONIC_FILE: "/mnt/share/wallet/mnemonic.txt"
#Static tip (in lamports) to add to every transaction
STATIC_TIP: 50000
#Jito blockbuilder configuration, when set the transaction are sent through Jito instead of the RPC
JITO:
PUBKEY: "DttWaMuVvTiduZRnguLF7jNxTgiMBZ1hyAumKUiL2KRL"
ENDPOINT: "https://frankfurt.mainnet.block-engine.jito.wtf/api/v1/transactions"
#Bitcoin RPC configuration
BITCOIND:
PROTOCOL: "http"
PORT: 8332
HOST: "bitcoind"
RPC_USERNAME: "user1"
RPC_PASSWORD: "ThisIsAPassword"
NETWORK: "mainnet"
#LND RPC configuration
LND:
MNEMONIC_FILE: "/mnt/share/wallet/mnemonic.txt"
WALLET_PASSWORD_FILE: "/mnt/share/wallet/password.txt"
CERT_FILE: "/mnt/share/lnd/tls.cert"
MACAROON_FILE: "/mnt/share/lnd/admin.macaroon"
HOST: "lnd"
PORT: 10009
#LN setup, uncomment these lines if you want to enable lightning network support for your node
# LN:
# #Total swap fee is calculated as BASE_FEE + {SWAP_VALUE}*FEE_PERCENTAGE
# #Base fee (in BTC) to be paid by every swap
# BASE_FEE: 0.00000010
# #Fee (in %) to be charged on the swaps
# FEE_PERCENTAGE: 0.3
# #Minimum swappable amount in BTC (for lightning network swaps)
# MIN: 0.00001000
# #Maximum swappable amount in BTC (for lightning network swaps)
# MAX: 0.01000000
# #Allow lightning network swaps that cannot be probed first
# ALLOW_NON_PROBABLE_SWAPS: false
# #Allow lightning network swaps where the LN invoice has a very short expiry
# ALLOW_LN_SHORT_EXPIRY: false
#On-chain setup
ONCHAIN:
#Total swap fee is calculated as BASE_FEE + {SWAP_VALUE}*FEE_PERCENTAGE
#Base fee (in BTC) to be paid by every swap
BASE_FEE: 0.00000150
#Fee (in %) to be charged on the swaps
FEE_PERCENTAGE: 0.3
#Minimum swappable amount in BTC (for on-chain swaps)
MIN: 0.00010000
#Maximum swappable amount in BTC (for on-chain swaps)
MAX: 0.05000000
#Network fee buffer (in %), we charge the client this much more on the network
# fee to accomodate for the possible fee rate increases in the near future
NETWORK_FEE_ADD_PERCENTAGE: 25
#Tradable assets setup
ASSETS:
WBTC:
#Address of the token
address: "3NZ9JMVBmGAqocybic2c7LQCJScmgsAZ6vQqTDzcqmJh"
#Decimal places
decimals: 8
#Pricing source (using Binance), you can invert the pair by prepending "!"
pricing: "WBTCBTC"
USDC:
address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
decimals: 6
pricing: "!BTCUSDC"
USDT:
address: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"
decimals: 6
pricing: "!BTCUSDT"
SOL:
address: "So11111111111111111111111111111111111111112"
decimals: 9
pricing: "SOLBTC"
#CLI - command line interface config
CLI:
#CLI bind address
ADDRESS: "0.0.0.0"
#CLI TCP port
PORT: 40221
#REST RFQ API config
REST:
#REST API bind address
ADDRESS: "0.0.0.0"
#REST API port
PORT: 4000
#Automatic SSL certificate provisioning config
SSL_AUTO:
#HTTP listen port to list for ACME challenges
HTTP_LISTEN_PORT: 80
#DNS proxy to use - mapping the server's IP address to a domain
DNS_PROXY: "sslip.io"
#Node extensions/plugins
PLUGINS:
atomiq-archiver: "atomiq-archiver@latest"