Skip to main content

🪙 Token Gating

Token Gating enables blockchain applications to limit access to specific content or features based on the ownership of certain digital tokens. By leveraging the Wallet Intelligence API, developers can easily verify whether a wallet holds particular tokens. This allows for the implementation of token-gating systems that ensure users meet specific criteria to access restricted areas or features within their applications.

Web3 developers can use Token Gating in various scenarios, including:

  • Exclusive Content: Restrict access to premium content, such as articles, videos, or forums, to users who hold specific tokens.
  • Event Participation: Limit entry to virtual or physical events to token holders, ensuring an exclusive and engaged audience.
  • Feature Unlocks: Enable special features or functionalities within an application only for users who possess the required tokens.
  • Community Access: Create exclusive communities or discussion groups for token holders, fostering a sense of belonging and value.
  • Sales and Promotions: Offer exclusive deals, discounts, or early access to token holders, incentivizing token ownership and loyalty.

Additionally, developers can layer on additional requirements to gate access, such as ensuring a wallet is not flagged as a bot or that it has a total balance above a certain threshold. This added layer of verification helps maintain a high-quality user base and enhances the overall user experience.

info

Note that token ownership data is based on the previous day's ownership and may not reflect real-time ownership. Future updates aim to provide real-time token ownership information.

Instructions

Step 0: A user with a connected wallet checks eligibility to participate in an upcoming airdrop, quest or tournament (e.g., 0xd8da6bf26964af9d7eed9e03e53415d37aa96045).

Step 1: Obtain API Key

Step 2: Construct the API Request

  • Use this endpoint to get the list and balances of current ERC20 token holdings of a wallet. https://api.thirdwavelabs.com/evm/wallets/{account}/erc20_tokens, replacing {account} with the blockchain wallet address you want to check.
  • Set the request method to GET.

Step 3: Set Headers

  • Include the X-Api-Key header in your request with your API key as the value.

Step 4: Send the Request

  • Execute the request using your preferred method, such as curl or HTTP request library in your programming language of choice.
curl -s
--request GET 'https://api.thirdwavelabs.com/evm/wallets/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/erc20_tokens
--header 'X-Api-Key: YOUR_API_KEY'

Step 5: Receive and Interpret the Response

  • Upon receiving the response from the API (which should happen in 100MS or less), parse the data to extract the relevant information.
  • Review the list of tokens and their balances owned by the wallet to determine if the user meets the token ownership requirements for participation in the activity.
  • Review any additional criteria you are gating wallets by like a minimum balance or isBot to determine final eligibility.

Example Response

{
"data": [
{
"address": "0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9",
"blockchain: "ethereum",
"balance: "14323.87"
},
{
"address": "0xfc5e67888c97b4a8ff507c7fa9854e0b95a5a8d0",
"blockchain: "polygon",
"balance: "294.56"
}
]
}
info

If the wallet address provided doesn't exist, wasn't in the correct format, or is not on a supported chain, the response for that entry will be null.

Step 6: Additional Information

  • Note that token ownership data is based on the previous day's ownership and may not reflect real-time ownership. Future updates aim to provide real-time token ownership information.

Outcome

By implementing Token Gating, developers can ensure that only users who meet specific token ownership criteria are granted access to designated activities or features within their Web3 applications. This approach enhances user engagement, fosters a community of real contributors, and maximizes the value for genuine participants.