SVM gas sponsorship is an enterprise-only feature. Contact Dynamic to learn more about upgrading your plan.
- Require KYC or another verification before sponsoring a user.
- Apply custom rate limits or budgets per user or per wallet.
- Enforce custom preconditions for each user or wallet, such as a plan tier, a region, or an existing balance.
- Sponsor only specific actions, such as a swap through a route you approve, and reject everything else.
The example below uses the JavaScript client SDK to sign and broadcast. Your backend can build and sponsor with either plain HTTPS calls with an environment API token or the Node server SDK, and each of those steps shows both options in tabs. It builds a swap from a LI.FI quote, so the transaction comes straight from the API and your server never assembles instructions by hand.
How it works
- Your backend builds the transaction, validates it and the user, and asks Dynamic to sponsor it on behalf of that user.
- Dynamic returns the transaction with the sponsor as fee payer and the sponsor’s signature already in place.
- The client signs the transaction as the user and broadcasts it.
1. Restrict sponsorship to your server
First, make sure SVM gas sponsorship is enabled for your environment. In the Dynamic Console, go to Sponsor Gas → Dynamic and enable Sponsor Network Fees (Solana), with Solana enabled in your embedded wallet chain configuration. Then, in the same card, turn on Restrict sponsorship to server-side requests. With it on, only your server can request sponsorship for Solana transactions. The change reaches end users the next time their app loads. While the setting is on, client SDKs stop requesting sponsorship, so a transaction your app sends without going through your backend is paid for by the user.2. Build the transaction on your backend
Authenticate to Dynamic with your environment API token and read the sponsor address. Pass it to LI.FI assvmSponsor. LI.FI then builds the transaction with the sponsor as fee payer, so the quote you get back is ready to sponsor as is.
- API
- Node SDK
Call the sponsor address endpoint with your environment API token as a bearer token. The token needs the The response is
gasless.read scope here and the gasless.write scope when you sponsor the transaction in step 4. See API token permissions for how to grant scopes.{ "sponsorAddress": "<base58 address>" }.x-lifi-api-key header for higher rate limits. You can create one on the LI.FI Partner Portal.
3. Validate on your backend
Before asking for sponsorship, apply your own rules to the user and to the transaction. The checks below are your business policy. Dynamic separately verifies that the wallet signing the transaction belongs to theuserId you send, in your environment.
4. Sponsor on behalf of the user
Authenticate the request, derive the user and wallet on the server, run your checks, and ask Dynamic to sponsor the transaction with the user’suserId. Dynamic returns the transaction with the sponsor’s signature. The user’s signature slot stays empty.
- API
- Node SDK
Send the transaction base64-encoded, together with the The response is
userId, to the sponsor endpoint. The token needs the gasless.write scope.{ "requestId": "<uuid>", "transaction": "<base64 transaction>" }, and the transaction field is what your handler returns to the client as is. The API requires userId. It responds with 400 when userId is missing or when the wallet that signs the transaction does not belong to that user in your environment. Take userId from your own authenticated session, for example the sub claim of the verified Dynamic JWT, and not from the request body.5. Sign and broadcast on the client
The client requests the sponsored transaction from your API, signs it with the user’s wallet, and broadcasts it.Related
- SVM Gas Sponsorship: the default client-side flow and setup.
- Signing and Sending Transactions:
signTransactionand the other Solana signing functions. - Getting Solana Connection: create a connection from a wallet account’s network.
- sponsorTransaction: the Node SDK method that sponsors a transaction for a user.
- getSponsorAddress: read the sponsor address to build transactions that name it as fee payer.
- EVM Server-Controlled Sponsorship: the same pattern for EVM chains.