├── .coveragerc ├── .github └── workflows │ └── build.yml ├── .gitignore ├── .readthedocs.yaml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE ├── MANIFEST.in ├── Makefile ├── README.md ├── clients ├── algorand.py ├── atomic_wallet.py ├── bip141.py ├── bip32.py ├── bip44.py ├── bip49.py ├── bip84.py ├── bip86.py ├── brave_legacy.py ├── cardano │ ├── byron_icarus.py │ ├── byron_ledger.py │ ├── byron_legacy.py │ ├── shelley_icarus.py │ └── shelley_ledger.py ├── electrum │ ├── v1.py │ └── v2 │ │ ├── segwit.py │ │ ├── segwit_2fa.py │ │ ├── standard.py │ │ └── standard_2fa.py ├── exodus_wallet.py ├── ledger_live.py ├── metamask.py ├── monero.py ├── phantom.py └── solana_cli.py ├── docs ├── addresses.rst ├── cli.rst ├── conf.py ├── const.rst ├── crypto.rst ├── cryptocurrencies.rst ├── derivations.rst ├── ecc.rst ├── entropies.rst ├── hds.rst ├── hdwallet.rst ├── index.rst ├── install.rst ├── mnemonics.rst ├── seeds.rst ├── sphinx_ext.py ├── static │ ├── css │ │ └── hdwallet.css │ ├── hdwallet.pdf │ └── svg │ │ ├── desktop-badge.svg │ │ ├── hdwallet-cli.svg │ │ ├── hdwallet-logo.svg │ │ └── online-badge.svg ├── toctree.rst ├── tools │ ├── generate_md_crypto_table.py │ └── generate_rst_crypto_table.py └── utils.rst ├── examples ├── BIPs │ ├── from_entropy.py │ ├── from_mnemonic.py │ ├── from_private_key.py │ ├── from_public_key.py │ ├── from_seed.py │ ├── from_wif.py │ ├── from_xprivate_key.py │ └── from_xpublic_key.py ├── README.md ├── cardano │ ├── from_entropy.py │ ├── from_mnemonic.py │ ├── from_private_key.py │ ├── from_public_key.py │ ├── from_seed.py │ ├── from_xprivate_key.py │ └── from_xpublic_key.py ├── electrum │ ├── v1 │ │ ├── from_entropy.py │ │ ├── from_mnemonic.py │ │ ├── from_private_key.py │ │ ├── from_public_key.py │ │ ├── from_seed.py │ │ └── from_wif.py │ └── v2 │ │ ├── from_entropy.py │ │ ├── from_mnemonic.py │ │ └── from_seed.py └── monero │ ├── from_entropy.py │ ├── from_mnemnoic.py │ ├── from_private_key.py │ ├── from_seed.py │ ├── from_spend_private_key.py │ └── from_watch_only.py ├── hdwallet ├── __init__.py ├── addresses │ ├── __init__.py │ ├── algorand.py │ ├── aptos.py │ ├── avalanche.py │ ├── cardano.py │ ├── cosmos.py │ ├── eos.py │ ├── ergo.py │ ├── ethereum.py │ ├── filecoin.py │ ├── harmony.py │ ├── iaddress.py │ ├── icon.py │ ├── injective.py │ ├── monero.py │ ├── multiversx.py │ ├── nano.py │ ├── near.py │ ├── neo.py │ ├── okt_chain.py │ ├── p2pkh.py │ ├── p2sh.py │ ├── p2tr.py │ ├── p2wpkh.py │ ├── p2wpkh_in_p2sh.py │ ├── p2wsh.py │ ├── p2wsh_in_p2sh.py │ ├── ripple.py │ ├── solana.py │ ├── stellar.py │ ├── sui.py │ ├── tezos.py │ ├── tron.py │ ├── xinfin.py │ └── zilliqa.py ├── cli │ ├── __init__.py │ ├── __main__.py │ ├── dump.py │ ├── dumps.py │ ├── generate │ │ ├── __init__.py │ │ ├── entropy.py │ │ ├── mnemonic.py │ │ └── seed.py │ └── list │ │ ├── __init__.py │ │ ├── cryptocurrencies.py │ │ ├── languages.py │ │ └── strengths.py ├── const.py ├── crypto.py ├── cryptocurrencies │ ├── __init__.py │ ├── adcoin.py │ ├── akashnetwork.py │ ├── algorand.py │ ├── anon.py │ ├── aptos.py │ ├── arbitum.py │ ├── argoneum.py │ ├── artax.py │ ├── aryacoin.py │ ├── asiacoin.py │ ├── auroracoin.py │ ├── avalanche.py │ ├── avian.py │ ├── axe.py │ ├── axelar.py │ ├── bandprotocol.py │ ├── bata.py │ ├── beetlecoin.py │ ├── belacoin.py │ ├── binance.py │ ├── bitcloud.py │ ├── bitcoin.py │ ├── bitcoinatom.py │ ├── bitcoincash.py │ ├── bitcoincashslp.py │ ├── bitcoingold.py │ ├── bitcoingreen.py │ ├── bitcoinplus.py │ ├── bitcoinprivate.py │ ├── bitcoinsv.py │ ├── bitcoinz.py │ ├── bitcore.py │ ├── bitsend.py │ ├── blackcoin.py │ ├── blocknode.py │ ├── blockstamp.py │ ├── bolivarcoin.py │ ├── britcoin.py │ ├── canadaecoin.py │ ├── cannacoin.py │ ├── cardano.py │ ├── celo.py │ ├── chihuahua.py │ ├── clams.py │ ├── clubcoin.py │ ├── compcoin.py │ ├── cosmos.py │ ├── cpuchain.py │ ├── cranepay.py │ ├── crave.py │ ├── dash.py │ ├── deeponion.py │ ├── defcoin.py │ ├── denarius.py │ ├── diamond.py │ ├── digibyte.py │ ├── digitalcoin.py │ ├── divi.py │ ├── dogecoin.py │ ├── dydx.py │ ├── ecash.py │ ├── ecoin.py │ ├── edrcoin.py │ ├── egulden.py │ ├── einsteinium.py │ ├── elastos.py │ ├── energi.py │ ├── eos.py │ ├── ergo.py │ ├── ethereum.py │ ├── europecoin.py │ ├── evrmore.py │ ├── exclusivecoin.py │ ├── fantom.py │ ├── feathercoin.py │ ├── fetchai.py │ ├── filecoin.py │ ├── firo.py │ ├── firstcoin.py │ ├── fix.py │ ├── flashcoin.py │ ├── flux.py │ ├── foxdcoin.py │ ├── fujicoin.py │ ├── gamecredits.py │ ├── gcrcoin.py │ ├── gobyte.py │ ├── gridcoin.py │ ├── groestlcoin.py │ ├── gulden.py │ ├── harmony.py │ ├── helleniccoin.py │ ├── hempcoin.py │ ├── horizen.py │ ├── huobitoken.py │ ├── hush.py │ ├── icon.py │ ├── icryptocurrency.py │ ├── injective.py │ ├── insanecoin.py │ ├── internetofpeople.py │ ├── irisnet.py │ ├── ixcoin.py │ ├── jumbucks.py │ ├── kava.py │ ├── kobocoin.py │ ├── komodo.py │ ├── landcoin.py │ ├── lbrycredits.py │ ├── linx.py │ ├── litecoin.py │ ├── litecoincash.py │ ├── litecoinz.py │ ├── lkrcoin.py │ ├── lynx.py │ ├── mazacoin.py │ ├── megacoin.py │ ├── metis.py │ ├── minexcoin.py │ ├── monacoin.py │ ├── monero.py │ ├── monk.py │ ├── multiversx.py │ ├── myriadcoin.py │ ├── namecoin.py │ ├── nano.py │ ├── navcoin.py │ ├── near.py │ ├── neblio.py │ ├── neo.py │ ├── neoscoin.py │ ├── neurocoin.py │ ├── neutron.py │ ├── newyorkcoin.py │ ├── ninechronicles.py │ ├── nix.py │ ├── novacoin.py │ ├── nubits.py │ ├── nushares.py │ ├── okcash.py │ ├── oktchain.py │ ├── omni.py │ ├── onix.py │ ├── ontology.py │ ├── optimism.py │ ├── osmosis.py │ ├── particl.py │ ├── peercoin.py │ ├── pesobit.py │ ├── phore.py │ ├── pinetwork.py │ ├── pinkcoin.py │ ├── pivx.py │ ├── polygon.py │ ├── poswcoin.py │ ├── potcoin.py │ ├── projectcoin.py │ ├── putincoin.py │ ├── qtum.py │ ├── rapids.py │ ├── ravencoin.py │ ├── reddcoin.py │ ├── ripple.py │ ├── ritocoin.py │ ├── rsk.py │ ├── rubycoin.py │ ├── safecoin.py │ ├── saluscoin.py │ ├── scribe.py │ ├── secret.py │ ├── shadowcash.py │ ├── shentu.py │ ├── slimcoin.py │ ├── smileycoin.py │ ├── solana.py │ ├── solarcoin.py │ ├── stafi.py │ ├── stash.py │ ├── stellar.py │ ├── stratis.py │ ├── sugarchain.py │ ├── sui.py │ ├── syscoin.py │ ├── terra.py │ ├── tezos.py │ ├── theta.py │ ├── thoughtai.py │ ├── toacoin.py │ ├── tron.py │ ├── twins.py │ ├── ultimatesecurecash.py │ ├── unobtanium.py │ ├── vcash.py │ ├── vechain.py │ ├── verge.py │ ├── vertcoin.py │ ├── viacoin.py │ ├── vivo.py │ ├── voxels.py │ ├── vpncoin.py │ ├── wagerr.py │ ├── whitecoin.py │ ├── wincoin.py │ ├── xinfin.py │ ├── xuez.py │ ├── ycash.py │ ├── zcash.py │ ├── zclassic.py │ ├── zetacoin.py │ ├── zilliqa.py │ └── zoobc.py ├── derivations │ ├── __init__.py │ ├── bip44.py │ ├── bip49.py │ ├── bip84.py │ ├── bip86.py │ ├── cip1852.py │ ├── custom.py │ ├── electrum.py │ ├── hdw.py │ ├── iderivation.py │ └── monero.py ├── ecc │ ├── __init__.py │ ├── iecc.py │ ├── ipoint.py │ ├── iprivate_key.py │ ├── ipublic_key.py │ ├── kholaw │ │ ├── __init__.py │ │ └── ed25519 │ │ │ ├── __init__.py │ │ │ ├── point.py │ │ │ ├── private_key.py │ │ │ └── public_key.py │ └── slip10 │ │ ├── __init__.py │ │ ├── ed25519 │ │ ├── __init__.py │ │ ├── blake2b │ │ │ ├── __init__.py │ │ │ ├── point.py │ │ │ ├── private_key.py │ │ │ └── public_key.py │ │ ├── monero │ │ │ ├── __init__.py │ │ │ ├── point.py │ │ │ ├── private_key.py │ │ │ └── public_key.py │ │ ├── point.py │ │ ├── private_key.py │ │ └── public_key.py │ │ ├── nist256p1 │ │ ├── __init__.py │ │ ├── point.py │ │ ├── private_key.py │ │ └── public_key.py │ │ └── secp256k1 │ │ ├── __init__.py │ │ ├── point.py │ │ ├── private_key.py │ │ └── public_key.py ├── entropies │ ├── __init__.py │ ├── algorand.py │ ├── bip39.py │ ├── electrum │ │ ├── __init__.py │ │ ├── v1.py │ │ └── v2.py │ ├── ientropy.py │ └── monero.py ├── exceptions.py ├── hds │ ├── __init__.py │ ├── bip141.py │ ├── bip32.py │ ├── bip44.py │ ├── bip49.py │ ├── bip84.py │ ├── bip86.py │ ├── cardano.py │ ├── electrum │ │ ├── __init__.py │ │ ├── v1.py │ │ └── v2.py │ ├── ihd.py │ └── monero.py ├── hdwallet.py ├── info.py ├── keys.py ├── libs │ ├── __init__.py │ ├── base32.py │ ├── base58.py │ ├── bech32.py │ ├── ecc.py │ ├── ed25519.py │ ├── ripemd160.py │ └── segwit_bech32.py ├── mnemonics │ ├── __init__.py │ ├── algorand │ │ ├── __init__.py │ │ ├── mnemonic.py │ │ └── wordlist │ │ │ └── english.txt │ ├── bip39 │ │ ├── __init__.py │ │ ├── mnemonic.py │ │ └── wordlist │ │ │ ├── chinese_simplified.txt │ │ │ ├── chinese_traditional.txt │ │ │ ├── czech.txt │ │ │ ├── english.txt │ │ │ ├── french.txt │ │ │ ├── italian.txt │ │ │ ├── japanese.txt │ │ │ ├── korean.txt │ │ │ ├── portuguese.txt │ │ │ ├── russian.txt │ │ │ ├── spanish.txt │ │ │ └── turkish.txt │ ├── electrum │ │ ├── __init__.py │ │ ├── v1 │ │ │ ├── __init__.py │ │ │ ├── mnemonic.py │ │ │ └── wordlist │ │ │ │ └── english.txt │ │ └── v2 │ │ │ ├── __init__.py │ │ │ ├── mnemonic.py │ │ │ └── wordlist │ │ │ ├── chinese_simplified.txt │ │ │ ├── english.txt │ │ │ ├── portuguese.txt │ │ │ └── spanish.txt │ ├── imnemonic.py │ └── monero │ │ ├── __init__.py │ │ ├── mnemonic.py │ │ └── wordlist │ │ ├── chinese_simplified.txt │ │ ├── dutch.txt │ │ ├── english.txt │ │ ├── french.txt │ │ ├── german.txt │ │ ├── italian.txt │ │ ├── japanese.txt │ │ ├── portuguese.txt │ │ ├── russian.txt │ │ └── spanish.txt ├── seeds │ ├── __init__.py │ ├── algorand.py │ ├── bip39.py │ ├── cardano.py │ ├── electrum │ │ ├── __init__.py │ │ ├── v1.py │ │ └── v2.py │ ├── iseed.py │ └── monero.py ├── slip44.py ├── symbols.py ├── utils.py └── wif.py ├── make.bat ├── pytest.ini ├── requirements.txt ├── requirements ├── cli.txt ├── docs.txt └── tests.txt ├── setup.py ├── tests ├── cli │ ├── dump_rules.py │ ├── test_cli_dumps.py │ ├── test_cli_entropy.py │ ├── test_cli_lists.py │ ├── test_cli_mnemonic.py │ └── test_cli_seed.py ├── conftest.py ├── data │ ├── json │ │ ├── addresses.json │ │ ├── derivations.json │ │ ├── eccs.json │ │ ├── entropies.json │ │ ├── hds.json │ │ ├── hdwallet.json │ │ ├── mnemonics.json │ │ └── seeds.json │ └── raw │ │ ├── cryptocurrencies.txt │ │ ├── languages.txt │ │ └── strengths.txt ├── hdwallet │ ├── addresses │ │ ├── test_kholaw_ed25519_addresses.py │ │ ├── test_slip10_ed25519_addresses.py │ │ ├── test_slip10_ed25519_blake2b_addresses.py │ │ ├── test_slip10_ed25519_monero_addresses.py │ │ ├── test_slip10_nist256p1_addresses.py │ │ └── test_slip10_secp256k1_addresses.py │ ├── derivations │ │ ├── test_derivation_bip44.py │ │ ├── test_derivation_bip49.py │ │ ├── test_derivation_bip84.py │ │ ├── test_derivation_bip86.py │ │ ├── test_derivation_cip1852.py │ │ ├── test_derivation_custom.py │ │ ├── test_derivation_electrum.py │ │ ├── test_derivation_hdw.py │ │ └── test_derivation_monero.py │ ├── ecc │ │ ├── test_kholaw_ed25519_ecc.py │ │ ├── test_slip10_ed25519_blake2b_ecc.py │ │ ├── test_slip10_ed25519_ecc.py │ │ ├── test_slip10_ed25519_monero_ecc.py │ │ ├── test_slip10_nist256p1_ecc.py │ │ └── test_slip10_sec256k1_ecc.py │ ├── entropies │ │ ├── test_entropies_algorand.py │ │ ├── test_entropies_bip39.py │ │ ├── test_entropies_electrum_v1.py │ │ ├── test_entropies_electrum_v2.py │ │ └── test_entropies_monero.py │ ├── hds │ │ ├── cardano │ │ │ ├── test_hds_cardano_byron_icarus.py │ │ │ ├── test_hds_cardano_byron_ledger.py │ │ │ ├── test_hds_cardano_byron_legacy.py │ │ │ ├── test_hds_cardano_shelley_icarus.py │ │ │ └── test_hds_cardano_shelley_ledger.py │ │ ├── electrum │ │ │ ├── test_hds_electrum_v1.py │ │ │ └── v2 │ │ │ │ ├── test_hds_electrum_v2_segwit.py │ │ │ │ ├── test_hds_electrum_v2_segwit_2fa.py │ │ │ │ ├── test_hds_electrum_v2_standard.py │ │ │ │ └── test_hds_electrum_v2_standard_2fa.py │ │ ├── test_hds_bip141.py │ │ ├── test_hds_bip32.py │ │ ├── test_hds_bip44.py │ │ ├── test_hds_bip49.py │ │ ├── test_hds_bip84.py │ │ ├── test_hds_bip86.py │ │ └── test_hds_monero.py │ ├── hdwallet │ │ ├── bip141 │ │ │ ├── test_bip141_from_entropy.py │ │ │ ├── test_bip141_from_mnemonics.py │ │ │ ├── test_bip141_from_private_key.py │ │ │ ├── test_bip141_from_public_key.py │ │ │ ├── test_bip141_from_seed.py │ │ │ ├── test_bip141_from_wif.py │ │ │ ├── test_bip141_from_xprivate_key.py │ │ │ └── test_bip141_from_xpublic_key.py │ │ ├── bip32 │ │ │ ├── test_bip32_from_entropy.py │ │ │ ├── test_bip32_from_mnemonics.py │ │ │ ├── test_bip32_from_private_key.py │ │ │ ├── test_bip32_from_public_key.py │ │ │ ├── test_bip32_from_seed.py │ │ │ ├── test_bip32_from_wif.py │ │ │ ├── test_bip32_from_xprivate_key.py │ │ │ └── test_bip32_from_xpublic_key.py │ │ ├── bip44 │ │ │ ├── test_bip44_from_entropy.py │ │ │ ├── test_bip44_from_mnemonics.py │ │ │ ├── test_bip44_from_private_key.py │ │ │ ├── test_bip44_from_public_key.py │ │ │ ├── test_bip44_from_seed.py │ │ │ ├── test_bip44_from_wif.py │ │ │ └── test_bip44_from_xprivate_key.py │ │ ├── bip49 │ │ │ ├── test_bip49_from_entropy.py │ │ │ ├── test_bip49_from_mnemonics.py │ │ │ ├── test_bip49_from_private_key.py │ │ │ ├── test_bip49_from_public_key.py │ │ │ ├── test_bip49_from_seed.py │ │ │ ├── test_bip49_from_wif.py │ │ │ └── test_bip49_from_xprivate_key.py │ │ ├── bip84 │ │ │ ├── test_bip84_from_entropy.py │ │ │ ├── test_bip84_from_mnemonics.py │ │ │ ├── test_bip84_from_private_key.py │ │ │ ├── test_bip84_from_public_key.py │ │ │ ├── test_bip84_from_seed.py │ │ │ ├── test_bip84_from_wif.py │ │ │ └── test_bip84_from_xprivate_key.py │ │ ├── bip86 │ │ │ ├── test_bip86_from_entropy.py │ │ │ ├── test_bip86_from_mnemonics.py │ │ │ ├── test_bip86_from_private_key.py │ │ │ ├── test_bip86_from_public_key.py │ │ │ ├── test_bip86_from_seed.py │ │ │ ├── test_bip86_from_wif.py │ │ │ └── test_bip86_from_xprivate_key.py │ │ ├── cardano │ │ │ ├── byron-icarus │ │ │ │ ├── test_cardano_byron_icarus_from_entropy.py │ │ │ │ ├── test_cardano_byron_icarus_from_mnemonic.py │ │ │ │ ├── test_cardano_byron_icarus_from_seed.py │ │ │ │ └── test_cardano_byron_icarus_from_xprivate_key.py │ │ │ ├── byron-ledger │ │ │ │ ├── test_cardano_byron_ledger_from_entropy.py │ │ │ │ ├── test_cardano_byron_ledger_from_mnemonic.py │ │ │ │ ├── test_cardano_byron_ledger_from_seed.py │ │ │ │ └── test_cardano_byron_legder_from_xprivate_key.py │ │ │ ├── byron-legacy │ │ │ │ ├── test_cardano_byron_legacy_from_entropy.py │ │ │ │ ├── test_cardano_byron_legacy_from_mnemonic.py │ │ │ │ ├── test_cardano_byron_legacy_from_seed.py │ │ │ │ └── test_cardano_byron_legacy_from_xprivate_key.py │ │ │ ├── shelley-icarus │ │ │ │ ├── test_cardano_shelley_icarus_from_entropy.py │ │ │ │ ├── test_cardano_shelley_icarus_from_mnemonic.py │ │ │ │ ├── test_cardano_shelley_icarus_from_private_key.py │ │ │ │ ├── test_cardano_shelley_icarus_from_public_key.py │ │ │ │ ├── test_cardano_shelley_icarus_from_seed.py │ │ │ │ └── test_cardano_shelley_icarus_from_xprivate_key.py │ │ │ └── shelley-ledger │ │ │ │ ├── test_cardano_shelley_ledger_from_entropy.py │ │ │ │ ├── test_cardano_shelley_ledger_from_mnemonic.py │ │ │ │ ├── test_cardano_shelley_ledger_from_private_key.py │ │ │ │ ├── test_cardano_shelley_ledger_from_public_key.py │ │ │ │ ├── test_cardano_shelley_ledger_from_seed.py │ │ │ │ └── test_cardano_shelley_ledger_from_xprivate_key.py │ │ ├── electrum │ │ │ ├── v1 │ │ │ │ ├── test_electrum_v1_from_entropy.py │ │ │ │ ├── test_electrum_v1_from_mnemonic.py │ │ │ │ ├── test_electrum_v1_from_private_key.py │ │ │ │ ├── test_electrum_v1_from_public_key.py │ │ │ │ ├── test_electrum_v1_from_seed.py │ │ │ │ └── test_electrum_v1_from_wif.py │ │ │ └── v2 │ │ │ │ ├── segwit │ │ │ │ ├── test_segwit_from_entropy.py │ │ │ │ ├── test_segwit_from_mnemonic.py │ │ │ │ └── test_segwit_from_seed.py │ │ │ │ ├── segwit_2fa │ │ │ │ ├── test_segwit_2fa_from_entropy.py │ │ │ │ ├── test_segwit_2fa_from_mnemonic.py │ │ │ │ └── test_segwit_2fa_from_seed.py │ │ │ │ ├── standard │ │ │ │ ├── test_standard_from_entropy.py │ │ │ │ ├── test_standard_from_mnemonic.py │ │ │ │ └── test_standard_from_seed.py │ │ │ │ └── standard_2fa │ │ │ │ ├── test_standard_2fa_from_entropy.py │ │ │ │ ├── test_standard_2fa_from_mnemonic.py │ │ │ │ └── test_standard_2fa_from_seed.py │ │ └── monero │ │ │ ├── test_monero_from_entropy.py │ │ │ ├── test_monero_from_mnemonic.py │ │ │ ├── test_monero_from_private_key.py │ │ │ ├── test_monero_from_seed.py │ │ │ ├── test_monero_from_spend_private_key.py │ │ │ └── test_monero_from_watch_only.py │ ├── mnemonics │ │ ├── test_mnemonics_algorand.py │ │ ├── test_mnemonics_bip39.py │ │ ├── test_mnemonics_electrum_v1.py │ │ ├── test_mnemonics_electrum_v2.py │ │ └── test_mnemonics_monero.py │ └── seeds │ │ ├── test_seeds_algorand.py │ │ ├── test_seeds_bip39.py │ │ ├── test_seeds_cardano.py │ │ ├── test_seeds_electrum_v1.py │ │ ├── test_seeds_electrum_v2.py │ │ └── test_seeds_monero.py ├── test_base58.py ├── test_cryptos.py ├── test_exceptions.py ├── test_keys.py └── test_symbols.py └── tox.ini /.coveragerc: -------------------------------------------------------------------------------- 1 | [run] 2 | omit = hdwallet/libs/* -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Swap package dependencies, run tests and lint with a variety of Python versions. 2 | 3 | name: HDWallet 4 | 5 | on: 6 | push: 7 | branches: [ 8 | master 9 | ] 10 | pull_request: 11 | branches: [ 12 | master 13 | ] 14 | 15 | 16 | jobs: 17 | python: 18 | runs-on: ubuntu-latest 19 | strategy: 20 | matrix: 21 | python-version: [ 22 | "3.9", "3.10", "3.11", "3.12", "3.13" 23 | ] 24 | steps: 25 | - uses: actions/checkout@master 26 | - name: Set up Python ${{ matrix.python-version }} 27 | uses: actions/setup-python@master 28 | with: 29 | python-version: ${{ matrix.python-version }} 30 | - name: Install System dependencies 31 | run: | 32 | sudo apt-get update 33 | sudo apt-get install -y libffi-dev libsecp256k1-dev 34 | - name: Install Dependencies 35 | run: | 36 | python -m pip install --upgrade pip 37 | pip install -e .[cli,tests] 38 | - name: Test with PyTest with Coverage 39 | run: | 40 | coverage run -m pytest 41 | coverage report 42 | - name: Submit Coverage to Coveralls 43 | if: matrix.python-version == '3.12' 44 | run: | 45 | pip install coveralls pyyaml 46 | coveralls 47 | env: 48 | COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }} 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Files stuff 2 | .coverage 3 | .coveralls.yml 4 | 5 | # Folders stuff 6 | experiment/ 7 | .venv/ 8 | .idea/ 9 | .tox/ 10 | .vs/ 11 | 12 | # Setuptools stuff 13 | build/ 14 | dist/ 15 | hdwallet.egg-info/ 16 | 17 | # Python stuff 18 | __pycache__/ 19 | 20 | # py.test stuff 21 | .pytest_cache/ 22 | -------------------------------------------------------------------------------- /.readthedocs.yaml: -------------------------------------------------------------------------------- 1 | # .readthedocs.yaml 2 | 3 | version: 2 4 | 5 | build: 6 | os: ubuntu-22.04 7 | tools: 8 | python: "3.12" 9 | 10 | python: 11 | install: 12 | - method: pip 13 | path: . 14 | extra_requirements: 15 | - cli 16 | - docs 17 | 18 | formats: 19 | - htmlzip 20 | 21 | sphinx: 22 | builder: html 23 | configuration: docs/conf.py 24 | fail_on_warning: false 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright © 2020-2025, Meheret Tesfaye Batu 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include LICENSE 2 | include README.md 3 | include requirements.txt 4 | 5 | recursive-include hdwallet/mnemonics/algorand/wordlist *.txt 6 | recursive-include hdwallet/mnemonics/bip39/wordlist *.txt 7 | recursive-include hdwallet/mnemonics/electrum/v1/wordlist *.txt 8 | recursive-include hdwallet/mnemonics/electrum/v2/wordlist *.txt 9 | recursive-include hdwallet/mnemonics/monero/wordlist *.txt 10 | 11 | recursive-exclude * __pycache__ 12 | recursive-exclude * *.py[co] -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = docs 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /clients/algorand.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics.algorand import ( 5 | AlgorandMnemonic, ALGORAND_MNEMONIC_LANGUAGES, ALGORAND_MNEMONIC_WORDS 6 | ) 7 | from hdwallet.seeds.algorand import AlgorandSeed 8 | from hdwallet.cryptocurrencies import Algorand as Cryptocurrency 9 | from hdwallet.hds import BIP44HD 10 | 11 | import json 12 | 13 | # Get Algorand mnemonic 14 | mnemonic: str = AlgorandMnemonic.from_words( 15 | words=ALGORAND_MNEMONIC_WORDS.TWENTY_FIVE, language=ALGORAND_MNEMONIC_LANGUAGES.ENGLISH 16 | ) 17 | algorand_mnemonic: AlgorandMnemonic = AlgorandMnemonic(mnemonic=mnemonic) 18 | print("Algorand Mnemonic:", algorand_mnemonic.mnemonic()) 19 | print("Algorand Language:", algorand_mnemonic.language()) 20 | print("Algorand Words:", algorand_mnemonic.words()) 21 | 22 | # Get Algorand seed 23 | seed: str = AlgorandSeed.from_mnemonic( 24 | mnemonic=algorand_mnemonic 25 | ) 26 | 27 | # Initialize Algorand HDWallet 28 | hdwallet: HDWallet = HDWallet( 29 | cryptocurrency=Cryptocurrency, 30 | hd=BIP44HD, 31 | network=Cryptocurrency.NETWORKS.MAINNET, 32 | passphrase=None 33 | ).from_private_key( # Get Algorand HDWallet from private key 34 | private_key=seed # Use seed directly as private key 35 | ) 36 | 37 | print(json.dumps(hdwallet.dump(exclude={ 38 | "root", "indexes", "xprivate_key", "xpublic_key", "wif", "chain_code", "parent_fingerprint" 39 | }), indent=4, ensure_ascii=False)) 40 | -------------------------------------------------------------------------------- /clients/atomic_wallet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import BIP39Mnemonic 5 | from hdwallet.cryptocurrencies import Ethereum as Cryptocurrency 6 | from hdwallet.hds import BIP32HD 7 | 8 | import json 9 | 10 | # Initialize Ethereum HDWallet 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=BIP32HD, 14 | network=Cryptocurrency.NETWORKS.MAINNET, 15 | passphrase=None 16 | ).from_mnemonic( # Get Ethereum HDWallet from mnemonic phrase 17 | mnemonic=BIP39Mnemonic( 18 | mnemonic="abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" 19 | ) 20 | ) 21 | 22 | # Print root keys 23 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 24 | -------------------------------------------------------------------------------- /clients/brave_legacy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import BIP39Mnemonic 5 | from hdwallet.seeds import BIP39Seed 6 | from hdwallet.cryptocurrencies import Ethereum as Cryptocurrency 7 | from hdwallet.hds import BIP44HD 8 | from hdwallet.derivations import ( 9 | BIP44Derivation, CHANGES 10 | ) 11 | 12 | import json 13 | 14 | # 24-words mnemonic phrase 15 | MNEMONIC: str = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon " \ 16 | "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon art" 17 | 18 | # Initialize Ethereum HDWallet 19 | hdwallet: HDWallet = HDWallet( 20 | cryptocurrency=Cryptocurrency, 21 | hd=BIP44HD, 22 | network=Cryptocurrency.NETWORKS.MAINNET, 23 | passphrase=None 24 | ).from_seed( # Get Ethereum HDWallet from seed 25 | seed=BIP39Seed( 26 | seed=BIP39Mnemonic.decode(mnemonic=MNEMONIC) # Use decoded mnemonic (entropy) directly as seed 27 | ) 28 | ).from_derivation( # Drive from BIP44 derivation 29 | derivation=BIP44Derivation( 30 | coin_type=Cryptocurrency.COIN_TYPE, 31 | account=0, 32 | change=CHANGES.EXTERNAL_CHAIN, 33 | address=0 34 | ) 35 | ) 36 | 37 | # Same address of Brave crypto wallets extension 38 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 39 | print(f"Address: {hdwallet.address()}") 40 | -------------------------------------------------------------------------------- /clients/exodus_wallet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.ecc import SLIP10Secp256k1ECC 5 | from hdwallet.seeds.bip39 import BIP39Seed 6 | from hdwallet.cryptocurrencies import ( 7 | Algorand, Solana, Stellar, Neo 8 | ) 9 | from hdwallet.hds import BIP44HD 10 | 11 | # Get BIP39 mnemonic 12 | mnemonic: str = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" 13 | 14 | # Get BIP39 seed 15 | seed: str = BIP39Seed.from_mnemonic( 16 | mnemonic=mnemonic, passphrase=None 17 | ) 18 | 19 | for Cryptocurrency in (Algorand, Solana, Stellar, Neo): 20 | # Initialize SLIP10-Secp256k1 BIP44 HD and update root keys from seed 21 | bip44_hd: BIP44HD = BIP44HD( 22 | ecc=SLIP10Secp256k1ECC, coin_type=Cryptocurrency.COIN_TYPE 23 | ).from_seed(seed=BIP39Seed(seed=seed)) 24 | 25 | # Initialize Cryptocurrency HDWallet 26 | hdwallet: HDWallet = HDWallet( 27 | cryptocurrency=Cryptocurrency, 28 | hd=BIP44HD, 29 | network=Cryptocurrency.NETWORKS.MAINNET, 30 | passphrase=None 31 | ).from_private_key( # Get Cryptocurrency HDWallet from private key 32 | private_key=bip44_hd.private_key() # Use the last private key as a master key 33 | ) 34 | 35 | # Same address of Exodus 36 | print(f"Address for {Cryptocurrency.NAME}: {hdwallet.address()}") 37 | 38 | -------------------------------------------------------------------------------- /clients/ledger_live.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import ( 5 | BIP39Mnemonic, BIP39_MNEMONIC_LANGUAGES, BIP39_MNEMONIC_WORDS 6 | ) 7 | from hdwallet.cryptocurrencies import Ethereum as Cryptocurrency 8 | from hdwallet.hds import BIP44HD 9 | from hdwallet.derivations import ( 10 | BIP44Derivation, CHANGES 11 | ) 12 | 13 | # Initialize Ethereum HDWallet 14 | hdwallet: HDWallet = HDWallet( 15 | cryptocurrency=Cryptocurrency, 16 | hd=BIP44HD, 17 | network=Cryptocurrency.NETWORKS.MAINNET, 18 | passphrase=None # "talonlab" 19 | ).from_mnemonic( # Get Ethereum HDWallet from mnemonic phrase 20 | mnemonic=BIP39Mnemonic( 21 | mnemonic=BIP39Mnemonic.from_words( 22 | words=BIP39_MNEMONIC_WORDS.TWENTY_FOUR, 23 | language=BIP39_MNEMONIC_LANGUAGES.ENGLISH 24 | ) 25 | ) 26 | ).from_derivation( # Drive from BIP44 derivation 27 | derivation=BIP44Derivation( 28 | coin_type=Cryptocurrency.COIN_TYPE, 29 | account=(0, 10), # or "0-10", 30 | change=CHANGES.EXTERNAL_CHAIN, 31 | address=0 32 | ) 33 | ) 34 | 35 | print("Mnemonic:", hdwallet.mnemonic()) 36 | print("Base HD Path: m/44'/60'/{account}'/0/0", "\n") 37 | 38 | # Print dived Ethereum HDWallet information's 39 | for derivation in hdwallet.dumps(exclude={"root", "indexes"}): 40 | # Print path, address and private_key 41 | print(f"{derivation['at']['path']} {derivation['address']} 0x{derivation['private_key']}") 42 | -------------------------------------------------------------------------------- /clients/metamask.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import ( 5 | BIP39Mnemonic, BIP39_MNEMONIC_LANGUAGES, BIP39_MNEMONIC_WORDS 6 | ) 7 | from hdwallet.cryptocurrencies import Ethereum as Cryptocurrency 8 | from hdwallet.hds import BIP44HD 9 | from hdwallet.derivations import ( 10 | BIP44Derivation, CHANGES 11 | ) 12 | 13 | # Initialize Ethereum HDWallet 14 | hdwallet: HDWallet = HDWallet( 15 | cryptocurrency=Cryptocurrency, 16 | hd=BIP44HD, 17 | network=Cryptocurrency.NETWORKS.MAINNET, 18 | passphrase=None # "talonlab" 19 | ).from_mnemonic( # Get Ethereum HDWallet from mnemonic phrase 20 | mnemonic=BIP39Mnemonic( 21 | mnemonic=BIP39Mnemonic.from_words( 22 | words=BIP39_MNEMONIC_WORDS.TWELVE, 23 | language=BIP39_MNEMONIC_LANGUAGES.ENGLISH 24 | ) 25 | ) 26 | ).from_derivation( # Drive from BIP44 derivation 27 | derivation=BIP44Derivation( 28 | coin_type=Cryptocurrency.COIN_TYPE, 29 | account=0, 30 | change=CHANGES.EXTERNAL_CHAIN, 31 | address=(0, 10) # or "0-10" 32 | ) 33 | ) 34 | 35 | print("Mnemonic:", hdwallet.mnemonic()) 36 | print("Base HD Path: m/44'/60'/0'/0/{address}", "\n") 37 | 38 | # Print dived Ethereum HDWallet information's 39 | for derivation in hdwallet.dumps(exclude={"root", "indexes"}): 40 | # Print path, address and private_key 41 | print(f"{derivation['at']['path']} {derivation['address']} 0x{derivation['private_key']}") 42 | -------------------------------------------------------------------------------- /clients/solana_cli.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics.bip39 import ( 5 | BIP39Mnemonic, BIP39_MNEMONIC_LANGUAGES, BIP39_MNEMONIC_WORDS 6 | ) 7 | from hdwallet.seeds.bip39 import BIP39Seed 8 | from hdwallet.cryptocurrencies import Solana as Cryptocurrency 9 | from hdwallet.hds import BIP44HD 10 | 11 | import json 12 | 13 | # Get BIP39 mnemonic 14 | mnemonic: str = BIP39Mnemonic.from_words( 15 | words=BIP39_MNEMONIC_WORDS.FIFTEEN, language=BIP39_MNEMONIC_LANGUAGES.CHINESE_TRADITIONAL 16 | ) 17 | bip39_mnemonic: BIP39Mnemonic = BIP39Mnemonic(mnemonic=mnemonic) 18 | print("BIP39 Mnemonic:", bip39_mnemonic.mnemonic()) 19 | print("BIP39 Language:", bip39_mnemonic.language()) 20 | print("BIP39 Words:", bip39_mnemonic.words()) 21 | 22 | # Get BIP39 seed 23 | seed: str = BIP39Seed.from_mnemonic( 24 | mnemonic=bip39_mnemonic, passphrase=None 25 | ) 26 | 27 | # Initialize Solana HDWallet 28 | hdwallet: HDWallet = HDWallet( 29 | cryptocurrency=Cryptocurrency, 30 | hd=BIP44HD, 31 | network=Cryptocurrency.NETWORKS.MAINNET, 32 | passphrase=None 33 | ).from_private_key( # Get Solana HDWallet from private key 34 | private_key=seed[:64] # Use the first 64-length seed directly as private key 35 | ) 36 | 37 | print(json.dumps(hdwallet.dump(exclude={ 38 | "root", "indexes", "xprivate_key", "xpublic_key" 39 | }), indent=4, ensure_ascii=False)) 40 | 41 | -------------------------------------------------------------------------------- /docs/cli.rst: -------------------------------------------------------------------------------- 1 | ============================ 2 | Command Line Interface (CLI) 3 | ============================ 4 | 5 | The ``hdwallet`` CLI provides a simple way to generate wallets, derive addresses, 6 | and manage keys directly from your terminal, with options for exporting data in JSON and CSV formats. 7 | 8 | .. image:: static/svg/hdwallet-cli.svg 9 | :alt: HDWallet CLI 10 | 11 | .. click:: hdwallet.cli.__main__:cli_main 12 | :prog: hdwallet 13 | :show-nested: 14 | -------------------------------------------------------------------------------- /docs/const.rst: -------------------------------------------------------------------------------- 1 | =============== 2 | Constant Values 3 | =============== 4 | 5 | .. autoclass:: hdwallet.const.SLIP10_ED25519_CONST 6 | :members: 7 | 8 | .. autoclass:: hdwallet.const.KHOLAW_ED25519_CONST 9 | :members: 10 | 11 | .. autoclass:: hdwallet.const.SLIP10_SECP256K1_CONST 12 | :members: 13 | 14 | .. autoclass:: hdwallet.const.PUBLIC_KEY_TYPES 15 | :members: 16 | 17 | .. autoclass:: hdwallet.const.WIF_TYPES 18 | :members: 19 | 20 | .. autoclass:: hdwallet.const.SEMANTICS 21 | :members: 22 | 23 | .. autoclass:: hdwallet.const.MODES 24 | :members: 25 | -------------------------------------------------------------------------------- /docs/crypto.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ====== 4 | Crypto 5 | ====== 6 | 7 | .. automodule:: hdwallet.crypto 8 | :members: 9 | -------------------------------------------------------------------------------- /docs/hdwallet.rst: -------------------------------------------------------------------------------- 1 | ======== 2 | HDWallet 3 | ======== 4 | 5 | .. autoclass:: hdwallet.HDWallet 6 | :members: 7 | -------------------------------------------------------------------------------- /docs/install.rst: -------------------------------------------------------------------------------- 1 | =================== 2 | Installing HDWallet 3 | =================== 4 | 5 | The easiest way to install ``hdwallet`` is via pip: 6 | 7 | :: 8 | 9 | pip install hdwallet 10 | 11 | 12 | To install ``hdwallet`` command line interface globally, for Linux `sudo` may be required: 13 | 14 | :: 15 | 16 | pip install hdwallet[cli] 17 | 18 | 19 | After you have installed, type ``hdwallet`` to verify that it worked: 20 | 21 | :: 22 | 23 | hdwallet 24 | Usage: hdwallet [OPTIONS] COMMAND [ARGS]... 25 | 26 | Options: 27 | -v, --version Show HDWallet version and exit 28 | -h, --help Show this message and exit. 29 | 30 | Commands: 31 | dump (d) Select Dump hdwallet keys 32 | dumps (ds) Select Dumps hdwallet keys 33 | generate (g) Select Generate for HDWallet 34 | list (l) Select List for HDWallet information 35 | 36 | 37 | If you want to run the latest version of the code, you can install from git: 38 | 39 | :: 40 | 41 | pip install git+git://github.com/talonlab/python-hdwallet.git 42 | 43 | 44 | For the versions available, see the `tags on this repository `_. 45 | 46 | Development 47 | =========== 48 | 49 | We welcome pull requests. To get started, just fork this `github repository `_, clone it locally, and run: 50 | 51 | :: 52 | 53 | pip install -e .[cli,tests,docs] 54 | -------------------------------------------------------------------------------- /docs/sphinx_ext.py: -------------------------------------------------------------------------------- 1 | def setup(app): 2 | app.connect('autodoc-process-docstring', update_docstring) 3 | 4 | def update_docstring(app, what, name, obj, options, lines): 5 | if what == 'class': 6 | idx = 1 7 | else: 8 | idx = 2 9 | 10 | path = name.split(".") 11 | 12 | module_paths = path[:-idx] 13 | module_path = ".".join(module_paths) 14 | 15 | class_name = path[-idx] 16 | for i, line in enumerate(lines): 17 | lines[i] = line\ 18 | .replace("{class_name}", class_name)\ 19 | .replace("{module_path}", module_path) 20 | 21 | for idx, p in enumerate(module_paths): 22 | mp = ".".join(module_paths[:-idx]) 23 | lines[i] = lines[i].replace("{module_path[-%d]}" % idx, mp) -------------------------------------------------------------------------------- /docs/static/css/hdwallet.css: -------------------------------------------------------------------------------- 1 | .rst-content dl:not(.docutils) code.descname { 2 | color: #2980B9; 3 | } 4 | 5 | table.docutils { 6 | margin-left: 5px; 7 | margin-right: auto; 8 | } 9 | 10 | .mixed-align-table td, .mixed-align-table th { 11 | text-align: center; 12 | width: 20px; 13 | } 14 | 15 | .mixed-align-table td:first-child, .mixed-align-table th:first-child { 16 | text-align: left; 17 | } 18 | 19 | .mixed-align-table td:last-child, .mixed-align-table th:last-child { 20 | text-align: center; /*right*/ 21 | } 22 | 23 | .sidebar-logo-container img { 24 | width: 100px; 25 | height: auto; 26 | } 27 | 28 | .sidebar-brand-text { 29 | text-align: center; 30 | font-size: 19px; 31 | } 32 | -------------------------------------------------------------------------------- /docs/static/hdwallet.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/talonlab/python-hdwallet/e0e50ea3e7bb96a45877edeea12969568f3dd5ea/docs/static/hdwallet.pdf -------------------------------------------------------------------------------- /docs/static/svg/online-badge.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/toctree.rst: -------------------------------------------------------------------------------- 1 | ======== 2 | HDWallet 3 | ======== 4 | 5 | .. toctree:: 6 | :maxdepth: 3 7 | 8 | Overview 9 | install.rst 10 | cli.rst 11 | Supported Cryptocurrencies 12 | 13 | .. toctree:: 14 | :maxdepth: 3 15 | :caption: API's 16 | 17 | Entropies 18 | Mnemonics 19 | Seeds 20 | Derivations 21 | ECCs 22 | HD's 23 | Addresses 24 | HDWallet 25 | Consts 26 | Crypto 27 | Utils 28 | -------------------------------------------------------------------------------- /docs/tools/generate_rst_crypto_table.py: -------------------------------------------------------------------------------- 1 | # Copyright © 2020-2024, Meheret Tesfaye Batu 2 | # 2024, Abenezer Lulseged Wube 3 | # 2024, Eyoel Tadesse 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from hdwallet.cryptocurrencies import CRYPTOCURRENCIES 8 | 9 | def _joined(arr): 10 | return " ".join(f"``{i}``" for i in arr) 11 | 12 | def get_source_link(c): 13 | if hasattr(c.INFO, "SOURCE_CODE"): 14 | return c.INFO.SOURCE_CODE 15 | elif hasattr(c.INFO, "WEBSITES") and c.INFO.WEBSITES: 16 | return c.INFO.WEBSITES[0] 17 | else: 18 | return "#" 19 | 20 | cryptocurrencies = CRYPTOCURRENCIES.classes() 21 | check_right = "✅" 22 | check_x = "❌" 23 | 24 | headers = ["Name", "Symbol", "Coin Type", "Networks", "ECC", "HDs", "BIP38", "Addresses"] 25 | 26 | def format_row(row): 27 | return " * - " + str(row[0]) + ''.join("\n - " + str(cell) for cell in row[1:]) 28 | 29 | def build_rst_table(): 30 | lines = [ 31 | ".. list-table::", 32 | " :width: 100%", 33 | " :header-rows: 1\n" 34 | ] 35 | lines.append(format_row(headers)) 36 | for c in cryptocurrencies: 37 | row = [ 38 | f"`{c.NAME} <{get_source_link(c)}>`_", 39 | c.SYMBOL, 40 | c.COIN_TYPE, 41 | _joined(c.NETWORKS.get_networks()), 42 | c.ECC.NAME, 43 | _joined(c.HDS.get_hds()), 44 | check_right if c.SUPPORT_BIP38 else check_x, 45 | _joined(c.ADDRESSES.get_addresses()) 46 | ] 47 | lines.append(format_row(row)) 48 | return '\n'.join(lines) 49 | 50 | with open("output.rst", "w", encoding="utf-8") as rst_file: 51 | rst_file.write(build_rst_table()) 52 | -------------------------------------------------------------------------------- /docs/utils.rst: -------------------------------------------------------------------------------- 1 | :orphan: 2 | 3 | ===== 4 | Utils 5 | ===== 6 | 7 | .. automodule:: hdwallet.utils 8 | :members: -------------------------------------------------------------------------------- /examples/BIPs/from_entropy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.entropies import ( 5 | BIP39Entropy, BIP39_ENTROPY_STRENGTHS 6 | ) 7 | from hdwallet.mnemonics import BIP39_MNEMONIC_LANGUAGES 8 | from hdwallet.cryptocurrencies import Qtum as Cryptocurrency 9 | from hdwallet.const import PUBLIC_KEY_TYPES 10 | from hdwallet.derivations import ( 11 | BIP44Derivation, CHANGES 12 | ) 13 | from hdwallet.hds import BIP44HD 14 | 15 | import json 16 | 17 | 18 | hdwallet: HDWallet = HDWallet( 19 | cryptocurrency=Cryptocurrency, 20 | hd=BIP44HD, 21 | network=Cryptocurrency.NETWORKS.MAINNET, 22 | language=BIP39_MNEMONIC_LANGUAGES.KOREAN, 23 | public_key_type=PUBLIC_KEY_TYPES.COMPRESSED, 24 | passphrase="meherett" 25 | ).from_entropy( 26 | entropy=BIP39Entropy( 27 | entropy=BIP39Entropy.generate( 28 | strength=BIP39_ENTROPY_STRENGTHS.ONE_HUNDRED_SIXTY 29 | ) 30 | ) 31 | ).from_derivation( 32 | derivation=BIP44Derivation( 33 | coin_type=Cryptocurrency.COIN_TYPE, 34 | account=(0, 2), 35 | change=CHANGES.EXTERNAL_CHAIN, 36 | address=452 37 | ) 38 | ) 39 | 40 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 41 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 42 | -------------------------------------------------------------------------------- /examples/BIPs/from_mnemonic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import ( 5 | BIP39Mnemonic, BIP39_MNEMONIC_LANGUAGES, MONERO_MNEMONIC_WORDS 6 | ) 7 | from hdwallet.cryptocurrencies import Binance as Cryptocurrency 8 | from hdwallet.const import PUBLIC_KEY_TYPES 9 | from hdwallet.derivations import ( 10 | BIP44Derivation, CHANGES 11 | ) 12 | from hdwallet.hds import BIP32HD 13 | 14 | import json 15 | 16 | 17 | hdwallet: HDWallet = HDWallet( 18 | cryptocurrency=Cryptocurrency, 19 | hd=BIP32HD, 20 | network=Cryptocurrency.NETWORKS.MAINNET, 21 | public_key_type=PUBLIC_KEY_TYPES.COMPRESSED, 22 | passphrase="meherett" 23 | ).from_mnemonic( 24 | mnemonic=BIP39Mnemonic( 25 | mnemonic=BIP39Mnemonic.from_words( 26 | words=MONERO_MNEMONIC_WORDS.TWELVE, 27 | language=BIP39_MNEMONIC_LANGUAGES.ITALIAN 28 | ) 29 | ) 30 | ).from_derivation( 31 | derivation=BIP44Derivation( 32 | coin_type=Cryptocurrency.COIN_TYPE, 33 | account=0, 34 | change=CHANGES.EXTERNAL_CHAIN, 35 | address=0 36 | ) 37 | ) 38 | 39 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 40 | # print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 41 | -------------------------------------------------------------------------------- /examples/BIPs/from_private_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency 5 | from hdwallet.const import PUBLIC_KEY_TYPES 6 | from hdwallet.hds import BIP49HD 7 | 8 | import json 9 | 10 | 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=BIP49HD, 14 | network=Cryptocurrency.NETWORKS.MAINNET, 15 | public_key_type=PUBLIC_KEY_TYPES.COMPRESSED 16 | ).from_private_key( 17 | private_key="0fea3ff3b19b033672e8ac8a3b26fed252daf30762c8294e9dd62dc417d2108e" 18 | ) 19 | 20 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 21 | -------------------------------------------------------------------------------- /examples/BIPs/from_public_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency 5 | from hdwallet.const import PUBLIC_KEY_TYPES 6 | from hdwallet.hds import BIP44HD 7 | 8 | import json 9 | 10 | 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=BIP44HD, 14 | network=Cryptocurrency.NETWORKS.MAINNET, 15 | public_key_type=PUBLIC_KEY_TYPES.COMPRESSED 16 | ).from_public_key( 17 | public_key="04da211622e04fc90a4264eac2f4294f74b0cbb23e4ed4c35796a8b188f9d66700c101441f9ed9a13e173f257d12e25a3870d7e2916e25c232d4c732af64e750b6" 18 | ) 19 | 20 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 21 | -------------------------------------------------------------------------------- /examples/BIPs/from_seed.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.seeds import AlgorandSeed 5 | from hdwallet.cryptocurrencies import Algorand as Cryptocurrency 6 | from hdwallet.const import PUBLIC_KEY_TYPES 7 | from hdwallet.derivations import ( 8 | BIP44Derivation, CHANGES 9 | ) 10 | from hdwallet.hds import BIP32HD 11 | 12 | import json 13 | 14 | 15 | hdwallet: HDWallet = HDWallet( 16 | cryptocurrency=Cryptocurrency, 17 | hd=BIP32HD, 18 | network=Cryptocurrency.NETWORKS.MAINNET, 19 | public_key_type=PUBLIC_KEY_TYPES.COMPRESSED 20 | ).from_seed( 21 | seed=AlgorandSeed( 22 | seed="680dca0430704e98224ea64e48964f647d6a428116e629f83c34fe37f799712a" 23 | ) 24 | ).from_derivation( 25 | derivation=BIP44Derivation( 26 | coin_type=Cryptocurrency.COIN_TYPE, 27 | account=0, 28 | change=CHANGES.EXTERNAL_CHAIN, 29 | address=0 30 | ) 31 | ) 32 | 33 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 34 | # print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 35 | -------------------------------------------------------------------------------- /examples/BIPs/from_wif.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency 5 | from hdwallet.const import PUBLIC_KEY_TYPES 6 | from hdwallet.hds import BIP86HD 7 | 8 | import json 9 | 10 | 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=BIP86HD, 14 | network=Cryptocurrency.NETWORKS.MAINNET, 15 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 16 | ).from_wif( 17 | wif="KwkeWuENpJSiPpUtrqFCXYbcU8zhJFuCg8ydwVg6ewUn3Wc1Jhek" 18 | ) 19 | 20 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 21 | -------------------------------------------------------------------------------- /examples/BIPs/from_xprivate_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Bitcoin as Cryptocurrency 5 | from hdwallet.derivations import CustomDerivation 6 | from hdwallet.const import ( 7 | PUBLIC_KEY_TYPES, SEMANTICS 8 | ) 9 | from hdwallet.hds import BIP141HD 10 | 11 | import json 12 | 13 | 14 | hdwallet: HDWallet = HDWallet( 15 | cryptocurrency=Cryptocurrency, 16 | hd=BIP141HD, 17 | network=Cryptocurrency.NETWORKS.MAINNET, 18 | public_key_type=PUBLIC_KEY_TYPES.COMPRESSED, 19 | semantic=SEMANTICS.P2WPKH_IN_P2SH 20 | ).from_xprivate_key( 21 | xprivate_key="xprv9s21ZrQH143K24t96gCaezzt1QQmnqiEGm8m6TP8yb8e3TmGfkCgcLEVsskufMW9R4KH27pD1kyyEfJkYz1eiPwjhFzB4gtabH3PzMSmXSM", 22 | strict=True 23 | ).from_derivation( 24 | derivation=CustomDerivation( 25 | path="m/0'/0-2" 26 | ) 27 | ) 28 | 29 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 30 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 31 | -------------------------------------------------------------------------------- /examples/BIPs/from_xpublic_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Qtum as Cryptocurrency 5 | from hdwallet.derivations import CustomDerivation 6 | from hdwallet.const import ( 7 | PUBLIC_KEY_TYPES, SEMANTICS 8 | ) 9 | from hdwallet.hds import BIP141HD 10 | 11 | import json 12 | 13 | 14 | hdwallet: HDWallet = HDWallet( 15 | cryptocurrency=Cryptocurrency, 16 | hd=BIP141HD, 17 | network=Cryptocurrency.NETWORKS.MAINNET, 18 | public_key_type=PUBLIC_KEY_TYPES.COMPRESSED, 19 | semantic=SEMANTICS.P2WSH 20 | ).from_xpublic_key( 21 | xpublic_key="xpub661MyMwAqRbcEYxcChjb28wcZSFGCJS5dz4MtqnkXvfcvG6RDHWwA8Yyj8huR1AnPaWwMjjwux3n6b5hNnTcgwYXSfCsi9RnQ6RvY3RZ8fm", 22 | strict=True 23 | ).from_derivation( 24 | derivation=CustomDerivation( 25 | path="m/0/0-2" # Hardened "'" key is not allowed for xpublic key 26 | ) 27 | ) 28 | 29 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 30 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 31 | -------------------------------------------------------------------------------- /examples/cardano/from_entropy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.entropies import ( 5 | BIP39Entropy, BIP39_ENTROPY_STRENGTHS 6 | ) 7 | from hdwallet.mnemonics import BIP39_MNEMONIC_LANGUAGES 8 | from hdwallet.cryptocurrencies import Cardano as Cryptocurrency 9 | from hdwallet.hds import CardanoHD 10 | from hdwallet.derivations import ( 11 | BIP44Derivation, CHANGES 12 | ) 13 | 14 | import json 15 | 16 | 17 | hdwallet: HDWallet = HDWallet( 18 | cryptocurrency=Cryptocurrency, 19 | hd=CardanoHD, 20 | language=BIP39_MNEMONIC_LANGUAGES.CZECH, 21 | cardano_type=Cryptocurrency.TYPES.BYRON_ICARUS, 22 | passphrase="meherett" 23 | ).from_entropy( 24 | entropy=BIP39Entropy( 25 | entropy=BIP39Entropy.generate( 26 | strength=BIP39_ENTROPY_STRENGTHS.TWO_HUNDRED_TWENTY_FOUR 27 | ) 28 | ) 29 | ).from_derivation( 30 | derivation=BIP44Derivation( 31 | coin_type=Cryptocurrency.COIN_TYPE, 32 | account=(0, 2), 33 | change=CHANGES.EXTERNAL_CHAIN, 34 | address=452 35 | ) 36 | ) 37 | 38 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 39 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 40 | -------------------------------------------------------------------------------- /examples/cardano/from_mnemonic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import ( 5 | BIP39Mnemonic, MONERO_MNEMONIC_WORDS, BIP39_MNEMONIC_LANGUAGES 6 | ) 7 | from hdwallet.cryptocurrencies import Cardano as Cryptocurrency 8 | from hdwallet.hds import CardanoHD 9 | from hdwallet.derivations import ( 10 | CIP1852Derivation, ROLES 11 | ) 12 | 13 | import json 14 | 15 | 16 | hdwallet: HDWallet = HDWallet( 17 | cryptocurrency=Cryptocurrency, 18 | hd=CardanoHD, 19 | cardano_type=Cryptocurrency.TYPES.SHELLEY_ICARUS, 20 | address_type=Cryptocurrency.ADDRESS_TYPES.STAKING, 21 | passphrase="meherett" 22 | ).from_mnemonic( 23 | mnemonic=BIP39Mnemonic( 24 | mnemonic=BIP39Mnemonic.from_words( 25 | words=MONERO_MNEMONIC_WORDS.TWELVE, 26 | language=BIP39_MNEMONIC_LANGUAGES.ITALIAN 27 | ) 28 | ) 29 | ).from_derivation( 30 | derivation=CIP1852Derivation( 31 | coin_type=Cryptocurrency.COIN_TYPE, 32 | account=0, 33 | role=ROLES.STAKING_KEY, 34 | address=0 35 | ) 36 | ) 37 | 38 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 39 | # print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 40 | -------------------------------------------------------------------------------- /examples/cardano/from_private_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Cardano as Cryptocurrency 5 | from hdwallet.hds import CardanoHD 6 | 7 | import json 8 | 9 | 10 | hdwallet: HDWallet = HDWallet( 11 | cryptocurrency=Cryptocurrency, 12 | hd=CardanoHD, 13 | cardano_type=Cryptocurrency.TYPES.SHELLEY_ICARUS, 14 | address_type=Cryptocurrency.ADDRESS_TYPES.STAKING 15 | ).from_private_key( 16 | private_key="a00f697f4eeafd98efb151ea16bd84451a3071eae3427a47d67a3361608b0656724e9a307aab119a07d3175f2a8f61dfcdcfc7f0e2e3138282dca388ea58f3ff" 17 | ) 18 | 19 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 20 | -------------------------------------------------------------------------------- /examples/cardano/from_public_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Cardano as Cryptocurrency 5 | from hdwallet.hds import CardanoHD 6 | 7 | import json 8 | 9 | 10 | hdwallet: HDWallet = HDWallet( 11 | cryptocurrency=Cryptocurrency, 12 | hd=CardanoHD, 13 | cardano_type=Cryptocurrency.TYPES.SHELLEY_LEDGER, 14 | address_type=Cryptocurrency.ADDRESS_TYPES.STAKING 15 | ).from_public_key( 16 | public_key="00c76d02311731bdca7afe7907f2f3b53383d43f278d8c22abb73c17d417d37cf1" 17 | ) 18 | 19 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 20 | -------------------------------------------------------------------------------- /examples/cardano/from_seed.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.seeds import CardanoSeed 5 | from hdwallet.cryptocurrencies import Cardano as Cryptocurrency 6 | from hdwallet.hds import CardanoHD 7 | from hdwallet.derivations import ( 8 | CIP1852Derivation, ROLES 9 | ) 10 | 11 | import json 12 | 13 | 14 | hdwallet: HDWallet = HDWallet( 15 | cryptocurrency=Cryptocurrency, 16 | hd=CardanoHD, 17 | cardano_type=Cryptocurrency.TYPES.SHELLEY_ICARUS, 18 | address_type=Cryptocurrency.ADDRESS_TYPES.PAYMENT, 19 | staking_public_key="00f06973be3a2b8d74086283e18176b6b4b5bd28da78c264cd65ad146126f8240e", 20 | passphrase="meherett" 21 | ).from_seed( 22 | seed=CardanoSeed( 23 | seed="fca87b68fdffa968895901c894f678f6" 24 | ) 25 | ).from_derivation( 26 | derivation=CIP1852Derivation( 27 | coin_type=Cryptocurrency.COIN_TYPE, 28 | account=0, 29 | role=ROLES.EXTERNAL_CHAIN, 30 | address=(6, 8) 31 | ) 32 | ) 33 | 34 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 35 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 36 | -------------------------------------------------------------------------------- /examples/cardano/from_xprivate_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Cardano as Cryptocurrency 5 | from hdwallet.derivations import CustomDerivation 6 | from hdwallet.hds import CardanoHD 7 | 8 | import json 9 | 10 | 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=CardanoHD, 14 | cardano_type=Cryptocurrency.TYPES.BYRON_LEGACY 15 | ).from_xprivate_key( 16 | xprivate_key="xprv3QESAWYc9vDdZKQAwwfoRBaiWEiTMbMtfPuyREap66sm2yyrV5ipveHVwDccQejWaLqMqLxDYnuNssg4Mf19Mc7EtNuGqLxZPdkaCnR9YEqo3qJpsqBnRi3qkWdWmFZ6xbhNUk799jZqiBwW3ou7jcS", 17 | strict=True 18 | ).from_derivation( 19 | derivation=CustomDerivation( 20 | path="m/0'/0-2" 21 | ) 22 | ) 23 | 24 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 25 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 26 | -------------------------------------------------------------------------------- /examples/cardano/from_xpublic_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Cardano as Cryptocurrency 5 | from hdwallet.derivations import CustomDerivation 6 | from hdwallet.hds import CardanoHD 7 | 8 | import json 9 | 10 | 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=CardanoHD, 14 | cardano_type=Cryptocurrency.TYPES.BYRON_LEDGER # Not supported for byton-legacy 15 | ).from_xpublic_key( 16 | xpublic_key="xpub661MyMwAqRbcEiUJew81QNEAr6jYLVSksDzdQUtWbSWLRdA8ouX1bqK1WxS4qdF4gu8VwSxDVX7n216daK1735md81Z1L7uFUAAT4eSN1xr", 17 | strict=True 18 | ).from_derivation( 19 | derivation=CustomDerivation( 20 | path="m/0/0-2" # Hardened "'" key is not allowed for xpublic key 21 | ) 22 | ) 23 | 24 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 25 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 26 | -------------------------------------------------------------------------------- /examples/electrum/v1/from_entropy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.entropies import ( 5 | ElectrumV1Entropy, ELECTRUM_V1_ENTROPY_STRENGTHS 6 | ) 7 | from hdwallet.mnemonics import ELECTRUM_V1_MNEMONIC_LANGUAGES 8 | from hdwallet.derivations import ElectrumDerivation 9 | from hdwallet.cryptocurrencies import Bitcoin 10 | from hdwallet.const import PUBLIC_KEY_TYPES 11 | from hdwallet.hds import ElectrumV1HD 12 | 13 | import json 14 | 15 | 16 | hdwallet: HDWallet = HDWallet( 17 | cryptocurrency=Bitcoin, 18 | hd=ElectrumV1HD, 19 | network=Bitcoin.NETWORKS.MAINNET, 20 | language=ELECTRUM_V1_MNEMONIC_LANGUAGES.ENGLISH, 21 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 22 | ).from_entropy( 23 | entropy=ElectrumV1Entropy( 24 | entropy=ElectrumV1Entropy.generate( 25 | strength=ELECTRUM_V1_ENTROPY_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT 26 | ) 27 | ) 28 | ).from_derivation( 29 | derivation=ElectrumDerivation( 30 | change=(0, 2), address=(1, 2) 31 | ) 32 | ) 33 | 34 | # print(json.dumps(hdwallet.dump(), indent=4, ensure_ascii=False)) 35 | print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False)) 36 | -------------------------------------------------------------------------------- /examples/electrum/v1/from_mnemonic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import ( 5 | ElectrumV1Mnemonic, ELECTRUM_V1_MNEMONIC_LANGUAGES, ELECTRUM_V1_MNEMONIC_WORDS 6 | ) 7 | from hdwallet.derivations import ElectrumDerivation 8 | from hdwallet.cryptocurrencies import Bitcoin 9 | from hdwallet.const import PUBLIC_KEY_TYPES 10 | from hdwallet.hds import ElectrumV1HD 11 | 12 | import json 13 | 14 | 15 | hdwallet: HDWallet = HDWallet( 16 | cryptocurrency=Bitcoin, 17 | hd=ElectrumV1HD, 18 | network=Bitcoin.NETWORKS.MAINNET, 19 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 20 | ).from_mnemonic( 21 | mnemonic=ElectrumV1Mnemonic( 22 | mnemonic=ElectrumV1Mnemonic.from_words( 23 | words=ELECTRUM_V1_MNEMONIC_WORDS.TWELVE, 24 | language=ELECTRUM_V1_MNEMONIC_LANGUAGES.ENGLISH 25 | ) 26 | ) 27 | ).from_derivation( 28 | derivation=ElectrumDerivation( 29 | change=0, address=1 30 | ) 31 | ) 32 | 33 | print(json.dumps(hdwallet.dump(), indent=4, ensure_ascii=False)) 34 | # print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False)) 35 | -------------------------------------------------------------------------------- /examples/electrum/v1/from_private_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.derivations import ElectrumDerivation 5 | from hdwallet.cryptocurrencies import Bitcoin 6 | from hdwallet.const import PUBLIC_KEY_TYPES 7 | from hdwallet.hds import ElectrumV1HD 8 | 9 | import json 10 | 11 | 12 | hdwallet: HDWallet = HDWallet( 13 | cryptocurrency=Bitcoin, 14 | hd=ElectrumV1HD, 15 | network=Bitcoin.NETWORKS.MAINNET, 16 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 17 | ).from_private_key( 18 | private_key="0fea3ff3b19b033672e8ac8a3b26fed252daf30762c8294e9dd62dc417d2108e" 19 | ).from_derivation( 20 | derivation=ElectrumDerivation( 21 | change=(0, 2), address=0 22 | ) 23 | ) 24 | 25 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 26 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 27 | -------------------------------------------------------------------------------- /examples/electrum/v1/from_public_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.derivations import ElectrumDerivation 5 | from hdwallet.cryptocurrencies import Bitcoin 6 | from hdwallet.const import PUBLIC_KEY_TYPES 7 | from hdwallet.hds import ElectrumV1HD 8 | 9 | import json 10 | 11 | 12 | hdwallet: HDWallet = HDWallet( 13 | cryptocurrency=Bitcoin, 14 | hd=ElectrumV1HD, 15 | network=Bitcoin.NETWORKS.MAINNET, 16 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 17 | ).from_public_key( 18 | public_key="04da211622e04fc90a4264eac2f4294f74b0cbb23e4ed4c35796a8b188f9d66700c101441f9ed9a13e173f257d12e25a3870d7e2916e25c232d4c732af64e750b6" 19 | ).from_derivation( 20 | derivation=ElectrumDerivation( 21 | change=0, address=(1, 2) 22 | ) 23 | ) 24 | 25 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 26 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 27 | -------------------------------------------------------------------------------- /examples/electrum/v1/from_seed.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.seeds import ElectrumV1Seed 5 | from hdwallet.derivations import ElectrumDerivation 6 | from hdwallet.cryptocurrencies import Bitcoin 7 | from hdwallet.const import PUBLIC_KEY_TYPES 8 | from hdwallet.hds import ElectrumV1HD 9 | 10 | import json 11 | 12 | 13 | hdwallet: HDWallet = HDWallet( 14 | cryptocurrency=Bitcoin, 15 | hd=ElectrumV1HD, 16 | network=Bitcoin.NETWORKS.MAINNET, 17 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 18 | ).from_seed( 19 | seed=ElectrumV1Seed( 20 | seed="5e29d84b7fc49c29eb0c3888d6eed8239711ccf94109eb986ca6a9058e8ba274" 21 | ) 22 | ).from_derivation( 23 | derivation=ElectrumDerivation( 24 | change=(0, 2), address=(1, 2) 25 | ) 26 | ) 27 | 28 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 29 | # print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 30 | -------------------------------------------------------------------------------- /examples/electrum/v1/from_wif.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.derivations import ElectrumDerivation 5 | from hdwallet.cryptocurrencies import Bitcoin 6 | from hdwallet.const import PUBLIC_KEY_TYPES 7 | from hdwallet.hds import ElectrumV1HD 8 | 9 | import json 10 | 11 | 12 | hdwallet: HDWallet = HDWallet( 13 | cryptocurrency=Bitcoin, 14 | hd=ElectrumV1HD, 15 | network=Bitcoin.NETWORKS.MAINNET, 16 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 17 | ).from_wif( 18 | wif="5HwJ7KdZapuVs2hJe7rSGXipupaToWCpxYG6eiqjWtmMdRtZDUA" 19 | ).from_derivation( 20 | derivation=ElectrumDerivation( 21 | change=(0, 2), address=(1, 2) 22 | ) 23 | ) 24 | 25 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 26 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 27 | -------------------------------------------------------------------------------- /examples/electrum/v2/from_entropy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.entropies import ( 5 | ElectrumV2Entropy, ELECTRUM_V2_ENTROPY_STRENGTHS 6 | ) 7 | from hdwallet.mnemonics import ( 8 | ELECTRUM_V2_MNEMONIC_LANGUAGES, ELECTRUM_V2_MNEMONIC_TYPES 9 | ) 10 | from hdwallet.derivations import ElectrumDerivation 11 | from hdwallet.cryptocurrencies import Bitcoin 12 | from hdwallet.const import ( 13 | MODES, PUBLIC_KEY_TYPES 14 | ) 15 | from hdwallet.hds import ElectrumV2HD 16 | 17 | import json 18 | 19 | 20 | hdwallet: HDWallet = HDWallet( 21 | cryptocurrency=Bitcoin, 22 | hd=ElectrumV2HD, 23 | network=Bitcoin.NETWORKS.MAINNET, 24 | language=ELECTRUM_V2_MNEMONIC_LANGUAGES.PORTUGUESE, 25 | mnemonic_type=ELECTRUM_V2_MNEMONIC_TYPES.SEGWIT, 26 | mode=MODES.SEGWIT, 27 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 28 | ).from_entropy( 29 | entropy=ElectrumV2Entropy( 30 | entropy=ElectrumV2Entropy.generate( 31 | strength=ELECTRUM_V2_ENTROPY_STRENGTHS.ONE_HUNDRED_THIRTY_TWO 32 | ) 33 | ) 34 | ).from_derivation( 35 | derivation=ElectrumDerivation( 36 | change=(1, 2), address=(1, 2) 37 | ) 38 | ) 39 | 40 | # print(json.dumps(hdwallet.dump(), indent=4, ensure_ascii=False)) 41 | print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False)) 42 | -------------------------------------------------------------------------------- /examples/electrum/v2/from_mnemonic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import ( 5 | ElectrumV2Mnemonic, ELECTRUM_V2_MNEMONIC_LANGUAGES, ELECTRUM_V2_MNEMONIC_TYPES, ELECTRUM_V2_MNEMONIC_WORDS 6 | ) 7 | from hdwallet.derivations import ElectrumDerivation 8 | from hdwallet.cryptocurrencies import Bitcoin 9 | from hdwallet.const import ( 10 | MODES, PUBLIC_KEY_TYPES 11 | ) 12 | from hdwallet.hds import ElectrumV2HD 13 | 14 | import json 15 | 16 | 17 | hdwallet: HDWallet = HDWallet( 18 | cryptocurrency=Bitcoin, 19 | hd=ElectrumV2HD, 20 | network=Bitcoin.NETWORKS.MAINNET, 21 | language=ELECTRUM_V2_MNEMONIC_LANGUAGES.SPANISH, 22 | mnemonic_type=ELECTRUM_V2_MNEMONIC_TYPES.SEGWIT, 23 | mode=MODES.SEGWIT, 24 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 25 | ).from_mnemonic( 26 | mnemonic=ElectrumV2Mnemonic( 27 | mnemonic=ElectrumV2Mnemonic.from_words( 28 | words=ELECTRUM_V2_MNEMONIC_WORDS.TWELVE, 29 | language=ELECTRUM_V2_MNEMONIC_LANGUAGES.SPANISH, 30 | mnemonic_type=ELECTRUM_V2_MNEMONIC_TYPES.SEGWIT, 31 | ), 32 | mnemonic_type=ELECTRUM_V2_MNEMONIC_TYPES.SEGWIT 33 | ) 34 | ).from_derivation( 35 | derivation=ElectrumDerivation( 36 | change=0, address=0 37 | ) 38 | ) 39 | 40 | # print(json.dumps(hdwallet.dump(), indent=4, ensure_ascii=False)) 41 | print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False)) 42 | -------------------------------------------------------------------------------- /examples/electrum/v2/from_seed.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.seeds import ElectrumV2Seed 5 | from hdwallet.derivations import ElectrumDerivation 6 | from hdwallet.cryptocurrencies import Bitcoin 7 | from hdwallet.const import ( 8 | MODES, PUBLIC_KEY_TYPES 9 | ) 10 | from hdwallet.hds import ElectrumV2HD 11 | 12 | import json 13 | 14 | 15 | hdwallet: HDWallet = HDWallet( 16 | cryptocurrency=Bitcoin, 17 | hd=ElectrumV2HD, 18 | network=Bitcoin.NETWORKS.MAINNET, 19 | mode=MODES.SEGWIT, 20 | public_key_type=PUBLIC_KEY_TYPES.UNCOMPRESSED 21 | ).from_seed( 22 | seed=ElectrumV2Seed( 23 | seed="4c423a08ccc9d0fe2fb6136ffdc5292a18c0a552e1246b572a5740c523052882880ca55faf84c996945c7f7145c84ddaedb671e8f23c9bff87617f67e9fb1319" 24 | ) 25 | ).from_derivation( 26 | derivation=ElectrumDerivation( 27 | change=(0, 2), address=(1, 2) 28 | ) 29 | ) 30 | 31 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 32 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 33 | -------------------------------------------------------------------------------- /examples/monero/from_entropy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet.entropies import ( 4 | MoneroEntropy, MONERO_ENTROPY_STRENGTHS 5 | ) 6 | from hdwallet.mnemonics import MONERO_MNEMONIC_LANGUAGES 7 | from hdwallet.cryptocurrencies import Monero as Cryptocurrency 8 | from hdwallet.derivations import MoneroDerivation 9 | from hdwallet.hds import MoneroHD 10 | from hdwallet import HDWallet 11 | 12 | import json 13 | 14 | 15 | hdwallet: HDWallet = HDWallet( 16 | cryptocurrency=Cryptocurrency, 17 | hd=MoneroHD, 18 | network=Cryptocurrency.NETWORKS.MAINNET, 19 | language=MONERO_MNEMONIC_LANGUAGES.PORTUGUESE, 20 | payment_id="ad17dc6e6793d178" 21 | ).from_entropy( 22 | entropy=MoneroEntropy( 23 | entropy=MoneroEntropy.generate( 24 | strength=MONERO_ENTROPY_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT 25 | ) 26 | ) 27 | ).from_derivation( 28 | derivation=MoneroDerivation( 29 | minor=0, major=0 30 | ) 31 | ) 32 | 33 | # print(json.dumps(hdwallet.dump(), indent=4, ensure_ascii=False)) 34 | print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False)) 35 | -------------------------------------------------------------------------------- /examples/monero/from_mnemnoic.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.mnemonics import ( 5 | MoneroMnemonic, MONERO_MNEMONIC_LANGUAGES, MONERO_MNEMONIC_WORDS 6 | ) 7 | from hdwallet.cryptocurrencies import Monero as Cryptocurrency 8 | from hdwallet.derivations import MoneroDerivation 9 | from hdwallet.hds import MoneroHD 10 | 11 | import json 12 | 13 | 14 | hdwallet: HDWallet = HDWallet( 15 | cryptocurrency=Cryptocurrency, 16 | hd=MoneroHD, 17 | network=Cryptocurrency.NETWORKS.MAINNET, 18 | payment_id="ad17dc6e6793d178" 19 | ).from_mnemonic( 20 | mnemonic=MoneroMnemonic( 21 | mnemonic=MoneroMnemonic.from_words( 22 | words=MONERO_MNEMONIC_WORDS.TWELVE, 23 | language=MONERO_MNEMONIC_LANGUAGES.DUTCH 24 | ) 25 | ) 26 | ).from_derivation( 27 | derivation=MoneroDerivation( 28 | minor=0, major=5 29 | ) 30 | ) 31 | 32 | print(json.dumps(hdwallet.dump(), indent=4, ensure_ascii=False)) 33 | # print(json.dumps(hdwallet.dumps(), indent=4, ensure_ascii=False)) 34 | -------------------------------------------------------------------------------- /examples/monero/from_private_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Monero as Cryptocurrency 5 | from hdwallet.derivations import MoneroDerivation 6 | from hdwallet.hds import MoneroHD 7 | 8 | import json 9 | 10 | 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=MoneroHD, 14 | network=Cryptocurrency.NETWORKS.MAINNET 15 | ).from_private_key( 16 | private_key="0fea3ff3b19b033672e8ac8a3b26fed252daf30762c8294e9dd62dc417d2108e" 17 | ).from_derivation( 18 | derivation=MoneroDerivation( 19 | minor=0, major=5 20 | ) 21 | ) 22 | 23 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 24 | # print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 25 | -------------------------------------------------------------------------------- /examples/monero/from_seed.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.seeds import MoneroSeed 5 | from hdwallet.cryptocurrencies import Monero as Cryptocurrency 6 | from hdwallet.derivations import MoneroDerivation 7 | from hdwallet.hds import MoneroHD 8 | 9 | import json 10 | 11 | 12 | hdwallet: HDWallet = HDWallet( 13 | cryptocurrency=Cryptocurrency, 14 | hd=MoneroHD, 15 | network=Cryptocurrency.NETWORKS.MAINNET, 16 | payment_id="ad17dc6e6793d178" 17 | ).from_seed( 18 | seed=MoneroSeed( 19 | seed="747bf6f08db7260c80a21bf6faae491c" 20 | ) 21 | ).from_derivation( 22 | derivation=MoneroDerivation( 23 | minor=0, major=5 24 | ) 25 | ) 26 | 27 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 28 | # print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 29 | -------------------------------------------------------------------------------- /examples/monero/from_spend_private_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Monero as Cryptocurrency 5 | from hdwallet.derivations import MoneroDerivation 6 | from hdwallet.hds import MoneroHD 7 | 8 | import json 9 | 10 | 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=MoneroHD, 14 | network=Cryptocurrency.NETWORKS.MAINNET 15 | ).from_spend_private_key( 16 | spend_private_key="ee08ca4c8556cf0e8f32a1663f9b9a695be2ed4d561244f7127d3753e5f9c802" 17 | ).from_derivation( 18 | derivation=MoneroDerivation( 19 | minor=0, major=(0, 5) 20 | ) 21 | ) 22 | 23 | # print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 24 | print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 25 | -------------------------------------------------------------------------------- /examples/monero/from_watch_only.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from hdwallet import HDWallet 4 | from hdwallet.cryptocurrencies import Monero as Cryptocurrency 5 | from hdwallet.derivations import MoneroDerivation 6 | from hdwallet.hds import MoneroHD 7 | 8 | import json 9 | 10 | 11 | hdwallet: HDWallet = HDWallet( 12 | cryptocurrency=Cryptocurrency, 13 | hd=MoneroHD, 14 | network=Cryptocurrency.NETWORKS.MAINNET 15 | ).from_watch_only( 16 | view_private_key="c6542d68c6a33d68d80f2ae4c7668f943772152c32a564512b16bc5e10ca460c", 17 | spend_public_key="f40f86a5c4742a17561fb67a8516bcdbca82ce7cab20f575a677e88444b3f517" 18 | ).from_derivation( 19 | derivation=MoneroDerivation( 20 | minor=0, major=5 21 | ) 22 | ) 23 | 24 | print(json.dumps(hdwallet.dump(exclude={"indexes"}), indent=4, ensure_ascii=False)) 25 | # print(json.dumps(hdwallet.dumps(exclude={"indexes"}), indent=4, ensure_ascii=False)) 26 | -------------------------------------------------------------------------------- /hdwallet/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .info import ( 10 | __name__, 11 | __version__, 12 | __license__, 13 | __author__, 14 | __email__, 15 | __documentation__, 16 | __description__, 17 | __source__, 18 | __url__, 19 | __tracker__, 20 | __keywords__, 21 | __websites__ 22 | ) 23 | from .hdwallet import HDWallet 24 | 25 | __all__: List[str] = [ 26 | "__name__", 27 | "__version__", 28 | "__license__", 29 | "__author__", 30 | "__email__", 31 | "__documentation__", 32 | "__description__", 33 | "__source__", 34 | "__url__", 35 | "__tracker__", 36 | "__keywords__", 37 | "__websites__", 38 | "HDWallet" 39 | ] 40 | -------------------------------------------------------------------------------- /hdwallet/addresses/harmony.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..cryptocurrencies import Harmony 8 | from .okt_chain import OKTChainAddress 9 | 10 | 11 | class HarmonyAddress(OKTChainAddress): 12 | 13 | hrp: str = Harmony.NETWORKS.MAINNET.HRP 14 | 15 | @staticmethod 16 | def name() -> str: 17 | """ 18 | Returns the name of the blockchain. 19 | 20 | :return: The name of the blockchain. 21 | :rtype: str 22 | """ 23 | 24 | return "Harmony" 25 | -------------------------------------------------------------------------------- /hdwallet/addresses/iaddress.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from __future__ import annotations 8 | 9 | from abc import ( 10 | ABC, abstractmethod 11 | ) 12 | from typing import ( 13 | Union, Optional 14 | ) 15 | 16 | from ..ecc import IPublicKey 17 | 18 | 19 | class IAddress(ABC): 20 | 21 | @staticmethod 22 | @abstractmethod 23 | def name() -> str: 24 | """ 25 | Get the name of the address class. 26 | 27 | :return: The name of the address class. 28 | :rtype: str 29 | """ 30 | 31 | pass 32 | 33 | @classmethod 34 | @abstractmethod 35 | def encode(cls, public_key: Union[bytes, str, IPublicKey], **kwargs) -> str: 36 | """ 37 | Encodes the given public key into a address. 38 | 39 | :param public_key: The public key to encode. Can be bytes, string, or an object implementing IPublicKey. 40 | :type public_key: Union[bytes, str, IPublicKey] 41 | :param kwargs: Additional keyword arguments. 42 | :type kwargs: Any 43 | 44 | :return: The encoded address as a string. 45 | :rtype: str 46 | """ 47 | 48 | pass 49 | 50 | @classmethod 51 | @abstractmethod 52 | def decode(cls, address: str, **kwargs) -> str: 53 | """ 54 | Decodes the given address into its corresponding public key or public key hash. 55 | 56 | :param address: The address to decode. 57 | :type address: str 58 | :param kwargs: Additional keyword arguments specific to each decoding type. 59 | :type kwargs: Any 60 | 61 | :return: The decoded public key as a string. 62 | :rtype: str 63 | """ 64 | 65 | pass 66 | -------------------------------------------------------------------------------- /hdwallet/addresses/ripple.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..cryptocurrencies import Ripple 8 | from .p2pkh import P2PKHAddress 9 | 10 | 11 | class RippleAddress(P2PKHAddress): 12 | 13 | alphabet: str = Ripple.PARAMS.ALPHABET 14 | 15 | @staticmethod 16 | def name() -> str: 17 | """ 18 | Return the name of the cryptocurrency, which is "Ripple". 19 | 20 | :return: The name of the cryptocurrency. 21 | :rtype: str 22 | """ 23 | 24 | return "Ripple" 25 | -------------------------------------------------------------------------------- /hdwallet/addresses/xinfin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..cryptocurrencies import XinFin 8 | from .ethereum import EthereumAddress 9 | 10 | 11 | class XinFinAddress(EthereumAddress): 12 | 13 | address_prefix: str = XinFin.PARAMS.ADDRESS_PREFIX 14 | 15 | @staticmethod 16 | def name() -> str: 17 | """ 18 | Return the name associated with the XinFin blockchain. 19 | 20 | :return: The name "XinFin". 21 | :rtype: str 22 | """ 23 | 24 | return "XinFin" 25 | -------------------------------------------------------------------------------- /hdwallet/cli/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | import inspect 7 | from bip38 import cryptocurrencies 8 | 9 | BIP38_CRYPTOCURRENCIES = { 10 | name: cls for name, cls in inspect.getmembers(cryptocurrencies, inspect.isclass) 11 | if issubclass(cls, cryptocurrencies.ICryptocurrency) 12 | } -------------------------------------------------------------------------------- /hdwallet/cli/generate/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | -------------------------------------------------------------------------------- /hdwallet/cli/list/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | -------------------------------------------------------------------------------- /hdwallet/cli/list/cryptocurrencies.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from tabulate import tabulate 8 | 9 | import click 10 | 11 | from ...cryptocurrencies import CRYPTOCURRENCIES 12 | 13 | 14 | def list_cryptocurrencies(): 15 | 16 | documents, table, headers = [], [], [ 17 | "Cryptocurrency", "Symbol", "Coin Type", "Networks", "ECC" 18 | ] 19 | 20 | for cryptocurrency in CRYPTOCURRENCIES.classes(): 21 | 22 | document: dict = { 23 | "name": cryptocurrency.NAME, 24 | "symbol": cryptocurrency.SYMBOL, 25 | "coin_type": cryptocurrency.COIN_TYPE, 26 | "networks": ", ".join(cryptocurrency.NETWORKS.get_networks()), 27 | "ecc": cryptocurrency.ECC.NAME 28 | } 29 | documents.append(document) 30 | 31 | for document in documents: 32 | table.append([ 33 | document["name"], 34 | document["symbol"], 35 | document["coin_type"], 36 | document["networks"], 37 | document["ecc"], 38 | ]) 39 | 40 | click.echo(tabulate( 41 | table, 42 | headers, 43 | colalign=( 44 | "left", "center", "center", "center", "center" 45 | ) 46 | )) 47 | -------------------------------------------------------------------------------- /hdwallet/cli/list/languages.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from tabulate import tabulate 8 | 9 | import click 10 | 11 | from ...mnemonics import MNEMONICS 12 | 13 | 14 | def list_languages(): 15 | 16 | for index, mnemonic in enumerate(MNEMONICS.classes()): 17 | 18 | languages: list = [] 19 | for _language in mnemonic.languages: 20 | language: str = "" 21 | for index, _ in enumerate(_language.split("-")): 22 | language += _.title() if index == 0 else f"-{_.title()}" 23 | languages.append([language]) 24 | 25 | click.echo(tabulate( 26 | languages, 27 | [ 28 | f"{mnemonic.name()} Languages" 29 | ], 30 | stralign="left", 31 | numalign="left" 32 | )) 33 | if index != (len(MNEMONICS.classes()) - 1): 34 | click.echo("\n") 35 | -------------------------------------------------------------------------------- /hdwallet/cli/list/strengths.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from tabulate import tabulate 8 | 9 | import click 10 | 11 | from ...entropies import ENTROPIES 12 | 13 | 14 | def list_strengths(): 15 | 16 | for index, entropy in enumerate(ENTROPIES.classes()): 17 | 18 | strengths: list = [] 19 | for strength in entropy.strengths: 20 | strengths.append([strength]) 21 | 22 | click.echo(tabulate( 23 | strengths, 24 | [ 25 | f"{entropy.name()} Strengths" 26 | ], 27 | stralign="left", 28 | numalign="left" 29 | )) 30 | if index != (len(ENTROPIES.classes()) - 1): 31 | click.echo("\n") 32 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/akashnetwork.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "akash" 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 AkashNetwork(ICryptocurrency): 30 | 31 | NAME = "Akash-Network" 32 | SYMBOL = "AKT" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/akash-network", 35 | "WEBSITES": [ 36 | "https://akash.network" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.AkashNetwork 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 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/aptos.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Ed25519ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, Params, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | 26 | 27 | class Aptos(ICryptocurrency): 28 | 29 | NAME = "Aptos" 30 | SYMBOL = "APT" 31 | INFO = Info({ 32 | "SOURCE_CODE": "https://github.com/aptos-labs", 33 | "WHITEPAPER": "https://aptosfoundation.org/whitepaper", 34 | "WEBSITES": [ 35 | "https://aptosfoundation.org" 36 | ] 37 | }) 38 | ECC = SLIP10Ed25519ECC 39 | COIN_TYPE = CoinTypes.Aptos 40 | NETWORKS = Networks({ 41 | "MAINNET": Mainnet 42 | }) 43 | DEFAULT_NETWORK = NETWORKS.MAINNET 44 | ENTROPIES = Entropies({ 45 | "BIP39" 46 | }) 47 | MNEMONICS = Mnemonics({ 48 | "BIP39" 49 | }) 50 | SEEDS = Seeds({ 51 | "BIP39" 52 | }) 53 | HDS = HDs({ 54 | "BIP32", "BIP44" 55 | }) 56 | DEFAULT_HD = HDS.BIP44 57 | ADDRESSES = Addresses({ 58 | "APTOS": "Aptos" 59 | }) 60 | DEFAULT_ADDRESS = ADDRESSES.APTOS 61 | PARAMS = Params({ 62 | "SUFFIX": 0x00, 63 | "ADDRESS_PREFIX": "0x" 64 | }) 65 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/arbitum.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class Arbitrum(ICryptocurrency): 29 | 30 | NAME = "Arbitrum" 31 | SYMBOL = "ARB" 32 | INFO = Info({ 33 | "WHITEPAPER": "https://github.com/OffchainLabs", 34 | "WEBSITES": [ 35 | "https://arbitrum.foundation", 36 | "https://arbitrum.io" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.Arbitrum 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 | "ETHEREUM": "Ethereum" 60 | }) 61 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/argoneum.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x32 20 | SCRIPT_ADDRESS_PREFIX = 0x61 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = None 30 | WIF_PREFIX = 0xbf 31 | 32 | 33 | class Argoneum(ICryptocurrency): 34 | 35 | NAME = "Argoneum" 36 | SYMBOL = "AGM" 37 | INFO = Info({ 38 | "SOURCE_CODE": "https://github.com/Argoneum/argoneum", 39 | "WEBSITES": [ 40 | "https://www.argoneum.net" 41 | ] 42 | }) 43 | ECC = SLIP10Secp256k1ECC 44 | COIN_TYPE = CoinTypes.Argoneum 45 | SUPPORT_BIP38 = True 46 | NETWORKS = Networks({ 47 | "MAINNET": Mainnet 48 | }) 49 | DEFAULT_NETWORK = NETWORKS.MAINNET 50 | ENTROPIES = Entropies({ 51 | "BIP39" 52 | }) 53 | MNEMONICS = Mnemonics({ 54 | "BIP39" 55 | }) 56 | SEEDS = Seeds({ 57 | "BIP39" 58 | }) 59 | HDS = HDs({ 60 | "BIP32", "BIP44" 61 | }) 62 | DEFAULT_HD = HDS.BIP44 63 | ADDRESSES = Addresses({ 64 | "P2PKH", "P2SH" 65 | }) 66 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/asiacoin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x17 20 | SCRIPT_ADDRESS_PREFIX = 0x8 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = "\x18AsiaCoin Signed Message:\n" 30 | WIF_PREFIX = 0x97 31 | 32 | 33 | class Asiacoin(ICryptocurrency): 34 | 35 | NAME = "Asiacoin" 36 | SYMBOL = "AC" 37 | INFO = Info({ 38 | "WEBSITES": [ 39 | "http://www.thecoin.asia" 40 | ] 41 | }) 42 | ECC = SLIP10Secp256k1ECC 43 | COIN_TYPE = CoinTypes.Asiacoin 44 | SUPPORT_BIP38 = True 45 | NETWORKS = Networks({ 46 | "MAINNET": Mainnet 47 | }) 48 | DEFAULT_NETWORK = NETWORKS.MAINNET 49 | ENTROPIES = Entropies({ 50 | "BIP39" 51 | }) 52 | MNEMONICS = Mnemonics({ 53 | "BIP39" 54 | }) 55 | SEEDS = Seeds({ 56 | "BIP39" 57 | }) 58 | HDS = HDs({ 59 | "BIP32", "BIP44" 60 | }) 61 | DEFAULT_HD = HDS.BIP44 62 | ADDRESSES = Addresses({ 63 | "P2PKH", "P2SH" 64 | }) 65 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 66 | 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/axe.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x37 20 | SCRIPT_ADDRESS_PREFIX = 0x10 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = None 30 | WIF_PREFIX = 0xcc 31 | 32 | 33 | class Axe(ICryptocurrency): 34 | 35 | NAME = "Axe" 36 | SYMBOL = "AXE" 37 | INFO = Info({ 38 | "SOURCE_CODE": "https://github.com/AXErunners/axe", 39 | "WEBSITES": [ 40 | "https://axerunners.com" 41 | ] 42 | }) 43 | ECC = SLIP10Secp256k1ECC 44 | COIN_TYPE = CoinTypes.Axe 45 | SUPPORT_BIP38 = True 46 | NETWORKS = Networks({ 47 | "MAINNET": Mainnet 48 | }) 49 | DEFAULT_NETWORK = NETWORKS.MAINNET 50 | ENTROPIES = Entropies({ 51 | "BIP39" 52 | }) 53 | MNEMONICS = Mnemonics({ 54 | "BIP39" 55 | }) 56 | SEEDS = Seeds({ 57 | "BIP39" 58 | }) 59 | HDS = HDs({ 60 | "BIP32", "BIP44" 61 | }) 62 | DEFAULT_HD = HDS.BIP44 63 | ADDRESSES = Addresses({ 64 | "P2PKH", "P2SH" 65 | }) 66 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/axelar.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "axelar" 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 Axelar(ICryptocurrency): 30 | 31 | NAME = "Axelar" 32 | SYMBOL = "AXL" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/axelarnetwork/axelar-core", 35 | "WHITEPAPER": "https://axelar.network/wp-content/uploads/2021/07/axelar_whitepaper.pdf", 36 | "WEBSITES": [ 37 | "https://axelar.network", 38 | "https://app.squidrouter.com" 39 | ] 40 | }) 41 | ECC = SLIP10Secp256k1ECC 42 | COIN_TYPE = CoinTypes.Axelar 43 | NETWORKS = Networks({ 44 | "MAINNET": Mainnet 45 | }) 46 | DEFAULT_NETWORK = NETWORKS.MAINNET 47 | ENTROPIES = Entropies({ 48 | "BIP39" 49 | }) 50 | MNEMONICS = Mnemonics({ 51 | "BIP39" 52 | }) 53 | SEEDS = Seeds({ 54 | "BIP39" 55 | }) 56 | HDS = HDs({ 57 | "BIP32", "BIP44" 58 | }) 59 | DEFAULT_HD = HDS.BIP44 60 | ADDRESSES = Addresses({ 61 | "COSMOS": "Cosmos" 62 | }) 63 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 64 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/bandprotocol.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "band" 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 BandProtocol(ICryptocurrency): 30 | 31 | NAME = "Band-Protocol" 32 | SYMBOL = "BAND" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/bandprotocol/chain", 35 | "WHITEPAPER": "https://bandprotocol.com/whitepaper-3.0.1.pdf", 36 | "WEBSITES": [ 37 | "https://bandprotocol.com" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.BandProtocol 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "COSMOS": "Cosmos" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/bitcoinsv.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x0 20 | SCRIPT_ADDRESS_PREFIX = 0x5 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = None 30 | WIF_PREFIX = 0x80 31 | 32 | 33 | class BitcoinSV(ICryptocurrency): 34 | 35 | NAME = "Bitcoin-SV" 36 | SYMBOL = "BSV" 37 | INFO = Info({ 38 | "SOURCE_CODE": "https://github.com/bitcoin-sv/bitcoin-sv", 39 | "WEBSITES": [ 40 | "https://www.bsvblockchain.org" 41 | ] 42 | }) 43 | ECC = SLIP10Secp256k1ECC 44 | COIN_TYPE = CoinTypes.BitcoinSV 45 | SUPPORT_BIP38 = True 46 | NETWORKS = Networks({ 47 | "MAINNET": Mainnet 48 | }) 49 | DEFAULT_NETWORK = NETWORKS.MAINNET 50 | ENTROPIES = Entropies({ 51 | "BIP39" 52 | }) 53 | MNEMONICS = Mnemonics({ 54 | "BIP39" 55 | }) 56 | SEEDS = Seeds({ 57 | "BIP39" 58 | }) 59 | HDS = HDs({ 60 | "BIP32", "BIP44" 61 | }) 62 | DEFAULT_HD = HDS.BIP44 63 | ADDRESSES = Addresses({ 64 | "P2PKH", "P2SH" 65 | }) 66 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/celo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class Celo(ICryptocurrency): 29 | 30 | NAME = "Celo" 31 | SYMBOL = "CELO" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/celo-org/celo-monorepo", 34 | "WHITEPAPER": "http://docs.celo.org", 35 | "WEBSITES": [ 36 | "https://celo.org", 37 | "https://www.celocamp.com" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Celo 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "ETHEREUM": "Ethereum" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/chihuahua.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "chihuahua" 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 Chihuahua(ICryptocurrency): 30 | 31 | NAME = "Chihuahua" 32 | SYMBOL = "HUA" 33 | INFO = Info({ 34 | "WHITEPAPER": "https://docs.chihuahua.army", 35 | "WEBSITES": [ 36 | "http://chihuahua.army" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.Chihuahua 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 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/clams.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x89 20 | SCRIPT_ADDRESS_PREFIX = 0xd 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0xa8c17826, 23 | "P2SH": 0xa8c17826 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0xa8c26d64, 27 | "P2SH": 0xa8c26d64 28 | }) 29 | 30 | MESSAGE_PREFIX = None 31 | WIF_PREFIX = 0x85 32 | 33 | 34 | class Clams(ICryptocurrency): 35 | 36 | NAME = "Clams" 37 | SYMBOL = "CLAM" 38 | INFO = Info({ 39 | "SOURCE_CODE": "https://github.com/nochowderforyou/clams", 40 | "WEBSITES": [ 41 | "http://clamcoin.org" 42 | ] 43 | }) 44 | ECC = SLIP10Secp256k1ECC 45 | COIN_TYPE = CoinTypes.Clams 46 | SUPPORT_BIP38 = True 47 | NETWORKS = Networks({ 48 | "MAINNET": Mainnet 49 | }) 50 | DEFAULT_NETWORK = NETWORKS.MAINNET 51 | ENTROPIES = Entropies({ 52 | "BIP39" 53 | }) 54 | MNEMONICS = Mnemonics({ 55 | "BIP39" 56 | }) 57 | SEEDS = Seeds({ 58 | "BIP39" 59 | }) 60 | HDS = HDs({ 61 | "BIP32", "BIP44" 62 | }) 63 | DEFAULT_HD = HDS.BIP44 64 | ADDRESSES = Addresses({ 65 | "P2PKH", "P2SH" 66 | }) 67 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 68 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/compcoin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x1c 20 | SCRIPT_ADDRESS_PREFIX = 0x55 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = "\x18CompCoin Signed Message:\n" 30 | WIF_PREFIX = 0x9c 31 | 32 | 33 | class Compcoin(ICryptocurrency): 34 | 35 | NAME = "Compcoin" 36 | SYMBOL = "CMP" 37 | INFO = Info({ 38 | "WEBSITES": [ 39 | "https://compcoin.com" 40 | ] 41 | }) 42 | ECC = SLIP10Secp256k1ECC 43 | COIN_TYPE = CoinTypes.Compcoin 44 | SUPPORT_BIP38 = True 45 | NETWORKS = Networks({ 46 | "MAINNET": Mainnet 47 | }) 48 | DEFAULT_NETWORK = NETWORKS.MAINNET 49 | ENTROPIES = Entropies({ 50 | "BIP39" 51 | }) 52 | MNEMONICS = Mnemonics({ 53 | "BIP39" 54 | }) 55 | SEEDS = Seeds({ 56 | "BIP39" 57 | }) 58 | HDS = HDs({ 59 | "BIP32", "BIP44" 60 | }) 61 | DEFAULT_HD = HDS.BIP44 62 | ADDRESSES = Addresses(( 63 | "P2PKH", "P2SH" 64 | )) 65 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 66 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/cosmos.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "cosmos" 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 Cosmos(ICryptocurrency): 30 | 31 | NAME = "Cosmos" 32 | SYMBOL = "ATOM" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/cosmos", 35 | "WHITEPAPER": "https://cosmos.network/resources/whitepaper", 36 | "WEBSITES": [ 37 | "https://cosmos.network" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Cosmos 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "COSMOS": "Cosmos" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/dydx.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 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 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/eos.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, Params, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class EOS(ICryptocurrency): 29 | 30 | NAME = "EOS" 31 | SYMBOL = "EOS" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/AntelopeIO/leap", 34 | "WHITEPAPER": "https://eosnetwork.com/blog/category/eos-blue-papers", 35 | "WEBSITES": [ 36 | "https://eosnetwork.com" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.EOS 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 | "EOS" 60 | }) 61 | DEFAULT_ADDRESS = ADDRESSES.EOS 62 | PARAMS = Params({ 63 | "ADDRESS_PREFIX": "EOS", 64 | "CHECKSUM_LENGTH": 4 65 | }) 66 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/fantom.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class Fantom(ICryptocurrency): 29 | 30 | NAME = "Fantom" 31 | SYMBOL = "FTM" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/Fantom-foundation/go-opera", 34 | "WHITEPAPER": "https://fantom.foundation/fantom-research-papers", 35 | "WEBSITES": [ 36 | "https://fantom.foundation" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.Fantom 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 | "ETHEREUM": "Ethereum" 60 | }) 61 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/fetchai.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "fetch" 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 FetchAI(ICryptocurrency): 30 | 31 | NAME = "Fetch.ai" 32 | SYMBOL = "FET" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/fetchai", 35 | "WHITEPAPER": "https://www.dropbox.com/s/gxptsecwdl3jjtn/David%20Minarsch%20-%202021-04-26%2010.34.17%20-%20paper_21_finalversion.pdf?dl=0", 36 | "WEBSITES": [ 37 | "https://fetch-ai.network", 38 | "https://docs.fetch.ai" 39 | ] 40 | }) 41 | ECC = SLIP10Secp256k1ECC 42 | COIN_TYPE = CoinTypes.FetchAI 43 | NETWORKS = Networks({ 44 | "MAINNET": Mainnet 45 | }) 46 | DEFAULT_NETWORK = NETWORKS.MAINNET 47 | ENTROPIES = Entropies({ 48 | "BIP39" 49 | }) 50 | MNEMONICS = Mnemonics({ 51 | "BIP39" 52 | }) 53 | SEEDS = Seeds({ 54 | "BIP39" 55 | }) 56 | HDS = HDs({ 57 | "BIP32", "BIP44" 58 | }) 59 | DEFAULT_HD = HDS.BIP44 60 | ADDRESSES = Addresses({ 61 | "COSMOS": "Cosmos" 62 | }) 63 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 64 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/gcrcoin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x26 20 | SCRIPT_ADDRESS_PREFIX = 0x61 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = "\x18GCR Signed Message:\n" 30 | WIF_PREFIX = 0x9a 31 | 32 | 33 | class GCRCoin(ICryptocurrency): 34 | 35 | NAME = "GCR-Coin" # Global Currency Reserve 36 | SYMBOL = "GCR" 37 | INFO = Info({ 38 | "WEBSITES": [ 39 | "https://globalcoinresearch.com" 40 | ] 41 | }) 42 | ECC = SLIP10Secp256k1ECC 43 | COIN_TYPE = CoinTypes.GCRCoin 44 | SUPPORT_BIP38 = True 45 | NETWORKS = Networks({ 46 | "MAINNET": Mainnet 47 | }) 48 | DEFAULT_NETWORK = NETWORKS.MAINNET 49 | ENTROPIES = Entropies({ 50 | "BIP39" 51 | }) 52 | MNEMONICS = Mnemonics({ 53 | "BIP39" 54 | }) 55 | SEEDS = Seeds({ 56 | "BIP39" 57 | }) 58 | HDS = HDs({ 59 | "BIP32", "BIP44" 60 | }) 61 | DEFAULT_HD = HDS.BIP44 62 | ADDRESSES = Addresses({ 63 | "P2PKH", "P2SH" 64 | }) 65 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 66 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/harmony.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "one" 20 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 21 | "P2PKH": 0x0488ade4 22 | }) 23 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 24 | "P2PKH": 0x0488b21e 25 | }) 26 | WIF_PREFIX = 0x80 27 | 28 | 29 | class Harmony(ICryptocurrency): 30 | 31 | NAME = "Harmony" 32 | SYMBOL = "ONE" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/harmony-one/harmony", 35 | "WHITEPAPER": "https://harmony.one/whitepaper.pdf", 36 | "WEBSITES": [ 37 | "https://www.harmony.one", 38 | "https://t.me/harmony_announcements" 39 | ] 40 | }) 41 | ECC = SLIP10Secp256k1ECC 42 | COIN_TYPE = CoinTypes.Harmony 43 | NETWORKS = Networks({ 44 | "MAINNET": Mainnet 45 | }) 46 | DEFAULT_NETWORK = NETWORKS.MAINNET 47 | ENTROPIES = Entropies({ 48 | "BIP39" 49 | }) 50 | MNEMONICS = Mnemonics({ 51 | "BIP39" 52 | }) 53 | SEEDS = Seeds({ 54 | "BIP39" 55 | }) 56 | HDS = HDs({ 57 | "BIP32", "BIP44" 58 | }) 59 | DEFAULT_HD = HDS.BIP44 60 | ADDRESSES = Addresses({ 61 | "HARMONY": "Harmony" 62 | }) 63 | DEFAULT_ADDRESS = ADDRESSES.HARMONY 64 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/huobitoken.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class HuobiToken(ICryptocurrency): 29 | 30 | NAME = "Huobi-Token" 31 | SYMBOL = "HT" 32 | INFO = Info({ 33 | "WEBSITES": [ 34 | "https://www.huobi.com/en-us", 35 | "https://www.huobiwallet.com" 36 | ] 37 | }) 38 | ECC = SLIP10Secp256k1ECC 39 | COIN_TYPE = CoinTypes.HuobiToken 40 | NETWORKS = Networks({ 41 | "MAINNET": Mainnet 42 | }) 43 | DEFAULT_NETWORK = NETWORKS.MAINNET 44 | ENTROPIES = Entropies({ 45 | "BIP39" 46 | }) 47 | MNEMONICS = Mnemonics({ 48 | "BIP39" 49 | }) 50 | SEEDS = Seeds({ 51 | "BIP39" 52 | }) 53 | HDS = HDs({ 54 | "BIP32", "BIP44" 55 | }) 56 | DEFAULT_HD = HDS.BIP44 57 | ADDRESSES = Addresses({ 58 | "ETHEREUM": "Ethereum" 59 | }) 60 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 61 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/icon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, Params, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class Icon(ICryptocurrency): 29 | 30 | NAME = "Icon" 31 | SYMBOL = "ICX" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/icon-project", 34 | "WHITEPAPER": "https://icondev.io", 35 | "WEBSITES": [ 36 | "https://www.icon.foundation", 37 | "https://icon.community" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Icon 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "ICON": "Icon" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.ICON 63 | PARAMS = Params({ 64 | "ADDRESS_PREFIX": "hx", 65 | "KEY_HASH_LENGTH": 20 66 | }) 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/injective.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "inj" 20 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 21 | "P2PKH": 0x0488ade4 22 | }) 23 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 24 | "P2PKH": 0x0488b21e 25 | }) 26 | WIF_PREFIX = 0x80 27 | 28 | 29 | class Injective(ICryptocurrency): 30 | 31 | NAME = "Injective" 32 | SYMBOL = "INJ" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/InjectiveLabs", 35 | "WHITEPAPER": "https://docs.injectiveprotocol.com/#introduction", 36 | "WEBSITES": [ 37 | "https://injective.com" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Injective 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "INJECTIVE": "Injective" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.INJECTIVE 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/irisnet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "iaa" 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 IRISnet(ICryptocurrency): 30 | 31 | NAME = "IRISnet" 32 | SYMBOL = "IRIS" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/irisnet", 35 | "WHITEPAPER": "https://www.irisnet.org/docs/resources/whitepaper-en.html", 36 | "WEBSITES": [ 37 | "https://www.irisnet.org" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.IRISnet 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "COSMOS": "Cosmos" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/jumbucks.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x2b 20 | SCRIPT_ADDRESS_PREFIX = 0x5 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x37a6460, 23 | "P2SH": 0x37a6460 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x37a689a, 27 | "P2SH": 0x37a689a 28 | }) 29 | MESSAGE_PREFIX = "\x19Jumbucks Signed Message:\n" 30 | WIF_PREFIX = 0xab 31 | 32 | 33 | class Jumbucks(ICryptocurrency): 34 | 35 | NAME = "Jumbucks" 36 | SYMBOL = "JBS" 37 | INFO = Info({ 38 | "WEBSITES": [ 39 | "http://getjumbucks.com" 40 | ] 41 | }) 42 | ECC = SLIP10Secp256k1ECC 43 | COIN_TYPE = CoinTypes.Jumbucks 44 | SUPPORT_BIP38 = True 45 | NETWORKS = Networks({ 46 | "MAINNET": Mainnet 47 | }) 48 | DEFAULT_NETWORK = NETWORKS.MAINNET 49 | ENTROPIES = Entropies({ 50 | "BIP39" 51 | }) 52 | MNEMONICS = Mnemonics({ 53 | "BIP39" 54 | }) 55 | SEEDS = Seeds({ 56 | "BIP39" 57 | }) 58 | HDS = HDs({ 59 | "BIP32", "BIP44" 60 | }) 61 | DEFAULT_HD = HDS.BIP44 62 | ADDRESSES = Addresses({ 63 | "P2PKH", "P2SH" 64 | }) 65 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 66 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/kava.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "kava" 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 Kava(ICryptocurrency): 30 | 31 | NAME = "Kava" 32 | SYMBOL = "KAVA" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/kava-labs", 35 | "WHITEPAPER": "https://docsend.com/view/gwbwpc3", 36 | "WEBSITES": [ 37 | "https://www.kava.io", 38 | "https://app.kava.io" 39 | ] 40 | }) 41 | ECC = SLIP10Secp256k1ECC 42 | COIN_TYPE = CoinTypes.Kava 43 | NETWORKS = Networks({ 44 | "MAINNET": Mainnet 45 | }) 46 | DEFAULT_NETWORK = NETWORKS.MAINNET 47 | ENTROPIES = Entropies({ 48 | "BIP39" 49 | }) 50 | MNEMONICS = Mnemonics({ 51 | "BIP39" 52 | }) 53 | SEEDS = Seeds({ 54 | "BIP39" 55 | }) 56 | HDS = HDs({ 57 | "BIP32", "BIP44" 58 | }) 59 | DEFAULT_HD = HDS.BIP44 60 | ADDRESSES = Addresses({ 61 | "COSMOS": "Cosmos" 62 | }) 63 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 64 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/landcoin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x30 20 | SCRIPT_ADDRESS_PREFIX = 0x7a 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = "\x18Landcoin Signed Message:\n" 30 | WIF_PREFIX = 0xb0 31 | 32 | 33 | class Landcoin(ICryptocurrency): 34 | 35 | NAME = "Landcoin" 36 | SYMBOL = "LDCN" 37 | INFO = Info({ 38 | "WEBSITES": [ 39 | "http://landcoin.co" 40 | ] 41 | }) 42 | ECC = SLIP10Secp256k1ECC 43 | COIN_TYPE = CoinTypes.Landcoin 44 | SUPPORT_BIP38 = True 45 | NETWORKS = Networks({ 46 | "MAINNET": Mainnet 47 | }) 48 | DEFAULT_NETWORK = NETWORKS.MAINNET 49 | ENTROPIES = Entropies({ 50 | "BIP39" 51 | }) 52 | MNEMONICS = Mnemonics({ 53 | "BIP39" 54 | }) 55 | SEEDS = Seeds({ 56 | "BIP39" 57 | }) 58 | HDS = HDs({ 59 | "BIP32", "BIP44" 60 | }) 61 | DEFAULT_HD = HDS.BIP44 62 | ADDRESSES = Addresses({ 63 | "P2PKH", "P2SH" 64 | }) 65 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 66 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/lynx.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x2d 20 | SCRIPT_ADDRESS_PREFIX = 0x32 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = "\x18Lynx Signed Message:\n" 30 | WIF_PREFIX = 0xad 31 | 32 | 33 | class Lynx(ICryptocurrency): 34 | 35 | NAME = "Lynx" 36 | SYMBOL = "LYNX" 37 | INFO = Info({ 38 | "SOURCE_CODE": "https://github.com/doh9Xiet7weesh9va9th/lynx", 39 | "WEBSITES": [ 40 | "https://getlynx.io" 41 | ] 42 | }) 43 | ECC = SLIP10Secp256k1ECC 44 | COIN_TYPE = CoinTypes.Lynx 45 | SUPPORT_BIP38 = True 46 | NETWORKS = Networks({ 47 | "MAINNET": Mainnet 48 | }) 49 | DEFAULT_NETWORK = NETWORKS.MAINNET 50 | ENTROPIES = Entropies({ 51 | "BIP39" 52 | }) 53 | MNEMONICS = Mnemonics({ 54 | "BIP39" 55 | }) 56 | SEEDS = Seeds({ 57 | "BIP39" 58 | }) 59 | HDS = HDs({ 60 | "BIP32", "BIP44" 61 | }) 62 | DEFAULT_HD = HDS.BIP44 63 | ADDRESSES = Addresses(( 64 | "P2PKH", "P2SH" 65 | )) 66 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/mazacoin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x32 20 | SCRIPT_ADDRESS_PREFIX = 0x9 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = None 30 | WIF_PREFIX = 0xe0 31 | 32 | 33 | class Mazacoin(ICryptocurrency): 34 | 35 | NAME = "Mazacoin" 36 | SYMBOL = "MZC" 37 | INFO = Info({ 38 | "SOURCE_CODE": "https://github.com/MazaCoin/maza", 39 | "WEBSITES": [ 40 | "http://www.mazacoin.org" 41 | ] 42 | }) 43 | ECC = SLIP10Secp256k1ECC 44 | COIN_TYPE = CoinTypes.Mazacoin 45 | SUPPORT_BIP38 = True 46 | NETWORKS = Networks({ 47 | "MAINNET": Mainnet 48 | }) 49 | DEFAULT_NETWORK = NETWORKS.MAINNET 50 | ENTROPIES = Entropies({ 51 | "BIP39" 52 | }) 53 | MNEMONICS = Mnemonics({ 54 | "BIP39" 55 | }) 56 | SEEDS = Seeds({ 57 | "BIP39" 58 | }) 59 | HDS = HDs({ 60 | "BIP32", "BIP44" 61 | }) 62 | DEFAULT_HD = HDS.BIP44 63 | ADDRESSES = Addresses({ 64 | "P2PKH", "P2SH" 65 | }) 66 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/metis.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class Metis(ICryptocurrency): 29 | 30 | NAME = "Metis" 31 | SYMBOL = "METIS" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/MetisProtocol/metis", 34 | "WHITEPAPER": "https://drive.google.com/file/d/1LS7CmKFt-FkfVXxSNu06hNgoZXxMzTC-/view", 35 | "WEBSITES": [ 36 | "https://www.metis.io" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.Metis 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 | "ETHEREUM": "Ethereum" 60 | }) 61 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/multiversx.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Ed25519ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "erd" 20 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 21 | "P2PKH": 0x0488ade4 22 | }) 23 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 24 | "P2PKH": 0x0488b21e 25 | }) 26 | 27 | 28 | class MultiversX(ICryptocurrency): 29 | 30 | NAME = "MultiversX" # Elrond old name 31 | SYMBOL = "EGLD" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/multiversx/mx-chain-go", 34 | "WHITEPAPER": "https://files.multiversx.com/multiversx-whitepaper.pdf", 35 | "WEBSITES": [ 36 | "https://multiversx.com", 37 | "https://multiversx.com/ecosystem" 38 | ] 39 | }) 40 | ECC = SLIP10Ed25519ECC 41 | COIN_TYPE = CoinTypes.MultiversX 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "MULTIVERSX": "MultiversX" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.MULTIVERSX 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/myriadcoin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x32 20 | SCRIPT_ADDRESS_PREFIX = 0x9 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = None 30 | WIF_PREFIX = 0xb2 31 | 32 | 33 | class Myriadcoin(ICryptocurrency): 34 | 35 | NAME = "Myriadcoin" 36 | SYMBOL = "XMY" 37 | INFO = Info({ 38 | "SOURCE_CODE": "https://github.com/myriadteam/myriadcoin", 39 | "WEBSITES": [ 40 | "http://myriadcoin.org" 41 | ] 42 | }) 43 | ECC = SLIP10Secp256k1ECC 44 | COIN_TYPE = CoinTypes.Myriadcoin 45 | SUPPORT_BIP38 = True 46 | NETWORKS = Networks({ 47 | "MAINNET": Mainnet 48 | }) 49 | DEFAULT_NETWORK = NETWORKS.MAINNET 50 | ENTROPIES = Entropies({ 51 | "BIP39" 52 | }) 53 | MNEMONICS = Mnemonics({ 54 | "BIP39" 55 | }) 56 | SEEDS = Seeds({ 57 | "BIP39" 58 | }) 59 | HDS = HDs({ 60 | "BIP32", "BIP44" 61 | }) 62 | DEFAULT_HD = HDS.BIP44 63 | ADDRESSES = Addresses({ 64 | "P2PKH", "P2SH" 65 | }) 66 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/near.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Ed25519ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | 26 | 27 | class Near(ICryptocurrency): 28 | 29 | NAME = "Near" 30 | SYMBOL = "NEAR" 31 | INFO = Info({ 32 | "SOURCE_CODE": "https://github.com/near/nearcore", 33 | "WHITEPAPER": "https://near.org/papers/the-official-near-white-paper", 34 | "WEBSITES": [ 35 | "https://near.org" 36 | ] 37 | }) 38 | ECC = SLIP10Ed25519ECC 39 | COIN_TYPE = CoinTypes.Near 40 | NETWORKS = Networks({ 41 | "MAINNET": Mainnet 42 | }) 43 | DEFAULT_NETWORK = NETWORKS.MAINNET 44 | ENTROPIES = Entropies({ 45 | "BIP39" 46 | }) 47 | MNEMONICS = Mnemonics({ 48 | "BIP39" 49 | }) 50 | SEEDS = Seeds({ 51 | "BIP39" 52 | }) 53 | HDS = HDs({ 54 | "BIP32", "BIP44" 55 | }) 56 | DEFAULT_HD = HDS.BIP44 57 | ADDRESSES = Addresses({ 58 | "NEAR": "Near" 59 | }) 60 | DEFAULT_ADDRESS = ADDRESSES.NEAR 61 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/neutron.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 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 = "neutron" 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 Neutron(ICryptocurrency): 30 | 31 | NAME = "Neutron" 32 | SYMBOL = "NTRN" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/neutron-org", 35 | "WHITEPAPER": "https://docs.neutron.org", 36 | "WEBSITES": [ 37 | "https://www.neutron.org" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Neutron 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "COSMOS": "Cosmos" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/ninechronicles.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class NineChronicles(ICryptocurrency): 29 | 30 | NAME = "Nine-Chronicles" 31 | SYMBOL = "NCG" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/planetarium/NineChronicles", 34 | "WEBSITES": [ 35 | "https://nine-chronicles.com", 36 | "https://presale.nine-chronicles.com" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.NineChronicles 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 | "ETHEREUM": "Ethereum" 60 | }) 61 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/oktchain.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "ex" 20 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 21 | "P2PKH": 0x0488ade4 22 | }) 23 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 24 | "P2PKH": 0x0488b21e 25 | }) 26 | WIF_PREFIX = 0x80 27 | 28 | 29 | class OKTChain(ICryptocurrency): 30 | 31 | NAME = "OKT-Chain" 32 | SYMBOL = "OKT" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/okex/okexchain", 35 | "WHITEPAPER": "https://okc-docs.readthedocs.io/en/latest", 36 | "WEBSITES": [ 37 | "https://www.okx.com/okc" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.OKTChain 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "OKT_CHAIN": "OKT-Chain" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.OKT_CHAIN 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/onix.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x4b 20 | SCRIPT_ADDRESS_PREFIX = 0x5 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = "ONIX Signed Message:\n" 30 | WIF_PREFIX = 0xcb 31 | 32 | 33 | class Onix(ICryptocurrency): 34 | 35 | NAME = "Onix" 36 | SYMBOL = "ONX" 37 | INFO = Info({ 38 | "SOURCE_CODE": "https://github.com/onix-project", 39 | "WEBSITES": [ 40 | "http://www.onixcoin.com" 41 | ] 42 | }) 43 | ECC = SLIP10Secp256k1ECC 44 | COIN_TYPE = CoinTypes.Onix 45 | SUPPORT_BIP38 = True 46 | NETWORKS = Networks({ 47 | "MAINNET": Mainnet 48 | }) 49 | DEFAULT_NETWORK = NETWORKS.MAINNET 50 | ENTROPIES = Entropies({ 51 | "BIP39" 52 | }) 53 | MNEMONICS = Mnemonics({ 54 | "BIP39" 55 | }) 56 | SEEDS = Seeds({ 57 | "BIP39" 58 | }) 59 | HDS = HDs({ 60 | "BIP32", "BIP44" 61 | }) 62 | DEFAULT_HD = HDS.BIP44 63 | ADDRESSES = Addresses({ 64 | "P2PKH", "P2SH" 65 | }) 66 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/ontology.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Nist256p1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, Params, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | 26 | 27 | class Ontology(ICryptocurrency): 28 | 29 | NAME = "Ontology" 30 | SYMBOL = "ONT" 31 | INFO = Info({ 32 | "SOURCE_CODE": "https://github.com/ontio/ontology", 33 | "WHITEPAPER": "https://docs.ont.io", 34 | "WEBSITES": [ 35 | "https://ont.io" 36 | ] 37 | }) 38 | ECC = SLIP10Nist256p1ECC 39 | COIN_TYPE = CoinTypes.Ontology 40 | NETWORKS = Networks({ 41 | "MAINNET": Mainnet 42 | }) 43 | DEFAULT_NETWORK = NETWORKS.MAINNET 44 | ENTROPIES = Entropies({ 45 | "BIP39" 46 | }) 47 | MNEMONICS = Mnemonics({ 48 | "BIP39" 49 | }) 50 | SEEDS = Seeds({ 51 | "BIP39" 52 | }) 53 | HDS = HDs({ 54 | "BIP32", "BIP44" 55 | }) 56 | DEFAULT_HD = HDS.BIP44 57 | ADDRESSES = Addresses({ 58 | "NEO": "Neo" 59 | }) 60 | DEFAULT_ADDRESS = ADDRESSES.NEO 61 | PARAMS = Params({ 62 | "ADDRESS_VERSION": 0x17 63 | }) 64 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/optimism.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class Optimism(ICryptocurrency): 29 | 30 | NAME = "Optimism" 31 | SYMBOL = "OP" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/ethereum-optimism", 34 | "WEBSITES": [ 35 | "https://www.optimism.io" 36 | ] 37 | }) 38 | ECC = SLIP10Secp256k1ECC 39 | COIN_TYPE = CoinTypes.Optimism 40 | NETWORKS = Networks({ 41 | "MAINNET": Mainnet 42 | }) 43 | DEFAULT_NETWORK = NETWORKS.MAINNET 44 | ENTROPIES = Entropies({ 45 | "BIP39" 46 | }) 47 | MNEMONICS = Mnemonics({ 48 | "BIP39" 49 | }) 50 | SEEDS = Seeds({ 51 | "BIP39" 52 | }) 53 | HDS = HDs({ 54 | "BIP32", "BIP44" 55 | }) 56 | DEFAULT_HD = HDS.BIP44 57 | ADDRESSES = Addresses({ 58 | "ETHEREUM": "Ethereum" 59 | }) 60 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 61 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/osmosis.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "osmo" 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 Osmosis(ICryptocurrency): 30 | 31 | NAME = "Osmosis" 32 | SYMBOL = "OSMO" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/osmosis-labs/osmosis", 35 | "WEBSITES": [ 36 | "https://osmosis.zone" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.Osmosis 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 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/polygon.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class Polygon(ICryptocurrency): 29 | 30 | NAME = "Polygon" 31 | SYMBOL = "MATIC" 32 | INFO = Info({ 33 | "WHITEPAPER": "https://github.com/maticnetwork/contracts", 34 | "WEBSITES": [ 35 | "https://github.com/maticnetwork/whitepaper", 36 | "https://polygon.technology" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.Polygon 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 | "ETHEREUM": "Ethereum" 60 | }) 61 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/poswcoin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x37 20 | SCRIPT_ADDRESS_PREFIX = 0x55 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = "\x18Poswcoin Signed Message:\n" 30 | WIF_PREFIX = 0xb7 31 | 32 | 33 | class PoSWCoin(ICryptocurrency): 34 | 35 | NAME = "PoSW-Coin" 36 | SYMBOL = "POSW" 37 | INFO = Info({ 38 | "WEBSITES": [ 39 | "https://posw.io" 40 | ] 41 | }) 42 | ECC = SLIP10Secp256k1ECC 43 | COIN_TYPE = CoinTypes.PoSWCoin 44 | SUPPORT_BIP38 = True 45 | NETWORKS = Networks({ 46 | "MAINNET": Mainnet 47 | }) 48 | DEFAULT_NETWORK = NETWORKS.MAINNET 49 | ENTROPIES = Entropies({ 50 | "BIP39" 51 | }) 52 | MNEMONICS = Mnemonics({ 53 | "BIP39" 54 | }) 55 | SEEDS = Seeds({ 56 | "BIP39" 57 | }) 58 | HDS = HDs({ 59 | "BIP32", "BIP44" 60 | }) 61 | DEFAULT_HD = HDS.BIP44 62 | ADDRESSES = Addresses({ 63 | "P2PKH", "P2SH" 64 | }) 65 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 66 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/scribe.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | PUBLIC_KEY_ADDRESS_PREFIX = 0x3c 20 | SCRIPT_ADDRESS_PREFIX = 0x7d 21 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 22 | "P2PKH": 0x488ade4, 23 | "P2SH": 0x488ade4 24 | }) 25 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 26 | "P2PKH": 0x488b21e, 27 | "P2SH": 0x488b21e 28 | }) 29 | MESSAGE_PREFIX = None 30 | WIF_PREFIX = 0x6e 31 | 32 | 33 | class Scribe(ICryptocurrency): 34 | 35 | NAME = "Scribe" 36 | SYMBOL = "SCRIBE" 37 | INFO = Info({ 38 | "SOURCE_CODE": "https://github.com/scribenetwork/scribe", 39 | "WEBSITES": [ 40 | "http://scribe.network" 41 | ] 42 | }) 43 | ECC = SLIP10Secp256k1ECC 44 | COIN_TYPE = CoinTypes.Scribe 45 | SUPPORT_BIP38 = True 46 | NETWORKS = Networks({ 47 | "MAINNET": Mainnet 48 | }) 49 | DEFAULT_NETWORK = NETWORKS.MAINNET 50 | ENTROPIES = Entropies({ 51 | "BIP39" 52 | }) 53 | MNEMONICS = Mnemonics({ 54 | "BIP39" 55 | }) 56 | SEEDS = Seeds({ 57 | "BIP39" 58 | }) 59 | HDS = HDs({ 60 | "BIP32", "BIP44" 61 | }) 62 | DEFAULT_HD = HDS.BIP44 63 | ADDRESSES = Addresses({ 64 | "P2PKH", "P2SH" 65 | }) 66 | DEFAULT_ADDRESS = ADDRESSES.P2PKH 67 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/secret.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "secret" 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 Secret(ICryptocurrency): 30 | 31 | NAME = "Secret" 32 | SYMBOL = "SCRT" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/scrtlabs/SecretNetwork", 35 | "WHITEPAPER": "https://docs.scrt.network", 36 | "WEBSITES": [ 37 | "https://scrt.network" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Secret 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "COSMOS": "Cosmos" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/shentu.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "certik" 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 Shentu(ICryptocurrency): 30 | 31 | NAME = "Shentu" # Certik old name 32 | SYMBOL = "CTK" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/ShentuChain", 35 | "WHITEPAPER": "https://www.shentu.technology/whitepaper", 36 | "WEBSITES": [ 37 | "https://www.shentu.technology" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Shentu 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "COSMOS": "Cosmos" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/solana.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Ed25519ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, Params, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | 26 | 27 | class Solana(ICryptocurrency): 28 | 29 | NAME = "Solana" 30 | SYMBOL = "SOL" 31 | INFO = Info({ 32 | "SOURCE_CODE": "https://github.com/solana-labs/solana", 33 | "WHITEPAPER": "https://solana.com/solana-whitepaper.pdf", 34 | "WEBSITES": [ 35 | "https://solana.com" 36 | ] 37 | }) 38 | ECC = SLIP10Ed25519ECC 39 | COIN_TYPE = CoinTypes.Solana 40 | NETWORKS = Networks({ 41 | "MAINNET": Mainnet 42 | }) 43 | DEFAULT_NETWORK = NETWORKS.MAINNET 44 | ENTROPIES = Entropies({ 45 | "BIP39" 46 | }) 47 | MNEMONICS = Mnemonics({ 48 | "BIP39" 49 | }) 50 | SEEDS = Seeds({ 51 | "BIP39" 52 | }) 53 | HDS = HDs({ 54 | "BIP32", "BIP44" 55 | }) 56 | DEFAULT_HD = HDS.BIP44 57 | ADDRESSES = Addresses({ 58 | "SOLANA": "Solana" 59 | }) 60 | DEFAULT_ADDRESS = ADDRESSES.SOLANA 61 | PARAMS = Params({ 62 | "ALPHABET": "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz" 63 | }) 64 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/stafi.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "stafi" 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 Stafi(ICryptocurrency): 30 | 31 | NAME = "Stafi" 32 | SYMBOL = "FIS" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/stafiprotocol/stafi-node", 35 | "WHITEPAPER": "https://docs.stafi.io", 36 | "WEBSITES": [ 37 | "https://www.stafi.io" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Stafi 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "COSMOS": "Cosmos" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/sui.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Ed25519ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, Params, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | 26 | 27 | class Sui(ICryptocurrency): 28 | 29 | NAME = "Sui" 30 | SYMBOL = "SUI" 31 | INFO = Info({ 32 | "SOURCE_CODE": "https://github.com/MystenLabs/sui", 33 | "WHITEPAPER": "https://docs.sui.io", 34 | "WEBSITES": [ 35 | "https://sui.io" 36 | ] 37 | }) 38 | ECC = SLIP10Ed25519ECC 39 | COIN_TYPE = CoinTypes.Sui 40 | NETWORKS = Networks({ 41 | "MAINNET": Mainnet 42 | }) 43 | DEFAULT_NETWORK = NETWORKS.MAINNET 44 | ENTROPIES = Entropies({ 45 | "BIP39" 46 | }) 47 | MNEMONICS = Mnemonics({ 48 | "BIP39" 49 | }) 50 | SEEDS = Seeds({ 51 | "BIP39" 52 | }) 53 | HDS = HDs({ 54 | "BIP32", "BIP44" 55 | }) 56 | DEFAULT_HD = HDS.BIP44 57 | ADDRESSES = Addresses({ 58 | "SUI": "Sui" 59 | }) 60 | DEFAULT_ADDRESS = ADDRESSES.SUI 61 | PARAMS = Params({ 62 | "KEY_TYPE": 0x00, 63 | "ADDRESS_PREFIX": "0x" 64 | }) 65 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/terra.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "terra" 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 Terra(ICryptocurrency): 30 | 31 | NAME = "Terra" 32 | SYMBOL = "LUNA" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/terra-money/core", 35 | "WHITEPAPER": "https://docs.terra.money", 36 | "WEBSITES": [ 37 | "https://terra.money" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Terra 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "COSMOS": "Cosmos" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.COSMOS 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/theta.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class Theta(ICryptocurrency): 29 | 30 | NAME = "Theta" 31 | SYMBOL = "THETA" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/thetatoken", 34 | "WHITEPAPER": "https://s3.us-east-2.amazonaws.com/assets.thetatoken.org/Theta-white-paper-latest.pdf?v=1553657855.509", 35 | "WEBSITES": [ 36 | "https://www.thetatoken.org" 37 | ] 38 | }) 39 | ECC = SLIP10Secp256k1ECC 40 | COIN_TYPE = CoinTypes.Theta 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 | "ETHEREUM": "Ethereum" 60 | }) 61 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 62 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/vechain.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class VeChain(ICryptocurrency): 29 | 30 | NAME = "VeChain" 31 | SYMBOL = "VET" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/vechain", 34 | "WHITEPAPER": "https://www.vechain.org/whitepaper/#bit_65sv8", 35 | "WEBSITES": [ 36 | "https://www.vechain.org", 37 | "https://vebetterdao.org" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.VeChain 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "ETHEREUM": "Ethereum" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.ETHEREUM 63 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/xinfin.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, Params, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 20 | "P2PKH": 0x0488ade4 21 | }) 22 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 23 | "P2PKH": 0x0488b21e 24 | }) 25 | WIF_PREFIX = 0x80 26 | 27 | 28 | class XinFin(ICryptocurrency): 29 | 30 | NAME = "XinFin" 31 | SYMBOL = "XDC" 32 | INFO = Info({ 33 | "SOURCE_CODE": "https://github.com/XinFinOrg/XDPoSChain", 34 | "WHITEPAPER": "https://xinfin.org/docs/whitepaper-tech.pdf", 35 | "WEBSITES": [ 36 | "https://www.xdc.org", 37 | "https://www.xinfin.org" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.XinFin 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "XINFIN": "XinFin" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.XINFIN 63 | PARAMS = Params({ 64 | "ADDRESS_PREFIX": "xdc" 65 | }) 66 | -------------------------------------------------------------------------------- /hdwallet/cryptocurrencies/zilliqa.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..slip44 import CoinTypes 8 | from ..ecc import SLIP10Secp256k1ECC 9 | from ..const import ( 10 | Info, Entropies, Mnemonics, Seeds, HDs, Addresses, Networks, XPrivateKeyVersions, XPublicKeyVersions 11 | ) 12 | from .icryptocurrency import ( 13 | ICryptocurrency, INetwork 14 | ) 15 | 16 | 17 | class Mainnet(INetwork): 18 | 19 | HRP = "zil" 20 | XPRIVATE_KEY_VERSIONS = XPrivateKeyVersions({ 21 | "P2PKH": 0x0488ade4 22 | }) 23 | XPUBLIC_KEY_VERSIONS = XPublicKeyVersions({ 24 | "P2PKH": 0x0488b21e 25 | }) 26 | WIF_PREFIX = 0x80 27 | 28 | 29 | class Zilliqa(ICryptocurrency): 30 | 31 | NAME = "Zilliqa" 32 | SYMBOL = "ZIL" 33 | INFO = Info({ 34 | "SOURCE_CODE": "https://github.com/Zilliqa/Zilliqa", 35 | "WHITEPAPER": "https://docs.zilliqa.com/whitepaper.pdf", 36 | "WEBSITES": [ 37 | "https://www.zilliqa.com" 38 | ] 39 | }) 40 | ECC = SLIP10Secp256k1ECC 41 | COIN_TYPE = CoinTypes.Zilliqa 42 | NETWORKS = Networks({ 43 | "MAINNET": Mainnet 44 | }) 45 | DEFAULT_NETWORK = NETWORKS.MAINNET 46 | ENTROPIES = Entropies({ 47 | "BIP39" 48 | }) 49 | MNEMONICS = Mnemonics({ 50 | "BIP39" 51 | }) 52 | SEEDS = Seeds({ 53 | "BIP39" 54 | }) 55 | HDS = HDs({ 56 | "BIP32", "BIP44" 57 | }) 58 | DEFAULT_HD = HDS.BIP44 59 | ADDRESSES = Addresses({ 60 | "ZILLIQA": "Zilliqa" 61 | }) 62 | DEFAULT_ADDRESS = ADDRESSES.ZILLIQA 63 | -------------------------------------------------------------------------------- /hdwallet/derivations/bip49.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import Tuple 8 | 9 | from .bip44 import BIP44Derivation 10 | 11 | 12 | class BIP49Derivation(BIP44Derivation): # https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki 13 | """ 14 | This class implements the BIP49 standard for hierarchical deterministic wallets. 15 | BIP49 defines a specific path structure for deriving keys from a master seed. 16 | 17 | .. note:: 18 | This class inherits from the ``BIP44Derivation`` class, thereby ensuring that all functions are accessible. 19 | """ 20 | 21 | _purpose: Tuple[int, bool] = (49, True) 22 | 23 | @classmethod 24 | def name(cls) -> str: 25 | """ 26 | Get the name of the derivation class. 27 | 28 | :return: The name of the derivation class. 29 | :rtype: str 30 | """ 31 | 32 | return "BIP49" 33 | -------------------------------------------------------------------------------- /hdwallet/derivations/bip84.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import Tuple 8 | 9 | from .bip44 import BIP44Derivation 10 | 11 | 12 | class BIP84Derivation(BIP44Derivation): # https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki 13 | """ 14 | This class implements the BIP84 standard for hierarchical deterministic wallets. 15 | BIP84 defines a specific path structure for deriving keys from a master seed. 16 | 17 | .. note:: 18 | This class inherits from the ``BIP44Derivation`` class, thereby ensuring that all functions are accessible. 19 | """ 20 | 21 | _purpose: Tuple[int, bool] = (84, True) 22 | 23 | @classmethod 24 | def name(cls) -> str: 25 | """ 26 | Get the name of the derivation class. 27 | 28 | :return: The name of the derivation class. 29 | :rtype: str 30 | """ 31 | 32 | return "BIP84" 33 | -------------------------------------------------------------------------------- /hdwallet/derivations/bip86.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import Tuple 8 | 9 | from .bip44 import BIP44Derivation 10 | 11 | 12 | class BIP86Derivation(BIP44Derivation): # https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki 13 | """ 14 | This class implements the BIP86 standard for hierarchical deterministic wallets. 15 | BIP86 defines a specific path structure for deriving keys from a master seed. 16 | 17 | .. note:: 18 | This class inherits from the ``BIP44Derivation`` class, thereby ensuring that all functions are accessible. 19 | """ 20 | 21 | _purpose: Tuple[int, bool] = (86, True) 22 | 23 | @classmethod 24 | def name(cls) -> str: 25 | """ 26 | Get the name of the derivation class. 27 | 28 | :return: The name of the derivation class. 29 | :rtype: str 30 | """ 31 | 32 | return "BIP86" 33 | -------------------------------------------------------------------------------- /hdwallet/ecc/iecc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from .ipoint import IPoint 8 | from .ipublic_key import IPublicKey 9 | from .iprivate_key import IPrivateKey 10 | 11 | 12 | class IEllipticCurveCryptography: 13 | """ 14 | Interface for Elliptic Curve Cryptography (ECC) representation. 15 | 16 | This interface defines the key components and attributes required 17 | for elliptic curve cryptography operations. It is intended to be 18 | implemented by specific ECC classes. 19 | """ 20 | 21 | NAME: str 22 | ORDER: int 23 | GENERATOR: IPoint 24 | POINT: IPoint 25 | PUBLIC_KEY: IPublicKey 26 | PRIVATE_KEY: IPrivateKey 27 | -------------------------------------------------------------------------------- /hdwallet/ecc/kholaw/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .ed25519 import ( 10 | KholawEd25519ECC, KholawEd25519Point, KholawEd25519PublicKey, KholawEd25519PrivateKey 11 | ) 12 | 13 | __all__: List[str] = [ 14 | "KholawEd25519ECC", "KholawEd25519Point", "KholawEd25519PublicKey", "KholawEd25519PrivateKey" 15 | ] 16 | -------------------------------------------------------------------------------- /hdwallet/ecc/kholaw/ed25519/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ...iecc import IEllipticCurveCryptography 8 | from ...slip10.ed25519 import SLIP10Ed25519ECC 9 | from .point import KholawEd25519Point 10 | from .public_key import KholawEd25519PublicKey 11 | from .private_key import KholawEd25519PrivateKey 12 | 13 | 14 | class KholawEd25519ECC(IEllipticCurveCryptography): 15 | 16 | NAME = "Kholaw-Ed25519" 17 | ORDER = SLIP10Ed25519ECC.ORDER 18 | GENERATOR = SLIP10Ed25519ECC.GENERATOR 19 | POINT = KholawEd25519Point 20 | PUBLIC_KEY = KholawEd25519PublicKey 21 | PRIVATE_KEY = KholawEd25519PrivateKey 22 | -------------------------------------------------------------------------------- /hdwallet/ecc/kholaw/ed25519/point.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ...slip10.ed25519 import SLIP10Ed25519Point 8 | 9 | 10 | class KholawEd25519Point(SLIP10Ed25519Point): 11 | 12 | @staticmethod 13 | def name() -> str: 14 | """ 15 | Get the name of the ecc class. 16 | 17 | :return: The name of the ecc class. 18 | :rtype: str 19 | """ 20 | 21 | return "Kholaw-Ed25519" 22 | -------------------------------------------------------------------------------- /hdwallet/ecc/kholaw/ed25519/public_key.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ...slip10.ed25519 import SLIP10Ed25519PublicKey 8 | from ...iecc import IPoint 9 | from .point import KholawEd25519Point 10 | 11 | 12 | class KholawEd25519PublicKey(SLIP10Ed25519PublicKey): 13 | 14 | @staticmethod 15 | def name() -> str: 16 | """ 17 | Get the name of the ecc class. 18 | 19 | :return: The name of the ecc class. 20 | :rtype: str 21 | """ 22 | 23 | return "Kholaw-Ed25519" 24 | 25 | def point(self) -> IPoint: 26 | """ 27 | Returns the point corresponding to the public key. 28 | 29 | :return: The point on the Ed25519 curve corresponding to the public key. 30 | :rtype: IPoint 31 | """ 32 | 33 | return KholawEd25519Point(bytes(self.verify_key)) 34 | 35 | -------------------------------------------------------------------------------- /hdwallet/ecc/slip10/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .ed25519 import ( 10 | SLIP10Ed25519ECC, SLIP10Ed25519Point, SLIP10Ed25519PublicKey, SLIP10Ed25519PrivateKey 11 | ) 12 | from .ed25519.blake2b import ( 13 | SLIP10Ed25519Blake2bECC, SLIP10Ed25519Blake2bPoint, SLIP10Ed25519Blake2bPublicKey, SLIP10Ed25519Blake2bPrivateKey 14 | ) 15 | from .ed25519.monero import ( 16 | SLIP10Ed25519MoneroECC, SLIP10Ed25519MoneroPoint, SLIP10Ed25519MoneroPublicKey, SLIP10Ed25519MoneroPrivateKey 17 | ) 18 | from .nist256p1 import ( 19 | SLIP10Nist256p1ECC, SLIP10Nist256p1Point, SLIP10Nist256p1PublicKey, SLIP10Nist256p1PrivateKey 20 | ) 21 | from .secp256k1 import ( 22 | SLIP10Secp256k1ECC, SLIP10Secp256k1Point, SLIP10Secp256k1PublicKey, SLIP10Secp256k1PrivateKey 23 | ) 24 | 25 | 26 | __all__: List[str] = [ 27 | "SLIP10Ed25519ECC", "SLIP10Ed25519Point", "SLIP10Ed25519PublicKey", "SLIP10Ed25519PrivateKey", 28 | "SLIP10Ed25519Blake2bECC", "SLIP10Ed25519Blake2bPoint", "SLIP10Ed25519Blake2bPublicKey", "SLIP10Ed25519Blake2bPrivateKey", 29 | "SLIP10Ed25519MoneroECC", "SLIP10Ed25519MoneroPoint", "SLIP10Ed25519MoneroPublicKey", "SLIP10Ed25519MoneroPrivateKey", 30 | "SLIP10Nist256p1ECC", "SLIP10Nist256p1Point", "SLIP10Nist256p1PublicKey", "SLIP10Nist256p1PrivateKey", 31 | "SLIP10Secp256k1ECC", "SLIP10Secp256k1Point", "SLIP10Secp256k1PublicKey", "SLIP10Secp256k1PrivateKey", 32 | ] 33 | 34 | -------------------------------------------------------------------------------- /hdwallet/ecc/slip10/ed25519/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ...iecc import IEllipticCurveCryptography 8 | from .point import SLIP10Ed25519Point 9 | from .public_key import SLIP10Ed25519PublicKey 10 | from .private_key import SLIP10Ed25519PrivateKey 11 | 12 | 13 | class SLIP10Ed25519ECC(IEllipticCurveCryptography): 14 | 15 | NAME = "SLIP10-Ed25519" 16 | ORDER = 2 ** 252 + 27742317777372353535851937790883648493 17 | GENERATOR = SLIP10Ed25519Point.from_coordinates( 18 | 15112221349535400772501151409588531511454012693041857206046113283949847762202, 19 | 46316835694926478169428394003475163141307993866256225615783033603165251855960 20 | ) 21 | POINT = SLIP10Ed25519Point 22 | PUBLIC_KEY = SLIP10Ed25519PublicKey 23 | PRIVATE_KEY = SLIP10Ed25519PrivateKey 24 | -------------------------------------------------------------------------------- /hdwallet/ecc/slip10/ed25519/blake2b/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ....iecc import IEllipticCurveCryptography 8 | from .. import SLIP10Ed25519ECC 9 | from .point import SLIP10Ed25519Blake2bPoint 10 | from .public_key import SLIP10Ed25519Blake2bPublicKey 11 | from .private_key import SLIP10Ed25519Blake2bPrivateKey 12 | 13 | 14 | class SLIP10Ed25519Blake2bECC(IEllipticCurveCryptography): 15 | 16 | NAME = "SLIP10-Ed25519-Blake2b" 17 | ORDER = SLIP10Ed25519ECC.ORDER 18 | GENERATOR = SLIP10Ed25519ECC.GENERATOR 19 | POINT = SLIP10Ed25519Blake2bPoint 20 | PUBLIC_KEY = SLIP10Ed25519Blake2bPublicKey 21 | PRIVATE_KEY = SLIP10Ed25519Blake2bPrivateKey 22 | -------------------------------------------------------------------------------- /hdwallet/ecc/slip10/ed25519/blake2b/point.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..point import SLIP10Ed25519Point 8 | 9 | 10 | class SLIP10Ed25519Blake2bPoint(SLIP10Ed25519Point): 11 | 12 | @staticmethod 13 | def name() -> str: 14 | """ 15 | Get the name of the ecc class. 16 | 17 | :return: The name of the ecc class. 18 | :rtype: str 19 | """ 20 | 21 | return "SLIP10-Ed25519-Blake2b" 22 | -------------------------------------------------------------------------------- /hdwallet/ecc/slip10/ed25519/monero/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ....iecc import IEllipticCurveCryptography 8 | from .. import SLIP10Ed25519ECC 9 | from .point import SLIP10Ed25519MoneroPoint 10 | from .public_key import SLIP10Ed25519MoneroPublicKey 11 | from .private_key import SLIP10Ed25519MoneroPrivateKey 12 | 13 | 14 | class SLIP10Ed25519MoneroECC(IEllipticCurveCryptography): 15 | 16 | NAME = "SLIP10-Ed25519-Monero" 17 | ORDER = SLIP10Ed25519ECC.ORDER 18 | GENERATOR = SLIP10Ed25519ECC.GENERATOR 19 | POINT = SLIP10Ed25519MoneroPoint 20 | PUBLIC_KEY = SLIP10Ed25519MoneroPublicKey 21 | PRIVATE_KEY = SLIP10Ed25519MoneroPrivateKey 22 | -------------------------------------------------------------------------------- /hdwallet/ecc/slip10/ed25519/monero/point.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..point import SLIP10Ed25519Point 8 | 9 | 10 | class SLIP10Ed25519MoneroPoint(SLIP10Ed25519Point): 11 | 12 | @staticmethod 13 | def name() -> str: 14 | """ 15 | Get the name of the ecc class. 16 | 17 | :return: The name of the ecc class. 18 | :rtype: str 19 | """ 20 | 21 | return "SLIP10-Ed25519-Monero" 22 | -------------------------------------------------------------------------------- /hdwallet/ecc/slip10/nist256p1/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ecdsa.ecdsa import generator_256 8 | 9 | from ...iecc import IEllipticCurveCryptography 10 | from .point import SLIP10Nist256p1Point 11 | from .public_key import SLIP10Nist256p1PublicKey 12 | from .private_key import SLIP10Nist256p1PrivateKey 13 | 14 | 15 | class SLIP10Nist256p1ECC(IEllipticCurveCryptography): 16 | 17 | NAME = "SLIP10-Nist256p1" 18 | ORDER = generator_256.order() 19 | GENERATOR = SLIP10Nist256p1Point(generator_256) 20 | POINT = SLIP10Nist256p1Point 21 | PUBLIC_KEY = SLIP10Nist256p1PublicKey 22 | PRIVATE_KEY = SLIP10Nist256p1PrivateKey 23 | -------------------------------------------------------------------------------- /hdwallet/entropies/algorand.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from .ientropy import IEntropy 8 | 9 | 10 | class ALGORAND_ENTROPY_STRENGTHS: 11 | """ 12 | Constants representing the entropy strengths for Algorand. 13 | """ 14 | 15 | TWO_HUNDRED_FIFTY_SIX: int = 256 16 | 17 | 18 | class AlgorandEntropy(IEntropy): 19 | """ 20 | Uses entropy to generate a mnemonic phrase specific to Algorand, 21 | ensuring secure account creation with a unique checksum for 22 | address verification. 23 | 24 | .. note:: 25 | This class inherits from the ``IEntropy`` class, thereby ensuring that all functions are accessible. 26 | 27 | Here are available ``ALGORAND_ENTROPY_STRENGTHS``: 28 | 29 | +-----------------------+-------+ 30 | | Name | Value | 31 | +=======================+=======+ 32 | | TWO_HUNDRED_FIFTY_SIX | 256 | 33 | +-----------------------+-------+ 34 | """ 35 | 36 | strengths = [ 37 | ALGORAND_ENTROPY_STRENGTHS.TWO_HUNDRED_FIFTY_SIX 38 | ] 39 | 40 | @classmethod 41 | def name(cls) -> str: 42 | """ 43 | Get the name of the entropy class. 44 | 45 | :return: The name of the entropy class. 46 | :rtype: str 47 | """ 48 | 49 | return "Algorand" 50 | -------------------------------------------------------------------------------- /hdwallet/entropies/electrum/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .v1 import ( 10 | ElectrumV1Entropy, ELECTRUM_V1_ENTROPY_STRENGTHS 11 | ) 12 | from .v2 import ( 13 | ElectrumV2Entropy, ELECTRUM_V2_ENTROPY_STRENGTHS 14 | ) 15 | 16 | 17 | __all__: List[str] = [ 18 | "ElectrumV1Entropy", 19 | "ELECTRUM_V1_ENTROPY_STRENGTHS", 20 | "ElectrumV2Entropy", 21 | "ELECTRUM_V2_ENTROPY_STRENGTHS" 22 | ] 23 | -------------------------------------------------------------------------------- /hdwallet/entropies/electrum/v1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from ..ientropy import IEntropy 8 | 9 | 10 | class ELECTRUM_V1_ENTROPY_STRENGTHS: 11 | """ 12 | Constants representing the entropy strengths for Electrum-V1. 13 | """ 14 | 15 | ONE_HUNDRED_TWENTY_EIGHT: int = 128 16 | 17 | 18 | class ElectrumV1Entropy(IEntropy): 19 | """ 20 | Relied on user input and simple entropy to generate a seed. It did not use a 21 | standardized mnemonic, leading to less secure key generation. 22 | 23 | .. note:: 24 | This class inherits from the ``IEntropy`` class, thereby ensuring that all functions are accessible. 25 | 26 | Here are available ``ELECTRUM_V1_ENTROPY_STRENGTHS``: 27 | 28 | +--------------------------+-------+ 29 | | Name | Value | 30 | +==========================+=======+ 31 | | ONE_HUNDRED_TWENTY_EIGHT | 128 | 32 | +--------------------------+-------+ 33 | """ 34 | 35 | strengths = [ 36 | ELECTRUM_V1_ENTROPY_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT 37 | ] 38 | 39 | @classmethod 40 | def name(cls) -> str: 41 | """ 42 | Get the name of the entropy class. 43 | 44 | :return: The name of the entropy class. 45 | :rtype: str 46 | """ 47 | 48 | return "Electrum-V1" 49 | -------------------------------------------------------------------------------- /hdwallet/entropies/monero.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from .ientropy import IEntropy 8 | 9 | 10 | class MONERO_ENTROPY_STRENGTHS: 11 | """ 12 | Constants for Monero entropy strengths. 13 | """ 14 | 15 | ONE_HUNDRED_TWENTY_EIGHT: int = 128 16 | TWO_HUNDRED_FIFTY_SIX: int = 256 17 | 18 | 19 | class MoneroEntropy(IEntropy): 20 | """ 21 | Uses high entropy to generate a 25-word mnemonic seed, with the last word acting 22 | as a checksum. This ensures secure generation of private spend and view keys. 23 | 24 | .. note:: 25 | This class inherits from the ``IEntropy`` class, thereby ensuring that all functions are accessible. 26 | 27 | Here are available ``MONERO_ENTROPY_STRENGTHS``: 28 | 29 | +--------------------------+-------+ 30 | | Name | Value | 31 | +==========================+=======+ 32 | | ONE_HUNDRED_TWENTY_EIGHT | 128 | 33 | +--------------------------+-------+ 34 | | TWO_HUNDRED_FIFTY_SIX | 256 | 35 | +--------------------------+-------+ 36 | """ 37 | 38 | strengths = [ 39 | MONERO_ENTROPY_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT, 40 | MONERO_ENTROPY_STRENGTHS.TWO_HUNDRED_FIFTY_SIX 41 | ] 42 | 43 | @classmethod 44 | def name(cls) -> str: 45 | """ 46 | Get the name of the entropy class. 47 | 48 | :return: The name of the entropy class. 49 | :rtype: str 50 | """ 51 | 52 | return "Monero" 53 | -------------------------------------------------------------------------------- /hdwallet/hds/electrum/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .v1 import ElectrumV1HD 10 | from .v2 import ElectrumV2HD 11 | 12 | 13 | __all__: List[str] = [ 14 | "ElectrumV1HD", 15 | "ElectrumV2HD" 16 | ] 17 | -------------------------------------------------------------------------------- /hdwallet/info.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | __name__: str = "hdwallet" 10 | __version__: str = "v3.4.0" 11 | __license__: str = "MIT" 12 | __author__: str = "Meheret Tesfaye Batu" 13 | __email__: str = "meherett.batu@gmail.com" 14 | __documentation__: str = "https://hdwallet.readthedocs.com" 15 | __description__: str = "Python-based library for the implementation of a Hierarchical Deterministic (HD) Wallet generator supporting more than 200 cryptocurrencies." 16 | __url__: str = "https://hdwallet.io" 17 | __source__: str = "https://github.com/talonlab/python-hdwallet" 18 | __changelog__: str = f"{__source__}/blob/master/CHANGELOG.md" 19 | __tracker__: str = f"{__source__}/issues" 20 | __keywords__: List[str] = [ 21 | "ecc", "kholaw", "slip10", "ed25519", "nist256p1", "secp256k1", # ECC keywords 22 | "hd", "bip32", "bip44", "bip49", "bip84", "bip86", "bip141", "monero", "cardano", # HD keywords 23 | "entropy", "mnemonic", "seed", "bip39", "algorand", "electrum", # Entropy, Mnemonic and Seed keywords 24 | "cryptocurrencies", "bitcoin", "ethereum", "cryptography", "cli", "cip1852" # Other keywords 25 | ] 26 | __websites__: List[str] = [ 27 | "https://talonlab.org", 28 | "https://talonlab.gitbook.io/hdwallet", 29 | __documentation__, 30 | "https://hdwallet.online", 31 | "https://hd.wallet", # On Web3 domain 32 | __url__ 33 | ] 34 | -------------------------------------------------------------------------------- /hdwallet/libs/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | -------------------------------------------------------------------------------- /hdwallet/libs/base32.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | from typing import Optional 4 | 5 | import base64 6 | import binascii 7 | 8 | 9 | alphabet: str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567" 10 | 11 | 12 | def add_padding(data: str) -> str: 13 | last_block_width = len(data) % 8 14 | if last_block_width != 0: 15 | data += (8 - last_block_width) * "=" 16 | return data 17 | 18 | 19 | def translate_alphabet(data: str, from_alphabet: str, to_alphabet: str) -> str: 20 | return data.translate(str.maketrans(from_alphabet, to_alphabet)) 21 | 22 | 23 | def decode(data: str, custom_alphabet: Optional[str] = None) -> str: 24 | try: 25 | data_decode = add_padding(data) 26 | if custom_alphabet: 27 | data_decode = translate_alphabet(data_decode, custom_alphabet, alphabet) 28 | 29 | return base64.b32decode(data_decode).hex() 30 | except binascii.Error as ex: 31 | raise ValueError("Invalid Base32 string") from ex 32 | 33 | 34 | def encode(data: str, custom_alphabet: Optional[str] = None) -> str: 35 | b32_encode: str = base64.b32encode(binascii.unhexlify(data)).decode("utf-8") 36 | if custom_alphabet: 37 | b32_encode = translate_alphabet(b32_encode, alphabet, custom_alphabet) 38 | 39 | return b32_encode 40 | 41 | 42 | def encode_no_padding(data: str, custom_alphabet: Optional[str] = None) -> str: 43 | return encode(data, custom_alphabet).rstrip("=") 44 | -------------------------------------------------------------------------------- /hdwallet/mnemonics/algorand/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .mnemonic import ( 10 | AlgorandMnemonic, ALGORAND_MNEMONIC_WORDS, ALGORAND_MNEMONIC_LANGUAGES 11 | ) 12 | 13 | 14 | __all__: List[str] = [ 15 | "AlgorandMnemonic", 16 | "ALGORAND_MNEMONIC_WORDS", 17 | "ALGORAND_MNEMONIC_LANGUAGES" 18 | ] 19 | -------------------------------------------------------------------------------- /hdwallet/mnemonics/bip39/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .mnemonic import ( 10 | BIP39Mnemonic, BIP39_MNEMONIC_WORDS, BIP39_MNEMONIC_LANGUAGES 11 | ) 12 | 13 | 14 | __all__: List[str] = [ 15 | "BIP39Mnemonic", 16 | "BIP39_MNEMONIC_WORDS", 17 | "BIP39_MNEMONIC_LANGUAGES" 18 | ] 19 | -------------------------------------------------------------------------------- /hdwallet/mnemonics/electrum/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .v1 import ( 10 | ElectrumV1Mnemonic, ELECTRUM_V1_MNEMONIC_WORDS, ELECTRUM_V1_MNEMONIC_LANGUAGES 11 | ) 12 | from .v2 import ( 13 | ElectrumV2Mnemonic, ELECTRUM_V2_MNEMONIC_WORDS, ELECTRUM_V2_MNEMONIC_LANGUAGES, ELECTRUM_V2_MNEMONIC_TYPES 14 | ) 15 | 16 | __all__: List[str] = [ 17 | "ElectrumV1Mnemonic", "ELECTRUM_V1_MNEMONIC_WORDS", "ELECTRUM_V1_MNEMONIC_LANGUAGES", 18 | "ElectrumV2Mnemonic", "ELECTRUM_V2_MNEMONIC_WORDS", "ELECTRUM_V2_MNEMONIC_LANGUAGES", "ELECTRUM_V2_MNEMONIC_TYPES" 19 | ] 20 | -------------------------------------------------------------------------------- /hdwallet/mnemonics/electrum/v1/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .mnemonic import ( 10 | ElectrumV1Mnemonic, ELECTRUM_V1_MNEMONIC_WORDS, ELECTRUM_V1_MNEMONIC_LANGUAGES 11 | ) 12 | 13 | 14 | __all__: List[str] = [ 15 | "ElectrumV1Mnemonic", 16 | "ELECTRUM_V1_MNEMONIC_WORDS", 17 | "ELECTRUM_V1_MNEMONIC_LANGUAGES" 18 | ] 19 | -------------------------------------------------------------------------------- /hdwallet/mnemonics/electrum/v2/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .mnemonic import ( 10 | ElectrumV2Mnemonic, ELECTRUM_V2_MNEMONIC_WORDS, ELECTRUM_V2_MNEMONIC_LANGUAGES, ELECTRUM_V2_MNEMONIC_TYPES 11 | ) 12 | 13 | 14 | __all__: List[str] = [ 15 | "ElectrumV2Mnemonic", 16 | "ELECTRUM_V2_MNEMONIC_WORDS", 17 | "ELECTRUM_V2_MNEMONIC_LANGUAGES", 18 | "ELECTRUM_V2_MNEMONIC_TYPES" 19 | ] 20 | -------------------------------------------------------------------------------- /hdwallet/mnemonics/monero/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .mnemonic import ( 10 | MoneroMnemonic, MONERO_MNEMONIC_WORDS, MONERO_MNEMONIC_LANGUAGES 11 | ) 12 | 13 | 14 | __all__: List[str] = [ 15 | "MoneroMnemonic", 16 | "MONERO_MNEMONIC_WORDS", 17 | "MONERO_MNEMONIC_LANGUAGES" 18 | ] 19 | -------------------------------------------------------------------------------- /hdwallet/seeds/electrum/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from typing import List 8 | 9 | from .v1 import ElectrumV1Seed 10 | from .v2 import ElectrumV2Seed 11 | 12 | 13 | __all__: List[str] = [ 14 | "ElectrumV1Seed", 15 | "ElectrumV2Seed" 16 | ] 17 | -------------------------------------------------------------------------------- /hdwallet/seeds/iseed.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2025, Meheret Tesfaye Batu 4 | # Distributed under the MIT software license, see the accompanying 5 | # file COPYING or https://opensource.org/license/mit 6 | 7 | from abc import ( 8 | ABC, abstractmethod 9 | ) 10 | from typing import Union 11 | 12 | import re 13 | 14 | from ..mnemonics import IMnemonic 15 | 16 | 17 | class ISeed(ABC): 18 | 19 | _name: str 20 | _seed: str 21 | 22 | length: int 23 | 24 | def __init__(self, seed: str, **kwargs) -> None: 25 | """ 26 | Initialize an object with a seed value. 27 | 28 | :param seed: The seed value used for initialization. 29 | :type seed: str 30 | 31 | :return: No return 32 | :rtype: NoneType 33 | """ 34 | 35 | self._seed = seed 36 | 37 | @classmethod 38 | def name(cls) -> str: 39 | pass 40 | 41 | @classmethod 42 | def is_valid(cls, seed: str) -> bool: 43 | """ 44 | Checks if the given seed is valid. 45 | 46 | :param seed: Hex string representing seed 47 | :type seed: str 48 | 49 | :return: True if is valid, False otherwise. 50 | :rtype: bool 51 | """ 52 | 53 | return isinstance(seed, str) and bool(re.fullmatch( 54 | r'^[0-9a-fA-F]+$', seed 55 | )) and len(seed) == cls.length 56 | 57 | def seed(self) -> str: 58 | """ 59 | Retrieves the seed associated with the current instance. 60 | 61 | :return: The seed as a string. 62 | :rtype: str 63 | """ 64 | 65 | return self._seed 66 | 67 | @classmethod 68 | @abstractmethod 69 | def from_mnemonic(cls, mnemonic: Union[str, IMnemonic]) -> str: 70 | pass 71 | -------------------------------------------------------------------------------- /make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=docs 11 | set BUILDDIR=build 12 | 13 | if "%1" == "" goto help 14 | 15 | %SPHINXBUILD% >NUL 2>NUL 16 | if errorlevel 9009 ( 17 | echo. 18 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 19 | echo.installed, then set the SPHINXBUILD environment variable to point 20 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 21 | echo.may add the Sphinx directory to PATH. 22 | echo. 23 | echo.If you don't have Sphinx installed, grab it from 24 | echo.http://sphinx-doc.org/ 25 | exit /b 1 26 | ) 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = tests/ 3 | python_files = test_*.py 4 | addopts = -vv -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | ecdsa>=0.18.0,<1 2 | crcmod>=1.7,<2 3 | pycryptodome>=3.20,<4 4 | ed25519-blake2b>=1.4.1,<2 5 | coincurve>=20.0.0,<21 6 | pynacl>=1.5.0,<2 7 | base58>=2.1.1,<3 8 | cbor2>=5.6.1,<6 -------------------------------------------------------------------------------- /requirements/cli.txt: -------------------------------------------------------------------------------- 1 | click>=8.1.7,<9 2 | click-aliases>=1.0.5,<2 3 | tabulate>=0.9.0,<1 4 | bip38>=1.3.1,<2 -------------------------------------------------------------------------------- /requirements/docs.txt: -------------------------------------------------------------------------------- 1 | sphinx>=8.1.3,<9 2 | sphinx-click>=6.0.0,<7 3 | furo==2024.8.6 -------------------------------------------------------------------------------- /requirements/tests.txt: -------------------------------------------------------------------------------- 1 | pytest>=8.3.2,<9 2 | coverage>=7.6.4,<8 3 | tox>=4.23.2,<5 -------------------------------------------------------------------------------- /tests/cli/test_cli_entropy.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | 10 | from hdwallet.cli.__main__ import cli_main 11 | 12 | 13 | def test_cli_entropy(data, cli_tester): 14 | 15 | for client in data["entropies"].keys(): 16 | for strength in data["entropies"][client].keys(): 17 | cli = cli_tester.invoke( 18 | cli_main, [ 19 | "generate", "entropy", 20 | "--client", client, 21 | "--strength", strength 22 | ] 23 | ) 24 | 25 | output = json.loads(cli.output) 26 | assert cli.exit_code == 0 27 | 28 | assert output["client"] == client 29 | assert output["strength"] == int(strength) 30 | 31 | if client == "Electrum-V2": 32 | assert len(output["entropy"]) == len(data["entropies"][client][strength]["entropy-not-suitable"]) 33 | else: 34 | assert len(output["entropy"]) == len(data["entropies"][client][strength]["entropy"]) 35 | -------------------------------------------------------------------------------- /tests/cli/test_cli_lists.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | from os import path 9 | 10 | from hdwallet.cli.__main__ import cli_main 11 | 12 | 13 | def test_cryptocurrencies_list(cli_tester): 14 | cli = cli_tester.invoke( 15 | cli_main, [ 16 | "list", "c", 17 | ] 18 | ) 19 | 20 | assert cli.exit_code == 0 21 | 22 | file_path = path.abspath( 23 | path.join(path.dirname(__file__), 24 | "../data/raw/cryptocurrencies.txt") 25 | ) 26 | 27 | with open(file_path, "r") as values: 28 | assert cli.output.strip() == values.read().strip() 29 | 30 | def test_languages_list(cli_tester): 31 | cli = cli_tester.invoke( 32 | cli_main, [ 33 | "list", "l", 34 | ] 35 | ) 36 | 37 | assert cli.exit_code == 0 38 | 39 | file_path = path.abspath( 40 | path.join(path.dirname(__file__), 41 | "../data/raw/languages.txt") 42 | ) 43 | 44 | with open(file_path, "r") as values: 45 | assert cli.output.strip() == values.read().strip() 46 | 47 | 48 | def test_strengths_list(cli_tester): 49 | cli = cli_tester.invoke( 50 | cli_main, [ 51 | "list", "s", 52 | ] 53 | ) 54 | 55 | assert cli.exit_code == 0 56 | 57 | file_path = path.abspath( 58 | path.join(path.dirname(__file__), 59 | "../data/raw/strengths.txt") 60 | ) 61 | 62 | with open(file_path, "r") as values: 63 | assert cli.output.strip() == values.read().strip() 64 | 65 | -------------------------------------------------------------------------------- /tests/conftest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | from click.testing import CliRunner 9 | 10 | import os 11 | import json 12 | import pytest 13 | 14 | @pytest.fixture(scope="session", name="data") 15 | def load_test_data(): 16 | base_path = os.path.dirname(__file__) 17 | jsons = os.listdir(os.path.join(base_path, f"data/json/")) 18 | data = {} 19 | 20 | for json_file in jsons: 21 | file_path = os.path.join(base_path, f"data/json/{json_file}") 22 | with open(file_path, "r", encoding="utf-8") as values: 23 | test_data_name = json_file.split(".")[0] 24 | data[test_data_name] = json.load(values) 25 | return data 26 | 27 | 28 | @pytest.fixture(scope="module") 29 | def cli_tester(): 30 | return CliRunner() 31 | -------------------------------------------------------------------------------- /tests/data/raw/languages.txt: -------------------------------------------------------------------------------- 1 | Algorand Languages 2 | -------------------- 3 | English 4 | 5 | 6 | BIP39 Languages 7 | ------------------- 8 | Chinese-Simplified 9 | Chinese-Traditional 10 | Czech 11 | English 12 | French 13 | Italian 14 | Japanese 15 | Korean 16 | Portuguese 17 | Russian 18 | Spanish 19 | Turkish 20 | 21 | 22 | Electrum-V1 Languages 23 | ----------------------- 24 | English 25 | 26 | 27 | Electrum-V2 Languages 28 | ----------------------- 29 | Chinese-Simplified 30 | English 31 | Portuguese 32 | Spanish 33 | 34 | 35 | Monero Languages 36 | ------------------ 37 | Chinese-Simplified 38 | Dutch 39 | English 40 | French 41 | German 42 | Italian 43 | Japanese 44 | Portuguese 45 | Russian 46 | Spanish 47 | 48 | 49 | -------------------------------------------------------------------------------- /tests/data/raw/strengths.txt: -------------------------------------------------------------------------------- 1 | Algorand Strengths 2 | -------------------- 3 | 256 4 | 5 | 6 | BIP39 Strengths 7 | ----------------- 8 | 128 9 | 160 10 | 192 11 | 224 12 | 256 13 | 14 | 15 | Electrum-V1 Strengths 16 | ----------------------- 17 | 128 18 | 19 | 20 | Electrum-V2 Strengths 21 | ----------------------- 22 | 132 23 | 264 24 | 25 | 26 | Monero Strengths 27 | ------------------ 28 | 128 29 | 256 30 | -------------------------------------------------------------------------------- /tests/hdwallet/addresses/test_slip10_ed25519_blake2b_addresses.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.addresses.nano import NanoAddress 13 | 14 | 15 | def test_nano_address(data): 16 | 17 | assert NanoAddress.name() == data["addresses"]["SLIP10-Ed25519-Blake2b"]["addresses"]["Nano"]["name"] 18 | assert NanoAddress.encode( 19 | public_key=data["addresses"]["SLIP10-Ed25519-Blake2b"]["public-key"] 20 | ) == data["addresses"]["SLIP10-Ed25519-Blake2b"]["addresses"]["Nano"]["encode"] 21 | 22 | assert NanoAddress.decode( 23 | address=data["addresses"]["SLIP10-Ed25519-Blake2b"]["addresses"]["Nano"]["encode"] 24 | ) == data["addresses"]["SLIP10-Ed25519-Blake2b"]["addresses"]["Nano"]["decode"] 25 | 26 | -------------------------------------------------------------------------------- /tests/hdwallet/addresses/test_slip10_ed25519_monero_addresses.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.addresses.monero import MoneroAddress 13 | 14 | 15 | def test_monero_address(data): 16 | 17 | assert MoneroAddress.name() == data["addresses"]["SLIP10-Ed25519-Monero"]["name"] 18 | assert MoneroAddress.encode( 19 | spend_public_key=data["addresses"]["SLIP10-Ed25519-Monero"]["spend-public-key"], 20 | view_public_key=data["addresses"]["SLIP10-Ed25519-Monero"]["view-public-key"], 21 | payment_id=data["addresses"]["SLIP10-Ed25519-Monero"]["args"]["payment_id"] 22 | ) == data["addresses"]["SLIP10-Ed25519-Monero"]["encode"] 23 | 24 | spend_public_key, view_public_key = MoneroAddress.decode( 25 | address=data["addresses"]["SLIP10-Ed25519-Monero"]["encode"], 26 | payment_id=data["addresses"]["SLIP10-Ed25519-Monero"]["args"]["payment_id"] 27 | ) 28 | assert spend_public_key == data["addresses"]["SLIP10-Ed25519-Monero"]["spend-public-key"] 29 | assert view_public_key == data["addresses"]["SLIP10-Ed25519-Monero"]["view-public-key"] 30 | -------------------------------------------------------------------------------- /tests/hdwallet/addresses/test_slip10_nist256p1_addresses.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.addresses.neo import NeoAddress 13 | 14 | 15 | def test_neo_address(data): 16 | 17 | assert NeoAddress.name() == data["addresses"]["SLIP10-Nist256p1"]["addresses"]["Neo"]["name"] 18 | assert NeoAddress.encode( 19 | public_key=data["addresses"]["SLIP10-Nist256p1"]["public-key"] 20 | ) == data["addresses"]["SLIP10-Nist256p1"]["addresses"]["Neo"]["encode"] 21 | 22 | assert NeoAddress.decode( 23 | address=data["addresses"]["SLIP10-Nist256p1"]["addresses"]["Neo"]["encode"] 24 | ) == data["addresses"]["SLIP10-Nist256p1"]["addresses"]["Neo"]["decode"] 25 | 26 | -------------------------------------------------------------------------------- /tests/hdwallet/derivations/test_derivation_electrum.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.derivations.electrum import ElectrumDerivation 13 | from hdwallet.exceptions import DerivationError 14 | 15 | 16 | def test_electrum_derivation(data): 17 | 18 | derivation = ElectrumDerivation() 19 | assert derivation.name() == data["derivations"]["Electrum"]["default"]["name"] 20 | assert derivation.change() == data["derivations"]["Electrum"]["default"]["change"] 21 | assert derivation.address() == data["derivations"]["Electrum"]["default"]["address"] 22 | 23 | derivation = ElectrumDerivation( 24 | change=data["derivations"]["Electrum"]["from"]["change"], 25 | address=data["derivations"]["Electrum"]["from"]["address"] 26 | 27 | ) 28 | assert derivation.change() == data["derivations"]["Electrum"]["from"]["change"] 29 | assert derivation.address() == data["derivations"]["Electrum"]["from"]["address"] 30 | 31 | derivation.clean() 32 | assert derivation.change() == data["derivations"]["Electrum"]["default"]["change"] 33 | assert derivation.address() == data["derivations"]["Electrum"]["default"]["address"] 34 | 35 | derivation = ElectrumDerivation() 36 | derivation.from_change(data["derivations"]["Electrum"]["from"]["change"]) 37 | derivation.from_address(data["derivations"]["Electrum"]["from"]["address"]) 38 | assert derivation.change() == data["derivations"]["Electrum"]["from"]["change"] 39 | assert derivation.address() == data["derivations"]["Electrum"]["from"]["address"] 40 | -------------------------------------------------------------------------------- /tests/hdwallet/derivations/test_derivation_monero.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.derivations.monero import MoneroDerivation 13 | from hdwallet.exceptions import DerivationError 14 | 15 | 16 | def test_monero_derivation(data): 17 | 18 | derivation = MoneroDerivation() 19 | assert derivation.name() == data["derivations"]["Monero"]["default"]["name"] 20 | assert derivation.minor() == data["derivations"]["Monero"]["default"]["minor"] 21 | assert derivation.major() == data["derivations"]["Monero"]["default"]["major"] 22 | 23 | derivation = MoneroDerivation( 24 | minor=data["derivations"]["Monero"]["from"]["minor"], 25 | major=data["derivations"]["Monero"]["from"]["major"] 26 | 27 | ) 28 | assert derivation.minor() == data["derivations"]["Monero"]["from"]["minor"] 29 | assert derivation.major() == data["derivations"]["Monero"]["from"]["major"] 30 | 31 | derivation.clean() 32 | assert derivation.minor() == data["derivations"]["Monero"]["default"]["minor"] 33 | assert derivation.major() == data["derivations"]["Monero"]["default"]["major"] 34 | 35 | derivation = MoneroDerivation() 36 | derivation.from_minor(data["derivations"]["Monero"]["from"]["minor"]) 37 | derivation.from_major(data["derivations"]["Monero"]["from"]["major"]) 38 | assert derivation.minor() == data["derivations"]["Monero"]["from"]["minor"] 39 | assert derivation.major() == data["derivations"]["Monero"]["from"]["major"] 40 | -------------------------------------------------------------------------------- /tests/hdwallet/entropies/test_entropies_algorand.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.entropies.algorand import ( 13 | AlgorandEntropy, ALGORAND_ENTROPY_STRENGTHS 14 | ) 15 | from hdwallet.utils import get_bytes 16 | from hdwallet.exceptions import EntropyError 17 | 18 | 19 | def test_algorand_entropy(data): 20 | 21 | assert ALGORAND_ENTROPY_STRENGTHS.TWO_HUNDRED_FIFTY_SIX == 256 22 | assert AlgorandEntropy.is_valid_strength(strength=ALGORAND_ENTROPY_STRENGTHS.TWO_HUNDRED_FIFTY_SIX) 23 | assert AlgorandEntropy.is_valid_bytes_strength(bytes_strength=len(get_bytes(data["entropies"]["Algorand"]["256"]["entropy"]))) 24 | assert AlgorandEntropy(entropy=AlgorandEntropy.generate(strength=ALGORAND_ENTROPY_STRENGTHS.TWO_HUNDRED_FIFTY_SIX)).strength() == 256 25 | 26 | algorand_256 = AlgorandEntropy(entropy=data["entropies"]["Algorand"]["256"]["entropy"]) 27 | 28 | assert algorand_256.name() == data["entropies"]["Algorand"]["256"]["name"] 29 | assert algorand_256.strength() == data["entropies"]["Algorand"]["256"]["strength"] 30 | assert algorand_256.entropy() == data["entropies"]["Algorand"]["256"]["entropy"] 31 | 32 | with pytest.raises(EntropyError, match="Invalid entropy data"): 33 | AlgorandEntropy(entropy="INVALID_ENTROPY") 34 | 35 | with pytest.raises(EntropyError, match="Unsupported entropy strength"): 36 | AlgorandEntropy(entropy="cdf694ac868efd01673fc51e897c57a0bd428503080ad4c94c7d6f6d13f095fbc8") 37 | -------------------------------------------------------------------------------- /tests/hdwallet/entropies/test_entropies_electrum_v1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.entropies.electrum.v1 import ( 13 | ElectrumV1Entropy, ELECTRUM_V1_ENTROPY_STRENGTHS 14 | ) 15 | from hdwallet.utils import get_bytes 16 | from hdwallet.exceptions import EntropyError 17 | 18 | 19 | def test_electrum_v1_entropy(data): 20 | 21 | assert ELECTRUM_V1_ENTROPY_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT == 128 22 | assert ElectrumV1Entropy.is_valid_strength(strength=ELECTRUM_V1_ENTROPY_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT) 23 | assert ElectrumV1Entropy.is_valid_bytes_strength(bytes_strength=len(get_bytes(data["entropies"]["Electrum-V1"]["128"]["entropy"]))) 24 | assert ElectrumV1Entropy(entropy=ElectrumV1Entropy.generate(strength=ELECTRUM_V1_ENTROPY_STRENGTHS.ONE_HUNDRED_TWENTY_EIGHT)).strength() == 128 25 | 26 | ev1_128 = ElectrumV1Entropy(entropy=data["entropies"]["Electrum-V1"]["128"]["entropy"]) 27 | 28 | assert ev1_128.name() == data["entropies"]["Electrum-V1"]["128"]["name"] 29 | assert ev1_128.strength() == data["entropies"]["Electrum-V1"]["128"]["strength"] 30 | assert ev1_128.entropy() == data["entropies"]["Electrum-V1"]["128"]["entropy"] 31 | 32 | with pytest.raises(EntropyError, match="Invalid entropy data"): 33 | ElectrumV1Entropy(entropy="INVALID_ENTROPY") 34 | 35 | with pytest.raises(EntropyError, match="Unsupported entropy strength"): 36 | ElectrumV1Entropy(entropy="cdf694ac868efd01673fc51e897c57a0bd428503080ad4c94c7d6f6d13f095fbc8") 37 | -------------------------------------------------------------------------------- /tests/hdwallet/hds/test_hds_monero.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | from hdwallet.cryptocurrencies import Monero 9 | from hdwallet.hds.monero import MoneroHD 10 | 11 | 12 | def test_monero_hd(data): 13 | 14 | monero_hd = MoneroHD( 15 | network=Monero.NETWORKS.MAINNET 16 | ) 17 | 18 | monero_hd.from_seed( 19 | seed=data["hds"]["Monero"]["seed"] 20 | ) 21 | 22 | assert isinstance(monero_hd, MoneroHD) 23 | 24 | assert monero_hd.name() == data["hds"]["Monero"]["name"] 25 | assert monero_hd.seed() == data["hds"]["Monero"]["seed"] 26 | 27 | assert monero_hd.spend_private_key() == data["hds"]["Monero"]["spend-private-key"] 28 | assert monero_hd.view_private_key() == data["hds"]["Monero"]["view-private-key"] 29 | assert monero_hd.spend_public_key() == data["hds"]["Monero"]["spend-public-key"] 30 | assert monero_hd.view_public_key() == data["hds"]["Monero"]["view-public-key"] 31 | assert monero_hd.primary_address() == data["hds"]["Monero"]["primary-address"] 32 | assert monero_hd.integrated_address( 33 | payment_id=data["hds"]["Monero"]["payment-id"] 34 | ) == data["hds"]["Monero"]["integrated-address"] 35 | 36 | for address in data["hds"]["Monero"]["sub-addresses"]: 37 | assert monero_hd.sub_address( 38 | minor=address["minor"], major=address["major"] 39 | ) == address["address"] 40 | -------------------------------------------------------------------------------- /tests/hdwallet/seeds/test_seeds_algorand.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.seeds.algorand import AlgorandSeed 13 | 14 | 15 | def test_algorand_seeds(data): 16 | assert AlgorandSeed.from_mnemonic( 17 | mnemonic=data["seeds"]["Algorand"]["25"]["english"]["mnemonic"] 18 | ) == data["seeds"]["Algorand"]["25"]["english"]["non-passphrase-seed"] 19 | 20 | -------------------------------------------------------------------------------- /tests/hdwallet/seeds/test_seeds_bip39.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.seeds.bip39 import BIP39Seed 13 | 14 | 15 | def test_bip39_seeds(data): 16 | 17 | for words in data["seeds"]["BIP39"].keys(): 18 | for lang in data["seeds"]["BIP39"][words].keys(): 19 | assert BIP39Seed.from_mnemonic( 20 | mnemonic= data["seeds"]["BIP39"][words][lang]["mnemonic"] 21 | ) == data["seeds"]["BIP39"][words][lang]["non-passphrase-seed"] 22 | 23 | for passphrase in data["seeds"]["BIP39"][words][lang]["passphrases"].keys(): 24 | assert BIP39Seed.from_mnemonic( 25 | mnemonic= data["seeds"]["BIP39"][words][lang]["mnemonic"], passphrase=passphrase 26 | ) == data["seeds"]["BIP39"][words][lang]["passphrases"][passphrase] 27 | 28 | assert BIP39Seed.from_mnemonic( 29 | mnemonic= data["seeds"]["BIP39"][words][lang]["mnemonic"], passphrase=passphrase 30 | ) == data["seeds"]["BIP39"][words][lang]["passphrases"][passphrase] 31 | 32 | -------------------------------------------------------------------------------- /tests/hdwallet/seeds/test_seeds_electrum_v1.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.seeds.electrum.v1 import ElectrumV1Seed 13 | 14 | 15 | def test_electrum_v1_seeds(data): 16 | assert ElectrumV1Seed.from_mnemonic( 17 | mnemonic=data["seeds"]["Electrum-V1"]["12"]["english"]["mnemonic"] 18 | ) == data["seeds"]["Electrum-V1"]["12"]["english"]["non-passphrase-seed"] 19 | 20 | -------------------------------------------------------------------------------- /tests/hdwallet/seeds/test_seeds_monero.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import json 9 | import os 10 | import pytest 11 | 12 | from hdwallet.seeds.monero import MoneroSeed 13 | 14 | 15 | def test_monero_seeds(data): 16 | 17 | for words in data["seeds"]["Monero"].keys(): 18 | for lang in data["seeds"]["Monero"][words].keys(): 19 | assert MoneroSeed.from_mnemonic( 20 | mnemonic=data["seeds"]["Monero"][words][lang]["mnemonic"] 21 | ) == data["seeds"]["Monero"][words][lang]["non-passphrase-seed"] 22 | 23 | -------------------------------------------------------------------------------- /tests/test_exceptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright © 2020-2024, Meheret Tesfaye Batu 4 | # 2024, Eyoel Tadesse 5 | # Distributed under the MIT software license, see the accompanying 6 | # file COPYING or https://opensource.org/license/mit 7 | 8 | import pytest 9 | 10 | from hdwallet.exceptions import Error 11 | 12 | 13 | def test_exception(): 14 | class TestError(Error): 15 | pass 16 | 17 | with pytest.raises(TestError, match="Error"): 18 | raise TestError(message="Error") 19 | 20 | with pytest.raises(TestError, match="more_detail"): 21 | raise TestError(message = "Error", detail="more_detail") 22 | 23 | with pytest.raises(TestError, match="value_expect"): 24 | raise TestError(message = "Error", expected="value_expect") 25 | 26 | with pytest.raises(TestError, match="value_got"): 27 | raise TestError(message = "Error", expected="value_expect", got="value_got") 28 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | # Tox configuration for testing across multiple Python versions with coverage reporting 2 | 3 | [tox] 4 | envlist = python39,python310,python311,python312,python313 5 | skipsdist = True 6 | 7 | [testenv] 8 | commands_pre = python -m pip install --upgrade pip 9 | install_command = pip install -e .[cli,tests,docs] 10 | allowlist_externals = 11 | coverage 12 | pytest 13 | commands = 14 | coverage run -m pytest 15 | coverage report 16 | --------------------------------------------------------------------------------