比特币现金bitcoin-cli无法连接到RPC服务器

时间:2019-07-25 16:58:18

标签: bitcoin

我正在运行比特币服务器,并通过运行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.

2 个答案:

答案 0 :(得分:0)

(本地)cli命令与rpc身份验证无关。 只需尝试如下命令:

  

bitcoin-cli getinfo

     

bitcoin-cli -rpcport = 8332 getinfo

答案 1 :(得分:0)

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