Free transactions with Bitcoin Cash

Last updated: 2018-07-20

This document describes how Bitcoin XT handles free transactions on the Bitcoin Cash network.

The criteria for free transactions

For sending a free transaction, your transaction needs to pass a coin age criteria. This criteria is accumulation of the value of the transaction inputs, multiplied by the number of confirmations they have.

Using this coin age criteria, we allow for many transactions to pass for free, while not allowing a bad actor to flood the network for free.

You’re basically rewarded for holding Bitcoin Cash by transacting for free. A bad actor would have to hold a large amount of coins for a long period of time to be able to abuse this. This makes an attack expensive and impractical.

What are inputs and confirmations?

When you create a transaction in Bitcoin Cash, you take one or more inputs from previous transactions you’ve received and you create outputs that can be spent in a later transaction.

tx

Your coins are basically a collection of unspent outputs. Every time a new block is added to the blockchain, any unspent output you own gets an additional confirmation.

The formula

A transaction that has a priority larger or equal to the following threshold requires no fee, where COIN is 100 000 000 satoshis (1 BCH).

priority >= COIN * 144 / 250

Where priority is calculated as (in pseudo code):

inputPriorty = 0;
for each input:
    inputPriority += input.value * input.confirmations

priority = inputPriorty / modified transaction size
        

Where modified transaction size is:

size = actual transaction size
for each input:
    offset = 41 + min(110, input.scriptSig.size)
    if (size > offset)
        size -= offset
        

The modified size is a rebate to incentivizing cleaning up the UTXO set.

The actual code for this is now located in policy/txpriority.cpp.

The threshold was originally introduced by Satoshi Nakamoto in commit f35e21e.

Simplified calculator

1 day = ~144 confirmations. Calculator assumes average input size is 180 bytes.

Inputs Size Criteria

Input:
Value    
Confirm. 

 

Total size (bytes):

Priority: 58181818 / 57600000

Free: Yes

How fast do free transactions get confirmed?

Bitcoin XT will mine all free transactions as long as there is block space available. Priority is not weighted in the block transaction selection. Transactions paying the highest fee have priority over lower fee paying transactions.

When blocks are full, Bitcoin XT will accept free transactions into its mempool as long as there is space available. Mempool size defaults to 300MB (maxmempool=300).

Miners can disable free transactions by adding allowfreetx=0 to their nodes configuration file.