From fce48ed2e2bd8d049e0cbefcd94a4b78e880b826 Mon Sep 17 00:00:00 2001 From: smk762 Date: Mon, 30 Oct 2023 14:18:07 +0800 Subject: [PATCH 1/2] update segwit derivation paths --- coins | 44 ++++++++++++++++++++--------------------- utils/scan_electrums.py | 2 ++ 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/coins b/coins index cbbe4184c..e8a5f7937 100644 --- a/coins +++ b/coins @@ -2094,7 +2094,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/0'", + "derivation_path": "m/84'/0'", "trezor_coin": "Bitcoin", "links": { "github": "https://github.com/bitcoin/bitcoin", @@ -2324,7 +2324,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/160'", + "derivation_path": "m/84'/160'", "trezor_coin": "Bitcore", "links": { "github": "https://github.com/LIMXTEC/BitCore", @@ -2604,7 +2604,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/34'" + "derivation_path": "m/84'/34'" }, { "coin": "CEL-ERC20", @@ -3226,7 +3226,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/802'", + "derivation_path": "m/84'/802'", "links": { "github": "https://github.com/cyberyen/cyberyen", "homepage": "https://cyberyen.org" @@ -3517,7 +3517,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/20'", + "derivation_path": "m/84'/20'", "trezor_coin": "DigiByte", "links": { "github": "https://github.com/digibyte/digibyte", @@ -4661,7 +4661,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/75'", + "derivation_path": "m/84'/75'", "trezor_coin": "Fujicoin", "links": { "github": "https://github.com/fujicoin/fujicoin", @@ -4827,7 +4827,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/8'", + "derivation_path": "m/84'/8'", "trezor_coin": "Feathercoin", "links": { "github": "https://github.com/FeatherCoin/Feathercoin", @@ -5442,7 +5442,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/17'", + "derivation_path": "m/84'/17'", "trezor_coin": "Groestlcoin", "links": { "github": "https://github.com/Groestlcoin/groestlcoin", @@ -6909,7 +6909,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/140'" + "derivation_path": "m/84'/140'" }, { "coin": "LCC", @@ -6959,7 +6959,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/192'" + "derivation_path": "m/84'/192'" }, { "coin": "LDO-ERC20", @@ -7313,7 +7313,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/613'" + "derivation_path": "m/84'/613'" }, { "coin": "LEASH-ERC20", @@ -7444,7 +7444,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/2'", + "derivation_path": "m/84'/2'", "trezor_coin": "Litecoin", "links": { "github": "https://github.com/litecoin-project/litecoin", @@ -8146,7 +8146,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/22'", + "derivation_path": "m/84'/22'", "trezor_coin": "Monacoin", "links": { "github": "https://github.com/monacoinproject/monacoin", @@ -8388,7 +8388,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/7'", + "derivation_path": "m/84'/7'", "trezor_coin": "Namecoin", "links": { "github": "https://github.com/namecoin/namecoin-core", @@ -9499,7 +9499,7 @@ "protocol": { "type": "QTUM" }, - "derivation_path": "m/44'/2301'", + "derivation_path": "m/84'/2301'", "trezor_coin": "Qtum", "links": { "github": "https://github.com/qtumproject/qtum", @@ -9744,7 +9744,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/143'" + "derivation_path": "m/84'/143'" }, { "coin": "NFTX", @@ -10587,7 +10587,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/57'", + "derivation_path": "m/84'/57'", "trezor_coin": "Syscoin", "links": { "github": "https://github.com/syscoin/syscoin", @@ -11987,7 +11987,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/14'", + "derivation_path": "m/84'/14'", "trezor_coin": "Viacoin", "links": { "github": "https://github.com/viacoin", @@ -12130,7 +12130,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/28'", + "derivation_path": "m/84'/28'", "trezor_coin": "Vertcoin", "links": { "github": "https://github.com/vertcoin-project/vertcoin-core", @@ -12374,7 +12374,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/597'" + "derivation_path": "m/84'/597'" }, { "coin": "XEP-BEP20", @@ -12491,7 +12491,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/90'" + "derivation_path": "m/84'/90'" }, { "coin": "XNA", @@ -13935,7 +13935,7 @@ "protocol": { "type": "UTXO" }, - "derivation_path": "m/44'/202'", + "derivation_path": "m/84'/202'", "links": { "github": "https://github.com/fiscalobject/ufo", "homepage": "https://ufobject.com" diff --git a/utils/scan_electrums.py b/utils/scan_electrums.py index dee8d911e..c2f8bef10 100755 --- a/utils/scan_electrums.py +++ b/utils/scan_electrums.py @@ -94,6 +94,8 @@ def thread_ws(coin, ip, port, method, params): passed_ws[coin].append(f"{ip}:{port}") except Exception as e: + # TODO: Fix this + resp = "" if str(resp).find('{"jsonrpc": "2.0"') > -1: if coin not in passed_ws: passed_ws.update({coin:[]}) From fa123e5cc17c50a9061b050e8be0bbccb46030c6 Mon Sep 17 00:00:00 2001 From: smk762 Date: Fri, 3 Nov 2023 17:30:52 +0800 Subject: [PATCH 2/2] accomodate segwit --- utils/generate_app_configs.py | 22 ++++++++++++++++++++++ utils/update_derivation_paths.py | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/utils/generate_app_configs.py b/utils/generate_app_configs.py index 72d11bc8a..40806430e 100755 --- a/utils/generate_app_configs.py +++ b/utils/generate_app_configs.py @@ -589,6 +589,22 @@ def filter_wss(coins_config): json.dump(coins_config_wss, f, indent=4) return coins_config_wss +def scan_segwit(coins_config): + no_tc = [] + no_dv = [] + bad_dv = [] + for coin in coins_config: + if coin.endswith('-segwit'): + if "derivation_path" not in coins_config[coin]: + print(colorize(f"{coin} has no derivation path!", 'red')) + no_dv.append(coin) + elif coins_config[coin]["derivation_path"].startswith("m/84'") == False: + print(colorize(f"{coin} has non-segwit derivation path!", 'red')) + bad_dv.append(coin) + if "trezor_coin" not in coins_config[coin]: + print(colorize(f"{coin} has no trezor coin!", 'red')) + no_tc.append(coin) + return no_dv, bad_dv, no_tc if __name__ == "__main__": @@ -611,3 +627,9 @@ def filter_wss(coins_config): print(f"Total coins with SSL: {len(coins_config_ssl)}") print(f"Total coins with TCP: {len(coins_config_tcp)}") print(f"Total coins with WSS: {len(coins_config_wss)}") + no_dv, bad_dv, no_tc = scan_segwit(coins_config) + print(f"Segwit coins with no derivation path: {no_dv}") + print(f"Segwit coins with bad derivation path: {bad_dv}") + print(f"Segwit coins with no trezor coin: {no_tc}") + + \ No newline at end of file diff --git a/utils/update_derivation_paths.py b/utils/update_derivation_paths.py index 7f9c5c24d..205bfdc0c 100755 --- a/utils/update_derivation_paths.py +++ b/utils/update_derivation_paths.py @@ -75,7 +75,7 @@ proto = i['protocol']['type'] if proto in ["UTXO", "QTUM"]: if 'derivation_path' in i: - path = i['derivation_path'] + path = i['derivation_path'].replace("m/44'", "m/84'") for i in coins: if i["coin"] == coin: if path != "":