Bitcoin RPC身份验证问题-regtest

问题描述 投票:0回答:1

我目前正在开发一个涉及运行完整比特币节点的比特币应用程序。

在测试源代码时,我决定使用比特币regtest模式。

这是我启动我的比特币节点的方式:

./bitcoind -regtest -rpcuser=a -rpcpassword=b -server -bind=0.0.0.0

这是我与regtest节点进行交互的方式:

./bitcoin-cli -regtest -rpcuser=a -rpcpassword=b getnewaddress

输出:

2N152jpoD9u52cpswsN7ih8RZ3P4DszaUGg

此示例按预期工作...但是!

我一开始尝试不使用bitcoin-cli]与比特币节点进行交互,但是我卡住了curl或python:

curl --user a --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://192.168.178.200:18444/

我被要求输入密码=>我输入b

然后说:

curl: (52) Empty reply from server

相同于:

curl --user a:b --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://192.168.178.200:18444/

和:

curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getnewaddress", "params": [] }' -H 'content-type: text/plain;' http://a:[email protected]:18444/

我还寻找了一个cookie文件来对cookie进行身份验证,但没有。

我已经研究了这个问题,例如

https://bitcoin.stackexchange.com/questions/22335/bitcoin-daemon-sends-empty-reply-from-server-when-in-test-net

和其他各种站点,但无济于事...

我正在运行版本0.18.0

嗯,我详细描述了我的问题,并提到了我已经尝试了两天的内容。

有什么建议吗?

感谢和问候!

我目前正在开发一个涉及运行完整的比特币节点的比特币应用程序。在测试源代码时,我决定使用比特币regtest模式。这就是我启动我的比特币的方式...

json authentication rpc bitcoin bitcoind
1个回答
0
投票

如果版本为> = 0.16.0

© www.soinside.com 2019 - 2024. All rights reserved.