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
SystemProgram.createAccount
. 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.
Setup
On your gas manager dashboard, create a new Solana sponsorship policy. You can customize this policy to set rules on sponsorship like max spend per transaction, max spend per policy, or max transactions per policy.
Select Solana as the chain type and apply this policy to the app corresponding to the API key you’re using.
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.