mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-16 11:28:14 +00:00
defs: add more info to coin definitions
This commit is contained in:
parent
71a38266ca
commit
d44f4f65b1
@ -2,8 +2,8 @@
|
||||
"coin_name": "Bcash",
|
||||
"coin_shortcut": "BCH",
|
||||
"coin_label": "Bitcoin Cash",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://www.bitcoincash.org",
|
||||
"github": "https://github.com/Bitcoin-ABC/bitcoin-abc",
|
||||
"maintainer": "Jochen Hoenicke <hoenicke@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 0,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Bcash Testnet",
|
||||
"coin_shortcut": "TBCH",
|
||||
"coin_label": "Bitcoin Cash Testnet",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://www.bitcoincash.org",
|
||||
"github": "https://github.com/Bitcoin-ABC/bitcoin-abc",
|
||||
"maintainer": "Jochen Hoenicke <hoenicke@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 111,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Bgold",
|
||||
"coin_shortcut": "BTG",
|
||||
"coin_label": "Bitcoin Gold",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://bitcoingold.org",
|
||||
"github": "https://github.com/BTCGPU/BTCGPU",
|
||||
"maintainer": "Saleem Rashid <trezor@saleemrashid.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 38,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Bitcoin",
|
||||
"coin_shortcut": "BTC",
|
||||
"coin_label": "Bitcoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://bitcoin.org",
|
||||
"github": "https://github.com/bitcoin/bitcoin",
|
||||
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 0,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Testnet",
|
||||
"coin_shortcut": "TEST",
|
||||
"coin_label": "Testnet",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://bitcoin.org",
|
||||
"github": "https://github.com/bitcoin/bitcoin",
|
||||
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 111,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Bprivate",
|
||||
"coin_shortcut": "BTCP",
|
||||
"coin_label": "Bitcoin Private",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://btcprivate.org",
|
||||
"github": "https://github.com/BTCPrivate/BitcoinPrivate",
|
||||
"maintainer": "Chris Sulmone <csulmone@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 4901,
|
||||
@ -31,6 +31,6 @@
|
||||
"min_address_length": 35,
|
||||
"max_address_length": 95,
|
||||
"bitcore": [
|
||||
"https://explorer.btcprivate.org/"
|
||||
"https://explorer.btcprivate.org"
|
||||
]
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import glob
|
||||
import re
|
||||
|
||||
|
||||
def check_type(val, types, nullable=False, empty=False, regex=None):
|
||||
def check_type(val, types, nullable=False, empty=False, regex=None, choice=None):
|
||||
# check nullable
|
||||
if nullable and val is None:
|
||||
return True
|
||||
@ -22,6 +22,10 @@ def check_type(val, types, nullable=False, empty=False, regex=None):
|
||||
m = re.match(regex, val)
|
||||
if not m or m.string != val:
|
||||
return False
|
||||
# check choice
|
||||
if choice is not None:
|
||||
if val not in choice:
|
||||
return False
|
||||
# check type
|
||||
if isinstance(types, list):
|
||||
return True in [isinstance(val, t) for t in types]
|
||||
@ -33,20 +37,25 @@ def validate_coin(coin):
|
||||
assert check_type(coin['coin_name'], str)
|
||||
assert check_type(coin['coin_shortcut'], str)
|
||||
assert check_type(coin['coin_label'], str)
|
||||
assert check_type(coin['website'], str, empty=True)
|
||||
assert check_type(coin['github'], str, empty=True)
|
||||
assert check_type(coin['website'], str)
|
||||
assert check_type(coin['github'], str)
|
||||
assert not coin['website'].endswith('/')
|
||||
assert not coin['github'].endswith('/')
|
||||
assert check_type(coin['maintainer'], str)
|
||||
assert check_type(coin['curve_name'], str)
|
||||
assert check_type(coin['curve_name'], str, choice=['secp256k1', 'secp256k1_decred', 'secp256k1_groestl'])
|
||||
assert check_type(coin['address_type'], int)
|
||||
assert check_type(coin['address_type_p2sh'], int)
|
||||
assert coin['address_type'] != coin['address_type_p2sh']
|
||||
assert check_type(coin['maxfee_kb'], int)
|
||||
assert check_type(coin['minfee_kb'], int)
|
||||
assert coin['maxfee_kb'] > coin['minfee_kb']
|
||||
assert coin['maxfee_kb'] >= coin['minfee_kb']
|
||||
assert check_type(coin['hash_genesis_block'], str, regex=r'[0-9a-f]{64}')
|
||||
assert check_type(coin['xprv_magic'], str, regex=r'[0-9a-f]{8}')
|
||||
assert check_type(coin['xpub_magic'], str, regex=r'[0-9a-f]{8}')
|
||||
assert check_type(coin['xpub_magic_segwit_p2sh'], str, regex=r'[0-9a-f]{8}', nullable=True)
|
||||
assert coin['xprv_magic'] != coin['xpub_magic']
|
||||
assert coin['xprv_magic'] != coin['xpub_magic_segwit_p2sh']
|
||||
assert coin['xpub_magic'] != coin['xpub_magic_segwit_p2sh']
|
||||
assert check_type(coin['slip44'], int)
|
||||
assert check_type(coin['segwit'], bool)
|
||||
assert check_type(coin['decred'], bool)
|
||||
@ -58,9 +67,12 @@ def validate_coin(coin):
|
||||
assert check_type(coin['signed_message_header'], str)
|
||||
assert check_type(coin['min_address_length'], int)
|
||||
assert check_type(coin['max_address_length'], int)
|
||||
assert check_type(coin['bitcore'], list, empty=True)
|
||||
assert coin['max_address_length'] >= coin['min_address_length']
|
||||
assert check_type(coin['bech32_prefix'], str, nullable=True)
|
||||
assert check_type(coin['cashaddr_prefix'], str, nullable=True)
|
||||
assert check_type(coin['bitcore'], list, empty=True)
|
||||
for bc in coin['bitcore']:
|
||||
assert not bc.endswith('/')
|
||||
|
||||
|
||||
def process_json(fn):
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Crown",
|
||||
"coin_shortcut": "CRW",
|
||||
"coin_label": "Crown",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://crown.tech",
|
||||
"github": "https://github.com/Crowndev/crowncoin",
|
||||
"maintainer": "hypermist <hypermist@crown.tech>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 0,
|
||||
@ -31,7 +31,7 @@
|
||||
"min_address_length": 27,
|
||||
"max_address_length": 34,
|
||||
"bitcore": [
|
||||
"https://crw-bitcore.crown.tech/",
|
||||
"https://crw2-bitcore.crown.tech/"
|
||||
"https://crw-bitcore.crown.tech",
|
||||
"https://crw2-bitcore.crown.tech"
|
||||
]
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Dash",
|
||||
"coin_shortcut": "DASH",
|
||||
"coin_label": "Dash",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://www.dash.org",
|
||||
"github": "https://github.com/dashpay/dash",
|
||||
"maintainer": "Karel Bilek <karel.bilek@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 76,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Dash Testnet",
|
||||
"coin_shortcut": "tDASH",
|
||||
"coin_label": "Dash Testnet",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://www.dash.org",
|
||||
"github": "https://github.com/dashpay/dash",
|
||||
"maintainer": "Karel Bilek <karel.bilek@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 140,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Decred Testnet",
|
||||
"coin_shortcut": "TDCR",
|
||||
"coin_label": "Decred Testnet",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://www.decred.org",
|
||||
"github": "https://github.com/decred/dcrd",
|
||||
"maintainer": "Saleem Rashid <trezor@saleemrashid.com>",
|
||||
"curve_name": "secp256k1_decred",
|
||||
"address_type": 3873,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Denarius",
|
||||
"coin_shortcut": "DNR",
|
||||
"coin_label": "Denarius",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://denarius.io",
|
||||
"github": "https://github.com/carsenk/denarius",
|
||||
"maintainer": "carsenk <carsenk@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 30,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "DigiByte",
|
||||
"coin_shortcut": "DGB",
|
||||
"coin_label": "DigiByte",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://digibyte.io",
|
||||
"github": "https://github.com/digibyte/digibyte",
|
||||
"maintainer": "DigiByte <dev@digibyte.co>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 30,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Dogecoin",
|
||||
"coin_shortcut": "DOGE",
|
||||
"coin_label": "Dogecoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "http://dogecoin.com",
|
||||
"github": "https://github.com/dogecoin/dogecoin",
|
||||
"maintainer": "Karel Bilek <karel.bilek@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 30,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Flashcoin",
|
||||
"coin_shortcut": "FLASH",
|
||||
"coin_label": "Flashcoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://www.flashcoin.io",
|
||||
"github": "https://github.com/flash-coin",
|
||||
"maintainer": "flashbountyhunter <flashbountyhunter@protonmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 68,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Fujicoin",
|
||||
"coin_shortcut": "FJC",
|
||||
"coin_label": "Fujicoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "http://fujicoin.org",
|
||||
"github": "https://github.com/fujicoin/fujicoin",
|
||||
"maintainer": "motty <admin@fujicoin.org>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 36,
|
||||
@ -34,6 +34,6 @@
|
||||
"min_address_length": 27,
|
||||
"max_address_length": 34,
|
||||
"bitcore": [
|
||||
"http://explorer.fujicoin.org/"
|
||||
"http://explorer.fujicoin.org"
|
||||
]
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Groestlcoin",
|
||||
"coin_shortcut": "GRS",
|
||||
"coin_label": "Groestlcoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://www.groestlcoin.org",
|
||||
"github": "https://github.com/Groestlcoin/groestlcoin",
|
||||
"maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
|
||||
"curve_name": "secp256k1_groestl",
|
||||
"address_type": 36,
|
||||
@ -31,6 +31,6 @@
|
||||
"min_address_length": 27,
|
||||
"max_address_length": 34,
|
||||
"bitcore": [
|
||||
"https://groestlsight.groestlcoin.org/"
|
||||
"https://groestlsight.groestlcoin.org"
|
||||
]
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Litecoin",
|
||||
"coin_shortcut": "LTC",
|
||||
"coin_label": "Litecoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://litecoin.org",
|
||||
"github": "https://github.com/litecoin-project/litecoin",
|
||||
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 48,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Litecoin Testnet",
|
||||
"coin_shortcut": "TLTC",
|
||||
"coin_label": "Litecoin Testnet",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://litecoin.org",
|
||||
"github": "https://github.com/litecoin-project/litecoin",
|
||||
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 111,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Monacoin",
|
||||
"coin_shortcut": "MONA",
|
||||
"coin_label": "Monacoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://monacoin.org",
|
||||
"github": "https://github.com/monacoinproject/monacoin",
|
||||
"maintainer": "cryptcoin-junkey <cryptcoin.junkey@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 50,
|
||||
|
@ -3,8 +3,8 @@
|
||||
"coin_shortcut": "XMY",
|
||||
"coin_label": "Myriad",
|
||||
"curve_name": "secp256k1",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://www.myriadcoin.org",
|
||||
"github": "https://github.com/myriadcoin/myriadcoin",
|
||||
"maintainer": "Adam Hickerson <a@hi.ckerson.com>",
|
||||
"address_type": 50,
|
||||
"address_type_p2sh": 9,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Namecoin",
|
||||
"coin_shortcut": "NMC",
|
||||
"coin_label": "Namecoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://namecoin.org",
|
||||
"github": "https://github.com/namecoin/namecoin-core",
|
||||
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 52,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Terracoin",
|
||||
"coin_shortcut": "TRC",
|
||||
"coin_label": "Terracoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://terracoin.io",
|
||||
"github": "https://github.com/terracoin/terracoin",
|
||||
"maintainer": "Justin F. Hallett <thesin@users.sf.net>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 0,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Vertcoin",
|
||||
"coin_shortcut": "VTC",
|
||||
"coin_label": "Vertcoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://vertcoin.org",
|
||||
"github": "https://github.com/vertcoin-project/vertcoin-core",
|
||||
"maintainer": "Jochen Hoenicke <hoenicke@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 71,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "viacoin",
|
||||
"coin_shortcut": "VIA",
|
||||
"coin_label": "viacoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://viacoin.org",
|
||||
"github": "https://github.com/viacoin",
|
||||
"maintainer": "romanornr <romanornr@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 71,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Zcash",
|
||||
"coin_shortcut": "ZEC",
|
||||
"coin_label": "Zcash",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://z.cash",
|
||||
"github": "https://github.com/zcash/zcash",
|
||||
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 7352,
|
||||
@ -31,6 +31,6 @@
|
||||
"min_address_length": 35,
|
||||
"max_address_length": 95,
|
||||
"bitcore": [
|
||||
"https://zec-bitcore1.trezor.io/"
|
||||
"https://zec-bitcore1.trezor.io"
|
||||
]
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Zcash Testnet",
|
||||
"coin_shortcut": "TAZ",
|
||||
"coin_label": "Zcash Testnet",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://z.cash",
|
||||
"github": "https://github.com/zcash/zcash",
|
||||
"maintainer": "Pavol Rusnak <stick@satoshilabs.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 7461,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Zcoin",
|
||||
"coin_shortcut": "XZC",
|
||||
"coin_label": "Zcoin",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://zcoin.io",
|
||||
"github": "https://github.com/zcoinofficial/zcoin",
|
||||
"maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 82,
|
||||
|
@ -2,8 +2,8 @@
|
||||
"coin_name": "Zcoin Testnet",
|
||||
"coin_shortcut": "tXZC",
|
||||
"coin_label": "Zcoin Testnet",
|
||||
"website": "",
|
||||
"github": "",
|
||||
"website": "https://zcoin.io",
|
||||
"github": "https://github.com/zcoinofficial/zcoin",
|
||||
"maintainer": "Yura Pakhuchiy <pakhuchiy@gmail.com>",
|
||||
"curve_name": "secp256k1",
|
||||
"address_type": 65,
|
||||
|
Loading…
Reference in New Issue
Block a user