cadlabs-ethereum-economic-model
Learn More →
Mathematical Model Specification for the CADLabs Ethereum Economic Model version v1.1.0.
If you are not viewing this document in HackMD, it was formatted using Markdown and LaTeX to be rendered in HackMD. For the best viewing experience see https://hackmd.io/@CADLabs/ryLrPm2T_
This Mathematical Model Specification articulates the relevant Ethereum validator economics system dynamics as a state-space representation. Given the iterative nature of dynamical systems modelling workflows, we expect to make adjustments to this Mathematical Model Specification as we build and validate the cadCAD model.
The model implements the official Ethereum Specification wherever possible, but rests on a few default system-level and validator-level assumptions detailed in the model ASSUMPTIONS.md document.
Although cadCAD technically supports several computational modelling paradigms (e.g. agent-based modelling, population-level modelling, system dynamics modelling, hybrid modelling, etc.) we adopt an aggregate system dynamics lens. Rather than modelling the behaviour of individual agents, we consider what is often called a "representative agent" in economics literature. This allows us to apply aggregation and approximation for groups of agents, or in our case - validators aggregated as validator environments.
Unless specified otherwise in the Mathematical Model Specification, all State Variables, System Metrics, and System Parameters are time-dependent and calculated at per-epoch granularity. For ease of notation, units of time will be assumed implicitly. In the model implementation, calculations can be aggregated across epochs where necessary - for example for performance reasons.
The Mathematical Model Specification uses the following notation:
lambda x: 1
would be represented as: The following domain notation is used in the Mathematical Model Specification:
To create a state-space representation, we first describe the system's state-space in the form of a set of State Variables. A state-space is a data structure that consists of all possible values of State Variables. The state of the system can be represented as a state vector within the state-space.
For reasons of clarity and comprehensibility we categorize State Variables as follows: ETH State Variables, Validator State Variables, Reward and Penalty State Variables, EIP-1559 State Variables, and System Metric State Variables.
We define the State Variables' domain, range, and units. The "variable" column values are direct referrences to the cadCAD model code.
Name | Symbol | Domain | Unit | Variable | Description |
---|---|---|---|---|---|
ETH Price | $ |
eth_price |
ETH spot price sample (from exogenous process) | ||
ETH Supply | eth_supply |
ETH supply with inflation/deflation | |||
ETH Staked | eth_staked |
Total ETH staked ("active balance") by all active validators |
Name | Symbol | Domain | Unit | Variable |
---|---|---|---|---|
# Validators in Activation Queue | None | number_of_validators_in_activation_queue |
||
# Validators | None | number_of_validators |
||
# Validators Online | None | number_of_validators_online |
||
# Validators Offline | None | number_of_validators_offline |
||
Average Effective Balance | average_effective_balance |
|||
Validator ETH Staked | validator_eth_staked |
Name | Symbol | Domain | Unit | Variable |
---|---|---|---|---|
Base Reward | base_reward |
|||
Source Reward | source_reward |
|||
Target Reward | target_reward |
|||
Head Reward | head_reward |
|||
Block Proposer Reward | block_proposer_reward |
|||
Sync Reward | sync_reward |
|||
Amount Slashed | amount_slashed |
|||
Validating Rewards | validating_rewards |
|||
Whistleblower Rewards | whistleblower_rewards |
|||
Attestation Penalties | attestation_penalties |
|||
Sync Committee Penalties | sync_committee_penalties |
|||
Validating Penalties | validating_penalties |
|||
Total Online Validator Rewards | total_online_validator_rewards |
Name | Symbol | Domain | Unit | Variable |
---|---|---|---|---|
Base Fee per Gas | base_fee_per_gas |
|||
Total Base Fee | total_base_fee |
|||
Priority Fee per Gas | base_fee_per_gas |
|||
Total Priority Fee to Validators | total_priority_fee_to_validators |
|||
Total Priority Fee to Miners | total_priority_fee_to_miners |
We first define System Metrics on the level of the following 7 validator environments, using Numpy array matrix algebra:
We then define network-level System Metrics through aggregation.
The State Variables in this category have the following vector form:
Name | Symbol | Domain | Unit | Variable |
---|---|---|---|---|
Validator Revenue | [$] | validator_revenue |
||
Validator Profit | [$] | validator_profit |
||
Validator Revenue Yields | validator_revenue_yields |
|||
Validator Profit Yields | validator_profit_yields |
|||
Validator Count Distribution | validator_count_distribution |
|||
Validator Hardware Costs | [$] | validator_hardware_costs |
||
Validator Cloud Costs | [$] | validator_cloud_costs |
||
Validator Third-Party Costs | validator_third_party_costs |
|||
Validator Costs | [$] | validator_costs |
The above validator-environment-level System Metrics are then aggregated into scalar values to define aggregate network-level system metrics. For example, the validator costs
Name | Symbol | Domain | Unit | Variable |
---|---|---|---|---|
ETH Supply Inflation | supply_inflation |
|||
Total Revenue | $ | total_revenue |
||
Total Profit | $ | total_profit |
||
Total Network Costs | $ | total_network_costs |
||
Total Revenue Yields | total_revenue_yields |
|||
Total Profit Yields | total_profit_yields |
By defining State Variables we have defined the system's state-space and with it, system boundaries. System inputs are not dependent on the system's State Variables. Their logic is defined by Policy Functions in our cadCAD model, and they update the model's State Variables via State Update Functions.
We describe three environmental processes as System Inputs, updating the ETH Price and ETH Staked State Variables.
For the purpose of the model, we define environmental processes for both Validator Adoption and ETH Staked. A certain level of Validator Adoption has an implied ETH Staked value. We use the ETH Staked process to drive the model when performing phase-space analyses of a range of ETH staked values, and the Validator Adoption process when performing time-domain analyses where the validator activation mechanism also comes into play.
The ETH Staked environmental process, represented in the model as a Python lambda function, is called at each epoch with the current run and timestep, and returns the change in ETH staked to update the ETH Staked State Variable during runtime. On the other hand, the Validator Adoption environmental process returns the number of validators being added to the activation queue at each epoch.
For the MVP implementation of our model we assume a representative agent that remains within the system once entered, and we use a monotonically increasing function as a standard adoption model. We also plan the option for the user to manually define validator adoption levels to emulate custom scenarios.
In future model implementations, we could imagine adding feedback loops from State Variables - for instance, capital efficient validators will likely stake and unstake ETH based on the development of validator returns.
For the MVP implementation of our model we use tiered ETH price levels to represent the relevant spectrum of market conditions, similar to Hoban/Borgers' Economic Model. We also plan the option for the user to manually select ETH price ranges to emulate custom scenarios.
This environmental process, represented in the model as a Python lambda function, is called at each epoch with the current run and timestep, and returns an ETH price sample to update the ETH Price state variable during runtime.
System Parameters are used as configurable variables in the model's System Input (Policy Function) and State Update (State Update Function) logic. An example of a parameter would be the BASE_REWARD_FACTOR
, used to calculate and update the base reward State Variable.
In a cadCAD model, parameters are lists of Python types that can be swept, or in the case of a stochastic process used to perform a Monte Carlo simulation. For the purpose of experimentation we've set defaults, and will sweep parameters within reasonable ranges around these defaults.
Any parameter with the suffix _process
can be assumed to be a Python lambda function used to generate a series of values for said parameter, indexed by the run and/or timestep. An illustrative example:
import random
TIMESTEPS = 100
samples = random.sample(range(95, 99), TIMESTEPS + 1)
validator_uptime_process = lambda _run, timestep: samples[timestep] / 100
For reasons of clarity and comprehensibility we categorize parameters as either Ethereum Official Specification, Validator Environment, Validator Performance, or Transaction Pricing System Parameters.
All System Parameters in this category use the same uppercase snake-case variable naming seen in the Ethereum Official Specification for easy recognition. See the annotated-spec repository and Benjaminion's annotated spec for further reference.
Variable | Default Value | Unit |
---|---|---|
BASE_REWARD_FACTOR |
64 |
None |
MAX_EFFECTIVE_BALANCE |
32e9 |
|
EFFECTIVE_BALANCE_INCREMENT |
1e9 |
|
PROPOSER_REWARD_QUOTIENT |
8 |
None |
WHISTLEBLOWER_REWARD_QUOTIENT |
512 |
None |
MIN_SLASHING_PENALTY_QUOTIENT |
32 |
None |
PROPORTIONAL_SLASHING_MULTIPLIER |
2 |
None |
TIMELY_HEAD_WEIGHT |
14 |
None |
TIMELY_SOURCE_WEIGHT |
14 |
None |
TIMELY_TARGET_WEIGHT |
26 |
None |
SYNC_REWARD_WEIGHT |
2 |
None |
PROPOSER_WEIGHT |
8 |
None |
WEIGHT_DENOMINATOR |
64 |
None |
MIN_PER_EPOCH_CHURN_LIMIT |
4 |
None |
CHURN_LIMIT_QUOTIENT |
2 ** 16 |
None |
BASE_FEE_MAX_CHANGE_DENOMINATOR |
8 |
None |
ELASTICITY_MULTIPLIER |
2 |
None |
Variable | Unit | Description |
---|---|---|
validator_percentage_distribution |
The distribution of the total number of validators per validator type. Vector sum is a total of 100%. | |
validator_hardware_costs_per_epoch |
The per-epoch costs for DIY hardware infrastructure per validator type | |
validator_cloud_costs_per_epoch |
The per-epoch costs for cloud computing resources per validator type | |
validator_third_party_costs_per_epoch |
A percentage value of the total validator rewards that goes to third-party service providers as a fee per validator type |
Variable | Default Value | Unit | Description |
---|---|---|---|
validator_uptime_process |
max(0.98, 2 / 3) |
The expected average validator uptime. A combination of validator internet, power, and technical uptime: 99.9 * 99.9 * 98.2. Minimum uptime is inactivity leak threshold of 2/3 , as this model doesn't model the inactivity leak mechanism. |
|
slashing_events_per_1000_epochs |
1 |
The expected number of validator actions that result in slashing per 1000 epochs |
Variable | Default Value | Unit | Description |
---|---|---|---|
base_fee_process |
30 |
EIP-1559 transaction pricing base fee burned for each transaction. Default value approximated using average historical gas price - see assumptions doc. | |
priority_fee_process |
2 |
EIP-1559 transaction pricing priority fee. Default value approximated using average gas price - see assumptions doc. | |
gas_target_process |
15e6 |
The long-term average gas target per block. Simplifying assumption that gas used per block will equal gas target on average over long-term. |
After defining the model's state-space in the form of System States, we describe the State Update Logic, represented as cadCAD Policy and State Update Functions (sometimes also called "mechanisms").
To visualize the State Update Logic, we use a differential specification diagram (also known as a "cadCAD Canvas" at cadCAD Edu). This diagram will accompany the derivation of the Mathematical Model Specification of the model mechanisms.
The model's cadCAD Canvas / Differential Model Specification is accessible via LucidChart. Below is an illustrative screenshot.
We describe the State Update Logic along the columns of the model's cadCAD Canvas, also known as "Partial State Update Blocks" (PSUB). One round of execution of these Partial State Update Blocks would represent the state transition from one epoch to the next.
Extracts from the cadCAD Canvas have been included for each PSUB below when deriving the Policy and State Update Logic, and the following is the legend included with the cadCAD Canvas:
The following constants are used in the derivation of the State Update Logic.
Name | Symbol | Domain | Unit | Variable | Value |
---|---|---|---|---|---|
Epochs per year | epochs_per_year |
82180 | |||
Epochs per day | epochs_per_day |
225 |
The Upgrade Stages Policy is essentially a Finite-state Machine that handles the transition from on stage in the Ethereum network upgrade process to the next for time-domain analyses, or simply selecting a single stage for phase-space analyses.
The model has three stages, configured using the Stage
Python Enum. The Enum option ALL
transitions through all stages in order:
BEACON_CHAIN
: Beacon Chain implemented; EIP1559 disabled; POW issuance enabledEIP1559
: Beacon Chain implemented; EIP1559 enabled; POW issuance enabledPROOF_OF_STAKE
: Beacon Chain implemented; EIP1559 enabled; POW issuance disabledEach stage has a corresponding date, set using the date_{}
System Parameters.
Validators that deposit their initial stake first enter into an activation queue before being considered active validators and having their stake as part of the effective balance used when calculating validator rewards and penalties.
The number of validators is equal to the sum of the number of validators online and offline:
The ETH price is driven by an environmental process, defined earlier in the Model Specification, that updates the ETH price at each timestep.
The total ETH staked is the number of activate validators multiplied by the average effective balance in ETH:
The following mathematical pseudo-code is used to calculate the aggregate average effective balance of the system:
The base reward is calculated as the average effective balance multiplied by the ratio of the base reward factor to the square-root of the total ETH staked multiplied by the base rewards per epoch (the higher the ETH Staked, the lower the base reward):
The rewards and penalties from PoS block proposal, attestation, and sync committees, are approximated and aggregated across all validators at each epoch.
It is useful seeing the rewards as a pie-chart, where the combined rewards are equal to one base reward (see source):
To approximate the source, target, and head vote rewards, it is assumed that all online validators get a source, target, and head vote in time and correctly once per epoch. The calculation for reward per epoch is the same, replacing the TIMELY_SOURCE_WEIGHT
with the appropriate reward weight:
It is assumed that all offline validators are penalized for not attesting to the source, target, and head:
The total validating rewards is calculated as the sum of all validator reward State Variables:
The total validating penalties is the sum of attestation and sync-committee penalties:
First, we calculate the slashing reward for a single slashing event, indicated by
The whistleblower rewards are made up of both a reward for the whistleblower, and for the proposer:
In addition to the slashing penalty, there is a slashing penalty proportional to the total slashings in the current time period using the PROPORTIONAL_SLASHING_MULTIPLIER
:
Finally, the individual slashing penalty is calculated as the sum of the individual slashing and proportional slashing penalties:
To calculate the total amount slashed and whistleblower rewards for the epoch, we scale by the number of slashing events per epoch:
EIP-1559 replaces the current transaction gas price (in Gwei per gas), with two values: a dynamic base fee that is burned and applied to all transactions, and a priority fee per transaction that is paid to miners/validators.
The current gas limit is replaced by two values:
The long-term average gas target per block is set to 15m gas; by default we assume the gas used per block will on average be equal to the gas target.
Pre-merge, while Proof-of-Work is still active, miners receive the priority fee, and the gas used is calculated according to block-time:
Post-merge, when Proof-of-Work is deprecated and Proof-of-Stake validators start including transactions, validators receive the priority fee, and the gas used is calculated according to slot-time:
System Metrics are computed from State Variables in order to assess the performance of the system. The calculation of our System Metrics is also represented in the model's cadCAD Canvas / Differential Model Specification and accessible via LucidChart. Below is an illustrative screenshot.
The following state-update logic for system metric State Variables could also be performed in post-processing, assuming there are no feedback loops that influence the metrics, to improve run-time performance.
The total online validator rewards is the net rewards and penalties awarded to online validators accounting for validating, whistleblowing, and priority fees post-merge:
The ETH supply at the next epoch is equal to the sum of the ETH supply at the current epoch and the net network issuance:
The validator costs is the sum of hardware, cloud, and third-party costs per validator type:
The total network costs is the sum of validator costs over all validator types (row index
The validator revenue is the rewards for online validators in ETH,
The validator profit is the validator revenue less the validator costs:
The total revenue is the sum of validator revenue over all validator types:
The total profit is the total revenue less the total network costs:
The per-validator revenue and profit yields are calculated and annualized as the validator profit and revenue multiplied by the number of epochs in a year divided by the validator ETH staked,
The total revenue and profit yields are calculated and annualized as the total profit and revenue multiplied by the number of epochs in a year divided by the total ETH staked,