Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ECONNREFUSED from external bitcoind #168

Open
Dwyte opened this issue Aug 28, 2020 · 2 comments
Open

ECONNREFUSED from external bitcoind #168

Dwyte opened this issue Aug 28, 2020 · 2 comments

Comments

@Dwyte
Copy link

Dwyte commented Aug 28, 2020

Describe the issue
ECONNREFUSED from external bitcoind. I've tried everything I could form the instructions, I never used docker before so I might be missing something...

Error log:

explorer    | 2020-08-28T10:26:01.453Z btcexp:app Verifying RPC connection...
explorer    | 2020-08-28T10:26:01.454Z btcexp:error Error 32euofeege: Error: connect ECONNREFUSED 127.0.0.1:8080, json: {"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080},"isOperational":true,"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080}, userData: [object Object] (json: {"cmd":"getnetworkinfo"})
explorer    | 2020-08-28T10:26:01.454Z btcexp:error Error 32ugegdfsde: Error: connect ECONNREFUSED 127.0.0.1:8080, json: {"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080},"isOperational":true,"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080}
nodejs      | 2020-08-28T10:26:14Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:14Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:14Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:14Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
explorer    | 2020-08-28T10:26:31.458Z btcexp:app Verifying RPC connection...
explorer    | 2020-08-28T10:26:31.462Z btcexp:error Error 32euofeege: Error: connect ECONNREFUSED 127.0.0.1:8080, json: {"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080},"isOperational":true,"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080}, userData: [object Object] (json: {"cmd":"getnetworkinfo"})
explorer    | 2020-08-28T10:26:31.463Z btcexp:error Error 32ugegdfsde: Error: connect ECONNREFUSED 127.0.0.1:8080, json: {"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080},"isOperational":true,"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080}
nodejs      | 2020-08-28T10:26:34Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:34Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:34Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:34Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:54Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:54Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:54Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
nodejs      | 2020-08-28T10:26:55Z  INFO  Bitcoind RPC : API is still unreachable. New attempt in 20s.
explorer    | 2020-08-28T10:27:01.461Z btcexp:app Verifying RPC connection...
explorer    | 2020-08-28T10:27:01.463Z btcexp:error Error 32euofeege: Error: connect ECONNREFUSED 127.0.0.1:8080, json: {"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080},"isOperational":true,"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080}, userData: [object Object] (json: {"cmd":"getnetworkinfo"})
explorer    | 2020-08-28T10:27:01.463Z btcexp:error Error 32ugegdfsde: Error: connect ECONNREFUSED 127.0.0.1:8080, json: {"cause":{"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080},"isOperational":true,"errno":"ECONNREFUSED","code":"ECONNREFUSED","syscall":"connect","address":"127.0.0.1","port":8080}

docker-bitcoind.conf

# Type: alphanumeric
BITCOIND_RPC_USER=user

# Password of user account used for rpc access to bitcoind
# Type: alphanumeric
BITCOIND_RPC_PASSWORD=pass 

# other configs... skipped

# IP address of bitcoind used by Dojo
# Set value to 172.28.1.5 if BITCOIND_INSTALL is set to 'on'
# Type: string
BITCOIND_IP=127.0.0.1

# Port of the RPC API
# Set value to 28256 if BITCOIND_INSTALL is set to 'on'
# Type: integer
BITCOIND_RPC_PORT=8080

# Port exposing ZMQ notifications for raw transactions
# Set value to 9501 if BITCOIND_INSTALL is set to 'on'
# Type: integer
BITCOIND_ZMQ_RAWTXS=3000

# Port exposing ZMQ notifications for block hashes
# Set value to 9502 if BITCOIND_INSTALL is set to 'on'
# Type: integer
BITCOIND_ZMQ_BLK_HASH=4200

bitcoin.conf

txindex=1
listen=1
server=1

# Check that bitcoind accepts connections from 127.0.0.1 (linux)
# or from the IP address of the Docker Virtual Machine (MacOS, Windows)
rpcallowip=127.0.0.1

# Check that a port is defined for the RPC API (or 8332 will be used as default value)
rpcport=8080

# Check that the RPC API listens on an IP address accessible from the nodejs container
rpcbind=127.0.0.1

# Check that the RPC user is set
rpcuser=user

# Check that the RPC password is set
rpcpassword=pass

# Enable publish hash block on an IP address accessible from the nodejs container
zmqpubhashblock=127.0.0.1:4200

# Enable publish raw transaction on an IP address accessible from the nodejs container
zmqpubrawtx=127.0.0.1:3000

Desktop (please complete the following information):

  • OS: Elementary OS 5.1
  • Dojo Version v1.6.0
  • External bitcoind

Additional context
Add any other context about the problem here.

@crypt-chameleon
Copy link

I have a similar issue, where I have gotten the nodejs container to connect, but still cannot do rpc calls with the explorer or bitcoin-cli now.
BUT what helped was

  1. don't use 127.0.0.1 for your local machines IP, but the IP address you find using the command "ip a" which would likely be something like 192.168.1.X
  2. rpcallowip should be the IP address for the docker container which is something like 172.28.1.x

@crypt-chameleon
Copy link

crypt-chameleon commented Sep 3, 2020

Okay finally got everything to connect to my node by using the following settings in the bitcoin.conf
rpcallowip=172.28.1.0/255.255.255.0
rpcallowip=172.30.1.0/255.255.255.0
rpcallowip=192.168.1.0/255.255.255.0
rpcport=8332
rpcbind=192.168.1.x (check what your machine's local IP address via the command "ip a")

The subnets of 172.28.1.0 and 172.30.1.0 I got from looking into the docker-compose file for the dojo app and could see these were the internal IP nets that they were given.

If you are doing a bitcoin-cli command outside the app, remember to add the parameter -rpcconnect=192.168.1.x otherwise it will give you a connection error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants