From 7db1061123d09a6a098913fb19b3cb4a072c5d82 Mon Sep 17 00:00:00 2001 From: Yura Pakhuchiy Date: Sun, 1 Jul 2018 17:53:30 +0700 Subject: [PATCH] Add .curve_name and Groestlcoin to coininfo.py --- src/apps/common/coininfo.py | 61 ++++++++++++++++++++++++++++++++++++- tools/codegen/gen_coins.py | 3 ++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/apps/common/coininfo.py b/src/apps/common/coininfo.py index b4cb2bf29f..6e357aa962 100644 --- a/src/apps/common/coininfo.py +++ b/src/apps/common/coininfo.py @@ -16,7 +16,8 @@ class CoinInfo: fork_id: int, force_bip143: bool, version_group_id: int, - bip115: bool + bip115: bool, + curve_name: str, ): self.coin_name = coin_name self.coin_shortcut = coin_shortcut @@ -33,6 +34,7 @@ class CoinInfo: self.force_bip143 = force_bip143 self.version_group_id = version_group_id self.bip115 = bip115 + self.curve_name = curve_name # the following list is generated using tools/codegen/gen_coins.py @@ -54,6 +56,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Testnet', @@ -71,6 +74,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Bcash', @@ -88,6 +92,7 @@ COINS = [ force_bip143=True, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Bcash Testnet', @@ -105,6 +110,7 @@ COINS = [ force_bip143=True, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Bgold', @@ -122,6 +128,7 @@ COINS = [ force_bip143=True, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Bprivate', @@ -139,6 +146,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Dash', @@ -156,6 +164,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='DigiByte', @@ -173,6 +182,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Dogecoin', @@ -190,6 +200,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Fujicoin', @@ -207,6 +218,43 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', + ), + CoinInfo( + coin_name='Groestlcoin', + coin_shortcut='GRS', + address_type=36, + address_type_p2sh=5, + maxfee_kb=100000, + signed_message_header='GroestlCoin Signed Message:\n', + xpub_magic=0x0488b21e, + bech32_prefix='grs', + cashaddr_prefix=None, + slip44=17, + segwit=True, + fork_id=None, + force_bip143=False, + version_group_id=None, + bip115=False, + curve_name='secp256k1-groestl', + ), + CoinInfo( + coin_name='Groestlcoin Testnet', + coin_shortcut='tGRS', + address_type=111, + address_type_p2sh=196, + maxfee_kb=100000, + signed_message_header='GroestlCoin Signed Message:\n', + xpub_magic=0x043587cf, + bech32_prefix='tgrs', + cashaddr_prefix=None, + slip44=1, + segwit=True, + fork_id=None, + force_bip143=False, + version_group_id=None, + bip115=False, + curve_name='secp256k1-groestl', ), CoinInfo( coin_name='Litecoin', @@ -224,6 +272,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Litecoin Testnet', @@ -241,6 +290,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Monacoin', @@ -258,6 +308,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Namecoin', @@ -275,6 +326,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Vertcoin', @@ -292,6 +344,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Viacoin', @@ -309,6 +362,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Zcash', @@ -326,6 +380,7 @@ COINS = [ force_bip143=False, version_group_id=0x03c48270, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Zcash Testnet', @@ -343,6 +398,7 @@ COINS = [ force_bip143=False, version_group_id=0x03c48270, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Zcoin', @@ -360,6 +416,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Zcoin Testnet', @@ -377,6 +434,7 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=False, + curve_name='secp256k1', ), CoinInfo( coin_name='Zencash', @@ -394,5 +452,6 @@ COINS = [ force_bip143=False, version_group_id=None, bip115=True, + curve_name='secp256k1', ), ] diff --git a/tools/codegen/gen_coins.py b/tools/codegen/gen_coins.py index 713fef93cd..2dcd98def7 100755 --- a/tools/codegen/gen_coins.py +++ b/tools/codegen/gen_coins.py @@ -17,6 +17,7 @@ fields = [ 'force_bip143', 'version_group_id', 'bip115', + 'curve_name', ] support = json.load(open('../../vendor/trezor-common/defs/support.json', 'r')) @@ -35,6 +36,8 @@ for c in coins: v = '0x%08x' % data[n] if data[n] is not None else 'None' else: v = repr(data[n]) + if n == 'curve_name': + v = v.replace('_', '-') print(' %s=%s,' % (n, v)) print(' ),')