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

Chainbase September Newsletter
The Author: Chainbase Team September is over and check out what awesome things we’ve done in this month! Highlights:TON supportedSync - The Cloud-native Kafka Service - launchedSync data updatedLine-up for upcoming events!✦ Product UpdatesThe Secret Chainbase Master PlanThe Secret Chainbase Master Plan.pngMogu, founder and CEO of Chainbase, has probed into the company's past, present, and future, and detailed our roadmap. From on-cloud to on-chain, from a SaaS product to the data network...
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...

Chainbase September Newsletter
The Author: Chainbase Team September is over and check out what awesome things we’ve done in this month! Highlights:TON supportedSync - The Cloud-native Kafka Service - launchedSync data updatedLine-up for upcoming events!✦ Product UpdatesThe Secret Chainbase Master PlanThe Secret Chainbase Master Plan.pngMogu, founder and CEO of Chainbase, has probed into the company's past, present, and future, and detailed our roadmap. From on-cloud to on-chain, from a SaaS product to the data network...
All-in-one web3 data infrastructure for indexing, transforming, and utilization of on-chain data at scale.

Subscribe to Chainbase

Subscribe to Chainbase
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers


The author: Penguins Jacques
If you're looking to track wallets address or develop applications that interact with a protocol, having access to all the portfolios owned by a specific address can be highly beneficial. In this guide, we will walk you through the steps to retrieve all portfolios owned by an address in the protocol using Chainbase's getAccountPortfolios API.
Overview - Tools you need to work with Chainbase
Set up a free account at Chainbase
Write a script using Chainbase API
Obtain DeFi portfolios
Conclusion
FAQs
To get started with Chainbase and retrieve portfolios owned by an address, you'll need the following:
A free account at Chainbase with an API key.
An Integrated Development Environment (IDE) like Visual Studio Code (VS Code).
The wallet address you want to analyze.
Before you can access Chainbase's APIs, you'll need to create a free account:
Visit the Chainbase website and register for a free account.
Log in to your Chainbase account and navigate to the dashboard.
Create a new project in the console to obtain an API key.
Once you have your Chainbase account set up and an API key, you can use the getAccountPortfolios API to get the portfolios owned by a specific address. Here's an example script in JavaScript:
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
fetch(`https://api.chainbase.online/v1/account/portfolios?address=${wallet_addr}`, {
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));
Make sure to replace CHAINBASE_API_KEY with your actual API key.
Alternatively, you can use the axios library.
Install axios by running npm install axios --save in your terminal, and then use the following script:
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
const axios = require('axios');
const options = {
url: `https://api.chainbase.online/v1/account/portfolios?address=${wallet_addr}`,
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 getAccountPortfolios API requires the chain ID and wallet address as parameters and returns the DeFi portfolios associated with the wallet. To print the portfolios, follow these steps:
Save the script to a file with a .js extension.
Open your terminal and navigate to the directory where the file is saved.
Run the command node <filename>.js, replacing <filename>.
The script will make a request to the Chainbase API with the provided wallet address and API key.
The API will return a response containing the portfolios owned by the address.
The script will print the portfolios to the console.
{
"id": "uniswap_v2",
"name": "uniswap_v2",
"blockchain": "ethereum",
"logo_url": "https://static.chainbase.online/token_icons/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984.png",
"portfolios": [
{
"pool": {
"address": "0x3d1cb7638d73657f7e554eda1d97703bc29d3c15",
"created_at": "2020-09-09T21:43:36"
},
"type": "liquidity",
"assets_deposited": [
{
"asset": {
"id": "0xa585cb4e6e833d6fa55a992e75b9ee0743b23d69",
"logo_url": null,
"name": "",
"symbol": "",
"type": ""
},
"amount": -1,
"usd_value": 0
},
{
"asset": {
"id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"logo_url": "https://static.chainbase.online/token_icons/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png",
"name": "WETH",
"symbol": "WETH",
"type": ""
},
"amount": 0.1378100814794963,
"usd_value": 249.6605333854962
}
Retrieving all portfolios owned by an address in a protocol can be accomplished by using Chainbase's getAccountPortfolios API. By following the steps outlined in this guide, you can easily obtain this information for auditing purposes or application development.
Remember to handle the response data appropriately based on your specific use case. You may need to extract and process the relevant portfolio information to further analyze or display it.
Q: Can I retrieve portfolios owned by an address on any blockchain protocol using Chainbase? A: Chainbase currently supports retrieving portfolios for Ethereum-based protocols, including Ethereum, Binance Smart Chain, and Polygon (Matic). You can check Chainbase's documentation for the supported protocols.
Q: Are there any rate limits or usage restrictions for Chainbase's API? A: Chainbase provides different rate limits based on your subscription plan. Free accounts have a limited number of API requests per day. You can check Chainbase's pricing and documentation for more details on rate limits and usage restrictions.
Q: Can I use Chainbase's API for other purposes beyond retrieving portfolios? A: Yes, Chainbase provides a range of APIs that allow you to access various blockchain data, including transaction history, token balances, portfolio details, and more. You can explore our API documentation for more information.
Q: Are there any alternatives to Chainbase for retrieving portfolios owned by an address? A: Yes, there are other blockchain data providers and APIs available that offer similar functionality. Some popular alternatives include Etherscan, Blockchair, and Covalent. Each provider may have different features, pricing, and supported protocols, so it's worth exploring multiple options to find the one that best suits your needs. And please remember to support us in the future.
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 Portfolios Owned by an Address in the Protocol
The author: Penguins Jacques
If you're looking to track wallets address or develop applications that interact with a protocol, having access to all the portfolios owned by a specific address can be highly beneficial. In this guide, we will walk you through the steps to retrieve all portfolios owned by an address in the protocol using Chainbase's getAccountPortfolios API.
Overview - Tools you need to work with Chainbase
Set up a free account at Chainbase
Write a script using Chainbase API
Obtain DeFi portfolios
Conclusion
FAQs
To get started with Chainbase and retrieve portfolios owned by an address, you'll need the following:
A free account at Chainbase with an API key.
An Integrated Development Environment (IDE) like Visual Studio Code (VS Code).
The wallet address you want to analyze.
Before you can access Chainbase's APIs, you'll need to create a free account:
Visit the Chainbase website and register for a free account.
Log in to your Chainbase account and navigate to the dashboard.
Create a new project in the console to obtain an API key.
Once you have your Chainbase account set up and an API key, you can use the getAccountPortfolios API to get the portfolios owned by a specific address. Here's an example script in JavaScript:
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
fetch(`https://api.chainbase.online/v1/account/portfolios?address=${wallet_addr}`, {
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));
Make sure to replace CHAINBASE_API_KEY with your actual API key.
Alternatively, you can use the axios library.
Install axios by running npm install axios --save in your terminal, and then use the following script:
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
const axios = require('axios');
const options = {
url: `https://api.chainbase.online/v1/account/portfolios?address=${wallet_addr}`,
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 getAccountPortfolios API requires the chain ID and wallet address as parameters and returns the DeFi portfolios associated with the wallet. To print the portfolios, follow these steps:
Save the script to a file with a .js extension.
Open your terminal and navigate to the directory where the file is saved.
Run the command node <filename>.js, replacing <filename>.
The script will make a request to the Chainbase API with the provided wallet address and API key.
The API will return a response containing the portfolios owned by the address.
The script will print the portfolios to the console.
{
"id": "uniswap_v2",
"name": "uniswap_v2",
"blockchain": "ethereum",
"logo_url": "https://static.chainbase.online/token_icons/0x1f9840a85d5af5bf1d1762f925bdaddc4201f984.png",
"portfolios": [
{
"pool": {
"address": "0x3d1cb7638d73657f7e554eda1d97703bc29d3c15",
"created_at": "2020-09-09T21:43:36"
},
"type": "liquidity",
"assets_deposited": [
{
"asset": {
"id": "0xa585cb4e6e833d6fa55a992e75b9ee0743b23d69",
"logo_url": null,
"name": "",
"symbol": "",
"type": ""
},
"amount": -1,
"usd_value": 0
},
{
"asset": {
"id": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
"logo_url": "https://static.chainbase.online/token_icons/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png",
"name": "WETH",
"symbol": "WETH",
"type": ""
},
"amount": 0.1378100814794963,
"usd_value": 249.6605333854962
}
Retrieving all portfolios owned by an address in a protocol can be accomplished by using Chainbase's getAccountPortfolios API. By following the steps outlined in this guide, you can easily obtain this information for auditing purposes or application development.
Remember to handle the response data appropriately based on your specific use case. You may need to extract and process the relevant portfolio information to further analyze or display it.
Q: Can I retrieve portfolios owned by an address on any blockchain protocol using Chainbase? A: Chainbase currently supports retrieving portfolios for Ethereum-based protocols, including Ethereum, Binance Smart Chain, and Polygon (Matic). You can check Chainbase's documentation for the supported protocols.
Q: Are there any rate limits or usage restrictions for Chainbase's API? A: Chainbase provides different rate limits based on your subscription plan. Free accounts have a limited number of API requests per day. You can check Chainbase's pricing and documentation for more details on rate limits and usage restrictions.
Q: Can I use Chainbase's API for other purposes beyond retrieving portfolios? A: Yes, Chainbase provides a range of APIs that allow you to access various blockchain data, including transaction history, token balances, portfolio details, and more. You can explore our API documentation for more information.
Q: Are there any alternatives to Chainbase for retrieving portfolios owned by an address? A: Yes, there are other blockchain data providers and APIs available that offer similar functionality. Some popular alternatives include Etherscan, Blockchair, and Covalent. Each provider may have different features, pricing, and supported protocols, so it's worth exploring multiple options to find the one that best suits your needs. And please remember to support us in the future.
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 Portfolios Owned by an Address in the Protocol
No activity yet