APIs used:
  • Check ownership in NFT collection  
  • Check ownership in NFT collection for specific token  
  • Get traits for a collection  
  • Get attributes for a collection trait  

Welcome to the future of decentralized community engagement! Are you managing a DAO or a Guild and looking to deepen member involvement? Let's dive into how the Covalent API can help you with token gating and membership by verifying the presence of specific tokens in a participant's wallet to unlock content, events, airdrops and more. We'll also spotlight Guilt.xyz, an innovative community platform that is using Covalent under the hood!

What is Token Gating?

Token gating is a method used by online communities, especially in the Web3 space, to grant exclusive access to certain content, events, services, or benefits based on the ownership of specific tokens or NFTs (Non-Fungible Tokens). It's a digital "key" that unlocks unique experiences or resources for token holders, leveraging blockchain technology to verify ownership securely and transparently.

What are Some Benefits of Token Gating?

  • Exclusivity: Creates a sense of belonging and exclusivity among token holders, offering them access to special features or content.

  • Engagement: Encourages deeper interaction and loyalty within a community by providing unique benefits and experiences.

  • Monetization and Value Creation: Helps creators and communities monetize their content and services while adding value to the ownership of tokens.

Using the Covalent API for Token Gating

So how do you actually check a user's wallet to confirm the presence of the particular token or NFT? That's where Covalent makes it easy. The Covalent API provides the following endpoints for querying the blockchain for real-time data about wallet contents.

Check ownership in NFT collection

GET/v1/{chainName}/address/{walletAddress}/collection/{collectionContract}/

Commonly used to verify ownership of NFTs (including ERC-721 and ERC-1155) within a collection.

Check ownership in NFT collection for specific token

GET/v1/{chainName}/address/{walletAddress}/collection/{collectionContract}/token/{tokenId}/

Commonly used to verify ownership of a specific token (ERC-721 or ERC-1155) within a collection.

Get traits for a collection

GET/v1/{chainName}/nft/{collectionContract}/traits/

Commonly used to fetch and render the traits of a collection as seen in rarity calculators.

Get attributes for a collection trait

GET/v1/{chainName}/nft/{collectionContract}/traits/{trait}/attributes/

Commonly used to get the count of unique values for traits within an NFT collection.

By integrating these queries into your application's logic, you can automate the process of verifying token ownership and granting access accordingly. With these endpoints, you token gate based on whether a user has any NFT in a collection, if they have a specific NFT in a collection, and you can even gate based off specific traits and attributes in an NFT collection, for instance, only characters wearing "red shoes".

Beyond Basic Token Gating: Looking Into Transactions

Now that we've covered traditional token gating, let's dive deeper. The scope of onchain activities extends far beyond mere token ownership, and DAOs/dApps might want to manage users based on their actual transactions rather than just what's in their wallet. This might involve flagging:

  • Transaction count and frequency.

  • Transaction type and complexity such as:

    • DEX activity.

    • Governance votes.

    • Pool positions & accumulated rewards.

    • Cross-chain messages and transfers.

By considering these varied interactions, DAOs and dApps can develop more nuanced and complex gating mechanisms. This approach enables the creation of membership tiers and roles based on actual onchain behaviors, fostering a more engaged and invested community.

Guild.xyz: A Platform for Customizable Onchain Gating

One platform leading the charge in this advanced gating approach is Guild.xyz. This innovative platform allows a guild (a decentralized community) administrator to define membership requirements and roles based on a wide array of onchain activities. Through a user-friendly interface, admins can customize criteria for each role within their guild, making sure that access to exclusive content or benefits is granted based on meaningful and relevant blockchain interactions.

Additionally, Guild.xyz has an open-source code base so communities can do deeper customization and tailor the platform to their unique UI needs and/or preferences.

How Covalent Supports Guild.xyz and Enhanced Token Gating

Guild.xyz's capabilities are supercharged by the Covalent API, which, on top of checking the contents of user wallets (as shown above), also offers comprehensive data on blockchain transactions and activities. Covalent's rich, detailed transaction data allows Guild.xyz to offer enhanced token gating options based on actual behaviour.

Guild.xyz uses the following endpoints to get a broad overview of a wallet's activity, as well as detailed information about each specific transaction:

Get transaction summary for address

GET/v1/{chainName}/address/{walletAddress}/transactions_summary/

Commonly used to fetch the earliest and latest transactions, and the transaction count for a wallet. Calculate the age of the wallet and the time it has been idle and quickly gain insights into their engagement with web3.

Get paginated transactions for address (v3)

GET/v1/{chainName}/address/{walletAddress}/transactions_v3/page/{page}/

Commonly used to fetch the transactions involving an address including the decoded log events in a paginated fashion.

Source: https://github.com/guildxyz/guild.xyz/blob/main/src/components/create-guild/templates.ts

Conclusion: Token Gating and Beyond

While traditional token gating continues to serve as a valuable mechanism, the evolution of DAO and guild memberships is moving towards a holistic model that embraces the entirety of a user's blockchain interactions. Platforms such as Guild.xyz enable the development of membership criteria that are more dynamic, inclusive, and engaging.

The Covalent API supports ALL these use cases, whether it's checking a user's wallet for a specific token, or more complex criteria based on transaction data. Offering these options to developers enables teams like Guild.xyz to foster greater involvement and investment within the Web3 domain, which is a win for all of us!

Resources

Here are some helpful guides providing additional details on using Covalent for token gating: