6

Given the number of inputs, number of outputs, and mixin count, what is the formula to calculate the expected size (in bytes) of the resulting Monero transaction?

For comparison's sake, in Bitcoin, the formula for calculating the size of a transaction is (from this stackexchange question):

in*148 + out*34 + 10 plus or minus 'in'
6

I have this, which may be wrong as I've not tested it a whole lot. The constants at start are "close enough", I did not try to be 100% precise:

47 + inputs * (39+(mixin+1)*2) + outputs*38 + 64 * inputs * (mixin+1)

If you want to know whether a fee is acceptable before it is actually sent, you can use set always-confirm-transfers 1 in simplewallet, and you'll always be prompted with the transaction before it is sent to the daemon.

For RingCT, the calculation is more complicated, see https://github.com/moneromooo-monero/bitmonero/blob/rct/src/wallet/wallet2.cpp, estimate_rct_tx_size (which is also a good approximation only, not exact).

The main reason for "not exact" is that integers tend to be stored as variable length, depending on their value.

In both cases, a tx_extra of 40 bytes is assumed (typically, a payment id). You can remove 34 bytes if there's none.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.