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

Sparrow will no longer connect to bitcoin core #724

Closed
xserver1992 opened this issue Oct 28, 2022 · 16 comments
Closed

Sparrow will no longer connect to bitcoin core #724

xserver1992 opened this issue Oct 28, 2022 · 16 comments

Comments

@xserver1992
Copy link

Sparrow suddenly won't connect to the bitcoin core even though it was previously working. I have not changed any of the configuration. Note that it won't connect locally on the bitcoin core machine either (again, used to work).
Here is the error that appears on the test connection screen:

Could not connect:
Check if Bitcoin Core is running, and the authentication details are correct.
See https://sparrowwallet.com/docs/connect-node.html

Here is the error log:
2022-10-28 10:55:28,139 ERROR [JavaFX Application Thread] c.s.s.n.ElectrumServer [null:-1] Failed to start BWT
dev.bwt.libbwt.BwtException: JSON-RPC error: JSON decode error: missing field keypoololdest at line 1 column 334
at com.sparrowwallet.merged.module@1.7.0/dev.bwt.libbwt.daemon.NativeBwtDaemon.start(Native Method)
at com.sparrowwallet.sparrow@1.7.0/com.sparrowwallet.sparrow.net.Bwt.start(Unknown Source)
at com.sparrowwallet.sparrow@1.7.0/com.sparrowwallet.sparrow.net.Bwt.start(Unknown Source)
at com.sparrowwallet.sparrow@1.7.0/com.sparrowwallet.sparrow.net.Bwt$ConnectionService$1.call(Unknown Source)
at com.sparrowwallet.sparrow@1.7.0/com.sparrowwallet.sparrow.net.Bwt$ConnectionService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2022-10-28 10:55:28,140 ERROR [JavaFX Application Thread] c.s.s.p.ServerPreferencesController [null:-1] Connection error
com.sparrowwallet.sparrow.net.ServerException: Check if Bitcoin Core is running, and the authentication details are correct.
at com.sparrowwallet.sparrow@1.7.0/com.sparrowwallet.sparrow.net.ElectrumServer$ConnectionService$1.call(Unknown Source)
at com.sparrowwallet.sparrow@1.7.0/com.sparrowwallet.sparrow.net.ElectrumServer$ConnectionService$1.call(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
at java.base/java.security.AccessController.doPrivileged(Unknown Source)
at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)

The authentication information is correct in the bitcoin core configuration file (like I said, used to work).

It seems to halfway work as the following screen appears on the bitcoin core:
BitcoinCore

I have Windows 10 on both machines, Sparrow v1.7.0 and bitcoin core v23.0.

java version "1.8.0_351"
Java(TM) SE Runtime Environment (build 1.8.0_351-b10)
Java HotSpot(TM) 64-Bit Server VM (build 25.351-b10, mixed mode)

Any suggestions appreciated.

@lvnilesh
Copy link

Are you able to successfully connect to your node via the command line?

bitcoin-cli -rpcconnect=<ip addr> -rpcport=8332 -rpcuser=<user_name> -rpcpassword=<password> -getinfo

@xserver1992
Copy link
Author

It appears so, here is the output:

Chain: main
Blocks: 760699
Headers: 760699
Verification progress: 99.9999%
Difficulty: 36835682546787.98

Network: in 0, out 10, total 10
Version: 230000
Time offset (s): 0
Proxies: n/a
Min tx relay fee rate (BTC/kvB): 0.00001000

Wallet: sparrow
Keypool size: 0
Transaction fee rate (-paytxfee) (BTC/kvB): 0.00000000

Balance: 0.00000000

Warnings:

@craigraw
Copy link
Collaborator

This is due to Bitcoin Core changing the default wallet type to descriptor wallets. See #488.

To solve this, start by upgrading Sparrow to the latest release. Shut down both Bitcoin Core and Sparrow, delete the sparrow folder in the Bitcoin Core wallets folder, restart Bitcoin Core and then Sparrow. This will recreate the sparrow wallet in Bitcoin Core using the correct type.

@xserver1992
Copy link
Author

That fixed it, thank you.

@ExchangeREC
Copy link

I got the exact same issue like OP but I already use Sparrow Wallet 1.7.1 (Linux) and Bitcoin Core 23.0.0 (Windows) when trying to connect.
The workaround of deleting the "sparrow" folder in the Bitcoin Core directory works only once when I work in the following order:

  1. Close Bitcoin Core
  2. Close Sparrow Wallet
  3. Delete "sparrow" folder in the Bitcoin Core directory
  4. Start Bitcoin Core
  5. Start Sparrow Wallet

Then it works, but: Only until I shut down Bitcoin Core and restart it. Then I have to follow steps 1-5 again.
Notice: I have not connected/created/imported any wallet on Sparrow yet but my Bitcoin Core application looks like the screenshot from OP anyways.

I really appreciate any help!

@xserver1992
Copy link
Author

I can only tell you that mine still works even if restart the Bitcoin Core. I can only suggest trying to delete the files in Sparrow's folder. Even though you haven't created a wallet perhaps there is something there anyways? Otherwise I don't know.

@ExchangeREC
Copy link

I can only tell you that mine still works even if restart the Bitcoin Core. I can only suggest trying to delete the files in Sparrow's folder. Even though you haven't created a wallet perhaps there is something there anyways? Otherwise I don't know.

Yeah I did this. And it works! But when I shut down Bitcoin Core anytime and try it again, it won't work until I delete that folder "sparrow" that gets created after successful connection again.

@xserver1992
Copy link
Author

I hope I'm not belaboring the point, but I was referring to Sparrow's working folders on your Linux machine not the Bitcoin core's Sparrow folder mentioned in your post. Might not work, but worth a try perhaps if you haven't already. Sorry if this was not clear.

@craigraw
Copy link
Collaborator

craigraw commented Dec 9, 2022

@ExchangeREC take a look at #770 - it might be related. Are you getting any errors in your Sparrow log? (Help menu)

@ExchangeREC
Copy link

ExchangeREC commented Dec 11, 2022

@xserver1992 ah sorry mate, I misunderstood you! Thanks for the suggestion but within the "wallets" folder on Linux, there is nothing inside (I did "ls -la" in the command line) ..

@craigraw thanks! The problem is similar but the only solution working for me right now is:

  • close Bitcoin Core
  • close Samourai Wallet
  • delete the "sparrow"-folder in Bitcoin Core directory
  • starting Bitcoin Core
  • starting Sparrow Wallet - it then successfully connects, but only until I close Bitcoin Core and reopen it again - then I need to do the above steps again

EDIT: This more looks like this issue to me (please keep in mind that I am kinda nooby and my understanding could be wrong :-))

EDIT 2: When shooting the "getwalletinfo"-command into the Bitcoin Core Console, it shows me the following:

"walletname": "sparrow",
"walletversion": 169900,   
"format": "bdb",   
"balance": 0.00000000,   
"unconfirmed_balance": 0.00000000,  
"immature_balance": 0.00000000,   
"txcount": 0,   "keypoolsize": 0,   
"keypoolsize_hd_internal": 0,   
"paytxfee": 0.00000000,   
"private_keys_enabled": false,   
"avoid_reuse": false,   
"scanning": false,   
"descriptors": false,   
"external_signer": false 

That is what my sparrow.log file shows about this:

2022-12-11 14:15:19,814 ERROR [JavaFX Application Thread] c.s.s.n.ElectrumServer [null:-1] Failed to start BWT
dev.bwt.libbwt.BwtException: JSON-RPC error: JSON decode error: missing field `keypoololdest` at line 1 column 334
	at com.sparrowwallet.merged.module@1.7.1/dev.bwt.libbwt.daemon.NativeBwtDaemon.start(Native Method)
	at com.sparrowwallet.sparrow@1.7.1/com.sparrowwallet.sparrow.net.Bwt.start(Unknown Source)
	at com.sparrowwallet.sparrow@1.7.1/com.sparrowwallet.sparrow.net.Bwt.start(Unknown Source)
	at com.sparrowwallet.sparrow@1.7.1/com.sparrowwallet.sparrow.net.Bwt$ConnectionService$1.call(Unknown Source)
	at com.sparrowwallet.sparrow@1.7.1/com.sparrowwallet.sparrow.net.Bwt$ConnectionService$1.call(Unknown Source)
	at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)
2022-12-11 14:15:45,316 ERROR [JavaFX Application Thread] c.s.s.n.ElectrumServer [null:-1] Failed to start BWT
dev.bwt.libbwt.BwtException: JSON-RPC error: JSON decode error: missing field `keypoololdest` at line 1 column 334
	at com.sparrowwallet.merged.module@1.7.1/dev.bwt.libbwt.daemon.NativeBwtDaemon.start(Native Method)
	at com.sparrowwallet.sparrow@1.7.1/com.sparrowwallet.sparrow.net.Bwt.start(Unknown Source)
	at com.sparrowwallet.sparrow@1.7.1/com.sparrowwallet.sparrow.net.Bwt.start(Unknown Source)
	at com.sparrowwallet.sparrow@1.7.1/com.sparrowwallet.sparrow.net.Bwt$ConnectionService$1.call(Unknown Source)
	at com.sparrowwallet.sparrow@1.7.1/com.sparrowwallet.sparrow.net.Bwt$ConnectionService$1.call(Unknown Source)
	at javafx.graphics@18/javafx.concurrent.Task$TaskCallable.call(Unknown Source)
	at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
	at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$6(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at javafx.graphics@18/javafx.concurrent.Service.lambda$executeTask$7(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

@craigraw
Copy link
Collaborator

craigraw commented Dec 12, 2022

@ExchangeREC I think this is the "problem":

I have not connected/created/imported any wallet on Sparrow yet

Once you have Sparrow connected to Bitcoin Core, create a wallet (a hot wallet is file) and the problem should go away. It appears that the keypoololdest field is not returned if no keys have been imported into the wallet. Ref https://github.com/bitcoin/bitcoin/blob/e334f7a54592ba9f05e4a5578dd933a7a31c3444/src/wallet/rpc/wallet.cpp#L91

Oddly enough I can't reproduce this myself, even with a freshly created Bitcoin Core wallet without any keys imported - keypoololdest is always returned:

{
  "walletname": "sparrow",
  "walletversion": 169900,
  "format": "bdb",
  "balance": 0.00000000,
  "unconfirmed_balance": 0.00000000,
  "immature_balance": 0.00000000,
  "txcount": 0,
  "keypoololdest": 1670826633,
  "keypoolsize": 0,
  "keypoolsize_hd_internal": 0,
  "paytxfee": 0.00000000,
  "private_keys_enabled": false,
  "avoid_reuse": false,
  "scanning": false,
  "descriptors": false,
  "external_signer": false
}

@craigraw
Copy link
Collaborator

Ok, I've managed to recreate it - the field keypoololdest is not returned when reloading an existing legacy Bitcoin Core wallet that has had no keys added to it. I've created an issue for BWT: bwt-dev/bwt#108.

The current solution is to stop both Bitcoin Core and Sparrow, delete the Bitcoin Core wallet, restart both and then make sure to create a wallet in Sparrow before restarting either application (to ensure some keys are added to the Bitcoin Core wallet).

@ExchangeREC
Copy link

@craigraw

The current solution is to stop both Bitcoin Core and Sparrow, delete the Bitcoin Core wallet, restart both and then make sure to create a wallet in Sparrow before restarting either application (to ensure some keys are added to the Bitcoin Core wallet).

Wow mate - looks like it works! Thank you SO much!
I have to "Disconnect" and "Connect" once in Sparrow but then it works. That's so great - thank you again!

@ExchangeREC
Copy link

ExchangeREC commented Dec 13, 2022

@craigraw

Once you have Sparrow connected to Bitcoin Core, create a wallet (a hot wallet is file) and the problem should go away.

So in case of setting up a hardware wallet: Should I create a hot software wallet as described by you before importing or setting up a hardware wallet?

@craigraw
Copy link
Collaborator

So in case of setting up a hardware wallet: Should I create a hot software wallet as described by you before importing or setting up a hardware wallet?

No, you can create any wallet. The important part is that the wallet is saved, and Sparrow adds the public keys it references to the Bitcoin Core wallet it creates.

@ExchangeREC
Copy link

Great, thanks!

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

4 participants