The following document explains the way Devonomics amounts are attributed to Starknet contracts in the first iteration of Devonomics. We stress that the computation applied here will be modified in the future as we manage to measure more accurately the exact fees that are attributed to each node in the transaction tree.
We consider blocks on mainnet from the beginning of the network (16/11/2021) to the end of November 2023. More precisely, we consider block numbers between 1 and 448500. The total fees collected are ~16.3K ETH. When all is said and done, we want to distribute 8% of this amount (~1,300 ETH) to dapps and an additional 2% (~320 ETH) to core devs. The protocol regarding the 2% redistribution is not described in this document. Regarding the 8%, below we describe how we computed the amounts to be distributed per contract addresses.
Divide the data per block.
starknet_getStateUpdate
response. The gas cost due to storage diffs can be read from the docs: if the storage diffs dictionary looks like $\{contract_1: dict_1, … , contract_n: dict_n\}$, where $dict_i$ is a dictionary of key-value pairs, then the total gas $G_1$ due to storage diffs is $1024 * (n + \sum_{i=1}^n len(dict_i))$. The 1024 comes from 16*64: 16 gas on L1 to write 1 byte, the 64 is: 1 key-value pair is 2 words (64 bytes), and the contract address (32 bytes) is written with an additional word (32 bytes) that encodes auxiliary information (see the docs).send_message_to_l1
syscall belong here).Distribute $F_1$ and $F_2$ per contract (in the block), at the level of internal calls.
Aggregate the data per contract over all blocks between 1 and 448500. This leads to a table of the form
Contract | Fees due to storage diffs | Fees due to steps and builtins |
---|---|---|
0x12345 | 30 ETH | 1 ETH |
… | … | … |
Note that in the linked table the fees due to storage diffs are called “L1 fees” and fees due to steps and builtins are called “L2 fees”. Moreover, the table only lists the top 10K contracts by fees, therefore the total fees sum to less than the total fees of the network.
Take a weighted sum of the [Fees due to storage diffs] column and [Fees due to steps and builtins] column, with weights $a_1, a_2$ respectively. At this stage the weights are $a_1 = 0.055, a_2 = 2$. This gives the final amount to be distributed to the contract.