我已经设置了bitcoind,我能够运行比特币-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端口之外,还有其他的方法来解决这个问题吗?
发布于 2021-02-12 12:37:38
默认情况下,RPC服务仅绑定到本地接口。
如果要更改配置,请在配置中使用rpcbind=。
但是,要注意公开rpc端口是一种安全风险。
https://stackoverflow.com/questions/65971466
复制相似问题