Blockchain tutorial 29: Hierarchical Deterministic wallet - BIP32 and BIP44
Mobilefish.com Mobilefish.com
28.3K subscribers
37,623 views
0

 Published On Oct 18, 2017

This is part 29 of the Blockchain tutorial.

In this video series different topics will be explained which will help you to understand blockchain.
It is recommended to watch each video sequentially as I may refer to certain Blockchain topics explained earlier.

DETERMINISTIC WALLET
BIP-39 describes how the mnemonic words are created.
These mnemonic words together with a password (optionally) are used to generate a 512 bit seed.
The 512 bit seed is also called the "BIP-39 seed".
This seed is used to create 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)

HIERARCHICAL DETERMINISTIC WALLET
Nowadays most wallets are Hierarchical Deterministic (HD) wallets.
More information:
https://github.com/bitcoin/bips/blob/...
Most HD wallet vendors have implemented BIP-32, BIP-39 and BIP-44.
These 3 Bitcoin Improvement Proposals are becoming an industry standard.

BIP-39
BIP-39 describes the implementation of mnemonic words to generate a 512 bit seed.
More information:
https://github.com/bitcoin/bips/blob/...

BIP-32
BIP-32 describes how you can build a general hierarchical deterministic wallet.
More information:
https://github.com/bitcoin/bips/blob/...
https://bitcoin.org/en/developer-guid...
If you want to see how BIP32 is implemented in the bitcoinjs library, see:
https://raw.githubusercontent.com/bit...

Online web application:
https://www.mobilefish.com/download/e...

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

Using different index numbers will create different unlinkable child keys from the same parent keys.
Repeating the procedure for the child keys using the child chain code will create unlinkable grandchild keys.
By changing the chain code, a new node (aka wallet) is created.

Extended private (xprv) keys can create a complete branch with child private keys and child public keys
Extended public (xpub) keys can only generate public keys.

BIP-44
BIP-44 defines a specific logical hierarchy for deterministic wallets based on an algorithm described in BIP-32.
More information:
https://github.com/bitcoin/bips/blob/...

BIP-44 uses the following derivation path: m/purpose'/coin_type'/account'/change/address_index
The letter m denotes 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.
More information:
https://github.com/satoshilabs/slips/...

account level can be seen as bank account types, for example payment account, savings account etc.
change level is also known as "external / internal level" where external (0) is used for addresses that are meant to be visible outside of the wallet (receiving payments) and internal (1) is used for addresses which are not meant to be visible outside of the wallet (signing transactions).
address_index is a sequence of addresses starting at 0.

BIP-44 XPRV AND XPUB DEMONSTRATION
Suppose a webshop wants to receive payments in only in ETH.
For each payment received a different Ethereum address must be used.
The webshop should use a wallet containing only public keys.
The webshop wallet uses a xpub key with derivation path: m/44'/60'/0'/0
This wallet creates the following addresses:
m/44'/60'/0'/0/0
m/44'/60'/0'/0/..
The accounting department uses another wallet containing the same public keys AND accompanied private keys.
The accounting department can transfer payments made on these public addresses and transfer it to a separate accounting address.
This is possible because they have access to the private keys.
The accounting department wallet uses a xprv key with the same derivation path: m/44'/60'/0'/0

BIP-32 RISK
If a hacker gets it hands on any child private key and the account xpub key, the hacker can recompute the account xprv key and thus have access to every private and public key descending from the account level.
More information:
https://github.com/bitcoin/bips/blob/...

Check out all my other Blockchain tutorial videos
https://goo.gl/aMTFHU

Subscribe to my YouTube channel
https://goo.gl/61NFzK

The presentation used in this video tutorial can be found at:
https://www.mobilefish.com/developer/...

#mobilefish #blockchain #bitcoin #cryptocurrency #ethereum

show more

Share/Embed