我不能通过RPC端口比特币连接



我已经设置了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

这是我的比特币。配置文件看起来像,

blocksonly=1
prune=1200
rpcauth=username:hash
rpcallowip=0.0.0.0/0
[main]
[test]
[regtest]

比特币节点正在运行一个ubuntu服务器和其他应用程序/端口允许外部连接除了所有比特币RPC端口有办法解决这个问题吗?

默认情况下RPC服务只绑定到本地接口。

使用rpcbind = & lt; ip-addr>在你的配置中,如果你想改变它。

但是,要注意公开暴露rpc端口是有安全风险的。

最新更新