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

Validate derivation_path purpose field in coin config #1995

Open
dimxy opened this issue Oct 19, 2023 · 1 comment
Open

Validate derivation_path purpose field in coin config #1995

dimxy opened this issue Oct 19, 2023 · 1 comment
Labels
improvement: hd-wallet priority: low Tasks with low importance that can be addressed when time permits.

Comments

@dimxy
Copy link
Collaborator

dimxy commented Oct 19, 2023

MM2 coin config has a 'derivation_path' parameter which defines how hierarchically derived addresses are created.
The purpose field in the derivation_path should be validated for coins with configured segwit or non-segwit address usage according to the BIP44 and BIP84 standards.
There is a param in coin configuration that determines that for this coin segwit addresses are used. This param is 'format' field in the 'address_format' set to "segwit" or set to other value if non-segwit addresses are used.
Sample coin config for segwit addresses:

{
    "coin": "BTC-segwit",
    ...
    "bech32_hrp": "bc",
    "address_format": {
      "format": "segwit"
    },
    ...
    "derivation_path": "m/84'/0'", 
    ...
  },
@dimxy
Copy link
Collaborator Author

dimxy commented Oct 30, 2023

In addition, what happens if incorrect purpose is set for a segwit coin (44 instead of 84):
if the hd wallet API or trezor wallet is used with a segwit coin then create_new_account() will create different pubkeys than pubkeys created by other apps that follow the BIP84 standard (like trezor firmware).
For this time the hd wallet api is not used in the GUI and trezor is not enabled for segwit coins yet so this change won't create any problems with user funds.

@shamardy shamardy added priority: low Tasks with low importance that can be addressed when time permits. improvement: hd-wallet labels Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement: hd-wallet priority: low Tasks with low importance that can be addressed when time permits.
Projects
None yet
Development

No branches or pull requests

2 participants