- What are the different pieces of a transaction that take up precious bytes on the blockchain (range proof, MLSAG, inputs, outputs, ECDH, keys, TX extra, other)?
- How much space do they take up (in bytes or kb)?
- Which items' sizes may change in the future?
The transaction structure is:
Transaction version: 1 VarInt
Unlock time: 1 VarInt
Per Input: 1 byte (type: either coinbase or regular spend) + 1 VarInt (pre-ringct amount) + 1 VarInt (the ring size) + Ring_Size VarInts (input offsets) + 32 bytes (key image)
Per Output: 1 VarInt (pre-ringct amount) + 1 byte (type: only regular spend type currently implemented) + 32 bytes (output one-time public key)
Tx extra: Includes 32 bytes for the txpubkey, may contain an encrypted or unencrypted payment id, a nonce if a coinbase tx, and can contain other arbitrary user defined information
Tx type: 1 byte (Version 2 transactions only)
Tx fee: VarInt
Version 1 transactions only: 1 LSAG ring signature per input, each ring signature is 32 bytes * Ring_Size
Version 1 transactions end here. The remainder of the transaction structure applies to Version 2 (RingCT) transactions only:
PsuedoOuts (newly generated commitments for the real input amounts, so that if one real input ring position is revealed, all real input ring positions in the transaction are not also revealed): Per input: 32 bytes (PseudoOuts are present for tx type 2 RCTType2Simple transactions only)
EcdhInfos (encrypted output amounts and OutPk commitment masks): 64 bytes per output
OutPks (output amount commitments): 32 bytes per output
Range proofs: 6176 bytes per output (Dec 2018 update: range proofs have now been replaced with bulletproofs, which are smaller).
MLSAG ring signatures: Per Input: (64 bytes * Ring_Size) + 32 bytes
Therefore, transaction size is most sensitive to increasing the number of outputs, because of the large range proof size requirements. The transaction is also sensitive to increasing the ring size and increasing the number of inputs.
It is expected that later in 2018, a new bulletproof scheme will replace Monero's existing range proofs. This will significantly lower the size of transactions.
Note: The VarInt integer representation is defined in section 1.2 of https://tukaani.org/xz/xz-file-format.txt