Blockchain tutorial 28: Bitcoin Improvement Proposal 39 (BIP-39) mnemonic words

in #blockchain7 years ago

Blockchain tutorial 28: Bitcoin Improvement Proposal 39 (BIP-39) mnemonic words

This is part 28 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.

WHAT IS A WALLET

A wallet stores private keys.
The word wallet is misleading, it just stores private keys and not the coins.
The public addresses are automatically derived from the private keys.
If you open your Bitcoin wallet and one of your Bitcoin addresses shows that is has a balance of 5 BTC, than these bitcoins are not actually stored in your wallet.
It means that these 5 bitcoins were transferred to your Bitcoin address during a transaction.
This transaction (TX) information is stored on the blockchain.
Your wallet queries the blockchain and searches for Unspent TX Outputs (UTXO) for all your Bitcoin addresses to display their balances.
The bitcoins on these UTXO can be unlocked and transferred to another Bitcoin address using the private keys stored in the wallet.

NON-DETERMINISTIC WALLET

Wallets stores private keys but they also create these private keys.
The private keys are randomly generated numbers which are not related to each other.
You can not derive these private keys with an algorithm.

Hence the words "non-deterministic".

If you use a non-deterministic wallet you must make regular backups of these private keys.
If you have problems with your wallet, you can restore your wallet by importing the backupped private keys.
Explaining a non-deterministic wallet (for educational purpose only), see:
https://www.mobilefish.com/services/cryptocurrency/cryptocurrency.html

DETERMINISTIC WALLET

A deterministic wallet uses 12 - 24 words to create a 512 bit seed.
These words are called mnemonic words, because they are more easily to remember than this long hexadecimal string.
The 512 bit seed is used to create a master private key.
This master private key in turn is used to create private keys and corresponding public addresses.

Generally speaking using these 12 - 24 words will complete restore your wallet with exactly the same private keys and corresponding public addresses.
Hence the word "deterministic".
It is imperative that you safely store these 12 - 24 words, without it you have no access to your private keys.
To see how an Ethereum deterministic wallet works, see YouTube movie

BIP-39

The acronym BIP means Bitcoin Improvement Proposal.
BIPs are design documents for introducing features or information to Bitcoin.

An overview can be found at:
https://github.com/bitcoin/bips
BIP-39 describes the implementation of mnemonic words for the generation of deterministic wallets, see:
https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
BIP-39 is becoming an industry standard which is not only used for Bitcoin wallets but it is also used in Ethereum, Dash and other Altcoin wallets.

The wordlist can be found at:
https://github.com/bitcoin/bips/blob/master/bip-0039/bip-0039-wordlists.md

For additional security you can allow users to enter a passphrase.

Use the Password-Based Key Derivation Function 2 (PBKDF2) together with the mnemonic phrase and salt to produce a 512 bits seed.
If an attacker gets its hands on your mnemonic words the passphrase (it you have set it) will prevent the attacker to access the private keys.
PBKDF2 is purposefully made slow to make brute force dictionary attack very difficult.

The 512 bit seed is used to generate deterministic wallets.
How to generate deterministic wallets is explained in BIP-32 and BIP-44.
It is important to know that each time you enter a different passphrase it will generate a valid 512 bit seed and thus a valid wallet with valid public and private key pairs.
This feature can help you limit your loss after a 5$ wrench attack.
You can setup a second deterministic wallet with some coins to satisfy the attacker.
If you do not know what a 5$ wrench attack is watch this comic:
https://xkcd.com/538/
Storing your passphrase at the same location as your mnemonic words is not recommended and beats the purpose.
But if you lose your passphrase, you have lost access to your coins.

A JavaScript implementation of BIP-39 can be found at:
https://github.com/bitcoinjs/bip39

How this JavaScript library is used see:
https://www.mobilefish.com/download/ethereum/bip39.html

A Mnemonic Code Converter web application can be found at:
https://iancoleman.github.io/bip39

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

Coin Marketplace

STEEM 0.19
TRX 0.17
JST 0.030
BTC 80568.31
ETH 3220.00
USDT 1.00
SBD 2.80