https://tests.bitcoin.it/w/index.php?title=BIP_0049&feed=atom&action=historyBIP 0049 - Revision history2024-03-29T09:11:25ZRevision history for this page on the wikiMediaWiki 1.30.0https://tests.bitcoin.it/w/index.php?title=BIP_0049&diff=68353&oldid=prev934: Update BIP text with latest version from https://github.com/bitcoin/bips/blob/cf0b529e78860fa2/bip-0049.mediawiki2021-01-01T10:09:53Z<p>Update BIP text with latest version from https://github.com/bitcoin/bips/blob/cf0b529e78860fa2/bip-0049.mediawiki</p>
<table class="diff diff-contentalign-left" data-mw="interface">
<col class="diff-marker" />
<col class="diff-content" />
<col class="diff-marker" />
<col class="diff-content" />
<tr style="vertical-align: top;" lang="en">
<td colspan="2" style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan="2" style="background-color: white; color:black; text-align: center;">Revision as of 10:09, 1 January 2021</td>
</tr><tr><td colspan="2" class="diff-lineno" id="mw-diff-left-l30" >Line 30:</td>
<td colspan="2" class="diff-lineno">Line 30:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Two generally different approaches are possible for current BIP44 capable wallets:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>Two generally different approaches are possible for current BIP44 capable wallets:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>1) Allow the user to use the same account(s) that they already <del class="diffchange diffchange-inline">uses</del>, but add segregated witness encoded addresses to it.</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>1) Allow the user to use the same account(s) that they already <ins class="diffchange diffchange-inline">use</ins>, but add segregated witness encoded addresses to it.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>1.1) Use the same public keys as defined in BIP44, but in addition to the normal P2PKH address also derive the P2SH address from it.</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>1.1) Use the same public keys as defined in BIP44, but in addition to the normal P2PKH address also derive the P2SH address from it.</div></td></tr>
</table>934https://tests.bitcoin.it/w/index.php?title=BIP_0049&diff=66828&oldid=prev934: Update BIP text with latest version from https://github.com/bitcoin/bips/blob/b5723035e23896d0/bip-0049.mediawiki2019-09-24T17:59:48Z<p>Update BIP text with latest version from https://github.com/bitcoin/bips/blob/b5723035e23896d0/bip-0049.mediawiki</p>
<p><b>New page</b></p><div>{{bip}}<br />
{{BipMoved|bip-0049.mediawiki}}<br />
<br />
<pre><br />
BIP: 49<br />
Layer: Applications<br />
Title: Derivation scheme for P2WPKH-nested-in-P2SH based accounts<br />
Author: Daniel Weigl <DanielWeigl@gmx.at><br />
Comments-Summary: No comments yet.<br />
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0049<br />
Status: Final<br />
Type: Informational<br />
Created: 2016-05-19<br />
License: PD<br />
</pre><br />
<br />
==Abstract==<br />
<br />
This BIP defines the derivation scheme for HD wallets using the P2WPKH-nested-in-P2SH ([[bip-0141.mediawiki|BIP 141]]) serialization format for segregated witness transactions.<br />
<br />
==Motivation==<br />
<br />
With the usage of P2WPKH-nested-in-P2SH ([[bip-0141.mediawiki#p2wpkh-nested-in-bip16-p2sh|BIP 141]]) transactions it is necessary to have a common derivation scheme.<br />
It allows the user to use different HD wallets with the same masterseed and/or a single account seamlessly.<br />
<br />
Thus the user needs to create dedicated segregated witness accounts, which ensures that only wallets compatible with this BIP<br />
will detect the accounts and handle them appropriately.<br />
<br />
===Considerations===<br />
Two generally different approaches are possible for current BIP44 capable wallets:<br />
<br />
1) Allow the user to use the same account(s) that they already uses, but add segregated witness encoded addresses to it.<br />
<br />
1.1) Use the same public keys as defined in BIP44, but in addition to the normal P2PKH address also derive the P2SH address from it.<br />
<br />
1.2) Use the same account root, but branch off and derive different external and internal chain roots to derive dedicated public keys for the segregated witness addresses.<br />
<br />
2) Create dedicated accounts used only for segregated witness addresses.<br />
<br />
The solutions from point 1 have a common disadvantage: if a user imports/recovers a BIP49-compatible wallet masterseed into/in a non-BIP49-compatible wallet, the account might show up but also it might miss some UTXOs.<br />
<br />
Therefore this BIP uses solution 2, which fails in a more visible way. Either the account shows up or not at all. The user does not have to check his balance after using the same seed in different wallets.<br />
<br />
<br />
==Specifications==<br />
<br />
This BIP defines the two needed steps to derive multiple deterministic addresses based on a [[bip-0032.mediawiki|BIP 32]] root account.<br />
<br />
===Public key derivation===<br />
<br />
To derive a public key from the root account, this BIP uses the same account-structure as defined in<br />
[[bip-0044.mediawiki|BIP 44]], but only uses a different purpose value to indicate the different transaction<br />
serialization method.<br />
<br />
<pre><br />
m / purpose' / coin_type' / account' / change / address_index<br />
</pre><br />
<br />
For the `purpose`-path level it uses `49'`. The rest of the levels are used as defined in BIP44.<br />
<br />
<br />
===Address derivation===<br />
<br />
To derive the P2SH address from the above calculated public key, we use the encapsulation defined in [[bip-0141.mediawiki#p2wpkh-nested-in-bip16-p2sh|BIP 141]]:<br />
<br />
witness: <signature> <pubkey><br />
scriptSig: <0 <20-byte-key-hash>><br />
(0x160014{20-byte-key-hash})<br />
scriptPubKey: HASH160 <20-byte-script-hash> EQUAL<br />
(0xA914{20-byte-script-hash}87)<br />
<br />
<br />
===Extended Key Version===<br />
<br />
When serializing extended keys, this scheme uses alternate version bytes. Extended public keys use <code>0x049d7cb2</code> to produce a "ypub" prefix, and private keys use <code>0x049d7878</code> to produce a "yprv" prefix. Testnet uses <code>0x044a5262</code> "upub" and <code>0x044a4e28</code> "uprv."<br />
<br />
Additional registered version bytes are listed in [[https://github.com/satoshilabs/slips/blob/master/slip-0132.md|SLIP-0132]].<br />
<br />
<br />
==Backwards Compatibility==<br />
<br />
This BIP is not backwards compatible by design as described under [[#considerations|considerations]]. An incompatible wallet will not discover accounts at all and the user will notice that something is wrong.<br />
<br />
<br />
==Test vectors==<br />
<br />
<pre><br />
masterseedWords = abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about<br />
masterseed = uprv8tXDerPXZ1QsVNjUJWTurs9kA1KGfKUAts74GCkcXtU8GwnH33GDRbNJpEqTvipfCyycARtQJhmdfWf8oKt41X9LL1zeD2pLsWmxEk3VAwd (testnet)<br />
<br />
// Account 0, root = m/49'/1'/0'<br />
account0Xpriv = uprv91G7gZkzehuMVxDJTYE6tLivdF8e4rvzSu1LFfKw3b2Qx1Aj8vpoFnHdfUZ3hmi9jsvPifmZ24RTN2KhwB8BfMLTVqaBReibyaFFcTP1s9n (testnet)<br />
account0Xpub = upub5EFU65HtV5TeiSHmZZm7FUffBGy8UKeqp7vw43jYbvZPpoVsgU93oac7Wk3u6moKegAEWtGNF8DehrnHtv21XXEMYRUocHqguyjknFHYfgY (testnet)<br />
<br />
// Account 0, first receiving private key = m/49'/1'/0'/0/0<br />
account0recvPrivateKey = cULrpoZGXiuC19Uhvykx7NugygA3k86b3hmdCeyvHYQZSxojGyXJ<br />
account0recvPrivateKeyHex = 0xc9bdb49cfbaedca21c4b1f3a7803c34636b1d7dc55a717132443fc3f4c5867e8<br />
account0recvPublickKeyHex = 0x03a1af804ac108a8a51782198c2d034b28bf90c8803f5a53f76276fa69a4eae77f<br />
<br />
// Address derivation<br />
keyhash = HASH160(account0recvPublickKeyHex) = 0x38971f73930f6c141d977ac4fd4a727c854935b3<br />
scriptSig = <0 <keyhash>> = 0x001438971f73930f6c141d977ac4fd4a727c854935b3<br />
addressBytes = HASH160(scriptSig) = 0x336caa13e08b96080a32b5d818d59b4ab3b36742<br />
<br />
// addressBytes base58check encoded for testnet<br />
address = base58check(prefix | addressBytes) = 2Mww8dCYPUpKHofjgcXcBCEGmniw9CoaiD2 (testnet)<br />
</pre><br />
<br />
<br />
==Reference==<br />
<br />
* [[bip-0016.mediawiki|BIP16 - Pay to Script Hash]]<br />
* [[bip-0032.mediawiki|BIP32 - Hierarchical Deterministic Wallets]]<br />
* [[bip-0043.mediawiki|BIP43 - Purpose Field for Deterministic Wallets]]<br />
* [[bip-0044.mediawiki|BIP44 - Multi-Account Hierarchy for Deterministic Wallets]]<br />
* [[bip-0141.mediawiki|BIP141 - Segregated Witness (Consensus layer)]]<br />
<br />
== Copyright ==<br />
<br />
This document is placed in the public domain.</div>934