Thursday, September 11, 2025
No Result
View All Result
Ajoobz
Advertisement
  • Home
  • Bitcoin
  • Crypto Updates
    • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Scam Alert
  • Regulations
  • Analysis
Marketcap
  • Home
  • Bitcoin
  • Crypto Updates
    • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Scam Alert
  • Regulations
  • Analysis
No Result
View All Result
Ajoobz
No Result
View All Result

How to Get All Owners of an ERC20 Token  – Moralis Web3

1 year ago
in Web3
Reading Time: 16 mins read
0 0
A A
0
Home Web3
Share on FacebookShare on TwitterShare on E-Mail


Are you in search of the simplest strategy to get all house owners of an ERC20 token? If that’s the case, then you definately’re precisely the place you could be! In at the moment’s information, we’ll present you the best way to get sorted holders of a token in a heartbeat utilizing Moralis’ Token API. If you happen to instantly need to leap straight into the code, take a look at our ERC20 Homeowners endpoint in motion down beneath: 

import fetch from ‘node-fetch’;

const choices = {
technique: ‘GET’,
headers: {
settle for: ‘software/json’,
‘X-API-Key’: ‘YOUR_API_KEY’
},
};

fetch(
“https://deep-index.moralis.io/api/v2.2/erc20/0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0/house owners?chain=eth&order=DESC”,
choices
)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));

In return for operating the code above, you’ll get an array comprising all house owners of the token in query in descending order – cryptocurrency whales first! What’s extra, the response is enriched with extra knowledge, equivalent to proprietor percentages, the USD worth of particular person holdings, and so forth. Right here’s an instance of what it would appear like: 

{
“cursor”: “eyJhbGciOiJIUz//…”,
“web page”: 1,
“page_size”: 100,
“consequence”: [
{
“balance”: “3704449652939473320142469218”,
“balance_formatted”: “3704449652.939473320142469218”,
“is_contract”: false,
“owner_address”: “0x5e3ef299fddf15eaa0432e6e66473ace8c13d908”,
“owner_address_label”: “Polygon (Matic): PoS Staking Contract”,
“usd_value”: “3489442144.205111503601074219”,
“percentage_relative_to_total_supply”: 37.044496529394735
},
//…
]
}

Getting sorted holders of a token doesn’t need to be tougher than that. Nevertheless, in order for you a extra detailed breakdown, please take a look at the documentation web page for our ERC20 Homeowners endpoint or be a part of us on this information. 

Additionally, when you want to get all house owners of an ERC20 token your self, don’t overlook to enroll with Moralis. You’ll be able to create an account without cost, and also you’ll achieve instantaneous entry to our premier suite of growth instruments! 

Overview 

Figuring out the house owners of an ERC20 token has been fairly a bothersome activity from a traditional perspective. Usually, this course of requires manually monitoring possession adjustments and transactions throughout numerous protocols, making a workflow that’s each time-intensive and complicated. Absolutely, there have to be a extra environment friendly technique, proper?

At Moralis, we got down to rework this historically troublesome course of right into a easy activity you’ll be able to full with out breaking a sweat. And that is exactly what our ERC20 Homeowners endpoint permits you to do. So, when you’d wish to discover the simplest strategy to get sorted holders of a token, then this learn is for you. Let’s leap straight into it by introducing Moralis! 

What’s Moralis? – The Best Method to Get All Homeowners of an ERC20 Token 

Moralis is the {industry}’s main Web3 knowledge supplier, supplying the assets you could construct subtle dapps. In our suite of growth instruments, you’ll discover every thing from top-tier blockchain nodes to 10+ use case-specific APIs. What’s extra, Moralis at present powers blockchain and crypto initiatives for thousands and thousands of finish customers all throughout the globe! 

Moralis title with the M logo on the left

So, why must you use Moralis when constructing dapps? 

One API – All of the Information: All our APIs are designed to reduce the requests you could construct dapps. This implies you get extra knowledge with fewer API calls when working with Moralis, resulting in decrease prices and enhanced effectivity.  Streamline Your Growth Expertise: Moralis’ APIs are intuitive and absolutely cross-chain. As such, you don’t need to trouble with a number of suppliers for numerous chains when utilizing our APIs, supplying you with a considerably extra accessible growth expertise.  Trusted By Business Leaders: Moralis is utilized by 100,000+ builders and trusted by {industry} leaders like MetaMask, Blockchain.com, and Opera. 

Industry-leading crypto enterprises that use Moralis to get all owners of ERC20 tokens, including MetaMask, Blockchain.com, Opera, etc.

Nonetheless, that offers you an summary of Moralis. Let’s now dive a bit deeper into our Web3 API suite and discover the Token API – the perfect software to get all house owners of an ERC20 token! 

Moralis’ Token API and the ERC20 Homeowners Endpoint 

Moralis’ Token API is the {industry}’s #1 software for ERC20 token knowledge, supporting each single token throughout all main chains. This contains stablecoins, meme cash, LP tokens, and every thing in between. So, when you’re trying to combine ERC20s into your dapps, then the Token API is the software for you! 

Moralis Token API banner image with Token API as title

With the Token API, you’ll be able to seamlessly combine balances, costs, transfers, and way more into your dapps with out breaking a sweat. What’s extra, with our ERC20 Homeowners endpoint, you may get sorted holders of a token with a single line of code. 

The ERC20 Homeowners endpoint simplifies the method of fetching correct ERC20 proprietor knowledge right into a easy operation you’ll be able to full in a heartbeat. With this revolutionary characteristic, now you can fetch the highest holders and whole provide of any token, together with possession percentages, the USD worth of particular person holdings, and extra, with ease. 

So, how does it work? 

Properly, to reply the above query, let’s dive into a brief script calling our ERC20 Homeowners endpoint: 

import fetch from ‘node-fetch’;

const choices = {
technique: ‘GET’,
headers: {
settle for: ‘software/json’,
‘X-API-Key’: ‘YOUR_API_KEY’
},
};

fetch(
“https://deep-index.moralis.io/api/v2.2/erc20/0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0/house owners?chain=eth&order=DESC”,
choices
)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));

All it’s important to do is exchange YOUR_API_KEY together with your Moralis API key, configure the parameters to suit your question and run the script. In return, you’ll get a response comprising an array of householders, together with their whole stability, the worth of their holdings, and way more. Right here’s an instance of what the response can appear like: 

{
“cursor”: “eyJhbGciOiJIUz//…”,
“web page”: 1,
“page_size”: 100,
“consequence”: [
{
“balance”: “3704449652939473320142469218”,
“balance_formatted”: “3704449652.939473320142469218”,
“is_contract”: false,
“owner_address”: “0x5e3ef299fddf15eaa0432e6e66473ace8c13d908”,
“owner_address_label”: “Polygon (Matic): PoS Staking Contract”,
“usd_value”: “3489442144.205111503601074219”,
“percentage_relative_to_total_supply”: 37.044496529394735
},
//…
]
}

The Advantages of Moralis’ ERC20 Homeowners Endpoint 

Now that you’ve familiarized your self with the ERC20 Homeowners endpoint, let’s dive a bit deeper into the advantages of this characteristic: 

Fewer API Calls: Up to now, you wanted to manually observe possession throughout the blockchain, which was a time-consuming and resource-intensive course of. By consolidating ERC20 proprietor knowledge right into a ready-to-use endpoint, you now want far fewer API calls to get the information you want.  Token Holder Perception: With the ERC20 Homeowners endpoint, you’ll be able to seamlessly fetch the highest holders of any token, considerably boosting transparency and the understanding of token distribution.  Simplified Token Analytics: With the ERC20 Homeowners endpoint, now you can effortlessly full complicated analytics duties. This contains figuring out distinctive holders, possession percentages, early adopters, newcomers, and so forth. 

Graphic art illustration - showing ERC20 tokens connected to wallet owners

3-Step Tutorial: How one can Get All Homeowners of an ERC20 Token with Moralis 

We’ll now stroll you thru a easy tutorial on the best way to get sorted holders of a token utilizing Moralis’ Token API. And due to the accessibility of this industry-leading software, you’ll be capable to get the information you want in three simple steps:

Get a Moralis API KeyWrite a Script Calling the ERC20 Homeowners EndpointRun the Code

Nevertheless, earlier than we will get going, you need to cope with some conditions! 

Conditions 

This shall be a JavaScript and Node.js tutorial. As such, when you haven’t already, ensure you arrange the next earlier than persevering with: 

Step 1: Get a Moralis API Key 

To get a Moralis API key, you could create an account by clicking on the ”Begin for Free” button on the prime proper on the Moralis homepage: 

Get ERC20 token owners step 1 - Sign up for a free Moralis account

When you’re achieved organising your account, you could log in, navigate to the ”Settings” tab, scroll down, and duplicate your key: 

Copying API key in the Moralis admin

Maintain the important thing for now. You’re going to wish it within the following step to initialize Moralis. 

Step 2: Write a Script Calling the ERC20 Homeowners Endpoint 

Begin by opening your most well-liked IDE and arrange a folder. Subsequent, open a brand new terminal and initialize a mission with the command beneath: 

npm init

You then want to put in the required dependencies with the next terminal inputs: 

npm set up node-fetch –save
npm set up moralis @moralisweb3/common-evm-utils

Subsequent, open your ”bundle.json” file and add ”sort”: ”module” to the listing: 

open your ”package.json” file and add ”type”: ”module” to the list: 

You’ll be able to then create a brand new ”index.js” file and add the next contents: 

import fetch from ‘node-fetch’;

const choices = {
technique: ‘GET’,
headers: {
settle for: ‘software/json’,
‘X-API-Key’: ‘YOUR_API_KEY’
},
};

fetch(
“https://deep-index.moralis.io/api/v2.2/erc20/0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0/house owners?chain=eth&order=DESC”,
choices
)
.then((response) => response.json())
.then((response) => console.log(response))
.catch((err) => console.error(err));

From right here, you could configure the code barely. First, exchange YOUR_API_KEY with the Moralis key you copied throughout step one. Subsequent, you additionally must configure question parameters to suit your question. 

That’s it for the code. All that continues to be from right here is executing the script! 

Step 3: Run the Code 

You’ll be able to execute the code by opening a brand new terminal and operating the command beneath within the root folder of the mission: 

node index.js

In return, you’ll get a response containing all house owners of the ERC20 token specified within the deal with parameter. Right here’s an instance of what it would appear like: 

{
“cursor”: “eyJhbGciOiJIUz//…”,
“web page”: 1,
“page_size”: 100,
“consequence”: [
{
“balance”: “3704449652939473320142469218”,
“balance_formatted”: “3704449652.939473320142469218”,
“is_contract”: false,
“owner_address”: “0x5e3ef299fddf15eaa0432e6e66473ace8c13d908”,
“owner_address_label”: “Polygon (Matic): PoS Staking Contract”,
“usd_value”: “3489442144.205111503601074219”,
“percentage_relative_to_total_supply”: 37.044496529394735
},
//…
]
}

And that’s it; it doesn’t need to be tougher than that to get sorted holders of a token when working with Moralis! 

Use Instances for Our API and the ERC20 Homeowners Endpoint 

Our ERC20 Homeowners endpoint is indispensable for many builders constructing dapps associated to fungible tokens. Nevertheless, to present you a couple of examples, let’s discover three outstanding use instances for this characteristic: 

Token Analytics: Token analytics platforms are web sites or functions that give customers beneficial perception into the efficiency of the market and particular person tokens. An ideal instance of a mission leveraging our APIs is Moralis Cash – the {industry}’s main token analytics platform.

Example project to get all owners of an ERC20 token - showing the Moralis Money platform

Portfolio Trackers: Portfolio trackers are platforms that give customers an entire overview of all their digital holdings. This sometimes contains each ERC20s and NFTs, in addition to shares and different digital belongings. Delta is a wonderful instance of a portfolio tracker platform leveraging our APIs to maintain customers up to date about current on-chain occasions. 

Get all owners of an erc20 token example project - showing a portfolio tracker and its UI

Cryptocurrency Wallets: Cryptocurrency wallets are web sites and functions for storing digital belongings. The perfect wallets additionally present options for getting, promoting, and buying and selling tokens. A outstanding instance of a supplier utilizing Moralis is MetaMask – the {industry}’s #1 cryptocurrency pockets.

Past the Token API – Exploring Moralis Additional

The Token API solely scratches the floor of what’s attainable with Moralis. As such, let’s now discover some extra APIs you’ll possible discover useful when constructing your dapps. Nevertheless, we gained’t be capable to cowl all of them on this information, which is why we’ll deal with the next three interfaces: 

Pockets APINFT APIBlockchain API

If you happen to’d wish to discover all our APIs, please go to the official Web3 API web page, which features a listing of all accessible interfaces! 

Pockets API 

The Pockets API is the {industry}’s #1 API for pockets knowledge, boasting a formidable array of options, unparalleled scalability, and distinctive flexibility. It’s the proper software when you’re trying to construct your personal crypto pockets or combine pockets functionalities into your dapp! 

Wallet API banner with Wallet API as title

With the Pockets API, you’ll be able to seamlessly fetch a pockets’s ERC20 balances, internet value, transaction historical past, and way more with a single line of code. To indicate you the way it works, we’ll now have a look at an instance of how straightforward it’s to fetch the ERC20 balances – with costs and metadata – of a pockets utilizing our getWalletTokenBalancesPrice() endpoint: 

import Moralis from ‘moralis’;

strive {
await Moralis.begin({
apiKey: “YOUR_API_KEY”
});

const response = await Moralis.EvmApi.wallets.getWalletTokenBalancesPrice({
“chain”: “0x1”,
“deal with”: “0xcB1C1FdE09f811B294172696404e88E658659905”
});

console.log(response.uncooked());
} catch (e) {
console.error(e);
}

Calling the endpoint above returns an array of all tokens the pockets holds. What’s extra, the response is enriched with costs and metadata, permitting you to, as an example, construct a portfolio view with a single endpoint: 

{
“cursor”: null,
“web page”: 0,
“page_size”: 100,
“consequence”: [
{
“token_address”: “0xae7ab96520de3a18e5e111b5eaab095312d7fe84”,
“symbol”: “stETH”,
“name”: “Liquid staked Ether 2.0”,
“logo”: “https://logo.moralis.io/0x1_0xae7ab96520de3a18e5e111b5eaab095312d7fe84_cd0f5053ccb543e08f65554bf642d751”,
“thumbnail”: “https://logo.moralis.io/0x1_0xae7ab96520de3a18e5e111b5eaab095312d7fe84_cd0f5053ccb543e08f65554bf642d751”,
“decimals”: 18,
“balance”: “90399378678107406”,
“possible_spam”: false,
“verified_contract”: true,
“total_supply”: “9542023372380838741270859”,
“total_supply_formatted”: “9542023.372380838741270859”,
“percentage_relative_to_total_supply”: 9.47381652195e-7,
“balance_formatted”: “0.090399378678107406”,
“usd_price”: 3611.562488280326,
“usd_price_24hr_percent_change”: 4.98306233529165,
“usd_price_24hr_usd_change”: 15.496644212196657,
“usd_value”: 326.483004997701,
“usd_value_24hr_usd_change”: 16.268851653168795,
“native_token”: false,
“portfolio_percentage”: 55.2363
},
//…
]
}

To discover different capabilities of this software, take a look at our official Pockets API web page! 

NFT API 

Moralis’ NFT API is Web3’s premier interface for NFT knowledge. This main software helps over three million NFT collections throughout all the most important chains, together with every thing from established initiatives like Nakamigos to tokens that dropped simply seconds in the past! 

NFT API marketing banner with NFT API as the title

With the NFT API, you’ll be able to seamlessly fetch metadata, balances, optimized picture previews, and way more with single endpoints. As such, you’ll be able to construct every thing from marketplaces to Web3 video games with out breaking a sweat when utilizing the NFT API. 

To spotlight the accessibility of the NFT API, we’ll now present you the best way to fetch the stability of any pockets with our getWalletNFTs() endpoint: 

import Moralis from ‘moralis’;

strive {
await Moralis.begin({
apiKey: “YOUR_API_KEY”
});

const response = await Moralis.EvmApi.nft.getWalletNFTs({
“chain”: “0x1”,
“deal with”: “0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e”
});

console.log(response.uncooked);
} catch (e) {
console.error(e);
}

In return for calling the endpoint above, you’ll get an array of all NFTs held by the pockets in query. Right here’s an instance of what the response would possibly appear like: 

{
“standing”: “SYNCED”,
“web page”: 1,
“page_size”: 100,
“cursor”: “eyJhbGciOiJIUzI1Ni//…”,
“consequence”: [
{
“amount”: “1”,
“token_id”: “5021”,
“token_address”: “0xfff54e6fe44fd47c8814c4b1d62c924c54364ad3”,
“contract_type”: “ERC721”,
“owner_of”: “0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e”,
“last_metadata_sync”: “2024-04-09T11:27:46.910Z”,
“last_token_uri_sync”: “2024-04-09T11:27:46.896Z”,
“metadata”: null,
“block_number”: “14647390”,
“block_number_minted”: “14647390”,
“name”: “Youtopia”,
“symbol”: “Youtopia”,
“token_hash”: “d4719eaf84eabcf443065b0a463f5886”,
“token_uri”: “http://api.youtopia-official.xyz/ipfs/5021”,
“minter_address”: “0x13f11fd2c7c7be94674651386370d02b7aac9653”,
“verified_collection”: false,
“possible_spam”: true,
“collection_logo”: “”,
“collection_banner_image”: “”
},
//…
]
}

Please take a look at our NFT API web page to study extra about this interface! 

Blockchain API 

The Blockchain API permits you to unlock the facility of uncooked blockchain knowledge with tempo and precision. It’s scalable, exact, and cross-chain, supplying you with what you could construct every thing from block explorers to analytics instruments! 

Blockchain API title

With the Blockchain API, you’ll be able to seamlessly fetch block knowledge, transactions, good contract logs, and extra with single traces of code. To indicate you the way it works, let’s have a look at our getBlock() endpoint, permitting you to fetch the contents of any given block: 

import Moralis from ‘moralis’;

strive {
await Moralis.begin({
apiKey: “YOUR_API_KEY”
});

const response = await Moralis.EvmApi.block.getBlock({
“chain”: “0x1”,
“blockNumberOrHash”: “18541416”
});

console.log(response.uncooked);
} catch (e) {
console.error(e);
}

In return for calling the endpoint above, you’ll get the block’s hash, miner deal with, fuel restrict, and extra. Right here’s an instance of what the response will appear like: 

{
“timestamp”: “2023-11-10T12:02:11.000Z”,
“quantity”: “18541416”,
“hash”: “0xe9de65582d5a210f3f5703e0d7dc1daf9fbb5a0670937f5d92283a41ea1bcb2b”,
“parent_hash”: “0xb63af7df0e2639cc25c323f22359b784408a117b534dea09cfec14263ea8d4fb”,
“nonce”: “0x0000000000000000”,
“sha3_uncles”: “0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347”,
“logs_bloom”: “0x00200000410//…”,
“transactions_root”: “0x0b6895fbd7fdf9b8e0239e5be21a195c89ffae093c1c2bcdea9ad498d720003b”,
“state_root”: “0x787cc0fff225d2b6d8acef1cea33522293d134297c1f4b22819a90f157db183d”,
“receipts_root”: “0x6d7caa30f12937a232dcedda5f8bc2c973ba917a67062cedeb4ccb52c729058c”,
“miner”: “0x95222290DD7278Aa3Ddd389Cc1E1d165CC4BAfe5”,
“issue”: “0”,
“total_difficulty”: “58750003716598352816469”,
“measurement”: “7792”,
“extra_data”: “0x6265617665726275696c642e6f7267”,
“gas_limit”: “30000000”,
“gas_used”: “1372772”,
“transaction_count”: “11”,
“base_fee_per_gas”: “35229184857”,
“transactions”: [
//…
]
}

Try our Blockchain API web page to study extra about this premier interface! 

Abstract: How one can Get All Homeowners of an ERC20 Token

From a traditional perspective, fetching the house owners of an ERC20 token has been an annoying activity. It sometimes requires manually monitoring possession and transactions throughout the blockchain, which is each tedious and time-consuming. Luckily, it’s now attainable to avoid this solely with Moralis’ ERC20 Homeowners endpoint! 

With our ERC20 Homeowners endpoint, now you can get sorted holders of a token with a single API name. Along with the house owners, you additionally get possession percentages, the USD worth of particular person holdings, and way more throughout the identical response. And with this premier characteristic, we’re lowering the limitations to complicated knowledge analytics, making token possession knowledge extra accessible to everybody! 

Moralis' "M" logo in neon blue color

If you happen to favored this tutorial on the best way to get all house owners of an ERC20 token, take into account studying extra content material right here at Moralis. As an example, take a look at our most up-to-date article on the perfect crypto emblem API or learn to get the online value of any ERC20 pockets. 

Additionally, don’t overlook that you may join with Moralis freed from cost. So, take this chance to supercharge your Web3 initiatives with streamlined knowledge integration from Moralis! 



Source link

Tags: ERC20MoralisOwnersTokenweb3
Previous Post

Uniswap Labs Receives SEC Wells Notice, Founder Vows to Fight

Next Post

SEC issues Wells notice against Uniswap over securities laws issues

Related Posts

Futures Traders Flock to Ethereum as ETF Investors Rotate to Bitcoin
Web3

Futures Traders Flock to Ethereum as ETF Investors Rotate to Bitcoin

10 hours ago
AI agents can now pay APIs with USDC in 200 ms as Coinbase activates x402 Bazaar
Web3

AI agents can now pay APIs with USDC in 200 ms as Coinbase activates x402 Bazaar

1 day ago
QMMM Stock Skyrockets Nearly 1,750% on Bitcoin, Ethereum, Solana Treasury Plan
Web3

QMMM Stock Skyrockets Nearly 1,750% on Bitcoin, Ethereum, Solana Treasury Plan

2 days ago
Strategy Buys 7 Million More In Bitcoin After S&P 500 Snub
Web3

Strategy Buys $217 Million More In Bitcoin After S&P 500 Snub

3 days ago
Wall Street’s Needs Will Advance Ethereum’s Privacy, Says Etherealize
Web3

Wall Street’s Needs Will Advance Ethereum’s Privacy, Says Etherealize

5 days ago
Robinhood Set to Join S&P 500 as Bitcoin Giant Strategy Misses Out
Web3

Robinhood Set to Join S&P 500 as Bitcoin Giant Strategy Misses Out

6 days ago
Next Post
SEC issues Wells notice against Uniswap over securities laws issues

SEC issues Wells notice against Uniswap over securities laws issues

SNXweave Weekly Recap 133

SNXweave Weekly Recap 133

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

[ccpw id="587"]
  • Disclaimer
  • Cookie Privacy Policy
  • Privacy Policy
  • DMCA
  • Terms and Conditions
  • Contact us
Contact us for business inquiries: cs@ajoobz.com

Copyright © 2023 Ajoobz.
Ajoobz is not responsible for the content of external sites.

No Result
View All Result
  • Home
  • Bitcoin
  • Crypto Updates
    • Crypto Updates
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • DeFi
  • Web3
  • Metaverse
  • Scam Alert
  • Regulations
  • Analysis

Copyright © 2023 Ajoobz.
Ajoobz is not responsible for the content of external sites.

Welcome Back!

Login to your account below

Forgotten Password?

Retrieve your password

Please enter your username or email address to reset your password.

Log In