Failed to connect Sparrow wallet to bitcoin knots

Great. From that, I can see that port 8332 is listening, which is expected. All the TIME_WAIT lines are short-lived connections to 8332 from your own machine. The good news is it means the port is reachable and the Windows Firewall is not the problem. I’m not sure why there are so many, though. Maybe because Sparrow is trying to connect many times and failing (that is just a guess).

Looks like Bitcoin Knots installation folder is not in your PATH, so we didn’t get a successful run of bitcoin-cli -getinfo yet. Knots doesn’t install to the datadir, so you CD’d to the wrong folder in your last command there. You need to CD into “C:\Program Files\Bitcoin” to run the executables. BTW, do not move any files around here – it is expected that the installation folder and the datadir are in two different places, so keep them that way to avoid introducing any unusual variables into the equation.

cd "C:\Program Files\Bitcoin"
dir bitcoin-cli.exe

If that is found, then retrying the bitcoin-cli -getinfo command:

cd "C:\Program Files\Bitcoin"
bitcoin-cli.exe -getinfo

That should confirm whether or not the RPC is working, now that we have confirmed that port 8332 is listening.

Also, to double-check a couple of things with your current installation:

Back in the C:\Users\USER\AppData\Roaming\Bitcoin folder, can you run “dir .cookie” while Knots is not running, and then “dir .cookie” again while it is running? I know you mentioned that you followed the steps from my earlier post, but this will just to confirm that the .cookie file doesn’t exist when Knots is not running, and that it does exist when Knnots is running. So the commands will be:

# Fully shut down Knots, then:

cd C:\Users\USER\AppData\Roaming\Bitcoin
dir .cookie

# Start Knots back up, then:

cd C:\Users\USER\AppData\Roaming\Bitcoin
dir .cookie

And, finally, grab the latest screenshot of the Sparrow config screen (File > Settings > Server) so we can double-check it matches what we use to run the bitcoin-cli -getinfo.

Hi,Mr Paul
Kindly find the attachments.

Dir.cookie

Connection failed Sparrow

Ok, the .cookie test was successful, and the Sparrow config looks correct.

We haven’t found the bitcoin-cli application yet though, so we still haven’t tested the RPC server separately from Sparrow. I wonder if maybe it is in a subfolder under Bitcoin or something. Try running this to see if it tells you the correct location:

cd "C:\Program Files\Bitcoin"
Get-ChildItem -Path "C:\Program Files\Bitcoin" -Recurse -Filter bitcoin-cli.exe

Hi,Mr.Paul
Kindly find the attachment.
Thanks.

Ok, so it is in the subfolder named daemon. So to run the test:

cd "C:\Program Files\Bitcoin\daemon"
bitcoin-cli.exe -getinfo

Hi,Mr.Paul
Kindly find the attachment.
Thanks.

Ok, interesting. Everything actually looks correct, and the RPC returned the expected information. I’m really not sure what is going wrong.

I suppose we can start being a bit redundant. Try putting the following into your C:\Users\USER\AppData\Roaming\Bitcoin\bitcoin.conf file (replace anything else that might already be in there):

server=1
rpcbind=127.0.0.1
rpcallowip=127.0.0.1
rpcport=8332

Then fully shut down Knots, and then start it back up.

Make sure you run both Knots and Sparrow at the same privilege level (either both as your user, or both as Administrator). Check Both Knot’s and Sparrow’s exe Properties > Compatibility > “Run this program as an administrator” setting (it may be automatically running one or the other as Administrator and not the other without you realizing it)

Hi,Mr.Paul
Kindly find the attachment.

What should I do next, as both not checklisted on the “Run this program as an administrator”.
Should I checklist them?
Kindly advice further.
Thanks.

No, looks like neither are running as Administrator, so that is good. Did the config changes make any difference?

Hi,Mr.Paul
Still can not.
Kindly find the attahcment.

Thanks.

Ok, next let’s rule out a read issue with the cookie.

  • Open the .cookie file in notepad; it should contain something like __cookie__:verylongrandomstring.
  • In Sparrow, change Authentication: to User/Pass
    • Username: the part before the colon (usually __cookie__)
    • Password: the part after the colon (do not include the colon)
  • Click Test Connection.
    • If this works, the RPC itself is fine and the problem is strictly Sparrow reading the cookie file. If it doesn’t work, then we know the problem is something else.

Image removed by OP

I’m not expert as @paul is the man but my Sparrow is setup differently using port 443? It works but after following this thread Im not sure if I’m exposed or not.

Regardless this is a screen grab of what I have

Greg, It looks like in your screenshot you are either connecting over Tor or mDNS (such as on StartOS). mDNS is not applicable in Jacken’s case, but we could go through Tor. I was just trying to get the simple OOB direct connection to run (and failing so far, unfortunately).

1 Like

Ok…was trying to help if I could. As I say…you’re the teacher…Im the pupil

1 Like

Hi,Mr.Paul & Greg
Thanks in advance for your assist & response.

Mr.Paul,
Kindly find the attachment.

Thanks.

Ok, so to sumarize what we have discovered so far:

  1. Knots is running, fully synced, and doesn’t appear to have any known problems
  2. Knots creates the .cookie file when it runs as expected
  3. Knots’ RPC server is running and reachable via bitcoin-cli.exe
  4. Sparrow fails to connect whether using the default .cookie for authentication or User/Pass

This seems to indicate either a problem with Sparrow itself or a security feature (firewall seems unlikely since this is localhost, but possible). I am a bit stuck at this point. There are a couple of non-typical directions we could go from here:

  1. We could try connecting a different wallet software (such as Electrum) to confirm whether or not the issue is specific to Sparrow
  2. We could try to route the connection over Tor (which routes over standard http) instead of localhost to confirm whether or not the issue is with some security feature gatekeeping port 8332.
  3. We could abandon Knots or core running natively, and instead run StartOS in a VM, and connect Sparrow to Knots running there, via electrs.

Let me know which route you would like to take next.

Hi,Mr Paul
Maybe No 2 or 3
Thanks.

Ok, let’s try #2 first, since it will take the least amount of time (#3 will require repeating the IBD if we go that route)

Let’s start by confirming the Tor proxy is running properly. Run this command:

curl.exe --socks5-hostname 127.0.0.1:9050 https://check.torproject.org/api/ip

The response should come back with something like:

{"IsTor":true,"IP":"xxx.xxx.xxx.xxx"}

If so, next check that the torrc config exists:

cd C:\ProgramData\tor
dir torrc

If it does, then open it and make sure it includes the following three lines somewhere in the file:

ControlPort   9051
CookieAuthentication 1
CookieAuthFileGroupReadable 1