Gas Station

Sponsor gas fees to increase user conversion and retention

What's in this doc?

This guide provides a high-level overview of Shinami's Gas Station and the benefits it provides to your application. It shows you an image of the entire sponsorship flow, from setting up a fund in your Shinami web dashboard all the way through executing a sponsored transaction. Finally, it summarizes our developer resources for getting started with Gas Station.

Gas Station overview

What are gas fees?

A gas fee is the fee charged for writing data to the Sui blockchain. Writing data is called executing a transaction. Gas fees pay the teams that run the hardware that processes transactions and stores any new data. This hardware is called a validator node, as they validate whether or not a transaction is allowed to happen. While gas fees for Sui are very small - averaging about 0.004 SUI per transaction in the last 12 months - they must be paid. Further, they must be paid in SUI.

Why sponsor transactions?

Typically, the wallet that's executing the transaction (the sender) pays the gas fees for a transaction. This means the wallet must have SUI in it.

For web2 native users, this adds too much friction: downloading a wallet app, completing KYC checks to purchase SUI, transferring SUI to their wallet, and then connecting their wallet to your app. You won't convert many Web2 users this way. Instead, you can use Shinami's Sui Wallet Services to create wallets for users and Gas Station to sponsor their transactions. This allows for a great UX, improving sign-up conversion and user retention. To see this in action, check out our zkLogin Game Dashboard Demo.

Even apps that target Web3-natives, who are used to managing a self-custody wallet, can have a lot of friction from gas fees. For example, when DeFi users who trade non-SUI tokens have no SUI and don't want to buy it just to pay a tiny gas fee. This annoyance could lead to fewer actions you want to promote, like deposits and swaps. Sponsoring these actions can increase both your MAU and your revenue per user.

In short: sponsoring transactions for your end users creates a low-friction user experience, increasing user conversion, retention, and engagement.

What is a gas station?

A gas station is a service that sponsors your user's transactions. It does two main things:

  1. Sponsor the gas fees of an individual transaction. This includes determining how much SUI is needed. If you don't know how much is needed, you'll have to lock up a large amount of SUI when promising to sponsor each transaction. If you're not efficient here, you may need to keep a very large (and expensive) reserve of SUI in order to sponsor transactions.
  2. Manage all the SUI that's used to pay for transactions, including creating the unique coin(s) to be used for each sponsorship, and cleaning up the partial bits of SUI leftover from completed (or failed) sponsored transactions. The more user activity you have, and the more transactions per second, the faster you have to generate and clean up the SUI coins needed for sponsorships. Doing this at scale is challenging.

A gas station manages the above for you, so that you can focus on building your app. With Shinami's Gas Station, you periodically deposit SUI in a fund in your Shinami account, and then our Gas Station uses it to handle the management and optimization of gas coins (SUI) used to facilitate sponsored transactions. You just request a sponsorship for each transaction, and we take care of the rest!

Why use Shinami?

Shinami is the leading developer infrastructure provider for the Sui ecosystem. We've been successfully supporting Sui builders since the early days of Sui Mainnet (see our case studies for examples of the success our customers have seen). For an overview of how we compare to Enoki (the main Shinami Gas Station competitor), see our Shinami vs Enoki guide.


End-to-end flow

Here is an image of the full end-to-end flow of a sponsoring a user's transaction with Gas Station. Steps 1 and 2 don't need to happen for each sponsorship after that.

Diagram

Summary of steps

  1. App creates a Gas Station fund in the Shinami dashboard (only happens once per fund).
  2. App sends SUI to the fund to pay for upcoming sponsorships (only happens periodically, when your fund is running low on SUI).
  3. An end user interaction with the app initiates a transaction. For example the user asks to mint an NFT or the app mints the user a free NFT for accomplishing a task.
  4. App constructs the mint NFT transaction without a gas object under the hood (check out our TypeScript tutorial for examples).
  5. App sends it to the Shinami Gas Station for sponsorship via a gas_sponsorTransactionBlock request.
  6. Gas Station sponsors the transaction from the app's fund and produces the full transaction data and sponsor signature needed for execution.
  7. A signature is obtained from the user's wallet in one of the following ways
    1. Programmatically on the backend with no user action via an app-controlled Invisible Wallet or a user-controlled zkLogin wallet.
    2. User is presented a pop-up to confirm and sign (connected, self-custody wallet).
  8. App submits the transaction with sponsor and sender signature to the Sui blockchain by making a sui_executeTransactionBlock request to Shinami Node Service, which provides enterprise-grade infrastructure to read and write to the Sui blockchain.

Creating and using a Gas Station fund

See the Sui Gas Station FAQ page of our Help Center for information on how to set up a Gas Station fund, how to deposit free Testnet SUI into it, and how to sponsor transaction using that fund.

Developer resources

Gas Station only

Gas Station + Invisible Wallets and zkLogin wallets

  • Our Invisible Wallet TypeScript Tutorial provides end-to-end sample code for setting up an app-controlled wallet on behalf of a user and sponsoring a transaction for it with Shinami Gas Station.
  • Our zkLogin wallet Next.js Tutorial helps you quickly set up your first zkLogin app that integrates with Shinami Gas Station for transaction sponsorship.