In right now’s tutorial, we’ll present you find out how to record all of the cash in an ETH deal with utilizing the Moralis Token API – the {industry}’s main device for ERC-20 knowledge. Because of the accessibility of the Token API, you may get all of the cash of any deal with with a single name to the getWalletTokenBalances() endpoint. Right here’s a bit of sneak peek of what the code would possibly appear like:
const Moralis = require(“moralis”).default;
const { EvmChain } = require(“@moralisweb3/common-evm-utils”);
const runApp = async () => {
await Moralis.begin({
apiKey: “YOUR_API_KEY”,
// …and some other configuration
});
const deal with = “0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d”;
const chain = EvmChain.ETHEREUM;
const response = await Moralis.EvmApi.token.getWalletTokenBalances({
deal with,
chain,
});
console.log(response.toJSON());
};
runApp();
You merely have so as to add your Moralis API key, configure deal with to suit your question and run the code. In return, you’ll get a response containing a listing of all of the cash from the required ETH deal with.
That’s it; it doesn’t should be tougher than that when working with Moralis. Nonetheless, if you need a extra detailed breakdown of the whole course of, be part of us on this tutorial or take a look at the Moralis documentation web page on find out how to get all tokens owned by an deal with!
Additionally, when you want to name the Token API your self, don’t overlook to enroll with Moralis. You’ll be able to arrange your account with out paying a dime, and also you’ll get instantaneous entry to all our industry-leading Web3 APIs!
Overview
We’ll kickstart right now’s article by diving into the ins and outs of ETH addresses. In doing so, we’ll cowl what they’re and what they’re used for. From there, we’ll soar straight into the tutorial and present you find out how to record all of the cash in an ETH deal with in three simple steps utilizing Moralis’ Token API:
Get a Moralis API KeyWrite a Script Calling the getWalletTokenBalances() EndpointRun the Code
From there, we’ll discover some outstanding use circumstances for itemizing all of the cash in an ETH deal with earlier than we prime issues off by diving deeper into Moralis!
Now, with out additional ado, let’s get going and discover the intricacies of ETH addresses!
What’s an ETH Deal with?
An ETH deal with is a 42-character lengthy, alphanumerical hex string serving as a singular and public identifier for an externally owned account (EOA) or sensible contract on the Ethereum blockchain. Such an deal with is usually used for sending, receiving, and storing digital belongings like fungible and non-fungible tokens (NFTs)!

There are two forms of ETH addresses, and we’ll briefly cowl each under:
Account Addresses: An account deal with – additionally generally known as a ”pockets deal with” or ”blockchain deal with” – corresponds to a public consumer account on the blockchain managed by a non-public key. Account addresses are used to ship, obtain, and retailer digital belongings, together with interacting with sensible contracts and dapps. Contract Addresses: Contract addresses are related to sensible contracts deployed on the blockchain. A contract deal with shouldn’t be managed by a person or entity like an account deal with however slightly represents the placement the place the sensible contract resides on the community.
All in all, ETH addresses are distinctive identifiers for Ethereum accounts and sensible contracts. Moreover, they’re generally used for sending, receiving, and storing digital belongings like fungible tokens and NFTs!
Since ETH addresses are public, we are able to use them to search for details about accounts and sensible contracts. This consists of issues reminiscent of token balances, which we’ll present you how one can fetch within the following part utilizing Moralis!
Full Tutorial: Checklist All of the Cash in An ETH Deal with
The best method to record all of the cash in an ETH deal with is to leverage Moralis’ Token API – the final word interface for real-time ERC-20 knowledge. In actual fact, due to the accessibility of this industry-leading device, you may get all the knowledge you want straight from the Ethereum blockchain in three easy steps:
Get a Moralis API KeyWrite a Script Calling the getWalletTokenBalances() EndpointRun the Code
Nonetheless, earlier than leaping into the preliminary step of this tutorial, you have to first deal with a few conditions!
Stipulations
Moralis’ Web3 APIs are appropriate with a number of programming languages, together with Python, TypeScript, and so forth. Nonetheless, for this tutorial, we’ll be sticking to JavaScript. As such, earlier than you proceed, please be sure you have the next prepared:
Step 1: Get a Moralis API Key
To name the Token API, you want a Moralis API key, which you may get totally free by signing up with Moralis. As such, when you haven’t already, click on on the ”Begin for Free” button on the prime proper of the Moralis homepage to create your account:

With an account at hand, choose a undertaking, go to the ”Settings” tab utilizing the navigation bar to the left, scroll all the way down to the ”API Keys” part, and replica your key:

Save the important thing for now, as you’ll want it within the subsequent step when initializing the Moralis software program growth package (SDK)!
Step 2: Write a Script Calling the getWalletTokenBalances() Endpoint
For the second step, begin by establishing a brand new undertaking folder in your most popular IDE. From there, open a brand new terminal and run the next command within the root folder to put in the Moralis SDK:
npm set up moralis @moralisweb3/common-evm-utils
Subsequent, create a brand new ”index.js” file and add the next code:
const Moralis = require(“moralis”).default;
const { EvmChain } = require(“@moralisweb3/common-evm-utils”);
const runApp = async () => {
await Moralis.begin({
apiKey: “YOUR_API_KEY”,
// …and some other configuration
});
const deal with = “0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d”;
const chain = EvmChain.ETHEREUM;
const response = await Moralis.EvmApi.token.getWalletTokenBalances({
deal with,
chain,
});
console.log(response.toJSON());
};
runApp();
Earlier than operating the code, you might want to make a couple of minor configurations. Begin by changing YOUR_API_KEY with the important thing you copied throughout step one. Doing so will initialize the Moralis SDK:

Understand that you don’t need to expose your Moralis API key. As such, when constructing production-ready dapps, ensure that to make use of setting variables and different greatest practices.
From right here, you additionally must configure the deal with const by including the ETH deal with from which you need to get the record of all cash:

We then go alongside deal with and chain as parameters when calling the getWalletTokenBalances() endpoint:

That’s it for the code; you’re now able to run the script and fetch a listing of all of the cash within the specified ETH deal with!
Step 3: Run the Code
To run the code, go forward and launch a brand new terminal, cd into the undertaking’s root folder, and execute the next command:
node index.js
When you run the code, you’ll get a response containing a listing of all of the cash within the specified ETH deal with. It ought to look one thing like this:
[
{
“token_address”: “0xff20548405c6f024264b5c8dc954625285b799e1”,
“symbol”: “BTCETF”,
“name”: “BTCETF”,
“logo”: null,
“thumbnail”: null,
“decimals”: 18,
“balance”: “166000000000000000000000”,
“possible_spam”: false
},
{
“token_address”: “0xe90cc7d807712b2b41632f3900c8bd19bdc502b1”,
“symbol”: “KUMA”,
“name”: “Kuma”,
“logo”: null,
“thumbnail”: null,
“decimals”: 18,
“balance”: “3000000000000000000000000000”,
“possible_spam”: false
},
//…
]
Congratulations; you now know find out how to get a listing of all of the cash in an ETH deal with!
Now, if you need inspiration on what to do with this knowledge, be part of us within the following part. In doing so, we’ll discover some widespread use circumstances for itemizing all of the cash in an ETH deal with!
Use Circumstances for Itemizing All of the Cash in An ETH Deal with
There are various use circumstances for itemizing all of the cash in an ETH deal with, and we gained’t be capable to cowl all of them on this part. As an alternative, we’ll briefly record 4 outstanding examples of platforms that want entry to deal with balances in some capability:
Portfolio Trackers: A crypto portfolio tracker is a digital platform that lets you oversee all of your cryptocurrency holdings in a single place. Some nice examples embody Delta, Koinly, and Kubera. Decentralized Exchanges (DEXs): A DEX is a crypto trade facilitating peer-to-peer (P2P) transactions with out middleman involvement. Examples of well-established platforms embody Uniswap, Curve Finance, and PancakeSwap. Block Explorers: A block explorer is a digital device that lets you seek for real-time and historic details about a blockchain community. This consists of every part from block knowledge to token balances of a selected deal with. Some outstanding examples of block explorers embody Etherscan, PolygonScan, and BscScan. Web3 Wallets: Web3 wallets are digital platforms that permit you to retailer and handle your digital belongings, together with shopping for, promoting, and swapping tokens. Examples of Web3 wallets are MetaMask, Coinbase Pockets, and Ledger.

Now that you understand how to record all of the cash in an ETH deal with and a few situations when this knowledge could be useful, let’s discover Moralis’ capabilities additional within the subsequent part!
Past Querying a Checklist of All of the Cash in An ETH Deal with – Exploring Moralis Additional
Moralis is the {industry}’s premier Web3 API supplier, and the capabilities of our dynamic toolset lengthen far past the Token API!

In Moralis’ industry-leading Web3 API suite, you’ll discover a number of interfaces for numerous use circumstances, and down under, we’ll discover three examples:
Pockets API: Our Pockets API is the final word device when you’re trying to construct Web3 wallets or combine pockets performance into your dapps. With single API calls, you’ll be able to effortlessly fetch pockets balances, real-time transfers, profile knowledge, and far more. For example, right here’s an instance of how simple it’s to fetch the native steadiness of any pockets with the getNativeBalance() endpoint: const response = await Moralis.EvmApi.steadiness.getNativeBalance({
“chain”: “0x1”,
“deal with”: “0xDC24316b9AE028F1497c275EB9192a3Ea0f67022”
}); NFT API: Moralis’ NFT API is the {industry}’s main device for NFT-related knowledge. With this premier interface, you may get NFT metadata, balances, on-chain costs, and extra with solely single traces of code. For instance, with the getWalletNFTs() endpoint, you’ll be able to seamlessly fetch the NFT steadiness of any pockets: const response = await Moralis.EvmApi.nft.getWalletNFTs({
“chain”: “0x1”,
“deal with”: “0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e”
}); Blockchain API: With the Blockchain API, you’ll be able to unlock the ability of uncooked and decoded blockchain knowledge. Fetch block knowledge, sensible contract logs, occasions, and far more with ease. For example, right here’s an instance of how one can get block knowledge – together with hashes, timestamps, and so forth. – with the getBlock() endpoint: const response = await Moralis.EvmApi.block.getBlock({
“chain”: “0x1”,
“blockNumberOrHash”: “18541416”
});
So, it doesn’t matter when you’re constructing Web3 wallets, NFT dapps, blockchain explorers, or some other platform; Moralis has the right instruments on your wants. In case you’d wish to discover all our premier interfaces, take a look at our official Web3 API web page!
Nonetheless, at this level, you would possibly nonetheless be asking your self, ”Why ought to I leverage Moralis’ Web3 APIs?”. To reply this query, let’s discover some outstanding advantages of Moralis within the following subsection!
Advantages of Moralis’ Web3 APIs
In addition to permitting you to construct Web3 tasks sooner and extra effectively, Moralis offers many benefits. Nonetheless, sadly, we will be unable to cowl all the advantages on this article. As an alternative, we’ve got narrowed it down to a few outstanding examples of why it’s best to use Moralis:
Prime Efficiency: There are various good Web3 API suppliers in the marketplace; nonetheless, Moralis stands out as the very best in relation to efficiency. Whether or not you need to measure by reliability, velocity, protection, or some other metric, Moralis at all times comes out on prime. Unparalleled Scalability: Moralis’ APIs supply unparalleled scalability. Consequently, our APIs will scale with out fault as your consumer base grows. Cross-Chain Compatibility: Our Web3 APIs are chain agnostic, supporting all main blockchain networks. This consists of Ethereum, BNB Good Chain, Solana, and so forth., together with a number of outstanding ETH layer-2 scaling options. As such, when working with Moralis, you’ll don’t have any bother constructing cross-chain appropriate dapps!

So, when you’re severe about constructing Web3 tasks, ensure that to enroll with Moralis. You’ll be able to create your account totally free, and also you’ll achieve instantaneous entry to all our industry-leading Web3 growth instruments!
Abstract: Methods to Checklist All of the Cash in An ETH Deal with
In right now’s article, we kicked issues off by diving into the ins and outs of ETH addresses. In doing so, we realized that they function distinctive identifiers for EOAs and sensible contracts on the Ethereum blockchain.
From there, we then jumped straight into the principle tutorial and confirmed you find out how to record all of the cash in an ETH deal with in three steps utilizing the Moralis Token API:
Get a Moralis API KeyWrite a Script Calling the getWalletTokenBalances() EndpointRun the Code
So, in case you have adopted alongside this far, you now know find out how to fetch all of the tokens of Ethereum addresses!
We then additionally explored some outstanding use circumstances for this knowledge. In doing so, we briefly coated Web3 wallets, portfolio trackers, DEXs, and block explorers. In case you favored this tutorial on find out how to record all of the cash in an ETH deal with, contemplate studying extra content material right here on the Moralis weblog. For instance, take a look at our most up-to-date Starknet faucet information or discover the ins and outs of Web3 social media.

Additionally, if you wish to leverage our Web3 APIs in your growth endeavors, don’t overlook to enroll with Moralis. You’ll be able to arrange your account totally free, and also you’ll be capable to begin constructing dapps sooner and smarter right now!







