Skip to content

Commit 50e707b

Browse files
committed
Leaner notifications
1 parent 7330484 commit 50e707b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bip-alfredhodler-privatepayments.mediawiki

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ While payment codes use 2-byte bitflag arrays, notifications use ordinal values
106106

107107
===Notifications===
108108

109-
Notifications are performed by publishing transactions that contain a 44-byte <code>OP_RETURN</code> output. The value of the <code>OP_RETURN</code> is constructed using the following formula:
109+
Notifications are performed by publishing transactions that contain a 40-byte <code>OP_RETURN</code> output. The value of the <code>OP_RETURN</code> is constructed using the following formula:
110110

111111
''search_key | notification_code | N<sub>x</sub> | address_type''
112112

113-
* ''search_key'' equals "BIP999" and is a static ASCII-encoded string (6 bytes)
113+
* ''search_key'' equals "PP" and is a static ASCII-encoded string (2 bytes)
114114
* ''notification_code'' is ''H(n<sub>x</sub> * P)[0..4]'' (4 bytes)
115115
* ''N<sub>x</sub>'' is the unique public key a sender is using for a particular recipient (33 bytes)
116116
* ''address_type'' is the '''ordinal''' value of a single address type that a sender wants to send to (1 byte). This must be selected from the recepient's accepted address types.
@@ -124,7 +124,7 @@ When Alice wants to notify Bob that he will receive future payments from her, sh
124124
# Selects any UTXO in her wallet, preferably not associated with her.
125125
# Sends a transaction including an <code>OP_RETURN</code> output whose value is set to the constructed payload.
126126
127-
When Bob notices an <code>OP_RETURN</code> starting with the search key, he performs the following procedure:
127+
When Bob notices a 40-byte <code>OP_RETURN</code> starting with ''search key'', he performs the following procedure:
128128

129129
# Breaks down the payload into its four constituent parts.
130130
# Discards the ''search_key'' (item #0).
@@ -142,6 +142,8 @@ Since ''notification_code'' is a 4-byte truncation of the full value, Bob has a
142142

143143
There is a scanning requirement on the recipient side in that the recipient must have access to full blocks in order to be able to search them for OP_RETURN outputs containing notifications. For more information on how light clients can get around this limitation and still use the standard, see Appendix B.
144144

145+
Recipients that do not want to decode raw block data can quickly search for notifications in a block by looking for the following byte array: <code>[106, 40, 80, 80]</code>. The first two bytes represent ''OP_RETURN'' and ''OP_PUSHBYTES_40'', followed by the ASCII value of ''search_key''.
146+
145147
===Transacting===
146148

147149
Alice initializes counter ''c'' which is unique to Bob and increments with each transaction. ''c'' is a 64-bit integer and must be inputted into a hasher as a big-endian encoded array of 8 bytes.
@@ -208,7 +210,7 @@ When Bob wants to spend from such addresses, he calculates his private keys in t
208210

209211
'''Address type commitment:''' 1 (segwit)
210212

211-
'''Notification output script:''' OP_RETURN OP_PUSHBYTES_44 424950393939fbe8d683039d138aaf5bc2e27a9740541576eceb90a5f20b4799dbfda48e5c7ca24050575301
213+
'''Notification output script:''' OP_RETURN OP_PUSHBYTES_40 5050fbe8d683039d138aaf5bc2e27a9740541576eceb90a5f20b4799dbfda48e5c7ca24050575301
212214

213215

214216
===Alice sending to Bob===

0 commit comments

Comments
 (0)