BTCPay Server 是一个开源、自托管的加密货币支付网关,可以让你像 Stripe 一样接收 BTC(比特币)付款,而且无需中介、无手续费托管风险。
本文将手把手教你:
👉 从 0 到 1 搭建属于自己的 BTCPay 支付系统
BTCPay Server 是一个:
👉 类似:
但它是 去中心化版本
| 配置 | 要求 |
|---|---|
| CPU | 4核 |
| 内存 | 8GB |
| 硬盘 | 500GB+ |
| 网络 | 公网IP |
| 配置 | 可行 |
|---|---|
| CPU | 2核 |
| 内存 | 4GB |
| 硬盘 | 30~50GB |
👉 必须开启:
opt-save-storage
否则直接炸盘 ❗
你需要准备:
pay.example.com)git clone https://github.com/btcpayserver/btcpayserver-docker
cd btcpayserver-docker
# Run btcpay-setup.sh with the right parameters
export BTCPAY_HOST="btcpay.EXAMPLE.com"
export NBITCOIN_NETWORK="mainnet"
export BTCPAYGEN_CRYPTO1="btc"
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-xs"
export BTCPAYGEN_REVERSEPROXY="nginx"
export BTCPAYGEN_LIGHTNING="clightning"
export BTCPAY_ENABLE_SSH=true
export BTCPAYGEN_ADDITIONAL_FRAGMENTS="opt-save-storage-xs"
👉 作用:
. ./btcpay-setup.sh -i
❗ 注意:
./btcpay-setup.sh. 或 source安装过程中会自动:
很多人卡在这里 👇
👉 打开网站显示:
503 Service Temporarily Unavailable
👉 Bitcoin 节点还没同步完成
bitcoind → nbxplorer → btcpayserver
| 配置 | 时间 |
|---|---|
| 高配服务器 | 6~12小时 |
| 低配服务器 | 1~3天 |
docker exec -it btcpayserver_bitcoind bitcoin-cli getblockchaininfo
关注:
"verificationprogress": 0.23
👉 表示已同步 23%
btcpay-down
docker system prune -a
docker volume prune
. btcpay-setup.sh -i
BTCPay 提供 API:
POST /api/v1/stores/{storeId}/invoices
👉 你可以实现:
如果你是做:
自己跑完整 BTC 节点(太重)
👉 BTCPay Server 的核心优势:
👉 但部署要注意: