Skip to main content

py_hdwallet

** A multi crypto-currencies HD wallet implemented by Python. **

BIP32 (or HD for “hierarchical deterministic”) wallets allow you to create child wallets which can only generate public keys and don’t expose a private key to an insecure server. The implementation is based on the proposal BIP32, BIP39 and is currently in audit mode. Please do not use in production yet. Testing welcome.

This library simplify the process of creating new wallets for the BTC, BTG, BCH, ETH, LTC, DASH, DOGE, ZEC, XRP, ZCASH and XLM.

Most of the code here is copied from:

  • Ran Aroussi’s pywallet <https://github.com/ranaroussi/pywallet>

  • Devrandom’s pymultiwallet <https://github.com/devrandom/pymultiwallet>

  • Reverbel’s seed-phrases-for-stellar <https://github.com/reverbel/seed-phrases-for-stellar>

I simply added support for a few more crypto-currencies.


Installation

Install via PiP:

$ sudo pip install py_hd_wallet

Example code:

Create HD Wallet

The following code creates a new Bitcoin HD wallet:

# create_btc_wallet.py

from py_hd_wallet import wallet

# generate 12 word mnemonic seed
seed = wallet.generate_mnemonic()

# create bitcoin wallet
w = wallet.create_wallet(network="bitcoin", seed=seed, children=1)
print(w)

# wallets = wallet.create_wallet(network="BTC", seed=seed, children=1)
# wallets = wallet.create_wallet(network="ETH", seed=seed, children=1)
# wallets = wallet.create_wallet(network="XRP", seed=seed, children=1)
# wallets = wallet.create_wallet(network="ZCASH", seed=seed, children=1)
# wallets = wallet.create_wallet(network="XLM", seed=seed, children=1)
# wallets = wallet.create_wallet(network="stellar_testnet", seed=seed, children=1)

Output looks like this:

$ python create_btc_wallet.py

{
  "coin": "BTC",
  "seed": "guess tiny intact poet process segment pelican bright assume avocado view lazy",
  "address": "1HwPm2tcdakwkTTWU286crWQqTnbEkD7av",
  "xprivate_key": "xprv9s21ZrQH143K2Dizn667UCo9oYPdTPSMWq7D5t929aXf1kfnmW79CryavzBxqbWfrYzw8jbyTKvsiuFNwr1JL2qfrUy2Kbwq4WbBPfxYGbg",
  "xpublic_key": "xpub661MyMwAqRbcEhoTt7d7qLjtMaE7rrACt42otGYdhv4dtYzwK3RPkfJ4nEjpFQDdT8JjT3VwQ3ZKjJaeuEdpWmyw16sY9SsoY68PoXaJvfU",
  "wif": "L1EnVJviG6jR2oovFbfxZoMp1JknTACKLzsTKqDNUwATCWpY1Fp4",
  "children": [{
     "address": "1nDWAr2v1wNv6ZkjQ3GJCZq1HUHCHm1wZ",
    "address": "1nDWAr2v1wNv6ZkjQ3GJCZq1HUHCHm1wZ",
     "path": "m/0",
     "wif": "KysRDiwJNkS9VPzy1UH76DrCDizsWKtEooSzikich792RVzcUaJP"
 }]
}

* Valid options for network are: BTC, BTG, BCH, LTC, DASH, DOGE, XRP, ZCASH and XLM

Metadata

Release files for py-hd-wallet 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for py-hd-wallet 0.1
File Interpreter ABI Platform Actions
py_hd_wallet-0.1-py3-none-any.whl Python 3 none any Details for py_hd_wallet-0.1-py3-none-any.whl

Release files / py_hd_wallet-0.1-py3-none-any.whl

Download URL py_hd_wallet-0.1-py3-none-any.whl
Size 13.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8cc3ab0d72fecb4eb0f189bd45ad7ff1d1d6a30d06326376b9dfd1166c4644b7
BLAKE2b-256 checksum
How to use checksums
51d06b573380dbc880fa5110af301d8e25b0ce6de4544568f849aa4b5bb563b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.6

Security for py-hd-wallet 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page