Skip to content
Monpediaby Unity Nodes
Category LabsSpecification

Monad Initial Specification Proposal

13 pages

Open the PDF (opens in a new tab)category-labs.github.io
Contents25 sections

Monad Initial Specification Proposal

Category Labs Version 2.0.1 November 19, 2025

1

Introductory Concepts

1.1

Fields in Transactions and Blocks

A transaction t has the same fields as an Ethereum transaction. The relevant ones that the transaction specifies are: • Gas limit, gas_limitt . Every transaction is only allowed to set gas_limitt ≤ max_tx_gas_limit, i.e., less than the full block_gas_limit. • Type 2 (EIP-1559) transactions: – Priority fee per gas (“maxPriorityFeePerGas” in Yellow paper), priority_fee_per_gast . – Max fee per gas (“maxFeePerGas” in Yellow paper), max_fee_per_gast . • Type 0 and type 1 transactions (legacy transactions): – Gas Price (“gasPrice” in Yellow paper), gas_pricet The block header for block k contains three base fee-related fields: • Base fee, base_feek • Trend accumulator, trendk , used inside the formula for the base fee update (details in Section 2.6). • Moment accumulator, momentk , used inside the formula for the base fee update (details in Section 2.6).

1.2

Asynchronous Execution

In Monad, block execution is allowed to be delayed with respect to consensus. Concretely, consensus block n includes the state root obtained by executing block n − k where k is a protocol parameter defining the allowed execution delay. Consequently, validity checks performed by consensus for block n must only depend on staten−k and the static data of block n − k + 1 through block n.

p. 2

Transaction Fee Mechanism (TFM)

The bid for gas by transaction t in block k is given by: EIP-1559 tx type : gas_bidt = min(priority_fee_per_gast + base_feek , max_fee_per_gast ) Legacy tx type : gas_bidt = gas_pricet

2.1

Inclusion and Block Construction

Validity checks for block k: • Block gas limit check:

P t∈block

gas_limitt ≤ block_gas_limit

• Check for every transaction t: – Base fee check: gas_bidt ≥ base_feek – Per-transaction gas limit check: gas_limitt ≤ max_tx_gas_limit – Other standard checks as in Ethereum, such as nonce matches the account nonce and gas limit covers the intrinsic gas. 2.1.1

Reserve Balance

Reserve Balance logic is performed in both the consensus and execution clients to ensure that despite asynchronous execution, sender accounts have enough balance to pay for gas fees at the time of execution. During execution, transactions revert due to spending of account balance outside of gas payments when the balance is below a specified reserve balance level. An exception is made for undelegated accounts that have no pending transactions within the past k blocks. When performing block validity checks for block n, consensus queries account balances of transaction senders from execution state as of block n − k and checks that the worst-case balance for each sender after executing blocks n − k + 1 through block n will be non-negative when factoring in execution spending restrictions. See Section 6 for a full description of the consensus and execution logic.

2.2

Ordering

Transactions are ordered in the client according to their bid for gas, gas_bidt . This ordering preference is not a validity check: it need not be checked on others’ blocks. It only describes the default client implementation and is not meaningfully enforced by the protocol.

2.3

Payment Rule for User

The payment for transaction t is given by the gas fees: Paymentt = gas_bidt · gas_limitt The user pays the gas fees on the gas limit, and there are no gas refunds (due to deallocations in SSTORE opcode for example). The user account is required to have enough balance to cover the upfront payment of gas_bidt · gas_limitt (more details in Section 6).

2.4

Burn Rule

The burn for each transaction t in block k is the gas burn: Burnt = base_feek · gas_limitt

p. 3

2.5

Reward Rule for the Validator

The reward for the validator for block k is given by the sum of the priority gas fees and a constant block reward (staking and consensus-related rewards/penalties are not included here): X Rewardk = (gas_bidt − base_feek ) · gas_limitt t∈block

2.6

Base Fee Update Rule

Similar to EIP-1559, Monad has a mandatory base fee enforced by consensus that is computed algorithmically across blocks based on recent utilization relative to a target. As with block validity checks, utilization is measured with respect to gas_limittx . Additionally, a protocol parameter min_base_fee is introduced as a lower bound to the base fee paid. The update rule is defined as follows: X block_gask = gas_limittx tx∈blockk

  base_feek+1 = max min_base_fee, base_feek · exp ηk · ηk =

block_gask − target block_gas_limit − target



max_step_size · epsilon q epsilon + momentk − trend2k

trendk+1 = beta · trendk + (1 − beta) · (target − block_gask ) momentk+1 = beta · momentk + (1 − beta) · (target − block_gask )

2

The initial values for the genesis block are: base_fee0 = 0; moment0 = 0; trend0 = 0. The reference implementation is provided in Section 7; these are the integer math calculations that must be followed, including for example the flooring square root. For more discussion around the update rule and parameters, see Section 5.

p. 4

List of Parameters with Suggestions

• Transaction-level: – max_tx_gas_limit = 30M (controls for large transactions)1 • Higher protocol-level: – block_gas_limit = 200M (500M gas / sec for 0.4 second block times) – block_size_limit = 2MB (applies to total size of RLP encoded transactions; excludes header) – min_base_fee = 100 MON-gwei (i.e., 100 · 10−9 MON) – default_reserve_balance = 10 MON (10 million gas in flight at 10 times the min base fee, yet small amount) – k = 3 (building / validating consensus block n requires knowing state obtained by applying block n − k) • Base fee update rule: – Learning rate max_step_size = 1/28 – Block gas target = 80% of limit = 160M – Smoothing for accumulators beta = 0.96 – Scaling factor epsilon = 1 · target = 160M

1 max_tx_gas_limit should be updated in conjunction with target.

p. 5

Opcode and Precompile Gas Costs

The costs of a few opcodes differ from the Yellow paper.

4.1

Cold Access Cost

To account for the relatively higher cost of state reads from disk in the Monad execution client, the following changes are proposed to "cold" account and storage access costs: Access Type Account Storage

Ethereum 100 if warm else 2600 100 if warm else 2100

Monad 100 if warm else 10100 100 if warm else 8100

Impacted opcodes: • Account access: BALANCE, EXTCODESIZE, EXTCODECOPY, EXTCODEHASH, CALL, CALLCODE, DELEGATECALL, STATICCALL, SELFDESTRUCT • Storage access: SLOAD, SSTORE For these opcodes, the dynamic access cost is unchanged for warm access and is as specified above for cold access.

4.2

Precompiles

Precompiles are recalibrated to accurately reflect their relative costs in execution, and the following precompiles’ gas cost is changed compared to Ethereum: Precompile ecRecover ecAdd ecMul ecPairing blake2f point eval ∗

Address 0x01 0x06 0x07 0x08 0x09 0x0a

Ethereum 3000 150∗ 6000∗ 45000∗ rounds×1 50000

Monad 6000 300∗ 30000∗ 225000∗ rounds×2 200000

Multiplier 2 2 5 5 2 4

: Per input/operation as defined in the respective precompile specification.

p. 6

Discussion

5.1

Reasoning for Parameters

5.1.1

Block Gas Target and Goal of Update Rule

The intended behavior of the base fee mechanism is that the base fee only ramps up so long as there is long-term (i.e., not just for a few blocks) average gas usage close to the entire gas limit of the chain. Otherwise, and in the usual case that there is no sustained (long-term) demand above the block gas target, the base fee is intended to remain around min_base_fee. For this reason, the block gas target is set to 80% (significantly higher than 50% in Ethereum’s EIP-1559) to allow for higher utilization, yet leave room for collecting demand signals. 5.1.2

Minimum Base Fee

There are three ways to derive the minimum base fee: • Cost to the users. • The revenue/yield for the network, more specifically holders • The marginal cost of processing an average unit of gas. We use the first criterion. In order for a simple transfer (21,000 gas) to cost about 0.002 MON, set the min_base_fee to 100 MON-gwei (i.e., 100 · 10−9 MON). 5.1.3

Base Fee Update Rule Parameters

First, an observation: by design, we want the fee to increase slower upon seeing full blocks than it decreases. We will design the learning rates for the former. Specifically, when seeing a series of empty blocks (depending on the smoothing parameter, longer or shorter), the fee will adjust at rates quadruple the ones we mention below; this is due to how we decided to set our target, and is an intended property to protect from overestimation of congestion relative to the block capacity. We design the top end such that the highest rate corresponds to Ethereum’s rates but with 1 second block times, i.e., 3.6%.Then, we fix the lowest achievable rate to correspond to a less aggressive than Ethereum’s (half) at 1 second block times; or equivalently, Ethereum’s rate at 0.25 second block times. These choices fully specify the parameters, and also, in hindsight, provide satisfying “normal” step size and step size lower bound if blocks are above the target: with a long-term variance of 20% of the block gas limit, this is a rate of 2.88%, corresponding to Ethereum’s rate with 0.64 second block times. Finally, for the smoothing parameter, we choose a smoothing constant of β = 0.96 for a half-life of about 17 blocks, with the goal to definitely fade spikes of less than ∼ 10 seconds, i.e., fade at least about 20 blocks.

5.2

Gas Limit vs Gas Used

Due to delayed execution, and to prevent denial of service speculative attacks (that would show up as severe underutilization of the chain’s capacity), the fees have to be charged on the transaction’s gas limit, or at least some function of it. We choose to charge both the base fee and the priority fee on the gas limit: • For the base fee, charging on the gas limit penalizes more the variance in actual execution gas, making variance penalties on risk-adjusted arbitrage expected value (EV) heavier for speculative / optimistic arbitrageurs, thus disincentivizing these harmful use cases (over the execution of normal, less-variance user transactions). Such high-variance execution gas transactions are those that we define as more correlated with spam transactions that we would like to disincentivize. • For the priority fee, charging on the gas limit allows validators to still accurately determine the fees paid to them under delayed execution. This is because it makes the knapsack problem of optimally choosing the transactions to include in a block as easy as it can be, and it helps in inducing a clear bidding behavior from users (upfront cost as a static unconditional payment). Payment based on gas

p. 7

used would have been a conditional payment under delayed execution. Note that a conditional payment can already be made through coinbase transfers. Either kind of conditional payment (coinbase or based on gas used) would require synchronous execution (or accurate enough estimation) for the knapsack optimal transaction choice problem (of a validator) to be tractable.

5.3

Reserve Balance UX Implications

Reserve balance (Section 2.1.1) is introduced to address the unknown execution results of transactions pending in the last k blocks due to delayed execution. The design was chosen to minimize disruption to standard usage patterns while enabling advanced users to have multiple pending transactions. In terms of practical implications, reserve balance can cause a given transaction to: • Be invalid for inclusion in a consensus block depending on the set of pending transactions. • Revert in execution if an account balance decreases beneath the reserve balance outside of gas payments. For an account that is undelegated (and with no pending authorizations), the first pending transaction is unaffected by reserve balance restrictions in either consensus or execution and is simply subject to standard balance solvency checks. Subsequent transactions sent from that account within k blocks could be impacted, especially if the account balance is close to or below the reserve level. For delegated accounts, all transactions are potentially affected.

p. 8

Reserve Balance Specifications

There is a default reserve balance for all accounts denoted by default_reserve_balance. In a future version, the protocol could allow users, through a stateful precompile, to customize their reserve balance. Denote the reserve balance for account a as user_reserve_balance(a). Let the consensus-execution delay gap be denoted by k blocks. More specifically, building or validating a consensus block number n requires knowing about state obtained by applying block n − k (staten−k ) from the execution client (k>1 for asynchronous execution). Denote account a’s balance at a state st as balance(a, st). Denote account a’s EIP-7702 delegation status at the state st as is_delegated(a, st): it is true if the delegation is towards a non-null address, false otherwise. Let the block number in which tx is sequenced (or being considered for sequencing) be denoted by blocknumber(tx). We say a transaction is before (denoted by ≺; ⪯ denotes before or equal to) another transaction based on their ordering in the blockchain. Similarly, we say a transaction t is after a state s if t is after the transaction that produced s.

p. 9

Let gas_fees(t) = gas_limitt · gas_bidt . Algorithm 1: Transaction Inclusion Validity. Used by consensus client and execution client with appropriate values of parameter x. For consensus client, x = n − k Precondition: n > x ≥ n − k Given: • t: Transaction from account t.sender for block n • statex : State obtained by applying block x (x = n − k for consensus client) • I: All intermediate transactions from account t.sender from block x + 1 (inclusive) up to t (inclusive). • P: All transactions from block x − k + 2 (inclusive) up to t (inclusive). Define: ValidInclusion(t, statex , I, P) :=

(1)

let balance = balance(t.sender, statex ) let delegated = is_delegated(t.sender, statex )

(2) (3)

let f irst_tx = I[0]

(4)

let starting_block = min(x + 1, blocknumber(f irst_tx) − k + 1)

(5)

Case Analysis: if f irst_tx = t ∧ IsEmptying(f irst_tx, P, starting_block, delegated) then

(6)

(No intermediate transaction, don’t do reserve balance checks if t qualifies) balance ≥ gas_fees(f irst_tx)

(7)

else

(8)

if IsEmptying(f irst_tx, P, starting_block, delegated) then

(9)

(At most one emptying transaction: I[0])

let adjusted_balance = balance − (f irst_tx.value + gas_fees(f irst_tx)) (adjusted_balance can be negative here, implementation works with EVM’s uint) let reserve = min(user_reserve_balance(t.sender), adjusted_balance) (10) X in reserve ≥ gas_fees(tx) (Sum over all but first) tx∈I[1:]

else

(11)

let reserve = min(user_reserve_balance(t.sender), balance) (12) X in reserve ≥ gas_fees(tx) (Use reserve balance for all transactions) tx∈I

p. 10

Algorithm 2: Transaction Execution

Given: • t: Transaction from account a in block n • state: Current state right before executing t • prior_transactions: All transactions from block n − k + 1 (inclusive) up to t (inclusive). Define: ExecutionResult(t, state, prior_transactions) :=

(13)

let sender = t.sender

(14)

let solvency_condition = balance(sender, state) ≥ gas_fees(t) (Soundness assertion) let (new_state, original_balances) = Execute(state, t) let delegated = is_delegated(sender, state)

(15) (16)

let is_emptying = IsEmptying(t, prior_transactions, n − k + 1, delegated) (17) let reserve_dipped = DippedIntoReserve(original_balances, new_state, t, is_emptying)

(18) (19)

let reverted_state = RevertExecution(state, t) (balance(sender, reverted_state) = balance(sender, state) − gas_fees(t)) Execution Logic: ExecutionResult =   if ¬solvency_condition AssertionFailure (Success, new_state) if solvency_condition ∧ ¬reserve_dipped   (Revert, reverted_state) if solvency_condition ∧ reserve_dipped

(20) (21)

Note: Execute is the black box EVM execution without reserve balance, and returns the state after execution and a map with keys as accounts whose balances were changed during execution and values as the old balances before execution.

p. 11

Algorithm 3: Reserve Balance Dip Detection

Given: • Original balances map original_balances : Address → Balance • New state new_state • Transaction t • is_emptying: Is sender allowed to dip into reserve Define: DippedIntoReserve(original_balances, new_state, t, is_emptying) :=

(22)

∃(account, orig_bal) ∈ original_balances. account is not SC in new_state∧ (23) AccountReserveViolated(account, orig_bal, new_state, t, is_emptying)

(24)

Where: AccountReserveViolated(account, orig_bal, new_state, t, is_emptying) :=

(25)

let reserve = min(user_reserve_balance(account), orig_bal)

(26)

let current_balance = balance(account, new_state) ( max(reserve − gas_fees(t), 0) if account = t.sender let violation_threshold = reserve if account ̸= t.sender

(27) (28)

(max(reserve - gas_fees(t), 0) is done to work with the uint datatypes of EVM.) in ((account ̸= t.sender) ∨ ¬is_emptying) ∧ (current_balance < violation_threshold)

11

(29)

p. 12

Algorithm 4: Emptying Transaction Check

Given: • Transaction t • all_tx: Contains all transactions from block starting_block (inclusive) up to t (inclusive) • Starting block starting_block • Delegation status delegated_in_state Logic: EOA account (no potential delegation) and no prior transactions in the past k blocks (includes t’s block). Define: IsEmptying(t, all_tx, starting_block, delegated_in_state) := let prior_txs = {tx ∈ all_tx : tx ⪯ t∧

(30) (31)

blocknumber(tx) ≥ starting_block} (32) let delegation_condition = delegated_in_state

(33)

let auth_condition = ∃tx ∈ prior_txs. HasDelegationAuth(tx, t.sender) (34) let prior_sender_condition = ∃tx ∈ prior_txs. (PriorSenderTx(tx, t)) (35) Where: PriorSenderTx(tx′ , t) := tx′ ≺ t ∧ tx′ .sender = t.sender ∧ blocknumber(tx′ ) ≥ blocknumber(t) − k + 1 HasDelegationAuth(tx, account) := whether tx contains valid (including wrt nonce) delegation authorization from account

(36) (37) (38) (39)

Note: Delegation authorization towards null address (i.e., undelegating) in prior transactions also counts in HasDelegationAuth. Result: IsEmptying(t, all_tx, starting_block, delegated_in_state) ⇐⇒

(40)

¬delegation_condition ∧ ¬auth_condition (41) ∧ ¬prior_sender_condition (42)

p. 13

Dynamic Base Fee Reference Implementation def fake_exponential(factor: np.uint64, num: np.int64, denom: np.uint64) -> ,→ np.uint64: i = Uint256(1) output = Int256(0) num_accum = Int256( Uint256(factor) * Uint256(denom) ) while num_accum != 0: output += num_accum num_accum = (num_accum * Int256(num)) // Int256(Uint256(denom) * i) i += Uint256(1) return np.uint64(output // Int256(denom)) class DynamicTFM: def __init__(self, gas_limit, target_gas, min_base_fee, beta, epsilon, inv_step): # protocol params self.gas_limit = np.uint64(gas_limit) # 200_000_000 self.target_gas = np.uint64(target_gas) # 160_000_000 self.min_base_fee = np.uint64(min_base_fee) # 100_000_000_000 self.beta = np.uint64(beta) # 96 self.epsilon = np.int64(epsilon) # 160_000_000 self.inv_step = np.uint64(inv_step) # 28 self.base_fee = np.uint64(0) self.moment = np.uint64(0) self.trend = np.int64(0) def update(self, gas_used: np.int64): delta = np.int64(gas_used) - self.target_gas num = self.epsilon * delta denom = self.inv_step * (np.uint64(math.isqrt( np.uint64(max(0, ,→ np.int64(self.moment) - self.trend*self.trend)) )) + self.epsilon) * ,→ (self.gas_limit - self.target_gas) self.base_fee = fake_exponential(self.base_fee, num, denom) self.base_fee = max(self.base_fee, self.min_base_fee) self.trend = ( np.int64(self.beta) * self.trend + ,→ np.int64(np.uint64(100)-self.beta) * (-delta) ) // 100 self.moment = np.uint64( ( Uint128(self.beta) * Uint128(self.moment) + ,→ (Uint128(100)-Uint128(self.beta)) * Uint128(Int128(delta) * ,→ Int128(delta)) ) // Uint128(100) ) Listing 1: Python reference implementation of base fee update rule with integer math