Skip to content

Make bech32m the default for RPC, opt-in for GUI #22260

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

Closed
wants to merge 2 commits into from

Conversation

Sjors
Copy link
Member

@Sjors Sjors commented Jun 16, 2021

RPC
This makes bech32m the default whenever possible. For legacy wallets the default remains bech32. Same for descriptor wallets without an active Taproot descriptor.

GUI
A new wallet setting allows users to opt-in to Taproot. If they opt in, the GUI bech32 checkbox now produces either bech32 or bech32m depending on the wallet. This avoids having to explain the difference.

Schermafbeelding 2021-10-20 om 20 13 17

Considerations
This lets users and developers experiment with taproot wallets. When merged before #22364, the user will have to manually import a taproot descriptor. After that PR, taproot descriptors will be present for all new wallets.

It is better to stick to bech32 addresses for the time being, because:

  1. It is expected that it will take a while for enough wallets and exchanges to correctly handle sending to bech32m addresses
  2. Taproot savings for a single signature wallet are not huge
  3. Explaining the difference between bech32 and bech32m is not great UX

But we don't want to prevent users and developers who do understand the difference to use Taproot. Without this PR they can only do this via the RPC (getnewaddress some_label bech32m). With this PR it's a simple checkbox.

Changing the RPC default to bech32m seems acceptable to me, since those users will have a better understanding of the wallet. Though I can see the case against it because it might be a breaking change, e.g. if someone has an automated setup that creates new wallets (existing wallets currently don't auto upgrade to taproot, so their behavior is not changed).

Suggested testing

  • call getnewaddress without type and getnewaddress Test bech32 / bech32m
  • create a receive address in the GUI with and without the bech32 checkbox
  1. Legacy wallet
  2. Default descriptor wallet (current does not have taproot descriptor)
  3. Wallet with taproot descriptor:

@DrahtBot
Copy link
Contributor

DrahtBot commented Jun 16, 2021

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Conflicts

Reviewers, this pull request conflicts with the following ones:

  • #23308 (Update basic multisig test/docs to use multipath descriptor by mjdietzx)
  • #22928 (refactor: Remove gArgs from wallet.h and wallet.cpp (2) by kiminuo)
  • #22838 (descriptors: Be able to specify change and receiving in a single descriptor string by achow101)
  • #22805 (refactor: use CWallet const shared pointers in dump{privkey,wallet} by theStack)
  • #22787 (refactor: actual immutable pointing by kallewoof)

If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

@michaelfolkson
Copy link

My understanding from discussion at they July 30th Core wallet meeting is that this will only be merged once the (super)majority of the ecosystem is able to make payments to bech32m addresses. So definitely post Taproot activation but uncertain at this stage when exactly.

Assuming I've understood above, Concept ACK. Thanks for the instructions for testing in the PR description, will do this testing at a later date.

@Sjors
Copy link
Member Author

Sjors commented Aug 2, 2021

@michaelfolkson note that this doesn't do anything unless there's actually a taproot descriptor in the wallet, which this PR doesn't add.

@Sjors Sjors force-pushed the 2021/06/bech32_gui branch from 47b02d6 to 2c2a8c0 Compare August 4, 2021 18:14
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ghost
Copy link

ghost commented Aug 11, 2021

Not sure why I don't see QR in bitcoin-qt

image

@Sjors
Copy link
Member Author

Sjors commented Oct 20, 2021

Rebased.

My understanding from discussion at they July 30th Core wallet meeting is that this will only be merged once the (super)majority of the ecosystem is able to make payments to bech32m addresses.

I added a note in the PR description. I tend to agree it's preferable to wait a little bit until more wallets and services support sending to bech32m, otherwise we have to add another checkbox for bech32 fallback and explain all that.

@schildbach
Copy link
Contributor

I wonder why this isn't already merged for Testnet and Signet (not Mainnet), both of which have Taproot activated already. It would make Taproot testing much easier.

@ghost
Copy link

ghost commented Oct 20, 2021

reACK 9ca663e

@sipa
Copy link
Member

sipa commented Oct 20, 2021

@schildbach I don't think we can merge this until there is wide support for sending to bech32m in commonly deployed clients/services, which will probably take a while after activation even.

@Sjors
Copy link
Member Author

Sjors commented Oct 20, 2021

I'm open to the idea of enabling this behavior on signet (and testnet) and turning it off on mainnet until a later release.

@Sjors Sjors changed the title Make bech32m the default, except where needed. Update GUI checkbox. Make bech32m the default for RPC, opt-in for GUI Oct 20, 2021
@Sjors
Copy link
Member Author

Sjors commented Oct 20, 2021

I added a GUI settings checkbox to enable "taproot" (maybe needs rewording). See updated PR description.

Sjors added 2 commits October 22, 2021 16:21
Except for legacy wallets and descriptor wallets without taproot. Update the default after importing a taproot descriptor.
@Rspigler
Copy link
Contributor

Use Taproot -> "Generate taproot addresses for wallets that support it..." Instead, could the new GUI option only be shown to users who have updated to taproot capable wallets? Then once clicking 'Use Taproot', the GUI bech32 checkbox should auto-select and produce bech32m addresses.

@Sjors
Copy link
Member Author

Sjors commented Oct 23, 2021

Do you mean moving it from the wallet Settings view to the Receive view? (and then only showing it for taproot capable wallets)

@Rspigler
Copy link
Contributor

I didn't, but I believe that's a better idea

@DrahtBot
Copy link
Contributor

🐙 This pull request conflicts with the target branch and needs rebase.

Want to unsubscribe from rebase notifications on this pull request? Just convert this pull request to a "draft".

@Sjors
Copy link
Member Author

Sjors commented Oct 29, 2021

Closing this in favor of a GUI-only PR: bitcoin-core/gui#459

@Sjors Sjors closed this Oct 29, 2021
maflcko pushed a commit to bitcoin-core/gui that referenced this pull request Dec 22, 2021
c9a77e2 gui: address type dropdown, add bech32m (Sjors Provoost)
56113da wallet: add taprootEnabled() to interface (Sjors Provoost)

Pull request description:

  This PR replaces the Bech32 checkbox with an address type dropdown It "Use Taproot" checkbox to the receive screen for any wallet with a Taproot descriptor. The Bech32m option is hidden for wallets that don't have taproot descriptors.

  Bech32 is kept as the default even for Taproot enabled wallets until it's more widely supported.

  (an earlier attempt of this PR added a second checkbox)

  <img width="469" alt="Schermafbeelding 2021-12-21 om 11 44 05" src="https://user-images.githubusercontent.com/10217/146872660-339fae1f-c0b8-4673-b8be-33c25f3933fd.png">

  **Suggested testing**
  * notice that the Bech32m entry only appears for wallet with a taproot descriptor
  * verify that it generates a bc1p instead of bc1q address
  1. Legacy wallet
  2. Default descriptor wallet (current does not have taproot descriptor)
  3. Wallet with taproot descriptor:
     * just create a new descriptor wallet

  Replaces bitcoin/bitcoin#22260

ACKs for top commit:
  Rspigler:
    tACK  c9a77e2.  I like the changes made now, thanks!
  kristapsk:
    re-ACK c9a77e2

Tree-SHA512: bae66ac90ed55372e6c94878db0e37d32b7b5c24ed00c0f2ebb10fd127dddce3a061162df915d67e92d7b35b3da093137db17b73931a0ae1a470fff20be1f30b
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request Dec 22, 2021
…ve tab)

c9a77e2 gui: address type dropdown, add bech32m (Sjors Provoost)
56113da wallet: add taprootEnabled() to interface (Sjors Provoost)

Pull request description:

  This PR replaces the Bech32 checkbox with an address type dropdown It "Use Taproot" checkbox to the receive screen for any wallet with a Taproot descriptor. The Bech32m option is hidden for wallets that don't have taproot descriptors.

  Bech32 is kept as the default even for Taproot enabled wallets until it's more widely supported.

  (an earlier attempt of this PR added a second checkbox)

  <img width="469" alt="Schermafbeelding 2021-12-21 om 11 44 05" src="https://user-images.githubusercontent.com/10217/146872660-339fae1f-c0b8-4673-b8be-33c25f3933fd.png">

  **Suggested testing**
  * notice that the Bech32m entry only appears for wallet with a taproot descriptor
  * verify that it generates a bc1p instead of bc1q address
  1. Legacy wallet
  2. Default descriptor wallet (current does not have taproot descriptor)
  3. Wallet with taproot descriptor:
     * just create a new descriptor wallet

  Replaces bitcoin#22260

ACKs for top commit:
  Rspigler:
    tACK  c9a77e2.  I like the changes made now, thanks!
  kristapsk:
    re-ACK c9a77e2

Tree-SHA512: bae66ac90ed55372e6c94878db0e37d32b7b5c24ed00c0f2ebb10fd127dddce3a061162df915d67e92d7b35b3da093137db17b73931a0ae1a470fff20be1f30b
RandyMcMillan pushed a commit to RandyMcMillan/gui that referenced this pull request Jan 27, 2022
c9a77e2 gui: address type dropdown, add bech32m (Sjors Provoost)
56113da wallet: add taprootEnabled() to interface (Sjors Provoost)

Pull request description:

  This PR replaces the Bech32 checkbox with an address type dropdown It "Use Taproot" checkbox to the receive screen for any wallet with a Taproot descriptor. The Bech32m option is hidden for wallets that don't have taproot descriptors.

  Bech32 is kept as the default even for Taproot enabled wallets until it's more widely supported.

  (an earlier attempt of this PR added a second checkbox)

  <img width="469" alt="Schermafbeelding 2021-12-21 om 11 44 05" src="https://user-images.githubusercontent.com/10217/146872660-339fae1f-c0b8-4673-b8be-33c25f3933fd.png">

  **Suggested testing**
  * notice that the Bech32m entry only appears for wallet with a taproot descriptor
  * verify that it generates a bc1p instead of bc1q address
  1. Legacy wallet
  2. Default descriptor wallet (current does not have taproot descriptor)
  3. Wallet with taproot descriptor:
     * just create a new descriptor wallet

  Replaces bitcoin/bitcoin#22260

ACKs for top commit:
  Rspigler:
    tACK  c9a77e2.  I like the changes made now, thanks!
  kristapsk:
    re-ACK c9a77e2

Tree-SHA512: bae66ac90ed55372e6c94878db0e37d32b7b5c24ed00c0f2ebb10fd127dddce3a061162df915d67e92d7b35b3da093137db17b73931a0ae1a470fff20be1f30b
@bitcoin bitcoin locked and limited conversation to collaborators Oct 30, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants