- 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.
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 thecount
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.