Bitcoin Cash fees on both ends

in #utxo5 months ago

Abstract

Transaction sizes can be calculated using a 1-degree polynomial of two variables. Ax+By+C where x is the the number of inputs, and y is the number of outputs. A, B and C are constants. An entity that receives many payments but spends a small number of payments will see a very elevated cost compared to the average median transaction.

Background

Both Bitcoin chains use a UTXO model. Which virtually means the coins work like a bunch of checks filled with random amounts but no names.

  1. You spend by filling the name of the recipient into a number of checks and and you write a new one for yourself with an amount and blank name and one for the recipient which will have the amount and a blank name.
  2. In the block chain the number of these signed checks take up 141 bytes each and the number of new checks with no name filled in take up 34 bytes each.
  3. In this analogy after the broadcast, the checks with the names are considered spent and cannot be cashed in again.
  4. The fees depend on how much space is used by a transaction on the blockchain rather than the amount.

Methodology

Using ElectronCash, various transactions were made and previewed and the sizes were observed. And then mathematical methods were used to derive the constants.

Details

Transaction shapeSize
Atypical one coin in, and one out185 bytes
Typical one UTX in, but two out219 bytes
Less typical one UTX in, but two out226 bytes
Three in, one out467 bytes
Three in, two out501 bytes
Five in, one out749 bytes
Five in, two out783 bytes
Seven in, one out1031 bytes
Seven in, two out1065 bytes
200 in, two out28 kBytes (calculated)

Purely from a mathematical point of view. Let x be the number of inputs and y be the number of outputs of a transaction. Neither i nor o make good letters to use for variables in Mathematics. I conjecture there is some A, B and C so that Ax+By+C will equal most of these transactions outlined in the chart.


and

thus
A + B + C= 185 Α + 2Β + C = 219 Α + 2Β + C - (A + B + C) = Β Α + 2Β + C - (A + B + C) = 219 - 185 = 34 B=34

The difference between the various transactions which have the same number in but have different amount of outputs is 34. At least B is constant here.

We should consider only A by comparing various that have only one output:
7A + B = 1031 3A + B = 467 4A = 564 A = 141

In particular 5A + B is 5*141 + 34 = 739 and the transaction size is 749 bytes. So C would seem to be 10 bytes.

Observe that A is consistent with being a constant:
2A (between 7A and 5A) = 7A + B - (5A + B) = 282 (141×2) 2A (between 5A and 3A) = 5A + B - (3A + B) = 282 (141×2)

Take the transaction of 1 in and two out

So now we can try plugging these in to other transactions. A+2B+C=219 C = (A+2B+C) - 2B - A = 219 - 141 - 2*34 = 10

Seven in and one out: 7*141+34+10 = 1031 bytes.

Merchant fees

A retail level merchant have very high number of inputs and end up using large transactions on the network. Fees when finally paying Bitcoin (Core) or Bitcoin Cash will be large sizes. In particular, if a merchant makes 200 sales with either Bitcoin in a week and then uses that to pay expenses in a single transaction, the transaction size for that will be 28,278 bytes. On Bitcoin Core (Block Stream's Bitcoin) this would be about $50 at current prices. On Bitcoin Cash this will be $0.09.

Conclusion

Your fees you pay depend on not only how many transactions but how you receive them. Thinking of them as a bunch a checks that you have to pay fee on for each when you want to cash them at the bank is a way to look at it.

For every 216 bytes of free that is paid sending you a transaction there is 141 bytes of fee going into your transaction paying someone else. As I indicated, this can really add up.