首页 > 解决方案 > 比特币现金 bitcoin-cli 无法连接到 RPC 服务器

问题描述

我正在运行一个比特币服务器,我通过运行 bitcoin-cli getinfo 来验证它的工作。我有一个新的比特币现金服务器,它的设置基本相同,但是当我运行 cli 命令时它会出错。当我从服务器运行此命令时;

bitcoin-cli -rpcuser bitcoin -stdinrpcpass REDACTED_1aAbY -conf /data01/bitcoin/bitcoin.conf -rpcport 8332 getinfo

我得到了这个结果; error: Could not locate RPC credentials. No authentication cookie could be found, and RPC password is not set. See -rpcpassword and -stdinrpcpass. Configuration file: (/home/ubuntu/.bitcoin/bitcoin.conf)

无论我在 bitcoin-cli 上使用什么标志,我都会遇到同样的错误。该错误表明 conf 文件应位于 /home/ubuntu/.bitcoin/bitcoin.conf 但该文件和目录不存在。

我的服务器配置看起来像;

server=1
txindex=1
zmqpubrawtx=tcp://127.0.0.1:28332
zmqpubhashblock=tcp://127.0.0.1:28332
rpcallowip=127.0.0.1
rpcallowip=0.0.0.0/0
rpcuser=bitcoin
rpcpassword=REDACTED_1aAbY
rpcbind=0.0.0.0
rest=1
daemon=1
datadir=/data01/bitcoin
rpcworkqueue=128
whitelist=0.0.0.0/0
rpcallowip=::/0
printtoconsole=1

如果我停止运行 bitcoind exe,则会收到此错误;


Make sure the bitcoind server is running and that you are connecting to the correct RPC port.```
That tells me at least I'm running against what I think I am.

标签: bitcoin

解决方案


事实证明,当服务器仍在下载块时,您无法连接到 rpc 服务器。完成后,您可以连接到服务器。使用 bitcoin-cli getinfo 是最初的问题。


推荐阅读