Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ This library simplifies the process of creating a new HDWallet's for:
| XUEZ | `XUEZ` | Yes | No | No | 225 | `m/44'/225'/0'/0/0` |
| [XinFin](https://github.com/XinFinOrg/XDPoSChain) | `XDC` | Yes | No | Yes | 550 | `m/44'/550'/0'/0/0` |
| ZClassic | `ZCL` | Yes | No | No | 147 | `m/44'/147'/0'/0/0` |
| Zcash | `ZEC` | Yes | No | No | 133 | `m/44'/133'/0'/0/0` |
| [Zcash](https://github.com/zcash/zcash) | `ZEC`, `ZECTEST` | Yes | Yes | No | 133 | `m/44'/133'/0'/0/0` |
| Zencash | `ZEN` | Yes | No | No | 121 | `m/44'/121'/0'/0/0` |

## Donations
Expand Down
80 changes: 60 additions & 20 deletions hdwallet/cryptocurrencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -3213,18 +3213,18 @@ class LitecoinMainnet(Cryptocurrency):
})

EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({
"P2PKH": 0x019d9cfe,
"P2SH": 0x019d9cfe,
"P2WPKH": 0x04b2430c,
"P2WPKH_IN_P2SH": 0x01b26792,
"P2PKH": 0x488ade4,
"P2SH": 0x488ade4,
"P2WPKH": None,
"P2WPKH_IN_P2SH": None,
"P2WSH": None,
"P2WSH_IN_P2SH": None
})
EXTENDED_PUBLIC_KEY = ExtendedPublicKey({
"P2PKH": 0x019da462,
"P2SH": 0x019da462,
"P2WPKH": 0x04b24746,
"P2WPKH_IN_P2SH": 0x01b26ef6,
"P2PKH": 0x488b21e,
"P2SH": 0x488b21e,
Comment on lines +3216 to +3225
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works in both P2PKH and P2SH but the standard of Litecoin EPrivateKey is 0x019d9cfe and EPublicKey is 0x019da462.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use this on LitecoinMainnet

    EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({
        "P2PKH": 0x019d9cfe,  # 0x488ade4
        "P2SH": 0x019d9cfe,  # 0x488ade4
        "P2WPKH": None,
        "P2WPKH_IN_P2SH": None,
        "P2WSH": None,
        "P2WSH_IN_P2SH": None
    })
    EXTENDED_PUBLIC_KEY = ExtendedPublicKey({
        "P2PKH": 0x019da462,  # 0x488b21e
        "P2SH": 0x019da462,  # 0x488b21e
        "P2WPKH": None,
        "P2WPKH_IN_P2SH": None,
        "P2WSH": None,
        "P2WSH_IN_P2SH": None
    })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, Maybe I will include option to access both extends keys next time. Good Job :)

"P2WPKH": None,
"P2WPKH_IN_P2SH": None,
"P2WSH": None,
"P2WSH_IN_P2SH": None
})
Expand All @@ -3245,33 +3245,33 @@ class LitecoinTestnet(Cryptocurrency):
"HARDENED": True
})

SCRIPT_ADDRESS = 0xc4
SCRIPT_ADDRESS = 0x3a
PUBLIC_KEY_ADDRESS = 0x6f
SEGWIT_ADDRESS = SegwitAddress({
"HRP": "litecointestnet",
"HRP": "tltc",
"VERSION": 0x00
})

EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({
"P2PKH": 0x0436ef7d,
"P2SH": 0x0436ef7d,
"P2WPKH": 0x04358394,
"P2WPKH_IN_P2SH": 0x04358394,
"P2PKH": 0x04358394,
"P2SH": 0x04358394,
"P2WPKH": None,
"P2WPKH_IN_P2SH": None,
"P2WSH": None,
"P2WSH_IN_P2SH": None
})
EXTENDED_PUBLIC_KEY = ExtendedPublicKey({
"P2PKH": 0x0436f6e1,
"P2SH": 0x0436f6e1,
"P2WPKH": 0x043587cf,
"P2WPKH_IN_P2SH": 0x043587cf,
"P2PKH": 0x043587cf,
"P2SH": 0x043587cf,
"P2WPKH": None,
"P2WPKH_IN_P2SH": None,
"P2WSH": None,
"P2WSH_IN_P2SH": None
})

MESSAGE_PREFIX = "\x19Litecoin Signed Message:\n"
DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0"
WIF_SECRET_KEY = 0xb0
WIF_SECRET_KEY = 0xef


class LitecoinZMainnet(Cryptocurrency):
Expand Down Expand Up @@ -6239,7 +6239,7 @@ class ZcashMainnet(Cryptocurrency):
NAME = "Zcash"
SYMBOL = "ZEC"
NETWORK = "mainnet"
SOURCE_CODE = None
SOURCE_CODE = "https://github.com/zcash/zcash"
COIN_TYPE = CoinType({
"INDEX": 133,
"HARDENED": True
Expand Down Expand Up @@ -6274,6 +6274,46 @@ class ZcashMainnet(Cryptocurrency):
WIF_SECRET_KEY = 0x80


class ZcashTestnet(Cryptocurrency):

NAME = "Zcash"
SYMBOL = "ZECTEST"
NETWORK = "testnet"
SOURCE_CODE = "https://github.com/zcash/zcash"
COIN_TYPE = CoinType({
"INDEX": 1,
"HARDENED": True
})

SCRIPT_ADDRESS = 0x1cba
PUBLIC_KEY_ADDRESS = 0x1d25
SEGWIT_ADDRESS = SegwitAddress({
"HRP": None,
"VERSION": 0x00
})

EXTENDED_PRIVATE_KEY = ExtendedPrivateKey({
"P2PKH": 0x4358394,
"P2SH": 0x4358394,
"P2WPKH": None,
"P2WPKH_IN_P2SH": None,
"P2WSH": None,
"P2WSH_IN_P2SH": None
})
EXTENDED_PUBLIC_KEY = ExtendedPublicKey({
"P2PKH": 0x43587cf,
"P2SH": 0x43587cf,
"P2WPKH": None,
"P2WPKH_IN_P2SH": None,
"P2WSH": None,
"P2WSH_IN_P2SH": None
})

MASSAGE_PREFIX = "\x18Zcash Signed Message:\n"
DEFAULT_PATH = f"m/44'/{str(COIN_TYPE)}/0'/0/0"
WIF_SECRET_KEY = 0xef


class ZencashMainnet(Cryptocurrency):

NAME = "Zencash"
Expand Down
4 changes: 2 additions & 2 deletions hdwallet/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@
# ZClassic
ZCL = "ZCL"
# Zcash
ZEC = "ZEC"
ZEC, ZECTEST = "ZEC", "ZECTEST"
# Zencash
ZEN = "ZEN"

Expand Down Expand Up @@ -418,6 +418,6 @@
"XUEZ",
"XDC",
"ZCL",
"ZEC",
"ZEC", "ZECTEST"
"ZEN"
]