Can't RPC to Bitcoind (C# / Windows)

1

I am running a node on Windows Server 2016. Everything seems to be running fine.

If I go to https://bitnodes.earn.com/ and put myip:8333, the node is successfully reachable.

My bitcoin.conf is: server=1 txindex=1 rpcuser=... rpcpassword=...

Locally, I can access it:

bitcoin-cli.exe -rpcuser=... -rpcpassword=... getinfo

returns:

{
  "deprecation-warning": "WARNING: getinfo is deprecated and will be fully removed in 0.16. Projects should transition to using getblockchaininfo, getnetworkinfo, and getwalletinfo before upgrading to 0.16",
  "version": 150001,
  "protocolversion": 70015,
  "walletversion": 139900,
  "balance": 0.00000000,
  "blocks": 0,
  "timeoffset": 0,
  "connections": 16,
  "proxy": "",
  "difficulty": 1,
  "testnet": false,
  "keypoololdest": 1506982194,
  "keypoolsize": 2000,
  "paytxfee": 0.00000000,
  "relayfee": 0.00001000,
  "errors": ""
}

However, any C# bitcoin lib I tried always returns the same web exception when trying to connect to bitcoind:

"The underlying connection was closed: The connection was closed unexpectedly."

and, also, I do not understand why some samples use port 8332, some 8333, etc. I don't have anything listening to 8332.

What could I be missing?

Thomas

Posted 2017-10-31T01:59:00.687

Reputation: 125

Answers

1

I do not understand why some samples use port 8332, some 8333, etc.

Port 8333 is the port that bitcoin uses to connect to other nodes on the network. Port 8332 is the default port for a bitcoin RPC interface. To connect with RPC, use port 8332 or specify a different port with rpcport=<port> option

MeshCollider

Posted 2017-10-31T01:59:00.687

Reputation: 8 735

oh ok, so I'm going to look at a firewall issue then because 8333 is reachable and nothing replies at 8332Thomas 2017-10-31T02:16:42.867

ok, I got it: the RPC calls are only allowing localhost by default...Thomas 2017-10-31T03:17:55.893

Yes, you can allow other IPs with the rpcallowip=&lt;ip&gt; optionMeshCollider 2017-10-31T03:25:25.093

@MeshCollider Is there a way to allow all IPs?Eutherpy 2017-11-15T21:56:38.267

You can use wildcard * but is dangerous to accept connection from anywhere. You can limit to a specific IP range for example 192.168.0.*MeshCollider 2017-11-15T22:58:35.747