diff --git a/README.mediawiki b/README.mediawiki index 0a5588a7..1480b6fa 100644 --- a/README.mediawiki +++ b/README.mediawiki @@ -199,6 +199,12 @@ Those proposing changes should consider that ultimately consent may rest with th | Standard | Draft |- +| [[bip-0047.mediawiki|47]] +| Reusable Payment Codes for Hierarchical Deterministic Wallets +| Justus Ranvier +| Informational +| Draft +|- | [[bip-0050.mediawiki|50]] | March 2013 Chain Fork Post-Mortem | Gavin Andresen diff --git a/bip-0021.mediawiki b/bip-0021.mediawiki index 00d9a537..27069264 100644 --- a/bip-0021.mediawiki +++ b/bip-0021.mediawiki @@ -56,6 +56,7 @@ The scheme component ("bitcoin:") is case-insensitive, and implementations must *address: bitcoin address *message: message that describes the transaction to the user ([[#Examples|see examples below]]) *size: amount of base bitcoin units ([[#Transfer amount/size|see below]]) +*paycode: payment code (BIP-47) *(others): optional, for future extensions ==== Transfer amount/size ==== @@ -67,6 +68,11 @@ I.e. amount=50.00 or amount=50 is treated as 50 BTC, and amount=50,000.00 is inv Bitcoin clients MAY display the amount in any format that is not intended to deceive the user. They SHOULD choose a format that is foremost least confusing, and only after that most reasonable given the amount requested. For example, so long as the majority of users work in BTC units, values should always be displayed in BTC by default, even if mBTC or TBC would otherwise be a more logical interpretation of the amount. + +==== Payment code ==== + +If a URI provides a payment code, and if the client supports BIP-47, then the resulting transaction SHOULD construct a transaction per BIP-47 instead of using the address provided in the URI. + == Rationale == ===Payment identifiers, not person identifiers=== @@ -122,3 +128,6 @@ Characters must be URI encoded properly. === Bitcoin clients === * Bitcoin-Qt supports the old version of Bitcoin URIs (ie without the req- prefix), with Windows and KDE integration as of commit 70f55355e29c8e45b607e782c5d76609d23cc858. +==References== + +* [[bip-0047.mediawiki|BIP47 - Reusable Payment Codes for Hierarchical Deterministic Wallets]] diff --git a/bip-0047.mediawiki b/bip-0047.mediawiki new file mode 100644 index 00000000..d49b0ea5 --- /dev/null +++ b/bip-0047.mediawiki @@ -0,0 +1,235 @@ +
+ BIP: 47 + Title: Reusable Payment Codes for Hierarchical Deterministic Wallets + Authors: Justus Ranvier+ +==Abstract== + +This BIP defines a technique for creating a payment code which can be publicly advertised and associated with a real-life identity without creating the loss of security or privacy inherent to P2PKH address reuse. + +This BIP is a particular application of BIP43 and is intended to supplement HD wallets which implement BIP44. + +The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119. + +==Motivation== + +Payment codes add identity information to transactions which is useful in a merchant-customer interaction while protecting the privacy of users. Payment codes provide the privacy benefits of Darkwallet-style Stealth Addresses to SPV clients without requiring the assistance of a trusted full node and while greatly reducing reliance on blockchain storage. + +==Path levels== + +We define the following 3 levels in BIP32 path: + ++ Status: Draft + Type: Informational + Created: 2015-04-24 +
+m / purpose' / coin_type' / identity' ++ +Apostrophe in the path indicates that BIP32 hardened derivation is used. + +Each level has a special meaning, described in the chapters below. + +===Purpose=== + +Purpose is a constant set to 47' (or 0x8000002F) following the BIP43 recommendation. It indicates that the subtree of this node is used according to this specification. + +===Coin type=== + +The coin type field is identical to the same field in BIP44 + +Hardened derivation is used at this level. + +===Identity=== + +Identity is a particular extended public/private key pair. The extended public key is a payment code. + +Identities SHOULD have 1:1 correspondence with a BIP44 account, as in each BIP44 account in an HD wallet should be assigned exactly one payment code which shares the same index value. + +Hardened derivation is used at this level. + +Except where noted, all keys derived from a payment code use the public derivation method. + +====Binary Serialization==== + +A payment code contains the following elements: + +* Byte 0: type. required value: 0x01 +* Byte 1: features bit field. All bits must be zero except where specified elsewhere in this specification +** Bit 0: Bitmessage notification +** Bits 1-7: reserved +* Byte 2: sign. required value: 0x02 or 0x03 +* Bytes 3 - 34: x value +* Bytes 35 - 66: chain code +* Bytes 67 - 79: reserved for future expansion, zero-filled unless otherwise noted + +====Base58 Serialization==== + +When a payment code is presented to the user, it SHOULD be presented encoded in Base58Check form. + +* The version byte is: 0x23 (produces a "P" as the first character of the serialized form) +* The payload is the binary serialization of the payment code + +===Protocol=== + +In the following examples, Alice and Bob are identities with a corresponding payment codes. Alice initiates a Bitcoin transaction, and Bob is the recipient of the transaction. + +It is assumed that Alice can easily obtain Bob's payment code via a suitable method outside the scope of the payment code protocol. + +====Definitions==== + +* Payment code: an extended public key which is associated with a particular identity +* Notification address: the P2PKH address associated with the 0th public key derived from a payment code +* Notification transaction: a transaction which sends an output to a notification address which includes an embedded payment code + +====Notification Transaction==== + +Prior to the first time Alice initiates a transaction to Bob, Alice MUST inform Bob of her payment code via the following procedure: + +# Alice constructs a transaction which sends a small quantity of bitcoins to Bob's notification address (notification transaction) +## The inputs selected for this transaction MUST NOT be easily associated with Alice's notification address +# Alice derives a unique shared secret using ECDH: +## Alice selects the first exposed public key, of the first pubkey-exposing input, of the transaction:
a+## Alice selects the public key associated with Bob's notification address:
B, where B = bG+## Alice calculates a secret point:
S = aB+## Alice expresses the secret point in compressed DER format, then calculates a scalar shared secret:
s = SHA256(S)+# Alice serializes her payment code in binary form. +# Alice renders her payment code (P) unreadable to anyone except Bob by: +## Replace the x value with:
s XOR (x value)+## Replace the chain code with:
sha256(s) XOR (chain code)+# Alice adds an OP_RETURN output to her transaction which consists of P. +
a+## Alice selects the next unused public key derived from Bob's payment code, starting from zero:
B, where B = bG+### The "next unused" public key is based on an index specific to the Alice-Bob context, not global to either Alice or Bob +## Alice calculates a secret point:
S = aB+## Alice expresses the secret point in compressed DER format, then calculates a scalar shared secret:
s = SHA256(S)+### If the value of s is not in the secp256k1 group, Alice MUST increment the index used to derive Bob's public key and try again. +## Alice uses the scalar shared secret to calculate the ephemeral public key used to generate the P2PKH address for this transaction:
B' = B + sG+
B' = B + sG+## Bob calculate the private key for each ephemeral address as:
b' = b + s+
B = payment code / 0 / 0+# Initialize a counter at 1:
n+# Derive a candidate encryption key as:
B' = payment code / 0 / n+# If the combination of B and B` do not form a valid Bitmessage address, increment n by one and try again +# Use the address version, signing key, encryption key, and stream number to construct a Bitmessage address per the Bitmessage protocol + +The sender transmits their payment code in base58 form to the calculated Bitmessage address. + +In order to use Bitmessage notification, the recipient must have a Bitmessage client which listens at the address which the senders will derive and is capable of relaying received payment codes to the Bitcoin wallet. + +==Reference== + +* [[bip-0032.mediawiki|BIP32 - Hierarchical Deterministic Wallets]] +* [[bip-0043.mediawiki|BIP43 - Purpose Field for Deterministic Wallets]] +* [[bip-0044.mediawiki|BIP44 - Multi-Account Hierarchy for Deterministic Wallets]] +* [[https://github.com/petertodd/dust-b-gone|dust-b-gone]] +* [[https://en.bitcoin.it/wiki/Base58Check_encoding|Base58Check encoding]] +* [[https://bitmessage.org/bitmessage.pdf|Bitmessage]] +* [[https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2015-April/007812.html|Mailing list discussion]] diff --git a/bip-0047/reusable_payment_codes-01.png b/bip-0047/reusable_payment_codes-01.png new file mode 100644 index 00000000..30a003fe Binary files /dev/null and b/bip-0047/reusable_payment_codes-01.png differ diff --git a/bip-0047/reusable_payment_codes-02.png b/bip-0047/reusable_payment_codes-02.png new file mode 100644 index 00000000..da81d639 Binary files /dev/null and b/bip-0047/reusable_payment_codes-02.png differ diff --git a/bip-0047/reusable_payment_codes-03.png b/bip-0047/reusable_payment_codes-03.png new file mode 100644 index 00000000..30872934 Binary files /dev/null and b/bip-0047/reusable_payment_codes-03.png differ diff --git a/bip-0047/reusable_payment_codes-04.png b/bip-0047/reusable_payment_codes-04.png new file mode 100644 index 00000000..9738ca26 Binary files /dev/null and b/bip-0047/reusable_payment_codes-04.png differ diff --git a/bip-0047/reusable_payment_codes-05.png b/bip-0047/reusable_payment_codes-05.png new file mode 100644 index 00000000..5e935593 Binary files /dev/null and b/bip-0047/reusable_payment_codes-05.png differ diff --git a/bip-0047/reusable_payment_codes-06.png b/bip-0047/reusable_payment_codes-06.png new file mode 100644 index 00000000..c5619da6 Binary files /dev/null and b/bip-0047/reusable_payment_codes-06.png differ