APIs used:
  • Get token holders as of any block height (v2)  


This guide demonstrates how to use the Covalent API to retrieve NFT ownership data at specific block heights, a key capability for implementing airdrops, granting exclusive benefits, and enabling token gating. By leveraging the Covalent SDK in TypeScript, you can enrich your applications, reward community loyalty, and ensure transparent and fair access to digital assets.

Why Retrieve NFT Owners Data at Specific Block Heights?

Retrieving a snapshot of NFT holders as of a certain block height is crucial for several use cases that directly benefit both creators and consumers in the blockchain ecosystem:

  • Airdrops: Projects can use historical data to determine eligibility for airdrops, ensuring that rewards or incentives are distributed to holders who owned the NFTs at a specific time, fostering loyalty and community engagement.

  • Exclusive Benefits: Access to events, content, or services can be granted based on NFT ownership at a certain block height. This practice is especially useful for offering perks to early adopters or long-term holders, enhancing the perceived value and exclusivity of owning NFTs.

  • Token Gating: By verifying ownership at particular block heights, projects can implement token gating to restrict access to certain areas of a platform or to special functionalities. This method is used to create tiered access within communities, where benefits increase based on the duration or timing of ownership.

These strategic applications not only enhance the utility and allure of NFTs but also empower developers and project owners to create more dynamic and engaged communities around their offerings.



Install the Covalent SDK

Before diving into the code, ensure your development environment is set up by installing the Covalent SDK:

npm install @covalenthq/client-sdk


yarn add @covalenthq/client-sdk

Initialize the Client

Import the necessary classes from the SDK and initialize your client with your API key:

Replace "YOUR_API_KEY" with your actual Covalent API key, which you can obtain by signing up on their platform.

import { CovalentClient, Chains } from "@covalenthq/client-sdk";

const client = new CovalentClient("YOUR_API_KEY");

Fetching NFT Holders

To fetch NFT holders, use the getTokenHoldersV2ForTokenAddress method. You need to specify the blockchain chain, contract address, and the specific block height:

async function getNFTOwners(chain: Chains | string | number, contractAddress: string, blockHeight: number) {
    try {
        const response = await client.BalanceService.getTokenHoldersV2ForTokenAddress(chain, contractAddress, { blockHeight: blockHeight });
        if (!response.error) {
            return response.data;
        } else {
    } catch (error) {
        console.error("An error occurred:", error);

Example Usage

Here is an example of how to call the function using specific parameters:

const chain = Chains.ETH_MAINNET; // Ethereum Mainnet
const contractAddress = "0x..."; // The NFT contract address
const blockHeight = 1234567; // Block height of interest

getNFTOwners(chain, contractAddress, blockHeight);

Tips and Additional Resources

This service supports both ERC-20 or ERC-721 token standards. To returns historic token holders, set the block height to latest.

For more detailed information on using the Covalent API, refer to the official documentation. You can also explore the SDK further on npm.


By leveraging the Covalent SDK, as demonstrated in this guide, developers can efficiently integrate ownership-based features into their applications, thus enriching the ecosystem and adding tangible value to the NFT holders. Whether you're aiming to boost participation in your project or provide exclusive content, historical data retrieval plays a pivotal role in creating a vibrant and dynamic community.