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
Sponsor Service Architecture
A typical sponsor service:Security Considerations
Validation Checklist
Gas Budget Limits
Gas Budget Limits
Set maximum gas budget to prevent excessive costs:
Function Whitelist
Function Whitelist
Only sponsor calls to approved functions:
Rate Limiting
Rate Limiting
Prevent spam and abuse:
User Authentication
User Authentication
Verify user identity before sponsoring:
Balance Monitoring
Balance Monitoring
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
Start with tight restrictions
Start with tight restrictions
Begin with strict limits and relax as needed:
Log all sponsored transactions
Log all sponsored transactions
Maintain audit trail for analysis:
Implement circuit breakers
Implement circuit breakers
Stop sponsorship if abuse detected:
Use separate sponsor accounts
Use separate sponsor accounts
Isolate sponsor funds from main treasury:
Related Topics
Gas Pricing
Understand gas costs
Transactions
Learn about transactions
Transaction Lifecycle
Follow transaction execution