Here for the API?Start building with us today

Learn about DeCommas API
Tutorial: How to Build a Top Token Holders Feature Using the DeСommas Mission Control API
October 20, 2023

Tutorial: How to Build a Top Token Holders Feature Using the DeСommas Mission Control API

For those just hearing the term token holders for the first time or not familiar with it, token holders are key stakeholders in a crypto ecosystem who are financially invested in the ownership of a crypto project. The concept of token holders is synonymous with shareholders. Just like a shareholder owns a part of a company in the form of a share, so does a token holder own a part of a crypto project in the form of a token. They are basically the financial members of a crypto project. 

The primary focus of this tutorial is to create a step-by-step guide on how to build a top token holders feature using our new Decommas Mission Control API. With this feature, interested parties like developers, traders, and crypto enthusiasts are better empowered with valuable insight and insider knowledge on the activities of token holders in their ecosystem. 

As we get into the thick of the tutorial, we will use blockchain explorer platforms like Etherscan and Bscscan to illustrate how the token top holders feature generally functions. We can almost assure you that by the end of this tutorial, you will have turned into a blockchain developer with the right ingredient of knowledge and tools to build a token holders feature for any web3 project using our Decommas Mission Control API

What is the Token Top Holders Feature?

Token top holders feature, or token holders feature if you like, is a feature or tool that helps you to know who has the most amount of a token or cryptocurrency. 

Let’s say you want to know who has the most amount of Ether in circulation; the token top holders feature is what you need to know. This feature is important because it provides vital information about who owns the largest token amount, which helps make informed investment decisions.

Generally, here are some functions the feature can perform:

  1. Help to identify the wallet that holds the most “tokens”. 
  2. Determine the general ownership distribution of a token to identify the potential risk of “rug-pull”. 
  3. Help to understand the behavior of large token holders or whales, which can influence the direction of the market. 

Tutorial: An Overview of How to Build the Token Top Holders Feature using DeCommas Mission Control API

Are you looking for a roadmap to creating a Token Top Holders feature using the Decommas Mission Control API? Here you go. This tutorial will guide you step-by-step through the process, ensuring you grasp each concept along the way. We will also do a recap of how to get your personal mission control API key and set it up. Specifically, we will examine the following topics: 

  1. Get Your Personal Mission Control API Key
  2. Setting Up Mission Control API in Your Development Environment
  3. Building the Token Top Holders Feature:
  • How to build actual token top holders feature  

Get Your Personal Mission Control API Key

If you recall in our previous tutorials, you need access to the Decommas Mission Control API to get your personal mission control API key. Fortunately, it’s often free to use with consistently low response times of 150 milliseconds. Here’s how you can obtain your API key:

Step 1: Visit

Step 2: Click “Get Started”

Step 3: Provide your email address for verification

Step 4: Check your email for the verification link, and click it to access with URL , your gateway to API keys.

Ensure your API keys are stored using high-level security, readily accessible for future use, and confidential. Furthermore, you can consult our documentation here for further research. 

Setting Up the Mission Control API in your Development Environment 

Whether you’re keen on making raw HTTPS requests or prefer the convenience of the JavaScript SDK, DeCommas offers both options. In this section, we’ll walk you through both options but concentrate mainly on the JavaScript SDK. Here are the steps to get started: 

Step 1: InstallationTo start, install the DeCommas API SDK:

npm install @decommas/sdk

Step 2: SDK Initialization

Post-installation, import the SDK. For development-only mode, you can initialize it without an API key:

import { Decommas } from '@decommas/sdk'; 
const decommas = new Decommas();

const getVitalikERC20Balances = async () => {
  const address = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Replace with any address
  const tokens = await decommas.address.getTokens({ address });

Step 3: Using an API Key

For full access to the DeCommas API features, sign up on the DeCommas dashboard to obtain your API key:

import { Decommas } from '@decommas/sdk'; 
const decommas = new Decommas(API_KEY);

Step 4: Fetching Token Top Holders

With the recent addition to the SDK, you can now retrieve the top holders of a specific token:

const getTokenTopHolders = async () => {
  const chainName = "YOUR_CHAIN_NAME"; // e.g., ChainName.MAINNET
  const contractAddress = "YOUR_CONTRACT_ADDRESS";
  const holders = await decommas.metadata.getTokenHolders({ chainName, contractAddress });

Replace YOUR_CHAIN_NAME with the desired blockchain name and YOUR_CONTRACT_ADDRESS with the contract address of the token.

Raw HTTPS Requests

For those who opt for raw HTTPS requests:{chain_name}/{contract_address}?api-key={YOUR-API-KEY}

Building the Token Top Holders Feature 

The Token Top Holders feature, exemplified by platforms like Etherscan and BscScan, provides a real-time snapshot of how tokens are distributed among various holders of a specified cryptocurrency. Through these platforms, anyone interested in analyzing the distribution and concentration of tokens in a particular cryptocurrency can readily do so, demonstrating the practical utility of this feature in the crypto space. 

However, with all the exciting functions the token top holders feature provides, the question remains: how can we build it using the Decommas Mission Control API? This is exactly what we will be addressing in this section.

How to build actual token top holders feature  

To build the token top holders feature, here is a detailed breakdown of how the token holders endpoint works and the steps to follow: 

Step 1: Initiate request

A simple request to the Token Holders endpoint kicks the ball rolling, and the endpoint can return a list of 10,000 addresses in total, not more. You’d also need to tag along some details like the network name (say, Ethereum), the token contract address, and, if you fancy, pagination details to slice the data into manageable bits.

const contractAddress = 'YOUR_CONTRACT_ADDRESS_HERE';  // Replace with your specific contract address
const url =${contractAddress}

Step 2: Blockchain Banter

Upon catching your request, the endpoint queries the blockchain to fetch the data of the token holders from the specified contract.

Upon accessing the endpoint, users instantly get token ownership data. Thanks to Decommas’ indexed infrastructure, there is no delay. 

Step 3: Data Sorting

The raw data is then sorted in descending order based on the amount of tokens held. It’s like arranging folks in a line from the tallest to the shortest.

Step 4: Response Crafting

The endpoint then crafts a neat and tidy response, usually in a JSON format, making it easy for your application to digest.

// An example of a response
  "holders": [
      "address": "0x123...",
      "balance": "10000"
      "address": "0x456...",
      "balance": "8000"
    // ... and the list goes on

As shown above, the response typically shows a list of addresses along with the amount of tokens each address holds. With this information, users can effortlessly determine who the largest token holders are and also understand the distribution pattern of the token. This can be particularly useful for developers, analysts, or even investors. Generally, the endpoint response helps users analyze ownership trends, market behavior or simply satisfy curiosity about who holds what. Let me quickly add that, whenever you’re eager to build a Token Top Holders feature, this endpoint is your go-to buddy!

Wrapping Up — Your First Steps to Building Top Token Holders Feature

And there you have it! We’ve walked through the definitions of token holders, skipped along the technical jargon of DeCommas Mission Control API, and ended our journey building a shiny Token Top Holders feature. 

While we’ve laid out the bricks, there’s still a lot more you can build on this foundation. The cryptoverse is a vast playground, and with tools like DeCommas at your disposal, there’s much to explore and create. Got questions or hit a rocky road? Feel free to hit up the support at [email protected]

Happy building!