For the life of me I can't figure this out...

I was having trouble getting my machine to port forward 8332, but 8333 seemed fine, so I ended up moving my rpcport to 8334, which seems to connect now but I keep getting this error now on the following python script...

My Python Script(named bitcoin104.py)

from bitcoinrpc.authproxy import AuthServiceProxy, JSONRPCException
# rpc_user and rpc_password are set in the bitcoin.conf file
#rpc_user = "myusername"
#rpc_password = "myuserpass"
rpc_connection = AuthServiceProxy("http://myusername:[email protected]:8334")

When i run it I get the following error...

PS D:\PROJECTS\python38_env_bitcoin\src\hellobitcoin101> python .\bitcoin104.py
Traceback (most recent call last):
  File ".\bitcoin104.py", line 8, in <module>
  File "D:\PROJECTS\python38_env_bitcoin\.venv\lib\site-packages\bitcoinrpc\authproxy.py",
line 139, in __call__
    response = self._get_response()
  File "D:\PROJECTS\python38_env_bitcoin\.venv\lib\site-packages\bitcoinrpc\authproxy.py", line 179, in _get_response
    http_response = self.__conn.getresponse()
  File "c:\users\hanso\appdata\local\programs\python\python38\lib\http\client.py", line 1344, in getresponse
  File "c:\users\hanso\appdata\local\programs\python\python38\lib\http\client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "c:\users\hanso\appdata\local\programs\python\python38\lib\http\client.py", line 276, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"*
http.client.RemoteDisconnected: Remote end closed connection without response

Here are all the options i have set in my bitcoin.conf file in my local directory for bitcoin...


I ended up commenting out rpcallowip just to give it the best chance of working...

Should also note the node seems to be running fine otherwise, so it is definitely up and running, and when I was first playing around with setup I left the port open for a day and had outside connections happening... So i think that is setup ok. Other then possible something I am doing wrong with the bitcoin.conf file.

And since I switched to port 8334 from 8332 I am at least now not getting a machine/host blocked request message. It seems to at least be communicating with the node now as well. But for some reason it doesn't seem to like the query?

I have no idea what I am doing wrong? Any help would be greatly appreciated as have been banging my head against the monitor all day on this now....

  • What were the router settings when you forwarded 8333? Jan 29 at 3:44
  • On what computer are you running the python-script? Are you running the python script and your bitcoin-node on the same machine?
    – Erik
    Jan 29 at 13:28
  • @user2880722 They were set for port forwarding on the ports i was attempting to connect through. When i had that not setup, i got a 'connection refused by computer', but when I added the port forwarding it stopped giving that error, and now gives the error above about timing out. Which makes me feel like it is actually not the portforwarding or firewall blocking issue now.....? Jan 30 at 9:30
  • @Erik I was using the same machine the node is running on. Hence connection using the address. Do you think I should try using my full address on my router instead? ie for example 192.168.68.XX Not sure if I mentioned but running on windows 11 machine. I feel like it is connecting now, at least partially, only because when I got opening port wrong i get a different error talking about the computer refusing connection. Now at least I am getting the "Remote end closed connection without response". It really feels like I am connecting... thought, definitely could be wrong... Jan 30 at 9:41
  • I wish I could see a working conf file, and matching python script using the rpc routines, then at least I could know how it is supposed to work. Right now I feel like I get only pieces, or examples setup on a cloud computer through one of those notebook sites, which I am sure don't have the same issues a real computer setup has like I am trying? It's frustrating because I Have no idea what to try next. Also I should mention I also can connect to my port using telnet just fine now, another reason I believe the port is available. Jan 30 at 9:44

1 Answer 1


So first you want to make sure that Bitcoin core is running. May seem obvious but I've forgotten that sometimes.

Next is the port forwarding. This may be the source of your problem.

You're going to want to go into your ethernet settings and network connection details. In there you will see an IPv4 address, something like 192.168.0.xx. Save that number.

Now go into your router settings, setup a TCP service on 8333 and put the IPv4 into the internal IP section and save.

Now to call this in python I use bitcoinlib.

my code looks like this:

from bitcoinlib.services.authproxy import AuthServiceProxy, JSONRPCException

def rpcConnect():
        rpc_connection = AuthServiceProxy("http://user:[email protected]:8332")
        return rpc_connection

My bitcoin conf looks like this. Some of these may not be relevant to you



  • Thanks @user2880722. I have already done the port forwarding on my local mesh router system setup. I added it specifically to my own machine. For some reason I could not for the life of my get 8332 open. I see 8333 is working fine when i run telnet or netstat -a. So I finally ended up trying 8334, and that worked it seems, at least I was able to telnet to it, where 8332 just would not work. Even after opening on myfirewall and router in as many ways as I could think to try... Jan 30 at 17:56
  • But I never had several of the options you had... namely.. coinstatsindex=1 daemon=1 txindex=1 So I am going to try those again. I will definitely try to see if my forwarding is working properly on my firewall and my router again, just to make sure. At work now so will try this later this evening and post how it went. Really hoping to figure this out as so frustrating... ;) Again thanks for the help!!! Jan 30 at 17:56
  • I have tried everything. I am certain my port is open, as when I telnet to it, it connects just fine. And when i use netstat -a, it shows up as 'listening' which wasn't happening before I set that port, so i think it isn't port forwarding or firewall issues. And when I run this... rpc_connection = AuthServiceProxy("username:[email protected]:8334") It seems to run no problem,.. but then when i try this right after.. print(rpc_connection.get_info()) It fails with the error... http.client.RemoteDisconnected: Remote end closed connection without response So frustrating. Jan 31 at 19:29
  • I am sure the connection is working now. it is the password I am now questioning.. But I dont' know what i could be wrong? my password is set as follows... rpcuser=one rpcpassword=two is there supposed to be quotes around the password and user id? The example .conf files I have seen had none of that. I am starting to think I might need to reopon this question and start again, and ask about how authorization, and what might be my issue on that front. As everything I confirmed my ports are open, and listening, it is just the server that seems to have some issue granting my request Jan 31 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.