From d44f4f65b1b3bc129e5e06587eb50c8c1e770958 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Mon, 23 Apr 2018 22:02:44 +0100 Subject: [PATCH] defs: add more info to coin definitions --- defs/coins/bcash.json | 4 ++-- defs/coins/bcash_testnet.json | 4 ++-- defs/coins/bgold.json | 4 ++-- defs/coins/bitcoin.json | 4 ++-- defs/coins/bitcoin_testnet.json | 4 ++-- defs/coins/bprivate.json | 6 +++--- defs/coins/combine.py | 24 ++++++++++++++++++------ defs/coins/crown.json | 8 ++++---- defs/coins/dash.json | 4 ++-- defs/coins/dash_testnet.json | 4 ++-- defs/coins/decred_testnet.json | 4 ++-- defs/coins/denarius.json | 4 ++-- defs/coins/digibyte.json | 4 ++-- defs/coins/dogecoin.json | 4 ++-- defs/coins/flashcoin.json | 4 ++-- defs/coins/fujicoin.json | 6 +++--- defs/coins/groestlcoin.json | 6 +++--- defs/coins/litecoin.json | 4 ++-- defs/coins/litecoin_testnet.json | 4 ++-- defs/coins/monacoin.json | 4 ++-- defs/coins/myriad.json | 4 ++-- defs/coins/namecoin.json | 4 ++-- defs/coins/terracoin.json | 4 ++-- defs/coins/vertcoin.json | 4 ++-- defs/coins/viacoin.json | 4 ++-- defs/coins/zcash.json | 6 +++--- defs/coins/zcash_testnet.json | 4 ++-- defs/coins/zcoin.json | 4 ++-- defs/coins/zcoin_testnet.json | 4 ++-- 29 files changed, 80 insertions(+), 68 deletions(-) diff --git a/defs/coins/bcash.json b/defs/coins/bcash.json index 277cbc740b..89fbcec8f4 100644 --- a/defs/coins/bcash.json +++ b/defs/coins/bcash.json @@ -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 ", "curve_name": "secp256k1", "address_type": 0, diff --git a/defs/coins/bcash_testnet.json b/defs/coins/bcash_testnet.json index a896d9acc9..a31b3caca1 100644 --- a/defs/coins/bcash_testnet.json +++ b/defs/coins/bcash_testnet.json @@ -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 ", "curve_name": "secp256k1", "address_type": 111, diff --git a/defs/coins/bgold.json b/defs/coins/bgold.json index 2e37f36efb..c70f451422 100644 --- a/defs/coins/bgold.json +++ b/defs/coins/bgold.json @@ -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 ", "curve_name": "secp256k1", "address_type": 38, diff --git a/defs/coins/bitcoin.json b/defs/coins/bitcoin.json index e755e44987..312e2f4d8e 100644 --- a/defs/coins/bitcoin.json +++ b/defs/coins/bitcoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 0, diff --git a/defs/coins/bitcoin_testnet.json b/defs/coins/bitcoin_testnet.json index ffa0eb18e8..cc0068f755 100644 --- a/defs/coins/bitcoin_testnet.json +++ b/defs/coins/bitcoin_testnet.json @@ -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 ", "curve_name": "secp256k1", "address_type": 111, diff --git a/defs/coins/bprivate.json b/defs/coins/bprivate.json index b89070ba93..d1595f3289 100644 --- a/defs/coins/bprivate.json +++ b/defs/coins/bprivate.json @@ -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 ", "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" ] } diff --git a/defs/coins/combine.py b/defs/coins/combine.py index d883bbb553..8b133ee41c 100755 --- a/defs/coins/combine.py +++ b/defs/coins/combine.py @@ -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): diff --git a/defs/coins/crown.json b/defs/coins/crown.json index a6a37dedc4..ec5ba08a74 100644 --- a/defs/coins/crown.json +++ b/defs/coins/crown.json @@ -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 ", "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" ] } diff --git a/defs/coins/dash.json b/defs/coins/dash.json index 200224a002..c90396d323 100644 --- a/defs/coins/dash.json +++ b/defs/coins/dash.json @@ -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 ", "curve_name": "secp256k1", "address_type": 76, diff --git a/defs/coins/dash_testnet.json b/defs/coins/dash_testnet.json index 9d03022b1f..c76ba7c632 100644 --- a/defs/coins/dash_testnet.json +++ b/defs/coins/dash_testnet.json @@ -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 ", "curve_name": "secp256k1", "address_type": 140, diff --git a/defs/coins/decred_testnet.json b/defs/coins/decred_testnet.json index 98e0630ce0..f8ac4d7171 100644 --- a/defs/coins/decred_testnet.json +++ b/defs/coins/decred_testnet.json @@ -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 ", "curve_name": "secp256k1_decred", "address_type": 3873, diff --git a/defs/coins/denarius.json b/defs/coins/denarius.json index 9c8b3ea477..ffcf1836c5 100644 --- a/defs/coins/denarius.json +++ b/defs/coins/denarius.json @@ -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 ", "curve_name": "secp256k1", "address_type": 30, diff --git a/defs/coins/digibyte.json b/defs/coins/digibyte.json index c13035ecff..f73a5e6c44 100644 --- a/defs/coins/digibyte.json +++ b/defs/coins/digibyte.json @@ -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 ", "curve_name": "secp256k1", "address_type": 30, diff --git a/defs/coins/dogecoin.json b/defs/coins/dogecoin.json index f1b2d350c1..b1bcad6587 100644 --- a/defs/coins/dogecoin.json +++ b/defs/coins/dogecoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 30, diff --git a/defs/coins/flashcoin.json b/defs/coins/flashcoin.json index 44a5ce6bb7..cea9997aca 100644 --- a/defs/coins/flashcoin.json +++ b/defs/coins/flashcoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 68, diff --git a/defs/coins/fujicoin.json b/defs/coins/fujicoin.json index 6e4d129608..4af581887b 100644 --- a/defs/coins/fujicoin.json +++ b/defs/coins/fujicoin.json @@ -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 ", "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" ] } diff --git a/defs/coins/groestlcoin.json b/defs/coins/groestlcoin.json index b8048dd193..74e5a6906c 100644 --- a/defs/coins/groestlcoin.json +++ b/defs/coins/groestlcoin.json @@ -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 ", "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" ] } diff --git a/defs/coins/litecoin.json b/defs/coins/litecoin.json index a6ec22b394..bb8d805aa0 100644 --- a/defs/coins/litecoin.json +++ b/defs/coins/litecoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 48, diff --git a/defs/coins/litecoin_testnet.json b/defs/coins/litecoin_testnet.json index 18ff7e58d5..b1936454d3 100644 --- a/defs/coins/litecoin_testnet.json +++ b/defs/coins/litecoin_testnet.json @@ -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 ", "curve_name": "secp256k1", "address_type": 111, diff --git a/defs/coins/monacoin.json b/defs/coins/monacoin.json index 30b640c6af..baf17ae236 100644 --- a/defs/coins/monacoin.json +++ b/defs/coins/monacoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 50, diff --git a/defs/coins/myriad.json b/defs/coins/myriad.json index ede048de5b..c5e1c366b3 100644 --- a/defs/coins/myriad.json +++ b/defs/coins/myriad.json @@ -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 ", "address_type": 50, "address_type_p2sh": 9, diff --git a/defs/coins/namecoin.json b/defs/coins/namecoin.json index 5990ad2952..28b425eeda 100644 --- a/defs/coins/namecoin.json +++ b/defs/coins/namecoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 52, diff --git a/defs/coins/terracoin.json b/defs/coins/terracoin.json index adf68cf746..5eeb562154 100644 --- a/defs/coins/terracoin.json +++ b/defs/coins/terracoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 0, diff --git a/defs/coins/vertcoin.json b/defs/coins/vertcoin.json index 8bf5dac43c..97777a34e2 100644 --- a/defs/coins/vertcoin.json +++ b/defs/coins/vertcoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 71, diff --git a/defs/coins/viacoin.json b/defs/coins/viacoin.json index bb928403e3..786cb8214a 100644 --- a/defs/coins/viacoin.json +++ b/defs/coins/viacoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 71, diff --git a/defs/coins/zcash.json b/defs/coins/zcash.json index 5938075253..9d94a224d8 100644 --- a/defs/coins/zcash.json +++ b/defs/coins/zcash.json @@ -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 ", "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" ] } diff --git a/defs/coins/zcash_testnet.json b/defs/coins/zcash_testnet.json index 1619f900f0..47fc22a623 100644 --- a/defs/coins/zcash_testnet.json +++ b/defs/coins/zcash_testnet.json @@ -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 ", "curve_name": "secp256k1", "address_type": 7461, diff --git a/defs/coins/zcoin.json b/defs/coins/zcoin.json index c1e6288474..0d3d9cedf0 100644 --- a/defs/coins/zcoin.json +++ b/defs/coins/zcoin.json @@ -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 ", "curve_name": "secp256k1", "address_type": 82, diff --git a/defs/coins/zcoin_testnet.json b/defs/coins/zcoin_testnet.json index 3629d08346..1f5465fc50 100644 --- a/defs/coins/zcoin_testnet.json +++ b/defs/coins/zcoin_testnet.json @@ -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 ", "curve_name": "secp256k1", "address_type": 65,