Publication
Partagez vos connaissances.
How can developers optimize gas usage when building on Sui?
How can developers optimize gas usage when building on Sui, particularly when designing complex Move contracts and dApps that rely on object interactions, shared state, and high-throughput execution — and what patterns or tools exist to minimize unnecessary storage, computation, and transaction costs
- Sui
- Transaction Processing
- Security Protocols
Réponses
4To optimize gas usage on Sui, developers should focus on minimizing unnecessary computation, storage, and transaction costs when designing Move contracts and dApps. Here are some key strategies:
-
Minimize State Changes: Each modification to an object’s state incurs gas costs. Developers should limit the number of state changes by combining actions when possible or avoiding unnecessary state updates. This can be achieved by carefully designing the contract logic to perform multiple actions in a single transaction.
-
Efficient Object Use: Since Sui’s object model treats assets as independent objects, developers should minimize object creation and avoid creating too many objects that aren’t essential to the application. This reduces the cost of storing and managing objects in the blockchain.
-
Batching Transactions: For dApps that interact with multiple objects, batching multiple operations into a single transaction can reduce the number of separate transactions, lowering transaction fees.
-
Use Move’s Built-in Optimization: The Move language allows developers to control resource access and minimize unnecessary computation. By using Move’s built-in functions for managing object interactions efficiently (like references and borrowing), developers can avoid copying objects or duplicating computations that would lead to extra costs.
-
Avoid Expensive Computations on-chain: Offload heavy computations to off-chain systems where possible. Sui provides mechanisms to interact with external data sources, so complex computations can be handled off-chain, and only essential state changes are sent on-chain.
-
Object Access Patterns: Careful consideration of how objects are accessed can minimize costs. Accessing shared objects or performing redundant read/write operations on the same objects can increase costs. Instead, design contracts to read from objects only when necessary and avoid writing to objects unless absolutely required.
-
Use Gas Estimation Tools: Sui offers tools that help estimate the gas cost of transactions before they are executed. Developers should use these tools to test and refine their code, ensuring that they understand the cost implications of different operations.
By applying these strategies and focusing on efficient state management, computation, and transaction structuring, developers can significantly optimize gas usage on Sui, especially for high-throughput applications.
only backward-compatible changes are allowed (e.g., adding new functions, but not changing existing signatures).
custom – more flexible, you can implement custom checks for upgrades.
Limit object inputs per transaction – Fewer objects = more parallelism and lower costs.
Avoid deep nesting – Flatten data structures for faster execution.
Mutate only when needed – Reduce unnecessary state writes.
Use events for history – Emit events instead of storing logs on-chain.
Batch operations smartly – Group actions to reduce overhead, but avoid bloated transactions.
Leverage profiling tools – Use dry-run, --gas-profile, or SDK tools to spot high-cost operations.
Recycle or delete unused objects – Earn storage rebates by cleaning up.
These practices help reduce computation, storage, and transaction gas costs for scalable, high-performance dApps
To optimize gas on Sui when building complex Move contracts:
-
Minimize shared object usage – Shared objects are expensive due to consensus; use them only when necessary.
-
Limit object inputs per transaction – Fewer objects = more parallelism and lower costs.
-
Avoid deep nesting – Flatten data structures for faster execution.
-
Mutate only when needed – Reduce unnecessary state writes.
-
Use events for history – Emit events instead of storing logs on-chain.
-
Batch operations smartly – Group actions to reduce overhead, but avoid bloated transactions.
-
Leverage profiling tools – Use dry-run, --gas-profile, or SDK tools to spot high-cost operations.
-
Recycle or delete unused objects – Earn storage rebates by cleaning up.
These practices help reduce computation, storage, and transaction gas costs for scalable, high-performance dApps on Sui.
Connaissez-vous la réponse ?
Veuillez vous connecter et la partager.
Sui is a Layer 1 protocol blockchain designed as the first internet-scale programmable blockchain platform.
Gagne ta part de 1000 Sui
Gagne des points de réputation et obtiens des récompenses pour avoir aidé la communauté Sui à se développer.

- ... SUIacher+1666
- ... SUIChubbycheeks +1091
- ... SUIjakodelarin+1060
- ... SUITucker+1045
- ... SUIKurosakisui+1036
- ... SUIOpiiii+861
- ... SUItolexwills47+783
- Pourquoi BCS exige-t-il un ordre de champs exact pour la désérialisation alors que les structures Move ont des champs nommés ?65
- « Erreurs de vérification de sources multiples » dans les publications du module Sui Move - Résolution automatique des erreurs55
- Comment maximiser la détention de profits SUI : Sui Staking contre Liquid Staking413
- Échec de la transaction Sui : objets réservés pour une autre transaction49
- Erreur Sui Move - Impossible de traiter la transaction Aucune pièce de gaz valide n'a été trouvée pour la transaction315