Skip to content

Commit 31da61f

Browse files
committed
Add: new dYdX cryptocurrency
1 parent 8c7bdcc commit 31da61f

File tree

8 files changed

+81
-3
lines changed

8 files changed

+81
-3
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,7 @@ This library simplifies the process of creating a new Hierarchical Deterministic
339339
| [Digitalcoin](https://github.com/lomtax/digitalcoin) | DGC | 18 | `mainnet` | SLIP10-Secp256k1 | `BIP44`, `BIP32` | :white_check_mark: | `P2PKH`, `P2SH` |
340340
| [Divi](https://github.com/Divicoin/Divi) | DIVI | 301 | `mainnet`, `testnet` | SLIP10-Secp256k1 | `BIP44`, `BIP32` | :white_check_mark: | `P2PKH`, `P2SH` |
341341
| [Dogecoin](https://github.com/dogecoin/dogecoin) | DOGE | 3 | `mainnet`, `testnet` | SLIP10-Secp256k1 | `BIP44`, `BIP32` | :white_check_mark: | `P2PKH`, `P2SH`, `P2WPKH`, `P2WPKH-In-P2SH` |
342+
| [dYdX](https://github.com/dydxprotocol) | DYDX | 22000118 | `mainnet` | SLIP10-Secp256k1 | `BIP44`, `BIP32` | :x: | `Cosmos` |
342343
| [eCash](https://github.com/bitcoin-abc) | XEC | 145 | `mainnet`, `testnet` | SLIP10-Secp256k1 | `BIP44`, `BIP32` | :x: | `P2PKH`, `P2SH`, `P2WPKH`, `P2WPKH-In-P2SH`, `P2WSH`, `P2WSH-In-P2SH` |
343344
| [E-coin](https://github.com/ecoinclub/ecoin) | ECN | 115 | `mainnet` | SLIP10-Secp256k1 | `BIP44`, `BIP32` | :white_check_mark: | `P2PKH`, `P2SH` |
344345
| [EDR-Coin](https://github.com/EDRCoin/EDRcoin-src) | EDRC | 56 | `mainnet` | SLIP10-Secp256k1 | `BIP44`, `BIP32` | :white_check_mark: | `P2PKH`, `P2SH` |

docs/cryptocurrencies.rst

+8
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,14 @@ This library simplifies the process of generating a new HDWallet's for:
490490
- ``BIP44`` ``BIP32``
491491
- ✅
492492
- ``P2PKH`` ``P2SH`` ``P2WPKH`` ``P2WPKH-In-P2SH``
493+
* - `dYdX <https://github.com/dydxprotocol>`_
494+
- DYDX
495+
- 22000118
496+
- ``mainnet``
497+
- SLIP10-Secp256k1
498+
- ``BIP44`` ``BIP32``
499+
- ❌
500+
- ``Cosmos``
493501
* - `eCash <https://github.com/bitcoin-abc>`_
494502
- XEC
495503
- 145

hdwallet/cryptocurrencies/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
from .digitalcoin import Digitalcoin
7171
from .divi import Divi
7272
from .dogecoin import Dogecoin
73+
from .dydx import dYdX
7374
from .ecash import eCash
7475
from .ecoin import ECoin
7576
from .edrcoin import EDRCoin
@@ -284,6 +285,7 @@ class CRYPTOCURRENCIES:
284285
Digitalcoin.NAME: Digitalcoin,
285286
Divi.NAME: Divi,
286287
Dogecoin.NAME: Dogecoin,
288+
dYdX.NAME: dYdX,
287289
eCash.NAME: eCash,
288290
ECoin.NAME: ECoin,
289291
EDRCoin.NAME: EDRCoin,

hdwallet/cryptocurrencies/dydx.py

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/usr/bin/env python3
2+
3+
# Copyright © 2020-2025, Meheret Tesfaye Batu <meherett.batu@gmail.com>
4+
# Distributed under the MIT software license, see the accompanying
5+
# file COPYING or https://opensource.org/license/mit
6+
7+
from hdwallet.slip44 import CoinTypes
8+
from hdwallet.ecc import SLIP10Secp256k1ECC
9+
from hdwallet.const import (
10+
Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions
11+
)
12+
from hdwallet.cryptocurrencies.icryptocurrency import (
13+
ICryptocurrency, INetwork
14+
)
15+
16+
17+
class Mainnet(INetwork):
18+
19+
HRP = "dydx"
20+
XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({
21+
"P2PKH": 0x488ade4
22+
})
23+
XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({
24+
"P2PKH": 0x488b21e
25+
})
26+
WIF_PREFIX = 0x80
27+
28+
29+
class dYdX(ICryptocurrency):
30+
31+
NAME = "dYdX"
32+
SYMBOL = "DYDX"
33+
INFO = Info({
34+
"SOURCE_CODE": "https://github.com/dydxprotocol",
35+
"WEBSITES": [
36+
"https://dydx.exchange"
37+
]
38+
})
39+
ECC = SLIP10Secp256k1ECC
40+
COIN_TYPE = CoinTypes.dYdX
41+
NETWORKS = Networks({
42+
"MAINNET": Mainnet
43+
})
44+
DEFAULT_NETWORK = NETWORKS.MAINNET
45+
ENTROPIES = Entropies({
46+
"BIP39"
47+
})
48+
MNEMONICS = Mnemonics({
49+
"BIP39"
50+
})
51+
SEEDS = Seeds({
52+
"BIP39"
53+
})
54+
HDS = HDs({
55+
"BIP32", "BIP44"
56+
})
57+
DEFAULT_HD = HDS.BIP44
58+
ADDRESSES = Addresses({
59+
"COSMOS": "Cosmos"
60+
})
61+
DEFAULT_ADDRESS = ADDRESSES.COSMOS

hdwallet/slip44.py

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ class CoinTypes: # https://github.com/satoshilabs/slips/blob/master/slip-0044.m
6666
Digitalcoin: int = 18
6767
Divi: int = 301
6868
Dogecoin: int = 3
69+
dYdX: int = 22000118
6970
eCash: int = 145 # Bitcoin-Cash
7071
ECoin: int = 115
7172
EDRCoin: int = 56

hdwallet/symbols.py

+3
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@
124124
DIVI: str = "DIVI"
125125
# Dogecoin
126126
DOGE: str = "DOGE"
127+
# dYdX
128+
DYDX: str = "DYDX"
127129
# eCash
128130
XEC: str = "XEC"
129131
# E-coin
@@ -483,6 +485,7 @@
483485
"DGC",
484486
"DIVI",
485487
"DOGE",
488+
"DYDX",
486489
"XEC",
487490
"ECN",
488491
"EDRC",

tests/data/raw/cryptocurrencies.txt

+4-3
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ Digi-Byte DGB 20 mainnet SLIP
5959
Digitalcoin DGC 18 mainnet SLIP10-Secp256k1
6060
Divi DIVI 301 mainnet, testnet SLIP10-Secp256k1
6161
Dogecoin DOGE 3 mainnet, testnet SLIP10-Secp256k1
62+
dYdX DYDX 22000118 mainnet SLIP10-Secp256k1
6263
eCash XEC 145 mainnet, testnet SLIP10-Secp256k1
63-
E-coin ECN 115 mainnet SLIP10-Secp256k1
64+
E-Coin ECN 115 mainnet SLIP10-Secp256k1
6465
EDR-Coin EDRC 56 mainnet SLIP10-Secp256k1
6566
e-Gulden EFL 78 mainnet SLIP10-Secp256k1
6667
Einsteinium EMC2 41 mainnet SLIP10-Secp256k1
@@ -142,7 +143,7 @@ Omni OMNI 200 mainnet, testnet SLIP
142143
Onix ONX 174 mainnet SLIP10-Secp256k1
143144
Ontology ONT 1024 mainnet SLIP10-Nist256p1
144145
Optimism OP 60 mainnet SLIP10-Secp256k1
145-
Osmosis OSMO 118 mainnet SLIP10-Secp256k1
146+
Osmosis OSMO 10000118 mainnet SLIP10-Secp256k1
146147
Particl PART 44 mainnet SLIP10-Secp256k1
147148
Peercoin PPC 6 mainnet SLIP10-Secp256k1
148149
Pesobit PSB 62 mainnet SLIP10-Secp256k1
@@ -207,4 +208,4 @@ Zcash ZEC 133 mainnet, testnet SLIP
207208
ZClassic ZCL 147 mainnet SLIP10-Secp256k1
208209
Zetacoin ZET 719 mainnet SLIP10-Secp256k1
209210
Zilliqa ZIL 313 mainnet SLIP10-Secp256k1
210-
ZooBC ZBC 883 mainnet SLIP10-Secp256k1
211+
ZooBC ZBC 883 mainnet SLIP10-Secp256k1

tests/test_symbols.py

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ def test_symbols():
6969
assert DGC == "DGC"
7070
assert DIVI == "DIVI"
7171
assert DOGE == "DOGE"
72+
assert DYDX == "DYDX"
7273
assert XEC == "XEC"
7374
assert ECN == "ECN"
7475
assert EDRC == "EDRC"

0 commit comments

Comments
 (0)