@@ -20,19 +20,21 @@ of Alice over a transaction spending the funding transaction without knowing `t`
20
20
21
21
Protocol description
22
22
---
23
- Assume Alice has permanent pubkey ` A = a*G ` and ephemeral pubkey ` A' ` , Bob has
24
- two pubkeys ` B1 = b1*G ` and ` B2 = b2*G ` and ` H ` is a cryptographic hash
25
- function. The partially blind atomic swap protocol where Alice acts as a
26
- tumbler and proceeds as follows.
23
+ Assume Alice has a permanent public key ` A = a*G ` , ephemeral pubkey `A1 = A +
24
+ h* G` and ephemeral pubkey ` A2` , Bob has two pubkeys ` B1 = b1* G` and ` B2 = b2* G`
25
+ and ` H ` is a cryptographic hash function. Public key aggregation in "2-of-2"
26
+ scripts is achieved with [ MuSig] ( https://eprint.iacr.org/2018/068.pdf ) and the
27
+ signature scheme is adapted from
28
+ [ Bellare-Neven] ( https://cseweb.ucsd.edu/~mihir/papers/multisignatures-ccs.pdf ) .
29
+ The partially blind atomic swap protocol where Alice acts as a tumbler works as
30
+ follows.
27
31
28
32
1 . Setup
29
33
30
34
* Bob anonymously asks Alice to put coins into a key aggregated output O1
31
- with public key ` P1 = H(A,B1,A)*A + H(A,B1,B1)*B1 ` (following "Simpler
32
- Schnorr Multi-Signatures with Applications to Bitcoin" by Pieter Wuille,
33
- Greg Maxwell and Andrew Poelstra).
34
- * Bob puts coins into a key aggregated output O2 with `P2 = H(A',B2,A')* A' +
35
- H(A',B2,B2)* B2`. As usual, before sending coins Alice and Bob agree on
35
+ with public key ` P1 = H(A1,B1,A1)*A1 + H(A1,B1,B1)*B1 ` .
36
+ * Bob puts coins into a key aggregated output O2 with `P2 = H(A2,B2,A2)* A2 +
37
+ H(A2,B2,B2)* B2`. As usual, before sending coins Alice and Bob agree on
36
38
timelocked refund transactions in case one party disappears.
37
39
2 . Blind signing
38
40
@@ -48,13 +50,13 @@ tumbler and proceeds as follows.
48
50
* the challenge ` c1 ` as the Bellare-Neven style challenge hash of
49
51
` tx_B ` with respect to ` P1 ` and input 0 for aggregated key ` P1 ` : `c1
50
52
= H(P1, 0, R', tx_B)`
51
- * the challenge ` c' ` for ` A ` as part of ` P1 ` : ` c' = c1*H(A ,B1,A ) `
53
+ * the challenge ` c' ` for ` A1 ` as part of ` P1 ` : ` c' = c1*H(A1 ,B1,A1 ) `
52
54
* the blinded challenge ` c = c'+beta `
53
55
* and the blinded signature of A times ` G ` : ` T = R + c*A `
54
56
* Bob sends ` c ` to Alice
55
57
* Alice replies with an adaptor signature over ` tx_A ` spending ` O2 ` with
56
58
auxiliary point ` T = t*G, t = ka + c*a ` where ` a ` is the discrete
57
- logarithm of A .
59
+ logarithm of permanent key ` A ` .
58
60
3 . Swap
59
61
60
62
* Bob gives Alice his contribution to the signature over ` tx_A ` .
@@ -63,13 +65,15 @@ tumbler and proceeds as follows.
63
65
* Due to previously receiving an adaptor signature Bob learns ` t ` from step (2).
64
66
4 . Unblinding
65
67
66
- * Bob unblinds Alice's blind signature ` t ` as ` t' = t+alpha ` resulting in a
67
- regular signature ` (R', t') ` of Alice over ` tx_B ` .
68
+ * Bob unblinds Alice's blind signature ` t ` as ` t' = t + alpha + c'*h ` where
69
+ c' is the unblinded challenge ` h ` is the tweak for ` A1 ` . This results in a
70
+ regular signature ` (R', t') ` of Alice (` A1 ` ) over ` tx_B ` .
68
71
* Bob adds his contribution to ` t' ` completing `(R', s), s = t' + kb +
69
- c1* H(A ,B1,A )* b1) ` which is a valid signature over ` tx_B` spending O1:
72
+ c1* H(A1 ,B1,B1 )* b1` which is a valid signature over ` tx_B` spending O1:
70
73
```
71
- s*G = (ka + (c'+beta)*a + alpha + kb + c1*H(A,B1,B1)*b1)*G
72
- = R + beta*A + alpha*G + c1*(H(A,B1,A)*a+*H(A,B1,B1)*b1)*G
74
+ s*G = t' + kb + c1*H(A1,B1,B1) * b1
75
+ = (ka + (c'+beta)*a + alpha + c'*h + kb + c1*H(A1,B1,B1) * b1)*G
76
+ = R + beta*A + alpha*G + c1*(H(A1,B1,A1) * (a+h) + H(A1,B1,B1) * b1)*G
73
77
= R' + H(P1, 0, R', tx_B)*P1
74
78
```
75
79
* Bob waits to increase his anonymity set and then publishes the signature
@@ -99,39 +103,27 @@ Among proposed countermeasures is a simple, but currently unproven trick by
99
103
Andrew Poelstra in which the signer randomly aborts after receiving a
100
104
challenge.
101
105
102
- Note that Bob can get a signature of A over anything including arbitrary
103
- messages. Therefore, the Blockchain this is used in must not allow spending
104
- more than one output with a single signature. The [SIGHASH_SINGLE
105
- bug](https://underhandedcrypto.com/2016/08/17/the-2016-backdoored-cryptocurrency-contest-winner/)
106
- for example would have been disastrous for this scheme.
107
106
108
- Dealing with Aggregated Signatures
107
+ A simpler scheme that would be broken by Aggregated Signatures
109
108
---
110
- The above scheme is broken by aggregated signatures, because they allow spending
111
- multiple inputs with a single signature. If Bob creates many funding txs with
112
- Alice, he can create a tx spending all of them, and prepares a message for Alice
113
- to sign which is her part of the aggregate signature of all the inputs. Alice
114
- just dumbly signs any blinded message, so can't decide if it's an aggregated
115
- sig or not. For example Bob may send Alice a challenge for an aggregate
116
- signature covering output 1 with pubkeys `L1 = {A, B1}` and output 2 with
117
- pubkeys `L2 = {A, B2}` as `c'=H(P1, 0, R', tx_B)*H(L1,A) + H(P2, 1, R',
118
- tx_B)*H(L2,A)`.
119
-
120
- A simple solution would be for Alice to create different pubkeys for every swap
121
- instead of permanent pubkey `A`. Then in step 2 Alice sends one nonce (`Ra`) per
122
- pubkey to Bob. Bob computes auxiliary points `T` for each of them, including the
123
- one corresponding to A's pubkey he's really interested in - and requires an
124
- adapter signature for each `T`.
125
- * Note that simply sending multiple adaptor sigs is problematic. Say Alice
126
- sends one adaptor sig with auxiliary point `T1=t1*G` and one with aux
127
- point `T2=t2*G`. Then even without seeing the actual signature, by just
128
- subtracting the signatures Bob learns `t1 - t2`. Instead, Alice uses
129
- auxiliary points `H(T1)*t1*G and H(T2)*t2*G` revealing `H(T1)t1 - H(T2)t2`
130
- which is usually meaningless.
131
-
132
- The downsides of this approach are increased communication and that Bob doesn't
133
- know the complete list of Alice's pubkeys, so Alice can only send half of the
134
- sigs, for example, reducing the anonymity set by 50% with 50% success
135
- probability. Moreover, Alice can send fake signatures (i.e. signatures not
136
- belonging to a legitimitate multi party output) such that Bob can not detemine
137
- his anonymity set.
109
+ Note that Bob can get a signature of A over anything including arbitrary
110
+ messages. Therefore, Alice must only use fresh ephemeral keys `A1` when
111
+ creating outputs. This complicates the protocol because at the same time Alice
112
+ must not be able to determine for which exact input she signs. As a result,
113
+ It's Bob's job to apply tweak `h` to convert a signature of `A` to `A1`.
114
+
115
+ A simpler protocol where Alice uses `A` instead of `A1` is broken by aggregated
116
+ signatures because it allows spending multiple inputs with a single signature.
117
+ If Bob creates many funding txs with Alice, he can create a tx spending all of
118
+ them, and prepares a message for Alice to sign which is her part of the
119
+ aggregate signature of all the inputs. Alice just dumbly signs any blinded
120
+ message, so can't decide if it's an aggregated sig or not. For example Bob may
121
+ send Alice a challenge for an aggregate signature covering output 1 with
122
+ pubkeys `L1 = {A, B1}` and output 2 with pubkeys `L2 = {A, B2}` as `c'=H(P1, 0,
123
+ R', tx_B)*H(L1,A) + H(P2, 1, R', tx_B)*H(L2,A)`.
124
+
125
+ Similarly, the [SIGHASH_SINGLE
126
+ bug](https://underhandedcrypto.com/2016/08/17/the-2016-backdoored-cryptocurrency-contest-winner/)
127
+ for example would have been disastrous for this scheme. In general, the
128
+ Blockchain this is used in must not allow spending more than one output with a
129
+ single signature.
0 commit comments