Transaction Rules

Introduction

This chapter does not include miner, coinbase, transactions as they are handled elsewhere, the rules for them are under blocks

Index

  1. Miscellaneous Rules
  2. Input Rules
  3. Output Rules
  4. Unlock Time
  5. Ring Signatures
  6. RingCT

Miscellaneous Rules

Version

Version 0 is never allowed1.

The max transaction version is 1 up to hard fork 4 then the max is 22.

The minimum tx version is 1 up until version 6 then if the number of un-mixable inputs is 0 the minimum is 2 otherwise 13 so a version 1 transaction is allowed if the amount it's spending does not have enough outputs with the same amount to mix with.

Transaction Size

The size of the transaction blob must not be bigger than 1 million bytes4.

From v8, the transaction's weight must not be bigger than half of the block penalty free zone minus 6005.

Calculating Transaction Weight

For all transactions that don't use bulletproofs or bulletproofs+ the weight is just the length of the transaction blob.6

For bulletproofs(+) transactions we add a "clawback" onto the transaction.

To calculate the "clawback" we fist define a bpBase which is the size of a 2 output proof, normalized to 1 proof by dividing by 27:

for bulletproofs: \(fields = 9\)

for bulletproofs+: \(fields = 6\)

\(bpBase = \frac{(32 * (fields + 7 * 2))}{2}\)

Next we calculate the size of the bulletproofs(+) field by first getting the first power of 2 above or equal to the number of outputs: firstPower2AboveNumbOuts.

If firstPower2AboveNumbOuts is <= 2 then the \(clawback = 0\)8.

Next define the number of L and R elements9: \(nlr = firstPower2AboveNumbOuts + 6\)

now the size of the bulletproofs(+) field is10:

\(bpSize = 32 * (fields + 2 * nlr)\)

now the clawback is11:

\( clawback = \frac{(bpBase * firstPower2AboveNumbOuts - bpSize) * 4}{ 5} \)

To get the transaction weight now you just get the length of the transaction blob and add this clawback12.