diff --git a/.gitignore b/.gitignore index 3c1a6c2..5d8f3a2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,11 @@ make.bat Makefile # Folders stuff +env/ experiment/ .idea/ .tox/ +.vs/ # Setuptools stuff build/ diff --git a/hdwallet/cryptocurrencies.py b/hdwallet/cryptocurrencies.py index ef24396..f36584d 100644 --- a/hdwallet/cryptocurrencies.py +++ b/hdwallet/cryptocurrencies.py @@ -354,6 +354,45 @@ class AuroracoinMainnet(Cryptocurrency): WIF_SECRET_KEY = 0x97 +class AviancoinMainnet(Cryptocurrency): + NAME = "Aviancoin" + SYMBOL = "AVN" + NETWORK = "mainnet" + SOURCE_CODE = "https://github.com/AvianNetwork/Avian" + COIN_TYPE = CoinType({ + "INDEX": 921, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x7a + PUBLIC_KEY_ADDRESS = 0x3c + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "av", + "VERSION": 0x0d + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x488ade4, + "P2SH": 0x488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x488b21e, + "P2SH": 0x488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = "Aviancoin Signed Message:\n" + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + class AxeMainnet(Cryptocurrency): NAME = "Axe" @@ -2154,6 +2193,86 @@ class EuropeCoinMainnet(Cryptocurrency): WIF_SECRET_KEY = 0xa8 +class EvrmoreMainnet(Cryptocurrency): + + NAME = "Evrmore" + SYMBOL = "EVR" + NETWORK = "mainnet" + SOURCE_CODE = "https://github.com/EvrmoreOrg/Evrmore" + COIN_TYPE = CoinType({ + "INDEX": 175, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x5c + PUBLIC_KEY_ADDRESS = 0x21 + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "ev", + "VERSION": 0x0b + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x488ade4, + "P2SH": 0x488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x488b21e, + "P2SH": 0x488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = "Evrmore Signed Message:\n" + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + +class EvrmoreTestnet(Cryptocurrency): + + NAME = "Evrmore" + SYMBOL = "EVRTEST" + NETWORK = "testnet" + SOURCE_CODE = "https://github.com/EvrmoreOrg/Evrmore" + COIN_TYPE = CoinType({ + "INDEX": 1, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0xc4 + PUBLIC_KEY_ADDRESS = 0x6f + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "te", + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x488ade4, + "P2SH": 0x488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x488b21e, + "P2SH": 0x488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = "Evrmore Signed Message:\n" + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0xef + + class ExclusiveCoinMainnet(Cryptocurrency): NAME = "Exclusive Coin" @@ -2431,6 +2550,87 @@ class FluxMainnet(Cryptocurrency): DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" WIF_SECRET_KEY = 0x80 + +class FoxdcoinMainnet(Cryptocurrency): + + NAME = "Foxdcoin" + SYMBOL = "FOXD" + NETWORK = "mainnet" + SOURCE_CODE = "https://github.com/foxdproject/foxdcoin" + COIN_TYPE = CoinType({ + "INDEX": 175, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x1e + PUBLIC_KEY_ADDRESS = 0x23 + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "fx", + "VERSION": 0x0d + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x488ade4, + "P2SH": 0x488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x488b21e, + "P2SH": 0x488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = "Foxdcoin Signed Message:\n" + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0x80 + + +class FoxdcoinTestnet(Cryptocurrency): + + NAME = "Foxdcoin" + SYMBOL = "FOXDTEST" + NETWORK = "testnet" + SOURCE_CODE = "https://github.com/foxdproject/foxdcoin" + COIN_TYPE = CoinType({ + "INDEX": 1, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0x5a + PUBLIC_KEY_ADDRESS = 0x5f + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "tf", + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x488ade4, + "P2SH": 0x488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x488b21e, + "P2SH": 0x488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + MESSAGE_PREFIX = "Foxdcoin Signed Message:\n" + DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" + WIF_SECRET_KEY = 0xef + + class FujiCoinMainnet(Cryptocurrency): NAME = "Fuji Coin" @@ -4836,7 +5036,7 @@ class RavencoinMainnet(Cryptocurrency): NAME = "Ravencoin" SYMBOL = "RVN" NETWORK = "mainnet" - SOURCE_CODE = None + SOURCE_CODE = "https://github.com/RavenProject/Ravencoin" COIN_TYPE = CoinType({ "INDEX": 175, "HARDENED": True @@ -4845,32 +5045,68 @@ class RavencoinMainnet(Cryptocurrency): SCRIPT_ADDRESS = 0x7a PUBLIC_KEY_ADDRESS = 0x3c SEGWIT_ADDRESS = SegwitAddress({ - "HRP": None, - "VERSION": 0x00 + "HRP": "ra", + "VERSION": 0x0c }) EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ "P2PKH": 0x488ade4, "P2SH": 0x488ade4, - "P2WPKH": None, - "P2WPKH_IN_P2SH": None, - "P2WSH": None, - "P2WSH_IN_P2SH": None + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 }) EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ "P2PKH": 0x488b21e, "P2SH": 0x488b21e, - "P2WPKH": None, - "P2WPKH_IN_P2SH": None, - "P2WSH": None, - "P2WSH_IN_P2SH": None + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f }) - MESSAGE_PREFIX = "Raven Signed Message:\n" + MESSAGE_PREFIX = "Raven Signed Message:\n" DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0" WIF_SECRET_KEY = 0x80 +class RavencoinTestnet(Cryptocurrency): + + NAME = "Ravencoin" + SYMBOL = "RVNTEST" + NETWORK = "testnet" + SOURCE_CODE = "https://github.com/RavenProject/Ravencoin" + COIN_TYPE = CoinType({ + "INDEX": 1, + "HARDENED": True + }) + + SCRIPT_ADDRESS = 0xc4 + PUBLIC_KEY_ADDRESS = 0x6f + SEGWIT_ADDRESS = SegwitAddress({ + "HRP": "tr", + "VERSION": 0x00 + }) + + EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({ + "P2PKH": 0x488ade4, + "P2SH": 0x488ade4, + "P2WPKH": 0x04b2430c, + "P2WPKH_IN_P2SH": 0x049d7878, + "P2WSH": 0x02aa7a99, + "P2WSH_IN_P2SH": 0x0295b005 + }) + EXTENDED_PUBLIC_KEY = ExtendedPublicKey({ + "P2PKH": 0x488b21e, + "P2SH": 0x488b21e, + "P2WPKH": 0x04b24746, + "P2WPKH_IN_P2SH": 0x049d7cb2, + "P2WSH": 0x02aa7ed3, + "P2WSH_IN_P2SH": 0x0295b43f + }) + + class ReddcoinMainnet(Cryptocurrency): NAME = "Reddcoin" diff --git a/hdwallet/hdwallet.py b/hdwallet/hdwallet.py index 1592fb8..a66ac84 100644 --- a/hdwallet/hdwallet.py +++ b/hdwallet/hdwallet.py @@ -1196,9 +1196,10 @@ def p2wpkh_address(self) -> Optional[str]: compressed_public_key = unhexlify(self.compressed()) public_key_hash = ripemd160(sha256(compressed_public_key).digest()) - if self._cryptocurrency.SEGWIT_ADDRESS.HRP is None: + segwit = self._cryptocurrency.SEGWIT_ADDRESS + if segwit.HRP is None: return None - return ensure_string(encode(self._cryptocurrency.SEGWIT_ADDRESS.HRP, 0, public_key_hash)) + return ensure_string(encode(segwit.HRP, segwit.VERSION, public_key_hash)) def p2wpkh_in_p2sh_address(self) -> Optional[str]: """ @@ -1240,9 +1241,10 @@ def p2wsh_address(self) -> Optional[str]: compressed_public_key = unhexlify("5121" + self.compressed() + "51ae") script_hash = sha256(compressed_public_key).digest() - if self._cryptocurrency.SEGWIT_ADDRESS.HRP is None: + segwit = self._cryptocurrency.SEGWIT_ADDRESS + if segwit.HRP is None: return None - return ensure_string(encode(self._cryptocurrency.SEGWIT_ADDRESS.HRP, 0, script_hash)) + return ensure_string(encode(segwit.HRP, segwit.VERSION, script_hash)) def p2wsh_in_p2sh_address(self) -> Optional[str]: """ diff --git a/hdwallet/symbols.py b/hdwallet/symbols.py index 531f6ea..e78d379 100644 --- a/hdwallet/symbols.py +++ b/hdwallet/symbols.py @@ -14,6 +14,8 @@ ATOM = "ATOM" # Auroracoin AUR = "AUR" +# Aviancoin +AVN = "AVN" # Axe AXE = "AXE" # Bata @@ -96,6 +98,8 @@ ETH = "ETH" # Europe Coin ERC = "ERC" +# Evrmore +EVR, EVRTEST = "EVR", "EVRTEST" # Exclusive Coin EXCL = "EXCL" # FIX @@ -108,6 +112,8 @@ FLASH = "FLASH" # Flux FLUX = "FLUX" +# Foxdcoin +FOXD, FOXDTEST = "FOXD", "FOXDTEST" # Fuji Coin FJC = "FJC" # GCR Coin @@ -217,7 +223,7 @@ # Rapids RPD = "RPD" # Ravencoin -RVN = "RVN" +RVN, RVNTEST = "RVN", "RVNTEST" # Reddcoin RDD = "RDD" # Rubycoin @@ -296,6 +302,7 @@ "AC", "ATOM", "AUR", + "AVN", "AXE", "BTA", "BEET", @@ -337,12 +344,14 @@ "NRG", "ETH", "ERC", + "EVR", "EVRTEST", "EXCL", "FIX", "FIXTEST", "FLUX", "FTC", "FRST", "FLASH", + "FOXD", "FOXDTEST", "FJC", "GCR", "GAME", @@ -397,7 +406,7 @@ "QTUM", "QTUMTEST", "RBTC", "RBTCTEST", "RPD", - "RVN", + "RVN", "RVNTEST", "RDD", "RBY", "SAFE",