Quantities and units
In this section, we introduce the quantities used in our models of agent economies, together with their units and basic operations.
| Quantity | Symbol | Unit | Type |
|---|---|---|---|
| Account sequence number | none | Nonce | |
| Asset amount | asset base unit | Amount asset | |
| Execution usage | gas | Gas | |
| Execution price | asset base units / gas | PricePerGas asset | |
| Power | W | Power | |
| Duration | s | Duration | |
| Energy | J | Energy |
Gas accounting follows Ethereum's gas documentation, whose diagram credits Ethereum EVM illustrated. The energy row is a separate physical calculation. The two numerical examples are independent; 21,000 gas does not imply an energy use of 200 J.
Nonce
Definition 1 (Account nonce).
An account nonce is a nonnegative integer identifying the next outgoing transaction in the transfer model. Its successor is
structure Nonce where
value : Nat
deriving DecidableEq, Reprdef Nonce.next (nonce : Nonce) : Nonce :=
⟨nonce.value + 1⟩The account and transfer both use
Nonce. A transfer carrying 7 is accepted only when the account expects 7;
afterwards it expects 8. This counter is different from the nonce miners vary
in a Bitcoin block header.
Ethereum account nonces,
Bitcoin block headers.
Asset amounts
Definition 2 (Asset amount).
For a fixed asset , an amount is an integer count of its smallest units. Amounts of different assets have different types. For native ETH, the smallest unit is wei:
structure Amount (asset : AssetId) where
units : Nat
deriving DecidableEq, Reprabbrev Wei := Amount etherThe asset parameter fixes the network and asset identity; decimal metadata
controls display. A value of 3,000,000,000,000,000 wei displays as 0.003 ETH.
ETH denominations.
Gas and fees
Gas measures execution usage under the protocol's rules. It is separate from measured electricity consumption.
Definition 3 (Execution fee).
Given chargeable gas usage and an effective price in base units of asset per gas, the fee is
The units satisfy
structure Gas where
units : Nat
deriving DecidableEq, Reprstructure PricePerGas (asset : AssetId) where
units : Nat
deriving DecidableEq, Reprdef fee {asset : AssetId}
(used : Gas) (price : PricePerGas asset) :
Amount asset :=
⟨used.units * price.units⟩fee takes Gas and a rate for one asset, then returns an amount of that same
asset. A Nonce or Energy value cannot be used as its gas argument. All
stored counts are unbounded natural numbers; protocol integer limits are not
encoded here.
For Ethereum, instantiate the asset with native ETH. Using an illustrative effective price of 2 gwei per gas and a supplied usage of 21,000 gas:
def transferGas : Quantities.Gas := ⟨21000⟩def effectivePrice : Quantities.PricePerGas ether :=
⟨2 * 10 ^ 9⟩The fee is 42,000,000,000,000 wei, or 0.000042 ETH. Gas usage and effective price are inputs here; this function does not execute the EVM or determine the price from fee caps. The effective-price rules are specified in EIP-1559.
At a fixed price, usage can be combined before pricing:
theorem fee_add {asset : AssetId}
(first second : Gas) (price : PricePerGas asset) :
fee ⟨first.units + second.units⟩ price =
(fee first price).add (fee second price) := by
simp only [fee, Amount.add, Nat.add_mul]This equality justifies aggregating usage at the same rate. It makes no such claim for quantities charged at different rates.
Physical energy
Energy is a resource consumed by the hardware running an agent, storing data, and communicating with other agents. Computation processes information into answers, plans, or actions. A service's costs depend on the resources it uses; its value to the buyer depends on the result and the task.
Definition 4 (Energy at constant power).
Over an interval of duration with constant power ,
The executable calculation uses whole watts and whole seconds. For varying power, the continuous relation is ; it is not implemented by this constant-power function.
structure Power where
watts : Nat
deriving DecidableEq, Reprstructure Duration where
seconds : Nat
deriving DecidableEq, Reprstructure Energy where
joules : Nat
deriving DecidableEq, Reprdef energy (power : Power) (duration : Duration) :
Energy :=
⟨power.watts * duration.seconds⟩NIST's definition of the watt gives the unit relation. At 100 W for 2 s, the energy consumed is 200 J. The power input must specify what it covers: one device, a server, or a share of a larger system. Attributing energy to a task also requires a measurement interval and a rule for allocating shared consumption.
For an illustrative allocation of the same 200 J, suppose a GPU uses 60 W, a CPU 25 W, and a separate network device 15 W throughout those two seconds. The bands show each device's share of the energy. These are example inputs, not hardware measurements; each device is counted once.
def deviceEnergy : List Energy :=
[energy ⟨60⟩ ⟨2⟩, -- GPU
energy ⟨25⟩ ⟨2⟩, -- CPU
energy ⟨15⟩ ⟨2⟩] -- Network deviceThe three calculations return 120, 50, and 30 J. Their sum equals the 200 J computed from the combined power of 100 W over the same interval.
Energy enters an agent's economic account through an electricity tariff; service revenue comes from the buyer's payment. Comparing them requires a common currency or asset and an explicit exchange rate when needed. Hardware costs and payments to other services are additional expenses. If a provider pays a hosted API price, its energy costs may already be included in that bill and must not be counted again as a separate expense.
An energy budget also constrains which tasks an agent can perform. Comparing implementations means holding the task and its quality requirements fixed, then comparing energy, completion time, and monetary cost. The amount of useful information in a result is not determined by the joules consumed. These relationships need a specified task and hardware; neither a gas-to-joule conversion nor an energy-to-value conversion is assumed here.