Multidimensional gas pricing

·
2 min read
0
Special thanks to Ansgar Dietrichs, Barnabe Monnot and Davide Crapis for feedback and review.
In Ethereum, resources were up until recently limited, and priced, using a single resource called "gas". Gas is a measure of the amount of "computational effort" needed to process a given transaction or block. Gas merges together multiple types of "effort", most notably:
Raw computation (eg. ADD, MULTIPLY)
Reading and writing to Ethereum's storage (eg. SSTORE, SLOAD, ETH transfers)
Data bandwidth
Cost of generating a
ZK-SNARK proof
of the block
For example,
this transaction
that I sent cost a total of 47,085 gas. This is split between (i) a "base cost" of 21000 gas, (ii) 1556 gas for the bytes in the calldata included as part of the transaction (iii) 16500 gas for reading and writing to storage, (iv) gas 2149 for making a
log
, and the rest for EVM execution. The transaction fee that a user must pay is proportional to the gas that the transaction consumes. A block can contain up to a maximum of 30 million gas, and gas prices are constantly adjusted via the
EIP-1559 targeting mechanism
, ensuring that on average, blocks contain 15 million gas.
This approach has one major efficiency: because everything is merged into one virtual resource, it leads to a very simple market design. Optimizing a transaction to minimize costs is easy, optimizing a block to collect the highest possible fees is relatively easy (not including
MEV
), and there are no weird incentives that encourage some transactions to bundle with other transactions to save on fees.