Altszn.com
  • Home
  • Crypto
    • Altcoins
    • Bitcoin
    • Ethereum
    • Monero
    • XRP
    • Zcash
  • Web3
  • DeFi
  • NFTs
No Result
View All Result
Altszn.com
  • Home
  • Crypto
    • Altcoins
    • Bitcoin
    • Ethereum
    • Monero
    • XRP
    • Zcash
  • Web3
  • DeFi
  • NFTs
No Result
View All Result
Altszn.com
No Result
View All Result

How to Get an ERC-20 Token Address

Altszn.com by Altszn.com
October 18, 2023
in Web3
0
How to Get an ERC-20 Token Address
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter


How to Get an ERC-20 Token Address

Users, decentralized applications (dapps), and other smart contracts need the address of an ERC-20 token to call functions, send transactions, or query data. However, what exactly is a token address? And how do you get them? If youโ€™re looking for the answers to these queries, join us in this tutorial, as weโ€™ll show you the easiest way to get the address of any ERC-20 token!

Overview

In todayโ€™s article, weโ€™ll kick things off by exploring the intricacies of ERC-20 token addresses. From there, weโ€™ll jump straight into the main topic and show you how to get the address of any ERC-20 token using the industryโ€™s leading token explorer โ€“ Moralis Money โ€“ and a block explorer like Etherscan. Next, weโ€™ll also cover other ways to get ERC-20 token addresses using Moralis and its various APIs, which can help you in your Web3 development endeavors. More specifically, weโ€™ll explore the following endpoints: 

  • getWalletTokenBalances()
  • getTopERC20TokensByMarketCap()
  • getTopERC20TokensByPriceMovers()

Lastly, to top things off, weโ€™ll give you an in-depth tutorial on how to get the addresses of all ERC-20 tokens in a wallet using Moralis! 

Throughout this article, weโ€™re going to utilize Moralisโ€™ Web3 Market Data API and Token API to get the addresses of ERC-20 tokens. However, if youโ€™re serious about building Web3 projects, we urge you to explore some additional Moralis tools as well. For instance, check out the Price API and explore the easiest way to get prices of crypto.

With the tools in Moralisโ€™ Web3 API suite, you can build Web3 projects faster and more efficiently. As such, if you havenโ€™t already, make sure to sign up with Moralis and get immediate access to our blockchain development tools for free!

Moralis API Landing Page for ERC-20 Token Address Queries

What is an ERC-20 Token Address? 

ERC-20 โ€“ short for Ethereum Request for Comment 20 โ€“ is the most widely adopted standard for creating tokens on the Ethereum blockchain. The standard defines a set of requirements, functions, and events all fungible tokens must implement to be considered ERC-20 compliant. Some prominent examples include functions for transferring tokens between addresses, checking the tokenโ€™s total supply, etc.

One of the key goals of the ERC-20 standard is to guarantee identical values between tokens. For example, one ETH token will always equal another ETH. 

The uniformity of the ERC-20 token standard is essential for the Ethereum ecosystem, making it significantly easier for Web3 wallets, decentralized applications (dapps), and other platforms to integrate tokens into their software. This is, for example, why you can seamlessly add any ERC-20 token to a wallet like MetaMask, a task that would be significantly harder without a prominent standard. 

That said, what is the address of an ERC-20 token?

ERC20 Token Address within Web3 compontents like dapps and contracts

ERC-20 tokens are created by inputting some data into a template smart contract responsible for controlling and managing the token. When the token creator first deploys it to the blockchain, an address that looks similar to any public Ethereum wallet address is generated. Consequently, an ERC-20 token address is essentially a unique sequence of letters and numbers acting as a unique identifier for the smart contract in question.    

So, why is this address necessary? 

In order for you to interact with a token, you need the address of the smart contract. You can think of it this way: if you want to send or receive anything to your account, you use your public address. Similarly, if youโ€™re going to send or receive an ERC-20 token, you have to interact with its address!

Easiest Way to Get the Address of Any ERC-20 Token

With an overview of what a token address is, weโ€™re ready to jump into the main tutorial. In this part, weโ€™ll show you how to get the address of an ERC-20 token using two different tools: 

  • Token explorers
  • Block explorers

So, without further ado, letโ€™s look at how you can get an ERC-20 tokenโ€™s address using a token explorer! 

Use a Token Explorer to Get the Address of an ERC-20 Token

In this section, weโ€™ll show you how to get the address of an ERC-20 token using the industryโ€™s premier token explorer โ€“ Moralis Money!

Thanks to the accessibility of Moralis Money, you can effortlessly get any token address in three straightforward steps: 

  • Step 2: Input a token name in the search bar at the top and click on it. Doing so takes you to the coinโ€™s token page, and in this case, weโ€™ll be using USDC as an example: 
Inputting an ERC20 token name into the address bar at Moralis Money Token Explorer
  • Step 3: Click on the copy button next to โ€Coin Addressโ€: 
Copying the ERC20 Token Address

Thatโ€™s it; when working with a token explorer like Moralis Money, itโ€™s easy to get the address of an ERC-20 token!

Whatโ€™s more, Moralis Money supports multiple blockchain networks. This means you can seamlessly find any ERC-20 tokenโ€™s address across various chains, including Ethereum, Polygon, Arbitrum, and many others.

Use a Block Explorer to Get the Address of an ERC-20 Token

You can also use other tools like block explorers to easily get an ERC-20 tokenโ€™s address. In this section, weโ€™ll show you how it works using Etherscan! 

  • Step 2: Add the token name to the search bar at the top and click on it. In this case, weโ€™ll also be using USDC as an example: 
Searching for a Token address using Etherscan
  • Step 3: Copy the address under the โ€Other Infoโ€ section:
Copying the ERC20 token address on Etherscan

Thatโ€™s it; it doesnโ€™t have to be more challenging than that to get the address of an ERC-20 token when using a block explorer like Etherscan! 

However, a significant drawback to using block explorers is that they are usually tied to one specific network. For instance, Etherscan is used for Ethereum, PolygonScan is used for Polygon, etc. This means you canโ€™t find token addresses across chains like when working with Moralis Money! 

Use Moralis to Get ERC-20 Token Addresses 

In addition to using token and block explorers, you can also leverage Moralis and our various APIs to get ERC-20 token addresses in other ways that are more useful when building Web3 projects. To give you a few examples, in the following sections, we will cover three prominent endpoints that allow you to seamlessly get ERC-20 token addresses: 

  • getWalletTokenBalances()
  • getTopERC20TokensByMarketCap()
  • getTopERC20TokensByPriceMovers()

If this sounds intriguing, join us below as we show you the getWalletTokenBalances() endpoint, allowing you to get the addresses of all ERC-20 tokens owned by a wallet in a heartbeat! 

getWalletTokenBalances()

The easiest way to get the addresses of all ERC-20 tokens owned by a wallet is to leverage the Moralis Token API. With the Token API, you can effortlessly get the data youโ€™re after with a single call to the getWalletTokenBalances() endpoint. Hereโ€™s an example of what it might look like: 

const response = await Moralis.EvmApi.token.getWalletTokenBalances({   "chain": "0x1",   "address": "0x1f9090aaE28b8a3dCeaDf281B0F12828e676c326" });

All you have to do is configure the address and chain parameters to fit your query. In this instance, the address parameter is the wallet address from which you want to get the tokens. Once you call the getWalletTokenBalances() endpoint, youโ€™ll get a response containing an array of all tokens and their addresses. It will look something like this: 

[   {     "token_address": "0xefd6c64533602ac55ab64442307f6fe2c9307305",     "name": "APE",     "symbol": "APE",     "logo": null,     "thumbnail": null,     "decimals": 18,     "balance": "101715701444169451516503179"   },   {     "token_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",     "name": "Wrapped Ether",     "symbol": "WETH",     "logo": "https://cdn.moralis.io/eth/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.webp",     "thumbnail": "https://cdn.moralis.io/eth/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_thumb.webp",     "decimals": 18,     "balance": "85000000000000000"   } ]

getTopERC20TokensByMarketCap()

Your best option for fetching the addresses of the top ERC-20 tokens by market cap is to use the Moralis Market Data API. With this tool, you can get the job done with a single API call to the getTopERC20TokensByMarketCap() endpoint. And this is what it looks like:  

const response = await Moralis.EvmApi.marketData.getTopERC20TokensByMarketCap();

In return for calling the endpoint above, youโ€™ll get a list of the top ERC-20 tokens by market cap, including each tokenโ€™s address. Hereโ€™s an example of what the response might look like:  

[   {     "rank": "1",     "token_name": "Wrapped Ether",     "token_symbol": "WETH",     "token_logo": "https://cdn.moralis.io/eth/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.png",     "token_decimals": "18",     "contract_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",     "price_usd": "0.0285",     "price_24h_percent_change": "0.0285",     "price_7d_percent_change": "0.0285",     "market_cap_usd": "0.0285"   } //โ€ฆ ]

getTopERC20TokensByPriceMovers()

You can also leverage the Market Data API to get the addresses of the top ERC-20 tokens based on price change. All it requires is a single call to the getTopERC20TokensByPriceMovers() endpoint, and it looks something like this: 

const response = await Moralis.EvmApi.marketData.getTopERC20TokensByPriceMovers();

Calling the getTopERC20TokensByPriceMovers() endpoint will give you the top gainers and losers based on price change. And each token in the response will have an address attached to it. Hereโ€™s an example of what the JSON response should look like: 

{   "gainers": [     {       "rank": 1,       "token_name": "Amber phantom Butterfly",       "token_symbol": "APB",       "token_logo": "https://market-data-images.s3.us-east-1.amazonaws.com/tokenImages/0x1650ec11bc9cfe2f3a4a18a9fcf5c2ad5e7979e8b5e92fae7cff5475d51f2bb4.png",       "token_decimals": "18",       "contract_address": "0x23da77203eead71e72d7326654c431ef563567a4",       "price_usd": "0.00009505",       "price_24h_percent_change": "1362.31",       "price_7d_percent_change": "8.1",       "market_cap_usd": "1072500"     }, 		//...   ],   "losers": [     {       "rank": 1,       "token_name": "ONSTON",       "token_symbol": "ONSTON",       "token_logo": "https://market-data-images.s3.us-east-1.amazonaws.com/tokenImages/0x52d802cacaf06b3f80e8c974091a44a171110ff7cf2a64db147209a9f92b2b02.png",       "token_decimals": "18",       "contract_address": "0x47b9f01b16e9c9cb99191dca68c9cc5bf6403957",       "price_usd": "0.0004902",       "price_24h_percent_change": "-78.89",       "price_7d_percent_change": "-78.27",       "market_cap_usd": "2320060"     },     //...   ] }

Full Tutorial: How to Get the Addresses of All ERC-20 Tokens in a Wallet

In this section, weโ€™ll provide a complete tutorial on how to get the addresses of all ERC-20 tokens in a wallet using Moralisโ€™ Token API. Thanks to the accessibility of this tool, we can effortlessly get the data we need in three straightforward steps: 

  1. Get a Moralis API key
  2. Write a script calling the getWalletTokenBalances() endpoint
  3. Run the code

However, before we can jump into the first step of the tutorial, you need to take care of a few prerequisites! 

Prerequisites 

While the Token API supports multiple programming languages, we will be using JavaScript in this tutorial. So, before you can proceed, make sure you have the following ready: 

Step 1: Get a Moralis API Key 

A Moralis API key is one requirement for calling the Token API and the getWalletTokenBalances() endpoint. As such, if you donโ€™t already have one, make sure to sign up with Moralis straight away by clicking on the โ€Start for Freeโ€ button at the top right of the Moralis homepage: 

Get an ERC20 Token Address - Moralis Start for Free Button

With a Moralis account at hand, you can navigate to the โ€Settingsโ€ tab, scroll down to the โ€Secretsโ€ section, and copy your API key: 

Settings page showing the API key to get ERC20 token address

Keep the key for now, as youโ€™ll need it in the following step to initiate the Moralis SDK! 

Step 2: Write a Script Calling the getWalletTokenBalances() Endpoint 

Open your preferred integrated development environment (IDE) and set up a new project. From here, you need to install the Moralis SDK. As such, open a new terminal and run the following command in your projectโ€™s root folder: 

npm install moralis @moralisweb3/common-evm-utils

Next, create a new โ€index.jsโ€ file and add the following code: 

const Moralis = require("moralis").default; const { EvmChain } = require("@moralisweb3/common-evm-utils");  const runApp = async () => {   await Moralis.start({     apiKey: "YOUR_API_KEY",     // ...and any other configuration   });    const address = "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d";    const chain = EvmChain.ETHEREUM;    const response = await Moralis.EvmApi.token.getWalletTokenBalances({     address,     chain,   });    console.log(response.toJSON()); };  runApp();

You then need to initiate the Moralis SDK by replacing YOUR_API_KEY with the key you copied in the first step: 

Showing source code and where to paste the API key for ERC20 token address

From there, configure the address and chain parameters to fit your request. In this case, the address parameter is the wallet address from which you want to query the token addresses:

Code source - Showing essential parameters to change

We then pass along the parameters when calling the getWalletTokenBalances() endpoint: 

The GetERC20TokenAddress Endpoint example

And thatโ€™s it; youโ€™re now ready to run the code!  

Step 3: Run the Code 

For the final step, open a new terminal, cd into your projectโ€™s root folder, and run the following command to execute the script: 

node index.js

In return, youโ€™ll get an array of all tokens contained within the wallet in question. Hereโ€™s an example of what the response might look like: 

[   {     "token_address": "0xefd6c64533602ac55ab64442307f6fe2c9307305",     "name": "APE",     "symbol": "APE",     "logo": null,     "thumbnail": null,     "decimals": 18,     "balance": "101715701444169451516503179"   },   {     "token_address": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",     "name": "Wrapped Ether",     "symbol": "WETH",     "logo": "https://cdn.moralis.io/eth/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2.webp",     "thumbnail": "https://cdn.moralis.io/eth/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2_thumb.webp",     "decimals": 18,     "balance": "85000000000000000"   } ]

As you can see in the response above, each element or token has a token_address parameter. And with this data, you can easily get each ERC-20 tokenโ€™s address!

Congratulations; you now know how to get the addresses of all ERC-20 tokens in a wallet using Moralis and the Token API! 

Summary: How to Get the Address of an ERC-20 Token

In todayโ€™s article, we kicked things off by exploring the ins and outs of ERC-20 token addresses. In doing so, we learned that they are a unique sequence of numbers and letters used to identify and interact with ERC-20 tokens. Consequently, as you can imagine, they are fundamental to the Web3 ecosystem. 

From there, we also showed you how to seamlessly get the address of an ERC-20 token using Moralis Money โ€“ an industry-leading token explorer. With this tool, you can effortlessly get the address of any ERC-20 token in three straightforward steps: 

  • Step 1: Visit Moralis Money 
  • Step 2: Go to the coinโ€™s token page
  • Step 3: Copy the address

As such, if you have followed along this far, you now know how to get the address of an ERC-20 token using Moralis Money! 

Moralis Money - Get ERC20 Addresses

In addition to the method above, we showed you how to get the addresses of ERC-20 tokens using Moralis APIs. In doing so, we covered the following three endpoints: 

  • getWalletTokenBalances()
  • getTopERC20TokensByMarketCap()
  • getTopERC20TokensByPriceMovers()

So, you now know how to get the addresses of ERC-20 tokens using the Moralis API!

If you liked this guide on how to get the address of an ERC-20 token, consider diving into more content here on the blog. For instance, explore the ERC-4337 standard or learn how to use the getLogs method. 

Also, if youโ€™re serious about building blockchain-based projects, make sure to explore some additional Moralis APIs. For instance, if youโ€™re into NFT development, then youโ€™ll definitely want to check out the NFT API. With this tool, you can get verified NFT collections, get all NFT tokens owned by a user address, and more! 

If you want access to these industry-leading development tools, sign up with Moralis immediately! 



Read More: moralis.io

Tags: addressERC20Tokenweb 3.0Web3
ADVERTISEMENT

Recent

Post-halving profitability, hashrate and energy trends

Post-halving profitability, hashrate and energy trends

May 15, 2025
Bahrain-based AlAbraaj Restaurants adopts Bitcoin treasury strategy

Bahrain-based AlAbraaj Restaurants adopts Bitcoin treasury strategy

May 15, 2025
Bitcoinโ€™s (BTC) $2T Market Cap Could Be Drained As Altcoin Season Heats Up in June: Analyst

Bitcoinโ€™s (BTC) $2T Market Cap Could Be Drained As Altcoin Season Heats Up in June: Analyst

May 15, 2025

Categories

  • Bitcoin (4,858)
  • Blockchain (11,412)
  • Crypto (9,352)
  • Dark Web (549)
  • DeFi (8,397)
  • Ethereum (4,905)
  • Metaverse (7,531)
  • Monero (290)
  • NFT (1,481)
  • Solana (5,047)
  • Web3 (20,708)
  • Zcash (509)

Category

Select Category

    Advertise

    Advertise your site, company or product to millions of web3, NFT and cryptocurrency enthusiasts. Learn more

    Useful Links

    Advertise
    DMCA
    Contact Us
    Privacy Policy
    Shipping & Returns
    Terms of Use

    Resources

    Exchanges
    Changelly
    Web3 Jobs

    Recent News

    Post-halving profitability, hashrate and energy trends

    Post-halving profitability, hashrate and energy trends

    May 15, 2025
    Bahrain-based AlAbraaj Restaurants adopts Bitcoin treasury strategy

    Bahrain-based AlAbraaj Restaurants adopts Bitcoin treasury strategy

    May 15, 2025

    ยฉ 2022 Altszn.com. All Rights Reserved.

    No Result
    View All Result
    • Home
      • Home โ€“ Layout 1
      • Home โ€“ Layout 2
      • Home โ€“ Layout 3

    ยฉ Altszn.com. All Rights Reserved.

    • bitcoinBitcoin (BTC) $ 103,402.00
    • ethereumEthereum (ETH) $ 2,565.17
    • tetherTether (USDT) $ 1.00
    • xrpXRP (XRP) $ 2.47
    • bnbBNB (BNB) $ 655.91
    • solanaSolana (SOL) $ 172.21
    • usd-coinUSDC (USDC) $ 0.999874
    • dogecoinDogecoin (DOGE) $ 0.225004
    • cardanoCardano (ADA) $ 0.773533
    • tronTRON (TRX) $ 0.274320
    • staked-etherLido Staked Ether (STETH) $ 2,562.47
    • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 103,384.00
    • suiSui (SUI) $ 3.81
    • chainlinkChainlink (LINK) $ 16.40
    • wrapped-stethWrapped stETH (WSTETH) $ 3,080.96
    • avalanche-2Avalanche (AVAX) $ 23.77
    • stellarStellar (XLM) $ 0.296832
    • shiba-inuShiba Inu (SHIB) $ 0.000015
    • hyperliquidHyperliquid (HYPE) $ 25.37
    • hedera-hashgraphHedera (HBAR) $ 0.200222
    • leo-tokenLEO Token (LEO) $ 9.04
    • bitcoin-cashBitcoin Cash (BCH) $ 394.04
    • the-open-networkToncoin (TON) $ 3.12
    • litecoinLitecoin (LTC) $ 98.44
    • polkadotPolkadot (DOT) $ 4.83
    • usdsUSDS (USDS) $ 0.999870
    • wethWETH (WETH) $ 2,574.30
    • pi-networkPi Network (PI) $ 0.900350
    • moneroMonero (XMR) $ 342.26
    • wrapped-eethWrapped eETH (WEETH) $ 2,740.66
    • pepePepe (PEPE) $ 0.000014
    • bitget-tokenBitget Token (BGB) $ 4.88
    • binance-bridged-usdt-bnb-smart-chainBinance Bridged USDT (BNB Smart Chain) (BSC-USD) $ 0.995238
    • ethena-usdeEthena USDe (USDE) $ 1.00
    • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 103,627.00
    • whitebitWhiteBIT Coin (WBT) $ 30.30
    • bittensorBittensor (TAO) $ 439.73
    • uniswapUniswap (UNI) $ 6.42
    • daiDai (DAI) $ 1.00
    • nearNEAR Protocol (NEAR) $ 2.93
    • aptosAptos (APT) $ 5.55
    • aaveAave (AAVE) $ 225.30
    • okbOKB (OKB) $ 53.49
    • kaspaKaspa (KAS) $ 0.120458
    • ondo-financeOndo (ONDO) $ 0.991659
    • jito-staked-solJito Staked SOL (JITOSOL) $ 207.49
    • crypto-com-chainCronos (CRO) $ 0.102775
    • internet-computerInternet Computer (ICP) $ 5.50
    • ethereum-classicEthereum Classic (ETC) $ 19.17
    • blackrock-usd-institutional-digital-liquidity-fundBlackRock USD Institutional Digital Liquidity Fund (BUIDL) $ 1.00
    • bitcoinBitcoin (BTC) $ 103,402.00
    • ethereumEthereum (ETH) $ 2,565.17
    • tetherTether (USDT) $ 1.00
    • xrpXRP (XRP) $ 2.47
    • bnbBNB (BNB) $ 655.91
    • solanaSolana (SOL) $ 172.21
    • usd-coinUSDC (USDC) $ 0.999874
    • dogecoinDogecoin (DOGE) $ 0.225004
    • cardanoCardano (ADA) $ 0.773533
    • tronTRON (TRX) $ 0.274320
    • staked-etherLido Staked Ether (STETH) $ 2,562.47
    • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 103,384.00
    • suiSui (SUI) $ 3.81
    • chainlinkChainlink (LINK) $ 16.40
    • wrapped-stethWrapped stETH (WSTETH) $ 3,080.96
    • avalanche-2Avalanche (AVAX) $ 23.77
    • stellarStellar (XLM) $ 0.296832
    • shiba-inuShiba Inu (SHIB) $ 0.000015
    • hyperliquidHyperliquid (HYPE) $ 25.37
    • hedera-hashgraphHedera (HBAR) $ 0.200222
    • leo-tokenLEO Token (LEO) $ 9.04
    • bitcoin-cashBitcoin Cash (BCH) $ 394.04
    • the-open-networkToncoin (TON) $ 3.12
    • litecoinLitecoin (LTC) $ 98.44
    • polkadotPolkadot (DOT) $ 4.83
    • usdsUSDS (USDS) $ 0.999870
    • wethWETH (WETH) $ 2,574.30
    • pi-networkPi Network (PI) $ 0.900350
    • moneroMonero (XMR) $ 342.26
    • wrapped-eethWrapped eETH (WEETH) $ 2,740.66
    • pepePepe (PEPE) $ 0.000014
    • bitget-tokenBitget Token (BGB) $ 4.88
    • binance-bridged-usdt-bnb-smart-chainBinance Bridged USDT (BNB Smart Chain) (BSC-USD) $ 0.995238
    • ethena-usdeEthena USDe (USDE) $ 1.00
    • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 103,627.00
    • whitebitWhiteBIT Coin (WBT) $ 30.30
    • bittensorBittensor (TAO) $ 439.73
    • uniswapUniswap (UNI) $ 6.42
    • daiDai (DAI) $ 1.00
    • nearNEAR Protocol (NEAR) $ 2.93
    • aptosAptos (APT) $ 5.55
    • aaveAave (AAVE) $ 225.30
    • okbOKB (OKB) $ 53.49
    • kaspaKaspa (KAS) $ 0.120458
    • ondo-financeOndo (ONDO) $ 0.991659
    • jito-staked-solJito Staked SOL (JITOSOL) $ 207.49
    • crypto-com-chainCronos (CRO) $ 0.102775
    • internet-computerInternet Computer (ICP) $ 5.50
    • ethereum-classicEthereum Classic (ETC) $ 19.17
    • blackrock-usd-institutional-digital-liquidity-fundBlackRock USD Institutional Digital Liquidity Fund (BUIDL) $ 1.00