Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 9B64CD7F for ; 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 ; 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 From: Ryan Perkins Reply-To: Ryan Perkins Message-ID: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-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.