Source: docs/lotus-v2/decisions/resources-and-parameters.md
🎯 Why: Replace arbitrary hard block-size walls with smooth, market-driven parabolic cost curves and automatic congestion fee burning.

In Practice: Normal payments stay cheap (~1 atom/byte), while huge transactions or sudden spam bursts face a smoothly rising fee-burn floor that no miner can bypass.

Under the Hood: Unified Cost Units (cu), one-pass AST size/cost upper bound, parabolic transaction cost C_tx = L + (L^2 >> 17), and rolling integer EMA E_n block fee-burn floor.

Resource soundness and parameter selection

Decision packet P05. Candidate cost algebra and parabolic fee-burn curves specified for D08 (unified Cost Units cu, parabolic transaction cost $C_{\text{tx}}$, rolling integer ema_block_cost $E_n$, and parabolic block burn floor, eliminating hard step-function walls MAX_TX_BYTES and MAX_BLOCK_BYTES); primitive cu coefficients and shift constants ($S_{\text{tx\_knee}}, w, E_{\min}, S_{\text{linear}}, S_{\text{quad}}$) remain to be confirmed by hardware benchmark and economic simulation before genesis freeze. A resource rule is consensus, even when its motivation is protection of a daemon. No post-genesis vote or hardware benchmark may change it implicitly.

Monetary index convention: issuance step n >= 0 means block height n + 1; genesis commits the initial state without advancing any recurrence. See P02's genesis/indexing rule.

Static cost algebra

Apply P03's bounded instruction-boundary success scan first. An invocation containing an unassigned OP_SUCCESS_N pays a structural charge covering its complete script bytes and scan, plus all outer witness/proof/transaction charges; its suffix need not form an AST and no ordinary VM instructions run. The algebra and size pass below apply only when the scan finds no unassigned success opcode. Future assignments preserve the frozen accounting view and add execution restrictions as specified below.

Assign every primitive a positive integer upper-bound charge in Cost Units (cu) (normalized so 1 wire byte = 1 cu) covering its operands and memory behavior. A charge that grows with operand size is a nondecreasing function of a per-operand size bound; the bound comes from the size pass below, and is MAX_ELEMENT_BYTES wherever that pass has no better answer. Let cost(node) be:

ordinary instruction: scheduled upper bound
sequence: sum(cost(child))
conditional: condition/control charge + max(cost(then),cost(else))
loop(bound,body): setup + bound*(iteration_control + cost(body))

Generic enumeration bound is always 256 for static charging; input/output bounds are validated counts I/O. Charge BREAK as an instruction but ignore its early termination when calculating the bound. The bound includes unexecuted arms and the complete loop syntax. No path-by-path symbolic execution is needed: the size pass below is a single traversal that merges paths. Use checked unsigned 128-bit arithmetic for every primitive charge and composed subexpression. Overflow of any such intermediate rejects before execution, including inside a zero-bound loop body. Compare MAX_INVOCATION_COST only against the complete invocation charge, structural bytes plus cost(script), after applying the loop bound and conditional max; a provisional body charge above that cap does not independently reject a zero-bound loop. The schedule must make all intermediate charge calculations well-defined before a narrowing conversion.

With nonnegative charges, structural induction proves monotonicity in bounds: sums, max, and multiplication by nonnegative bounds are monotone. An ordinary instruction's charged work is bounded by its schedule. A selected conditional arm is bounded by max; a loop executes no more than its captured bound and BREAK only removes work. Induction therefore establishes actual abstract charge <= static charge, conditional on correct primitive upper bounds and control semantics. It does not prove a nanosecond bound or a hardware-independent memory-latency bound.

Decode/charge syntax once per invocation, not once per expanded iteration. Nested I×O loops remain legal; I identical invocations still charge I²O inner work. No optimization discounts. Runtime memory/stack/range checks remain necessary even when static cost fits.

Extension-safe accounting and enforcement

Freeze two views at genesis. C_account is the monetary accounting cost: evaluate the genesis opcode allocation, instruction-boundary success scan and cost schedule forever, even after assigning a success byte. An invocation that encounters a genesis-success byte keeps its genesis structural accounting charge for its complete script and outer work. This immutable view defines L, C_tx, C_block and the EMA committed in MonetaryState.

C_enforce is the current validation charge. Initially it equals C_account. After an extension activates, statically charge its actual execution under the activated rules, at least the genesis accounting charge for that invocation; retain all outer charges and apply the same parabolic aggregation. Enforce invocation limits and the block burn floor using C_enforce >= C_account, but update the EMA only from C_account. Thus in the deduction formula use R = RequiredBlockBurnFloor(C_enforce, E_n); genesis-rule nodes compute the weaker floor using C_account and accept the same coinbase underclaim and state root. New checks may reject more blocks; they must not change state transitions for blocks they accept. Each later activation must preserve all previous restrictions and must not lower the prior enforcement charge for an accepted invocation; comparison only to the genesis baseline is insufficient across multiple upgrades.

The genesis scan used for accounting is distinct from the activated execution scan: newly assigned instructions may execute, but remain success bytes in the immutable accounting view. Prefix/suffix execution costs, proof/wire work, the fixed size-pass algorithm and block-overhead costs must be covered. Future assignments cannot reinterpret transaction bytes, monetary recurrence inputs or output/state effects. Differential upgrade vectors must compare whole-block acceptance and exact post-state roots, not only script success. Increased enforcement cost is a restriction, never a new monetary-state value.

Size-bounded charging

MAX_ELEMENT_BYTES has a working value of 8192, chosen so that a post-quantum signature or key (for example SLH-DSA at about 7.9 KB) fits in one stack item. A large limit must not raise the price of scripts that only handle small items, so size-dependent charges use a bound computed per operand, before execution, by one traversal of the decoded script.

The pass never rejects a script and adds no validity rule. It only chooses charges. Where it cannot follow the stack it falls back to the maximum, which is the rule this packet had before.

State. Either Known(main, alt), two lists holding one byte-size bound per stack item, or Unknown. In Unknown every operand is charged at MAX_ELEMENT_BYTES (plus the worst-case quadratic limb surcharge (max_limbs^2 - 1) * 16 with max_limbs = ceil(min(MAX_ELEMENT_BYTES, 1024) / 16) on MUL, DIV, MOD, MUL128_WIDE, LOG and SQRT when max_limbs > 1). The initial state is Known: the witness arguments at their actual lengths in wire order, then N-sized (16) for the mint delta in a mint invocation; alt is empty.

Transfer rules. An instruction that needs more items than a Known state holds moves the pass to Unknown (it would error if executed, but it may sit in an arm that never runs).

Instruction Bound of each result
PUSH_n, PUSHDATA exact data length
constants, comparisons, NOT, 0NOTEQUAL, BOOLAND, BOOLOR, WITHIN, LOG, OUTPUTCONTINUESBRANCH and every other Boolean result, DEPTH, SIZE, counts, indices, values 16
BIN2NUM, 1ADD, 1SUB, NEGATE, ABS, SQRT, MULPOW2 clamp(bound(a), 16, 1024) (with quadratic limb surcharge (limbs^2 - 1) * 16 operand bytes on LOG and SQRT when limbs = ceil(min(bound(a), 1024) / 16) > 1)
ADD, SUB, DIV, MOD, MIN, MAX max(clamp(bound(a), 16, 1024), clamp(bound(b), 16, 1024)) (with quadratic limb surcharge (limbs_a * limbs_b - 1) * 16 operand bytes on DIV and MOD when limbs_a * limbs_b > 1)
MUL 16 when bound(a) <= 16 and bound(b) <= 16, else min(2048, clamp(bound(a), 16, 1024) + clamp(bound(b), 16, 1024)) (with quadratic limb surcharge (limbs_a * limbs_b - 1) * 16 operand bytes when limbs_a * limbs_b > 1)
ADDCARRY, SUBCARRY low limb clamp(max(bound(a), bound(b)), 16, 1024), carry/borrow 16
MUL128_WIDE both limbs clamp(max(bound(a), bound(b)), 16, 1024) (with quadratic limb surcharge (limbs_a * limbs_b - 1) * 16 operand bytes when limbs_a * limbs_b > 1)
RAWLEFTBITSHIFT the shifted operand's bound
hashes, LEAFHASH, NODEHASH, MERKLEROOT_SORTED, MERKLEROOT_INDEXED, TXID, OUTPOINTTXID, CHAINID, SIGHASH, BRANCHROOT, token IDs, branch roots 32
CAT sum of both operand bounds, capped at MAX_ELEMENT_BYTES
SPLIT each piece takes the source's bound
NUM2BIN the width, if it is a constant in 0..MAX_ELEMENT_BYTES pushed by the immediately preceding instruction; otherwise MAX_ELEMENT_BYTES
INVERT, AND, OR, XOR the larger operand bound
LESSSWAP both results take the larger of the two operand bounds
DUP, OVER, SWAP, ROT, TUCK, NIP, DROP, alt-stack moves and the other fixed stack shuffles bounds move with their items
PICK, ROLL with an in-range index pushed as a constant by the immediately preceding instruction, the exact slot. Otherwise PICK yields the maximum bound on main, and ROLL sets every main slot to that maximum
ACTIVEBYTECODE length of the running script
path, complete-output and other transaction or coin reads with a constant index, that field's actual length in this transaction or its resolved coin; otherwise the maximum of that field over all inputs or outputs
NOP no change

Conditional. Pop the condition, analyze both arms from the same state. If both results are Known with equal main and alt heights, the result is the slot-by-slot maximum; otherwise Unknown. A missing ELSE is an empty arm.

Loop. Let S0 be the state at loop entry, plus the 16-byte index the loop pushes for each iteration. Analyze the body once to get S1. Every BREAK reached in the body pops its depth operand; for each enclosing loop that the BREAK may exit (only the inner loop if the depth is a constant 1 pushed by the immediately preceding instruction, otherwise every active enclosing loop), if the state at BREAK after popping is Unknown or differs in main or alt height from that loop's entry state before its index, the state after that loop is Unknown; otherwise merge that BREAK state slot-by-slot into S1 and into the exited loop's post-loop state. If S1 is Known with the same heights as S0 before its index, set to MAX_ELEMENT_BYTES every slot whose bound grew, and analyze the body a second time from that widened state; if any slot still grows, or the heights differ, or either result is Unknown, the body is charged in Unknown and the state after the loop is Unknown. Otherwise the body's charges are those of the second analysis and the state after the loop is the slot-by-slot maximum of S0, the second result and any BREAK states that exit that loop. Each body is analyzed at most twice, so with nesting depth two the pass visits any instruction at most four times.

Soundness obligation. For every execution and every instruction reached, each operand's actual size is at most the bound the pass assigned at that instruction. With charges nondecreasing in the bound, actual abstract charge <= static charge continues to hold. Unknown reproduces the maximum-operand rule, so the pass can only lower a charge where it has a proof. Runtime element, count and total-byte checks are unchanged and still required; the pass is not a memory proof. Vectors must cover unequal conditional arms, computed PICK/ROLL indices, accumulating and non-accumulating loops, BREAK at equal and unequal heights, and underflow inside an unexecuted arm.

Unified Cost Units (cu) and transaction linear base cost $L(\text{tx})$

All wire bytes, BLAKE3/SHA256 hashing, signature verifications, state-tree updates, and static VM opcode charges are unified into a single integer unit: Cost Units (cu), where 1 wire byte = 1 cu and every cryptographic, commitment, state, and VM operation has a deterministic static cu charge. Each transaction's linear base cost $L(\text{tx})$ (u64) is the checked sum of:

  1. Wire parsing and canonicalization by bytes/counts (1 cu per serialized wire byte) and all script structural scans. For coinbase, the zero-cost absence of witnesses does not exempt its bytes or outputs.
  2. Coin resolution, resolved output bytes and metadata; path/witness matching.
  3. Script/mint commitment hashing and every supplied membership sibling.
  4. InputCoreLeaf(i), InputsRoot, InputFullLeaf(i), FullInputsRoot, OutputLeaf(j), OutputsRoot, CoinLeaf(i), CoinsRoot, TxID, TxHash, and OwnInputHash(i) construction and hashing, charged linearly in $O(\text{tx bytes} + \text{resolved coin bytes})$ even if lazily cached. Both TxID and TxHash top-level digests hash a fixed 112-byte preimage, and every CHECKSIG or SIGHASH execution in any mode (00, 01, 02) hashes a fixed-size preimage of 138, 150 or 178 bytes ($\le 4$ BLAKE3 64-byte compression blocks including the domain prefix) in $O(1)$ time, preventing quadratic sighash hashing.
  5. Every spend and mint invocation, including signatures, data hashing, byte copies, introspection serialization and Merkle-root opcodes (MERKLEROOT_SORTED and MERKLEROOT_INDEXED, charged at k <= floor(size_bound(proof_bytes) / 32) times the step cost of hash_alg, or max(C_blake3, C_hash256) when hash_alg is non-constant).
  6. Native/token aggregation and mint lookup, with a deterministic bounded algorithm/model.
  7. State updates and root calculation: each consumed/created key's leaf/value hashing and interior-node updates in P02's compact single-leaf-collapsed sparse tree (~27 hashes per key at $10^8$ coins, bounded by a conservative per-key cu charge).

Input resolution never loads parent transactions into memory, and outputs carry no inline scripts or state blobs. With the hard consensus caps MAX_OUTPUT_BRANCHES = 16 and MAX_OUTPUT_PATHS = 16 (P01), every serialized Output is at most 812 bytes (45B native / 77B token for single-branch outputs) and every UTXO Coin record is at most 868 bytes (865 bytes without the outer CS length). Spending 256 or 1,000 inputs from the largest transactions in history therefore requires $< 225\text{ KB}$ or $< 870\text{ KB}$ of Coin memory, eliminating Bitcoin's PrevTx and oversized-UTXO out-of-memory vectors by construction. Furthermore, each path is a subset of 0..15 stored in RAM as a single uint16_t bitmask (uint16_t paths[16], 32 bytes per coin), making UTXOREQUIRESBRANCH, OUTPUTREQUIRESBRANCH, OUTPUTEXCLUSIVEBRANCH and OUTPUTCONTINUESBRANCH $O(1)$ bitmask operations.

The sorted/hashed algorithm chosen for asset accumulation must have a bounded worst-case schedule; expected O(1) hash-table lookup is not a worst-case consensus argument. Model at most I+O asset records with a deterministic sort or another explicitly bounded procedure. Storage I/O and peer submission limits remain operational obligations; consensus does not require the entire UTXO set in RAM.

Minimum byte fees and coinbase reward deduction

MIN_FEE_PER_KB = 1000 native atoms per 1,000 bytes (decimal kB). Here a “sat” means one native atom, 10^-6 XPI; it does not mean 10^-8 XPI. For b bytes define ByteFee(b) = ceil(1000*b/1000) = b atoms using checked integer arithmetic. This is a consensus floor, not merely the upstream default relay policy. Relay may require more.

Every ordinary transaction requires F_tx >= ByteFee(len(Tx)), counting its complete serialized bytes, including scripts and witness arguments. C14a's token-output burn remains a separate lower bound on the same fee, so both must hold; this does not add the two minima together. The parabolic block requirement below is additional and can require more burn than the byte floor.

Coinbase has no fee-paying inputs. Its byte charge is deducted from the reward. Define overhead_bytes = 134 + 4 + sum(len(CS(len(Tx)))) for the header, transaction count and all transaction-frame prefixes. Set K = ByteFee(len(coinbase) + overhead_bytes). No bytes are exempt and ordinary transaction payload bytes are not counted twice. Coinbase hashing, output validation and state insertion are included in L(coinbase); only nonexistent script execution, coin resolution and signing work are omitted. C_envelope charges envelope bytes, block transaction-tree hashing and other block-only work under the frozen schedule; per-transaction work is not charged twice.

Let R = RequiredBlockBurnFloor(C_block, E_n) be the parabolic expression below. With G = F - T_tok, BurnedFees = ceil(G/2), and actual coinbase output sum C, require:

U_required = max(K, max(0, R - BurnedFees))
C <= S + floor(G/2) - U_required
U = S + floor(G/2) - C

If the available entitlement is less than U_required, the block is invalid; subtraction never wraps. Equivalently require U >= K and BurnedFees + U >= R. The unclaimed amount is burned, including when paid from subsidy in a coinbase-only block. Explicit burn outputs do not count as this underclaim. Coinbase payout distribution, including Avalanche-selected payouts, occurs after the required deduction. Genesis is a fixed manifest block with zero native issuance and is exempt from recurring fee/EMA rules; P02 defines that initialization boundary.

Parabolic transaction and block cost curves (replacing MAX_TX_BYTES and MAX_BLOCK_BYTES)

Arbitrary hard step-function byte walls (MAX_TX_BYTES and MAX_BLOCK_BYTES) are removed from consensus. Structural framing bounds (u16 input/output counts, MAX_OUTPUT_BRANCHES = 16, MAX_OUTPUT_PATHS = 16, MAX_ELEMENT_BYTES = 8192, MAX_SCRIPT_BYTES, MAX_ARGUMENTS, MAX_STACK_ITEMS, etc.) remain enforced before allocation so parsers never allocate unbounded buffers, while aggregate transaction and block capacity are governed by smooth parabolic integer cost curves enforced through C16's mandatory 50% native fee burn.

1. Parabolic transaction effective cost $C_{\text{tx}}$

Given a transaction's linear base cost $L = L(\text{tx})$ (u64 Cost Units), its parabolic effective cost $C_{\text{tx}}$ (u64, computed with checked u128 intermediates) is:

$$C_{\text{tx}} = L(\text{tx}) + \big((L(\text{tx}) \cdot L(\text{tx})) \gg S_{\text{tx\_knee}}\big)$$

with candidate knee shift $S_{\text{tx\_knee}} = 17$ ($2^{17} = 131{,}072\text{ cu}$):

2. Rolling integer ema_block_cost ($E_n$) and parabolic block burn floor

Let $C_{\text{block}}$ be the sum of $C_{\text{tx}}$ over all transactions, including coinbase, plus deterministic block-envelope work at post-genesis step $n$, accumulated in checked u128 arithmetic:

$$C_{\text{block}} = C_{\text{envelope}} + \sum_{\text{tx} \in \text{block}} C_{\text{tx}}$$

The canonical 56-byte MonetaryState record (P02) maintains a rolling integer exponential moving average $E_n$ (ema_block_cost:u64) of block cost units with candidate smoothing shift $w = 10$ ($2^{10} = 1024\text{ blocks} \approx 34.1\text{ hours}$ at 2-minute blocks), updated after accepting issuance step $n$:

$$E_{n+1} = E_n - (E_n \gg 10) + (C_{\text{block}} \gg 10)$$

Let $F_n$ be total native transaction fees of issuance step $n$'s ordinary transactions, $T_{\text{tok},n}$ the mandatory token-output burn (C14a), $G_n = F_n - T_{\text{tok},n}$ the remaining native fees, and $\text{BurnedFees}_n = G_n - \lfloor G_n / 2 \rfloor = \lceil G_n / 2 \rceil$ the mandatory 50% burned share of remaining native fees under C16. Consensus requires $\text{BurnedFees}_n + U$ to be at least the Required Block Burn Floor:

$$\text{BurnedFees}_n + U \ge \left(\big(C_{\text{block}} \cdot \max(E_n,\, E_{\min})\big) \gg S_{\text{linear}}\right) + \left(\big(C_{\text{block}} \cdot C_{\text{block}}\big) \gg S_{\text{quad}}\right)$$

Why this synergy with C16's 50% fee burn replaces MAX_BLOCK_BYTES:

Parameter manifest to freeze

Family Required named parameters / constraints
Wire framing u16 input/output counts (MAX_INPUTS, MAX_OUTPUTS), MAX_BLOCK_TXS, MAX_MINTS (MAX_TX_BYTES and MAX_BLOCK_BYTES removed in favor of parabolic $C_{\text{tx}}$ and block burn floor)
Output/authorization MAX_OUTPUT_BRANCHES = 16, MAX_OUTPUT_PATHS = 16 (implied MAX_PATH_BRANCHES = 16, MAX_OUTPUT_BYTES = 812, MAX_COIN_BYTES = 868), MAX_BRANCH_PROOF_DEPTH = 64
VM MAX_SCRIPT_BYTES, MAX_ARGUMENTS, MAX_ELEMENT_BYTES (working value 8192), MAX_STACK_ITEMS, MAX_ALTSTACK_ITEMS, MAX_VM_BYTES, MAX_AST_DEPTH; loop depth=2 and generic bound=256
Cost & parabolic curves Frozen accounting schedule and extension enforcement schedule (1 wire byte = 1 cu), MIN_FEE_PER_KB = 1000 atoms per 1000 bytes, MAX_INVOCATION_COST, candidate shift parameters ($S_{\text{tx\_knee}} = 17$, $w = 10$, $E_{\min}$, $S_{\text{linear}}$, $S_{\text{quad}}$) and initial $E_0$
Time/chain COINBASE_MATURITY, POW_LIMIT, ASERT anchor and half-life (working value 172800 s), timestamp/future-eligibility rules
Money 56-byte MonetaryState initial values ($R_0 = M_{\text{boot}}$, $T_0$, $W_{-1}$, $E_0$), bootstrap shift ($k_{\text{boot}} = 20$), tail bounds ($T_{\min}, T_{\max}$), DUST_LIMIT and the token-output burn multiple (C14a), zero genesis issuance; Avalanche payout profile (P06)
Identity ChainID, header/transaction versions, exact genesis bytes/hash, network/address/seed/directory configuration

Represent constants in a versioned machine-readable manifest, not scattered daemon defaults. Its byte grammar and digest must be fixed before freezing; a JSON file with unspecified number/string canonicalization is not yet a consensus hash preimage. An outer release manifest can hash the exact canonical parameter-file bytes without making its own digest part of those bytes.

Feasibility constraints matter as much as maxima: a standard payment must sit comfortably in the flat linear region ($L(\text{tx}) \ll 2^{S_{\text{tx\_knee}}}$); a useful two-level covenant must fit its invocation budget; every valid Output ($\le 812\text{ bytes}$) fits well inside MAX_ELEMENT_BYTES (8192) for UTXOOUTPUT / OUTPUTRECORD introspection; total stack memory must cover legal individual elements; and bounded parser allocations must prevent out-of-memory conditions on rejected inputs before block fee-burn validation runs.

Calibration procedure

Before freezing the numerical mainnet shift constants ($S_{\text{tx\_knee}}, w, E_{\min}, S_{\text{linear}}, S_{\text{quad}}$) and primitive cu schedule, define supported hardware and a target full-block verification/recovery envelope. Measure scalar worst permitted operands, including each crypto algorithm, wide math, LOG's fixed 64 rounds, hashing, copying, proof handling, sparse-tree updates, large spent coins and asset aggregation. Fit conservative integer cu coefficients (normalized to 1 wire byte = 1 cu) with documented margin, and validate the parabolic transaction and block burn floor shifts against economic and hardware stress simulations.

A separate named development profile may choose smaller values for fixtures. Its name and ChainID must differ from production, and passing it must not be represented as mainnet capacity qualification. No development value is adopted by this packet merely to make the checklist green.

Implementation can begin on the parameterized parser/evaluator, unified cu cost algebra, and parabolic fee-burn checks before final constant calibration. Mainnet readiness cannot. This separates a real implementation dependency from a launch dependency without pretending either is complete.

A minimally populated block, including its coinbase byte charge and envelope work, must remain affordable at the selected tail minimum and reachable EMA values. Test that liveness condition during calibration; underclaim may consume subsidy but cannot make a negative payout valid. Coinbase output amounts use fixed-width encoding, so reducing the claim does not change its serialized length; constructors finalize output count/policies before computing the deduction.


References

  1. [Chancellor 2026] Shammah Chancellor, "Adaptive PoW Monetary Policy Without Oracles: A Constructive Mechanism for Pseudo-Stability via Work-Coupled Tail Emission and Burn", Lotus Network Technical Paper, 2026.
  2. [Buterin et al. 2019] Vitalik Buterin, Eric Conner, Rick Dudley, Matthew Slipper, Ian Norden, and Abdelhamid Bakhta, "EIP-1559: Fee market change for ETH 1.0 chain", Ethereum Improvement Proposals, April 2019.
  3. [Roughgarden 2020] Tim Roughgarden, "Transaction Fee Mechanism Design for the Ethereum Blockchain: An Economic Analysis of EIP-1559", arXiv:2012.00854, December 2020.
  4. [Nakamoto 2008] Satoshi Nakamoto, "Bitcoin: A Peer-to-Peer Electronic Cash System", October 2008 (https://bitcoin.org/bitcoin.pdf).
  5. [Lombrozo, Lau, & Wuille 2015] Eric Lombrozo, Johnson Lau, and Pieter Wuille, "BIP 141: Segregated Witness (Consensus layer)", Bitcoin Improvement Proposals, December 2015.