Skip to content

Commit

Permalink
docs: update regtest and deployment configurations
Browse files Browse the repository at this point in the history
  • Loading branch information
michael1011 committed Feb 12, 2024
1 parent 62ed227 commit d180636
Show file tree
Hide file tree
Showing 3 changed files with 234 additions and 79 deletions.
147 changes: 107 additions & 40 deletions docs/deployment.md
Expand Up @@ -91,12 +91,15 @@ bucketname = ""
# Cron interval at which a new backup should be uploaded. The default value is daily
interval = "0 0 * * *"

# Boltz backend supports sending messages to Discord after successful and failed
# Swaps and if the wallet or channel balance is below a configurable threshold
# Boltz backend supports sending messages to Discord after successful and
# failed Swaps and if the wallet or channel balance is below a configurable threshold
[notification]
token = ""
channel = ""

# A string to prefix all messages with
prefix = "mainnet"
# When Mattermost should be used instead of Discord for notifications
# mattermostUrl = ""
# Optionally, important alerts can be sent to a different channel
# channelAlerts = ""

Expand All @@ -120,7 +123,7 @@ otpsecretpath = "/home/boltz/.boltz/otpSecret.dat"
# - Kraken
# - Poloniex
# - "fee": percentage of the swapped amount that should be charged as fee
# - "swapInFee" (optional): same as "fee" but for swaps from onchain to lightning; defaults to "fee" if not set
# - "swapInFee" (optional): same as "fee" but for swaps from onchain to lightning; defaults to "fee" if not set
[[pairs]]
base = "BTC"
quote = "BTC"
Expand All @@ -133,24 +136,45 @@ minSwapAmount = 10_000
# If not set, half of the expiry time of the reverse swap will be used
invoiceExpiry = 7200

timeoutDelta = 400
# Alternatively, the timeouts of swaps of a pair can be set like this
# [pairs.timeoutDelta]
# reverse = 1440
# swapMinimal = 1440
# swapMaximal = 2880
# Timeouts in minutes
[pairs.timeoutDelta]
reverse = 1440
swapMinimal = 1440
swapMaximal = 2880
swapTaproot = 10080

[[pairs]]
base = "L-BTC"
quote = "BTC"
rate = 1
fee = 0.5
swapInFee = 0.2
timeoutDelta = 300

maxSwapAmount = 1_000_000_000
maxSwapAmount = 10_000_00
minSwapAmount = 100_000

[pairs.timeoutDelta]
reverse = 1440
swapMinimal = 1440
swapMaximal = 2880
swapTaproot = 10080

[[pairs]]
base = "L-BTC"
quote = "BTC"
fee = 0.25
swapInFee = 0.1
rate = 1

maxSwapAmount = 4_294_967
minSwapAmount = 10_000

[pairs.timeoutDelta]
reverse = 1440
swapMinimal = 1400
swapMaximal = 2880
swapTaproot = 10080

# The array "currencies" configures the chain and LND clients for the "pairs"
# Not configuring the LND client is possible but will cause that chain not to support Lightning
# The values are pretty self explainatory apart from: "minWalletBalance" and "minChannelBalance" which trigger
Expand All @@ -162,37 +186,80 @@ minWalletBalance = 10_000_000
minChannelBalance = 10_000_000
maxZeroConfAmount = 10_000_000

# Onchain wallet provider
# Options: "core" or "lnd"
# Defaults to "lnd"
# preferredWallet = "core"

# Can be set to alert about the balance of an unused wallet being more than a certain threshold
# maxUnusedWalletBalance = 100_000

[currencies.chain]
host = "127.0.0.1"
port = 18_332

# The requests to Bitcoin Core like clients can be authenticated with cookie files or user/password
# If both are configured, cookie files are preferred
cookie = ""

user = "bitcoin"
password = "bitcoin"

# Optional API endpoint of a MempoolSpace instance running on the chain of the configured client
mempoolSpace = "https://mempool.space/api"

# The ZMQ endpoints for a chain can be configured here
# If they are not set, those endpoints are fetched via the "getzmqnotifications" RPC method of the node
zmqpubrawtx = "tcp://0.0.0.0:29000"
zmqpubrawblock = "tcp://0.0.0.0:29001"

# hashblock is not required and should only be used as fallback in case rawblock is not available
# zmqpubhashblock = ""

[currencies.lnd]
host = "127.0.0.1"
port = 10_009
certpath = "/home/boltz/.lnd/bitcoin/tls.cert"
macaroonpath = "/home/boltz/.lnd/bitcoin/admin.macaroon"
maxPaymentFeeRatio = 0.03
[currencies.chain]
host = "127.0.0.1"
port = 18_332

# The requests to Bitcoin Core like clients can be authenticated with cookie files or user/password
# If both are configured, cookie files are preferred
cookie = ""

user = "bitcoin"
password = "bitcoin"

# Optional API endpoint of a MempoolSpace instance running on the chain of the configured client
mempoolSpace = "https://mempool.space/api"

# The ZMQ endpoints for a chain can be configured here
# If they are not set, those endpoints are fetched via the "getzmqnotifications" RPC method of the node
zmqpubrawtx = "tcp://0.0.0.0:29000"
zmqpubrawblock = "tcp://0.0.0.0:29001"

# hashblock is not required and should only be used as fallback in case rawblock is not available
# zmqpubhashblock = ""

[currencies.lnd]
host = "127.0.0.1"
port = 10_009
certpath = "/home/boltz/.lnd/bitcoin/tls.cert"
macaroonpath = "/home/boltz/.lnd/bitcoin/admin.macaroon"
maxPaymentFeeRatio = 0.03

# A CLN node can be connected via its gRPC interface
[currencies.cln]
host = "127.0.0.1"
port = 9291
rootCertPath = "/home/boltz/.lightning/testnet/ca.pem"
privateKeyPath = "/home/boltz/.lightning/testnet/client-key.pem"
certChainPath = "/home/boltz/.lightning/testnet/client.pem"

# The Boltz hold invoice plugin is required: https://github.com/BoltzExchange/boltz-backend/tree/master/tools/plugins/hold
[currencies.cln.hold]
host = "127.0.0.1"
port = 9292
rootCertPath = "/home/boltz/.lightning/testnet/hold/ca.pem"
privateKeyPath = "/home/boltz/.lightning/testnet/hold/client-key.pem"
certChainPath = "/home/boltz/.lightning/testnet/hold/client.pem"

# Optionally, mpay (https://github.com/BoltzExchange/boltz-backend/tree/master/tools/plugins/mpay) can be used to pay invoices
[currencies.cln.mpay]
host = "127.0.0.1"
port = 9293
rootCertPath = "/home/boltz/.lightning/testnet/mpay/ca.pem"
privateKeyPath = "/home/boltz/.lightning/testnet/mpay/client-key.pem"
certChainPath = "/home/boltz/.lightning/testnet/mpay/client.pem"

[liquid]
symbol = "L-BTC"
network = "liquidTestnet"

maxSwapAmount = 4_294_967
minSwapAmount = 10_000

minWalletBalance = 100_000_000

[liquid.chain]
host = "127.0.0.1"
port = 18884
cookie = "/home/boltz/.elements/liquidv1/.cookie"
```

## Database migrations
Expand Down
155 changes: 125 additions & 30 deletions docs/regtest.md
Expand Up @@ -11,77 +11,172 @@ Prerequisites:
* The latest [Node.js LTS and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) installed. We recommend using [nvm](https://github.com/nvm-sh/nvm#install--update-script) to manage npm installs: `nvm install --lts`
* [Docker](https://docs.docker.com/engine/install/)

The regtest environment of Boltz Backend is based on [boltz/regtest](https://hub.docker.com/r/boltz/regtest). To start the images run `npm run docker:start` and to stop them again use `npm run docker:stop` to stop and remove the containers.
The regtest environment of the Boltz Backend is based on [boltz/regtest](https://hub.docker.com/r/boltz/regtest). To start the images run `npm run docker:start` and to stop them again use `npm run docker:stop` to stop and remove the containers.

To use the nodes in the container with Boltz Backend, use a configuration similar to this one:
To use the nodes in the container with the Boltz Backend, use a configuration file in `~/.boltz/boltz.conf` similar to this one:

```toml
[nodeSwitch]
clnAmountThreshold = 1_000_000

[swap]
deferredClaimSymbols = ["BTC", "L-BTC"]

[[pairs]]
base = "BTC"
quote = "BTC"
rate = 1
fee = 0.4
swapInFee = 0.2

invoiceExpiry = 361

maxSwapAmount = 4_294_967
minSwapAmount = 50_000

[pairs.timeoutDelta]
reverse = 1440
swapMinimal = 1440
swapMaximal = 2880
swapTaproot = 10080

[[pairs]]
base = "RBTC"
quote = "BTC"
rate = 1
fee = 0.5
timeoutDelta = 1_440

maxSwapAmount = 4_294_967
minSwapAmount = 10_000
minSwapAmount = 50_000

[pairs.timeoutDelta]
reverse = 1440
swapMinimal = 1440
swapMaximal = 2880
swapTaproot = 10080

[[pairs]]
base = "L-BTC"
quote = "BTC"
fee = 0.25
swapInFee = 0.1
rate = 1
fee = 0.5
timeoutDelta = 1_440
maxSwapAmount = 2_000_000_000
minSwapAmount = 100_000

maxSwapAmount = 4_294_967
minSwapAmount = 10_000

[pairs.timeoutDelta]
reverse = 1440
swapMinimal = 1400
swapMaximal = 2880
swapTaproot = 10080

[[currencies]]
symbol = "BTC"
network = "bitcoinRegtest"
minWalletBalance = 10_000_000
minChannelBalance = 10_000_000
maxZeroConfAmount = 10_000_000

[currencies.chain]
host = "127.0.0.1"
port = 18_443
cookie = "docker/regtest/data/core/cookies/.bitcoin-cookie"
rpcuser = "kek"
rpcpass = "kek"

[currencies.lnd]
host = "127.0.0.1"
port = 10_009
certpath = "docker/regtest/data/lnd/certificates/tls.cert"
macaroonpath = "docker/regtest/data/lnd/macaroons/admin.macaroon"
maxPaymentFeeRatio = 0.03
minLocalBalance = 10_000_000
minRemoteBalance = 10_000_000
maxSwapAmount = 4_294_967
minSwapAmount = 50_000
maxZeroConfAmount = 0
preferredWallet = "core"

[currencies.chain]
host = "127.0.0.1"
port = 18_443
cookie = "docker/regtest/data/core/cookies/.bitcoin-cookie"

[currencies.lnd]
host = "127.0.0.1"
port = 10_009
certpath = "docker/regtest/data/lnd/certificates/tls.cert"
macaroonpath = "docker/regtest/data/lnd/macaroons/admin.macaroon"

[currencies.cln]
host = "127.0.0.1"
port = 9291
rootCertPath = "docker/regtest/data/cln/certs/ca.pem"
privateKeyPath = "docker/regtest/data/cln/certs/client-key.pem"
certChainPath = "docker/regtest/data/cln/certs/client.pem"

[currencies.cln.hold]
host = "127.0.0.1"
port = 9292
rootCertPath = "docker/regtest/data/cln/hold/ca.pem"
privateKeyPath = "docker/regtest/data/cln/hold/client-key.pem"
certChainPath = "docker/regtest/data/cln/hold/client.pem"

[currencies.cln.mpay]
host = "127.0.0.1"
port = 9293
rootCertPath = "docker/regtest/data/cln/mpay/ca.pem"
privateKeyPath = "docker/regtest/data/cln/mpay/client-key.pem"
certChainPath = "docker/regtest/data/cln/mpay/client.pem"

[liquid]
symbol = "L-BTC"
network = "liquidRegtest"
minWalletBalance = 10_000_000

[liquid.chain]
host = "127.0.0.1"
port = 18884
cookie = "docker/regtest/data/core/cookies/.elements-cookie"
maxSwapAmount = 4_294_967
minSwapAmount = 10_000

minWalletBalance = 100_000_000

[liquid.chain]
host = "127.0.0.1"
port = 18884
cookie = "docker/regtest/data/core/cookies/.elements-cookie"

[rsk]
providerEndpoint = "http://127.0.0.1:8545"

etherSwapAddress = "0x5FbDB2315678afecb367f032d93F642f64180aa3"
erc20SwapAddress = "0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512"

[[rsk.tokens]]
symbol = "RBTC"

maxSwapAmount = 4_294_96700
minSwapAmount = 10000

minWalletBalance = 100_000_000

[[rsk.tokens]]
symbol = "USDT"
decimals = 18
contractAddress = "0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0"

maxSwapAmount = 4_294_96700000
minSwapAmount = 10000

minWalletBalance = 400_000_000_000
maxWalletBalance = 500_000_000_000
```

We recommend adding aliases to control executables of Boltz and nodes to your `.bashrc`:

```bash
# Boltz Docker regtest
boltzDir="<path to the cloned repository>"
boltzDataDir="$boltzDir/docker/regtest/data/"
boltzDataDir="$boltzDir/docker/regtest/data"

cookieDir="$boltzDataDir/core/cookies"

alias bitcoin-cli-sim='bitcoin-cli --regtest --rpccookiefile=$cookieDir/.bitcoin-cookie'
alias elements-cli-sim='elements-cli --regtest --rpcport=18884 --rpccookiefile=$cookieDir/.elements-cookie'

lndCert="$boltzDataDir/lnd/certificates/tls.cert"
lndMacaroon="$boltzDataDir/lnd/macaroons/admin.macaroon"

alias lnclibtc='lncli --rpcserver=127.0.0.1:10009 --tlscertpath=$lndCert --macaroonpath=$lndMacaroon'
alias lnclibtc2='lncli --rpcserver=127.0.0.1:10011 --tlscertpath=$lndCert --macaroonpath=$lndMacaroon'

alias lncliltc='lncli --rpcserver=127.0.0.1:11009 --tlscertpath=$lndCert --macaroonpath=$lndMacaroon'
alias lncliltc2='lncli --rpcserver=127.0.0.1:11010 --tlscertpath=$lndCert --macaroonpath=$lndMacaroon'

alias lightning-cli-sim='docker exec -it regtest lightning-cli'

# Add the Boltz executables to the path
export PATH="$boltzDir/bin:$PATH"
```

0 comments on commit d180636

Please sign in to comment.