Btcpayserver

From ArchWiki

BTCPayServer is an open source payment processor for crypto currencies licensed under the MIT license. While Bitcoin is supported natively, other crypto currencies are supported via extensions. The software is written in C# and is accessed over the web browser. The core idea of the project is to give merchants full control over payments without a middleman.

Installation

Install the package btcpayserverAUR.

Configuration

Bitcoin

BTCPayServer communicates with the Bitcoin node via RPC. For this, those values need to be set. Edit /etc/bitcoin/bitcoin.conf and set rpcuser= and rpcpassword=. Moreover, a whitelist must be defined with whitelist=127.0.0.1.

Note: Bitcoin requires several hundreds GiB of disk space. You may want to run a pruned node. This is done by uncommenting prune=550 in /etc/bitcoin/bitcoin.conf.

Optional configuration

Usage of the lightning network is optional. Information on the lightning connection string can be found here. Decide for one lightning implementation.

LND

Execute lnd as a private key needs to be generated. Then, execute lncli create and create your needed wallet or restore an existing one. Edit /etc/bitcoin/bitcoin.conf and add the following settings.

zmqpubrawblock=tcp://127.0.0.1:28332
zmqpubrawtx=tcp://127.0.0.1:28333

Usage

Start/enable bitcoind.service

Lightning

Core Lightning

lightningd --bitcoin-rpcpassword "${bitcoin_rpc_password}" --bitcoin-rpcuser "${USER}" --log-level info --network bitcoin --rpc-file "${XDG_STATE_HOME}"/lightning/lightning-rpc

LND

lnd --bitcoin.active --bitcoin.mainnet --bitcoin.node bitcoind --bitcoind.rpcpass "${bitcoin_rpc_password}" --bitcoind.rpcuser "${USER}" --bitcoind.zmqpubrawblock tcp://127.0.0.1:28332 --bitcoind.zmqpubrawtx tcp://127.0.0.1:28333 --externalip localhost lncli unlock

NBXplorer

nbxplorer --btcrpcpassword "${bitcoin_rpc_password}" --btcrpcuser "${USER}" -d "${XDG_DATA_HOME}"/nbxplorer/ --postgres "User ID=\"${USER}\";Password=\"${postgresql_password}\";Host=localhost;Port=5432;Database=nbxplorer;"

BTCPayServer

When running no lightning node, just skip the option --btclightning.

With Core Lightning

btcpayserver --btclightning type=clightning;unix://"${XDG_STATE_HOME}"/lightning/lightning-rpc -d "${XDG_DATA_HOME}"/btcpayserver/ --explorerpostgres "User ID=\"${USER}\";Password=\"${postgresql_password}\";Host=localhost;Port=5432;Database=nbxplorer;\" --sqlitefile btcpayserver.db

With LND

btcpayserver --btclightning type=lnd-rest;server=https://127.0.0.1:8080/;macaroonfilepath=/home/"${USER}"/.lnd/data/chain/bitcoin/mainnet/admin.macaroon;certthumbprint="$(openssl x509 -noout -fingerprint -sha256 -in ~/.lnd/tls.cert | sed -e "s/.*=//;s/://g")" -d "${XDG_DATA_HOME}\"/btcpayserver/ --explorerpostgres "UserID=\"${USER}\";Password=${postgresql_password};Host=localhost;Port=5432;Database=nbxplorer;\" --sqlitefile btcpayserver.db