### Example RTL Configuration Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended An example configuration file for Ride The Lightning. Ensure paths and URLs match your setup. ```json { "port": "3000", "defaultNodeIndex": 1, "SSO": { "rtlSSO": 1, "rtlCookiePath": "/var/lib/rtl/.cookie", # Needs to match the value in BTCPay systemd settings. "logoutRedirectLink": "https://mainnet.demo.btcpayserver.org/login" }, "nodes": [ { "index": 1, "lnNode": "Node 1", "lnImplementation": "LND", "Authentication": { "macaroonPath": "/var/lib/lnd/data/chain/bitcoin/mainnet", "configPath": "/etc/lnd/lnd.conf" }, "Settings": { "userPersona": "MERCHANT", "themeMode": "DAY", "themeColor": "PURPLE", "channelBackupPath": "/home/admin/rtl/backup/node-1", "enableLogging": false, "lnServerUrl": "https://localhost:8080/v1", "swapServerUrl": "http://localhost:8081/v1", "fiatConversion": false } } ] } ``` -------------------------------- ### Install and Enable Bitcoin Daemon Service Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Commands to copy the systemd service file, enable it to start on boot, and start the service immediately. Also includes how to check the service status. ```bash sudo cp bitcoind.service /etc/systemd/system sudo systemctl enable --now bitcoind sudo systemctl status bitcoind ``` -------------------------------- ### Install ThunderHub Source: https://docs.btcpayserver.org/FAQ/LightningNetwork Add the 'opt-add-thunderhub' fragment and run the setup script to install ThunderHub on your BTCPay Server instance. ```bash export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-thunderhub" . btcpay-setup.sh -i ``` -------------------------------- ### Run BTCPay Server Installation Script Source: https://docs.btcpayserver.org/Deployment/LightningInABox Executes the BTCPay Server installation script. This command initiates the setup process after environment variables have been configured. ```bash . ./btcpay-setup.sh -i ``` -------------------------------- ### Build and Install LND Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Clone the LND repository, build the project using 'make', and install the binaries. Ensure your GOPATH is set correctly. Verify the installation by checking the LND version. ```bash ~$ cd ~; mkdir -p src; cd src ~$ git clone https://github.com/lightningnetwork/lnd ~$ cd lnd ~$ make ~$ make install # installs to a directory in $GOPATH/bin ~$ sudo cp $GOPATH/bin/lnd $GOPATH/bin/lncli /usr/bin ~$ lnd --version lnd version 0.10.99-beta commit=clock/v1.0.0-229-ge64e71d86dc1ac716c30a80f85a22e8fb544697f ``` -------------------------------- ### Install Tallycoin Connect Service Source: https://docs.btcpayserver.org/Docker/tallycoin-connect Configure Tallycoin API key and password, then add the Tallycoin Connect fragment and run the setup script. A password is recommended for security. ```bash # Set API key and password export TALLYCOIN_APIKEY="my-tallycoin-api-key" export TALLYCOIN_PASSWD_CLEARTEXT="sUpErSeCuRe" # Add fragment and run setup BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-tallycoin-connect" . btcpay-setup.sh -i ``` -------------------------------- ### Install .NET 8.0 SDK on Ubuntu Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Install the .NET 8.0 SDK by adding the Microsoft package repository and then using `apt-get` to install the SDK. Verify the installation with `dotnet --version`. ```bash # Add Microsoft package repository wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb # Install the SDK sudo apt-get update sudo apt-get install -y apt-transport-https sudo apt-get update sudo apt-get install -y dotnet-sdk-8.0 ## Check dotnet --version ``` -------------------------------- ### Download and Setup BTCPay Server Source: https://docs.btcpayserver.org/Deployment/LightningInABox Clones the BTCPay Server Docker repository and installs necessary packages like fail2ban and git. This is the initial step before configuring server settings. ```bash cd # ensure we are in root home apt install -y fail2ban git git clone https://github.com/btcpayserver/btcpayserver-docker cd btcpayserver-docker ``` -------------------------------- ### Enable and Start RTL Service Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Copies the service file to the systemd directory, enables the service to start on boot, and starts it immediately. ```bash ~$ sudo cp rtl.service /etc/systemd/system ~$ sudo systemctl enable --now rtl ``` -------------------------------- ### Install Docker Source: https://docs.btcpayserver.org/Deployment/RaspberryPi4 Install Docker CE, the command-line interface, and containerd.io on your system by adding the Docker repository and then installing the packages. ```bash apt install apt-transport-https ca-certificates curl gnupg lsb-release -y curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/debian \ $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null apt update apt -y install docker-ce docker-ce-cli containerd.io ``` -------------------------------- ### Install .NET 8.0 SDK Source: https://docs.btcpayserver.org/Deployment/ManualDeployment Installs the .NET 8.0 SDK on Ubuntu 20.04 by adding the Microsoft package repository and then installing the SDK. Verify the installation by checking the dotnet version. ```bash # Add Microsoft package repository wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb rm packages-microsoft-prod.deb # Install the SDK sudo apt-get update sudo apt-get install -y apt-transport-https sudo apt-get update sudo apt-get install -y dotnet-sdk-6.0 ## Check dotnet --version ``` -------------------------------- ### Install Go and Set Environment Variables Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Install the Go programming language and set the necessary environment variables for Go development. This is a prerequisite for building LND. ```bash ~$ sudo apt install make ~$ wget https://dl.google.com/go/go1.13.linux-amd64.tar.gz ~$ sha256sum go1.13.linux-amd64.tar.gz 68a2297eb099d1a76097905a2ce334e3155004ec08cdea85f24527be3c48e856 go1.13.linux-amd64.tar.gz ~$ sudo tar -C /usr/local -xzf go1.13.linux-amd64.tar.gz ~$ export PATH=$PATH:/usr/local/go/bin ~$ export GOPATH=~/gocode ~$ export PATH=$PATH:$GOPATH/bin ~$ go version go version go1.13 linux/amd64 ``` -------------------------------- ### Example Extended Public Key (xpub) Source: https://docs.btcpayserver.org/Multisig An example of an extended public key (xpub), root fingerprint, and derivation path required for multisig wallet setup. Ensure these values are correctly obtained from your hardware wallet or software wallet. ```text xpub6CUGRUonZSQ4TWtTMmzXdrXDtypWKiKp5KUMRmD9YgoWDbEVpLFgje71pRAVBPX6DCmV9HNTLr8GHqKZANvNcFpSZe3kiKsH5Ej7ApG1NVDK Root Fingerprint: abcdef21 Key Path: 48'/0'/0'/0' ``` -------------------------------- ### Install Bitcoin Core Prerequisites Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Install necessary build tools and libraries for compiling Bitcoin Core. These are required for building from source. ```bash ~$ sudo apt install build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 ~$ sudo apt install libevent-dev libboost-system-dev libboost-filesystem-dev libboost-test-dev libboost-thread-dev libminiupnpc-dev libzmq3-dev ``` -------------------------------- ### Install Node.js and Build Tools Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Installs Node.js and essential build tools required for compiling Node.js applications. ```bash ~$ sudo apt install nodejs build-essential npm ``` -------------------------------- ### Download and Run BTCPay Server Raspberry Pi Install Script Source: https://docs.btcpayserver.org/Deployment/RaspberryPi4 Download the BTCPay Server installation script for Raspberry Pi 4, make it executable, and then run it to begin the installation process. ```bash wget -O btcpayserver-install.sh https://raw.githubusercontent.com/btcpayserver/btcpayserver-doc/master/scripts/btcpayserver-rpi4-install.sh chmod +x btcpayserver-install.sh . btcpayserver-install.sh ``` -------------------------------- ### Install Bitcoin Core 0.19.1 Source: https://docs.btcpayserver.org/Deployment/ManualDeployment Downloads, verifies, and installs Bitcoin Core binaries. Ensure the SHA256 checksum matches the downloaded file. ```bash BITCOIN_VERSION="0.19.1" BITCOIN_URL="https://bitcoin.org/bin/bitcoin-core-0.19.1/bitcoin-0.19.1-x86_64-linux-gnu.tar.gz" BITCOIN_SHA256="5fcac9416e486d4960e1a946145566350ca670f9aaba99de6542080851122e4c" # install bitcoin binaries cd /tmp wget -O bitcoin.tar.gz "$BITCOIN_URL" echo "$BITCOIN_SHA256 bitcoin.tar.gz" | sha256sum -c - && \ mkdir bin && \ sudo tar -xzvf bitcoin.tar.gz -C /usr/local/bin --strip-components=2 "bitcoin-$BITCOIN_VERSION/bin/bitcoin-cli" "bitcoin-$BITCOIN_VERSION/bin/bitcoind" rm bitcoin.tar.gz ``` -------------------------------- ### Start development environment with Docker Compose Source: https://docs.btcpayserver.org/Development/LocalDevelopment This command starts the BTCPay Server development environment using Docker Compose. It ensures the latest images are pulled before starting. ```bash docker-compose down --volumes docker-compose pull docker-compose up dev ``` -------------------------------- ### Start Docker Services for Development Source: https://docs.btcpayserver.org/Contribute/DevCode This command starts the necessary Docker containers defined in the docker-compose.yml file for the development environment. Ensure you are in the 'BTCPayServer.Tests' directory before running. ```powershell docker-compose up dev ``` -------------------------------- ### Create and Configure RTL Configuration File Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Copies the sample configuration file and opens it for editing. Adjust settings according to your environment. ```bash ~$ cp src/RTL/sample-RTL-Config.json RTL-Config.json ~$ vi RTL-Config.json ``` -------------------------------- ### JoinMarket Service Status Example Source: https://docs.btcpayserver.org/Docker/joinmarket Example output from `supervisorctl status` showing the current state of JoinMarket services. Services like `yg-privacyenhanced` and `yield-generator-basic` can be started or stopped. ```bash root> supervisorctl status ob-watcher STOPPED Not started yg-privacyenhanced STOPPED Not started yield-generator-basic STOPPED Not started ``` -------------------------------- ### LND Configuration File Example Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Example configuration for LND. Customize parameters like datadir, TLS paths, alias, and network settings. Ensure external IP is set if needed. ```ini [Application Options] datadir=/var/lib/lnd/data tlscertpath=/var/lib/lnd/tls.cert tlskeypath=/var/lib/lnd/tls.key logdir=/var/lib/lnd/logs maxlogfiles=3 maxlogfilesize=10 #externalip=1.1.1.1 # change to your public IP address if required. alias=i_luv_btcpay listen=0.0.0.0:9735 [Bitcoin] bitcoin.active=1 bitcoin.node=bitcoind bitcoin.mainnet=true [tor] tor.active=true tor.v3=true ``` -------------------------------- ### Check Nginx Version Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Verify the installed Nginx version. This is a preliminary check for server setup. ```bash ~$ sudo nginx -v nginx version: nginx/1.18.0 (Ubuntu) ``` -------------------------------- ### Set Up RTL Data Directory and Permissions Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Creates the data directory for RTL, copies the configuration file, and sets appropriate ownership and permissions. ```bash ~$ sudo mkdir -p /var/lib/rtl ~$ sudo cp ~/RTL-Config.json /var/lib/rtl ~$ sudo chown admin:admin -R /var/lib/rtl ~$ sudo chmod 644 /var/lib/rtl/RTL-Config.json ``` -------------------------------- ### Set Lightning Terminal Password and Install Source: https://docs.btcpayserver.org/Docker/lightning-terminal Set a secure password for Lightning Terminal login and add the service fragment to your BTCPay Server setup script. This command installs the Lightning Terminal service. ```bash # Set password export LIT_PASSWD="sUpErSeCuRe" # Add fragment and run setup export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-lightning-terminal" . btcpay-setup.sh -i ``` -------------------------------- ### Create LND Directories and Copy Configuration Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Create necessary directories for LND data and configuration, set ownership, and copy the LND configuration file to the system directory. Ensure correct permissions are set. ```bash ~$ sudo mkdir -p /etc/lnd ~$ sudo mkdir -p /var/lib/lnd ~$ sudo chown admin:admin -R /var/lib/lnd ~$ sudo cp lnd.conf /etc/lnd ~$ sudo chmod 644 /etc/lnd/lnd.conf ``` -------------------------------- ### Run bitcoind Source: https://docs.btcpayserver.org/Deployment/ManualDeployment Starts the Bitcoin Core daemon. This command should be run after Bitcoin Core has been installed and synced. ```bash bitcoind ``` -------------------------------- ### Configure, Build, and Install Bitcoin Core Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Generate Makefiles, configure the build with Berkeley DB, compile, and install Bitcoin Core. This process builds the necessary daemon. ```bash ~/src/bitcoin$ ./autogen.sh ~/src/bitcoin$ export BDB_PREFIX='/home/admin/src/bitcoin/db4' ~/src/bitcoin$ ./configure BDB_LIBS="-L${BDB_PREFIX}/lib -ldb_cxx-4.8" BDB_CFLAGS="-I${BDB_PREFIX}/include" ~/src/bitcoin$ make ~/src/bitcoin$ sudo make install ~/src/bitcoin$ bitcoind -version Bitcoin Core version v0.20.0 ``` -------------------------------- ### Get Store Roles Response Sample Source: https://docs.btcpayserver.org/API/Greenfield/v1 Example JSON response when retrieving store roles, showing role details and permissions. ```json { * "id": "Owner", * "role": "Owner", * "permissions": [ * "btcpay.store.canmodifystoresettings" ], * "isServerRole": true } ``` -------------------------------- ### Rescan Blockchain from Specific Height Source: https://docs.btcpayserver.org/NBXplorer To include older payments, configure a specific start height for a cryptocurrency and use the rescan option. This example uses Litecoin. ```bash --[crypto]startheight=101 --[crypto]rescan ``` -------------------------------- ### Add Custom Docker Compose Fragment Source: https://docs.btcpayserver.org/Docker To add a custom fragment to your BTCPay Server installation, set the BTCPAYGEN_ADDITIONAL_FRAGMENTS environment variable and re-run the setup script. ```bash export BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-lnd-autopilot" . btcpay-setup.sh -i ``` -------------------------------- ### Enable NDLC Docker Fragment Source: https://docs.btcpayserver.org/Docker/ndlc Add the NDLC docker fragment to your BTCPay Server installation to enable its functionality. This requires running the setup script after modification. ```bash BTCPAYGEN_ADDITIONAL_FRAGMENTS="$BTCPAYGEN_ADDITIONAL_FRAGMENTS;opt-add-ndlc" . btcpay-setup.sh -i ``` -------------------------------- ### Setup BTCPay Server with ElectrumX Source: https://docs.btcpayserver.org/ElectrumX Run the btcpay-setup script to configure or reconfigure your BTCPay Server instance with ElectrumX. This process may take several hours for initial synchronization. ```bash cd ~/BTCPayServer/btcpayserver-docker && . ./btcpay-setup.sh -i ``` -------------------------------- ### Get Store Information using cURL Source: https://docs.btcpayserver.org/Development/ecommerce-integration-guide Example of how to retrieve store information using cURL with an API key. Ensure to replace API_KEY and STORE_ID with actual values. ```bash curl -s \ -H "Content-Type: application/json" \ -H "Authorization: token API_KEY" \ -X GET \ "https://mainnet.demo.btcpayserver.org/api/v1/stores/STORE_ID" ``` -------------------------------- ### Prepare Let's Encrypt Directory Source: https://docs.btcpayserver.org/Deployment/ReverseProxyToTor Creates a directory for Let's Encrypt challenge files and sets appropriate permissions. This is necessary for SSL certificate verification. ```bash # create directory for Let's Encrypt files mkdir -p /var/lib/letsencrypt/.well-known chgrp www-data /var/lib/letsencrypt chmod g+s /var/lib/letsencrypt ``` -------------------------------- ### Systemd Service File for LND Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Example systemd service file for LND. Adjust paths, User, and Group as necessary. This ensures LND starts automatically and is managed by systemd. ```systemd [Unit] Description=LND Lightning Network Daemon Requires=bitcoind.service After=bitcoind.service [Service] ExecStart=/usr/bin/lnd --configfile=/etc/lnd/lnd.conf ExecStop=/usr/bin/lncli --lnddir /var/lib/lnd stop PIDFile= /run/lnd/lnd.pid User=admin Group=admin Type=simple KillMode=process TimeoutStartSec=60 TimeoutStopSec=60 Restart=always RestartSec=60 [Install] WantedBy=multi-user.target ``` -------------------------------- ### Configure NBXplorer Service Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Set up NBXplorer by creating a configuration directory, copying the configuration file, and setting appropriate file permissions. ```bash ~$ sudo mkdir /etc/nbxplorer ~$ sudo cp nbxplorer.config /etc/nbxplorer ~$ sudo chmod 644 /etc/nbxplorer/nbxplorer.config ``` -------------------------------- ### Configure Additional Hosts for Docker Deployment Source: https://docs.btcpayserver.org/Deployment/DynamicDNS When using a Docker deployment, update your BTCPay Server installation to include additional hosts for HTTPS certificates. This command sets the BTCPAY_ADDITIONAL_HOSTS environment variable and runs the setup script. ```bash BTCPAY_ADDITIONAL_HOSTS="example.ddns.net" . btcpay-setup.sh -i ``` -------------------------------- ### Remove a Coin from BTCPay Server Source: https://docs.btcpayserver.org/FAQ/Altcoin To remove a specific altcoin from your BTCPay Server deployment, set the corresponding BTCPAYGEN_CRYPTO variable to an empty string and re-run the setup script. For example, to remove Litecoin if it's set as CRYPTO2, use `export BTCPAYGEN_CRYPTO2=""`. ```bash sudo su - export BTCPAYGEN_CRYPTO2="" . ./btcpay-setup.sh -i ``` -------------------------------- ### Example Bitcoin Core Configuration Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended An example `bitcoin.conf` file suitable for BTCPay Server. It enables RPC, sets up ZMQ for lightning, and recommends against pruning for full blockchain storage. ```ini server=1 # need RPC for btcpay. rpcbind=127.0.0.1 # loopback is default for 0.18.0 but no harm making sure. whitelist=127.0.0.1 # for nbxplorer. rpcallowip=127.0.0.1/32 # loopback is default but again no harm. zmqpubrawblock=tcp://127.0.0.1:28332 # needed for lightning. zmqpubrawtx=tcp://127.0.0.1:28333 # needed for lightning. #prune=5000 # Recommended if not enough disk space for full 600+GB blockchain. ``` -------------------------------- ### Enable and Start autossh Service Source: https://docs.btcpayserver.org/Deployment/ReverseSSHtunnel Enables the autossh service to start on boot and starts it immediately. ```bash sudo systemctl enable autossh-tunnel ``` ```bash sudo systemctl start autossh-tunnel ``` -------------------------------- ### Create Bitcoin Core Configuration File Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Create a `bitcoin.conf` file with essential settings for BTCPay Server. This includes RPC, ZMQ, and network configurations. ```bash ~$ vi bitcoin.conf ``` -------------------------------- ### NBXplorer Configuration via Command Line Source: https://docs.btcpayserver.org/NBXplorer/API Configure NBXplorer using command-line arguments. Example shows setting the chains to 'btc'. ```bash dotnet run --no-launch-profile --no-build -c Release -p .\NBXplorer\NBXplorer.csproj -- --chains btc ``` -------------------------------- ### Install Fail2ban, GIT, and Avahi-Daemon on Ubuntu Source: https://docs.btcpayserver.org/Deployment/LightningInABox Installs essential packages for server security, version control, and local network service discovery. Run these commands in a new terminal window. ```bash sudo apt update sudo apt install -y fail2ban git avahi-daemon ``` -------------------------------- ### Install Docker CE on Ubuntu Source: https://docs.btcpayserver.org/Deployment/LightningInABox Installs Docker Community Edition on Ubuntu systems. Ensure you have the necessary prerequisites and follow the steps to add the Docker repository and install the package. ```bash sudo apt install apt-transport-https ca-certificates curl software-properties-common curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null sudo apt update apt-cache policy docker-ce sudo apt install docker-ce systemctl status docker ``` -------------------------------- ### Configure BTCPay Server with Multiple Cryptocurrencies and Services Source: https://docs.btcpayserver.org/Docker This example demonstrates how to configure BTCPay Server with Bitcoin and Litecoin support, using Nginx as a reverse proxy and c-lightning for the Lightning Network. The configuration is saved to a custom Docker Compose file. ```powershell Invoke-Command { $BTCPAYGEN_CRYPTO1="btc" $BTCPAYGEN_CRYPTO2="ltc" $BTCPAYGEN_REVERSEPROXY="nginx" $BTCPAYGEN_LIGHTNING="clightning" $BTCPAYGEN_SUBNAME="custom" . .\build.ps1 } ``` -------------------------------- ### Install autossh Source: https://docs.btcpayserver.org/Deployment/ReverseSSHtunnel Installs the autossh utility, which is used to maintain the SSH tunnel. ```bash sudo apt-get install autossh ``` -------------------------------- ### Build NBXplorer from Source Source: https://docs.btcpayserver.org/Deployment/ManualDeploymentExtended Clone the NBXplorer repository, checkout the latest stable tag, and build the application using the provided `build.sh` script. ```bash ~$ cd ~; mkdir -p src; cd src ~/src$ git clone https://github.com/dgarage/NBXplorer ~/src$ cd NBXplorer ~/src/NBXplorer$ git checkout $(git tag --sort -version:refname | awk 'match($0, /^v[0-9]+\./)' | head -n 1) ~/src/NBXplorer$ ./build.sh ```