From 31fbb2b0a3e0213290f4691f3ae9eac51da6daa4 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Tue, 24 Apr 2018 15:03:40 +0100 Subject: [PATCH] defs: update coin definitions --- defs/coins/bcash.json | 2 +- defs/coins/bcash_testnet.json | 2 +- defs/coins/bgold.json | 2 +- defs/coins/bitcoin.json | 2 +- defs/coins/bitcoin_testnet.json | 2 +- defs/coins/bprivate.json | 2 +- defs/coins/combine.py | 31 +++++++++++++++---------------- defs/coins/crown.json | 2 +- defs/coins/dash.json | 2 +- defs/coins/dash_testnet.json | 2 +- defs/coins/decred_testnet.json | 2 +- defs/coins/denarius.json | 2 +- defs/coins/digibyte.json | 2 +- defs/coins/dogecoin.json | 2 +- defs/coins/flashcoin.json | 2 +- defs/coins/fujicoin.json | 2 +- defs/coins/groestlcoin.json | 2 +- defs/coins/litecoin.json | 2 +- defs/coins/litecoin_testnet.json | 2 +- defs/coins/monacoin.json | 2 +- defs/coins/myriad.json | 2 +- defs/coins/namecoin.json | 2 +- defs/coins/terracoin.json | 2 +- defs/coins/vertcoin.json | 2 +- defs/coins/viacoin.json | 6 +++--- defs/coins/zcash.json | 2 +- defs/coins/zcash_testnet.json | 2 +- defs/coins/zcoin.json | 2 +- defs/coins/zcoin_testnet.json | 2 +- 29 files changed, 45 insertions(+), 46 deletions(-) diff --git a/defs/coins/bcash.json b/defs/coins/bcash.json index 89fbcec8f..c72fed992 100644 --- a/defs/coins/bcash.json +++ b/defs/coins/bcash.json @@ -29,7 +29,7 @@ "High": 200 }, "dust_limit": 546, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "bitcoincash:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/bcash_testnet.json b/defs/coins/bcash_testnet.json index a31b3caca..219ed1b3d 100644 --- a/defs/coins/bcash_testnet.json +++ b/defs/coins/bcash_testnet.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 546, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "bitcoincash:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/bgold.json b/defs/coins/bgold.json index c70f45142..233173c6c 100644 --- a/defs/coins/bgold.json +++ b/defs/coins/bgold.json @@ -29,7 +29,7 @@ "High": 200 }, "dust_limit": 546, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "bitcoingold:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/bitcoin.json b/defs/coins/bitcoin.json index 312e2f4d8..bcae7be88 100644 --- a/defs/coins/bitcoin.json +++ b/defs/coins/bitcoin.json @@ -29,7 +29,7 @@ "High": 200 }, "dust_limit": 546, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "bitcoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/bitcoin_testnet.json b/defs/coins/bitcoin_testnet.json index cc0068f75..bd31b6c20 100644 --- a/defs/coins/bitcoin_testnet.json +++ b/defs/coins/bitcoin_testnet.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 546, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "bitcoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/bprivate.json b/defs/coins/bprivate.json index d1595f328..dbe2d3a34 100644 --- a/defs/coins/bprivate.json +++ b/defs/coins/bprivate.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 546, - "blocktime_minutes": 2.5, + "blocktime_seconds": 150, "address_prefix": "bitcoinprivate:", "min_address_length": 35, "max_address_length": 95, diff --git a/defs/coins/combine.py b/defs/coins/combine.py index 8b133ee41..8b483ce2e 100755 --- a/defs/coins/combine.py +++ b/defs/coins/combine.py @@ -20,7 +20,7 @@ def check_type(val, types, nullable=False, empty=False, regex=None, choice=None) if types is not str: return False m = re.match(regex, val) - if not m or m.string != val: + if not m: return False # check choice if choice is not None: @@ -34,13 +34,11 @@ def check_type(val, types, nullable=False, empty=False, regex=None, choice=None) 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) - assert check_type(coin['github'], str) - assert not coin['website'].endswith('/') - assert not coin['github'].endswith('/') + assert check_type(coin['coin_name'], str, regex=r'^[A-Z]') + assert check_type(coin['coin_shortcut'], str, regex=r'^[A-Zt][A-Z][A-Z]+$') + assert check_type(coin['coin_label'], str, regex=r'^[A-Z]') + assert check_type(coin['website'], str, regex=r'^http.*[^/]$') + assert check_type(coin['github'], str, regex=r'^https://github.com/.*[^/]$') assert check_type(coin['maintainer'], str) assert check_type(coin['curve_name'], str, choice=['secp256k1', 'secp256k1_decred', 'secp256k1_groestl']) assert check_type(coin['address_type'], int) @@ -49,10 +47,10 @@ def validate_coin(coin): assert check_type(coin['maxfee_kb'], int) assert check_type(coin['minfee_kb'], int) 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 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'] @@ -60,11 +58,12 @@ def validate_coin(coin): assert check_type(coin['segwit'], bool) assert check_type(coin['decred'], bool) assert check_type(coin['forkid'], int, nullable=True) - assert check_type(coin['force_bip143'], bool, nullable=True) + assert check_type(coin['force_bip143'], bool) assert check_type(coin['default_fee_b'], dict) assert check_type(coin['dust_limit'], int) - assert check_type(coin['blocktime_minutes'], [int, float]) + assert check_type(coin['blocktime_seconds'], int) assert check_type(coin['signed_message_header'], str) + assert check_type(coin['address_prefix'], str, regex=r'^.*:$') assert check_type(coin['min_address_length'], int) assert check_type(coin['max_address_length'], int) assert coin['max_address_length'] >= coin['min_address_length'] @@ -76,8 +75,10 @@ def validate_coin(coin): def process_json(fn): + print(fn, end=' ... ') j = json.load(open(fn)) validate_coin(j) + print('OK') return j @@ -88,5 +89,3 @@ for fn in glob.glob('*.json'): coins[n] = c json.dump(coins, open('../coins.json', 'w'), indent=4, sort_keys=True) - -print('OK') diff --git a/defs/coins/crown.json b/defs/coins/crown.json index ec5ba08a7..6c1ab6430 100644 --- a/defs/coins/crown.json +++ b/defs/coins/crown.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 546, - "blocktime_minutes": 1, + "blocktime_seconds": 60, "address_prefix": "crown:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/dash.json b/defs/coins/dash.json index c90396d32..be568f587 100644 --- a/defs/coins/dash.json +++ b/defs/coins/dash.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 5460, - "blocktime_minutes": 2.5, + "blocktime_seconds": 150, "address_prefix": "dash:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/dash_testnet.json b/defs/coins/dash_testnet.json index c76ba7c63..3bd3f55ed 100644 --- a/defs/coins/dash_testnet.json +++ b/defs/coins/dash_testnet.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 5460, - "blocktime_minutes": 2.5, + "blocktime_seconds": 150, "address_prefix": "dash:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/decred_testnet.json b/defs/coins/decred_testnet.json index f8ac4d717..0ae331a25 100644 --- a/defs/coins/decred_testnet.json +++ b/defs/coins/decred_testnet.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 546, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "bitcoin:", "min_address_length": 35, "max_address_length": 35, diff --git a/defs/coins/denarius.json b/defs/coins/denarius.json index ffcf1836c..6a1fc28a7 100644 --- a/defs/coins/denarius.json +++ b/defs/coins/denarius.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 54600, - "blocktime_minutes": 0.5, + "blocktime_seconds": 30, "address_prefix": "denarius:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/digibyte.json b/defs/coins/digibyte.json index f73a5e6c4..510da8104 100644 --- a/defs/coins/digibyte.json +++ b/defs/coins/digibyte.json @@ -29,7 +29,7 @@ "High": 200 }, "dust_limit": 546, - "blocktime_minutes": 0.25, + "blocktime_seconds": 15, "address_prefix": "digibyte:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/dogecoin.json b/defs/coins/dogecoin.json index b1bcad658..cc70bb0ea 100644 --- a/defs/coins/dogecoin.json +++ b/defs/coins/dogecoin.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 10000000, - "blocktime_minutes": 1, + "blocktime_seconds": 60, "address_prefix": "dogecoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/flashcoin.json b/defs/coins/flashcoin.json index cea9997ac..5aeef8e16 100644 --- a/defs/coins/flashcoin.json +++ b/defs/coins/flashcoin.json @@ -26,7 +26,7 @@ "Normal": 0 }, "dust_limit": 10000, - "blocktime_minutes": 1, + "blocktime_seconds": 60, "address_prefix": "flashcoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/fujicoin.json b/defs/coins/fujicoin.json index 4af581887..57e73570f 100644 --- a/defs/coins/fujicoin.json +++ b/defs/coins/fujicoin.json @@ -29,7 +29,7 @@ "High": 1000000 }, "dust_limit": 100000, - "blocktime_minutes": 1.0, + "blocktime_seconds": 60, "address_prefix": "fujicoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/groestlcoin.json b/defs/coins/groestlcoin.json index 74e5a6906..43cb4eeb4 100644 --- a/defs/coins/groestlcoin.json +++ b/defs/coins/groestlcoin.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 546, - "blocktime_minutes": 1, + "blocktime_seconds": 60, "address_prefix": "groestlcoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/litecoin.json b/defs/coins/litecoin.json index bb8d805aa..1cd9bd041 100644 --- a/defs/coins/litecoin.json +++ b/defs/coins/litecoin.json @@ -26,7 +26,7 @@ "Normal": 1000 }, "dust_limit": 54600, - "blocktime_minutes": 2.5, + "blocktime_seconds": 150, "address_prefix": "litecoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/litecoin_testnet.json b/defs/coins/litecoin_testnet.json index b1936454d..071ff8c80 100644 --- a/defs/coins/litecoin_testnet.json +++ b/defs/coins/litecoin_testnet.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 54600, - "blocktime_minutes": 2.5, + "blocktime_seconds": 150, "address_prefix": "litecoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/monacoin.json b/defs/coins/monacoin.json index baf17ae23..977b628fb 100644 --- a/defs/coins/monacoin.json +++ b/defs/coins/monacoin.json @@ -26,7 +26,7 @@ "Normal": 100000 }, "dust_limit": 54600, - "blocktime_minutes": 1.5, + "blocktime_seconds": 90, "address_prefix": "monacoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/myriad.json b/defs/coins/myriad.json index c5e1c366b..5bcc847c6 100644 --- a/defs/coins/myriad.json +++ b/defs/coins/myriad.json @@ -29,7 +29,7 @@ "High": 200 }, "dust_limit": 546, - "blocktime_minutes": 1, + "blocktime_seconds": 60, "address_prefix": "myriadcoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/namecoin.json b/defs/coins/namecoin.json index 28b425eed..38382517d 100644 --- a/defs/coins/namecoin.json +++ b/defs/coins/namecoin.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 2940, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "namecoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/terracoin.json b/defs/coins/terracoin.json index 5eeb56215..5fdc34f89 100644 --- a/defs/coins/terracoin.json +++ b/defs/coins/terracoin.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 5460, - "blocktime_minutes": 2, + "blocktime_seconds": 120, "address_prefix": "terracoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/vertcoin.json b/defs/coins/vertcoin.json index 97777a34e..3d9f85c3d 100644 --- a/defs/coins/vertcoin.json +++ b/defs/coins/vertcoin.json @@ -26,7 +26,7 @@ "Normal": 1000 }, "dust_limit": 54600, - "blocktime_minutes": 2.5, + "blocktime_seconds": 150, "address_prefix": "vertcoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/viacoin.json b/defs/coins/viacoin.json index 786cb8214..aeb245c4b 100644 --- a/defs/coins/viacoin.json +++ b/defs/coins/viacoin.json @@ -1,7 +1,7 @@ { - "coin_name": "viacoin", + "coin_name": "Viacoin", "coin_shortcut": "VIA", - "coin_label": "viacoin", + "coin_label": "Viacoin", "website": "https://viacoin.org", "github": "https://github.com/viacoin", "maintainer": "romanornr ", @@ -29,7 +29,7 @@ "High": 20000 }, "dust_limit": 54600, - "blocktime_minutes": 0.4, + "blocktime_seconds": 24, "address_prefix": "viacoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/zcash.json b/defs/coins/zcash.json index 9d94a224d..9699e0431 100644 --- a/defs/coins/zcash.json +++ b/defs/coins/zcash.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 546, - "blocktime_minutes": 2.5, + "blocktime_seconds": 150, "address_prefix": "zcash:", "min_address_length": 35, "max_address_length": 95, diff --git a/defs/coins/zcash_testnet.json b/defs/coins/zcash_testnet.json index 47fc22a62..ae5a361f4 100644 --- a/defs/coins/zcash_testnet.json +++ b/defs/coins/zcash_testnet.json @@ -26,7 +26,7 @@ "Normal": 10 }, "dust_limit": 546, - "blocktime_minutes": 2.5, + "blocktime_seconds": 150, "address_prefix": "zcash:", "min_address_length": 35, "max_address_length": 95, diff --git a/defs/coins/zcoin.json b/defs/coins/zcoin.json index 0d3d9cedf..0154c365d 100644 --- a/defs/coins/zcoin.json +++ b/defs/coins/zcoin.json @@ -29,7 +29,7 @@ "High": 200 }, "dust_limit": 546, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "zcoin:", "min_address_length": 27, "max_address_length": 34, diff --git a/defs/coins/zcoin_testnet.json b/defs/coins/zcoin_testnet.json index 1f5465fc5..716fba60a 100644 --- a/defs/coins/zcoin_testnet.json +++ b/defs/coins/zcoin_testnet.json @@ -29,7 +29,7 @@ "High": 200 }, "dust_limit": 546, - "blocktime_minutes": 10, + "blocktime_seconds": 600, "address_prefix": "testzcoin:", "min_address_length": 27, "max_address_length": 35,