Analysis of the GAS fee calculation mechanism of the Aptos chain: The innovative design of the MOVE language

The First GAS Design of MOVE Language: Detailed Explanation of GAS Fee Calculation on Aptos

The MOVE language was not initially prepared for the GAS program, so the GAS program established by Aptos is seen as an innovative attempt. Aptos's GAS program clarifies the principles, processes, calculation methods, and later adjustment mechanisms for formulating GAS, while also welcoming community suggestions.

GAS measurement is a fundamental concept in Aptos and many blockchains, used to abstract the amount of computational and storage resources required for executing and storing on-chain transactions. The GAS plan determines the cost of all executions on-chain, used to calculate the GAS expenditure during transaction execution.

implementation process

The implementation process on the Aptos chain includes:

  1. Definition Principles
  2. Prepare the evaluation framework to determine the price for each execution.
  3. Establish a GAS measurement system and secure GAS algebra for MOVE
  4. Import the upstream GAS framework into Aptos
  5. Make the GAS framework storage-aware
  6. Further refine the GAS plan

Core Principles

  1. The operating cost should be directly related to the available resources of the network, and the GAS cost should decrease accordingly after technical improvements.
  2. GAS should be set by on-chain governance and can be configured seamlessly.
  3. GAS can prevent DoS attacks on the network's fixed resources and needs to be quickly adjusted based on network conditions.
  4. The GAS price of Aptos reflects the foundation's vision of accelerating growth and maintaining the popularity of the blockchain.
  5. Encourage making wise choices in design, such as prioritizing security, modularity, etc.

GAS calculation method

When users submit a transaction, they need to specify two quantities:

  1. Maximum GAS amount: The maximum number of GAS units that a user is willing to spend to execute a transaction.
  2. GAS price: calculated in octal per unit of GAS, 1 octal = 0.00000001 APT.

A fee will be charged during the transaction execution process:

  1. Fixed Cost
  2. Execution Cost
  3. Read Cost
  4. Write Cost

Final transaction fee = Total amount of GAS consumed × GAS unit price. For example, if the transaction consumes 670 units of GAS and the user specifies the GAS unit price as 100 Octa per unit, then the final transaction fee is 670 × 100 = 67000 Octa = 0.00067 APT.

If the transaction runs out of GAS during execution, the sender will be charged the maximum GAS amount, and all changes will be reverted.

GAS plan construction

  1. Basic configuration: including trade size and maximum GAS units.

  2. Transaction size: Currently set at 64KB, balancing the demand for large-scale transactions and network performance.

  3. Maximum GAS Unit: Defines the maximum amount of operations that can be executed in a single transaction, currently set to 1,000,000.

  4. Execution Costs: Evaluate the relative costs of MOVE instructions and native functions using a benchmark framework and Valgrind analysis tools.

  5. Storage costs: Consider data access and permanent storage costs, and design a storage GAS plan. Storage GAS fee = project fee + ( byte fee × number of bytes )

read, create, and write operations

  • Read: The most common operation, with costs calibrated based on disk IOPS and bandwidth capacity.
  • Create: Add new items to the state storage, highest cost, calibrated based on network disk space.
  • Write: Update existing items, byte fee is the same as creation.

stable GAS unit cost

The fixed GAS unit cost helps maintain stability in the GAS program, decoupling it from the market value of APT. The Aptos team represents GAS units with an accuracy of about three digits, for example, the cost of a transfer transaction is approximately 700 GAS units.

Community Participation

Aptos encourages community members:

  1. Point out the unreasonable aspects of the GAS plan.
  2. Participate in community discussions and express concerns about the GAS plan.
  3. Vote on governance proposals related to GAS on Aptos

GAS cost adjustment mechanism

The GAS plan is designed as on-chain configurable storage and can be modified through Aptos governance proposals. It is designed to be scalable, allowing upgrades via governance proposals. Complex changes to the GAS formula require updates to node software and a significant amount of adoption, ultimately approved through governance proposals.

Future Outlook

As the first viable GAS framework for MOVE, the Aptos team plans:

  1. Reduce execution costs
  2. Implement multi-dimensional GAS calculation, allowing users to specify separate budgets for execution and storage.
  3. Alleviate the problem of bloated states, explore the TTL concept for each project, and delete unvisited state items when the TTL expires.
APT6.74%
MOVE4.68%
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • 6
  • Repost
  • Share
Comment
0/400
BlockchainRetirementHomevip
· 07-31 12:51
It's the beginning of being imitated again.
View OriginalReply0
TommyTeachervip
· 07-30 11:32
It seems to be well planned.
View OriginalReply0
GateUser-a180694bvip
· 07-29 09:16
The gas design is very creative.
View OriginalReply0
JustHereForMemesvip
· 07-29 09:16
Too many processes are not as good as doing it cleanly.
View OriginalReply0
metaverse_hermitvip
· 07-29 09:06
The mechanism is a bit complicated.
View OriginalReply0
BlockchainThinkTankvip
· 07-29 09:05
The cost of data analysis is high.
View OriginalReply0
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)