Return-Path: Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 13A34E9B for ; Mon, 22 Jan 2018 18:16:16 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-ot0-f178.google.com (mail-ot0-f178.google.com [74.125.82.178]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 44DB6203 for ; Mon, 22 Jan 2018 18:16:15 +0000 (UTC) Received: by mail-ot0-f178.google.com with SMTP id d7so4975431oti.0 for ; Mon, 22 Jan 2018 10:16:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=lZvaYMqHYSaxdI8P3X2ezFCY2FCi8ePJqNOppOmmJ8g=; b=fRpfnvrSs/EU2QK/NB9BVBCd3wxIsp4Uq/PTH0za+AEQ4RMSyhpONZKeTuOfZT6TG8 hE6jEAao3zmT+ha/w5qzLlitccO82V1jfv9MuE5rVzrFwM9d6FB7Tf/vg5QzcWKNNTEi Tu8AGsI8E/L1yCffRB2YupXWyJpFvC9xw2REVLOOeKGoR7xbgDhqdibfXZ5hciVEIP0Z dp8nuOZ/QECRQuIC54Zh3y98AomPad6ENCrQi+5zkKBEMa0sSS37V4rNCL/MuYZWS009 89M0OQCm7vydej1qnLTWhBcgwzQ3Q6j4a7CfdttQbaCBcV3+SsI6H3nZc/rsqDtGvs1M FRdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=lZvaYMqHYSaxdI8P3X2ezFCY2FCi8ePJqNOppOmmJ8g=; b=F4Rv/WDT3mGbBVPQzWhe0zKi5LWfNxn8Z6y0Kc5rcdhq/e2Ws/0xouUzhD/jNePj6n UJXKjVZXRNjoE5i0abc9lTkJgiZvkqHuewBaNLwhxQrYEVrH+YJ+cB/jktkwICtFcH+K UaFJt0uYvq8+6SGX3TGIz0UKP8nCJTrVM9AahlPAOEw7Cwg9DCnVaPtaMCgL9U68tT7b mOTNbFzsOxFqDJgwhR+GyRvLJ8uOqR3kxtNibfEJXA2f/87OZXndgS+Sc4LP9e15yUeI K9rMfAeN0AqP7rX1L0Zw0NB1kuIXNmedRtJsrO8DbBMXjV2mFqCQmivYnu3CQ8ILCnl8 dUPA== X-Gm-Message-State: AKwxytdr5QiVgODbJBZ3o0BBNAveJzItmqLks6ea1tCM7zJINuseQWL/ UJeqCtncS+34YeRgHHIVnDE+xLItOKyDuYxe5Qs= X-Google-Smtp-Source: AH8x224m9C92/foVeXg3mgd0P7gvCk5x0Rkd67GwIP8BUcdWIa58kdYAawRM4LdfUPbiTJ/Bk6HMgoCNkqFD3e77AuM= X-Received: by 10.157.28.158 with SMTP id l30mr5095931ota.95.1516644974505; Mon, 22 Jan 2018 10:16:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.140.104 with HTTP; Mon, 22 Jan 2018 10:16:13 -0800 (PST) In-Reply-To: References: From: Alan Evans Date: Mon, 22 Jan 2018 14:16:13 -0400 Message-ID: To: Rhavar , Bitcoin Protocol Discussion Content-Type: multipart/alternative; boundary="f4030435adccf4b3b50563616c1e" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE 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: Mon, 22 Jan 2018 18:31:31 +0000 Subject: Re: [bitcoin-dev] Transaction Merging (bip125 relaxation) 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 Jan 2018 18:16:16 -0000 --f4030435adccf4b3b50563616c1e Content-Type: text/plain; charset="UTF-8" > So now I still owe John 1 BTC, however it's not immediately clear if it's safe to send to him If you spent your change from transaction A, that would be safe. There'd be no way you John could end up with 2 BTC from you then. On Mon, Jan 22, 2018 at 1:40 PM, Rhavar via bitcoin-dev < bitcoin-dev@lists.linuxfoundation.org> wrote: > So my half-baked idea is very simple: > > Allow users to merge multiple unconfirmed transactions, stripping > extraneous inputs and change as they go. > > This is currently not possible because of the bip125 rule: > "The replacement transaction pays an absolute fee of at least the sum paid > by the original transactions." > > Because the size of the merged transaction is smaller than the original > transactions, unless there is a considerable feerate bump, this rule isn't > possible to observe. > > > I my question is: is it possible or reasonable to relax this rule? If this > rule was removed in its entirety, does it introduce any DoS vectors? Or can > it be changed to allow my use-case? > > > --- > Full backstory: I have been trying to use bip125 (Opt-in Full > Replace-by-Fee) to do "transaction merging" on the fly. Let's say that I > owe John 1 bitcoin, and have promised to pay him immediately: Instead of > creating a whole new transaction if I have an in-flight (unconfirmed) > transaction, I can follow the rules of bip125 to create a replacement that > accomplishes this goal. > > From a "coin selection" point of view, this was significantly easier than > I had anticipated. I was able to encode the rules in my linear model and > feed in all my unspent and in-flight transactions and it can solve it > without difficulty. > > However, the real problem is tracking the mess. Consider this sequence of > events: > 1) I have unconfirmed transaction A > 2) I replace it with B, which pays John 1 BTC > 3) Transaction A gets confirmed > > So now I still owe John 1 BTC, however it's not immediately clear if > it's safe to send to him without waiting $n transactions. However even > for a small $n, this breaks my promise to pay him immediately. > > One possible solution is to only consider a transaction "replaceable" if > it has change, so if the original transaction confirms -- payments can > immediately be made that source the change, and provide safety in a reorg. > > However, this will only work <50% of the time for me (most transactions > don't have change) and opens a pandora's box of complexity. > > There's a few other hacks you can do to make it work in a few more cases, > but nothing that is realistic to expect anyone to implement any time soon. > > However, if there was a straight foward way to merge N unconfirmed > transactions, it would be easy get into production, and potentially offer > some pretty nice savings for everyone. > > _______________________________________________ > bitcoin-dev mailing list > bitcoin-dev@lists.linuxfoundation.org > https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev > > --f4030435adccf4b3b50563616c1e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
>=C2=A0So now I still = owe John 1 BTC, however it's not immediately clear if=C2=A0it's safe to send to him

If you spen= t your change from transaction A, that would be safe. There'd be no way= you John could end up with 2 BTC from you then.

On Mon, Jan 22, 2018 at 1:40 PM,= Rhavar via bitcoin-dev <bitcoin-dev@lists.linuxfounda= tion.org> wrote:
So = my half-baked idea is very simple:

Allow users= to merge multiple unconfirmed transactions, stripping extraneous inputs an= d change as they go.

This is currently not pos= sible because of the bip125 rule:
"The replacement trans= action pays an absolute fee of at least the sum paid by the original transa= ctions."

Because the size of the merged t= ransaction is smaller than the original transactions, unless there is a con= siderable feerate bump, this rule isn't possible to observe.
<= div>

I my question is: is it possible or reaso= nable to relax this rule? If this rule was removed in its entirety, does it= introduce any DoS vectors? Or can it be changed to allow my use-case?=C2= =A0


---
Full back= story: I have been trying to use bip125 (Opt-in Full Replace-by-Fee) to do = "transaction merging" on the fly. Let's say that I owe John 1= bitcoin, and have promised to pay him immediately: Instead of creating a w= hole new transaction if I have an in-flight (unconfirmed) transaction, I ca= n follow the rules of bip125 to create a replacement that accomplishes this= goal.

From a "coin selection" point= of view, this was significantly easier than
I had anticipate= d. I was able to encode the rules in my linear model and
feed= in all my unspent and in-flight transactions and it can solve it without d= ifficulty.

However, the real problem is tracki= ng the mess. Consider this sequence of events:
1) I have unco= nfirmed transaction A
2) I replace it with B, which pays John= 1 BTC
3) Transaction A gets confirmed

So now I still owe John 1 BTC, however it's not immediately clea= r if
it's safe to send to him without waiting $n transact= ions. However even
for a small $n, this breaks my promise to = pay him immediately.

One possible solution is = to only consider a transaction "replaceable" if it has change, so= if the original transaction confirms -- payments can immediately be made t= hat source the change, and provide safety in a reorg.

However, this will only work <50% of the time for me (most trans= actions
don't have change) and opens a pandora's box = of complexity.

There's a few other hacks y= ou can do to make it work in a few more cases, but nothing that is realisti= c to expect anyone to implement any time soon.

However, if there was a straight foward way to merge N unconfirmed transac= tions, it would be easy get into production, and potentially offer some pre= tty nice savings for everyone.

______________________________<= wbr>_________________
bitcoin-dev mailing list
bitcoin-dev@lists.= linuxfoundation.org
https://lists.linuxfoundation.org= /mailman/listinfo/bitcoin-dev


--f4030435adccf4b3b50563616c1e--