Gas Station Guide

Shinami’s Gas Station allows apps on Sui to abstract away gas fees

Background

Sending a transaction on Sui requires end users to first have a SUI balance in order to pay gas fees. This typically involves KYC to purchase SUI and interact with apps on the blockchain.

Alternatively, apps on Sui can sponsor their end user's transactions to remove friction. Shinami handles the management, refueling and optimization of gas credits (SUI) to facilitate sponsored transactions. This frees apps to focus on how to apply sponsored transactions to improve onboarding and user engagement.

Parties

End user - sender of the transaction. Has a wallet and Sui address.
App - sponsors transactions on behalf of end users
Gas station (Shinami) - manager of gas objects for sponsors, and facilitator of sponsored transactions
Wallet - interface for the end user to interact with the the app and node service
Node service (Shinami) - endpoint for transactions to be submitted to

📘

Role of Shinami's Node Service:

Shinami’s node service provides enterprise-grade infrastructure to read and write to the Sui blockchain. The gas station leverages this infrastructure when tracking state and it's also used to submit sponsored transactions to Sui.

Gas Station API

Shinami provides easy to use APIs for sponsoring transactions. Once you've created a fund and gas station access key in the Shinami dashboard, you can make the following JSON-RPC requests:

  • gas_sponsorTransactionBlock: sponsors a transaction by attaching a gas object to it and signs the sponsored transaction with the gas owner's key
  • gas_getSponsoredTransactionBlockStatus: retrieve the status of a sponsored transaction (IN_FLIGHT, INVALID, or COMPLETE).

You can find more information on these methods in our Gas Station API page.

Adding Gas Credits

You can create a fund and add gas credits to it within the Shinami dashboard. Funds are separated by network and can be used for different sponsored transaction campaigns:

Once your fund has been created, you can add gas credits to it by either clicking the View next to the particular fund in the Funds table or clicking the Add Gas Credits button above the table:

In the modal that pops up, you will be able to see fund details and deposit history. Copy your fund wallet address and send SUI to it to add gas credits for sponsoring transactions:

End-to-end Scenario

  1. App adds gas credits for sponsoring transactions in the Shinami dashboard.
  2. End user is interacting with an app (sponsor) with a connected wallet and wants to perform a transaction, e.g. mint an NFT.
  3. App constructs the mint NFT transaction gaslessly under the hood (check out our TypeScript tutorial for examples).
  4. App sends it to the Shinami Gas Station via gas_sponsorTransactionBlock
  5. Gas station:
  • Puts a hold on the app's gas credits for the specified gas budget amount
  • Constructs the transaction data to mint the NFT with a provisioned gas object
  • Signs the transaction and returns the transaction data with gas back to the app
  1. App presents the transaction to the end user and prompts for signature via wallet.
  2. Wallet submits the transaction to the Sui blockchain (sui_executeTransactionBlock)