Bitcoin Forum
May 07, 2024, 01:40:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Master Private Key for Beginner  (Read 426 times)
blue Snow (OP)
Legendary
*
Offline Offline

Activity: 1498
Merit: 1024


#SWGT CERTIK Audited


View Profile WWW
November 13, 2020, 01:42:02 AM
 #1

Master Private Key (MPK) comes from Seed generated from Hierarchical Deterministic (HD) Wallet.

from MPK we can generate Million public (BTC address) and private key. when still curious about detail, you have read the source: A, B, C.



MPK is Important, you can restore your wallet using it. I don't exactly understand how to get MPK from various BIP39 Wallet. But you can get MPK by running https://github.com/iancoleman/bip39/releases offline. Just Import 12 or 24 mnemonic seed into BIP39 Mnemonic box, scrolling down Html and you will find BIP32 Root Key and Account Extended Private Key.

Example:

BIP39 24 Mnemonic Seed
Code:
board produce disorder rib behave harbor border pudding radar hip episode loud energy attack friend idle badge click arctic bridge real rotate link choose

BIP32 Root Key
Code:
xprv9s21ZrQH143K413FYiGja2j6ErRSWgZdVfopfqgaNSEJuDkgauSVvw2oCRAXEV6hsi4f9TTxZ5TNNky4zb5vCewdACPnw3XNLKcTzJpMK3U

Account Extended Private Key
Code:
xprv9ymVnwPJTZpaUsFLPnSSpqwCqWZgW3ddFhbnwEbQBK2xkjsstMx2dpF5jhemPXaHhSj7mx3bzAVPRb66aewsDQt8qM7nPunfiLRSYS3mwXX

Public key (BTC address)
Code:
1W8QEako617xt2R1F6jQqx1k6qF25uQAB
14LrwCWqR4nYzLzDaDjgURtXfcnAJGyiTe
17a4wdA4QmNKm2Q82waWehQuWTDuTBJd3D
16YrfyvfzzpXAQ188TVdbR2MzD1sp8neVZ
19L8MKgSDHSHFKhmJ7majiZ1AH1iPSTuC6
1FZ8sJkerQrc8PNPgWJ7zBaaw2k1Hwvr2g
1NiBBgWt4yfPL6M5EcRbQa48mjLYv3Um3c
1BuVM5skScCLngMhnusbMqytdb2JuQHM1f
19UWDgvdhPBdsm54HbGyQwdyWvdtNWK9js
1NiHRRYgQPHKNKrEJMsSMLLQsfXQy7C3HQ
18ffV1ErZQWbEMb5XBXWLvwn2JNiJd1oBi





Okay, Let's experience, close Iancoleman Html, and open it again by import BIP32 Root Key to BIP32 Root Key box, Are you got the same public key? Of course yes. we will get the same BTC Address. But can we get the same address by importing Account Extended Private Key into the BIP32 Root Key box?, of course, yes, but you need Clicking specific path - BIP32 tab, The BIP32 derivation path and extended keys are the basis for the derived addresses.

Okay, Let's experience by importing BIP32 Root Key into electrum wallet. Create new wallet, on keystore box ticking use master key,

you will get address:
Code:
1L1oES4VVTVPhzC1ELDpyRH1CB7x13eiDY
1M5xHAJTKGFkz9Lh7sMoURLLbBjmKcDwPq
16mjp7TkWRYXiT4f1MvgpwoPYpBNnm1d2L
1Nh63pNWKmtP8mLz64SbJHxWskhumHJxLV
12xZpEEJUgPQFF7Gef4eCo7RupFQHrq9jr
159KmH1wZoUYVnpeqyyJtYhccjHxQWGgbH
16LSzyxnfhxNvTJkn9EYpZ5EwBM4msyKRi
126nQtKwr4Ln4YmyvFBd9C8TDH3DzWuYVb
1GjrMQhvH9x9JGSXkzWU1vo6JdVXkQFsWw
1PPTfF7TfqBv1H59hkHXMBNDh5AGKJXmXd
1L9BNXffxA39Fhi5VvgxoRifCG2NZ7eswq

It will get the same address if importing it into Iancoleman HTML to BIP32 Root Key box and select BIP 32 in Derivation Path.

How to get the same address when importing MPK into electrum?, by importing Account Extended Private Key into Keystore box when begin to create a new wallet.





Can we import electrum MPK? sure. I did a test. how to get MPK?, go to console and write getmasterprivate()

Electrum Seed
Code:
east alpha glare jealous federal rail bless staff banner unfold crystal excite

Master Private Key
Code:
zprvAZrVEE8P7AUEdxJZFPgVz9cuDbYackc5Gnk6F8ekEMFdCDa7icALWk9edVxT3hm2gqF8sqEEWR8vzaxnWAGqi6wUbh8Hpi5Ng7R8xXRpme8

Public key (BTC address)
Code:
bc1qymy0auqu48yzd9aqswfzu753txu6rsux6epm0h
bc1qfxrjyq78z7puvcjegfx957vldhfdawjzwcsdv9
bc1qv2g455q2cfwn7nzzp0h7qd5cg73wzh2u3z4jyy
bc1qxhp3eukw9qt9ptvf6rfgem4hy90xtrxy68kmaj
bc1qx3mc6390qud2uyn8tkyja7a7hy9we82vjrt9yy
bc1qysz4gtl3jr0jsyrv4xquc44nfscff94vqwvkkk
bc1q7yxjm6ed5ck5gty35x4epzep7rfjqj43h97tcr
bc1q3aayrtmgseugru39cj7fwhaqjak22lwstm7thp
bc1qdzfcxymmy6fwkcghj5m754elj2myk80pmzkfzs
bc1qnwrwky7gdm8lwv0w94sxj86kg5ghfk63hsu6nq
bc1qygmtr6x0a62yc3nrys2t575v8d2256yuu397e4

By importing MPK into BIP32 Root Key in iancoleman html then select BIP141 on derivation path tab, choose P2PWKH



You will get the same address as an Electrum wallet.





Okay, this guide may be difficult when reading either, you must practice using that tool and create your own experience using it. because Experience Is The Best Teacher

Creating this guide, beginners do not worried if you lost a wallet and still keeping MPK only, but it's more technically difficult to recover an account. So, please keep you 12 or 24 seed in a safe place you will be saved.

A. https://learnmeabitcoin.com/beginners/keys_addresses
B. https://bitcointalk.org/index.php?topic=19137
C. https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
D. https://ethereum.stackexchange.com/questions/40821/difference-between-account-extended-private-key-and-bip32-extended-private-key

1715089255
Hero Member
*
Offline Offline

Posts: 1715089255

View Profile Personal Message (Offline)

Ignore
1715089255
Reply with quote  #2

1715089255
Report to moderator
There are several different types of Bitcoin clients. The most secure are full nodes like Bitcoin Core, but full nodes are more resource-heavy, and they must do a lengthy initial syncing process. As a result, lightweight clients with somewhat less security are commonly used.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715089255
Hero Member
*
Offline Offline

Posts: 1715089255

View Profile Personal Message (Offline)

Ignore
1715089255
Reply with quote  #2

1715089255
Report to moderator
1715089255
Hero Member
*
Offline Offline

Posts: 1715089255

View Profile Personal Message (Offline)

Ignore
1715089255
Reply with quote  #2

1715089255
Report to moderator
SquirrelJulietGarden
Hero Member
*****
Offline Offline

Activity: 1316
Merit: 727



View Profile
November 13, 2020, 02:27:38 AM
Merited by Quickseller (3), cryptomaniac_xxx (2)
 #2

Chapter 5. Wallets (in Mastering bitcoin)

With same seed, you can create a Masterkey, and Child keys then Grandchild keys

Quote
HD Wallets (BIP-32/BIP-44)
Deterministic wallets were developed to make it easy to derive many keys from a single "seed." The most advanced form of deterministic wallets is the HD wallet defined by the BIP-32 standard. HD wallets contain keys derived in a tree structure, such that a parent key can derive a sequence of children keys, each of which can derive a sequence of grandchildren keys, and so on, to an infinite depth. This tree structure is illustrated in Type-2 HD wallet: a tree of keys generated from a single seed.

https://github.com/bitcoinbook/bitcoinbook/raw/develop/images/mbc2_0503.png (the image link can not display)

Figure 3. Type-2 HD wallet: a tree of keys generated from a single seed
HD wallets offer two major advantages over random (nondeterministic) keys. First, the tree structure can be used to express additional organizational meaning, such as when a specific branch of subkeys is used to receive incoming payments and a different branch is used to receive change from outgoing payments. Branches of keys can also be used in corporate settings, allocating different branches to departments, subsidiaries, specific functions, or accounting categories.

The second advantage of HD wallets is that users can create a sequence of public keys without having access to the corresponding private keys. This allows HD wallets to be used on an insecure server or in a receive-only capacity, issuing a different public key for each transaction. The public keys do not need to be preloaded or derived in advance, yet the server doesn’t have the private keys that can spend the funds.


███▄▀██▄▄
░░▄████▄▀████ ▄▄▄
░░████▄▄▄▄░░█▀▀
███ ██████▄▄▀█▌
░▄░░███▀████
░▐█░░███░██▄▄
░░▄▀░████▄▄▄▀█
░█░▄███▀████ ▐█
▀▄▄███▀▄██▄
░░▄██▌░░██▀
░▐█▀████ ▀██
░░█▌██████ ▀▀██▄
░░▀███
▄▄██▀▄███
▄▄▄████▀▄████▄░░
▀▀█░░▄▄▄▄████░░
▐█▀▄▄█████████
████▀███░░▄░
▄▄██░███░░█▌░
█▀▄▄▄████░▀▄░░
█▌████▀███▄░█░
▄██▄▀███▄▄▀
▀██░░▐██▄░░
██▀████▀█▌░
▄██▀▀██████▐█░░
███▀░░
blue Snow (OP)
Legendary
*
Offline Offline

Activity: 1498
Merit: 1024


#SWGT CERTIK Audited


View Profile WWW
November 14, 2020, 12:13:29 PM
 #3

Chapter 5. Wallets (in Mastering bitcoin)
With same seed, you can create a Masterkey, and Child keys then Grandchild keys



Yes, but only created once master key right?. this means we can save that master key only. In my previous post about Derivation Path child key was in index, where 1 is the second address, etc.

https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki#Private_parent_key_rarr_public_child_key

Charles-Tim
Legendary
*
Offline Offline

Activity: 1540
Merit: 4850



View Profile
November 14, 2020, 01:28:36 PM
Merited by DdmrDdmr (1)
 #4

MPK is Important, you can restore your wallet using it. I don't exactly understand how to get MPK from various BIP39 Wallet.
Using mastering bitcoin to know how to understand how to get master private key from seed phrase will be helpful.



After the seed phrase is generated, then the seed is generated by key stretching function in which PBKDF2 stretches the mnemonic and salt parameters using 2048 rounds of hashing with the HMAC-SHA512 algorithm, producing a 512-bit value as its final output. That 512-bit value is the seed.



From the seed, then the master private key, master public key and master chain code are generated.

Creating master keys and chain code from a root seed
The root seed is input into the HMAC-SHA512 algorithm and the resulting hash is used to create a master private key (m) and a master chain code. The master private key then generates a corresponding master public key (M) using the normal elliptic curve multiplication process m * G that we saw in [pubkey]. The chain code is used to introduce entropy in the function that creates child keys from parent keys, as we will see in the next section.
https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc

But, I will advice people to just use normal hd wallet to generate seed phrase instead (offline recommended), it is easy to write down for back, import and export if compared to master private key. Using seed phrase will be easier, but master private key has the advantage to be able to be compatible with all bitcoin wallets.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
blue Snow (OP)
Legendary
*
Offline Offline

Activity: 1498
Merit: 1024


#SWGT CERTIK Audited


View Profile WWW
November 17, 2020, 11:33:25 AM
 #5

but master private key has the advantage to be able to be compatible with all bitcoin wallets.
the beginner must be careful, every extended MPK had a specific derivation path, they must know they address using legacy, nested or native segwit.

webtricks
Legendary
*
Offline Offline

Activity: 1918
Merit: 1728


View Profile
November 17, 2020, 04:11:49 PM
Merited by joniboini (5), Welsh (4), DdmrDdmr (1)
 #6

But, I will advice people to just use normal hd wallet to generate seed phrase instead (offline recommended), it is easy to write down for back, import and export if compared to master private key. Using seed phrase will be easier, but master private key has the advantage to be able to be compatible with all bitcoin wallets.

Seed phrase and master private key are equally compatible with all wallets. Master private key is generated using seed phrase itself like you said. Master Private key is nothing but the left 256 bits of hash generated using HMAC-512 hashing of key-stretched seed phrase and 'Bitcoin seed' as the constant salt. So, I can use master private key as well as seed phrase to access same addresses in all wallets.

Example:

Seed Phrase: trade people mad crash chaos axis grocery amateur decorate winter visit crazy
Master Private Key: eede74442e041d530edb68ff7c709cd171e185205031b40a227fff0f966c3170
BIP32 Root Key: xprv9s21ZrQH143K2D2Xt47bnkaT8ysB5RhUdA6hbpGuVoq3PsNjDAP9FxW75AGQiwb25RCYmPQFXtT 5GAQtN1NmfUEWHVboYKeFsRdT852zvuk
Account Extended Private Key: xprv9xxGy2ta42RufFyKPzRtxKAUpiF4hpqUrFWNhaFMexNqBem6pmk9PR4yprmhQ3qqLSaEcnE2GE1 uttot5P6XcoHCMg94RNTL9KkQ1GZkCL7

Now I can use both 'seed phrase' as well as 'account extended private key' to access same addresses from m/44'/0'/0'/0 branch.

Here's how on Electrum:

Using Seed Phrase: Create New Wallet > Standard Wallet > I already have a seed > Enter Seed Phrase > Check BIP-39 > Type of Address (P2PKH)



Using Account Extended Private Key: Create New Wallet > Standard Wallet > Use a master key > Enter Account Extended Private Key



Both will lead me to same set of addresses:

Charles-Tim
Legendary
*
Offline Offline

Activity: 1540
Merit: 4850



View Profile
November 17, 2020, 08:06:57 PM
 #7

...
I understand your point and you are totally right, but the reason I made such comment is because I have tried to import seed phrase from Coinomi wallet to Electrum wallet before, they both claim to be BIP39, but it did not work, but sweeping and importing of private key should probably work fine, There are some wallets that you can not import BIP39 seed phrase to if it is from another wallet of another type like the one I just commented about, but if it is the same wallet it will work fine. But, unlike master private key that will work on any wallet that support private key import. Please, correct me if getting it wrong.

the beginner must be careful, every extended MPK had a specific derivation path, they must know they address using legacy, nested or native segwit.
You are right, but it will be fine if they use electrum wallet for this purpose. There are many wallets that support legacy, compatible and segwit addresses all together too.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
webtricks
Legendary
*
Offline Offline

Activity: 1918
Merit: 1728


View Profile
November 18, 2020, 03:42:44 PM
Merited by Charles-Tim (1)
 #8

...
I understand your point and you are totally right, but the reason I made such comment is because I have tried to import seed phrase from Coinomi wallet to Electrum wallet before, they both claim to be BIP39, but it did not work, but sweeping and importing of private key should probably work fine, There are some wallets that you can not import BIP39 seed phrase to if it is from another wallet of another type like the one I just commented about, but if it is the same wallet it will work fine. But, unlike master private key that will work on any wallet that support private key import. Please, correct me if getting it wrong.

I just tried Coinomi wallet and the seed works fine with Electrum. Since, the Seed Phrase generated on Coinomi is in accordance with BIP-39, you can easily import the Coinomi Seed on Electrum by checking the BIP-39 checkbox.

Example:

The seed generated on Coinomi: cruise thought frozen test heart best praise ozone short milk either tomorrow potato give already trap work dynamic humble giraffe citizen donor milk issue

Addresses on Coinomi:

P2PKH Address:


P2SH Address:


Bech32 Address:


Addresses on Electrum by importing same seed phrase:

P2PKH Address:


P2SH Address:


Bech32 Address:



Both wallets generating same addresses!
Charles-Tim
Legendary
*
Offline Offline

Activity: 1540
Merit: 4850



View Profile
November 18, 2020, 06:53:43 PM
 #9

...
Thanks for the correction, I was using coinomi before I joined this forum, at the time, I had to convert to electrum. I downloaded electrum wallet from scatch unknown to me I got something wrong while importing the seed. Your points are so clear and correct, although I was newbie at the time and did not know much about wallet. I appreciate the correction.

.
.HUGE.
▄██████████▄▄
▄█████████████████▄
▄█████████████████████▄
▄███████████████████████▄
▄█████████████████████████▄
███████▌██▌▐██▐██▐████▄███
████▐██▐████▌██▌██▌██▌██
█████▀███▀███▀▐██▐██▐█████

▀█████████████████████████▀

▀███████████████████████▀

▀█████████████████████▀

▀█████████████████▀

▀██████████▀▀
█▀▀▀▀











█▄▄▄▄
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
.
CASINSPORTSBOOK
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀▀█











▄▄▄▄█
blue Snow (OP)
Legendary
*
Offline Offline

Activity: 1498
Merit: 1024


#SWGT CERTIK Audited


View Profile WWW
December 25, 2020, 11:35:45 AM
 #10

bump


Gif source; https://learnmeabitcoin.com

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!