Telos EVM doresources Action Complete

Telos Foundation
Telos Core Developers
2 min readJan 6, 2023

Why do we need to run this action? Great question…a few people in the chats have asked. Now that the eosio.evm::doresources action has been run for the first time on the Telos Mainnet, we can dive into more detail.

Since the tEVM is built as a Telos smart contract, it utilizes network resources (CPU, NET, RAM) just like any other smart contract. The main resource the tEVM contract has to manage is RAM. RAM is the on chain “live” storage medium for any data stored for a Telos smart contract database. Every tEVM transaction causes a table update or addition and therefore cost RAM to store that data.

The tEVM contract settings and actions can be found here: https://explorer.telos.net/account/eosio.evm?tab=contract but we also have a screen shot below for simplicity.

The resources table includes:

  • GAS_PER_BYTE — The amount of gas measured in Gwei charged per byte of Telos RAM consumed during a transaction. In this case, 45 gwei = 1 byte.
  • BYTE_COST — The weighted average cost per byte of Telos RAM as of the last time doresources was ran.
  • BYTES_USED — How many bytes of RAM have been used to store data over the lifetime of the EVM deployment.
  • BYTES_BOUGHT — How many bytes of RAM the contract has purchased over time.
  • TARGET_BYTES_FREE — The number of RAM bytes set by the TCD that the contract should aim to have free.
  • MIN_BYTE_BUY — The minimum amount of RAM the contract will buy. Any amount under this setting and it won’t execute a RAM buy till the next time doresources is ran.
  • FEE_BALANCE — The balance of TLOS collected from tEVM gas fees.
  • FEE_TRANSFER_PCT — The percentage of gas fees that should be transferred to the fees.evm account when doresources is ran.

Running eosio.evm::doresources performs many actions. We captured all the command output here for the geeks: https://pastebin.com/p6ULsYqz and the batched transactions can be viewed here for the not-so-geeks https://explorer.telos.net/transaction/8580f67a04228f235583789f5e0370e16c92446c6699bca607de1520be7aabd9

The main two actions were to figure out how much RAM needed to be bought to maintain the target_bytes_free setting and buy that RAM using the collected gas fees. It then transfers the leftover fees under the custody of the BPs in the fees.evm account for future use. After that, it recalculates the gas price based on the average price paid for RAM over time. This calculation uses the GAS_PER_BYTE multiplier and the BYTE_COST to arrive at the updated gas price.

All that to say, gas on the tEVM is now 504 Gwei a total increase of 0.7% :-)

--

--

Telos Foundation
Telos Core Developers

Innovation meets gaming at Telos. Your home for secure, scalable & supercharged gaming experiences. Empowering devs, exhilarating gamers. https://www.telos.net