Mysten Labs is open-sourcing the Sui Gas Pool to the Sui developer community. This innovative service is designed to sponsor gas payments for transactions on Sui at scale, addressing important needs around user onboarding for apps with high concurrency needs.

Sui's native support for sponsored transactions allows a transaction to use a gas coin owned by a different address than the sender for gas payment. This feature allows a service to subsidize their users' transaction costs, significantly enhancing the onboarding experience for users new to Web3. Being able to get started without funding a wallet significantly enhances the user experience by providing greater flexibility and ease of use. Despite these advantages, app builders often struggle with the complexities of managing gas payments at scale.

The Sui Gas Pool allows apps to easily offer greater user onboarding experiences through sponsorship of gas payments at scale. Additionally, the Sui Gas Pool alleviates the burden that apps handling highly concurrent transactions experience, allowing them to streamline their operations through efficiently managed gas sponsorship.

How a Sui Gas Pool works

The Sui Gas Pool was developed with two primary goals in mind, horizontal scalability and generality. The system can easily scale by adding more instances to meet higher throughput demands, ensuring it can handle increased transaction volumes. It is also designed to be generic, allowing any builder to integrate and operate it as either a standalone service or part of their system.

When initializing a gas pool, it queries all gas coins dedicated to sponsoring transactions owned by the sponsor address then splits them into smaller gas coins with a configurable target initial balance. These gas coins are then added to the gas pool database which manages available gas coins and gas coin reservations. 

Funding the gas pool is straightforward: simply send a large balance gas coin to the sponsor address, and the gas pool will automatically detect and process it. To ensure that funding within the gas pool is maintained, the system periodically checks for any large gas coin owned by the sponsor and then splits it before adding to the gas pool.

The gas pool service operates an RPC server, with permission control managed through a secret bearer token in HTTP requests. The interaction workflow is as follows:

  1. The client sends a reserve_gas request to the gas pool to reserve gas coins that meet the specified gas budget.
  2. The client attaches the gas coins to the transaction and obtains the user's signature on the transaction.
  3. The client sends the user-signed transaction to the gas pool through the execute_transaction request.
  4. The gas pool signs the transaction, sends it to a full node to execute, and releases the gas coins.

Scaling a Sui Gas Pool

The Sui Gas Pool service scales efficiently through several mechanisms. 

  1. Automated gas coin splitting: The automated gas coin splitting creates many smaller gas coin objects, allowing for increased throughput. 
  2. Controlled transaction execution: Conservative waiting heuristics are not needed since the gas pool retains full control over transaction execution, ensuring gas coins are released promptly.
  3. Centralized data persistence: Data persistence is handled through central Redis storage, allowing individual gas pool servers to run without local data persistence requirements or crash recovery. This allows app builders to run as many gas pool servers as needed per sponsor address with minimal overhead.
  4. Multiple sponsors and services: The system can further scale by having multiple sponsors and deploying multiple gas pool services.

Get started

By addressing these needs and implementing a robust, scalable solution, the Sui Gas Pool significantly enhances the user experience and operational efficiency of apps on Sui. Enoki, Mysten Lab's customer experience platform, already uses the Sui Gas Pool  for its sponsored transaction feature. Through its usage in Enoki, the Sui Gas Pool demonstrates its reliability and efficiency in a production environment, highlighting its capability to enhance user experience and operational efficiency for apps on Sui.

Making the Sui Gas Pool component open source ensures the entire Sui community can effectively scale sponsored transactions, supporting new apps with large user bases.

To learn more about the Sui Gas Pool, visit the GitHub repository. Feel free to contact engineers for any questions or problems experienced.

Author

Sui Foundation

High-performance blockchain delivering the full stack for a new global economy.

Read more like this

Celebrating One Year of Walrus: What’s Been Built and What’s Next for Verifiable Data

A look back at Walrus’s first year on Mainnet, from key features and partnerships to the numbers that show how far it’s come

3min read
Abhinav Garg

Recap 8/18 Sui AMA: Business Development & Partnerships with Jameel Khalfan

This recap covers an AMA about business development on Sui with members of Mysten Labs.

7min read
Sui Foundation

Sui Celebrates Second Anniversary with a Tsunami of Growth

With important events like the advent of BTCfi and astronomical user growth, Sui's second year shows enormous promise.

4min read
Sui Foundation

Developer Nimblebites Pushes Gaming Innovation with Super-B

Sui-based Super-B gives players a brick world environment where they can fight, build, and make friends.

1min read
Sui Foundation

New Sui VM: Bug Bounty Now Open

Sui's execution layer is getting its most significant improvement since launch

2min read
Sui Foundation

Tidehunter: Re-Architecting Storage for Sustained Blockchain Throughput

Addressing the storage demands that emerge when blockchains operate at sustained, real-world scale

8min read
Abhinav Garg