Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: yakuza699 on November 28, 2014, 12:28:28 PM



Title: What is the possible biggest free transaction in bytes?
Post by: yakuza699 on November 28, 2014, 12:28:28 PM
I would like to know what is the biggest transaction(in bytes) without a fee could be created that node would relay?


Title: Re: What is the possible biggest free transaction in bytes?
Post by: TimS on November 28, 2014, 03:25:27 PM
The largest transaction size that will be relayed by a standard node is 100,000 bytes (https://github.com/bitcoin/bitcoin/blob/master/src/main.h). For it to be free as well, it would need (https://en.bitcoin.it/wiki/Transaction_fees#Technical_info) to destroy at least 400 Bitcoin days (e.g. spend 100 Bitcoins that were received 576 confirmations, about 4 days, ago).

A standard miner will only include up to 50,000 bytes of free/low-fee transactions, but the question was about relaying, not mining (besides, I expect most miners use non-standard implementations, and hopefully someone will include that in a block once it's relayed to them).


Title: Re: What is the possible biggest free transaction in bytes?
Post by: BitCoinDream on November 28, 2014, 11:17:53 PM
The largest transaction size that will be relayed by a standard node is 100,000 bytes (https://github.com/bitcoin/bitcoin/blob/master/src/main.h). For it to be free as well, it would need (https://en.bitcoin.it/wiki/Transaction_fees#Technical_info) to destroy at least 400 Bitcoin days (e.g. spend 100 Bitcoins that were received 576 confirmations, about 4 days, ago).

A standard miner will only include up to 50,000 bytes of free/low-fee transactions, but the question was about relaying, not mining (besides, I expect most miners use non-standard implementations, and hopefully someone will include that in a block once it's relayed to them).

Nice learning. I added it under Bitcoin Q/A :)

https://bitcointalk.org/index.php?topic=568942.msg9685300#msg9685300


Title: Re: What is the possible biggest free transaction in bytes?
Post by: dabura667 on November 29, 2014, 07:20:00 AM
I would like to know what is the biggest transaction(in bytes) without a fee could be created that node would relay?

https://en.bitcoin.it/wiki/Transaction_fee#Sending

A transaction may be safely sent without fees if these conditions are met:

  • It is smaller than 1,000 bytes.
  • All outputs are 0.01 BTC or larger.
  • Its priority is large enough (see the Technical Info section below)

So because of #1 in that list, I would say 1,000.

If your tx doesn't meet the above 3 requirements, then it will check the fee. If the fee is less than MIN_RELAY_TX_FEE (currently set to 0.00001 BTC on most nodes) than they remove the transaction from their mempool and don't pass it along.


Title: Re: What is the possible biggest free transaction in bytes?
Post by: TimS on November 29, 2014, 03:23:56 PM
I would like to know what is the biggest transaction(in bytes) without a fee could be created that node would relay?

https://en.bitcoin.it/wiki/Transaction_fee#Sending

A transaction may be safely sent without fees if these conditions are met:

  • It is smaller than 1,000 bytes.
  • All outputs are 0.01 BTC or larger.
  • Its priority is large enough (see the Technical Info section below)

So because of #1 in that list, I would say 1,000.

If your tx doesn't meet the above 3 requirements, then it will check the fee. If the fee is less than MIN_RELAY_TX_FEE (currently set to 0.00001 BTC on most nodes) than they remove the transaction from their mempool and don't pass it along.
When I wrote my earlier post, I couldn't find a reference in the source for proving that those first two rules currently exist, so I left it out.

I've looked through the source code more and found the GetMinFee method, which shows the current implementation and takes an older implementation into account. The 0.01 BTC rule (0.01 BTC = CENT) and 1000 byte limits are in place for sending but not for relaying because prior to version 0.9, that was the rule. Since 0.9, it's been looser: no CENT rule, and a size limit of 49000 (max free - 1000) instead of 1000.
Code:
int64_t GetMinFee(const CTransaction& tx, unsigned int nBytes, bool fAllowFree, enum GetMinFee_mode mode)
{
    // Base fee is either nMinTxFee or nMinRelayTxFee
    int64_t nBaseFee = (mode == GMF_RELAY) ? tx.nMinRelayTxFee : tx.nMinTxFee;

    int64_t nMinFee = (1 + (int64_t)nBytes / 1000) * nBaseFee;

    if (fAllowFree)
    {
        // There is a free transaction area in blocks created by most miners,
        // * If we are relaying we allow transactions up to DEFAULT_BLOCK_PRIORITY_SIZE - 1000
        //   to be considered to fall into this category. We don't want to encourage sending
        //   multiple transactions instead of one big transaction to avoid fees.
        // * If we are creating a transaction we allow transactions up to 1,000 bytes
        //   to be considered safe and assume they can likely make it into this section.
        if (nBytes < (mode == GMF_SEND ? 1000 : (DEFAULT_BLOCK_PRIORITY_SIZE - 1000)))
            nMinFee = 0;
    }

    // This code can be removed after enough miners have upgraded to version 0.9.
    // Until then, be safe when sending and require a fee if any output
    // is less than CENT:
    if (nMinFee < nBaseFee && mode == GMF_SEND)
    {
        BOOST_FOREACH(const CTxOut& txout, tx.vout)
            if (txout.nValue < CENT)
                nMinFee = nBaseFee;
    }

    if (!MoneyRange(nMinFee))
        nMinFee = MAX_MONEY;
    return nMinFee;
}
So now I believe the answer to the question is: 48999 bytes and (at least) 196 Bitcoin days destroyed (there is no limit on output sizes). That will be relayed across the network by 0.9+ clients, which make up a good majority (https://getaddr.bitnodes.io/nodes/) of nodes now.
However, your client might not let you send it, because it's playing it safe in regards to how many nodes might relay it. To do that, the answer is: 999 bytes and (at least) 4 Bitcoin days destroyed and all outputs >= 0.01 BTC.

There's also the IsDust rules, which in short state that if you'd have to pay over 1/3rd of your transaction in fees. However, it's unlikely that a free transaction will hit those rules. (e.g. you might if you're only sending a year-old 0.015 BTC input)

TLDR: the wiki rules are right for playing it safe.


Title: Re: What is the possible biggest free transaction in bytes?
Post by: yakuza699 on November 30, 2014, 12:54:30 PM
Just tried to push this transaction 2637de855942a580996d94b0bf782ddcd3757822a02023b8415216b7c4d6fc35 to blockchain.info but it said
Code:
The Maximum Very Small Inputs Exceeded (20)
so then I pushed it to blockr.io and it worked http://btc.blockr.io/tx/info/2637de855942a580996d94b0bf782ddcd3757822a02023b8415216b7c4d6fc35 (http://btc.blockr.io/tx/info/2637de855942a580996d94b0bf782ddcd3757822a02023b8415216b7c4d6fc35) it also appears on https://www.blocktrail.com/BTC/tx/2637de855942a580996d94b0bf782ddcd3757822a02023b8415216b7c4d6fc35 (https://www.blocktrail.com/BTC/tx/2637de855942a580996d94b0bf782ddcd3757822a02023b8415216b7c4d6fc35) and it is here http://mempool.info/ (http://mempool.info/) so I assume that the biggest free transaction is the same as normal transactions 100KB