Sponsored Transactions
Learn how to provide a gasless social experience for your users.
The Lens API allows you to offer a gasless experience to your users by sponsoring their transaction costs, provided that:
- The Profile executing the operation must be within their rate limits.
- If an operation involves a Custom Module, the module must be approved for sponsorship by the Lens Protocol team.
You can ALWAYS use the Lens Protocol by submitting transactions directly to the blockchain.
Rate Limits
The Lens Protocol team has set rate limits on the number of sponsored transactions that will be covered for any given user.
Transaction Type | Hourly Limit | Daily Limit |
---|---|---|
On-chain | 150 | 150 |
Momoka | 100 | 200 |
Since Momoka transactions are currently used exclusively for creating Momoka Publications, this effectively sets a limit on the number of Momoka Publications a profile can create within a given timeframe.
Low-Signal Profile Limits
The Lens Protocol team has implemented a series of measures to uphold the quality of the Lens ecosystem. These measures are designed to mitigate the impact of spammy profiles on the overall user experience. They include:
- Machine Learning Algorithms: The Lens backend employs a set of ML algorithms that take into account factors such as follower graphs, content, and other variables to calculate a signal score for each profile.
- Community Gardeners: This group, comprising Lens community members and Lens Protocol team members, helps identify profiles that negatively impact the overall user experience.
The Lens API imposes further restrictions on the number of sponsored transactions for profiles that fall below a certain signal score threshold, referred to as low-signal profiles. The rate limits for these low-signal profiles are as follows:
Transaction Type | Hourly Limit | Daily Limit |
---|---|---|
On-chain | 0 | 0 |
Momoka | 10 | 10 |
Accounts identified as low-signal will need to cover their own gas costs for transactions beyond these limits.
Check User's Rate Limits
You can query the current rate limits for a user by using either the LensClient SDK or the GraphQL API.
import { development, LensClient } from '@lens-protocol/client';
const client = new LensClient({
environment: development,
});
const result = await client.wallet.rateLimits({
userAddress: '0xa5653e88D9c352387deDdC79bcf99f0ada62e9c6',
});
fragment UserCurrentRateLimit on UserCurrentRateLimit {
hourAllowanceLeft
hourAllowanceUsed
hourAllowance
dayAllowanceLeft
dayAllowanceUsed
dayAllowance
}
query {
userRateLimit(
request: { userAddress: "0xa5653e88D9c352387deDdC79bcf99f0ada62e9c6" }
) {
momoka {
...UserCurrentRateLimit
}
onchain {
...UserCurrentRateLimit
}
}
}
Non-sponsored Modules
With the introduction of Lens Protocol V2, anyone can now create and use Custom Modules without requiring approval from the Lens Protocol team. This empowers the community to innovate without constraints.
However, Lens API only sponsors transactions involving modules that have undergone a review process. Consequently, operations involving non-reviewed custom modules may not be eligible for sponsored transactions.
Updated 16 days ago