summaryrefslogtreecommitdiff
path: root/0e/39bb9718ad48c8f9484746f01e1ceb988ec56e
blob: 171a12f87e3a01eb6c9e4e9bff68d8dabaea182f (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
Return-Path: <riperk@protonmail.com>
Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org
	[172.17.192.35])
	by mail.linuxfoundation.org (Postfix) with ESMTPS id 9B64CD7F
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Mon, 22 Apr 2019 19:23:02 +0000 (UTC)
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6
Received: from mail-40132.protonmail.ch (mail-40132.protonmail.ch
	[185.70.40.132])
	by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D0501829
	for <bitcoin-dev@lists.linuxfoundation.org>;
	Mon, 22 Apr 2019 19:23:01 +0000 (UTC)
Date: Mon, 22 Apr 2019 19:22:52 +0000
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;
	s=default; t=1555960979;
	bh=LdZLure/+KEalIxgiOA0P9E8XJAU3dYqGPU6S3qGIP4=;
	h=Date:To:From:Cc:Reply-To:Subject:Feedback-ID:From;
	b=DWNYpN0eucoX/7itCaCQU6Rer9S93VbPrP5/Sy+8YPyqonuAptNBIL1H/7Iu0VSM9
	y1tMbimBLOX9iE1UrqY8LH4ynG6t93Oi2Ng3CjOfxmeAQ8jSaOg56MMJ129HDol7oh
	mDGtykRbUUrIB9Ige35p6IWcUcKwp2Ae7+IvlAq8=
To: Bitcoin Protocol Discussion <bitcoin-dev@lists.linuxfoundation.org>
From: Ryan Perkins <riperk@protonmail.com>
Reply-To: Ryan Perkins <riperk@protonmail.com>
Message-ID: <kZwZOekiYq3oxv7wgNj57KJqpOP0a2lkwM-TXsROtIDW5M8VunVV7majgvia4uo_bF3LxJn-8IOYN3IHBy25gjEN-OmPt-T47068L6s5ycE=@protonmail.com>
Feedback-ID: RdfuD--Ffc-FNb_4UIG1XA3s5stj1f6Yt84KENdha_3WoiW3STYpu7X5uGR72LvTfQZpxEhSRHGSlNfV5XM5RA==:Ext:ProtonMail
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,
	DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM,
	RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
	smtp1.linux-foundation.org
X-Mailman-Approved-At: Tue, 23 Apr 2019 14:47:54 +0000
Subject: [bitcoin-dev] CoinJoin Jigsaw
X-BeenThere: bitcoin-dev@lists.linuxfoundation.org
X-Mailman-Version: 2.1.12
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: Mon, 22 Apr 2019 19:23:02 -0000

Earlier today ZmnSCPxj posted to the mailing list with an interesting post =
about payjoin. In it he mentioned:

> Any non-equal-value coinjoin is easily solvable via [value sudoku](https:=
//www.coinjoinsudoku.com/advisory/).

Which doesn't seem right to me.

I came up with something I call a "CoinJoin Jigsaw". A "CoinJoin Jigsaw" is=
 send-to-self coinjoin transaction in which every input is ambiguously asso=
ciated with an output (i.e. every transaction input must belong to at least=
 one subset of every output amount).


For simplicity I've used minizinc to model this. To make it clean, I decide=
d to model as two users (affectionately called 'A' and 'B') who trust a com=
mon party to orchestrate the CoinJoin Jigsaw for them. A and B don't trust =
each other, so they want to get all their money atomically in this one tran=
saction. We also want the "CoinJoin Jigsaw" to have exactly 2 outputs. One =
for A, and one for B. That way at first approximation it looks like a prett=
y standard bitcoin payment. (Of course the problem is substantially easier =
to solve if we allow A and B to have N outputs, but that creates an ugly tr=
ansaction).

We also need to make sure that both A and B are paying a fee proportional t=
o the amount of inputs they added, and the total transaction fee is satisfa=
ctory.

So I've modelled it as A and B provide their utxo to the orchestrater. The =
orchestrater will pick the largest subset of A's and B's utxo and such that=
 satisfies our CoinJoin Jigsaw properties. I ended up copy-and-pasting a lo=
t more than I'd like:

https://gist.github.com/riperk/7be6698f291e865ad5c930d0edb0cd5a

I'm not sure it has much practical utility, but it's kind of cool. Maybe.