1from pycoin.coins.groestlcoin.hash import groestlHash 2from pycoin.coins.groestlcoin.parse import GRSParseAPI 3from pycoin.coins.groestlcoin.Block import Block as GrsBlock 4from pycoin.coins.groestlcoin.Tx import Tx as GrsTx 5from pycoin.encoding.b58 import b2a_base58 6from pycoin.encoding.hexbytes import h2b 7from pycoin.networks.bitcoinish import create_bitcoinish_network 8 9 10network = create_bitcoinish_network( 11 symbol="GRS", network_name="Groestlcoin", subnet_name="mainnet", tx=GrsTx, block=GrsBlock, 12 wif_prefix_hex="80", sec_prefix="GRSSEC:", address_prefix_hex="24", pay_to_script_prefix_hex="05", 13 bip32_prv_prefix_hex="0488ade4", bip32_pub_prefix_hex="0488B21E", bech32_hrp="grs", 14 magic_header_hex="F9BEB4D9", default_port=1331, 15 parse_api_class=GRSParseAPI, 16 dns_bootstrap=[ 17 "groestlcoin.org", "electrum1.groestlcoin.org", "electrum2.groestlcoin.org", 18 "jswallet.groestlcoin.org", "groestlsight.groestlcoin.org" 19 ] 20) 21 22# monkey patches 23_wif_prefix = h2b("80") 24_bip32_prv_prefix = h2b("0488ade4") 25_bip32_pub_prefix = h2b("0488B21E") 26 27 28def b2a_hashed_base58_grs(data): 29 return b2a_base58(data + groestlHash(data)[:4]) 30 31 32def bip32_as_string(blob, as_private): 33 prefix = _bip32_prv_prefix if as_private else _bip32_pub_prefix 34 return b2a_hashed_base58_grs(prefix + blob) 35 36 37def wif_for_blob(blob): 38 return b2a_hashed_base58_grs(_wif_prefix + blob) 39 40 41network.address.b2a = b2a_hashed_base58_grs 42network.bip32_as_string = bip32_as_string 43network.wif_for_blob = wif_for_blob 44 45# Cause parsing to fail and tests to skip. 46try: 47 import groestlcoin_hash # noqa 48except ImportError: 49 network.Key = None 50 51 def none_parser(*args, **kwargs): 52 return None 53 54 for attr in "hierarchical_key private_key public_key address".split(): 55 setattr(network.parse, attr, none_parser) 56