cryptoadvance / specter-desktop

A desktop GUI for Bitcoin Core optimised to work with hardware wallets
MIT License
794 stars 237 forks source link

Creating wallet issue #2

Closed davterra closed 4 years ago

davterra commented 5 years ago

I am very intrigued by your wallet, and would like to test it but so far I am running into the error messages shown below. I am running Debian 9 in a Qubes VM. I have a full, indexed node available on localhost

user@BTC-Node:~/Repositories/specter-desktop$ python3 server.py can't load wallets... Server responded with error code 401: can't load wallets... Server responded with error code 401:

Selection_003

stepansnigirev commented 5 years ago

Hi! Thanks for your interest! Are you running bitcoin core on the same machine? At the moment server will try to load rpc credentials from bitcoin.conf file in one of these folders: ~/Library/Application Support/Bitcoin/ (default for MacOS) or ~/.bitcoin/ (default for Linux) I didn't make it to work automatically with cookie file yet (that's how bitcoin-cli does it), so you need to set up credentials in bitcoin.conf manually by adding two lines in the bitcoin.conf file:

rpcuser=your_username
rpcpassword=yourpassword

If your bitcoin.conf file is in a different folder or not accessible by the server process you can fill the credentials manually on the http://localhost:25441/settings/ page.

I plan to add cookie support in the upcoming days, meanwhile try to hardcode the rpc credentials and provide them to the app.

davterra commented 5 years ago

Yes, I am running bitcoin core 18 on the same machine, with bitcoin.conf in the default location,

with an rpc user/password included in the file.

I did fill the credentials manually on the settings page, but I still get the error message telling me to configure bitcoin core to create wallet.

Thanks for your quick response.

David

stepansnigirev commented 5 years ago

Got it, let me try to go through the whole setup process from scratch, I didn't test the initial steps for quite some time so there might be bugs...

davterra commented 5 years ago

Sounds good. Thanks again.

stepansnigirev commented 5 years ago

A few more questions: Are you running bitcoin core on mainnet or testnet? Did you also configure the port correctly on the settings page (mainnet, testnet, regtest and signet all have different ports, their values are 8332 for mainnet, 18332 for testnet, 18443 for regtest, 38332 for signet)?

(you can also reach me on Telegram - it may be faster https://t.me/stepansnigirev, I should probably create a Telegram group for techsupport :) )

davterra commented 5 years ago

Hi, My only attempts to run specter have been mainnet, and I do have port 8332 selected in the config settings along with my rpcuser/rpcpassword. Thanks for the Telegram link. I will connect there perhaps later today.

stepansnigirev commented 5 years ago

Maybe try to create a small python file in the specter-desktop folder (let's say rpctest.py):

from rpc import *
cli = BitcoinCLI("yourrpcusername", "yourrpcpassword", port=8332)
print(cli.getmininginfo())

Then run it (python3 rpctest.py) and see what's wrong.

I think I also forgot to write that requests is another dependency of the app. To install run pip3 install requests

davterra commented 5 years ago

Yeah, I had to install requests myself and you are correct that it is not in the documentation. I will try your script. Thank you.

davterra commented 5 years ago

Here's the result of your script:

user@BTC-Node:~/Repositories/specter-desktop$ python3 rpctest.py Traceback (most recent call last): File "rpctest.py", line 3, in print(cli.getmininginfo()) File "/home/user/Repositories/specter-desktop/rpc.py", line 55, in fn raise Exception("Server responded with error code %d: %s" % (r.status_code, r.text)) Exception: Server responded with error code 401:

stepansnigirev commented 5 years ago

Ok, this means that rpc credentials are incorrect. After hardcoding rpcuser and password in the bitcoin.conf file did you restart the bitcoin daemon? If not it is probably still using cookie file for credentials. At the moment if you try to stop bitcoin daemon using bitcoin-cli stop you will probably fail - in this case you may need to delete rpc credentials from bitcoin.conf, stop the daemon using bitcoin-cli stop, then add credentials again to the config file and restart the daemon (bitcoind --daemon) If you are using bitcoin-qt then you can just close it and open again.

davterra commented 5 years ago

I don't see how they could be incorrect. I've changed the rpcpassword in bitcoincore and in specter to something short and simple, triple-checked that they are identical, and restarted bitcoin core. When I start specter the bitcoin core log gives me this: 2019-09-26T15:06:40Z ThreadRPCServer incorrect password attempt from [::1]:39428 However, the passwords are identical. And I am getting proper responses from bitcoin-cli.

stepansnigirev commented 5 years ago

I see... now I am confused :( I will try to google around, and maybe add a config option to use bitcoin-cli as a subprocess.

davterra commented 5 years ago

Adding cookie support will be helpful, I'm sure. I'll keep trying to get core and specter to connect and let you know of anything noteworthy

davterra commented 5 years ago

Is the error message in m first post, regarding configuring BTC core to create wallets related to the rpc connection issue?

stepansnigirev commented 5 years ago

Yes, Server responded with error code 401 from the first message means that authentication failed. This means that specter can reach bitcoin rpc server, but is using wrong credentials for some reason. I will work on the cookie integration tomorrow morning and ping you when I am done - then we can test if it helps, if not I will add the bitcoin-cli subprocess support - then bitcoin-cli will get all necessary information by itself and we will only need to pass parameters to it.

Cookie integration issue: https://github.com/cryptoadvance/specter-desktop/issues/3

davterra commented 5 years ago

That all sounds great. I look forward to more testing. I will also keep trying to connect using the current build. It sure seems like the problem should be something simple on my end, otherwise you would have seen this occur before my tests.

davterra commented 5 years ago

Also, I like the idea of a Telegram group for techsupport. Or Slack.

stepansnigirev commented 5 years ago

Added it to the readme. Telegram: https://t.me/spectersupport Slack: https://join.slack.com/t/spectersupport/shared_invite/enQtNzY4MTQ2MTg0NDY1LWQzMGMzMTk2MWE2YmVmNzE3ODgxODIxNWRlMzJjZTZlMDBlMjA5YzVhZjQ0NzJlNmE0N2Q4MzE0ZGJiNjM4NTY

stepansnigirev commented 5 years ago

Can you try running this file and see if daemon autodetect works? It should be able to find bitcon.conf file with credentials and if there is nothing - parse cookies. https://github.com/cryptoadvance/specter-desktop/blob/master/rpctest.py

Meanwhile I will integrate this logic into the app.

stepansnigirev commented 4 years ago

If I understand correctly this issue was solved.