Recommended: JavaScript SDK with React Hooks
For new React apps, we recommend the JavaScript SDK with React Hooks (
@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.awaitingFeePayer flag. This allows third parties to pay transaction fees on behalf of users, enabling gasless experiences.
How Fee Sponsorship Works
- User signs a transaction with
awaitingFeePayer: true - Transaction is sent to a fee payer service
- Fee payer adds their signature and broadcasts the transaction
- User’s transaction executes without paying gas fees
Transaction Expiry
When using fee sponsorship, you can set transaction validity windows:Example: Creating a Sponsored Transaction
Fee Payer Service (Server-Side)
The fee payer service receives the signed transaction, adds its signature for the fee payment, and broadcasts:Best Practices
- Set reasonable validity windows: Use
validAfterandvalidBeforeto prevent stale transactions from being broadcast - Validate transactions server-side: Check transaction parameters before sponsoring
- Rate limit: Implement rate limiting on your fee payer service to prevent abuse
- Monitor spending: Track gas expenditure to manage sponsor costs