Joerg Hiller
Jul 13, 2024 16:58
The Sui Gas Pool service allows developers to efficiently sponsor gas payments for transactions at scale, streamlining user onboarding and handling high concurrency needs.
The Sui Gas Pool service, developed by Mysten Labs, offers a groundbreaking solution for developers to sponsor gas payments for transactions at scale, according to The Sui Blog. This service aims to address significant challenges related to user onboarding and transaction management for applications with high concurrency demands.
Mysten Labs has made the Sui Gas Pool open-source, allowing the Sui developer community to leverage this innovative service. By sponsoring gas payments, the service enhances the onboarding experience for users new to Web3 by enabling them to start without funding a wallet, thus offering greater flexibility and ease of use. Despite these benefits, developers often face difficulties managing gas payments at scale, which the Sui Gas Pool aims to resolve.
How a Sui Gas Pool Works
The Sui Gas Pool was created with two main goals: horizontal scalability and generality. It can easily scale to meet higher throughput demands by adding more instances, and it is designed to be flexible enough for any developer to integrate and operate it as a standalone service or part of their system.
To initialize a gas pool, the system queries all gas coins dedicated to sponsoring transactions owned by the sponsor address and splits them into smaller gas coins with a configurable initial balance. These gas coins are then managed in the gas pool database. Funding the gas pool is straightforward; simply send a large balance gas coin to the sponsor address, and the gas pool will detect and process it automatically. The system periodically checks for any large gas coin owned by the sponsor and splits it as needed.
The gas pool service operates an RPC server with permission control managed through a secret bearer token in HTTP requests. The interaction workflow includes reserving gas coins, attaching them to transactions, obtaining user signatures, and executing transactions through the gas pool.
Scaling a Sui Gas Pool
The Sui Gas Pool scales efficiently through several mechanisms:
- Automated gas coin splitting: This creates many smaller gas coin objects, increasing throughput.
- Controlled transaction execution: The gas pool retains full control over transaction execution, ensuring prompt release of gas coins.
- Centralized data persistence: Data is stored centrally through Redis, allowing gas pool servers to run without local data persistence requirements or crash recovery.
- Multiple sponsors and services: The system can scale further by having multiple sponsors and deploying multiple gas pool services.
Get Started
The Sui Gas Pool significantly improves the user experience and operational efficiency of apps on Sui. Mysten Labs’ customer experience platform, Enoki, already utilizes the Sui Gas Pool for its sponsored transaction feature, demonstrating its reliability and efficiency in a production environment.
By making the Sui Gas Pool open source, Mysten Labs ensures that the entire Sui community can effectively scale sponsored transactions, supporting new apps with large user bases. For more details, visit the GitHub repository or contact engineers for support.
Image source: Shutterstock