Babylon Docs 中文版
by DocsZH
  • 介绍 Babylon
    • Babylon 概述
    • 比特币时间戳
    • 比特币质押
    • Babylon 架构
  • 用户指南
    • 比特币质押主网-阶段 1
      • 后端部署
        • 后端部署概述
        • 基础设施设置
          • MongoDB设置
          • RabbitMQ设置
          • 比特币全节点设置
        • 后端服务设置
          • 质押索引器
          • 质押 API
          • 质押期限检查器
        • 全局系统配置
    • 比特币质押测试网-4
    • 比特币质押测试网-3 (Sunset)
      • 安装
      • 验证器部署概述
      • 区块链网络信息
      • 设置节点
      • 获取测试网代币
      • 成为验证者
      • 成为 Finality 提供商
        • EOTS 管理器
        • Finality 提供商
      • 使用 BTC Staker CLI 进行质押
      • 成为 Babylon 守护者
      • BTC 时间戳集成
  • 开发者指南
    • Babylon 开发模块
      • Epoching 模块
      • 检查点模块
      • BTC 检查点模块
      • BTC 轻客户端模块
      • Zone Concierge 模块
    • Babylon Vigilantes 模块
      • Vigilante 提交者程序
      • Vigilante 报告者程序
      • 检查点监控器程序
    • gRPC 网关 (REST API)
  • Babylon 白皮书
  • 团队支持
  • 常见问题
  • 相关链接
    • Babylon 官方链接
    • DocsZH 相关链接
  • CLI 代码参考
由 GitBook 提供支持
在本页
  • 硬件要求
  • Bitcoin Core设置
  • bitcoind配置
  • 启动bitcoind
  • 为bitcoind创建一个systemd服务 (可选)
  • 服务器监控
  1. 用户指南
  2. 比特币质押主网-阶段 1
  3. 后端部署
  4. 基础设施设置

比特币全节点设置

上一页RabbitMQ设置下一页后端服务设置

最后更新于7个月前

硬件要求

  • CPU:多核处理器

  • 内存:至少 8GB

  • 硬盘:至少 800GB 的SSD硬盘,可容纳完整的比特币区块链。

Bitcoin Core设置

从选择合适你操作系统的bitcoin-core文件,下载并安装。本文档中的所有程序均与版本兼容。

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

  1. 启动比特币守护进程

bitcoind
  1. 验证bitcoind是否运行

检查bitcoind运行状态:

bitcoin-cli getblockchaininfo

如果看到有关区块链的信息,表明bitcoind运行正常。

为bitcoind创建一个systemd服务 (可选)

  1. 创建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
  1. 重新加载systemd管理器配置

sudo systemctl daemon-reload
  1. 启用开机自动启动功能

sudo systemctl enable bitcoind.service
  1. 启动服务器

sudo systemctl start bitcoind.service

服务器监控

建议不要在配置中硬编码RPC服务器密码 (rpcpassword),而是生成其 (salted hash) 并使用rpcauth字段。要生成加盐哈希,可以参考——但是,加盐操作应在本地执行。生成的配置值如下所示:

可通过轮询bitcoind服务器的可用性。

比特币特定的Prometheus指标可以通过任何开源来公开。

Bitcoin Core官方
bitcoin-core-26.0
加盐哈希
此示例
Prometheus Blackbox Exporter
Prometheus bitcoind导出器