public inbox for bitcoindev@googlegroups.com
 help / color / mirror / Atom feed
From: Tier Nolan <tier.nolan@gmail•com>
Cc: bitcoin-dev@lists•linuxfoundation.org
Subject: Re: [bitcoin-dev] Why not Child-Pays-For-Parent?
Date: Fri, 10 Jul 2015 17:28:02 +0100	[thread overview]
Message-ID: <CAE-z3OV+-18VLbOfWzDnE5HWJ4436HGtC_qDFFVkFQTGyjGOVw@mail.gmail.com> (raw)
In-Reply-To: <6D3AACE5-D6CD-4785-8A55-F6DF0B94D927@ricmoo.com>

[-- Attachment #1: Type: text/plain, Size: 2315 bytes --]

On Fri, Jul 10, 2015 at 5:09 PM, Richard Moore <me@ricmoo•com> wrote:

> I was also wondering, with CPFP, should the transaction fee be based on
> total transactions size, or the sum of each transaction’s required fee? For
> example, a third transaction C whose unconfirmed utxo from transaction B
> has an unconfirmed utxo in transaction A (all of A’s inputs are confirmed),
> with each A, B and C being ~300bytes, should C’s transaction fee be 0.0001
> btc for the ~1kb it is about to commit to the blockchain, or 0.0003 btc for
> the 3 transactions it is going to commit.
>

It should be whatever gives the highest fee.  In effect, child pays for
parent creates compound transactions.

A: 250 bytes, 0 fee
B: 300 bytes: 0.0005 fee
C: 400 bytes: 0.0001 fee

There are 3 combinations to consider

A: 0 fee for 250 bytes = 0 per byte
A&B: 0.0005 fee for 550 bytes = 0.91 uBTC per byte
A&B&C: 0.0006 fee for 950 bytes = 0.63uBTC per byte

This means that the A&B combination has the best fee per byte value.  A&B
should be added to the memory pool (if 0.91 uBTC per byte is above the
threshold).

Once A&B are added, then C can be reconsidered on its own.

C: 0.0001 for 400 bytes = 0.25 BTC per byte

If that is above the threshold, then C should be added.

In practice, it isn't possible to check every combination.  If there are N
transactions, then checking all triple combinations costs around N cubed.

A 2 pass system could get a reasonably efficient result.

B is 0.0005 fee for 300 bytes = 1.67 uBTC per byte and is assumed to be a
high value transaction.

The algorithm would be

Pass 1:
Process all transactions in order of BTC per byte, until block is full
    If the transaction's parents are either already in the pool or a
previous block, add the transaction.

Pass 1:
Process all non-included transactions in order of BTC per byte, until block
is full
    If the transaction's parents are either already in the pool or a
previous block, add the transaction.

    Otherwise, consider the transaction plus all non-included ancestors as
a single transaction
        If this combined transaction has a higher BTC per byte than the
lowest transaction(s),
            add the combined transaction
            drop the other transaction(s)

[-- Attachment #2: Type: text/html, Size: 3117 bytes --]

  parent reply	other threads:[~2015-07-10 16:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-10 16:09 Richard Moore
2015-07-10 16:13 ` Jeff Garzik
2015-07-10 16:25   ` Richard Moore
2015-07-10 16:26     ` Dan Bryant
2015-07-10 16:28 ` Tier Nolan [this message]
2015-07-10 16:31   ` Jeff Garzik
2015-07-10 17:02     ` Justus Ranvier
2015-07-10 17:16       ` Dan Bryant
2015-07-10 17:51       ` Alex Morcos
2015-07-10 19:39         ` Tier Nolan
2015-07-10 21:10           ` Luke Dashjr
2015-07-11 20:28             ` Micha Bailey
2015-07-11 21:30               ` Dan Bryant
2015-07-11 22:29                 ` Jeff Garzik
2015-07-12 10:18                   ` Matt Whitlock
2015-07-11 23:19                 ` Tier Nolan
2015-07-10 17:28     ` Tier Nolan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAE-z3OV+-18VLbOfWzDnE5HWJ4436HGtC_qDFFVkFQTGyjGOVw@mail.gmail.com \
    --to=tier.nolan@gmail$(echo .)com \
    --cc=bitcoin-dev@lists$(echo .)linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox