Tuesday, July 29, 2025
No Result
View All Result
Coin Digest Daily
  • Home
  • Bitcoin
  • Crypto Updates
    • General
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • Metaverse
  • Web3
  • DeFi
  • Analysis
  • Scam Alert
  • Regulations
Marketcap
  • Home
  • Bitcoin
  • Crypto Updates
    • General
    • Altcoin
    • Ethereum
    • Crypto Exchanges
  • Blockchain
  • NFT
  • Metaverse
  • Web3
  • DeFi
  • Analysis
  • Scam Alert
  • Regulations
No Result
View All Result
Coin Digest Daily
No Result
View All Result

How to Get ERC-20 Token Balances with RPC Nodes – Moralis for Developers | Enterprise-Grade Web3 APIs

23 September 2024
in Web3
Reading Time: 18 mins read
0 0
A A
0
Home Web3
Share on FacebookShare on Twitter


Uncover the simplest approach to get ERC-20 token balances utilizing RPC nodes. Moralis’ Prolonged RPC Strategies can help you seamlessly fetch any pockets’s token balances with a single RPC-style request. Curious to see the way it works? Try the eth_getTokenBalances endpoint in motion:

import fetch from ‘node-fetch’;

const choices = {
methodology: ‘POST’,
headers: {
settle for: ‘software/json’,
‘content-type’: ‘software/json’
},
physique: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“methodology”: “eth_getTokenBalances”,
“params”: [
{
“address”: “0xcB1C1FdE09f811B294172696404e88E658659905”,
}
]
})
};

fetch(‘YOUR_NODE_URL’, choices)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

With one name, you’ll obtain the ERC-20 stability of the desired pockets. Right here’s a pattern response:

{
//…
outcome: [
{
token_address: ‘0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2’,
name: ‘Wrapped Ether’,
symbol: ‘WETH’,
decimals: 18,
logo: ‘https://logo.developers.moralis.com/0x1_0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_a578c5277503e547a072ae32517254ca’,
thumbnail: ‘https://logo.developers.moralis.com/0x1_0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_a578c5277503e547a072ae32517254ca’,
balance: ‘10000000000000000’,
possible_spam: false,
verified_contract: true,
total_supply: ‘2746607222348759943423350’,
total_supply_formatted: ‘2746607.22234875994342335’,
percentage_relative_to_total_supply: 3.64085549569e-7
},
//…
]
}

That’s all it takes – fetching ERC-20 token balances with RPC nodes has by no means been simpler. For a deeper dive, be part of us on this detailed tutorial or try our official Prolonged RPC Strategies documentation.

Able to get began? Enroll with Moralis, and also you’ll be capable of get ERC-20 token balances with RPC nodes in a heartbeat!

Overview

Whether or not you’re constructing a portfolio tracker, cryptocurrency pockets, tax platform, or different Web3 tasks, you’ll possible want entry to ERC-20 token balances. Historically, fetching these balances utilizing RPC nodes has been cumbersome, requiring a number of requests and guide placing collectively knowledge. However there’s a greater method: Moralis’ Prolonged RPC Strategies.

With our Prolonged RPC Strategies, you may simply question decoded, human-readable knowledge by means of RPC-style requests. Immediately entry ERC-20 token balances, decoded transactions, token costs, and extra with minimal effort.

Curious the way it works? On this tutorial, we’ll present you use Moralis to get ERC-20 token balances by way of RPC nodes. Let’s dive in!

What are ERC-20 Token Balances?

Put merely, ERC-20 token balances seek advice from the variety of tokens held by a particular pockets or deal with. Since varied kinds of ERC-20 tokens exist, a pockets can maintain a number of token balances concurrently. For instance, a consumer may need 5 Wrapped BTC, 100 USDC, and 1,000,000 Shiba Inu tokens.

Text: "What are ERC-20 Token Balances?"

Why are ERC-20 token balances necessary for builders?

ERC-20 token balances are important for a lot of Web3 purposes. Listed below are three key examples:

Wallets: Cryptocurrency wallets must retrieve and show ERC-20 token balances so customers can see which tokens they personal and in what quantities.

Portfolio Trackers: Portfolio trackers depend on ERC-20 token balances to precisely monitor customers’ property, monitor worth modifications, and replace customers on their total portfolio efficiency.

Tax Platforms: To generate exact tax experiences, tax platforms should entry the ERC-20 token balances of their customers.

These are only a few examples; ERC-20 token balances are needed for many Web3 dapps!

Introducing Prolonged RPC Strategies – The Best Technique to Get ERC-20 Token Balances with RPC Nodes 

Moralis’ Prolonged RPC Strategies streamline the method of querying decoded, human-readable knowledge utilizing RPC nodes, making dapp improvement extra accessible.

Moralis' Extended RPC Methods.

Key knowledge you may entry:

eth_getTokenBalances: Retrieve ERC-20 token balances by pockets.

eth_getTransactions: Fetch native transactions by pockets deal with.

eth_getDecodedTransactions: Entry detailed pockets transaction historical past by deal with.

eth_getTokenPrice: Get costs by token addresses.

eth_getTokenMetadata: Receive ERC-20 metadata by token deal with.

eth_getNFTBalances: Retrieve NFTs by pockets deal with.

eth_getNFTCollections: Entry NFT collections by pockets.

In essence, our Prolonged RPC Strategies make it simple so that you can question and combine decoded, human-readable crypto knowledge into your dapps!

Why Do You Want Prolonged RPC Strategies?

Querying on-chain knowledge utilizing typical RPC strategies will be cumbersome. These strategies aren’t optimized for frequent queries like, “What ERC-20 tokens does pockets X maintain?” To get this info, you usually must make a number of requests and manually compile the information, which is time-consuming and resource-intensive. Fortuitously, that’s the place Moralis’ Prolonged RPC Strategies are available.

Our Prolonged RPC Strategies allow you to simply get ERC-20 token balances, pockets historical past, NFT balances, and extra by means of easy RPC-style requests, making fetching crypto knowledge by way of nodes extra environment friendly than ever.

Need to see the way it works? Try the tutorial beneath to discover ways to use our Prolonged RPC Strategies to get ERC-20 token balances!

3-Step Tutorial: How one can Get ERC-20 Token Balances with RPC Nodes

We’ll now present you seamlessly get ERC-20 token balances utilizing RPC nodes. Because of the accessibility of our Prolonged RPC Strategies, you may get hold of this knowledge in three easy steps:

Enroll with Moralis & create a node.

Write a script calling the eth_getTokenBalances endpoint.

Run the code.

Nevertheless, earlier than you may start, you have to deal with a number of conditions.

Conditions

Earlier than beginning the tutorial, guarantee you’ve the next prepared:

Step 1: Signal Up with Moralis & Create a Node

Click on the “Begin for Free” button on the high proper to arrange your Moralis account:

Red arrow pointing at "Start for Free" button on Moralis.io.

From there, log in, go to the “Nodes” tab, and click on “+ Create Node”:

Red arrows pointing at "Nodes" tab and "+ Create Node" button.

Subsequent, choose “Ethereum,” adopted by “Mainnet,” and click on the “Create Node” button:

Showing configurations for Ethereum mainnet node.

It will offer you two node URLs. Copy and save one of many URLs, as you’ll want it within the subsequent part:

Red arrows pointing at copy button for Ethereum RPC nodes.

Step 2: Write a Script Calling the eth_getTokenBalances Endpoint

Begin by opening Visible Studio Code or your most well-liked IDE, then arrange a brand new folder and initialize a challenge utilizing the terminal command offered:

npm init

After that, set up the required dependencies utilizing the given command:

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

In your “bundle.json” file, you’ll want to add “kind”: ”module”:

type: module highlighted in code editor.

Subsequent, create a brand new “index.js” file and insert the offered code:

import fetch from ‘node-fetch’;

const choices = {
methodology: ‘POST’,
headers: {
settle for: ‘software/json’,
‘content-type’: ‘software/json’
},
physique: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“methodology”: “eth_getTokenBalances”,
“params”: [
{
“address”: “0xcB1C1FdE09f811B294172696404e88E658659905”,
}
]
})
};

fetch(‘YOUR_NODE_URL’, choices)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

Exchange YOUR_NODE_URL with the node URL you copied earlier, and regulate the deal with parameter as wanted to suit your question:

Red arrows pointing at address and YOUR_NODE_URL in code editor.

That’s it. From right here, you simply must run the code.

Step 3: Run the Code

Open a brand new terminal and run the offered command in your challenge’s root folder:

node index.js

In return, you’ll get the ERC-20 token balances of the desired pockets utilizing your RPC node. Right here’s an instance of what it’d seem like:

{
//…
outcome: [
{
token_address: ‘0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2’,
name: ‘Wrapped Ether’,
symbol: ‘WETH’,
decimals: 18,
logo: ‘https://logo.developers.moralis.com/0x1_0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_a578c5277503e547a072ae32517254ca’,
thumbnail: ‘https://logo.developers.moralis.com/0x1_0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_a578c5277503e547a072ae32517254ca’,
balance: ‘10000000000000000’,
possible_spam: false,
verified_contract: true,
total_supply: ‘2746607222348759943423350’,
total_supply_formatted: ‘2746607.22234875994342335’,
percentage_relative_to_total_supply: 3.64085549569e-7
},
//…
]
}

And that’s it! It’s that simple to get ERC-20 token balances from RPC nodes utilizing Moralis!

To be taught extra about how this works, please try the eth_getTokenBalances documentation web page. 

Additionally, wish to see how you should utilize this knowledge in apply? Try the Moralis YouTube video beneath, the place considered one of our builders reveals you construct a portfolio app utilizing simply the eth_getTokenBalances endpoint:

Past How one can Get ERC-20 Token Balances with RPC Nodes – Exploring Different Prolonged RPC Strategies

Fetching ERC-20 token balances with nodes is only one facet of our Prolonged RPC Strategies. Within the following sections, we’ll discover 5 different strategies and spotlight the responses you get from them:

eth_getDecodedTransactions

eth_getTokenPrice

eth_getTokenMetadata

eth_getNFTBalances

eth_getNFTCollections

So, with out additional ado, let’s take a more in-depth take a look at eth_getDecodedTransactions!

eth_getDecodedTransactions

With eth_getDecodedTransactions, you may seamlessly fetch the transaction historical past of a particular pockets deal with, enriched with decoded knowledge. Furthermore, this methodology encompasses native transfers, ERC-20 transactions, NFT transfers, and extra.

Right here’s an instance of name this premier methodology:

import fetch from ‘node-fetch’;

const choices = {
methodology: ‘POST’,
headers: {
settle for: ‘software/json’,
‘content-type’: ‘software/json’
},
physique: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“methodology”: “eth_getDecodedTransactions”,
“params”: [
{
“address”: “0xda74Ac6b69Ff4f1B6796cdDf61fBDd4A5f68525f”,
}
]
})
};

fetch(‘YOUR_NODE_URL’, choices)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

In return for calling the script above, you’ll obtain the total transaction historical past of the pockets. Moreover, every transaction is enriched with a human-readable occasion abstract, class tag, logos, addresses, and extra. Right here’s an instance of what it’d seem like:

{
//…
“outcome”: [
{
“block_hash”: “0x660274d577cd20b0b82c1bff5f3c5641ba6027544e005f9256d5add9c7447920”,
“block_number”: “19868695”,
“block_timestamp”: “2024-05-14T14:00:23.000Z”,
“from_address”: “0xda74ac6b69ff4f1b6796cddf61fbdd4a5f68525f”,
“from_address_label”: null,
“from_address_entity”: null,
“from_address_entity_logo”: null,
“to_address”: “0xdac17f958d2ee523a2206206994597c13d831ec7”,
“to_address_label”: “Tether USD (USDT)”,
“to_address_entity”: null,
“to_address_entity_logo”: null,
“gas”: “55331”,
“gas_price”: “13623172301”,
“hash”: “0xc565260238f59fc3f35b74f3011375c7d637db9b075f77d342c30d19f946272e”,
“nonce”: “14”,
“receipt_cumulative_gas_used”: “13917979”,
“receipt_gas_used”: “41309”,
“receipt_status”: “1”,
“transaction_fee”: “0.000562759624582009”,
“transaction_index”: “75”,
“value”: “0”,
“receipt_contract_address”: null,
“nft_transfers”: [],
“erc20_transfers”: [
{
“token_name”: “Tether USD”,
“token_symbol”: “USDT”,
“token_logo”: “https://logo.developers.moralis.com/0x1_0xdac17f958d2ee523a2206206994597c13d831ec7_3282f332c2ac2948929f01fe7d921c51”,
“token_decimals”: “6”,
“from_address”: “0xda74ac6b69ff4f1b6796cddf61fbdd4a5f68525f”,
“from_address_entity”: null,
“from_address_entity_logo”: null,
“from_address_label”: null,
“to_address”: “0x28c6c06298d514db089934071355e5743bf21d60”,
“to_address_label”: “Binance 14”,
“to_address_entity”: “Binance”,
“to_address_entity_logo”: “https://entities-logos.s3.us-east-1.amazonaws.com/binance.png”,
“address”: “0xdac17f958d2ee523a2206206994597c13d831ec7”,
“log_index”: 338,
“value”: “50000000000”,
“possible_spam”: false,
“verified_contract”: true,
“direction”: “send”,
“value_formatted”: “50000”
}
],
“method_label”: “switch”,
“native_transfers”: [],
“abstract”: “Despatched 50,000 USDT to Binance 14”,
“possible_spam”: false,
“class”: “token ship”
},
//…
}
]
}

eth_getTokenPrice

With eth_getTokenPrice, now you can seamlessly fetch token costs primarily based on contract addresses utilizing RPC-style strategies. You possibly can retrieve costs for stablecoins like USDT, meme cash like Shiba Inu, and every little thing in between.

Right here’s an instance of what it seems to be like when calling the endpoint:

import fetch from ‘node-fetch’;

const choices = {
methodology: ‘POST’,
headers: {
settle for: ‘software/json’,
‘content-type’: ‘software/json’
},
physique: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“methodology”: “eth_getTokenPrice”,
“params”: [
{
“address”: “0xdAC17F958D2ee523a2206206994597C13D831ec7”,
“include”: “percent_change”
}
]
})
};

fetch(YOUR_NODE_URL, choices)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

In return for operating the script above, you obtain each the USD and native worth of the desired token. Moreover, the response is enriched with worth modifications over time, a token brand, token decimals, and extra. Right here’s an instance of what the response seems to be like:

{
//…
outcome: {
tokenName: ‘Tether USD’,
tokenSymbol: ‘USDT’,
tokenLogo: ‘https://brand.builders.moralis.com/0x1_0xdac17f958d2ee523a2206206994597c13d831ec7_3282f332c2ac2948929f01fe7d921c51’,
tokenDecimals: ‘6’,
nativePrice: {
worth: ‘375760131462618’,
decimals: 18,
title: ‘Ether’,
image: ‘ETH’,
deal with: ‘0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2’
},
usdPrice: 1.0000402502911871,
usdPriceFormatted: ‘1.000040250291187229’,
’24hrPercentChange’: ‘-0.04543241491797881’,
exchangeName: ‘Uniswap v3’,
exchangeAddress: ‘0x1F98431c8aD98523631AE4a59f267346ea31F984’,
tokenAddress: ‘0xdac17f958d2ee523a2206206994597c13d831ec7’,
priceLastChangedAtBlock: ‘20534105’,
possibleSpam: false,
verifiedContract: true,
pairAddress: ‘0xc7bbec68d12a0d1830360f8ec58fa599ba1b0e9b’,
pairTotalLiquidityUsd: ‘7148031.13’
}
}

eth_getTokenMetadata

With eth_getTokenMetadata, you may seamlessly fetch the metadata of an ERC-20 token. Furthermore, this endpoint covers every little thing from meme cash like Shiba Inu to stablecoins like USDC. 

Right here’s an instance of the endpoint in motion: 

import fetch from ‘node-fetch’;

const choices = {
methodology: ‘POST’,
headers: {
settle for: ‘software/json’,
‘content-type’: ‘software/json’
},
physique: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“methodology”: “eth_getTokenMetadata”,
“params”: [
{
“addresses”: [
“0xdac17f958d2ee523a2206206994597c13d831ec7”
]
}
]
})
};

fetch(‘YOUR_NODE_URL’, choices)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

In return for calling the endpoint above, you get the metadata of the desired token. It will embody the token title, image, decimals, logos, complete provide, and far more. Right here’s a pattern response: 

{
//…
outcome: [
{
address: ‘0xdac17f958d2ee523a2206206994597c13d831ec7’,
address_label: ‘Tether USD (USDT)’,
name: ‘Tether USD’,
symbol: ‘USDT’,
decimals: ‘6’,
logo: ‘https://logo.developers.moralis.com/0x1_0xdac17f958d2ee523a2206206994597c13d831ec7_3282f332c2ac2948929f01fe7d921c51’,
logo_hash: ‘ee7aa2cdf100649a3521a082116258e862e6971261a39b5cd4e4354fcccbc54d’,
thumbnail: ‘https://logo.developers.moralis.com/0x1_0xdac17f958d2ee523a2206206994597c13d831ec7_3282f332c2ac2948929f01fe7d921c51’,
total_supply: ‘51986637760874451’,
total_supply_formatted: ‘51986637760.874451’,
fully_diluted_valuation: ‘51930247101.87’,
block_number: ‘20519335’,
validated: 1,
created_at: ‘2017-11-28T00:41:21.000Z’,
possible_spam: false,
verified_contract: true,
categories: [
‘Asset-backed Tokens’,
‘Exchange-Issued Asset Tokens’,
‘Platform-Based Utility Tokens’,
‘Stablecoins’
],
hyperlinks: {
twitter: ‘https://twitter.com/Tether_to’,
web site: ‘https://tether.to/’,
fb: ‘https://www.fb.com/tether.to’,
reddit: ‘https://www.reddit.com’
}
}
]
}

eth_getNFTBalances

Utilizing eth_geNFTBalances, you may effortlessly retrieve a listing of NFTs owned by a particular pockets deal with.

Right here’s an instance script exhibiting name this endpoint:

import fetch from ‘node-fetch’;

const choices = {
methodology: ‘POST’,
headers: {
settle for: ‘software/json’,
‘content-type’: ‘software/json’
},
physique: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“methodology”: “eth_getNFTBalances”,
“params”: [
{
“address”: “0x3F22FC93143790a1bd11C37C65a0a0f7e7875eA2”,
“limit”: 10,
}
]
})
};

fetch(‘YOUR_NODE_URL’, choices)
.then(response => response.json())
.then(response => console.log(response.outcome, null, 2))
.catch(err => console.error(err));

In return, you’ll get a listing of all NFTs owned by the desired deal with. Furthermore, every object is enriched with token addresses, intensive metadata, spam indicators, assortment logos, and extra. Right here’s an instance of what it’d seem like:

{
//…
outcome: [
{
amount: ‘1’,
token_id: ‘8545’,
token_address: ‘0xbd3531da5cf5857e7cfaa92426877b022e612cf8’,
contract_type: ‘ERC721’,
owner_of: ‘0x3f22fc93143790a1bd11c37c65a0a0f7e7875ea2’,
last_metadata_sync: ‘2024-08-14T19:47:37.128Z’,
last_token_uri_sync: ‘2024-08-14T19:47:32.019Z’,
metadata: ‘{“attributes”:[{“trait_type”:”Background”,”value”:”Red”},{“trait_type”:”Skin”,”value”:”Normal”},{“trait_type”:”Body”,”value”:”Shirt Red”},{“trait_type”:”Face”,”value”:”Beard”},{“trait_type”:”Head”,”value”:”Mohawk Green”}],”description”:”A set 8888 Cute Chubby Pudgy Penquins sliding round on the freezing ETH blockchain.”,”picture”:”ipfs://QmNf1UsmdGaMbpatQ6toXSkzDpizaGmC9zfunCyoz1enD5/penguin/8545.png”,”title”:”Pudgy Penguin #8545″}’,
block_number: ‘18777311’,
block_number_minted: null,
title: ‘PudgyPenguins’,
image: ‘PPG’,
token_hash: ‘5e8faae3c07cd3bdb8bfa817e5a14a1b’,
token_uri: ‘https://ipfs.builders.moralis.com:2053/ipfs/bafybeibc5sgo2plmjkq2tzmhrn54bk3crhnc23zd2msg4ea7a4pxrkgfna/8545’,
minter_address: null,
verified_collection: true,
possible_spam: false,
collection_logo: ‘https://i.seadn.io/gae/yNi-XdGxsgQCPpqSio4o31ygAV6wURdIdInWRcFIl46UjUQ1eV7BEndGe8L661OoG-clRi7EgInLX4LPu9Jfw4fq0bnVYHqg7RFi?w=500&auto=format’,
collection_banner_image: ‘https://i.seadn.io/gcs/information/8a26e3de0f309089cbb1e5ab969fc0bc.png?w=500&auto=format’
},
//…
]
}
}

eth_getNFTCollections

Get a listing of all of the NFT collections owned by a particular pockets, together with assortment particulars and metadata. 

Right here’s the endpoint in motion: 

import fetch from ‘node-fetch’;

const choices = {
methodology: ‘POST’,
headers: {
settle for: ‘software/json’,
‘content-type’: ‘software/json’
},
physique: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“methodology”: “eth_getNFTCollections”,
“params”: [
{
“address”: “0x3F22FC93143790a1bd11C37C65a0a0f7e7875eA2”,
“limit”: 10
}
]
})
};

fetch(‘YOUR_NODE_URL’, choices)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

Calling the endpoint above gives an array of all collections owned by the desired pockets. Every object is enriched with knowledge, together with a reputation, assortment brand, assortment banner, spam indicators, and extra. Right here’s an instance of what it’d seem like: 

{
//…
outcome: [
{
token_address: ‘0xbd3531da5cf5857e7cfaa92426877b022e612cf8’,
possible_spam: false,
contract_type: ‘ERC721’,
name: ‘PudgyPenguins’,
symbol: ‘PPG’,
verified_collection: true,
collection_logo: ‘https://i.seadn.io/gae/yNi-XdGxsgQCPpqSio4o31ygAV6wURdIdInWRcFIl46UjUQ1eV7BEndGe8L661OoG-clRi7EgInLX4LPu9Jfw4fq0bnVYHqg7RFi?w=500&auto=format’,
collection_banner_image: ‘https://i.seadn.io/gcs/files/8a26e3de0f309089cbb1e5ab969fc0bc.png?w=500&auto=format’
},
//…
]
}
}

Moralis Overview – Exploring RPC Nodes & Web3 APIs

Moralis stands out because the trade’s #1 crypto knowledge supplier. Our suite of improvement instruments contains top-tier RPC nodes and a number of other use case-specific APIs, such because the Pockets API, Token API, Streams API, and extra. With Moralis, you get all crypto knowledge in a single place.

Moralis logo.

What makes Moralis distinctive?

One Name – All of the Information: Our APIs and Prolonged RPC Strategies are designed with the end result in thoughts, supplying you with extra knowledge with fewer calls. Fetch ERC-20 token balances, a pockets’s full historical past, token costs, and extra with single requests.

Multi-Chain Assist: Our nodes and Web3 APIs assist all main chains, together with Ethereum, Polygon, BSC, Optimism, Base, and others. Get pleasure from full characteristic parity throughout our supported networks, so that you solely want one knowledge supplier for all chains.

Enterprise-grade Safety: Moralis is SOC 2 Kind 2 licensed, demonstrating our dedication to safety and reliability.

Let’s dive deeper into our merchandise to focus on the advantages of Moralis!

RPC Nodes

Moralis is a number one node supplier, supporting over 30 blockchains, together with Ethereum, Base, and Polygon. With our user-friendly interface, you may effortlessly combine nodes into your tasks on the click on of some buttons. 

Text: "Ultimate RPC Nodes for Web3"

What units our nodes aside?

Pace: Business-leading response instances as little as 70 ms.

Reliability: 99.9% uptime, making certain fixed knowledge availability.

Safety: SOC 2 Kind 2 licensed for enterprise-grade safety.

Uncover extra on our RPC nodes web page!

Web3 APIs 

Moralis’ Web3 API suite consists of a number of distinguished interfaces. Listed below are 5 of them:

Moralis logo.

Pockets API: A number one device for constructing wallets and integrating pockets performance into dapps. Retrieve any pockets’s historical past, token balances, web value, profitability, and extra with single strains of code.

Token API: Entry ERC-20 knowledge with the Token API. Get balances, costs, metadata, and extra.

NFT API: Superb for constructing NFT marketplaces, Web3 video games, and different NFT-related platforms. Fetch NFT balances, metadata, costs, and extra with minimal code.

Worth API: Get real-time ERC-20 costs, NFT flooring costs, OHLCV costs, and extra. Combine worth knowledge seamlessly into your tasks.

Streams API: Arrange Web3 knowledge pipelines for customized occasions with only a few clicks. Excellent for real-time alerts, populating databases with present occasions, and incorporating dwell insights into your tasks.

To be taught extra about our interfaces, go to our Web3 API web page!

Abstract: How one can Get ERC-20 Token Balances with RPC Nodes

It doesn’t matter for those who’re constructing a Web3 pockets, portfolio tracker, tax device, or different related platforms – likelihood is, you want entry to the ERC-20 token balances of your customers. Nevertheless, querying ERC-20 token balances from RPC nodes has historically been a bothersome and time-consuming endeavor. Doing so requires many requests utilizing strategies like eth_getBalance and necessitates stitching collectively a number of knowledge your self. Fortuitously, there’s now a extra streamlined different: Moralis’ Prolonged RPC Strategies.

Wallet surrounded by coins.

Our Prolonged RPC Strategies make it doable to question decoded and enriched knowledge seamlessly utilizing RPC-style requests. With this characteristic, you solely want a single name to get ERC-20 token balances, transaction histories, token costs, and extra utilizing RPC nodes.

To spotlight the accessibility of our Prolonged RPC Strategies, right here’s the eth_getTokenBalances endpoint in motion:

import fetch from ‘node-fetch’;

const choices = {
methodology: ‘POST’,
headers: {
settle for: ‘software/json’,
‘content-type’: ‘software/json’
},
physique: JSON.stringify({
“jsonrpc”: “2.0”,
“id”: 1,
“methodology”: “eth_getTokenBalances”,
“params”: [
{
“address”: “0xcB1C1FdE09f811B294172696404e88E658659905”,
}
]
})
};

fetch(‘YOUR_NODE_URL’, choices)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));

In return for calling the script above, you’ll get the ERC-20 token balances of the desired deal with, enriched with token logos, spam indicators, and far more. Right here’s a pattern response:

{
//…
outcome: [
{
token_address: ‘0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2’,
name: ‘Wrapped Ether’,
symbol: ‘WETH’,
decimals: 18,
logo: ‘https://logo.developers.moralis.com/0x1_0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_a578c5277503e547a072ae32517254ca’,
thumbnail: ‘https://logo.developers.moralis.com/0x1_0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_a578c5277503e547a072ae32517254ca’,
balance: ‘10000000000000000’,
possible_spam: false,
verified_contract: true,
total_supply: ‘2746607222348759943423350’,
total_supply_formatted: ‘2746607.22234875994342335’,
percentage_relative_to_total_supply: 3.64085549569e-7
},
//…
]
}

That’s it! Fetching ERC-20 token balances with RPC nodes doesn’t should be more difficult than this when utilizing Moralis.

In case you appreciated this tutorial on get ERC-20 token balances with RPC nodes, think about trying out extra Moralis content material. For example, discover ways to get DeFi protocol knowledge or dive into our Alchemy Customized Webhooks information.

Lastly, if you wish to get ERC-20 token balances with RPC nodes your self, don’t overlook to enroll with Moralis. You possibly can create an account freed from cost and get fast entry to all our premier improvement instruments!





Source link

Tags: APIsBalancesDevelopersEnterpriseGradeERC20MoralisNodesRPCtokenWeb3
Previous Post

Tron Price Outshines Bitcoin: Can TRX Keep Momentum and Rise?

Next Post

Blockchain: The Backbone of Web3

Related Posts

Ethereum Treasury Companies Could Buy 10% of All ETH: Standard Chartered – Decrypt
Web3

Ethereum Treasury Companies Could Buy 10% of All ETH: Standard Chartered – Decrypt

29 July 2025
Billionaire Ray Dalio Urges Investors to Allocate 15% of Portfolios to Gold and Bitcoin – Decrypt
Web3

Billionaire Ray Dalio Urges Investors to Allocate 15% of Portfolios to Gold and Bitcoin – Decrypt

28 July 2025
Binance launches RWUSD yield bearing stablecoin-like product offering 4.2% APR from RWAs
Web3

Binance launches RWUSD yield bearing stablecoin-like product offering 4.2% APR from RWAs

28 July 2025
This Fake Bitcoin ATM Scheme Has Wasted 4,000 Hours of Scammers’ Time – Decrypt
Web3

This Fake Bitcoin ATM Scheme Has Wasted 4,000 Hours of Scammers’ Time – Decrypt

27 July 2025
This single point of failure can kill web3’s dream of an open, decentralized internet
Web3

This single point of failure can kill web3’s dream of an open, decentralized internet

26 July 2025
Blockchain won’t win until it outruns TradFi
Web3

Blockchain won’t win until it outruns TradFi

27 July 2025
Next Post
Blockchain: The Backbone of Web3

Blockchain: The Backbone of Web3

Pro-Crypto Fairshake PAC Funds Democrats in Key Senate Races – News Bytes Bitcoin News

Pro-Crypto Fairshake PAC Funds Democrats in Key Senate Races – News Bytes Bitcoin News

Leave a Reply Cancel reply

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

  • Trending
  • Comments
  • Latest
BNB Price Gears Up for Upside Break — Will Bulls Deliver?

BNB Price Gears Up for Upside Break — Will Bulls Deliver?

8 July 2025
Something Big Is Coming For XRP On July 9—Why It Matters

Something Big Is Coming For XRP On July 9—Why It Matters

8 July 2025
XRP could rally higher on steady capital inflow; check forecast

XRP could rally higher on steady capital inflow; check forecast

8 July 2025
10 Most Popular Bitcoin Mining Apps for Android & iOS in 2025 | Earn Crypto Fast

10 Most Popular Bitcoin Mining Apps for Android & iOS in 2025 | Earn Crypto Fast

24 May 2025
Ethereum Price Drops After Bullish Attempt — Support Area Under Pressure

Ethereum Price Drops After Bullish Attempt — Support Area Under Pressure

2 July 2025
Live Best Meme Coins Updates Today: TOKEN6900 Presale Begins with Promises of 1000x, SEC Approves First-Ever ETF with Bitcoin, Ethereum, XRP, and More…

Live Best Meme Coins Updates Today: TOKEN6900 Presale Begins with Promises of 1000x, SEC Approves First-Ever ETF with Bitcoin, Ethereum, XRP, and More…

2 July 2025
What You Should Know Before Investing in Tokenized Assets | eToro

What You Should Know Before Investing in Tokenized Assets | eToro

29 July 2025
XRP to Replace the US Dollar? Wild Prediction Could Hype Bitcoin Hyper

XRP to Replace the US Dollar? Wild Prediction Could Hype Bitcoin Hyper

29 July 2025
Altcoins update: Dogecoin and Injective signal recoveries as Ethereum eyes $4,000 – CoinJournal

Altcoins update: Dogecoin and Injective signal recoveries as Ethereum eyes $4,000 – CoinJournal

29 July 2025
Ethereum Treasury Companies Could Buy 10% of All ETH: Standard Chartered – Decrypt

Ethereum Treasury Companies Could Buy 10% of All ETH: Standard Chartered – Decrypt

29 July 2025
Mento Selects Wormhole as its Official Interoperability Provider to Power Multichain FX – Press release Bitcoin News

Mento Selects Wormhole as its Official Interoperability Provider to Power Multichain FX – Press release Bitcoin News

29 July 2025
South Korea’s Political Heavyweights Square Off Over Stablecoin Bills

South Korea’s Political Heavyweights Square Off Over Stablecoin Bills

29 July 2025
Facebook Twitter Instagram Youtube RSS
Coin Digest Daily

Stay ahead in the world of cryptocurrencies with Coin Digest Daily. Your daily dose of insightful news, market trends, and expert analyses. Empowering you to make informed decisions in the ever-evolving blockchain space.

CATEGORIES

  • Altcoin
  • Analysis
  • Bitcoin
  • Blockchain
  • Crypto Exchanges
  • Crypto Updates
  • DeFi
  • Ethereum
  • Metaverse
  • NFT
  • Regulations
  • Scam Alert
  • Web3

SITEMAP

  • About us
  • Disclaimer
  • Privacy Policy
  • DMCA
  • Cookie Privacy Policy
  • Terms and Conditions
  • Contact us

Copyright © 2024 Coin Digest Daily.
Coin Digest Daily is not responsible for the content of external sites.

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

Copyright © 2024 Coin Digest Daily.
Coin Digest Daily 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
  • bitcoinBitcoin(BTC)$117,732.00-0.35%
  • ethereumEthereum(ETH)$3,778.45-0.58%
  • rippleXRP(XRP)$3.14-0.55%
  • tetherTether(USDT)$1.00-0.02%
  • binancecoinBNB(BNB)$806.12-3.28%
  • solanaSolana(SOL)$181.73-2.25%
  • usd-coinUSDC(USDC)$1.000.00%
  • staked-etherLido Staked Ether(STETH)$3,776.46-0.56%
  • dogecoinDogecoin(DOGE)$0.223100-2.94%
  • tronTRON(TRX)$0.3364114.21%