2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

BTCPayServerのセットアップ手順

Last updated at Posted at 2024-06-18

趣旨

Bitcoinをもっと実生活で使う方法はないかとリサーチしている時にBTCPayServerがおもしろそうだと思ったので実験的にローカルサーバーに導入してみました。

以下は、Raspberry PiでBitcoin CoreとBTCPayServerをセットアップし、複数の店舗にビットコインによる支払いサービスを提供するための手順と使用したコマンドの概要です。ただし適宜自分の状況に合わせて設定を一部変える必要があると思います。

補足:

  • Tor利用
  • Blockchainの全データをダウンロードしたくないのでprune=5500をセット
  • LightningはセットせずOnchainBTCのみセット

事前準備

Raspberry Piを最新の状態にする

sudo apt update
sudo apt upgrade

DockerとDocker Composeのインストール

Dockerのインストール

sudo apt install -y docker.io
sudo systemctl start docker
sudo systemctl enable docker

Docker Composeのインストール

sudo apt install -y python3-pip
sudo pip3 install docker-compose

Bitcoin Coreのインストールと設定

wget https://bitcoincore.org/bin/bitcoin-core-27.0/bitcoin-27.0-aarch64-linux-gnu.tar.gz
tar -xzf bitcoin-27.0-aarch64-linux-gnu.tar.gz
sudo install -m 0755 -o root -g root -t /usr/local/bin bitcoin-27.0/bin/*

Bitcoin Coreの設定ファイル作成

mkdir ~/.bitcoin
nano ~/.bitcoin/bitcoin.conf

設定ファイルに以下の内容を追加:

prune=5500
proxy=127.0.0.1:9050
bind=127.0.0.1
listenonion=1
server=1
rpcuser=your_rpc_username
rpcpassword=your_rpc_password

Torのインストールと設定

sudo apt install tor
sudo nano /etc/tor/torrc

torrcファイルに以下の行を追加:

ControlPort 9051
CookieAuthentication 1
CookieAuthFileGroupReadable 1

Torサービスの再起動

sudo systemctl restart tor
sudo systemctl status tor

Bitcoin Coreの起動

bitcoind -daemon

BTCPayServerのセットアップ

BTCPayサーバーDockerリポジトリのクローン作成

git clone https://github.com/btcpayserver/btcpayserver-docker
cd btcpayserver-docker

環境変数の設定

export BTCPAY_HOST="http://$IP"
export NBITCOIN_NETWORK="mainnet"
export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_REVERSEPROXY="none"

Gitの安全なディレクトリとしてマークする

sudo su -
git config --global --add safe.directory /home/daniel/bitcoin/btcpayserver-docker

セットアップスクリプトの実行

BTCPayサーバーDockerディレクトリに移動し、セットアップスクリプトを実行:

cd /home/daniel/bitcoin/btcpayserver-docker
source btcpay-setup.sh -i

ポート競合のトラブルシューティング

ポート80を使用しているDockerコンテナを特定して停止:

sudo docker ps
sudo docker stop tradingview-alert-connector-webserver-1

BTCPayサーバーの再起動

sudo btcpay-restart.sh

Adminページ

ローカルネットでhttp://$IPにアクセスするとBTCPayServerのAdminページになります。

Screenshot 2024-06-18 at 21.07.55.png

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?