diff --git a/compose/README.md b/compose/README.md index afecdb9..5bb5e6f 100644 --- a/compose/README.md +++ b/compose/README.md @@ -90,12 +90,16 @@ nano env/{namespace}/lnd.conf ``` If you were already running `robosats-deploy/compose` in another machine and need to recover, simply bring your existing environmental files from your backup. -In `/compose/env/compose...env` there is a variable named `SUFFIX` . This one is used to suffix all of your containers and configuration files. For example if you use `-tn` (for testnet), your bitcoind service will be called `btc-tn`, this is an effective way of creating namespaces. The example configuration in `/compose/env-sample/` uses the prefix `-lndtn`, for a LND testnet coordinator. This way, it is easy to run several coordinator orchestration in the same machine. For example, you can use the `-lndmn` prefix for a LND mainnet coordinator configuration or `-clntn` for a CLN Testnet configuration. You can also create alias shortcuts for each of your orchestration. +In `/compose/env/compose...env` there is a variable named `SUFFIX` . This one is used to suffix all of your containers and configuration files. For example if you use `-tn` (for testnet), your bitcoind service will be called `btc-tn`, this is an effective way of creating namespaces. The example configuration in `/compose/env-sample/` includes: +- `-lndtn` and `-clntn` for testnet3 +- `-lndtn4` and `-clntn4` for testnet4 +- `-lndmn` for mainnet +This way, it is easy to run several coordinator orchestrations on the same machine. You can also create alias shortcuts for each orchestration. ## Use aliases Docker commands are lengthy. You can use aliases to make your task of operating a docker compose based robosats coordinator easier. Take a look at `/compose/aliases.sh` for some useful aliases and shortcuts. -## Example commands for a lnd testnet orchestration (-lndtn containers) +## Example commands for a lnd testnet3 orchestration (-lndtn containers) If you install the aliases you can run the following shortcut commands: ``` @@ -130,6 +134,8 @@ Create p2wkh addresses `tn-lncli newaddress p2wkh` (note without alias this command would be ``docker exec -it lnd-lndtn lncli --network=testnet newaddress p2wkh``) +For testnet4 orchestration samples (`lndtn4`/`clntn4`), use `--network=testnet4` in direct `lncli` commands. + Wallet balance `tn-lncli walletbalance` diff --git a/compose/aliases.sh b/compose/aliases.sh index f39bac0..5645a9f 100644 --- a/compose/aliases.sh +++ b/compose/aliases.sh @@ -55,4 +55,21 @@ alias tn-manage="docker exec -it rs-lndtn python3 manage.py" # POSTGRESS # Example postgresql dump and restore. Unsafe! alias tn-pg-restore='docker exec -i sql-lndtn /bin/bash -c "PGPASSWORD=robotest psql --username postgres postgres" < /home/$(whoami)/backup/testnet/database/backup.sql' -alias tn-pg-backup='docker exec -i sql-lndtn /bin/bash -c "PGPASSWORD=robotest pg_dump --username postgres postgres" > /home/$(whoami)/backup/testnet/database/backup.sql' \ No newline at end of file +alias tn-pg-backup='docker exec -i sql-lndtn /bin/bash -c "PGPASSWORD=robotest pg_dump --username postgres postgres" > /home/$(whoami)/backup/testnet/database/backup.sql' + +################################################################################################################# +## ROBOTEST4 Docker-Compose (same aliases as above, but for a testnet4 `lndtn4` orchestration) + +alias tn4="docker compose -p lndtest4 --env-file /home/$(whoami)/robosats-deploy/compose/env/lndtn4/compose.env -f /home/$(whoami)/robosats-deploy/compose/docker-compose.yml -f /home/$(whoami)/robosats-deploy/compose/docker-compose.override-lnd.yml" + +## Once ROBOTEST4 is up! +# ROBOTEST4 LNCLI COMANDS +alias tn4-lncli="docker exec -it lnd-lndtn4 lncli --network=testnet4" + +# DJANGO MANAGE +alias tn4-manage="docker exec -it rs-lndtn4 python3 manage.py" + +# POSTGRESS +# Example postgresql dump and restore. Unsafe! +alias tn4-pg-restore='docker exec -i sql-lndtn4 /bin/bash -c "PGPASSWORD=robotest psql --username postgres postgres" < /home/$(whoami)/backup/testnet4/database/backup.sql' +alias tn4-pg-backup='docker exec -i sql-lndtn4 /bin/bash -c "PGPASSWORD=robotest pg_dump --username postgres postgres" > /home/$(whoami)/backup/testnet4/database/backup.sql' diff --git a/compose/env-sample/README.md b/compose/env-sample/README.md index 9e6e0bd..e1cea9e 100644 --- a/compose/env-sample/README.md +++ b/compose/env-sample/README.md @@ -1,3 +1,7 @@ ## Example environment and configuration files You can think of these as "Namespaces" for your orchestration. -You can find a LND Testnet example (lndtn) in `/compose/env-sample/lndtn` that will create containers suffixed with `-lndtn` and a CLN Testnet example in `/compose/env-sample/clntn` using the suffix `-clntn` . \ No newline at end of file +You can find: +- a LND testnet3 example (`lndtn`) in `/compose/env-sample/lndtn` using suffix `-lndtn` +- a CLN testnet3 example (`clntn`) in `/compose/env-sample/clntn` using suffix `-clntn` +- a LND testnet4 example (`lndtn4`) in `/compose/env-sample/lndtn4` using suffix `-lndtn4` +- a CLN testnet4 example (`clntn4`) in `/compose/env-sample/clntn4` using suffix `-clntn4` diff --git a/compose/env-sample/clntn4/bitcoin.conf b/compose/env-sample/clntn4/bitcoin.conf new file mode 100644 index 0000000..1a749ee --- /dev/null +++ b/compose/env-sample/clntn4/bitcoin.conf @@ -0,0 +1,38 @@ +# Reference: https://en.bitcoin.it/wiki/Running_Bitcoin +# https://github.com/bitcoin/bitcoin/blob/master/share/examples/bitcoin.conf + +server=1 +txindex=1 +onion=127.0.0.1:9050 +torcontrol=127.0.0.1:9051 +rpcuser=robosats_testnet4_bitcoind +rpcpassword=robosats_testnet4_bitcoind +zmqpubrawblock=tcp://127.0.0.1:18501 +zmqpubrawtx=tcp://127.0.0.1:18502 + +# limit upload bandwith (in MB per day) +maxuploadtarget=10 +# Allow RPC connections from outside of container localhost +rpcbind=0.0.0.0 +# Only connect to typical docker IP addresses (Usually from docker host computer) +rpcallowip=172.0.0.0/255.0.0.0 +# Allow access from any IP address (Usually from another computer on LAN) +#rpcallowip=0.0.0.0/0 + +# Run on the test network instead of the real bitcoin network. +testnet4=1 + +mempoolfullrbf=1 + +[main] +# Only run on Tor +onlynet=onion + +# Add Tor seed nodes +addnode=i4x66albngo3sg3w.onion:8333 + +# Some testnet4 settings needed for 0.19, if using testnet4 +[testnet4] +# Allow RPC connections from outside of container localhost +onlynet=onion +rpcbind=0.0.0.0 diff --git a/compose/env-sample/clntn4/cln_config b/compose/env-sample/clntn4/cln_config new file mode 100644 index 0000000..44122e0 --- /dev/null +++ b/compose/env-sample/clntn4/cln_config @@ -0,0 +1,10 @@ +network=testnet4 +proxy=127.0.0.1:9050 +bind-addr=127.0.0.1:9736 +addr=statictor:127.0.0.1:9051 +grpc-port=9999 +grpc-hold-port=9998 +always-use-proxy=true +important-plugin=/root/.lightning/plugins/cln-grpc-hold +# wallet=postgres://user:pass@localhost:5433/cln +# bookkeeper-db=postgres://user:pass@localhost:5433/cln \ No newline at end of file diff --git a/compose/env-sample/clntn4/compose.env b/compose/env-sample/clntn4/compose.env new file mode 100644 index 0000000..54e2501 --- /dev/null +++ b/compose/env-sample/clntn4/compose.env @@ -0,0 +1,69 @@ +# Uncomment the dockerhub tags to override the image versions localy without need to fork the docker-compose.yml + +# ROBOSATS_TAG='v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1' +# BITCOIND_TAG='24.0.1-alpine@sha256:624b6fb1c282a3db6438ff35fbb9eed6ae260c66ffbb427ae72edd7da6a0ecdc' +# REDIS_TAG='7.2.1-alpine@sha256:7f5a0dfbf379db69dc78434091dce3220e251022e71dcdf36207928cbf9010de' +# NGINX_TAG='1.25.2-alpine-slim@sha256:1b0cb433e90260a96528c987ee78b797e842d510473935304a0931536d10f50d' +# POSTGRES_TAG='14.2-alpine@sha256:2fb5718f2a23dbac9bd1258e886eee90250a5903785e3136d62dd65e19f34982' + +STATIC='/custom_path/testnet4/static' +DATABASE='/custom_path/testnet4/database' + +# You can create a cronjob to create PG backups +PG_BACKUP='/custom_path/testnet4/pg_backup' +ROBOSATS_ENVS_FILE='env/clntn4/robosats.env' +THUB_ENVS_FILE='env/clntn4/thunderhub.env' +SUFFIX='-clntn4' +NETWORK='testnet4' + +# Postgresql Database (Should match with those in robosats-tn.env) +POSTGRES_NAME='postgres' +POSTGRES_USER='postgres' +POSTGRES_PASSWORD='example' + +BITCOIND_VERSION='24.0.1-alpine' + +NGINX_CONFD='./nginx/tn.conf.d' +WELLKNOWN='./nginx/tn.well-known' + +# Port and number of HTTP server workers for the robosats backend +WEB_LOCAL_PORT=8001 +GUNICORN_WORKERS=2 + +BU_DIR1='/backup' +BU_DIR2='/custom_path/backup' +BU_DIR3='/custom_path/backup2' + +BITCOIN_DATA='/custom_path/testnet4/bitcoin' +BITCOIN_CONF='./env/clntn4/bitcoin.conf' +CLN_DATA='/custom_path/testnet4/cln' +CLN_CONF='./env/clntn4/cln_config' +LIT_DATA='/custom_path/testnet4/lit' + +GUEST_BITCOIN=/home/bitcoin/.bitcoin + +TOR_DATA='./env/lndtn4/tor' +TOR_CONFIG='./env/lndtn4/torrc' + +GUEST_LND_RPC_PORT=10009 +GUEST_LND_REST_PORT=8080 + +HOST_LND_RPC_PORT=10009 +HOST_LND_REST_PORT=8080 + +THUB_LOCAL_PORT=3001 +THUB_ACCOUNTS='./env/clntn4/thunderhub-accounts.yml' +# THUB_ACCOUNTS_CONFIG_PATH must match thub...env +THUB_ACCOUNTS_CONFIG_PATH='/config/accounts.yml' + + + + +LIT_LOCAL_PORT=4001 +LIT_PASSWORD=999999999 + +LND_BACKUP_PATH='/custom_path/testnet4/lnd-backup' +NODE_ALIAS='šŸ¤–RoboSats⚔(Testnet4)' +NODE_COLOR='#4126a7' + +LND_AUTOUNLOCK_PWD='./env/clntn4/lnd_autounlock_pwd' diff --git a/compose/env-sample/clntn4/robosats.env b/compose/env-sample/clntn4/robosats.env new file mode 100644 index 0000000..b895694 --- /dev/null +++ b/compose/env-sample/clntn4/robosats.env @@ -0,0 +1,183 @@ +# Coordinator Alias (Same as longAlias) +COORDINATOR_ALIAS="coordinator_NAME_CLN" +# Lightning node vendor: CLN | LND +LNVENDOR='CLN' + +# LND configuration (only needed if LNVENDOR='LND') +# LND directory to read TLS cert and macaroon +#LND_DIR='/lnd/' +#MACAROON_PATH='data/chain/bitcoin/testnet4/admin.macaroon' + +# If LND directory is not specified, cert and macaroon can be provided as base64 strings +# base64 ~/.lnd/tls.cert | tr -d '\n' +#LND_CERT_BASE64='LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNLVENDQWRDZ0F3SUJBZ0lRQ0VoeGpPZXY1bGQyVFNPTXhKalFvekFLQmdncWhrak9QUVFEQWpBNE1SOHcKSFFZRFZRUUtFeFpzYm1RZ1lYVjBiMmRsYm1WeVlYUmxaQ0JqWlhKME1SVXdFd1lEVlFRREV3d3dNakJtTVRnMQpZelkwTnpVd0hoY05Nakl3TWpBNE1UWXhOalV3V2hjTk1qTXdOREExTVRZeE5qVXdXakE0TVI4d0hRWURWUVFLCkV4WnNibVFnWVhWMGIyZGxibVZ5WVhSbFpDQmpaWEowTVJVd0V3WURWUVFERXd3d01qQm1NVGcxWXpZME56VXcKV1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVNJVWdkcVMrWFZKL3EzY0JZeWd6ZDc2endaanlmdQpLK3BzcWNYVkFyeGZjU2NXQ25jbXliNGRaMy9Lc3lLWlRaamlySDE3aEY0OGtIMlp5clRZSW9hZG80RzdNSUc0Ck1BNEdBMVVkRHdFQi93UUVBd0lDcERBVEJnTlZIU1VFRERBS0JnZ3JCZ0VGQlFjREFUQVBCZ05WSFJNQkFmOEUKQlRBREFRSC9NQjBHQTFVZERnUVdCQlEwWUJjZXdsd1BqYTJPRXFyTGxzZnJscEswUFRCaEJnTlZIUkVFV2pCWQpnZ3d3TWpCbU1UZzFZelkwTnpXQ0NXeHZZMkZzYUc5emRJSUVkVzVwZUlJS2RXNXBlSEJoWTJ0bGRJSUhZblZtClkyOXVib2NFZndBQUFZY1FBQUFBQUFBQUFBQUFBQUFBQUFBQUFZY0V3S2dRQW9jRUFBQUFBREFLQmdncWhrak8KUFFRREFnTkhBREJFQWlBd0dMY05qNXVZSkVwanhYR05OUnNFSzAwWmlSUUh2Qm50NHp6M0htWHBiZ0lnSWtvUQo3cHFvNGdWNGhiczdrSmt1bnk2bkxlNVg0ZzgxYjJQOW52ZnZ2bkk9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K' +# base64 ~/.lnd/data/chain/bitcoin/testnet4/admin.macaroon | tr -d '\n' +#LND_MACAROON_BASE64='AgEDbG5kAvgBAwoQsyI+PK+fyb7F2UyTeZ4seRIBMBoWCgdhZGRyZXNzEgRyZWFkEgV3cml0ZRoTCgRpbmZvEgRyZWFkEgV3cml0ZRoXCghpbnZvaWNlcxIEcmVhZBIFd3JpdGUaIQoIbWFjYXJvb24SCGdlbmVyYXRlEgRyZWFkEgV3cml0ZRoWCgdtZXNzYWdlEgRyZWFkEgV3cml0ZRoXCghvZmZjaGFpbhIEcmVhZBIFd3JpdGUaFgoHb25jaGFpbhIEcmVhZBIFd3JpdGUaFAoFcGVlcnMSBHJlYWQSBXdyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgMt90uD6v4truTadWCjlppoeJ4hZrL1SBb09Y+4WOiI0=' + +# CLN directory (only needed if LNVENDOR='CLN') +CLN_DIR='/cln/testnet4/' +CLN_GRPC_HOST='localhost:9999' +CLN_GRPC_HOLD_HOST='localhost:9998' + +# Bitcoin Core Daemon RPC, used to validate addresses +BITCOIND_RPCURL = 'http://127.0.0.1:48332' +BITCOIND_RPCUSER = 'robosats_testnet4_bitcoind' +BITCOIND_RPCPASSWORD = 'robosats_testnet4_bitcoind' + +# Auto unlock LND password. Only used in development docker-compose environment. +# It will fail starting up the node without it. +# To disable auto unlock, comment out 'wallet-unlock-password-file=/tmp/pwd' from 'docker/lnd/lnd.conf' +LND_GRPC_HOST='localhost:10009' + +REDIS_URL='redis://localhost:6379/1' + +# Postgresql Database (These are fed from STACK-XX.env) +# Deprecated +POSTGRES_NAME='postgres' +# New +POSTGRES_DB='postgres' +POSTGRES_USER='postgres' +POSTGRES_PASSWORD='example' +POSTGRES_HOST='127.0.0.1' +POSTGRES_PORT='5432' + +# Tor proxy for remote calls (e.g. fetching prices or sending Telegram messages) +USE_TOR='True' +TOR_PROXY='127.0.0.1:9050' + +# Local nostr relay +STRFRY_HOST = 'localhost' +STRFRY_PORT = '7778' + +# List of market price public APIs. If the currency is available in more than 1 API, will use median price. +MARKET_PRICE_APIS = 'https://blockchain.info/ticker, https://api.yadio.io/exrates/BTC' + +# Host e.g. 'robotesta15gf7845r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion' +HOST_NAME = 'robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion' +HOST_NAME2 = '*' # Do not change +I2P_ALIAS = '' +I2P_LONG = '' +LOCAL_ALIAS = '' +ONION_LOCATION = 'robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion' + +# Geoblocked countries (will reject F2F trades). +# List of A3 country codes (see fhttps://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) +# Leave empty '' to allow all countries. +# Example 'NOR,USA,CZE'. +GEOBLOCKED_COUNTRIES = 'ABW,AFG,AGO' + +# Link to robosats alternative site (shown in frontend in statsfornerds so users can switch mainnet/testnet4) +ALTERNATIVE_SITE = 'RoboSats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion' +ALTERNATIVE_NAME = 'RoboSats Mainnet' + +SECRET_KEY= 'n098eafh82390fu9283uyt9yf023uf' + +# Link to robosats mainnet/testnet4 (shown on frontend in statsfornerds so users can switch mainnet/testnet4) +THE_OTHER_ROBOSATS = 'robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion' + +# Telegram bot token +TELEGRAM_TOKEN = '' +TELEGRAM_BOT_NAME = '' +# Telegram chat id to receive admin notifications +TELEGRAM_COORDINATOR_CHAT_ID = 'AdminNotificationChatId' +# Notify new messages in-chat app (fiat exchange step) if at least X minutes has passed since the last chat message. +CHAT_NOTIFICATION_TIMEGAP = 5 + +# Maintainance notice or and other coordinator messages on client start +# Style of the notice on the client app, use None for no notice: 'None' | 'Warning' | 'Success' | 'Error' | 'Info' +NOTICE_SEVERITY = 'info' +NOTICE_MESSAGE = 'This is a coordinator message with LINK' + +# Lightning node open info, url to amboss and 1ML +NETWORK = 'testnet4' +NODE_ALIAS = 'šŸ¤–RoboSats⚔(Coordinator_NAME)' +NODE_ID = '028.....' + +# Total trade fee as fraction +FEE = 0.002 +# Maker/taker fee split. As seen in https://bisq.wiki/Trading_fees . It is implicit that TAKER_FEE_SPLIT = (1 - MAKER_FEE_SPLIT) +# Shall incentivize order making +MAKER_FEE_SPLIT=0.125 + +# Time out penalty for canceling takers in SECONDS +PENALTY_TIMEOUT = 60 +# Time between routing attempts of buyer invoice in MINUTES +RETRY_TIME = 1 + +# Store Order Logs in DB. Verbose logging for each order as property of the order object in DB. Useful for debugging and for learning +# the order flow for new robosats coordinators (prints a pretty timestamped table on the coordinator panel on each order). But a bit heavy +# on write operations and can potentially affect performance for every request. +DISABLE_ORDER_LOGS = False + +# Robosats Development Fund donation as fraction. 0.2 = 20% of successful orders proceeds are donated via keysend. +# Donations to the devfund are important for the sustainabilty of the project, however, these are totally optional (you +# can run a coordinator without donating devfund!). Coordinators with higher devfund donations % will be more prominently +# displayed (and have special badges), while coordinators that do not donate might eventually lose frontend/client support. +# Leaving the default value (20%) will grant the DevFund contributor badge. +DEVFUND = 0.2 + +# Coordinator activity limits +MAX_PUBLIC_ORDERS = 100 + +# Trade limits in satoshis +MIN_TRADE = 20000 +MAX_TRADE = 5000000 + +# For CLTV_expiry calculation +# Assume 8 min/block assumed +BLOCK_TIME = 8 +# Safety multiplier in case of mining speed up (CLTV expiry will be times X larger than real time needs for locked bonds/escrow) +MAX_MINING_NETWORK_SPEEDUP_EXPECTED = 1.7 + +# Expiration time for locking collateral in SECONDS +EXP_MAKER_BOND_INVOICE = 300 +EXP_TAKER_BOND_INVOICE = 200 + +# ROUTING +# Proportional routing fee limit (fraction of total payout: % / 100) +PROPORTIONAL_ROUTING_FEE_LIMIT = 0.001 +# Base flat limit fee for routing in Sats (used only when proportional is lower than this) +MIN_FLAT_ROUTING_FEE_LIMIT_REWARD = 2 +# Routing timeouts +REWARDS_TIMEOUT_SECONDS = 30 +PAYOUT_TIMEOUT_SECONDS = 90 +DEBUG_PERMISSIONED_PAYOUTS = False + +# Allow self keysend on keysend function (set true to debug keysend functionality) +ALLOW_SELF_KEYSEND = False + +# REVERSE SUBMARINE SWAP PAYOUTS +# Disable on-the-fly swaps feature +DISABLE_ONCHAIN = False +# Shape of fee to available liquidity curve. Either "linear" or "exponential" +SWAP_FEE_SHAPE = 'exponential' +# EXPONENTIAL. fee (%) = MIN_SWAP_FEE + (MAX_SWAP_FEE - MIN_SWAP_FEE) * e ^ (-LAMBDA * onchain_liquidity_fraction) +SWAP_LAMBDA = 8.8 +# LINEAR. 4 parameters needed: min/max fees and min/max balance points. E.g. If 25% or more of liquidity +# is onchain the fee for swap is 2% (minimum), if it is 12% fee is 6%, and for 0% fee is 10%. +# Minimum swap fee as fraction (1%) +MIN_SWAP_FEE = 0.008 +# Liquidity split point (LN/onchain) at which we use MIN_SWAP_FEE +MIN_SWAP_POINT = 0.35 +# Maximum swap fee as fraction (~10%) +MAX_SWAP_FEE = 0.1 +# Liquidity split point (LN/onchain) at which we use MAX_SWAP_FEE +MAX_SWAP_POINT = 0 +# Min and Max amount allowed for Swap +MIN_SWAP_AMOUNT = 10000 +MAX_SWAP_AMOUNT = 1000000 +# Spend Unconfirmed UTXOS (more capital efficient, more risky) +SPEND_UNCONFIRMED = False +# Mining fee confirmation target +SUGGESTED_TARGET_CONF = 4 +MINIMUM_TARGET_CONF = 24 + +# Fraction rewarded to user from the slashed bond of a counterpart. +# It should not be close to 1, or could be exploited by an attacker trading with himself to DDOS the LN node. +SLASHED_BOND_REWARD_SPLIT = 0.5 + +# Username for HTLCs escrows +ESCROW_USERNAME = 'admin' + +#Social +NOSTR_NSEC = 'nsec1vxhs2zc4kqe0dhz4z2gfrdyjsrwf8pg3neeqx6w4nl8djfzdp0dqwd6rxh' diff --git a/compose/env-sample/clntn4/tor/.gikeep b/compose/env-sample/clntn4/tor/.gikeep new file mode 100644 index 0000000..e69de29 diff --git a/compose/env-sample/clntn4/torrc b/compose/env-sample/clntn4/torrc new file mode 100644 index 0000000..3043480 --- /dev/null +++ b/compose/env-sample/clntn4/torrc @@ -0,0 +1,12 @@ +Log notice file /var/log/tor/notices.log + +## The directory for keeping all the keys/etc. By default, we store +## things in $HOME/.tor on Unix, and in Application Data\tor on Windows. +DataDirectory /var/lib/tor +DataDirectoryGroupReadable 1 + +## Enable ControlPort +ControlPort 9051 +CookieAuthentication 1 +CookieAuthFileGroupReadable 1 +CookieAuthFile /var/lib/tor/control_auth_cookie diff --git a/compose/env-sample/lndtn4/bitcoin.conf b/compose/env-sample/lndtn4/bitcoin.conf new file mode 100644 index 0000000..1a749ee --- /dev/null +++ b/compose/env-sample/lndtn4/bitcoin.conf @@ -0,0 +1,38 @@ +# Reference: https://en.bitcoin.it/wiki/Running_Bitcoin +# https://github.com/bitcoin/bitcoin/blob/master/share/examples/bitcoin.conf + +server=1 +txindex=1 +onion=127.0.0.1:9050 +torcontrol=127.0.0.1:9051 +rpcuser=robosats_testnet4_bitcoind +rpcpassword=robosats_testnet4_bitcoind +zmqpubrawblock=tcp://127.0.0.1:18501 +zmqpubrawtx=tcp://127.0.0.1:18502 + +# limit upload bandwith (in MB per day) +maxuploadtarget=10 +# Allow RPC connections from outside of container localhost +rpcbind=0.0.0.0 +# Only connect to typical docker IP addresses (Usually from docker host computer) +rpcallowip=172.0.0.0/255.0.0.0 +# Allow access from any IP address (Usually from another computer on LAN) +#rpcallowip=0.0.0.0/0 + +# Run on the test network instead of the real bitcoin network. +testnet4=1 + +mempoolfullrbf=1 + +[main] +# Only run on Tor +onlynet=onion + +# Add Tor seed nodes +addnode=i4x66albngo3sg3w.onion:8333 + +# Some testnet4 settings needed for 0.19, if using testnet4 +[testnet4] +# Allow RPC connections from outside of container localhost +onlynet=onion +rpcbind=0.0.0.0 diff --git a/compose/env-sample/lndtn4/compose.env b/compose/env-sample/lndtn4/compose.env new file mode 100644 index 0000000..f5cefad --- /dev/null +++ b/compose/env-sample/lndtn4/compose.env @@ -0,0 +1,81 @@ +# Uncomment the dockerhub tags to override the image versions localy without need to fork the docker-compose.yml + +# ROBOSATS_TAG='v0.6.0-alpha@sha256:8cc975ff5942a3fb2a09827b8eaafebea1c851eb3ecf9be1aaac1f238cfa9fc1' +# BITCOIND_TAG='24.0.1-alpine@sha256:624b6fb1c282a3db6438ff35fbb9eed6ae260c66ffbb427ae72edd7da6a0ecdc' +# REDIS_TAG='7.2.1-alpine@sha256:7f5a0dfbf379db69dc78434091dce3220e251022e71dcdf36207928cbf9010de' +# NGINX_TAG='1.25.2-alpine-slim@sha256:1b0cb433e90260a96528c987ee78b797e842d510473935304a0931536d10f50d' +# POSTGRES_TAG='14.2-alpine@sha256:2fb5718f2a23dbac9bd1258e886eee90250a5903785e3136d62dd65e19f34982' + +# LND_TAG='v0.17.4-beta@sha256:668eba1fdb1ac520292db95a57059be91895fb8af076eafd6c8b5e757f0f196c' +# THUNDERHUB_TAG='v0.13.23@sha256:5ad834045dc3030ec199615827c415ca07729da32c4739afd3adfc662af4fe65' +# LIT_TAG='v0.11.0-alpha@sha256:dc14c495f699b14c2d75c43097ad3ab40e7287fc136a3203df9cffe17b867b71' + +STATIC='/custom_path/testnet4/static' +DATABASE='/custom_path/testnet4/database' + +# You can create a cronjob to create PG backups +PG_BACKUP='/custom_path/testnet4/pg_backup' +ROBOSATS_ENVS_FILE='env/lndtn4/robosats.env' +THUB_ENVS_FILE='env/lndtn4/thunderhub.env' +SUFFIX='-lndtn4' +NETWORK='testnet4' + +# Postgresql Database (Should match with those in robosats-tn.env) +POSTGRES_NAME='postgres' +POSTGRES_USER='postgres' +POSTGRES_PASSWORD='example' + +NGINX_CONFD='./nginx/tn.conf.d' +WELLKNOWN='./nginx/tn.well-known' + +RELAY_CONF='./env-sample/lndtn4/relay.strfry.conf' +RELAY_URLS_EXTERNAL='./relay/tn.external_urls.txt' +RELAY_URLS_FEDERATION='./relay/tn.federation_urls.txt' +RELAY_DATA='/custom_path/testnet4/relay' + +# Port and number of HTTP server workers for the robosats backend +WEB_LOCAL_PORT=8001 +GUNICORN_WORKERS=2 + +BU_DIR1='/backup' +BU_DIR2='/custom_path/backup' +BU_DIR3='/custom_path/backup2' + +BITCOIN_DATA='/custom_path/testnet4/bitcoin' +BITCOIN_CONF='./env-sample/lndtn4/bitcoin.conf' +LND_DATA='/custom_path/testnet4/lnd' +LND_CONF='./env-sample/lndtn4/lnd.conf' +LIT_DATA='/custom_path/testnet4/lit' + +GUEST_BITCOIN=/home/bitcoin/.bitcoin + +TOR_DATA='./env-sample/lndtn4/tor' +TOR_CONFIG='./env-sample/lndtn4/torrc' + +GUEST_LND_RPC_PORT=10009 +GUEST_LND_REST_PORT=8080 + +HOST_LND_RPC_PORT=10009 +HOST_LND_REST_PORT=8080 + +THUB_LOCAL_PORT=3001 +THUB_ACCOUNTS='./env-sample/lndtn4/thunderhub-accounts.yml' +# THUB_ACCOUNTS_CONFIG_PATH must match thub...env +THUB_ACCOUNTS_CONFIG_PATH='/config/accounts.yml' + +LNDG_CONFIG='./env-sample/lndtn4/supervisord.conf' +LNDG_DATA='/custom_path/testnet4/lndg/data' +LNDG_PASSWORD=999999999 + +LIT_LOCAL_PORT=4001 +LIT_PASSWORD=999999999 + +LND_BACKUP_PATH='/custom_path/testnet4/lnd-backup' +NODE_ALIAS='šŸ¤–RoboSats⚔(Testnet4)' +NODE_COLOR='#4126a7' + +LND_AUTOUNLOCK_PWD='./env-sample/lndtn4/lnd_autounlock_pwd' + +# Blossom server +BLOSSOM_CONFIG=./blossom/config.yml +BLOSSOM_DATA=/custom_path/testnet4/blossom_data diff --git a/compose/env-sample/lndtn4/lnd.conf b/compose/env-sample/lndtn4/lnd.conf new file mode 100644 index 0000000..bd6b513 --- /dev/null +++ b/compose/env-sample/lndtn4/lnd.conf @@ -0,0 +1,46 @@ +# Reference: https://github.com/lightningnetwork/lnd/blob/master/sample-lnd.conf + +debuglevel=info +alias=šŸ¤–RoboSats⚔ COORDINATOR_NAME +color=#4126a7 +maxpendingchannels=6 +bitcoin.active=1 +bitcoin.testnet4=1 +bitcoin.node=bitcoind +bitcoind.rpcuser=robosats_testnet4_bitcoind +bitcoind.rpcpass=robosats_testnet4_bitcoind +bitcoind.zmqpubrawblock=tcp://127.0.0.1:18501 +bitcoind.zmqpubrawtx=tcp://127.0.0.1:18502 + +# /robosats-deploy/compose/env/{namespace}/lnd_autounlock_pwd is mounted to /tmp/pwd +wallet-unlock-password-file=/tmp/pwd + + +routerrpc.estimator=bimodal +routerrpc.bimodal.scale=300000000 +routerrpc.bimodal.nodeweight=0.2 +routerrpc.bimodal.decaytime=100h + +accept-amp=true +accept-keysend=true +protocol.wumbo-channels=true + +# Neutrino +neutrino.connect=faucet.lightning.community + +# needed for lit > 0.9.0 +rpcmiddleware.enable=true + + +# Configuring Tor docs: +# https://github.com/lightningnetwork/lnd/blob/master/docs/configuring_tor.md +tor.active=1 +tor.v3=1 + +# Listening port will need to be changed if multiple LND instances are running +listen=localhost:9735 + +# Allow connection to gRPC from host +rpclisten=0.0.0.0:10009 +restlisten=0.0.0.0:8080 +tlsextraip=0.0.0.0 diff --git a/compose/env-sample/lndtn4/lnd_autounlock_pwd b/compose/env-sample/lndtn4/lnd_autounlock_pwd new file mode 100644 index 0000000..e9a9ea1 --- /dev/null +++ b/compose/env-sample/lndtn4/lnd_autounlock_pwd @@ -0,0 +1 @@ +12345678 \ No newline at end of file diff --git a/compose/env-sample/lndtn4/relay.strfry.conf b/compose/env-sample/lndtn4/relay.strfry.conf new file mode 100644 index 0000000..2109056 --- /dev/null +++ b/compose/env-sample/lndtn4/relay.strfry.conf @@ -0,0 +1,138 @@ +## +## Default strfry config +## + +# Directory that contains the strfry LMDB database (restart required) +db = "/app/strfry-db/" + +dbParams { + # Maximum number of threads/processes that can simultaneously have LMDB transactions open (restart required) + maxreaders = 256 + + # Size of mmap() to use when loading LMDB (default is 10TB, does *not* correspond to disk-space used) (restart required) + mapsize = 10995116277760 + + # Disables read-ahead when accessing the LMDB mapping. Reduces IO activity when DB size is larger than RAM. (restart required) + noReadAhead = false +} + +events { + # Maximum size of normalised JSON, in bytes + maxEventSize = 65536 + + # Events newer than this will be rejected + rejectEventsNewerThanSeconds = 900 + + # Events older than this will be rejected + rejectEventsOlderThanSeconds = 94608000 + + # Ephemeral events older than this will be rejected + rejectEphemeralEventsOlderThanSeconds = 60 + + # Ephemeral events will be deleted from the DB when older than this + ephemeralEventsLifetimeSeconds = 300 + + # Maximum number of tags allowed + maxNumTags = 2000 + + # Maximum size for tag values, in bytes + maxTagValSize = 1024 +} + +relay { + # Interface to listen on. Use 0.0.0.0 to listen on all interfaces (restart required) + bind = "0.0.0.0" + + # Port to open for the nostr websocket protocol (restart required) + port = 7778 + + # Set OS-limit on maximum number of open files/sockets (if 0, don't attempt to set) (restart required) + nofiles = 524288 + + # HTTP header that contains the client's real IP, before reverse proxying (ie x-real-ip) (MUST be all lower-case) + realIpHeader = "" + + info { + # NIP-11: Name of this server. Short/descriptive (< 30 characters) + name = "Robosats" + + # NIP-11: Detailed information about relay, free-form + description = "Federation cache system." + + # NIP-11: Administrative nostr pubkey, for contact purposes + pubkey = "" + + # NIP-11: Alternative administrative contact (email, website, etc) + contact = "" + } + + # Maximum accepted incoming websocket frame size (should be larger than max event) (restart required) + maxWebsocketPayloadSize = 131072 + + # Websocket-level PING message frequency (should be less than any reverse proxy idle timeouts) (restart required) + autoPingSeconds = 55 + + # If TCP keep-alive should be enabled (detect dropped connections to upstream reverse proxy) + enableTcpKeepalive = false + + # How much uninterrupted CPU time a REQ query should get during its DB scan + queryTimesliceBudgetMicroseconds = 10000 + + # Maximum records that can be returned per filter + maxFilterLimit = 500 + + # Maximum number of subscriptions (concurrent REQs) a connection can have open at any time + maxSubsPerConnection = 3 + + writePolicy { + # If non-empty, path to an executable script that implements the writePolicy plugin logic + plugin = "" + } + + compression { + # Use permessage-deflate compression if supported by client. Reduces bandwidth, but slight increase in CPU (restart required) + enabled = true + + # Maintain a sliding window buffer for each connection. Improves compression, but uses more memory (restart required) + slidingWindow = false + } + + logging { + # Dump all incoming messages + dumpInAll = false + + # Dump all incoming EVENT messages + dumpInEvents = false + + # Dump all incoming REQ/CLOSE messages + dumpInReqs = false + + # Log performance metrics for initial REQ database scans + dbScanPerf = false + + # Log reason for invalid event rejection? Can be disabled to silence excessive logging + invalidEvents = true + } + + numThreads { + # Ingester threads: route incoming requests, validate events/sigs (restart required) + ingester = 3 + + # reqWorker threads: Handle initial DB scan for events (restart required) + reqWorker = 3 + + # reqMonitor threads: Handle filtering of new events (restart required) + reqMonitor = 3 + + # negentropy threads: Handle negentropy protocol messages (restart required) + negentropy = 2 + } + + negentropy { + # Support negentropy protocol messages + enabled = true + + # Maximum records that sync will process before returning an error + maxSyncEvents = 1000000 + } +} diff --git a/compose/env-sample/lndtn4/robosats.env b/compose/env-sample/lndtn4/robosats.env new file mode 100644 index 0000000..39d6e60 --- /dev/null +++ b/compose/env-sample/lndtn4/robosats.env @@ -0,0 +1,186 @@ +# Coordinator Alias (Same as longAlias) +COORDINATOR_ALIAS="coordinator_NAME" +# Lightning node vendor: CLN | LND +LNVENDOR='LND' + +# LND directory to read TLS cert and macaroon +LND_DIR='/lnd/' +MACAROON_PATH='data/chain/bitcoin/testnet4/admin.macaroon' + +# If LND directory is not specified, cert and macaroon can be provided as base64 strings +# base64 ~/.lnd/tls.cert | tr -d '\n' +LND_CERT_BASE64='LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUNLVENDQWRDZ0F3SUJBZ0lRQ0VoeGpPZXY1bGQyVFNPTXhKalFvekFLQmdncWhrak9QUVFEQWpBNE1SOHcKSFFZRFZRUUtFeFpzYm1RZ1lYVjBiMmRsYm1WeVlYUmxaQ0JqWlhKME1SVXdFd1lEVlFRREV3d3dNakJtTVRnMQpZelkwTnpVd0hoY05Nakl3TWpBNE1UWXhOalV3V2hjTk1qTXdOREExTVRZeE5qVXdXakE0TVI4d0hRWURWUVFLCkV4WnNibVFnWVhWMGIyZGxibVZ5WVhSbFpDQmpaWEowTVJVd0V3WURWUVFERXd3d01qQm1NVGcxWXpZME56VXcKV1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVNJVWdkcVMrWFZKL3EzY0JZeWd6ZDc2endaanlmdQpLK3BzcWNYVkFyeGZjU2NXQ25jbXliNGRaMy9Lc3lLWlRaamlySDE3aEY0OGtIMlp5clRZSW9hZG80RzdNSUc0Ck1BNEdBMVVkRHdFQi93UUVBd0lDcERBVEJnTlZIU1VFRERBS0JnZ3JCZ0VGQlFjREFUQVBCZ05WSFJNQkFmOEUKQlRBREFRSC9NQjBHQTFVZERnUVdCQlEwWUJjZXdsd1BqYTJPRXFyTGxzZnJscEswUFRCaEJnTlZIUkVFV2pCWQpnZ3d3TWpCbU1UZzFZelkwTnpXQ0NXeHZZMkZzYUc5emRJSUVkVzVwZUlJS2RXNXBlSEJoWTJ0bGRJSUhZblZtClkyOXVib2NFZndBQUFZY1FBQUFBQUFBQUFBQUFBQUFBQUFBQUFZY0V3S2dRQW9jRUFBQUFBREFLQmdncWhrak8KUFFRREFnTkhBREJFQWlBd0dMY05qNXVZSkVwanhYR05OUnNFSzAwWmlSUUh2Qm50NHp6M0htWHBiZ0lnSWtvUQo3cHFvNGdWNGhiczdrSmt1bnk2bkxlNVg0ZzgxYjJQOW52ZnZ2bkk9Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K' +# base64 ~/.lnd/data/chain/bitcoin/testnet4/admin.macaroon | tr -d '\n' +LND_MACAROON_BASE64='AgEDbG5kAvgBAwoQsyI+PK+fyb7F2UyTeZ4seRIBMBoWCgdhZGRyZXNzEgRyZWFkEgV3cml0ZRoTCgRpbmZvEgRyZWFkEgV3cml0ZRoXCghpbnZvaWNlcxIEcmVhZBIFd3JpdGUaIQoIbWFjYXJvb24SCGdlbmVyYXRlEgRyZWFkEgV3cml0ZRoWCgdtZXNzYWdlEgRyZWFkEgV3cml0ZRoXCghvZmZjaGFpbhIEcmVhZBIFd3JpdGUaFgoHb25jaGFpbhIEcmVhZBIFd3JpdGUaFAoFcGVlcnMSBHJlYWQSBXdyaXRlGhgKBnNpZ25lchIIZ2VuZXJhdGUSBHJlYWQAAAYgMt90uD6v4truTadWCjlppoeJ4hZrL1SBb09Y+4WOiI0=' + +# CLN directory (only needed if LNVENDOR='CLN') +CLN_DIR='/cln/testnet4/' +CLN_GRPC_HOST='localhost:9999' +CLN_GRPC_HOLD_HOST='localhost:9998' + +# Bitcoin Core Daemon RPC, used to validate addresses +# For mainnet the URL port is 8332 +BITCOIND_RPCURL = 'http://127.0.0.1:48332' +BITCOIND_RPCUSER = 'robosats_testnet4_bitcoind' +BITCOIND_RPCPASSWORD = 'robosats_testnet4_bitcoind' + +# Auto unlock LND password. Only used in development docker-compose environment. +# It will fail starting up the node without it. +# To disable auto unlock, comment out 'wallet-unlock-password-file=/tmp/pwd' from 'docker/lnd/lnd.conf' +LND_GRPC_HOST='localhost:10009' + +REDIS_URL='redis://localhost:6379/1' + +# Postgresql Database (These are fed from STACK-XX.env) +# Deprecated +POSTGRES_NAME='postgres' +# New +POSTGRES_DB='postgres' +POSTGRES_USER='postgres' +POSTGRES_PASSWORD='example' +POSTGRES_HOST='127.0.0.1' +POSTGRES_PORT='5432' + +# Tor proxy for remote calls (e.g. fetching prices or sending Telegram messages) +USE_TOR='True' +TOR_PROXY='127.0.0.1:9050' + +# Local nostr relay +STRFRY_HOST = 'localhost' +STRFRY_PORT = '7778' + +# List of market price public APIs. If the currency is available in more than 1 API, will use median price. +MARKET_PRICE_APIS = 'https://blockchain.info/ticker, https://api.yadio.io/exrates/BTC' + +# Host e.g. 'robotesta15gf7845r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion' +HOST_NAME = 'robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion' +HOST_NAME2 = '*' # Do not change +I2P_ALIAS = '' +I2P_LONG = '' +LOCAL_ALIAS = '' +ONION_LOCATION = 'robotestagw3dcxmd66r4rgksb4nmmr43fh77bzn2ia2eucduyeafnyd.onion' + +# Geoblocked countries (will reject F2F trades). +# List of A3 country codes (see fhttps://en.wikipedia.org/wiki/ISO_3166-1_alpha-3) +# Leave empty '' to allow all countries. +# Example 'NOR,USA,CZE'. +GEOBLOCKED_COUNTRIES = 'ABW,AFG,AGO' + +# Link to robosats alternative site (shown in frontend in statsfornerds so users can switch mainnet/testnet4) +ALTERNATIVE_SITE = 'RoboSats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion' +ALTERNATIVE_NAME = 'RoboSats Mainnet' + +SECRET_KEY= 'n098eafh82390fu9283uyt9yf023uf' + +# Link to robosats mainnet/testnet4 (shown on frontend in statsfornerds so users can switch mainnet/testnet4) +THE_OTHER_ROBOSATS = 'robosats6tkf3eva7x2voqso3a5wcorsnw34jveyxfqi2fu7oyheasid.onion' + +# Telegram bot token +TELEGRAM_TOKEN = '' +TELEGRAM_BOT_NAME = '' +# Telegram chat id to receive admin notifications +TELEGRAM_COORDINATOR_CHAT_ID = 'AdminNotificationChatId' + +# Notify new messages in-chat app (fiat exchange step) if at least X minutes has passed since the last chat message. +CHAT_NOTIFICATION_TIMEGAP = 5 + +# Maintainance notice or and other coordinator messages on client start +# Style of the notice on the client app, use None for no notice: 'None' | 'Warning' | 'Success' | 'Error' | 'Info' +NOTICE_SEVERITY = 'info' +NOTICE_MESSAGE = 'This is a coordinator message with LINK' + +# Lightning node open info, url to amboss and 1ML +NETWORK = 'testnet4' +NODE_ALIAS = 'šŸ¤–RoboSats⚔(Coordinator_NAME)' +NODE_ID = '028.....' + +# Total trade fee as fraction +FEE = 0.002 +# Maker/taker fee split. As seen in https://bisq.wiki/Trading_fees . It is implicit that TAKER_FEE_SPLIT = (1 - MAKER_FEE_SPLIT) +# Shall incentivize order making +MAKER_FEE_SPLIT=0.125 + +# Time out penalty for canceling takers in SECONDS +PENALTY_TIMEOUT = 60 +# Time between routing attempts of buyer invoice in MINUTES +RETRY_TIME = 1 + +# Store Order Logs in DB. Verbose logging for each order as property of the order object in DB. Useful for debugging and for learning +# the order flow for new robosats coordinators (prints a pretty timestamped table on the coordinator panel on each order). But a bit heavy +# on write operations and can potentially affect performance for every request. +DISABLE_ORDER_LOGS = False + +# Robosats Development Fund donation as fraction. 0.2 = 20% of successful orders proceeds are donated via keysend. +# Donations to the devfund are important for the sustainabilty of the project, however, these are totally optional (you +# can run a coordinator without donating devfund!). Coordinators with higher devfund donations % will be more prominently +# displayed (and have special badges), while coordinators that do not donate might eventually lose frontend/client support. +# Leaving the default value (20%) will grant the DevFund contributor badge. +DEVFUND = 0.2 + +# Coordinator activity limits +MAX_PUBLIC_ORDERS = 100 + +# Coordinator Order size limits in Satoshi +# Minimum order size (must be bigger than DB constrain in /robosats/settings.py MIN_TRADE, currently 20_000 Sats) +MIN_ORDER_SIZE = 20000 +# Minimum order size (must be smaller than DB constrain in /robosats/settings.py MAX_TRADE, currently 5_000_000 Sats) +MAX_ORDER_SIZE = 500000 + +# For CLTV_expiry calculation +# Assume 8 min/block assumed +BLOCK_TIME = 8 +# Safety multiplier in case of mining speed up (CLTV expiry will be times X larger than real time needs for locked bonds/escrow) +MAX_MINING_NETWORK_SPEEDUP_EXPECTED = 1.7 + +# Expiration time for locking collateral in SECONDS +EXP_MAKER_BOND_INVOICE = 300 +EXP_TAKER_BOND_INVOICE = 200 + +# ROUTING +# Proportional routing fee limit (fraction of total payout: % / 100) +PROPORTIONAL_ROUTING_FEE_LIMIT = 0.001 +# Base flat limit fee for routing in Sats (used only when proportional is lower than this) +MIN_FLAT_ROUTING_FEE_LIMIT_REWARD = 2 +# Routing timeouts +REWARDS_TIMEOUT_SECONDS = 30 +PAYOUT_TIMEOUT_SECONDS = 90 +DEBUG_PERMISSIONED_PAYOUTS = False + +# Allow self keysend on keysend function (set true to debug keysend functionality) +ALLOW_SELF_KEYSEND = False + +# REVERSE SUBMARINE SWAP PAYOUTS +# Disable on-the-fly swaps feature +DISABLE_ONCHAIN = False +# Shape of fee to available liquidity curve. Either "linear" or "exponential" +SWAP_FEE_SHAPE = 'exponential' +# EXPONENTIAL. fee (%) = MIN_SWAP_FEE + (MAX_SWAP_FEE - MIN_SWAP_FEE) * e ^ (-LAMBDA * onchain_liquidity_fraction) +SWAP_LAMBDA = 8.8 +# LINEAR. 4 parameters needed: min/max fees and min/max balance points. E.g. If 25% or more of liquidity +# is onchain the fee for swap is 2% (minimum), if it is 12% fee is 6%, and for 0% fee is 10%. +# Minimum swap fee as fraction (1%) +MIN_SWAP_FEE = 0.008 +# Liquidity split point (LN/onchain) at which we use MIN_SWAP_FEE +MIN_SWAP_POINT = 0.35 +# Maximum swap fee as fraction (~10%) +MAX_SWAP_FEE = 0.1 +# Liquidity split point (LN/onchain) at which we use MAX_SWAP_FEE +MAX_SWAP_POINT = 0 +# Min and Max amount allowed for Swap +MIN_SWAP_AMOUNT = 10000 +MAX_SWAP_AMOUNT = 1000000 +# Spend Unconfirmed UTXOS (more capital efficient, more risky) +SPEND_UNCONFIRMED = False +# Mining fee confirmation target +SUGGESTED_TARGET_CONF = 4 +MINIMUM_TARGET_CONF = 24 + +# Fraction rewarded to user from the slashed bond of a counterpart. +# It should not be close to 1, or could be exploited by an attacker trading with himself to DDOS the LN node. +SLASHED_BOND_REWARD_SPLIT = 0.5 + +# Username for HTLCs escrows +ESCROW_USERNAME = 'admin' + +#Social +NOSTR_NSEC = 'nsec1vxhs2zc4kqe0dhz4z2gfrdyjsrwf8pg3neeqx6w4nl8djfzdp0dqwd6rxh' diff --git a/compose/env-sample/lndtn4/supervisord.conf b/compose/env-sample/lndtn4/supervisord.conf new file mode 100644 index 0000000..55d7d9b --- /dev/null +++ b/compose/env-sample/lndtn4/supervisord.conf @@ -0,0 +1,34 @@ +[supervisord] +user=root +childlogdir = /var/log +logfile = /var/log/supervisord.log +logfile_maxbytes = 50MB +logfile_backups = 30 +loglevel = info +pidfile = /var/supervisord.pid +umask = 022 +nodaemon = false +nocleanup = false + +[inet_http_server] +port = 9001 +username = lndg-supervisord +password = 8888888888 # Change this password + +[supervisorctl] +serverurl = http://localhost:9001 +username = lndg-supervisord +password = 8888888888 # Change this password + +[rpcinterface:supervisor] +supervisor.rpcinterface_factory=supervisor.rpcinterface:make_main_rpcinterface + +[program:controller] +command = sh -c "python controller.py && sleep 15" +process_name = lndg-controller +directory = /app +autorestart = true +redirect_stderr = true +stdout_logfile = /var/log/lndg-controller.log +stdout_logfile_maxbytes = 150MB +stdout_logfile_backups = 15 diff --git a/compose/env-sample/lndtn4/thunderhub-accounts.yml b/compose/env-sample/lndtn4/thunderhub-accounts.yml new file mode 100644 index 0000000..ed0c3bd --- /dev/null +++ b/compose/env-sample/lndtn4/thunderhub-accounts.yml @@ -0,0 +1,6 @@ +defaultNetwork: "testnet4" +accounts: + - name: "RoboSats (Testnet4)" + serverUrl: "127.0.0.1:10009" + lndDir: "/lnd/" + password: "sillywhoreadsthis" diff --git a/compose/env-sample/lndtn4/thunderhub.env b/compose/env-sample/lndtn4/thunderhub.env new file mode 100644 index 0000000..2c31b3d --- /dev/null +++ b/compose/env-sample/lndtn4/thunderhub.env @@ -0,0 +1,64 @@ +# ----------- +# Server Configs +# ----------- +LOG_LEVEL='warn' +# LOG_JSON=true +TOR_PROXY_SERVER=socks://127.0.0.1:9050 +# DISABLE_TWOFA=true + +# ----------- +# URLs +# ----------- +# MEMPOOL_URL='https://mempool.space' + +# ----------- +# Interface Configs +# ----------- +THEME='dark' +CURRENCY='sat' + +# ----------- +# Subscription Configs +# ----------- +# DISABLE_ALL_SUBS=true +# DISABLE_INVOICE_SUB=true +# DISABLE_PAYMENT_SUB=true +# DISABLE_FORWARD_SUB=true +# DISABLE_CHANNEL_SUB=true +# DISABLE_BACKUP_SUB=true + +# ----------- +# Privacy Configs +# ----------- +FETCH_PRICES=false +FETCH_FEES=false +DISABLE_LINKS=true +DISABLE_LNMARKETS=true +NO_VERSION_CHECK=true + +# ----------- +# Account Configs +# ----------- +ACCOUNT_CONFIG_PATH='/config/accounts.yml' +# MASTER_PASSWORD_OVERRIDE='secretPasswordForAllAccounts' +# YML_ENV_1='' +# YML_ENV_2='' +# YML_ENV_3='' +# YML_ENV_4='' + +# ----------- +# SSO Account Configs +# ----------- +# COOKIE_PATH='/lnd/.cookie' +# SSO_SERVER_URL='127.0.0.1:10009' +# SSO_CERT_PATH='/lnd/tls.cert' +# SSO_MACAROON_PATH='/path/to/folder/containing/macaroons' +# DANGEROUS_NO_SSO_AUTH=false +# LOGOUT_URL='http://thunderhub.io' + +# ----------- +# SSL Config +# ----------- +# PUBLIC_URL='app.example.com' +# SSL_PORT=8080 +# SSL_SAVE=true diff --git a/compose/env-sample/lndtn4/tor/.gikeep b/compose/env-sample/lndtn4/tor/.gikeep new file mode 100644 index 0000000..e69de29 diff --git a/compose/env-sample/lndtn4/torrc b/compose/env-sample/lndtn4/torrc new file mode 100644 index 0000000..b256e78 --- /dev/null +++ b/compose/env-sample/lndtn4/torrc @@ -0,0 +1,34 @@ +Log notice file /var/log/tor/notices.log + +## The directory for keeping all the keys/etc. By default, we store +## things in $HOME/.tor on Unix, and in Application Data\tor on Windows. +DataDirectory /var/lib/tor +DataDirectoryGroupReadable 1 + +## Enable ControlPort +ControlPort 9051 +CookieAuthentication 1 +CookieAuthFileGroupReadable 1 +CookieAuthFile /var/lib/tor/control_auth_cookie + +# Robosats LND Testnet4 Onion Service +HiddenServiceDir /var/lib/tor/robotest/ +HiddenServiceVersion 3 +HiddenServicePort 80 127.0.0.1:80 + +# Robosats Admin Testnet4 Onion Service +HiddenServiceDir /var/lib/tor/robotest-admin/ +HiddenServiceVersion 3 +HiddenServicePort 80 127.0.0.1:80 + +HiddenServiceDir /var/lib/tor/robotest-thunderhub/ +HiddenServiceVersion 3 +HiddenServicePort 80 127.0.0.1:3000 + +HiddenServiceDir /var/lib/tor/robotest-lit/ +HiddenServiceVersion 3 +HiddenServicePort 8443 127.0.0.1:8443 + +HiddenServiceDir /var/lib/tor/robotest-lndg/ +HiddenServiceVersion 3 +HiddenServicePort 80 127.0.0.1:8889