Skip to main content
Sponsored transactions allow one party (the sponsor) to pay for another party’s (the user’s) transaction gas fees. This is crucial for improving user onboarding and creating seamless Web3 experiences.

How Sponsored Transactions Work

In a sponsored transaction:
1

User builds transaction

User creates and signs the transaction with their intent
2

Sponsor is designated

Transaction specifies a different address as the gas owner
3

Sponsor signs separately

Sponsor reviews and signs to approve paying for gas
4

Transaction executes

Gas is deducted from sponsor’s gas coins

Basic Implementation

TypeScript SDK

Withdrawal from Sponsor

With address balances, sponsors can allow users to withdraw funds directly:
This allows users to perform actions using the sponsor’s balance without the sponsor needing to transfer coins first.

Use Cases

User Onboarding

Let new users try your app without acquiring SUI first

Gaming

Players focus on gameplay without managing gas

Enterprise Apps

Company pays for employee transactions

DAO Operations

Treasury sponsors member transactions
A typical sponsor service:

Security Considerations

Sponsors must carefully validate transactions to prevent abuse. Malicious users could craft transactions that drain the sponsor’s balance or perform unwanted actions.

Validation Checklist

Set maximum gas budget to prevent excessive costs:
Only sponsor calls to approved functions:
Prevent spam and abuse:
Verify user identity before sponsoring:
Track sponsor balance and alert when low:

Advanced Patterns

Conditional Sponsorship

Sponsor only specific types of transactions:

Quota-Based Sponsorship

Limit sponsorship per user:

Transaction Batching

Sponsor multiple operations in one transaction:

Client Integration

React Hook Example

Cost Management

Estimating Sponsorship Costs

Monitoring and Alerts

Best Practices

Begin with strict limits and relax as needed:
Maintain audit trail for analysis:
Stop sponsorship if abuse detected:
Isolate sponsor funds from main treasury:

Gas Pricing

Understand gas costs

Transactions

Learn about transactions

Transaction Lifecycle

Follow transaction execution