BenWestgate / Bails

Bails is a Bitcoin solution protecting against surveillance, censorship, and confiscation. It installs Bitcoin Core to Tails encrypted Persistent Storage, creates and recovers Bitcoin Core wallets from Codex32 (BIP93) seed backups, and creates backup Bails USB sticks and shareable blank Bails USB sticks. Learn more in README.md.
MIT License
45 stars 8 forks source link

Unable to create a new receiving address #86

Closed extrapockets closed 1 year ago

extrapockets commented 1 year ago

After initial sync & importing a BAILS-created wallet: Under the Receive tab, I cannot create a new receiving address to send a small test transaction (button is grayed out). I tried filling out all the forms, changing from Bech32, closing the wallet, restarting Core, and restarting Tails, but still no luck. The Window > Receiving addresses window shows no addresses.

BenWestgate commented 1 year ago

can you press Ctrl+T in Bitcoin Core while this BAILS-created wallet is open console and type: listdescriptors

If you DO NOT intend to use this wallet, you may paste the output of the command directly.

Otherwise remove the "xpub...." strings to keep your privacy.

There should be 8 descriptors, all marked "active": true, half marked "internal": true the other half "internal": false.

extrapockets commented 1 year ago

Output was just the wallet name and an empty array after 'descriptors'

BenWestgate commented 1 year ago

OK, that means the RPC commands to import descriptors failed when this wallet was created.

Now to fix it, I'd like you to type:

git clone https://github.com/BenWestgate/Bails; */b in Terminal. This will update Bails and Bitcoin Core to the latest versions (without losing your blockchain sync or wallet!!!). Due to your long sync it's hard for me to know what the code you're running exactly is that experienced this RPC issue.

After you have typed this, click Applications > Office > Bails and select "Wallet" from the menu and you can restore your codex32 seed again.

Then let me know if this issue has been resolved.

extrapockets commented 1 year ago

Unfortunately that did not resolve the issue - still can't generate receive addresses, and the listdescriptors cmd outputs an empty array.

extrapockets commented 1 year ago

More context: this BAILS-created wallet is from 3 weeks ago, before my sync. I'm going to create a new wallet and see if I can generate an address with that.

extrapockets commented 1 year ago

More context: this BAILS-created wallet is from 3 weeks ago, before my sync. I'm going to create a new wallet and see if I can generate an address with that.

The new wallet also cannot create addresses. I made sure to select the new wallet in the console and the receive address tab, as I currently have both wallets open.

BenWestgate commented 1 year ago

Okay, thanks for your report. I will try to reproduce it now.

BenWestgate commented 1 year ago

I possibly found the bug: export CLI="bitcoin-cli" # rpcport=17600 must be set in bitcoin.conf for Tails.

I was working on my Bails the other day and noticed either rpcport wasn't set in bitcoin.conf or the bitcoin.conf did not persist correctly.

By the way, while you're here. Would you like me to make "bails-wallet" this codex32 create and restore utility into a stand alone repro that you can run it on any system that has bitcoin core installed (windows, linux, etc) not just Tails?

BenWestgate commented 1 year ago

I've recreated the issue. DIagnosing.

extrapockets commented 1 year ago

I possibly found the bug: export CLI="bitcoin-cli" # rpcport=17600 must be set in bitcoin.conf for Tails.

I was working on my Bails the other day and noticed either rpcport wasn't set in bitcoin.conf or the bitcoin.conf did not persist correctly.

By the way, while you're here. Would you like me to make "bails-wallet" this codex32 create and restore utility into a stand alone repro that you can run it on any system that has bitcoin core installed (windows, linux, etc) not just Tails?

I think that's a good idea so there is less friction to get users to test the codex32 create & restore utility. Am I right in assuming that a monitor is required to use that utility? I am currently only running core on Ubuntu Server. I can easily set up Bitcoin Core on a laptop to test it with a GUI though.

BenWestgate commented 1 year ago

I'll update an issue on it. The whole bails-wallet file needs a refactor because its size and evolution has made tracking bugs like this one harder. And more eyes on the wallet code means less bugs for Bails users and more people using codex32 with bitcoin core.

You will need a monitor, I don't have plans to write a Terminal User Interface for bails-wallet anytime soon.

So I'll try to convert it entirely to python by the end of the year and release it as a stand alone bails-wallet repo that becomes a dependency for bails

extrapockets commented 1 year ago

I'll make an issue on it. The whole bails-wallet file needs a refactor because its size and evolution has made tracking bugs like this harder. And more eyes on the wallet code means less bugs for Bails users and more people using codex32 with bitcoin core.

You will need a monitor, I don't have plans to write a Terminal User Interface for bails-wallet anytime soon.

OK, sounds great. Gives me time to brush up on python too.

BenWestgate commented 1 year ago

The current bails-wallet file switches between bash and in-line python code frequently and that is one of the reasons it's large and harder than necessary to reason about.

BenWestgate commented 1 year ago

Getting Hot..

error: Error parsing JSON: [{ "desc": "pkh(xprv9s21ZrQH143K3xy9DcYuprFDp99kGHMrRXfszZscqkTAwfUbcKP3dD5e5CaFhLMafApD4s4ki4fFrFvgisHYJjrkEQi3SUEZUnP4k4x7LSZ/44'/0'/0'/0/*)
error: Error parsing JSON: [{ "desc": "sh(wpkh(xprv9s21ZrQH143K3xy9DcYuprFDp99kGHMrRXfszZscqkTAwfUbcKP3dD5e5CaFhLMafApD4s4ki4fFrFvgisHYJjrkEQi3SUEZUnP4k4x7LSZ/49'/0'/0'/0/*))
error: Error parsing JSON: [{ "desc": "wpkh(xprv9s21ZrQH143K3xy9DcYuprFDp99kGHMrRXfszZscqkTAwfUbcKP3dD5e5CaFhLMafApD4s4ki4fFrFvgisHYJjrkEQi3SUEZUnP4k4x7LSZ/84'/0'/0'/0/*)
error: Error parsing JSON: [{ "desc": "tr(xprv9s21ZrQH143K3xy9DcYuprFDp99kGHMrRXfszZscqkTAwfUbcKP3dD5e5CaFhLMafApD4s4ki4fFrFvgisHYJjrkEQi3SUEZUnP4k4x7LSZ/86'/0'/0'/0/*)
error: Error parsing JSON: [{ "desc": "pkh(xprv9s21ZrQH143K3xy9DcYuprFDp99kGHMrRXfszZscqkTAwfUbcKP3dD5e5CaFhLMafApD4s4ki4fFrFvgisHYJjrkEQi3SUEZUnP4k4x7LSZ/44'/0'/0'/1/*)
error: Error parsing JSON: [{ "desc": "sh(wpkh(xprv9s21ZrQH143K3xy9DcYuprFDp99kGHMrRXfszZscqkTAwfUbcKP3dD5e5CaFhLMafApD4s4ki4fFrFvgisHYJjrkEQi3SUEZUnP4k4x7LSZ/49'/0'/0'/1/*))
error: Error parsing JSON: [{ "desc": "wpkh(xprv9s21ZrQH143K3xy9DcYuprFDp99kGHMrRXfszZscqkTAwfUbcKP3dD5e5CaFhLMafApD4s4ki4fFrFvgisHYJjrkEQi3SUEZUnP4k4x7LSZ/84'/0'/0'/1/*)
error: Error parsing JSON: [{ "desc": "tr(xprv9s21ZrQH143K3xy9DcYuprFDp99kGHMrRXfszZscqkTAwfUbcKP3dD5e5CaFhLMafApD4s4ki4fFrFvgisHYJjrkEQi3SUEZUnP4k4x7LSZ/86'/0'/0'/1/*)

It looks like the descriptor strings are missing closing quotes and braces! That'll make import fail for sure..

I know BAILS used to be able to generate addresses, so I must have fat fingered the keyboard one day and accidentally deleted some characters from the loop that processes these.

extrapockets commented 1 year ago

If the scripting is solely in python, would that allow for the Codex32 utility to work on a non-linux OS? Either way, I think enough people use Linux that it's not necessary to have it work on Windows or MacOS right away.

BenWestgate commented 1 year ago

Yes, it means it would work on any OS with Python and Bitcoin Core.

BenWestgate commented 1 year ago

I was missing quotes around the checksum's "#' in the descriptor import which made the rest of the line be interpreted as a comment. Run git clone https://github.com/BenWestgate/Bails; */b again and it should work just fine now.