suiboxer.xyz

How Do You Sponsor Transactions with the Sui Gas Station?

The Sui Gas Station is a sponsored transaction mechanism that allows a third party to pay the gas fees for a user's transaction. Instead of the sender covering the Sui gas cost, a sponsor signs a separate sponsorship request that authorizes the network to deduct the fee from the sponsor's coin balance. The user constructs the transaction, the sponsor approves the gas payment, and both signatures are combined into a single programmable transaction block that the sponsor submits. The result is a transaction the user never pays for.

How sponsored transactions work on sui

Every transaction on Sui requires gas. Normally the sender's account must hold enough SUI to cover the computation and storage costs. With the gas station model, the transaction is split into two parts:

The network validates both signatures. If the sponsor's account has sufficient SUI, the transaction executes and the gas cost is deducted from the sponsor's balance. The user's account never loses SUI.

When to Use a Gas Station

The pattern is useful in several real-world scenarios:

Gas stations are not a Sui-specific invention, but Sui's programmable transaction blocks make the implementation cleaner than on many other chains.

Setting up the sponsor

Before you can sponsor transactions, you need a Sui account that holds SUI and is willing to pay. This is typically a service account controlled by the dApp backend. The sponsor's private key must be kept secure, because anyone with that key can authorize gas payments.

You do not need to deploy a smart contract. Sponsorship is handled at the protocol level using the gas station API exposed by the Sui full node.

Step-by-Step: sponsoring a transaction

The following steps assume you are building a backend service in TypeScript or Rust using the Sui SDK. The exact method names depend on the SDK version, but the logic is consistent.

1. User constructs the transaction

The user builds a programmable transaction block (PTB) for whatever operation they want to perform. This PTB does not yet include any gas payment information.

const ptb = new TransactionBlock();
ptb.transferObjects([coinObjectId], recipientAddress);

The user signs this PTB with their own key and sends the signed transaction (but not the gas sponsorship) to the sponsor's backend.

2. Sponsor creates the gas sponsorship

The sponsor's backend receives the user's signed PTB. It then creates a separate GasSponsorship request. This request specifies:

The sponsor signs this sponsorship request with their private key.

3. Sponsor combines both signatures

The sponsor merges the user's signature and the sponsorship signature into a single TransactionData structure. The Sui SDK provides a helper function for this, typically called combineTransactionSignatures or similar.

4. Sponsor submits the combined transaction

The sponsor executes the combined transaction via the Sui full node's executeTransactionBlock endpoint. The network checks:

If all checks pass, the transaction runs. The gas cost is deducted from the sponsor's coin, not the user's.

Gas budget and price considerations

The sponsor sets a gas budget. If the actual gas cost exceeds this budget, the transaction fails and the sponsor still pays for the computation that was already performed. Setting the budget too low causes unnecessary failures.

A common practice is to:

Security Notes

Alternative: Sui Gas Station as a Service

Instead of building your own sponsorship backend, you can use Sui's built-in gas station service available on testnet and mainnet. This service allows developers to request gas sponsorship through an API without managing a sponsor account. The service applies its own rate limits and gas budgets. Check the Sui documentation for current availability and endpoints.

Not financial advice. suiboxer.xyz publishes market data and general information about digital assets. Crypto assets are volatile and you can lose everything you put in. Nothing here is a recommendation to buy, sell or hold, and we make no price predictions.

Prices are sourced from third parties and may be delayed or wrong. Verify anything you intend to act on against a primary source.

Back to sui & aptos