Get NFT owners by collection
If you’re interested in the market of NFTs, it’s essential to know who the current owners of particular NFT collection are. Here are some steps to follow to get the owner information:
- First, you need to identify the blockchain platform that the NFT collection is built on. Popular blockchain platforms for NFTs include Ethereum, Polygon, Binance Smart Chain, and so on.
- Once you know the blockchain platform, you can use a blockchain explorer to search for the NFT contract address. A blockchain explorer is a tool that allows you to view transaction data on the blockchain.
- After you find the NFT contract address, you can use Chainbase API Get NFT owners by collection to get all the owners of that NFT collection.
The following tutorial shows how to use Chainbase to get all the owners of a certain NFT collection. With this information, you can see who the largest holder of an NFT collection is.
Overview - Tools you need to work with Chainbase
- A free account at Chainbase with an API key.
- An IDE. Our examples are shown in JavaScript, you can use VS Code as your IDE for example.
- The contract address of a known NFT collection as your input.
Step 1: Set up a free account at Chainbase
To better leverage the ability that Chainbase provides, you can register here for a free account and access to different APIs and data cloud.
After logging into Chainbase, visit the dashboard to get an overview. Create a new project in the console and get an API key.
Step 2: Write script using Chainbase API
- Using
fetch
in JavaScript.
- Using
axios
in JavaScript. You need to installaxios
usingnpm install axios --save
in the terminal first.
Step 3: Print the owners of the NFT collection
Chainbase API Get NFT owners by collection takes the chain id and NFT contract address as parameters, and returns the holders’ address and the corresponding total. You can also get the total holder number in the count
column of the returned data.
To get data printed, run command node <filename>.js
in the terminal. In this case, the data
column of the returned data looks as follows.
API Reference
If you want to know more details on the endpoint and optional parameters, check out:
Support
If you meet any trouble following the tutorial, feel free to reach out to us in our Discord to get 24/7 community support.