summaryrefslogtreecommitdiff
path: root/cd/bddea8930cbe0acadf533cc4b13c8fe641824c
blob: 7010f721668f3753d5c2653d17cf2c101d633f3e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
Return-Path: <clarkmoody@gmail.com>
Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136])
 by lists.linuxfoundation.org (Postfix) with ESMTP id 0D4F4C0011
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 29 Jun 2022 22:33:56 +0000 (UTC)
Received: from localhost (localhost [127.0.0.1])
 by smtp3.osuosl.org (Postfix) with ESMTP id CE19660E67
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 29 Jun 2022 22:33:55 +0000 (UTC)
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org CE19660E67
Authentication-Results: smtp3.osuosl.org;
 dkim=pass (2048-bit key) header.d=clarkmoody-com.20210112.gappssmtp.com
 header.i=@clarkmoody-com.20210112.gappssmtp.com header.a=rsa-sha256
 header.s=20210112 header.b=Zdridf8q
X-Virus-Scanned: amavisd-new at osuosl.org
X-Spam-Flag: NO
X-Spam-Score: -1.4
X-Spam-Level: 
X-Spam-Status: No, score=-1.4 tagged_above=-999 required=5
 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
 FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001,
 HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=no autolearn_force=no
Received: from smtp3.osuosl.org ([127.0.0.1])
 by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)
 with ESMTP id 0oCWxAQa0aMR
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 29 Jun 2022 22:33:54 +0000 (UTC)
X-Greylist: whitelisted by SQLgrey-1.8.0
DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 6E6CC60ACD
Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com
 [IPv6:2607:f8b0:4864:20::22c])
 by smtp3.osuosl.org (Postfix) with ESMTPS id 6E6CC60ACD
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 29 Jun 2022 22:33:54 +0000 (UTC)
Received: by mail-oi1-x22c.google.com with SMTP id e131so23554841oif.13
 for <bitcoin-dev@lists.linuxfoundation.org>;
 Wed, 29 Jun 2022 15:33:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=clarkmoody-com.20210112.gappssmtp.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :content-transfer-encoding;
 bh=QXJDm9OFGPM450ySisyz0P06qlOaLC2g+jEF693VAgw=;
 b=Zdridf8qFhgOVeNIm+pJEAib1DqSTNR45IklcpFGjz73F/w++5sQeua9AxzGPd65E6
 O981Rkeownk0v1yf3++K1e6gpCw/M50KZ8yDEOeFct0oAJyA1tUzb/EcEfT5lHUg8ulL
 Y4RdAV+U36Tcpq2BMyzE3g/DflIMITC40juYzBhd9txWEgS4xvdkez0BbQJ/0rV5TNPw
 UmO3j/Mjdc2V7UbmNWubQtWTM7STC+0k8NtKUL1/w46hhQW7iIJjSjWn4QkjeniWTc6g
 VFFJ52IgMZ70XWJPtGUZsUq3bvpqb1g4vuxpquTnzG8Twtkus4cxi+fypBHTK4UhKs5e
 +/ZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:content-transfer-encoding;
 bh=QXJDm9OFGPM450ySisyz0P06qlOaLC2g+jEF693VAgw=;
 b=PyRps8O+nxMKkqmBgPbgnHaLzzcG7yP84cGlT0ToNCGiGgp//pgonftU050Kb4SBJV
 CrocqJXdkNbd6Aph5ZZkkE1eU7ngcHauRQcw0pKp8TGxX5kir6aGIyJYdcIPSmbuLnNI
 Ypd+fb7GMcMHBXNWD+Gw8QlVE9CE5EKsCdcQmzK2M5TyVFsCF9A3aaZexHR3s1LiTqMA
 FYp+iHGKFx2iKbYy7im45Bk6wxTPnB0pRDXqSues7jnCIWiWoCMn/J+XKGMJgIxAf5er
 9Cg9zmoiBPbOZ6W5zzSAdbVJp9MDXtkOq7TdOBYCFtf/BM6lyEffiiuZAcCVT2xMATuy
 JRNw==
X-Gm-Message-State: AJIora9iMEJZ6OGgwQPy6/8kfTt6c5GxWW675OxszJIywl+iS3o3W9pM
 c0axaKqqvtPlVwnPXlbTYSm6ZW71PjLkT8NkK5j3m77cnvE=
X-Google-Smtp-Source: AGRyM1szu7jhvD+wv2LwpVccebvpix1C6mXFchbJmVj6oTm6JcxYXwhzqJJSRvszHF7LJl7OLCBQW/ohxsun/zhw51k=
X-Received: by 2002:a54:4e83:0:b0:335:511b:a7d4 with SMTP id
 c3-20020a544e83000000b00335511ba7d4mr4405647oiy.266.1656542032920; Wed, 29
 Jun 2022 15:33:52 -0700 (PDT)
MIME-Version: 1.0
References: <rH1Js_T_UWcAg9lS9NDw_Qb6Js5bgs8rPILej69BjqsEZcJZwsvHhZRilkkOQZRGXabai63hrGgbTP2Yk99ojKEN6fU6HT4TmukiafqiKjo=@protonmail.com>
In-Reply-To: <rH1Js_T_UWcAg9lS9NDw_Qb6Js5bgs8rPILej69BjqsEZcJZwsvHhZRilkkOQZRGXabai63hrGgbTP2Yk99ojKEN6fU6HT4TmukiafqiKjo=@protonmail.com>
From: Clark Moody <clark@clarkmoody.com>
Date: Wed, 29 Jun 2022 17:33:26 -0500
Message-ID: <CAHGSxGvfe_quLxrFTPtsHsrtw25h6LiT4m_xrT8aiG-pUf=AYg@mail.gmail.com>
To: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Mailman-Approved-At: Wed, 29 Jun 2022 22:41:17 +0000
Subject: Re: [bitcoin-dev] [BIP proposal] Private Payments
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Bitcoin Protocol Discussion <bitcoin-dev.lists.linuxfoundation.org>
List-Unsubscribe: <https://lists.linuxfoundation.org/mailman/options/bitcoin-dev>, 
 <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=unsubscribe>
List-Archive: <http://lists.linuxfoundation.org/pipermail/bitcoin-dev/>
List-Post: <mailto:bitcoin-dev@lists.linuxfoundation.org>
List-Help: <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=help>
List-Subscribe: <https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev>, 
 <mailto:bitcoin-dev-request@lists.linuxfoundation.org?subject=subscribe>
X-List-Received-Date: Wed, 29 Jun 2022 22:33:56 -0000

Alfred,

Thanks for the proposal. This is really interesting, especially the
additional on-chain privacy improvements over BIP47: ephemeral
notifier/sender keys and shielding of the sender key(s) against
seizure of the recipient's wallet.

> A payment code is encoded in base58check and the version byte produces "S=
" for the first character.

This is a bit under-specified, but let me bike-shed here and suggest
going with a Bech32m encoding. We gain more compact QR codes as well
as error detection/correction.

Alternate proposal:

- Bech32m human-readable part =3D "pay"
- Data payload is [watched address type bytes (2), compressed pubkey (33)]

Example:

- Address type bytes =3D c000
- Pubkey 03b54543fbed9d17d9300b508c55769bc4c8385620626730b4d52e5f3e30d9a6c1
- Published payment code:
pay1cqqq8d29g0a7m8ghmycqk5yv24mfh3xg8ptzqcn8xz6d2tjl8ccdnfkpjl7p84

> The owner of a code could simply demand that a notification transaction m=
eets some minimum miner fee or a multiple of some trailing average.

I don't see how this would work, and others have pointed out that the
cost of block space is itself an anti-spam measure.

=3D=3D Notification Service Idea =3D=3D

A third-party service could offer to publish OP_RETURN notification
payloads in the blockchain for a fee, paid over Lightning Network.
This completely de-links Alice's notification from her wallet, while
accepting the less-known privacy implications of a Lightning payment.
The service would remain ignorant of Bob's identity in any event. Such
a service would also be incentivized to charge market rates for the
potential privacy boost and for block space.

=3D=3D Data Service Idea =3D=3D

Another service could publish only the OP_RETURN data pertaining to
this BIP, which is easy to obtain due to the clear tagging scheme.
Light wallets would check in with this service on a regular basis,
performing the ECDH filtering steps on each output. Upon further
request, the service furnishes transaction proofs for the full
transaction containing the OP_RETURN. Care would need to be taken to
avoid leaking too much information to the service, and techniques such
as using separate Tor circuits or requesting tx proofs on a bulk set
of transactions could help obfuscate the exact transaction of
interest. These concerns are similar to those found in BIP157
client-side block filtering (Neutrino filters).

Alternatively, the service publishes the block height along with the
notification data contained within that block. Light clients could
download relevant blocks over the p2p network and perform full
validation.


-Clark

On Mon, Jun 27, 2022 at 2:14 PM Alfred Hodler via bitcoin-dev
<bitcoin-dev@lists.linuxfoundation.org> wrote:
>
> Hi,
>
> There have been attempts to create static payment codes that function as =
a way for transacting parties to create "private" addresses, where private =
stands for "known only to transacting parties". BIP47 was one such standard=
.
>
> The standard suffered from a number of problems:
>
> 1. The standard promised extensibility through versioning but it never us=
ed that capability to follow innovations in the Bitcoin protocol. It was de=
signed around the idea that legacy p2pkh addresses would always be the prim=
ary and only way to transact. As new standard script types started to emerg=
e (Segwit v0, Taproot), the creators dealt with the problem by stating that=
 implementing wallets should scan for all existing standard scripts. The in=
ability of payment codes to explicitly state which address types they deriv=
e places a burden on more resource constrained wallets.
>
> 2. The standard relied on a notification mechanism in order to connect a =
sender with a recipient, which included either offchain technology (Bitmess=
age), or so called "notification addresses" which a) left a footprint b) cr=
eated toxic change. That type of footprint is particularly harmful because =
it makes it obvious that a particular recipient is going to receive private=
 transactions. If the notifying party performs this process with coins link=
ed to its identity (i.e. tainted or non-anonymized inputs), it forever beco=
mes visible that Alice connected with Bob despite the fact that her payment=
 code was blinded. While future transactions and their amounts aren't visib=
le, this metadata makes it possible to build a social graph.
>
> 3. The standard was implemented only by an entity that disavowed the BIP =
process and didn't wish to use it to keep the standard up to date. Further =
updates did take place but only outside the BIP process, creating a lack of=
 clarity as to what the real specification is. Ultimately the standard was =
abandoned.
>
> I propose to build on the idea of payment codes under a new BIP with the =
following principal differences:
>
> 1. The new standard will allocate a 2-byte bitflag array that will signal=
 address/script types that the receiver is deriving. Since the vast majorit=
y of scripts are p2pkh (47.3%) and p2wpkh (26.2%), bits 0 and 1 will be use=
d for those respectively. Bit 2 will be p2tr. The remaining 13 bits are res=
erved for future standard script types.
>
> 2. Notification transactions still exist but no longer leave a privacy fo=
otprint on the blockchain. Instead, a notification transaction is simply a =
single OP_RETURN containing a value that only Alice and Bob can calculate. =
If Alice's notification transaction uses UTXOs not associated with her iden=
tity, there is never a footprint showing that either her or Bob are using p=
rivate payments. If Alice uses tainted coins, only she is exposed as a user=
 of Private Payments but Bob still isn't.
>
> 3. Payment code versioning is no longer done because it creates the poten=
tial for fragmentation and disparate standard updates by different parties =
that don't follow the BIP process (BIP47 is a good example of that).
>
> 4. Relying on static compressed pubkeys as opposed to extended keys means=
 shorter payment codes.
>
> =3D=3DProposed Payment Code Structure=3D=3D
>
> bytes 0-1: - enabled (watched) address types (16 possible address types)
> bytes 2-35: - compressed public key P
>
> =3D=3DEncoding=3D=3D
>
> A payment code is encoded in base58check and the version byte produces "S=
" for the first character. A code might look like "SwLUHs3UfMUXq956aXLTUPPf=
ow7a8gDfSUUAtafwqHcobf6mKcMbJk".
>
> =3D=3DPubkey Derivation=3D=3D
>
> Recipient's payment code pubkey `P` is derived from a master key using th=
e following path: `m/purpose'/coin_type'/account'`. `purpose` will be defin=
ed once a BIP number is assigned. Its corresponding private key is `p`.
>
> Notifier/sender's pubkey `N` is derived using the following derivation pa=
th: `m/purpose'/coin_type'/account'/*`, where each recipient gets a new ind=
ex. This way send-side privacy is always preserved. Its corresponding priva=
te key is `n`.
>
> =3D=3DNotifications=3D=3D
>
> Alice wants to notify Bob that he will receive future payments from her. =
Alice selects any UTXO in her wallet (preferably not associated with her) a=
nd `n_Alice`. Alice selects the public key contained in Bob's payment code =
`P_Bob`. Alice performs the following process (`*` and `+` are EC operation=
s):
>
> notification =3D SHA256(n_Alice * P_Bob)
>
> Alice then constructs a 72-byte OP_RETURN output whose value is set to `B=
IPXXXX + notification + N_Alice` (`+` is concat) and sends it in a transact=
ion containing no other outputs (XXXX to be replaced once a BIP number is a=
ssigned). Alice MUST now keep track of `n_Alice` or its derivation path as =
it will be used in future transactions exclusively with Bob (not for spendi=
ng but to calculate secret addresses).
>
> Bob's wallet receives whole blocks but doesn't need to waste resources on=
 decoding them if the environment is resource constrained. Bob simply needs=
 find the string BIPXXXX in the binary blob that represents an undecoded bl=
ock. Once found, Bob extracts the subsequent 32 bytes (`notification`) and =
the subsequent 33 bytes (`N_Alice`). The benefit of this approach is that B=
ob doesn't have to decode blocks and extract pubkeys from scriptsigs.
>
> Since ECDH dictates that SHA256(n_Alice * P_Bob) =3D=3D SHA256(N_Alice * =
p_Bob), Bob calculates the expected notification value and checks if it mat=
ches the first value in the payload. If so, Bob found a notification transa=
ction addressed to himself and stores `N_Alice` in order to be able to dete=
ct and spend future payments from Alice. The added benefit of this approach=
 over BIP47 is that Bob doesn't learn Alice's payment code, so Alice can pa=
y Bob without revealing her identity. To take advantage of these privacy be=
nefits, Alice simply has to engage in coin control on her end. A real world=
 scenario where this might be useful is anonymous donations to a party whos=
e wallet may be seized in the future. Seizing such a wallet won't reveal wh=
o Alice is (as long as she engages in coin control), whereas BIP47 would by=
 default leak her identity even if her coins as anonymized.
>
> If this process fails for any reason, Bob assumes a spurious notification=
 or one not addressed to himself and gives up.
>
> =3D=3DTransacting=3D=3D
>
> Now that they are connected, Alice can send transactions to Bob. Alice ne=
eds to keep track of her transaction count toward Bob; let's name that coun=
ter `X`. This process is similar to what BIP47 does.
>
> Alice calculates a secret point:
>
> S =3D n_Alice * P_Bob
>
> Alice calculates a shared secret:
>
> s =3D SHA256(S, X)
>
> Alice calculates Bob's ephemeral public key and its associated address wh=
ere the funds will be sent:
>
> P_Bob' =3D P_Bob + s*G
>
> When Bob detects a payment to `P_Bob'`, he can spend such coins by calcul=
ating the shared secret `s` in the same manner using `N_Alice` and `p_Bob` =
and performing:
>
> p_bob' =3D p_bob + s
>
> The fact that Alice and Bob are using a shared counter means we can do aw=
ay with chain codes and make payment codes much smaller. Bob simply needs t=
o derive a number of addresses to watch with respect to some gap limit (whi=
ch can be as low as 1 in practice).
>
> =3D=3DAnti-spam=3D=3D
>
> While DoS hasn't been a problem with BIP47, it is possible to build anti-=
spam measures into payment codes. The owner of a code could simply demand t=
hat a notification transaction meets some minimum miner fee or a multiple o=
f some trailing average. This would help prevent spam notifications that mi=
ght otherwise overwhelm a payment code with addresses to watch. But that is=
 purely optional.
>
> Looking forward to hearing thoughts and ideas.
>
> Alfred
>
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists.linuxfoundation.org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev