Title: Master Private Key for Beginner Post by: blue Snow on November 13, 2020, 01:42:02 AM 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. https://i.postimg.cc/RVztJ4xv/mpk1.gif 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 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 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 By importing MPK into BIP32 Root Key in iancoleman html then select BIP141 on derivation path tab, choose P2PWKH https://i.postimg.cc/15h9SfSG/4.jpg 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 Title: Re: Master Private Key for Beginner Post by: SquirrelJulietGarden on November 13, 2020, 02:27:38 AM Chapter 5. Wallets (in Mastering bitcoin) (https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc)
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. Title: Re: Master Private Key for Beginner Post by: blue Snow on November 14, 2020, 12:13:29 PM Chapter 5. Wallets (in Mastering bitcoin) (https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05.asciidoc) With same seed, you can create a Masterkey, and Child keys then Grandchild keys https://raw.githubusercontent.com/bitcoinbook/bitcoinbook/develop/images/mbc2_0503.png Yes, but only created once master key right?. this means we can save that master key only. In my previous post about Derivation Path (https://bitcointalk.org/index.php?topic=5243350) 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 Title: Re: Master Private Key for Beginner Post by: Charles-Tim on November 14, 2020, 01:28:36 PM 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.https://i.imgur.com/I8wskmV.png 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. https://i.imgur.com/cYgo1xU.png 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. Title: Re: Master Private Key for Beginner Post by: blue Snow on November 17, 2020, 11:33:25 AM 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.Title: Re: Master Private Key for Beginner Post by: webtricks on November 17, 2020, 04:11:49 PM 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) https://i.ibb.co/h2Q7WPj/two.png Using Account Extended Private Key: Create New Wallet > Standard Wallet > Use a master key > Enter Account Extended Private Key https://i.ibb.co/YN21fj9/one.png Both will lead me to same set of addresses: https://i.ibb.co/qm3Fw0Q/three.png Title: Re: Master Private Key for Beginner Post by: Charles-Tim on November 17, 2020, 08:06:57 PM ... 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. Title: Re: Master Private Key for Beginner Post by: webtricks on November 18, 2020, 03:42:44 PM ... 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: https://i.imgur.com/cK4C2vC.png P2SH Address: https://i.imgur.com/nn8U7ta.png Bech32 Address: https://i.imgur.com/7xFlZoY.png Addresses on Electrum by importing same seed phrase: P2PKH Address: https://i.imgur.com/pgWsDyF.png P2SH Address: https://i.imgur.com/68KuD9I.png Bech32 Address: https://i.imgur.com/1yH17sn.png Both wallets generating same addresses! Title: Re: Master Private Key for Beginner Post by: Charles-Tim on November 18, 2020, 06:53:43 PM ... 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. Title: Re: Master Private Key for Beginner Post by: blue Snow on December 25, 2020, 11:35:45 AM bump
https://learnmeabitcoin.com/technical/images/hd-wallets/hierarchical-deterministic-wallets.gif Gif source; https://learnmeabitcoin.com |