Skip to content

Commit 38a7545

Browse files
authored
Merge pull request bitcoin#620 from satoshilabs/master
BIP 84: Derivation scheme for P2WPKH based accounts
2 parents 8ee73ca + 2382e31 commit 38a7545

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

README.mediawiki

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,13 @@ Those proposing changes should consider that ultimately consent may rest with th
407407
| Standard
408408
| Draft
409409
|-
410+
| [[bip-0084.mediawiki|84]]
411+
| Applications
412+
| Derivation scheme for P2WPKH based accounts
413+
| Pavol Rusnak
414+
| Informational
415+
| Draft
416+
|-
410417
| [[bip-0090.mediawiki|90]]
411418
| Consensus (hard fork)
412419
| Buried Deployments

bip-0084.mediawiki

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<pre>
2+
BIP: 84
3+
Layer: Applications
4+
Title: Derivation scheme for P2WPKH based accounts
5+
Author: Pavol Rusnak <[email protected]>
6+
Comments-Summary: No comments yet.
7+
Comments-URI: https://github.com/bitcoin/bips/wiki/Comments:BIP-0084
8+
Status: Draft
9+
Type: Informational
10+
Created: 2017-12-28
11+
License: CC0-1.0
12+
</pre>
13+
14+
==Abstract==
15+
16+
This BIP defines the derivation scheme for HD wallets using the P2WPKH ([[bip-0173.mediawiki|BIP 173]]) serialization format for segregated witness transactions.
17+
18+
==Motivation==
19+
20+
With the usage of P2WPKH transactions it is necessary to have a common derivation scheme.
21+
It allows the user to use different HD wallets with the same masterseed and/or a single account seamlessly.
22+
23+
Thus the user needs to create dedicated segregated witness accounts, which ensures that only wallets compatible with this BIP will detect the accounts and handle them appropriately.
24+
25+
===Considerations===
26+
27+
We use the same rationale as described in Considerations section of [[bip-0049.mediawiki|BIP 49]].
28+
29+
==Specifications==
30+
31+
This BIP defines the two needed steps to derive multiple deterministic addresses based on a [[bip-0032.mediawiki|BIP 32]] root account.
32+
33+
===Public key derivation===
34+
35+
To derive a public key from the root account, this BIP uses the same account-structure as defined in [[bip-0044.mediawiki|BIP 44]] and [[bip-0049.mediawiki|BIP 49]], but only uses a different purpose value to indicate the different transaction serialization method.
36+
37+
<pre>
38+
m / purpose' / coin_type' / account' / change / address_index
39+
</pre>
40+
41+
For the <code>purpose</code>-path level it uses <code>84'</code>. The rest of the levels are used as defined in BIP44 or BIP49.
42+
43+
44+
===Address derivation===
45+
46+
To derive the P2WPKH address from the above calculated public key, we use the encapsulation defined in [[bip-0141.mediawiki#p2wpkh|BIP 141]]:
47+
48+
49+
witness: <signature> <pubkey>
50+
scriptSig: (empty)
51+
scriptPubKey: 0 <20-byte-key-hash>
52+
(0x0014{20-byte-key-hash})
53+
54+
==Backwards Compatibility==
55+
56+
This BIP is not backwards compatible by design as described under [#considerations]. An incompatible wallet will not discover accounts at all and the user will notice that something is wrong.
57+
58+
==Test vectors==
59+
60+
<pre>
61+
mnemonic = abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about
62+
rootnode = zprvAWgYBBk7JR8Gjrh4UJQ2uJdG1r3WNRRfURiABBE3RvMXYSrRJL62XuezvGdPvG6GFBZduosCc1YP5wixPox7zhZLfiUm8aunE96BBa4Kei5
63+
64+
// Account 0, root = m/84'/0'/0'
65+
xpriv = zprvAdG4iTXWBoARxkkzNpNh8r6Qag3irQB8PzEMkAFeTRXxHpbF9z4QgEvBRmfvqWvGp42t42nvgGpNgYSJA9iefm1yYNZKEm7z6qUWCroSQnE
66+
67+
// Account 0, first receiving address = m/84'/0'/0'/0/0
68+
privkey = KyZpNDKnfs94vbrwhJneDi77V6jF64PWPF8x5cdJb8ifgg2DUc9d
69+
pubkey = 0330d54fd0dd420a6e5f8d3624f5f3482cae350f79d5f0753bf5beef9c2d91af3c
70+
address = bc1qcr8te4kr609gcawutmrza0j4xv80jy8z306fyu
71+
72+
// Account 0, second receiving address = m/84'/0'/0'/0/1
73+
privkey = Kxpf5b8p3qX56DKEe5NqWbNUP9MnqoRFzZwHRtsFqhzuvUJsYZCy
74+
pubkey = 03e775fd51f0dfb8cd865d9ff1cca2a158cf651fe997fdc9fee9c1d3b5e995ea77
75+
address = bc1qnjg0jd8228aq7egyzacy8cys3knf9xvrerkf9g
76+
77+
// Account 0, first change address = m/84'/0'/0'/1/0
78+
privkey = KxuoxufJL5csa1Wieb2kp29VNdn92Us8CoaUG3aGtPtcF3AzeXvF
79+
pubkey = 03025324888e429ab8e3dbaf1f7802648b9cd01e9b418485c5fa4c1b9b5700e1a6
80+
address = bc1q8c6fshw2dlwun7ekn9qwf37cu2rn755upcp6el
81+
</pre>
82+
83+
==Reference==
84+
85+
* [[bip-0032.mediawiki|BIP32 - Hierarchical Deterministic Wallets]]
86+
* [[bip-0043.mediawiki|BIP43 - Purpose Field for Deterministic Wallets]]
87+
* [[bip-0044.mediawiki|BIP44 - Multi-Account Hierarchy for Deterministic Wallets]]
88+
* [[bip-0049.mediawiki|BIP49 - Derivation scheme for P2WPKH-nested-in-P2SH based accounts]]
89+
* [[bip-0141.mediawiki|BIP141 - Segregated Witness (Consensus layer)]]
90+
* [[bip-0173.mediawiki|BIP173 - Base32 address format for native v0-16 witness outputs]]

0 commit comments

Comments
 (0)