The Gas Model & Optimization
38.1 Sui gas
Computation is charged in buckets (small differences in work often cost the same).
Storage is paid upfront for bytes your transaction leaves in objects; the SUI goes into a storage fund.
Storage rebate: deleting or shrinking objects refunds most (99%) of the storage fee originally paid.
The sender sets a gas budget; the CLI and SDKs estimate it via a dry run.
Units: 1 SUI = 10^9 MIST.
total_fee = computation_units × reference_gas_price
+ storage_units × storage_price
− storage_rebate38.2 Aptos gas
Execution + IO gas covers instructions and storage reads/writes.
Storage fees are charged per new storage slot and per byte; the slot fee is refunded when the slot is deleted.
The sender sets max_gas_amount and gas_unit_price (minimum 100 octas; higher prices get priority under congestion).
Units: 1 APT = 10^8 octas.
fee = gas_used × gas_unit_price (+ storage fees, charged in APT)38.3 Optimization tips
Avoid unbounded loops over growing vectors Use tables/dynamic fields for large collections Table, dynamic fields Table, SmartTable, BigOrderedMap Delete data you no longer need Get storage rebates Get slot refunds Avoid hot contention
Prefer owned objects; shard shared objects Per-user resources, aggregators One PTB with many commands Scripts or batch entry functions Keep objects/resources small Object size limits and per-byte storage Per-byte storage fees
Prefer Balance<T> over many Coin<T> objects inside pools Use FungibleStore
Pass references, not copies of big vectors