Code Monkey home page Code Monkey logo

mhdw's Introduction

mhdw

Multiformat HD Wallet tools

mhdw is a command-line application to handle Hierarchical Deterministic Key creation and derivation.

HD wallets (see BIP32) are used by multiple cryptocurrencies.

mdhw allows to generate a master seed, which can be then used to produce the master private and public keys, and derivate payment addresses and WIF (Wallet Import Format) files for different cryptocurrencies.

Currently it supports:

  • Bitcoin
  • Zcash
  • Ethereum
  • Decred

mhdw is a diverging fork of hdkeyutils. While hdkeyutils saves and loads a master bitcoin-formatted key to perform derivation, mhdw saves and loads the original seed and uses it to recreate the key. This allows to more easily incorporate additional key formats, as Decred. Multisig key handling and operations are not supported for the moment.

Installation

go get github.com/hsanjuan/mhdw

Usage

NAME:
   mhdw - A command line utility for manipulating HD wallet keys

USAGE:
   mhdw [global options] command [command options] [arguments...]

VERSION:
   0.0.1

COMMANDS:
     seed     utilities to generate and handle multipurpose key-seeds
     priv     tools for working with HD master/derived private keys
     pub      tools for working with HD public keys and addresses
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Generating a seed

The seed is the key that holds any cryptocurrency sent to any of the subsequently derived addresses. Keep in mind that:

  • You should not lose the seed
  • You should keep it safe
  • You should make sure that a generated seed is truly random and cannot be re-generated by someone else

mhdw can generate random seeds with the mhdw seed gen command:

$ mhdw seed gen foo bar
Seed has been written to "seed.hex"

This is the mnemonic representation of the seed that is used to build your
private key and your HD wallets. Keep it safe!

-------------------------------------------------------------------------
<list of 65 words>
-------------------------------------------------------------------------

The result is a 512-bit seed which is hex-encoded and written to a file.

The command also prints a mnemonic representation of the seed (1-word per byte + 1 checksum word), which can be used to backup the seed offline or memorize it. mhdw provides utilities to recover the seed file from a mnemonic list of words and vice-versa.

Sending money and importing keys

To generate a payment address do:

$ mhdw pub child --format

You can then send cryptocurrency to that address.

When you want to manage that money or move it somewhere else, you will need to generate the corresponding private key using the same index:

$ mhdw priv child --format

The result can be imported as follows:

  • Bitcoin: bitcoin-cli importprivkey "<result>" true
  • Zcash: zcash-cli importprivkey "<result>" true
  • Decred: dcrctl --wallet importprivkey "<result>" true
  • Ethereum (store result in file): geth account import key.eth

In Bitcoin and Zcash, the amount received by the address will appear as unspent with listunspent and it can be moved out of the address by creating a raw transaction. For example:

$ zcash-cli createrawtransaction '[{"txid":"<txid_as_shown_by_listunspent>", "vout":<vout_shown_for_the_chosen_tx_in_listunspent>"}]' '{"<destinationaddress>":"<amount - fee>"}'
<raw_tx>
$ zcash-cli signrawtransaction "<raw_tx>"
{
  "hex": "<signed_tx>",
  "complete": true
}
$ zcash-cli sendrawtransaction "<signed_tx>"

In Ethereum, the imported key will become a new account which can be handled like any other accounts in geth.

In Decred, the imported key will become part of the imported pseudo-account and the associated credits will be shown as spendable and can be used as normal.

mhdw's People

Contributors

whyrusleeping avatar hsanjuan avatar

Stargazers

caivega avatar

Watchers

James Cloos avatar  avatar  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.