【问题标题】:I can not connect through RPC port bitcoind我无法通过 RPC 端口 bitcoind 连接
【发布时间】: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 暴露给不受信任的网络。即使使用强密码,它也并非旨在确保安全!

标签: bitcoind bitcoin-testnet


【解决方案1】:

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

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-12-03
    • 1970-01-01
    • 2012-06-19
    • 2015-06-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-02-16
    相关资源
    最近更新 更多