How to sponsor fees on Solana
Once you’ve created a smart wallet on Solana, sponsor Solana transaction fees with your Smart Wallets to enable users to transact without holding SOL. Powered by Smart Wallets, this removes a major barrier to entry for new users of your app.
Implement sponsorship either globally (applying to all transactions) or on a per-transaction basis with policies defining what you want to sponsor for users:
- Fees cover the cost of executing transactions.
- Rent is required to store data on-chain.
- We support rent sponsorship for
createAccount
andcreateAssociatedTokenAccount
programs. If you need support for sponsoring rent in custom programs, please contact us at [email protected].
- We support rent sponsorship for
See our recommendations for gas manager spending.
Create a Gas Manager policy
A gas manager policy defines which transactions are eligible for sponsorship. You can customize the policy to limit the amount of money or the number of transactions that can be sponsored.
You can create a policy in the Gas Manager dashboard.
Now you should have a Gas policy created with a policy id you can use to sponsor fees and rent for your users.
React
APIs
Global sponsorship
To apply a sponsorship policy to all transactions sent by the Solana wallet provider, you can configure fee and rent sponsorship at the Alchemy configuration level by passing a policyId
into your Solana config. Replace the API key and Policy Id with your keys from the dashboard.
This setup applies sponsorship to all Solana transactions sent from wallets created with this configuration (e.g. this will be applied to usage of the useSolana…
hooks).
Per transaction sponsorship
Alternatively, to apply sponsorship conditionally for each transaction, you can pass a policyId
to the useSolanaTransaction
hook.
Congrats! You’re now creating smart wallets on Solana with social login and sending sponsored transactions to create a zero-friction experience from sign-up to transaction. Reach out with any feature request or questions.