# How is the cost of a trasaction that referances many inputs calculated?

I understand that PPC charges a larger network fee for a transaction if it uses a large number of inputs. This is because multiple inputs can make the transaction’s size in bytes larger so this is in part an anti spam measure.

Can someone point me to where this is enforced in the PPC code?

I’m keen to find out:

1. What’s the byte size threshold at which this fee is applied?
2. How much the fee is and in what ratio is it applied?
3. How much of this fee is passed to the miner and how much is destroyed?
1 Like

I dont have a ref to the line of code, but it suffice to say that the fee is 0.01 PPC/kb. Miners/minters gets nothing of that as the fee is destroyed.

Cant say if the kb is floored, ceiled or rounded to nearest kb as i ve not found the line of code yet.

The number of kilobytes is rounded up. For example:

[ul][li]Any transaction up to 1kb will require 0.01PPC to be destroyed[/li]
[li]Any transaction up to 2kb will require 0.02PPC to be destroyed[/li]
[li]Any transaction up to 3kb will require 0.03PPC to be destroyed[/li][/ul]

And so on.

On mobile so not able to get the line numbers right now.

``````static const int64 MIN_TX_FEE = CENT;
static const int64 MIN_RELAY_TX_FEE = CENT;``````

[code]

``````            // Check that enough fee is included
int64 nPayFee = nTransactionFee * (1 + (int64)nBytes / 1000);
int64 nMinFee = wtxNew.GetMinFee(1, false, GMF_SEND);
if (nFeeRet < max(nPayFee, nMinFee))
{
nFeeRet = max(nPayFee, nMinFee);
continue;
}
``````

1 Like

Thanks for these links and info. I have a further question:

Does anyone know how the price per multiple of 1000 bytes was arrived at? I.e. what is the overhead of adding each referenced transaction output to the new transaction’s input? I assume it scales linearly?

[quote=“No_2, post:5, topic:3251”]Thanks for these links and info. I have a further question:

Does anyone know how the price per multiple of 1000 bytes was arrived at? I.e. what is the overhead of adding each referenced transaction output to the new transaction’s input? I assume it scales linearly?[/quote]

The only one who could definitively answer that is Sunny King, but I’ve always worked under the belief that it was an educated, but arbitrary decision. 0.01 PPC was a tiny amount when the protocol was launched (and it’s still not a very large amount).

It does scale in a linear fashion.

[quote=“Chronos, post:3, topic:3251”]The number of kilobytes is rounded up. For example:

[ul][li]Any transaction up to 1kb will require 0.01PPC to be destroyed[/li]
[li]Any transaction up to 2kb will require 0.02PPC to be destroyed[/li]
[li]Any transaction up to 3kb will require 0.03PPC to be destroyed[/li][/ul]

And so on.[/quote]

What’s the size in bytes of referencing each transaction output?

I got this one as I working thinking of parsing my own data for my project.

it differs a little than btc but it does have a nice wiki https://en.bitcoin.it/wiki/Protocol_specification

a tx has A list of 1 or more transaction inputs or sources for coins.

One txin consists of
TxIn consists of the following fields:
32 Previous output hash (OutPoint)
4 Prevous output index (OutPoint)
1 length of signature script
? signature script (coinbase)
4 Sequence

so it depends on the signature script