比特币全节点设置
硬件要求
CPU:多核处理器
内存:至少 8GB
硬盘:至少 800GB 的SSD硬盘,可容纳完整的比特币区块链。
Bitcoin Core设置
从Bitcoin Core官方选择合适你操作系统的bitcoin-core文件,下载并安装。本文档中的所有程序均与bitcoin-core-26.0版本兼容。
bitcoind配置
bitcoind通过名为bitcoin.conf
的主配置文件进行配置。
根据操作系统的不同,配置文件应放置在对应的文件路径中:
MacOS:
/Users/<username>/Library/Application Support/Bitcoin
Linux:
/home/<username>/.bitcoin
Windows:
C:\Users\<username>\AppData\Roaming\Bitcoin
两台服务器都可以使用以下基本参数框架 (适用于BTC签名网络):
# Accept command line and JSON-RPC commands
server=1
# Enable transaction indexing
txindex=1
# RPC server settings
rpcuser=<rpc-username>
rpcpassword=<rpc-password>
# Optional: In case of non-mainnet BTC node,
# the following two lines specify the network that your
# node will operate; for this example, utilizing signet
signet=1
[signet]
# Port your bitcoin node will listen for incoming requests;
# below port is the canonical port for signet,
# for mainnet, typically 8332 is used
rpcport=38332
# Address your bitcoin node will listen for incoming requests
rpcbind=0.0.0.0
# Optional: Needed for remote node connectivity
rpcallowip=0.0.0.0/0
注意事项:
rpcauth=<rpc-password-salted-hash>
如果你要连接到比特币主网,请确保删除下方配置:
signet=1
[signet]
启动bitcoind
启动比特币守护进程
bitcoind
验证bitcoind是否运行
检查bitcoind运行状态:
bitcoin-cli getblockchaininfo
如果看到有关区块链的信息,表明bitcoind
运行正常。
为bitcoind创建一个systemd服务 (可选)
创建systemd服务定义
运行下方命令,将your_username
替换为你的自定义用户名:
cat <<EOF | sudo tee /etc/systemd/system/bitcoind.service
[Unit]
Description=Bitcoin daemon
After=network.target
[Service]
ExecStart=/usr/local/bin/bitcoind -conf=/home/your_username/.bitcoin/bitcoin.conf
ExecStop=/usr/local/bin/bitcoin-cli stop
User=your_username
Restart=always
[Install]
WantedBy=multi-user.target
EOF
重新加载systemd管理器配置
sudo systemctl daemon-reload
启用开机自动启动功能
sudo systemctl enable bitcoind.service
启动服务器
sudo systemctl start bitcoind.service
服务器监控
可通过Prometheus Blackbox Exporter轮询bitcoind服务器的可用性。
比特币特定的Prometheus指标可以通过任何开源Prometheus bitcoind导出器来公开。
最后更新于