<p>I am running a bitcoin daemon (launched via plist file) on MacOS with these parameters:</p>
<ul>
<li><code>-server</code> (to accept command line and JSON-RPC commands)</li>
<li><code>-daemon</code> (to run in the background as a daemon and accept commands)</li>
<li><code>-txindex=1</code> (I need to maintain a full transaction index for testing purposes)</li>
</ul>
<p>Both my bitcoin.conf and settings.json files are empty, and I want to use the random cookie authentication.</p>
<p>The node is running fine, has a local address 192.168.83.33, generates a .cookie file,  and is actually connected to 10 peers on tcp4 port 8333.</p>
<p>I would like to test the JSON-RPC API via HTTP (from another computer in the same local net) with the example command described in the <a href="https://en.bitcoin.it/wiki/API_reference_(JSON-RPC)" rel="nofollow noreferrer">bitcoin wiki</a>:</p>
<pre><code>curl --data-binary '{&quot;jsonrpc&quot;: &quot;1.0&quot;, &quot;id&quot;:&quot;curltest&quot;, &quot;method&quot;: &quot;getblockchaininfo&quot;, &quot;params&quot;: [] }' -H 'content-type: text/plain;' http://192.168.83.33:8333/
</code></pre>
<p>But I am receiving just empty replies (<code>curl: (52) Empty reply from server</code>), even when I try from the same node (on localhost address 127.0.0.1:8333)</p>
<p>Since I want to rely on random cookie authentication, I did not set any rpcuser. Do I need to pass the cookie file in the HTTP header (via curl's --cookie parameter)?</p>
<p>Bonus question: How can I set up one or more peer I would like to connect (along or instead of the random select pool)?</p>

CC BY-SA 4.0
2023-04-17T19:24:28.327Z
You need to pass the cookie's contents as HTTP auth username/password (username `__cookie__`, password a long hex string) if you manually connect. `bitcoin-cli` will do this automatically for you.
Pieter Wuille
CC BY-SA 4.0
2023-04-17T22:03:47.383Z
@PieterWuille I tried it already (with curl -u), and the client is working. What else could I check?
Claudio Floreani
CC BY-SA 4.0
2023-04-17T22:09:05.693Z
So did that fix the problem? What else is there to check?
Pieter Wuille
CC BY-SA 4.0
2023-04-17T22:17:44.870Z
@PieterWuille no. I mean the bitcoin-cli client is working, but I would like to test JSON-RPC commands via HTTP/curl, and write some JSON-RPC tool to play around with.
Claudio Floreani
CC BY-SA 4.0
2023-04-17T22:43:43.450Z
Are you sending the username and password from the cookie file?
Pieter Wuille
<bitcoind><json-rpc>
How to access bitcoin server's RPC interface remotely?
Claudio Floreani
# How to access bitcoin server's RPC interface remotely?

(Asked by: username_0 on 2023-04-17)

I am running a bitcoin daemon (launched via plist file) on MacOS with these parameters:

-server (to accept command line and JSON-RPC commands)
-daemon (to run in the background as a daemon and accept commands)
-txindex=1 (I need to maintain a full transaction index for testing purposes)

Both my bitcoin.conf and settings.json files are empty, and I want to use the random cookie authentication.
The node is running fine, has a local address 192.168.83.33, generates a .cookie file,  and is actually connected to 10 peers on tcp4 port 8333.
I would like to test the JSON-RPC API via HTTP (from another computer in the same local net) with the example command described in the bitcoin wiki:
curl --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "getblockchaininfo", "params": [] }' -H 'content-type: text/plain;' http://192.168.83.33:8333/

But I am receiving just empty replies (curl: (52) Empty reply from server), even when I try from the same node (on localhost address 127.0.0.1:8333)
Since I want to rely on random cookie authentication, I did not set any rpcuser. Do I need to pass the cookie file in the HTTP header (via curl's --cookie parameter)?
Bonus question: How can I set up one or more peer I would like to connect (along or instead of the random select pool)?

**Tags:** bitcoind, json-rpc

> **Comments:**
> **username_1**: You need to pass the cookie's contents as HTTP auth username/password (username `__cookie__`, password a long hex string) if you manually connect. `bitcoin-cli` will do this automatically for you.  
> **username_0**: @PieterWuille I tried it already (with curl -u), and the client is working. What else could I check?  
> **username_1**: So did that fix the problem? What else is there to check?  
> **username_0**: @PieterWuille no. I mean the bitcoin-cli client is working, but I would like to test JSON-RPC commands via HTTP/curl, and write some JSON-RPC tool to play around with.  
> **username_1**: Are you sending the username and password from the cookie file?  

---

## 0 answers

