Code Monkey home page Code Monkey logo

py_hd_wallet's Introduction

py_hd_wallet

** 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:

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

py_hd_wallet's People

Contributors

hoangkimduc avatar nthtson avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.