我无法通过 RPC 端口 bitcoind 连接

问题描述

我已经设置了 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","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 端口是否有办法解决这个问题?

解决方法

RPC 服务默认只绑定本地接口。

如果您想更改它,请在您的配置中使用 rpcbind=

但是,请注意,公开 rpc 端口存在安全风险。

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...