Aptos launches the MOVE language with innovative GAS design, detailing the on-chain fee calculation mechanism.

MOVE Language's Innovative GAS Design: Exploring the GAS Fee Calculation Mechanism on the Aptos Chain

On October 14, Aptos Labs announced the GAS plan for Aptos. Since previous versions of the MOVE language did not consider the GAS mechanism, this GAS plan established for Aptos is the first GAS design for the MOVE language and is referred to as "a bold adventure".

The GAS plan of Aptos outlines the principles, processes, calculation methods, subsequent adjustments, and community participation involved in the formulation of GAS.

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

implementation process

The implementation process on the Aptos blockchain includes:

  1. Definition Principles
  2. Prepare the evaluation framework and 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

The core principles defined by Aptos include:

  1. Operating costs should be directly related to the available resources of the network and decrease with technological advancements.
  2. GAS is set by on-chain governance and can be seamlessly configured.
  3. GAS can prevent DoS attacks and needs to be adjusted quickly based on network conditions.
  4. The GAS price reflects the vision of accelerating growth and maintaining blockchain accessibility.
  5. Encourage making good choices in design that prioritize safety, modularity, and other factors.

GAS calculation method

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

  • Maximum GAS Amount: The maximum number of GAS units that a user is willing to pay for executing a transaction.
  • GAS price: calculated in octal per unit of GAS, 1 octal = 0.00000001 APT

During the execution of the transaction, the following will be charged:

  1. Fixed costs
  2. Execution Cost
  3. Read Cost
  4. Writing Cost

Final transaction fee = Total amount of GAS consumed × GAS unit price

For example, a transaction consumes 670 GAS units, and the user specifies the GAS price as 100 Octa/unit, so the final fee is 670 × 100 = 67000 Octa = 0.00067 APT.

If the GAS is exhausted during the transaction execution, the sender will be charged for the maximum GAS amount, and all changes will be reverted.

GAS plan schedule construction

Basic Configuration

The GAS plan includes components that are independent of individual operations, such as transaction size and maximum GAS units.

trading scale

Most transaction sizes are at the kilobyte level, with the Move module release reaching several kilobytes, and the Aptos framework around 100 KB. User modules generally range from 4KB to 40KB. Currently, the transaction size is set to 64KB to balance network bandwidth costs and ease of application development.

Maximum GAS Unit

The maximum GAS unit defined in the GAS plan specifies the maximum amount of operations that can be executed in a single transaction, set at 1,000,000. A setting that is too high may lead to performance issues, such as infinite loops.

Execution Cost Assessment

Estimate the relative costs of MOVE instructions and native functions through benchmarking frameworks and Valgrind analysis. Considering system robustness and security, derive the final number of executed machine instructions, and determine the current value in balance with storage and maximum GAS units.

Storage Cost

Storage GAS fee = Project fee + ( byte fee × Byte count )

Access types include read, create, and write, each with different billing standards:

  • Read operation: calibrated based on disk IOPS and bandwidth capacity
  • Creation Operation: Based on network reference disk space calibration, the cost is the highest.
  • Write operations: Charge the same fee for bytes in the update item as for creation.

Defined 6 GAS parameters: per item read, per byte read, per item creation, per byte creation, per item write, per byte write.

stable GAS unit cost

The fixed GAS unit cost helps maintain the stability of the GAS plan, decoupled from the market value of APT. The Aptos team represents GAS units with approximately three-digit precision, for example, the cost of a transfer transaction is about 700 GAS units.

Community Participation

Aptos encourages community members:

  1. Discover unreasonable aspects of the GAS plan
  2. Participate in community discussions
  3. Vote on GAS-related governance proposals

GAS cost adjustment

The GAS plan serves as on-chain configuration storage and can be modified through governance proposals. Designed to be scalable, it allows for upgrades and parameter adjustments. Complex changes require updates to node software and widespread adoption.

Future Outlook

As the first viable GAS framework for MOVE, future work directions include:

  1. Reduce execution costs
  2. Implement multi-dimensional GAS calculation
  3. Alleviating the issue of bloated states

The team is exploring the TTL concept for each project, automatically deleting unvisited status projects when the TTL expires.

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
  • 3
  • Share
Comment
0/400
ApeShotFirstvip
· 5h ago
Finally, Aptos is gaining momentum, buddy. Let's explode the gas first!
View OriginalReply0
ProposalManiacvip
· 5h ago
So many people have dealt with GAS, is it time for MOVE to take the risk? Hehe, it's just old wine in a new bottle.
View OriginalReply0
SandwichTradervip
· 5h ago
Do you really dare to brag about this newbie village thing in move?
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)