Giter Site home page Giter Site logo

hdtools's Introduction

hdtools Build Status

HD Tools for cyrptocurrencies like BTC, and BTCt base on mcdallas/cryptotools.

Requirements

  1. Create an virtualenv:
    virtualenv -p python3 .env
  2. Install requirements:
    pip install -r requirements
  3. Use library:
    from hdtools.extended_keys import *
    private_key = XPrv.from_mnemonic('mnemonic phrase')
    private_key.encode() 

How to install

pip install hdtools

Examples

Create HD Wallets

>>> from hdtools.extended_keys import *
>>> M = XPrv.from_mnemonic('lemon child success once board usual cigar buffalo video cheese kitten onion build axis dose')
>>> M.encode()
b'xprv9s21ZrQH143K38p5ouMV2qFYest2F3uRQC51JPLqsdi8Lh1rkXUJRUy1m7rd5TvooJn6gerthNmntuJag6e73mrf8GmG96Ua8rpayQtUEsL'

Address Generation

>>> (M/44./0./0./0/0).address('P2PKH')  # BIP44
b'1DgEh5Y6NioqaxHBBc2puDYq6SvG5NDsG9'
>>> (M/49./0./0./0/0).address('P2WPKH-P2SH')  # BIP49
b'39Qn8kHG6h7zv1Fh1iwjjyeRibx7gHTq1Z'
>>> (M/84./0./0./0/0).address('P2WPKH')  # BIP84
'bc1qrxxtlul9j3p95wrt33zg7vdf74skujnhnghaey'

Run tests

python3 -m uninttest

Run setup.py

python setup.py sdist bdist_wheel

hdtools's People

Contributors

professormahi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

hdtools's Issues

docs for noobs

Hi,
for newb like me, it will be great if there's more document on how to use your lib. for example, how to use it on testnet?

How to sign transactions

Hi,

I'm having trouble trying to understand how to use the extended_keys after I derived them using hdtools.
I generated my address in a similar way as the one you described in the README:
xprv = (m/44./0./0./0/0)
address = xprv.address()

I sent some BTC on a private regtest chain to this address and now I would like to understand how to send them back using hdtools.

Usually I would do this by creating a rawtransaction and signing it with the private key derived by the Bip39 online tool.

Is there a way to either retrieve the private key that can be used to sign a transaction from this address or, even better, directlly sign the transaction using xprv ?

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.