Comment on page
BTCPay Server
BTCPay Server is a free, open-source, and self-hosted Bitcoin payment gateway, which means developers and security auditors can always inspect the code for quality. It enables individuals and businesses to accept Bitcoin payments online or in person without any fees, offering self-sovereignty in the process.
Difficulty: Hard

BTCPay Server is a self-hosted and automated invoicing system. At checkout, a customer is presented with an invoice that they pay from their wallet. BTCPay Server follows the status of the invoice through the blockchain and informs you when the payment has been settled so that you can fulfill the order. It also takes care of payment refunding and bitcoin management alongside plenty of other features.
- Others
- PostgreSQL
To run the BTCPay Server you will need to install
.NET Core SDK
, PostgreSQL
, and NBXplorer
-
We need to set up settings in the Bitcoin Core configuration file - add new lines if they are not present
- With user
admin
, editbitcoin.conf
$ sudo nano /data/bitcoin/bitcoin.conf
- Add the following line to the
"# Connections"
section. Save and exit
# NBXplorer requeriment
whitelist=127.0.0.1
- Restart Bitcoin Core to apply changes
$ sudo systemctl restart bitcoind
- Configure the firewall to allow incoming HTTPS requests
$ sudo ufw allow 23000/tcp comment 'allow BTCPay Server from anywhere'
Expected output
Rule added
Rule added (v6)
We do not want to run BTCPay Server and other related services alongside other services due to security reasons. Therefore, we will create a separate user and run the code under the new user's account.
- With user
admin
, create a new user calledbtcpay
$ sudo adduser --disabled-password --gecos "" btcpay
- Add
btcpay
user to the bitcoin and lnd groups
$ sudo adduser btcpay bitcoin lnd
- With user
admin
, change to thebtcpay
user
$ sudo su - btcpay
- We will use the scripted install mode. Download the script
$ wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
- Before running this script, you'll need to grant permission for this script to run as an executable
$ chmod +x ./dotnet-install.sh
- Install .NET Core SDK 6.0
$ ./dotnet-install.sh --channel 6.0
- Add path to dotnet executable
$ echo 'export DOTNET_ROOT=$HOME/.dotnet' >>~/.bashrc
$ echo 'export PATH=$PATH:$HOME/.dotnet:$HOME/.dotnet/tools' >>~/.bashrc
$ source ~/.bashrc
- Check .NET SDK 6.0 is correctly installed
$ dotnet --version
Example of expected output:
> 6.0.411
- Delete the installation script
$ rm dotnet-install.sh
- Come back to the "admin" user
$ exit
- With user
admin
, create the file repository configuration
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- Import the repository signing key
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Expected output:
> Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
OK
- Update the package lists. You can ignore the
W: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8))
message
$ sudo apt update
- Install the latest version of PostgreSQL
$ sudo apt install postgresql postgresql-contrib
- Check the correct installation
$ psql -V
Example of expected output:
> psql (PostgreSQL) 15.3 (Ubuntu 15.3-1.pgdg22.04+1)
- Ensure PostgreSQL is running and listening on the default port
5432
$ sudo ss -tulpn | grep LISTEN | grep postgres
Expected output:
> tcp LISTEN 0 200 127.0.0.1:5432 0.0.0.0:* users:(("postgres",pid=2532748,fd=7))
> tcp LISTEN 0 200 [::1]:5432 [::]:* users:(("postgres",pid=2532748,fd=6))
- With user
admin
, change to the automatically created user for the PostgreSQL installation calledpostgres
$ sudo su - postgres
- Create a new database user
$ createuser --pwprompt --interactive
Type in the following:
Enter name of role to add: adminEnter password for new role: adminEnter it again: adminShall the new role be a superuser? (y/n) nShall the new role be allowed to create databases? (y/n) yShall the new role be allowed to create more new roles? (y/n) n
- Create 2 new databases
$ createdb -O admin btcpayserver
$ createdb -O admin nbxplorer
- Go back to the
admin
user
$ exit
- With user
admin
, switch to thebtcpay
user
$ sudo su - btcpay
- Create a "src" directory and enter the folder
$ mkdir src
$ cd src
- Download the NBXplorer source code and enter the folder
$ git clone https://github.com/dgarage/NBXplorer
$ cd NBXplorer
- Checkout latest tag
$ git checkout $(git tag --sort -version:refname | awk 'match($0, /^v[0-9]+\./)' | head -n 1)
- Modify NBXplorer run script
$ nano run.sh
- Comment existing line
#dotnet run --no-launch-profile --no-build -c Release --project "NBXplorer/NBXplorer.csproj" -- $@
- Add the next line below. Save and exit
/home/btcpay/.dotnet/dotnet run --no-launch-profile --no-build -c Release --project "NBXplorer/NBXplorer.csproj" -- $@
- Modify NBXplorer build script
$ nano build.sh
- Comment next line
#dotnet build -c Release NBXplorer/NBXplorer.csproj
- Add the next line below. Save and exit
/home/btcpay/.dotnet/dotnet build -c Release NBXplorer/NBXplorer.csproj
- Build NBXplorer
$ ./build.sh
Welcome to .NET 6.0!
---------------------
SDK Version: 6.0.411
Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.
Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
MSBuild version 17.3.2+561848881 for .NET
Determining projects to restore...
Restored /home/btcpay/src/NBXplorer/NBXplorer.Client/NBXplorer.Client.csproj (in 18.17 sec).
Restored /home/btcpay/src/NBXplorer/NBXplorer/NBXplorer.csproj (in 19.19 sec).
NBXplorer.Client -> /home/btcpay/src/NBXplorer/NBXplorer.Client/bin/Release/netstandard2.1/NBXplorer.Client.dll
NBXplorer -> /home/btcpay/src/NBXplorer/NBXplorer/bin/Release/net6.0/NBXplorer.dll
Build succeeded.
0 Warning(s)
0 Error(s)
- Create the data folder and navigate to it
$ mkdir -p ~/.nbxplorer/Main
$ cd ~/.nbxplorer/Main
- Create a new config file
$ nano settings.config
- Add the entire next lines. Save and exit
# MiniBolt: nbxplorer configuration
# /home/btcpay/.nbxplorer/Main/settings.config
# Bitcoind connection
btc.rpc.cookiefile=/data/bitcoin/.cookie
# Database
postgres=User ID=admin;Password=admin;Host=localhost;Port=5432;Database=nbxplorer;
- Go back to the
admin
user
$ exit
- As user
admin
, create the service file
$ sudo nano /etc/systemd/system/nbxplorer.service
- Paste the following configuration. Save and exit
# MiniBolt: systemd unit for NBXplorer
# /etc/systemd/system/nbxplorer.service
[Unit]
Description=NBXplorer daemon
Wants=bitcoind.service
After=bitcoind.service
[Service]
WorkingDirectory=/home/btcpay/src/NBXplorer
ExecStart=/home/btcpay/src/NBXplorer/run.sh
User=btcpay
Type=simple
PrivateTmp=true
ProtectSystem=full
NoNewPrivileges=true
PrivateDevices=true
TimeoutSec=120
[Install]
WantedBy=multi-user.target
- Enable autoboot (optional)
$ sudo systemctl enable nbxplorer
- Prepare “
nbxplorer
” monitoring by the systemd journal and checking the logging output. You can exit monitoring at any time with Ctrl-C
$ journalctl -f -u nbxplorer
Keep this terminal open, you'll need to come back here on the next step to monitor the logs
To keep an eye on the software movements, start your SSH program (eg. PuTTY) a second time, connect to the MiniBolt node, and log in as "admin". Commands for the second session start with the prompt
$2
(which must not be entered)- With user
admin
, start thenbxplorer
service
$ sudo systemctl start nbxplorer
Jul 05 17:50:20 bbonode systemd[1]: Started NBXplorer daemon.
Jul 05 17:50:21 bbonode run.sh[2808966]: info: Configuration: Data Directory: /home/btcpay/.nbxplorer/Main
Jul 05 17:50:21 bbonode run.sh[2808966]: info: Configuration: Configuration File: /home/btcpay/.nbxplorer/Main/settings.config
Jul 05 17:50:21 bbonode run.sh[2808966]: info: Configuration: Network: Mainnet
Jul 05 17:50:21 bbonode run.sh[2808966]: info: Configuration: Supported chains: BTC
Jul 05 17:50:21 bbonode run.sh[2808966]: info: Configuration: DBCache: 50 MB
Jul 05 17:50:21 bbonode run.sh[2808966]: info: Configuration: Network: Mainnet
Jul 05 17:50:21 bbonode run.sh[2808966]: info: Configuration: Supported chains: BTC
Jul 05 17:50:21 bbonode run.sh[2808966]: info: Configuration: DBCache: 50 MB
Jul 05 17:50:21 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Postgres services activated
Jul 05 17:50:21 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 001.Migrations...
Jul 05 17:50:21 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 002.Model...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 003.Legacy...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 004.Fixup...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 005.ToBTCFix...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 006.GetWalletsRecent2...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 007.FasterSaveMatches...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 008.FasterGetUnused...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 009.FasterGetUnused2...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 010.ChangeEventsIdType...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 011.FixGetWalletsRecent...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 012.PerfFixGetWalletsRecent...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 013.FixTrackedTransactions...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 014.FixAddressReuse...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.DatabaseSetup: Execute script 015.AvoidWAL...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Indexer.BTC: TCP Connection succeed, handshaking...
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Indexer.BTC: Handshaked
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Indexer.BTC: Testing RPC connection to http://localhost:8332/
Jul 05 17:50:22 bbonode run.sh[2808966]: Hosting environment: Production
Jul 05 17:50:22 bbonode run.sh[2808966]: Content root path: /home/btcpay/src/NBXplorer/NBXplorer/bin/Release/net6.0/
Jul 05 17:50:22 bbonode run.sh[2808966]: Now listening on: http://127.0.0.1:24444
Jul 05 17:50:22 bbonode run.sh[2808966]: Application started. Press Ctrl+C to shut down.
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Indexer.BTC: RPC connection successful
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Indexer.BTC: Full node version detected: 250000
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Indexer.BTC: Has txindex support
Jul 05 17:50:22 bbonode run.sh[2808966]: warn: NBXplorer.Indexer.BTC: BTC: Your NBXplorer server is not whitelisted by your node, you should add "whitelist=127.0.0.1" to the configuration file of your node. (Or use whitebind)
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Events: BTC: Node state changed: NotStarted => NBXplorerSynching
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Indexer.BTC: Current Index Progress not found, start syncing from the header's chain tip (At height: 797318)
Jul 05 17:50:22 bbonode run.sh[2808966]: info: NBXplorer.Events: BTC: Node state changed: NBXplorerSynching => Ready
Jul 05 17:50:23 bbonode run.sh[2808966]: info: NBXplorer.Events: BTC: New block 00000000000000000001415583131d3c1da985497830abcf638413226892d4ad (797318)
- Ensure NBXplorer is running and listening on the default port
24444
$ sudo ss -tulpn | grep LISTEN | grep NBXplorer
Expected output:
tcp LISTEN 0 512 127.0.0.1:24444 0.0.0.0:* users:(("NBXplorer",pid=2808966,fd=176))
You have NBxplorer running and prepared for the BTCpay server to use it
- Switch to the
btcpay
user
$ sudo su - btcpay
- Go to the
src
folder
$ cd src
- Clone the BTCPay Server official GitHub repository
$ git clone https://github.com/btcpayserver/btcpayserver
- Go to the
btcpayserver
folder
$ cd btcpayserver
- Checkout latest tag
$ git checkout $(git tag --sort -version:refname | awk 'match($0, /^v[0-9]+\.[0-9]+\.[0-9]+$/)' | head -n 1)
- Modify BTCPay Server run script
$ nano run.sh
- Comment next line
#dotnet "BTCPayServer.dll" $@
- Add the next line below. Save and exit
/home/btcpay/.dotnet/dotnet "BTCPayServer.dll" $@
- Modify the BTCPay Server build script
$ nano build.sh
- Comment next line
#dotnet publish --no-cache -o BTCPayServer/bin/Release/publish/ -c Release BTCPayServer/BTCPayServer.csproj
- Add the next line below. Save and exit
/home/btcpay/.dotnet/dotnet publish --no-cache -o BTCPayServer/bin/Release/publish/ -c Release BTCPayServer/BTCPayServer.csproj
- Build BTCPay Server
$ ./build.sh
MSBuild version 17.3.2+561848881 for .NET
Determining projects to restore...
Restored /home/btcpay/src/btcpayserver/BTCPayServer/BTCPayServer.csproj (in 59.8 sec).
Restored /home/btcpay/src/btcpayserver/BTCPayServer.Rating/BTCPayServer.Rating.csproj (in 59.8 sec).
Restored /home/btcpay/src/btcpayserver/BTCPayServer.Common/BTCPayServer.Common.csproj (in 28 ms).
Restored /home/btcpay/src/btcpayserver/BTCPayServer.Client/BTCPayServer.Client.csproj (in 596 ms).
Restored /home/btcpay/src/btcpayserver/BTCPayServer.Abstractions/BTCPayServer.Abstractions.csproj (in 17 ms).
Restored /home/btcpay/src/btcpayserver/BTCPayServer.Data/BTCPayServer.Data.csproj (in 675 ms).
BTCPayServer.Client -> /home/btcpay/src/btcpayserver/BTCPayServer.Client/bin/Release/netstandard2.1/BTCPayServer.Client.dll
BTCPayServer.Rating -> /home/btcpay/src/btcpayserver/BTCPayServer.Rating/bin/Release/net6.0/BTCPayServer.Rating.dll
BTCPayServer.Common -> /home/btcpay/src/btcpayserver/BTCPayServer.Common/bin/Release/net6.0/BTCPayServer.Common.dll
BTCPayServer.Abstractions -> /home/btcpay/src/btcpayserver/BTCPayServer.Abstractions/bin/Release/net6.0/BTCPayServer.Abstractions.dll
BTCPayServer.Data -> /home/btcpay/src/btcpayserver/BTCPayServer.Data/bin/Release/net6.0/BTCPayServer.Data.dll
BTCPayServer -> /home/btcpay/src/btcpayserver/BTCPayServer/bin/Release/net6.0/BTCPayServer.dll
BTCPayServer -> /home/btcpay/src/btcpayserver/BTCPayServer/bin/Release/publish/
- Create the data folder and enter it
$ mkdir -p ~/.btcpayserver/Main
$ cd ~/.btcpayserver/Main
- Create a new config file
$ nano settings.config
- Add the complete following lines
# MiniBolt: btcpayserver configuration
# /home/btcpay/.btcpayserver/Main/settings.config
# Server settings
bind=0.0.0.0
# Database
## NBXplorer
explorer.postgres=User ID=admin;Password=admin;Host=localhost;Port=5432;Database=nbxplorer;
## BTCpay server
postgres=User ID=admin;Password=admin;Host=localhost;Port=5432;Database=btcpay;
If you want to connect your Lightning LND node to BTCpay too, go to the Connect to your LND internal node optional section
- Go back to the
admin
user
$ exit
- As user
admin
, create the service file
$ sudo nano /etc/systemd/system/btcpay.service
- Paste the following configuration. Save and exit
# MiniBolt: systemd unit for BTCpay server
# /etc/systemd/system/btcpay.service
[Unit]
Description=BTCPay Server
Wants=nbxplorer.service
After=nbxplorer.service
[Service]
WorkingDirectory=/home/btcpay/src/btcpayserver
ExecStart=/home/btcpay/src/btcpayserver/run.sh
User=btcpay
Type=simple
TimeoutSec=120
[Install]
WantedBy=multi-user.target
- Enable autoboot (optional)
$ sudo systemctl enable btcpay
- Prepare
btcpay
monitoring by the systemd journal and checking the logging output. You can exit monitoring at any time with Ctrl-C
$ journalctl -f -u btcpay
Keep this terminal open, you'll need to come back here on the next step to monitor the logs
To keep an eye on the software movements, start your SSH program (eg. PuTTY) a second time, connect to the MiniBolt node, and log in as
admin
. Commands for the second session start with the prompt $2
(which must not be entered)$ sudo systemctl start btcpay
Jul 05 18:01:08 bbonode run.sh[2810276]: info: Configuration: Data Directory: /home/btcpay/.btcpayserver/Main
Jul 05 18:01:08 bbonode run.sh[2810276]: info: Configuration: Configuration File: /home/btcpay/.btcpayserver/Main/settings.config
Jul 05 18:01:09 bbonode run.sh[2810276]: info: BTCPayServer.Plugins.PluginManager: Loading plugins from /home/btcpay/.btcpayserver/Plugins
Jul 05 18:01:09 bbonode run.sh[2810276]: info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer - 1.10.3
Jul 05 18:01:09 bbonode run.sh[2810276]: info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.Shopify - 1.10.3
Jul 05 18:01:09 bbonode run.sh[2810276]: info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.PointOfSale - 1.10.3
Jul 05 18:01:09 bbonode run.sh[2810276]: info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.PayButton - 1.10.3
Jul 05 18:01:09 bbonode run.sh[2810276]: info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.NFC - 1.10.3
Jul 05 18:01:09 bbonode run.sh[2810276]: info: BTCPayServer.Plugins.PluginManager: Adding and executing plugin BTCPayServer.Plugins.Crowdfund - 1.10.3
Jul 05 18:01:09 bbonode run.sh[2810276]: info: Configuration: Supported chains: BTC
Jul 05 18:01:09 bbonode run.sh[2810276]: info: Configuration: BTC: Explorer url is http://127.0.0.1:24444/
Jul 05 18:01:09 bbonode run.sh[2810276]: info: Configuration: BTC: Cookie file is /home/btcpay/.nbxplorer/Main/.cookie
Jul 05 18:01:09 bbonode run.sh[2810276]: info: Configuration: Network: Mainnet
Jul 05 18:01:13 bbonode run.sh[2810276]: info: Configuration: Root Path: /
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: Checking if any payment arrived on lightning while the server was offline...
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: Processing lightning payments...
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: Starting listening NBXplorer (BTC)
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: Start watching invoices
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: Starting payment request expiration watcher
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: 0 pending payment requests being checked since last run
Jul 05 18:01:14 bbonode run.sh[2810276]: info: Configuration: Now listening on: http://127.0.0.1:23000
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: BTC: Checking if any pending invoice got paid while offline...
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: BTC: 0 payments happened while offline
Jul 05 18:01:14 bbonode run.sh[2810276]: info: PayServer: Connected to WebSocket of NBXplorer (BTC)
- Ensure the BTCPay Server is running and listening on the default port
23000
$ sudo ss -tulpn | grep LISTEN | grep 23000
Expected output:
> tcp LISTEN 0 512 127.0.0.1:23000 0.0.0.0:* users:(("dotnet",pid=2811744,fd=320))
Now point your browser,
"http://minibolt.local:23000"
(or your node IP address) like "http://192.168.0.20:23000"
.You can now create the first account to access the dashboard using a real (recommended) or a dummy email, and password
Congratulations! You now have the amazing BTCPay Server payment processor running
You can easily do so by adding a Tor hidden service on the MiniBolt and accessing the BTCPay Server with the Tor browser from any device.
- Ensure that you are logged in with the user
admin
and add the following lines to thelocation hidden services
section, below## This section is just for location-hidden services ##
in the torrc file. Save and exit
$ sudo nano /etc/tor/torrc
# Hidden Service BTCPay Server
HiddenServiceDir /var/lib/tor/hidden_service_btcpay/
HiddenServiceVersion 3
HiddenServicePoWDefensesEnabled 1
HiddenServicePort 80 127.0.0.1:23000
- Reload the Tor configuration
$ sudo systemctl reload tor
- Get your connection address
$ sudo cat /var/lib/tor/hidden_service_btcpay/hostname
Example of expected output:
> abcdefg..............xyz.onion
- Stay logged as
admin
user, and configure LND to allow LND REST from anywhere editing thelnd.conf
file
$ sudo nano /data/lnd/lnd.conf
- Add the next line under the
[Application Options]
section. Save and exit
# Specify all ipv4 interfaces to listen on for REST connections
restlisten=0.0.0.0:8080
- Restart LND to apply changes
$ sudo systemctl restart lnd
- Ensure the REST port is now binding to the
0.0.0.0
host instead of127.0.0.1
$ sudo ss -tulpn | grep LISTEN | grep lnd | grep 8080
Expected output:
> tcp LISTEN 0 4096 0.0.0.0:8080 0.0.0.0:* users:(("lnd",pid=774047,fd=32))
- Stop BTCPay Server before making changes
$ sudo systemctl stop btcpay
- Change to the
btcpay
user
$ sudo su - btcpay
- Edit the
settings.config
file
$ nano .btcpayserver/Main/settings.config
- Add the next content to the end of the file. Save and exit
# Lightning internal node connection
BTC.lightning=type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=/data/lnd/data/chain/bitcoin/mainnet/admin.macaroon;allowinsecure=true
- Go back to the
admin
user
$ exit
- Start the BTCPay Server again
$ sudo systemctl start btcpay
Monitor logs with
$ journalctl -f -u btcpay
to ensure that all is running well- With user
admin
, stop BTCPay Server & NBXplorer
$ sudo systemctl stop btcpay && sudo systemctl stop nbxplorer
- Change to the
btcpay
user
$ sudo su - btcpay
- Enter the
src/nbxplorer
folder
$ cd src/NBXplorer
- Fetch the latest tag
$ git fetch --tags && git checkout $(git tag --sort -version:refname | awk 'match($0, /^v[0-9]+\./)' | head -n 1)
- Build it
$ ./build.sh
- Go back to the
admin
user
$ exit
- Start the NBXplorer & BTCpay server again. Monitor logs with
$ journalctl -f -u nbxplorer
&$ journalctl -f -u btcpay
to ensure that all is running well
$ sudo systemctl start nbxplorer && sudo systemctl start btcpay
- With user
admin
, stop BTCPay Server
$ sudo systemctl stop btcpay
- Change to the
btcpay
user
$ sudo su - btcpay
- Enter the
src/btcpayserver
folder
$ cd src/btcpayserver
- Fetch the latest tag
$ $ git checkout $(git tag --sort -version:refname | awk 'match($0, /^v[0-9]+\.[0-9]+\.[0-9]+$/)' | head -n 1)
- Build it
$ ./build.sh
- Go back to the
admin
user
$ exit
- Start the BTCpay server again. Monitor logs with
$ journalctl -f -u btcpay
to ensure that all is running well
$ sudo systemctl start btcpay
- Ensure you are logged in with the user
admin
, stopbtcpay
andnbxplorer
services
$ sudo systemctl stop btcpay
$ sudo systemctl stop nbxplorer
- Delete
btcpay
andnbxplorer
services
$ sudo rm /etc/systemd/system/btcpay.service