【发布时间】:2021-05-04 09:01:24
【问题描述】:
我已经设置了 bitcoind,我可以运行 bitcoin-cli 命令,我也可以通过 RPC 发出请求。
curl --user username:password --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://127.0.0.1:18332
它也有效。但是通过公共 ip 连接只是返回Connection refused。
curl --user username:password --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://public-ip:18332
返回
curl: (7) Failed to connect to external-ip port 18332: Connection refused
这是我的 bitcoin.config 文件的样子,
blocksonly=1
prune=1200
rpcauth=username:hash
rpcallowip=0.0.0.0/0
[main]
[test]
[regtest]
比特币节点正在运行一个 ubuntu 服务器,其他应用程序/端口允许外部连接,除了所有 bitcoind RPC 端口。有没有办法解决这个问题?
【问题讨论】:
-
您不应该将 bitcoind RPC 暴露给不受信任的网络。即使使用强密码,它也并非旨在确保安全!