EVM Gas Sponsorship is an enterprise-only feature. Contact us to learn more about upgrading your plan.
- Sponsor gas only for specific actions (e.g. a card top-up, a first purchase) and reject everything else.
- Sponsor gas only for specific users (e.g. a plan tier, a verified account, a region).
- Apply per-user budgets or rate limits before spending sponsored gas.
The example below uses the JavaScript client SDK to sign and the Node server SDK to relay. This is not limited to these SDKs. The same pattern works with any Dynamic client SDK for signing and any Dynamic server SDK for relaying.
How it works
- Client signs the transaction and sends the signed bundle to your API.
- Your backend validates the transaction and the user, then relays it through Dynamic.
- Dynamic submits the transaction on-chain and the user pays no gas.
1. Restrict sponsorship to your server
First, make sure EVM gas sponsorship is enabled for your environment: in the Dynamic Dashboard, go to Wallets → Sponsor Gas → Dynamic and enable Sponsor Network Fees (EVM) (with the EVM chains you want to sponsor enabled). Then, in that same Sponsor Network Fees (EVM) setting, turn on Restrict sponsorship to server-side requests. With this on, only your server can submit EVM sponsored transactions. Requests sent directly by end users are rejected. This controls who can submit a sponsored transaction, not who signs it: users still sign on the client exactly as before.2. Sign on the client
CallsignSponsoredTransaction to produce a signed transaction bundle without submitting it, then send that bundle to your backend along with the user’s Dynamic user id. This example signs a single USDC transfer on Base, the same transaction your backend validates in the next step.
3. Validate on your backend
Your API receives the signed bundle. This is the shape to expect:When you relay, Dynamic already verifies that the wallet belongs to this user in your environment, caps the batch at 5 calls, and checks that the EIP-7702 authorization (when present) targets the correct delegate contract. The checks below are your business policy on top of that.
4. Relay from your backend
Authenticate the Node SDK with your environment API token, then relay the signed bundle. Pass theuserId so the relay is attributed to that end user.
Option A: wait on the server, return the transaction hash
sendSponsoredTransaction relays and waits for the transaction to land on-chain, then returns the hash. Simplest when your client just wants the final hash.
Option B: return a request id, wait on the client
relaySponsoredTransaction relays without waiting and returns a requestId. Return it to the client and let the client poll for the hash. This is useful for keeping your request short or driving a progress UI.
waitForSponsoredTransaction:
Related
- EVM Gas Sponsorship overview — the default client-side flow and setup.
- Splitting sign & send —
signSponsoredTransaction,relaySponsoredTransaction, and status polling in depth. - sendSponsoredTransaction — the primary client-side send function.