
How to Get the Holders of an ERC20 Token
IntroductionIn the world of cryptocurrency, knowing the holders of a particular token can provide valuable insights and opportunities for collaboration. Chainbase, a leading platform, offers a powerful API called getTokenHolders that allows you to retrieve a list of addresses for all the holders of a specific ERC20 token. This tutorial will guide you through the process of using Chainbase API to get the holders of a cryptocurrency deployed on various chains. By leveraging this information, yo...

How to Determine the Type of an EVM Contract
In common on-chain data parsing, there is often a large demand for determining the type of contract. This article will judge on relevant standards and engineering practices to determine whether the contract belongs to ERC20 / ERC721 / ERC1155. For more use cases, you can refer to the developer documentation of Chainbase, or ask the original author through Discord. We are happy to discuss issues related to Web3 infra, Data SDK, Chainbase APIs, etc.Rules to determine different contractsWith the...

How to Register a Chainbase Account?
To get started, go to the Chainbase official website.websiteClick on the dashboard to register a new account.loginEnter your email and password.Untitled.pngNext, create a new project in the console to obtain an API key. Now it's time to start your Web3 journey!
All-in-one web3 data infrastructure for indexing, transforming, and utilization of on-chain data at scale.



How to Get the Holders of an ERC20 Token
IntroductionIn the world of cryptocurrency, knowing the holders of a particular token can provide valuable insights and opportunities for collaboration. Chainbase, a leading platform, offers a powerful API called getTokenHolders that allows you to retrieve a list of addresses for all the holders of a specific ERC20 token. This tutorial will guide you through the process of using Chainbase API to get the holders of a cryptocurrency deployed on various chains. By leveraging this information, yo...

How to Determine the Type of an EVM Contract
In common on-chain data parsing, there is often a large demand for determining the type of contract. This article will judge on relevant standards and engineering practices to determine whether the contract belongs to ERC20 / ERC721 / ERC1155. For more use cases, you can refer to the developer documentation of Chainbase, or ask the original author through Discord. We are happy to discuss issues related to Web3 infra, Data SDK, Chainbase APIs, etc.Rules to determine different contractsWith the...

How to Register a Chainbase Account?
To get started, go to the Chainbase official website.websiteClick on the dashboard to register a new account.loginEnter your email and password.Untitled.pngNext, create a new project in the console to obtain an API key. Now it's time to start your Web3 journey!
All-in-one web3 data infrastructure for indexing, transforming, and utilization of on-chain data at scale.
Share Dialog
Share Dialog

Subscribe to Chainbase

Subscribe to Chainbase
<100 subscribers
<100 subscribers
The author: Takahashi Kaito
Introduction
Tools required to work with Chainbase
Set up a free account at Chainbase
Write a script using Chainbase API
Print NFTs owned by the wallet
Conclusion
FAQs (5 unique questions)
As the world of Non-Fungible Tokens (NFTs) continues to gain popularity, it becomes essential for wallet owners to have the ability to view all the NFTs they hold. In this article, we will explore how you can retrieve all the NFTs owned by a specific wallet address using Chainbase, a platform that offers a convenient API endpoint called getAccountNFTs.
Before we dive into the process, let's ensure we have the necessary tools in place:
Chainbase Account and API Key: Start by setting up a free account at Chainbase and obtain an API key. This key will grant you access to the Chainbase API.
Integrated Development Environment (IDE): For our examples, we will be using JavaScript, and you can use Visual Studio Code (VS Code) for writing and executing the code.
Wallet Address: You will need a wallet address for which you want to obtain the associated NFTs. Make sure you have the address ready before proceeding.
To make the most out of Chainbase's capabilities, begin by registering for a free account on our website. Once you've successfully logged in, explore the dashboard to familiarize yourself with the features. Next, create a new project using the console and obtain your unique API key.
Now that we have our account and API key, we can proceed with writing a script that utilizes the Chainbase API to retrieve the NFTs. Let's consider two options using JavaScript: fetch and axios.
Using Fetch in JavaScript
network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
fetch(`https://api.chainbase.online/v1/account/nfts?chain_id=${network_id}&address=${wallet_addr}&page=1&limit=5`, {
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
}).then(response => response.json())
.then(data => console.log(data.data))
.catch(error => console.error(error));
Using Axios in JavaScript
Ensure you have axios installed by running npm install axios --save in the terminal.
network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
const axios = require('axios');
const options = {
url: `https://api.chainbase.online/v1/account/nfts?chain_id=${network_id}&address=${wallet_addr}&page=1&limit=5`,
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
The Chainbase API provides the [getAccountNFTs](https://docs.chainbase.com/reference/getaccountnfts) endpoint, which requires the chain ID and the wallet address as parameters. This endpoint returns the NFTs associated with the given wallet address.
To secure and display the NFTs’ data, execute the script in your preferred JavaScript runtime environment. By running the command node <filename>.js in the terminal, you will see the NFTs owned by the provided wallet address.
[
{
contract_address: '0xc54567b294d7ec7807529fbaec71d326543453c5',
erc_type: 'ERC721',
image_uri: 'ipfs://QmVaTJSCgGFyfcd4hsaTN2ZMDh2hErpCtY9xMP9USdZqt1',
metadata: {
attributes: [Array],
description: "CoinStats GLXY is for the starry-eyed and galaxy-brained. It's for those whose spaceship has landed on CoinStats planet, who appreciate the mysterious glow the cosmic entities on our orbit give off. Enjoy the kitsch!",
image: 'ipfs://QmVaTJSCgGFyfcd4hsaTN2ZMDh2hErpCtY9xMP9USdZqt1',
name: 'CoinStats GLXY 1856'
},
mint_time: '2022-08-11T07:22:13Z',
mint_transaction_hash: '0x46a7b861a8f1e0290b6dc3095051bf03914701ea6b0a065455273c61fb6b3861',
name: 'CoinStatsGLXY',
owner: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
symbol: 'GLXY',
token_id: '0x0740',
token_uri: 'ipfs://QmQyhH7CWpcRpZtuau7GzucbG4NnG2Uv3ZuAuvHGJWdys7/1856.json',
total: 1,
total_string: '1',
traits: null
},
{
contract_address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
erc_type: 'ERC1155',
image_uri: '',
metadata: null,
mint_time: '0001-01-01T00:00:00Z',
mint_transaction_hash: '',
name: 'OpenSea Shared Storefront',
owner: '',
symbol: 'OPENSTORE',
token_id: '0x92c6b6b4a1817e76b56eb3e1724f9df6026dd63c000000000000410000000006',
token_uri: '',
total: 1,
total_string: '1',
traits: null
},
{
contract_address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
erc_type: 'ERC1155',
image_uri: '',
metadata: null,
mint_time: '0001-01-01T00:00:00Z',
mint_transaction_hash: '',
name: 'OpenSea Shared Storefront',
owner: '',
symbol: 'OPENSTORE',
token_id: '0x92c6b6b4a1817e76b56eb3e1724f9df6026dd63c000000000000400000000006',
token_uri: '',
total: 1,
total_string: '1',
traits: null
},
{
contract_address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
erc_type: 'ERC1155',
image_uri: '',
metadata: null,
mint_time: '0001-01-01T00:00:00Z',
mint_transaction_hash: '',
name: 'OpenSea Shared Storefront',
owner: '',
symbol: 'OPENSTORE',
token_id: '0x92c6b6b4a1817e76b56eb3e1724f9df6026dd63c0000000000003f0000000006',
token_uri: '',
total: 1,
total_string: '1',
traits: null
},
{
contract_address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
erc_type: 'ERC1155',
image_uri: '',
metadata: null,
mint_time: '0001-01-01T00:00:00Z',
mint_transaction_hash: '',
name: 'OpenSea Shared Storefront',
owner: '',
symbol: 'OPENSTORE',
token_id: '0x92c6b6b4a1817e76b56eb3e1724f9df6026dd63c0000000000003e0000000006',
token_uri: '',
total: 1,
total_string: '1',
traits: null
}
]
API Reference If you want more detailed information about the [getAccountNFTs](https://docs.chainbase.com/reference/getaccountnfts) endpoint and its optional parameters, please refer to the official API documentation provided by Chainbase.
In this article, we explored how to get all the NFTs owned by a specific wallet address using the Chainbase API. We covered the necessary tools required to work with Chainbase, such as setting up a free account and obtaining an API key. Additionally, we provided examples of JavaScript code using both the fetch and axios libraries to make API requests.
By following the steps outlined in this article, you can easily retrieve the NFTs associated with any given wallet address. This functionality enables wallet holders to gain a comprehensive view of their NFT holdings, facilitating better management and analysis of their digital assets for developers.
If you have any further questions or face any challenges while implementing this process, please refer to the official Chainbase documentation or reach out to their support team for assistance.
1. Is it necessary to have a Chainbase account to retrieve NFTs owned by a wallet address?
Yes, you need to have a Chainbase account and obtain an API key to access the [getAccountNFTs](https://docs.chainbase.com/reference/getaccountnfts) endpoint and retrieve NFTs associated with a wallet address.
2. Can I use a different programming language instead of JavaScript to retrieve NFTs using Chainbase?
Yes, Chainbase provides a RESTful API, so you can use any programming language that supports HTTP requests to interact with the Chainbase API and retrieve NFT data.
3. Can I retrieve all NFTs owned by any wallet address, or do I need specific permissions?
You can retrieve the NFTs owned by any wallet address as long as you have the wallet address and the necessary API key from Chainbase.
4. How can I increase the limit of NFTs retrieved per request?
In the API endpoint URL, you can modify the limit parameter to increase the number of NFTs retrieved per request. By default, it is set to 5 in the provided examples.
5. Are there any additional filters or sorting options available when retrieving NFTs using Chainbase?
Yes, Chainbase provides additional optional parameters in the [getAccountNFTs](https://docs.chainbase.com/reference/getaccountnfts) endpoint to apply filters and sorting options. You can refer to the official API documentation for more details on these parameters.
Chainbase is an all-in-one data infrastructure for Web3 that allows you to index, transform, and use on-chain data at scale. By leveraging enriched on-chain data and streaming computing technologies across one data infrastructure, Chainbase automates the indexing and querying of blockchain data, enabling developers to accomplish more with less effort.
Visit our website chainbase.com Sign up for a free account, and Check out our documentation.
Website|Blog|Twitter|Discord|Link3
Original Link: How to Get All the NFTs Owned by an Address
The author: Takahashi Kaito
Introduction
Tools required to work with Chainbase
Set up a free account at Chainbase
Write a script using Chainbase API
Print NFTs owned by the wallet
Conclusion
FAQs (5 unique questions)
As the world of Non-Fungible Tokens (NFTs) continues to gain popularity, it becomes essential for wallet owners to have the ability to view all the NFTs they hold. In this article, we will explore how you can retrieve all the NFTs owned by a specific wallet address using Chainbase, a platform that offers a convenient API endpoint called getAccountNFTs.
Before we dive into the process, let's ensure we have the necessary tools in place:
Chainbase Account and API Key: Start by setting up a free account at Chainbase and obtain an API key. This key will grant you access to the Chainbase API.
Integrated Development Environment (IDE): For our examples, we will be using JavaScript, and you can use Visual Studio Code (VS Code) for writing and executing the code.
Wallet Address: You will need a wallet address for which you want to obtain the associated NFTs. Make sure you have the address ready before proceeding.
To make the most out of Chainbase's capabilities, begin by registering for a free account on our website. Once you've successfully logged in, explore the dashboard to familiarize yourself with the features. Next, create a new project using the console and obtain your unique API key.
Now that we have our account and API key, we can proceed with writing a script that utilizes the Chainbase API to retrieve the NFTs. Let's consider two options using JavaScript: fetch and axios.
Using Fetch in JavaScript
network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
fetch(`https://api.chainbase.online/v1/account/nfts?chain_id=${network_id}&address=${wallet_addr}&page=1&limit=5`, {
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
}).then(response => response.json())
.then(data => console.log(data.data))
.catch(error => console.error(error));
Using Axios in JavaScript
Ensure you have axios installed by running npm install axios --save in the terminal.
network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
const axios = require('axios');
const options = {
url: `https://api.chainbase.online/v1/account/nfts?chain_id=${network_id}&address=${wallet_addr}&page=1&limit=5`,
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
The Chainbase API provides the [getAccountNFTs](https://docs.chainbase.com/reference/getaccountnfts) endpoint, which requires the chain ID and the wallet address as parameters. This endpoint returns the NFTs associated with the given wallet address.
To secure and display the NFTs’ data, execute the script in your preferred JavaScript runtime environment. By running the command node <filename>.js in the terminal, you will see the NFTs owned by the provided wallet address.
[
{
contract_address: '0xc54567b294d7ec7807529fbaec71d326543453c5',
erc_type: 'ERC721',
image_uri: 'ipfs://QmVaTJSCgGFyfcd4hsaTN2ZMDh2hErpCtY9xMP9USdZqt1',
metadata: {
attributes: [Array],
description: "CoinStats GLXY is for the starry-eyed and galaxy-brained. It's for those whose spaceship has landed on CoinStats planet, who appreciate the mysterious glow the cosmic entities on our orbit give off. Enjoy the kitsch!",
image: 'ipfs://QmVaTJSCgGFyfcd4hsaTN2ZMDh2hErpCtY9xMP9USdZqt1',
name: 'CoinStats GLXY 1856'
},
mint_time: '2022-08-11T07:22:13Z',
mint_transaction_hash: '0x46a7b861a8f1e0290b6dc3095051bf03914701ea6b0a065455273c61fb6b3861',
name: 'CoinStatsGLXY',
owner: '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045',
symbol: 'GLXY',
token_id: '0x0740',
token_uri: 'ipfs://QmQyhH7CWpcRpZtuau7GzucbG4NnG2Uv3ZuAuvHGJWdys7/1856.json',
total: 1,
total_string: '1',
traits: null
},
{
contract_address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
erc_type: 'ERC1155',
image_uri: '',
metadata: null,
mint_time: '0001-01-01T00:00:00Z',
mint_transaction_hash: '',
name: 'OpenSea Shared Storefront',
owner: '',
symbol: 'OPENSTORE',
token_id: '0x92c6b6b4a1817e76b56eb3e1724f9df6026dd63c000000000000410000000006',
token_uri: '',
total: 1,
total_string: '1',
traits: null
},
{
contract_address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
erc_type: 'ERC1155',
image_uri: '',
metadata: null,
mint_time: '0001-01-01T00:00:00Z',
mint_transaction_hash: '',
name: 'OpenSea Shared Storefront',
owner: '',
symbol: 'OPENSTORE',
token_id: '0x92c6b6b4a1817e76b56eb3e1724f9df6026dd63c000000000000400000000006',
token_uri: '',
total: 1,
total_string: '1',
traits: null
},
{
contract_address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
erc_type: 'ERC1155',
image_uri: '',
metadata: null,
mint_time: '0001-01-01T00:00:00Z',
mint_transaction_hash: '',
name: 'OpenSea Shared Storefront',
owner: '',
symbol: 'OPENSTORE',
token_id: '0x92c6b6b4a1817e76b56eb3e1724f9df6026dd63c0000000000003f0000000006',
token_uri: '',
total: 1,
total_string: '1',
traits: null
},
{
contract_address: '0x495f947276749ce646f68ac8c248420045cb7b5e',
erc_type: 'ERC1155',
image_uri: '',
metadata: null,
mint_time: '0001-01-01T00:00:00Z',
mint_transaction_hash: '',
name: 'OpenSea Shared Storefront',
owner: '',
symbol: 'OPENSTORE',
token_id: '0x92c6b6b4a1817e76b56eb3e1724f9df6026dd63c0000000000003e0000000006',
token_uri: '',
total: 1,
total_string: '1',
traits: null
}
]
API Reference If you want more detailed information about the [getAccountNFTs](https://docs.chainbase.com/reference/getaccountnfts) endpoint and its optional parameters, please refer to the official API documentation provided by Chainbase.
In this article, we explored how to get all the NFTs owned by a specific wallet address using the Chainbase API. We covered the necessary tools required to work with Chainbase, such as setting up a free account and obtaining an API key. Additionally, we provided examples of JavaScript code using both the fetch and axios libraries to make API requests.
By following the steps outlined in this article, you can easily retrieve the NFTs associated with any given wallet address. This functionality enables wallet holders to gain a comprehensive view of their NFT holdings, facilitating better management and analysis of their digital assets for developers.
If you have any further questions or face any challenges while implementing this process, please refer to the official Chainbase documentation or reach out to their support team for assistance.
1. Is it necessary to have a Chainbase account to retrieve NFTs owned by a wallet address?
Yes, you need to have a Chainbase account and obtain an API key to access the [getAccountNFTs](https://docs.chainbase.com/reference/getaccountnfts) endpoint and retrieve NFTs associated with a wallet address.
2. Can I use a different programming language instead of JavaScript to retrieve NFTs using Chainbase?
Yes, Chainbase provides a RESTful API, so you can use any programming language that supports HTTP requests to interact with the Chainbase API and retrieve NFT data.
3. Can I retrieve all NFTs owned by any wallet address, or do I need specific permissions?
You can retrieve the NFTs owned by any wallet address as long as you have the wallet address and the necessary API key from Chainbase.
4. How can I increase the limit of NFTs retrieved per request?
In the API endpoint URL, you can modify the limit parameter to increase the number of NFTs retrieved per request. By default, it is set to 5 in the provided examples.
5. Are there any additional filters or sorting options available when retrieving NFTs using Chainbase?
Yes, Chainbase provides additional optional parameters in the [getAccountNFTs](https://docs.chainbase.com/reference/getaccountnfts) endpoint to apply filters and sorting options. You can refer to the official API documentation for more details on these parameters.
Chainbase is an all-in-one data infrastructure for Web3 that allows you to index, transform, and use on-chain data at scale. By leveraging enriched on-chain data and streaming computing technologies across one data infrastructure, Chainbase automates the indexing and querying of blockchain data, enabling developers to accomplish more with less effort.
Visit our website chainbase.com Sign up for a free account, and Check out our documentation.
Website|Blog|Twitter|Discord|Link3
Original Link: How to Get All the NFTs Owned by an Address
No activity yet