Trending Technology Machine Learning, Artificial Intelligent, Block Chain, IoT, DevOps, Data Science

Recent Post

Codecademy Code Foundations

Search This Blog

Hierarchical Deterministic wallet - BIP32 and BIP44

Deterministic Wallet

In blockchain page we are explained BIP-39

BIP-39 describes how the mnemonic words are created. These mnemonic words together with a password (optionally) is used to generate a 512 bit seed.

In this page the 512 bit seed is also called the "BIP-39 seed".

This seed is used as input to generate private and public keys for deterministic wallets.

There are two types of deterministic wallets:
  • Sequential deterministic wallets.
  • Hierarchical deterministic wallets
Sequential Deterministic Wallet
  • Sequential deterministic wallets generates private keys for example by taking SHA256 (seed + n), where n is an index number that starts from 0 and increments as additional keys are needed (simplified explanation).

Hierarchical Deterministic Wallet

Nowadays most wallet are Hierarchical Deterministic (HD) wallets.

This wallet type is described at :
http://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki


Most HD wallet vendors have implemented BIP-32, BIP-39 and BIP-44.

These 3 Bitcoin Improvement Proposals are becoming an industry standard.

If your HD wallet is BIP 32/39/44 compliant than you can "transfer" your private keys to another from vendor which also implemented these standards. However implemented of these standards can differ. For example a vendor implementing BIP-39 uses his own wordlist, making his wallet not compatible with other vendors.

 BIP - 39

BIP - 39 describes the implemented of mnemonic words to generate a 512 bit seed. This seed can be used to creste a HD wallet.

More information about BIP - 39 can be found at :
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki

BIP - 32

BIP - 32 describes how you can build a general hierarchical deterministic wallet. These wallets can be shared partially or entirely with different systems, each with or without the ability to spend coins.





BIP-32 explains how master keys and master chain code are created from BIP - 39 seed. The chain code is used as entropy in the Child Key Derivation (CDK) function.




BIP - 32 Child Key Derivation (CKD)




Using different index numbers (i) will create different unlinkable child keys from the same parent keys.

Repeating the procedure for the child keys using child chain code will create unlinkable grandchild keys.

By changing the chain code, a new node (aka wallet) is create.

Extended public (xpub) keys can only generate public keys. This is perfect if you want a wallet which can only watch your account balances or receives coins but you can not sign any transactions because there are no private keys available.

A wallet created with an extended private (xprv) key can generate public keys and private keys.

 BIP - 44

BIP - 44 defines a specific logical hierarchy for deterministic wallets based on an algorithm described in BIP - 32.
m/purpose' / coin_type' / account'/ change/ address_index

The letter m denoted the master node and all hierarchical levels are separated  with slashes (/). m is level 0, purpose is level 1, coin_type is level 2 etc.

The purpose scheme is described in BIP-43. Because we are using BIP44 scheme we should use 44'

The apostrophe (for example in purpose') indicates hardened derivation.






No comments:

Post a Comment

Popular Articles