The MOVE language pioneers the GAS mechanism: a detailed explanation of on-chain resource consumption calculation.

robot
Abstract generation in progress

The First GAS Mechanism Design of MOVE Language: Detailed Explanation of On-Chain GAS Consumption Calculation

On October 14, an important breakthrough in blockchain technology was announced. This is the first design of the GAS mechanism in the MOVE language, officially referred to as "an adventure." The mechanism defines an abstract computational method for the amount of computing and storage resources required to execute and store on-chain transactions, used to calculate GAS consumption during the execution of transactions.

Design Process

To execute effectively, the design team followed the process below:

  1. Determine design principles
  2. Establish an evaluation framework to determine the price of each operation.
  3. Establish a GAS measurement system and secure GAS algebra for MOVE
  4. Import the upstream GAS framework on-chain
  5. Make the GAS framework storage-aware
  6. Further optimize the GAS plan

Design Principles

The main principles include:

  1. The operating cost is directly related to the available resources of the network and decreases with technological advancements.
  2. GAS is set by on-chain governance and can be flexibly configured.
  3. GAS can prevent DoS attacks and can quickly adjust based on network conditions.
  4. The GAS price reflects the vision of accelerating growth and maintaining blockchain accessibility.
  5. Encourage excellent choices in design, such as focusing on security, modularity, etc.

GAS Calculation Method

When the user submits a transaction, two quantities must be specified:

  • Maximum GAS Amount: The maximum number of GAS units the user is willing to pay
  • GAS price: calculated in octal per unit of GAS, 1 octal = 0.00000001 APT

During the transaction execution, 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, if a transaction consumes 670 GAS units and the user-specified GAS price is 100 Octa/unit, then the final fee is 670 * 100 = 67000 Octa = 0.00067 APT.

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

GAS Plan Table Construction

1. Basic Configuration

The GAS plan includes some components that are unrelated to individual operations, such as transaction size and maximum GAS units.

2. Transaction Scale

Most transactions are at the kilobyte level, but the released MOVE module can reach several kilobytes. Currently, the transaction size limit is set to 64KB, balancing size and accessibility.

3. Maximum GAS unit

Define the maximum operable amount for a single transaction, set at 1,000,000. Even with the maximum framework upgrade, it will use less than 90%.

4. Execution Cost Assessment

Estimate the relative costs of all MOVE instructions and native functions using the benchmark framework and Valgrind analysis tool. Consider system robustness and security to arrive at the final number of executed instructions.

5. Storage Cost

Consider the bandwidth, IOPS capacity, and permanent occupancy costs of the storage device to design the storage GAS plan. The basic formula is:

Storage GAS fee = Project fee + ( byte fee * Number of bytes )

read, create, and write operations

  • Read: Calibrate based on disk IOPS and bandwidth capacity
  • Creation: Highest cost, calibrated according to reference disk space
  • Write: Charge the same fee for updating items as for creation.

Defines 6 GAS parameters that constitute the total fee:

  • per_item_read
  • per_byte_read
  • per_item_create
  • per_byte_create
  • per_item_write
  • per_byte_write

Stable GAS Unit Cost

Fixed GAS unit costs help maintain the stability of the GAS plan. The team represents GAS units with approximately three-digit precision, such as the transfer transaction cost of about 700 GAS units.

Community Participation

As a community project, members can:

  1. Point out the unreasonable aspects of the GAS plan.
  2. Participate in community discussions
  3. Voting on relevant governance proposals

GAS Cost Adjustment

The GAS plan serves as on-chain configuration storage and can be changed through governance proposals. Designed to be scalable, allowing upgrades. Complex changes require updating node software and achieving widespread adoption, ultimately approved through governance proposals.

Future Work

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

  1. Reduce execution costs
  2. Achieve multi-dimensional GAS calculation
  3. Mitigating the state bloat issue

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

MOVE2.02%
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
  • Share
Comment
0/400
LuckyHashValuevip
· 5h ago
Finally got some gas. Sui's gas has been completely exhausted by move.
View OriginalReply0
BlockchainTherapistvip
· 5h ago
move the first battle ah this is a bit bull
View OriginalReply0
DegenDreamervip
· 5h ago
No wonder it's stable, move.
View OriginalReply0
SilentObservervip
· 5h ago
I understand a bit about this move.
View OriginalReply0
GateUser-74b10196vip
· 5h ago
Su Shen feels that this wave is about to To da moon.
View OriginalReply0
LiquidatorFlashvip
· 5h ago
Can't the gas fee really come down?
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)