diff --git a/README.md b/README.md index cb9cb46c..f61598a1 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ Supported BIP coins: - Cosmos - Dash (and related test net) - Dogecoin (and related test net) +- dYdX - eCash (and related test net) - Elrond (MultiversX) - EOS diff --git a/bip_utils/bip/conf/bip44/bip44_coins.py b/bip_utils/bip/conf/bip44/bip44_coins.py index 39f94460..b34b5d8c 100644 --- a/bip_utils/bip/conf/bip44/bip44_coins.py +++ b/bip_utils/bip/conf/bip44/bip44_coins.py @@ -55,6 +55,7 @@ class Bip44Coins(BipCoins): COSMOS = auto() DASH = auto() DOGECOIN = auto() + DYDX = auto() ECASH = auto() ELROND = auto() EOS = auto() diff --git a/bip_utils/bip/conf/bip44/bip44_conf.py b/bip_utils/bip/conf/bip44/bip44_conf.py index a2df7cd4..4f6a7636 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf.py +++ b/bip_utils/bip/conf/bip44/bip44_conf.py @@ -520,6 +520,21 @@ class Bip44Conf: }, ) + # Configuration for dYdX + DYDX: BipCoinConf = BipCoinConf( + coin_names=CoinsConf.DYDX.CoinNames(), + coin_idx=Slip44.ATOM, + is_testnet=False, + def_path=DER_PATH_NON_HARDENED_FULL, + key_net_ver=_BIP44_BTC_KEY_NET_VER_MAIN, + wif_net_ver=None, + bip32_cls=Bip32Slip10Secp256k1, + addr_cls=AtomAddrEncoder, + addr_params={ + "hrp": CoinsConf.DYDX.ParamByKey("addr_hrp"), + }, + ) + # Configuration for eCash main net EcashMainNet: BipBitcoinCashConf = BipBitcoinCashConf( coin_names=CoinsConf.EcashMainNet.CoinNames(), diff --git a/bip_utils/bip/conf/bip44/bip44_conf_getter.py b/bip_utils/bip/conf/bip44/bip44_conf_getter.py index 868e789c..d80a3963 100644 --- a/bip_utils/bip/conf/bip44/bip44_conf_getter.py +++ b/bip_utils/bip/conf/bip44/bip44_conf_getter.py @@ -64,6 +64,7 @@ class Bip44ConfGetterConst: Bip44Coins.DASH_TESTNET: Bip44Conf.DashTestNet, Bip44Coins.DOGECOIN: Bip44Conf.DogecoinMainNet, Bip44Coins.DOGECOIN_TESTNET: Bip44Conf.DogecoinTestNet, + Bip44Coins.DYDX: Bip44Conf.DYDX, Bip44Coins.ECASH: Bip44Conf.EcashMainNet, Bip44Coins.ECASH_TESTNET: Bip44Conf.EcashTestNet, Bip44Coins.ELROND: Bip44Conf.Elrond, diff --git a/bip_utils/coin_conf/coins_conf.py b/bip_utils/coin_conf/coins_conf.py index 421e0a6d..e0ea1e76 100644 --- a/bip_utils/coin_conf/coins_conf.py +++ b/bip_utils/coin_conf/coins_conf.py @@ -376,6 +376,14 @@ class CoinsConf: }, ) + # Configuration for dYdX + DYDX: CoinConf = CoinConf( + coin_name=CoinNames("dYdX", "DYDX"), + params={ + "addr_hrp": Slip173.DYDX, + }, + ) + # Configuration for eCash main net EcashMainNet: CoinConf = CoinConf( coin_name=CoinNames("eCash", "XEC"), diff --git a/bip_utils/slip/slip173/slip173.py b/bip_utils/slip/slip173/slip173.py index d937b4bb..8dcda7dd 100644 --- a/bip_utils/slip/slip173/slip173.py +++ b/bip_utils/slip/slip173/slip173.py @@ -42,6 +42,7 @@ class Slip173: CHIHUAHUA: str = "chihuahua" CELESTIA: str = "celestia" COSMOS: str = "cosmos" + DYDX: str = "dydx" ELROND: str = "erd" FETCH_AI: str = "fetch" HARMONY_ONE: str = "one" diff --git a/keywords.txt b/keywords.txt index 7f8f536e..496a77b8 100644 --- a/keywords.txt +++ b/keywords.txt @@ -58,6 +58,7 @@ certik cosmos dash dogecoin +dydx ecash elrond eos diff --git a/readme/bip44.md b/readme/bip44.md index 7e1c79d8..891fd29a 100644 --- a/readme/bip44.md +++ b/readme/bip44.md @@ -40,6 +40,7 @@ Supported coins enumerative for BIP-0044: |Cosmos|`Bip44Coins.COSMOS`|-| |Dash|`Bip44Coins.DASH`|`Bip44Coins.DASH_TESTNET`| |Dogecoin|`Bip44Coins.DOGECOIN`|`Bip44Coins.DOGECOIN_TESTNET`| +|dYdX|`Bip44Coins.DYDX`|-| |eCash|`Bip44Coins.ECASH`|`Bip44Coins.ECASH_TESTNET`| |Elrond (MultiversX)|`Bip44Coins.ELROND` or `Bip44Coins.MULTIVERSX`|-| |EOS|`Bip44Coins.EOS`|-| diff --git a/tests/bip/bip44/test_bip44.py b/tests/bip/bip44/test_bip44.py index c02e8692..a2e86994 100644 --- a/tests/bip/bip44/test_bip44.py +++ b/tests/bip/bip44/test_bip44.py @@ -629,6 +629,30 @@ "DTdrvUHbk5oMyi62tM7LqrjAcXfqB7eaad", ], }, + # dYdX + { + "coin": Bip44Coins.DYDX, + "names": ("dYdX", "DYDX"), + "is_testnet": False, + "seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4", + "ex_master": "xprv9s21ZrQH143K3GJpoapnV8SFfukcVBSfeCficPSGfubmSFDxo1kuHnLisriDvSnRRuL2Qrg5ggqHKNVpxR86QEC8w35uxmGoggxtQTPvfUu", + "wif_master": "", + "account": { + "ex_pub": "xpub6DGzViq8bmgMLYdVZ3xnLVEdKwzBnGdzzJZ4suG8kVb9TTLAbrwv8YdKBb8FWKdBNinaHKmBv7JpQvqBYx4rxch7WnHzNFzSVrMf8hQepTP", + "ex_priv": "xprv9zHe6DJEmQ8484Z2T2RmyMHtmv9hNov9d5dU5WrXCA4Aaf124KdfakJqLGnVYwvBvMP4ttqm7QL5vuPTepiJiEJREiJnhswKmj6zLttwCMu", + }, + "chain_ext": { + "ex_pub": "xpub6EbeQ8h8S7mEGxYTn34gKedwvsmytMW61v51RAc8e6VzgMMLFkkNMN6sYtqvtZQ8TjBKswbxUTzxzj3nZfwr4pzFB7rySMaBUUCJnCuxu33", + "ex_priv": "xprvA1cHzdAEbkCw4UTzg1XfxWhDNqwVUtnEeh9QcnCX5ky1oZ2BiDS7oZnPhdgFNqWwGtB3BNebior1tS26wAtbQzCTe5Pty1BhkcwT8QfWQSP", + }, + "addresses": [ + "dydx19rl4cm2hmr8afy4kldpxz3fka4jguq0a4erelz", + "dydx1jrkmdcwgq94uaamx6zax2luewlhf7u4k4pg4k4", + "dydx1kng7tv83qesgvv2ze7hxlw4urfrjk8vqf20ydu", + "dydx1zuvk68xw4y9swp06796rx8zarjvvkrt6xraztg", + "dydx12ecyuddg4wlnhztusgju5zxxjgznkz7fes66kh", + ], + }, # eCash { "coin": Bip44Coins.ECASH, @@ -2411,6 +2435,12 @@ "seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4", "default_address": "DBus3bamQjgJULBJtYXpEzDWQRwF5iwxgC", }, + # dYdX + { + "coin": Bip44Coins.DYDX, + "seed": b"5eb00bbddcf069084889a8ab9155568165f5c453ccb85e70811aaed6f6da5fc19a5ac40b389cd370d086206dec8aa6c43daea6690f20ad3d8d48b2d2ce9e38e4", + "default_address": "dydx19rl4cm2hmr8afy4kldpxz3fka4jguq0a4erelz", + }, # eCash { "coin": Bip44Coins.ECASH,