How to Install BTCPay Server on OpenBSD

BTCPay Server is a self-hosted Bitcoin payment processor. It allows merchants to receive Bitcoin payments directly to their own wallet, and it does not require any third-party service. BTCPay Server is open source and completely free to use.

This tutorial will guide you through the steps to install BTCPay Server on OpenBSD.

Prerequisites

  1. A VPS or dedicated server running OpenBSD
  2. SSH access to the server with root privileges
  3. An open port for Bitcoin payment processing (default is 23000)

Installation Steps

Step 1: Install Git

BTCPay Server requires Git to clone its repository. The following command will install Git:

$ sudo pkg_add git

Step 2: Clone the BTCPay Server Repository

Clone the BTCPay Server repository from GitHub:

$ git clone https://github.com/btcpayserver/btcpayserver.git

Step 3: Install Dependencies

To install the necessary dependencies, run the commands listed below:

$ cd btcpayserver
$ sudo chown -R _btcpay:wheel BTCPayServer/
$ sudo su - _btcpay
$ cd BTCPayServer
$ sh ./build.sh

Step 4: Configure Nginx

BTCPay Server uses Nginx as a reverse proxy. Edit the Nginx configuration file:

$ sudo vi /etc/nginx/nginx.conf

Add the following configuration at the end of the file:

server {
listen 80;
server_name yourdomain.com;

location / {
proxy_pass http://127.0.0.1:23000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

Replace "yourdomain.com" with the domain name or IP address of your server.

Step 5: Configure BTCPay Server

Create a configuration file for BTCPay Server:

$ cd /usr/local/btcpayserver/BTCPayServer
$ cp BTCPayServer.Tests/BTCPayServer.Tests.csproj.user BTCPayServer/Configs/Production/user secrets.json

Edit "user secrets.json" file and add your secrets:

{
  "BTCPAY_CHAINS": {
    "BTC": {
      "ConnectionString": "Your BitcoinD Connection String",
      "CryptoCode": "BTC"
    }
  },
  "BTCPAY_CRYPTO": {
    "BTC": {
      "CryptoCode": "BTC",
      "BlockExplorerLink": "https://live.blockcypher.com/btc/tx/{0}",
      "DisplayName": "Bitcoin",
      "MinimalCryptoDeposit": "0.0001",
      "CryptoImagePath": "/cryptocurrencies/btc.svg",
      "LightningImagePath": "",
      "CryptoBaseUnit": "Satoshi",
      "CryptoCodeInExchange": "BTC",
      "TxOutput:Value": "0.0005",
      "Multisig": []
    }
  },
  "BTCPAY_NETWORK": "mainnet",
  "BTCPAY_APPDATA": "/mnt/BTCPayServer",
  "BTCPAY_ROUNDRADIUS": "1",
  "BTCPAY_ENABLEPAYMENTREQUEST": false,
  "BTCPAY_USINGPAYJOIN": false,
  "NBITCOIN_DEFAULTNETWORK": "mainnet",
  "ChainType": "BTCPayServer.Payments.Bitcoin.BitcoindCookieFileWallet, BTCPayServer"
}

Replace "Your BitcoinD Connection String" with the connection string for your Bitcoin node.

Step 6: Start BTCPay Server

Finally, you can start BTCPay Server with the following command:

$ cd /usr/local/btcpayserver/BTCPayServer
$ dotnet run --no-launch-profile --no-build

BTCPay Server will start and bind to port 23000 by default. You can access it using a web browser with the server's domain name or IP address.

Conclusion

BTCPay Server provides a secure and private way for merchants to accept Bitcoin payments. With this tutorial, you now know how to install BTCPay Server on OpenBSD, and you can now start accepting Bitcoin payments on your own server.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!