<p>You'll need to specify an IP address to bind the RPC interface to. Since Bitcoin Core 0.18, it's not sufficient to have "rpcallowip=*", as it will by still default still only bind to localhost.</p>

<p>So add:</p>

<pre><code>rpcbind=fakeip
</code></pre>

CC BY-SA 4.0
2019-06-26T03:01:48.923Z
Hi Pieter, big fan. The C# code is working now but I'm getting error code -32700 when using curl. Any idea why? If not, using C# should be enough for what I want to do. Thanks a lot.
fon
CC BY-SA 4.0
2019-06-26T03:09:33.920Z
The `getinfo` command was deprecated in version 0.16, and subsequently removed. Use the more specific `getblockchaininfo`, `getpeerinfo`, `getnetworkinfo`, `getwalletinfo`, ... instead.
Pieter Wuille
CC BY-SA 4.0
2019-06-26T03:14:00.640Z
Oh yeah, I figured that out. The error is the same for any command. The error message is "Parse error".
fon
CC BY-SA 4.0
2019-06-26T03:15:06.510Z
Can you update your question with the exact command and output?
Pieter Wuille
CC BY-SA 4.0
2019-06-26T21:37:50.580Z
I tried your command on my system and it works fine.
Pieter Wuille
CC BY-SA 4.0
2019-06-26T01:21:15.023Z
2019-06-26T01:21:15.023Z
Pieter Wuille
<p>I'm trying to perform a remote JSON RPC. It works fine using localhost but not if I try to do it from another computer.</p>

<p>Here's what I have so far:</p>

<pre><code>            int index = 0;
        HttpWebRequest webRequest = (HttpWebRequest).Create("http://fakeip:8332");

        webRequest.Credentials = new NetworkCredential("fakeuser", "fakepw");
        /// important, otherwise the service can't desirialse your request properly
        webRequest.ContentType = "application/json-rpc";
        webRequest.Method = "POST";

        JObject joe = new JObject();
        joe.Add(new JProperty("jsonrpc", "1.0"));
        joe.Add(new JProperty("id", "1"));
        joe.Add(new JProperty("method", "getinfo"));
        // params is a collection values which the method requires..
        Dictionary&lt;string, string&gt; Params = new Dictionary&lt;string, string&gt;();
        if (Params.Keys.Count == 0) {
            joe.Add(new JProperty("params", new JArray()));
        } else {
            JArray props = new JArray();
            // add the props in the reverse order!
            for (int i = Params.Keys.Count - 1; i &gt;= 0; i--) {
            }
            joe.Add(new JProperty("params", props));
        }

        // serialize json for the request
        string s = JsonConvert.SerializeObject(joe);
        byte[] byteArray = Encoding.UTF8.GetBytes(s);
        webRequest.ContentLength = byteArray.Length;
        Stream dataStream = webRequest.GetRequestStream();
        dataStream.Write(byteArray, 0, byteArray.Length);
        dataStream.Close();

        WebResponse webResponse = webRequest.GetResponse();
</code></pre>

<p>which gives this exception:</p>

<pre><code>    Unable to connect to the remote server ---&gt; System.Net.Sockets.SocketException: 
A connection attempt failed because the connected party did not properly respond 
after a period of time, or established connection failed because connected host
 has failed to respond fakeip:8332
</code></pre>

<p>I've tried using curl too:</p>

<pre><code>   curl --data-binary 
    '{"jsonrpc":"1.0","id":"curltext","method":"getnetworkinfo","params":[]}' 
-H 'content-type:text/plain;' http://fakeuser:fakepw@fakeip:8332

curl: (7) Failed to connect to fakeip port 8332: Timed out
</code></pre>

<p>My bitcoin.conf:</p>

<pre><code>testnet=0
server=1
rpcuser=fakeuser
rpcpassword=fakepw
rpcallowip=0.0.0.0/0
txindex=1
</code></pre>

<p>Anyone have any ideas?</p>

<p>Edit: rpcbind allows me to make the RPC query using C# but the curl method is still not working.</p>

<p>Running the following:</p>

<pre><code>curl --data-binary 
'{"jsonrpc":"1.0","id":"curltext","method":"getnetworkinfo","params":[]}' -H
 'content-type:text/plain;' http://fakeuser:fakepw@fakeip:8332
</code></pre>

<p>results in:</p>

<pre><code>{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}
</code></pre>

<p>I get the same error for any command.</p>

<json-rpc>
Can't perform remote JSON RPC to my Bitcoin node (C#)
fon
# Can't perform remote JSON RPC to my Bitcoin node (C#)

(Asked by: username_0 on 2019-06-25)

I'm trying to perform a remote JSON RPC. It works fine using localhost but not if I try to do it from another computer.
Here's what I have so far:
            int index = 0;
        HttpWebRequest webRequest = (HttpWebRequest).Create("http://fakeip:8332");

        webRequest.Credentials = new NetworkCredential("fakeuser", "fakepw");
        /// important, otherwise the service can't desirialse your request properly
        webRequest.ContentType = "application/json-rpc";
        webRequest.Method = "POST";

        JObject joe = new JObject();
        joe.Add(new JProperty("jsonrpc", "1.0"));
        joe.Add(new JProperty("id", "1"));
        joe.Add(new JProperty("method", "getinfo"));
        // params is a collection values which the method requires..
        Dictionary Params = new Dictionary();
        if (Params.Keys.Count == 0) {
            joe.Add(new JProperty("params", new JArray()));
        } else {
            JArray props = new JArray();
            // add the props in the reverse order!
            for (int i = Params.Keys.Count - 1; i >= 0; i--) {
            }
            joe.Add(new JProperty("params", props));
        }

        // serialize json for the request
        string s = JsonConvert.SerializeObject(joe);
        byte[] byteArray = Encoding.UTF8.GetBytes(s);
        webRequest.ContentLength = byteArray.Length;
        Stream dataStream = webRequest.GetRequestStream();
        dataStream.Write(byteArray, 0, byteArray.Length);
        dataStream.Close();

        WebResponse webResponse = webRequest.GetResponse();

which gives this exception:
    Unable to connect to the remote server ---> System.Net.Sockets.SocketException: 
A connection attempt failed because the connected party did not properly respond 
after a period of time, or established connection failed because connected host
 has failed to respond fakeip:8332

I've tried using curl too:
   curl --data-binary 
    '{"jsonrpc":"1.0","id":"curltext","method":"getnetworkinfo","params":[]}' 
-H 'content-type:text/plain;' http://fakeuser:fakepw@fakeip:8332

curl: (7) Failed to connect to fakeip port 8332: Timed out

My bitcoin.conf:
testnet=0
server=1
rpcuser=fakeuser
rpcpassword=fakepw
rpcallowip=0.0.0.0/0
txindex=1

Anyone have any ideas?
Edit: rpcbind allows me to make the RPC query using C# but the curl method is still not working.
Running the following:
curl --data-binary 
'{"jsonrpc":"1.0","id":"curltext","method":"getnetworkinfo","params":[]}' -H
 'content-type:text/plain;' http://fakeuser:fakepw@fakeip:8332

results in:
{"result":null,"error":{"code":-32700,"message":"Parse error"},"id":null}

I get the same error for any command.

**Tags:** json-rpc


---

## 1 answers

### Answer by username_1 on 2019-06-26. Score: 1 | Accepted answer

You'll need to specify an IP address to bind the RPC interface to. Since Bitcoin Core 0.18, it's not sufficient to have "rpcallowip=*", as it will by still default still only bind to localhost.
So add:
rpcbind=fakeip

> **Comments:**
> **username_0**: Hi Pieter, big fan. The C# code is working now but I'm getting error code -32700 when using curl. Any idea why? If not, using C# should be enough for what I want to do. Thanks a lot.  
> **username_1**: The `getinfo` command was deprecated in version 0.16, and subsequently removed. Use the more specific `getblockchaininfo`, `getpeerinfo`, `getnetworkinfo`, `getwalletinfo`, ... instead.  
> **username_0**: Oh yeah, I figured that out. The error is the same for any command. The error message is "Parse error".  
> **username_1**: Can you update your question with the exact command and output?  
> **username_1**: I tried your command on my system and it works fine.  

---

