Skip to content

Commit

Permalink
update testnet bip44 derivation path
Browse files Browse the repository at this point in the history
  • Loading branch information
icodeface committed Aug 22, 2020
1 parent 6bc5f60 commit 2b23440
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion electrum/base_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def derivation_and_script_type_dialog(self, f):
# For segwit, a custom path is used, as there is no standard at all.
default_choice_idx = 2
choices = [
('standard', 'legacy multisig (p2sh)', normalize_bip32_derivation("m/45'/0")),
('standard', 'legacy multisig (p2sh)', normalize_bip32_derivation(f"m/45'/{constants.net.BIP44_COIN_TYPE}'/0")),
('p2wsh-p2sh', 'p2sh-segwit multisig (p2wsh-p2sh)', purpose48_derivation(0, xtype='p2wsh-p2sh')),
('p2wsh', 'native segwit multisig (p2wsh)', purpose48_derivation(0, xtype='p2wsh')),
]
Expand Down
4 changes: 2 additions & 2 deletions electrum/plugins/hw_wallet/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from typing import TYPE_CHECKING, Dict, List, Union, Tuple, Sequence, Optional, Type
from functools import partial

from electrum import constants
from electrum.plugin import BasePlugin, hook, Device, DeviceMgr, DeviceInfo
from electrum.i18n import _
from electrum.bitcoin import is_address, opcodes
Expand Down Expand Up @@ -245,7 +245,7 @@ def get_xpub(self, bip32_path: str, xtype) -> str:
def request_root_fingerprint_from_device(self) -> str:
# digitalbitbox (at least) does not reveal xpubs corresponding to unhardened paths
# so ask for a direct child, and read out fingerprint from that:
child_of_root_xpub = self.get_xpub("m/44'/88'/0'", xtype='standard')
child_of_root_xpub = self.get_xpub(f"m/44'/{constants.net.BIP44_COIN_TYPE}'/0'", xtype='standard')
root_fingerprint = BIP32Node.from_xkey(child_of_root_xpub).fingerprint.hex().lower()
return root_fingerprint

Expand Down
3 changes: 2 additions & 1 deletion electrum/plugins/ledger/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from electrum import ecc
from electrum import bip32
from electrum import constants
from electrum.crypto import hash_160
from electrum.bitcoin import int_to_hex, var_int, is_segwit_script_type, push_data
from electrum.bip32 import BIP32Node, convert_bip32_intpath_to_strpath
Expand Down Expand Up @@ -702,7 +703,7 @@ def setup_device(self, device_info, wizard, purpose):
device_id = device_info.device.id_
client = self.scan_and_create_client_for_device(device_id=device_id, wizard=wizard)
wizard.run_task_without_blocking_gui(
task=lambda: client.get_xpub("m/44'/88'/0'", 'standard')) # TODO replace by direct derivation once Nano S > 1.1
task=lambda: client.get_xpub(f"m/44'/{constants.net.BIP44_COIN_TYPE}'/0'", 'standard')) # TODO replace by direct derivation once Nano S > 1.1
return client

def get_xpub(self, device_id, derivation, xtype, wizard):
Expand Down
3 changes: 2 additions & 1 deletion electrum/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@

from .wallet_db import WalletDB
from .logging import Logger
from . import constants


def get_derivation_used_for_hw_device_encryption():
return ("m/44'/88'"
return (f"m/44'/{constants.net.BIP44_COIN_TYPE}'"
"/4541509'" # ascii 'ELE' as decimal ("BIP43 purpose")
"/1112098098'") # ascii 'BIE2' as decimal

Expand Down

0 comments on commit 2b23440

Please sign in to comment.