In this tutorial, we will delve into Moonbeam and its advantages, discussing why you might consider developing on this blockchain. Additionally, we will introduce Moralis – the leading provider of crypto data in the industry. With our high-quality RPC nodes and APIs, integrating on-chain data from Moonbeam into your Web3 projects is straightforward and efficient. To understand how this operates, take a look at the example provided below, which showcases the simplicity of fetching token prices using Moralis:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://deep-index.moralis.io/api/v2.2/erc20/0xE57eBd2d67B462E9926e04a8e33f01cD0D64346D/price?chain=0x504&include=percent_change', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
By executing the script above, you will receive the price of the specified token, expressed in both the chain’s native currency and USD. Here’s an illustration of what that response might look like:
{ tokenName: 'Wrapped BTC', tokenSymbol: 'WBTC', tokenLogo: null, tokenDecimals: '8', nativePrice: { value: '361716720517110579889317', decimals: 18, name: 'Moonbeam', symbol: 'GLMR', address: '0xacc15dc74880c9944775448304b263d191c6077f' }, usdPrice: 57333.47928669679, usdPriceFormatted: '57333.479286696792189825', exchangeName: 'StellaSwap', exchangeAddress: '0x68A384D826D3678f78BB9FB1533c7E9577dACc0E', tokenAddress: '0xe57ebd2d67b462e9926e04a8e33f01cd0d64346d', priceLastChangedAtBlock: '7395637', blockTimestamp: '1725934212000', possibleSpam: false, verifiedContract: false, pairAddress: '0xf8f5e8b9ee84664695b14862212d8092e16331f6', pairTotalLiquidityUsd: '6512.06', '24hrPercentChange': '4.2813011084629755', securityScore: 64 }
That’s all there is to it; obtaining on-chain data from Moonbeam is this straightforward. For a more comprehensive tutorial and deeper insights into our development tools, continue reading as we present everything in detail.
Are you ready to start utilizing our APIs and RPC nodes? Sign up for free with Moralis!
Overview
Ethereum has long been at the forefront of decentralized application (dapp) development; however, the network has faced challenges with high transaction fees, rendering it unaffordable for many users. This gap has paved the way for alternative networks, with Moonbeam emerging as a noteworthy contender.

So, what exactly is Moonbeam? How does it function? And why should developers consider building on the Moonbeam network? If you’re seeking answers to these questions, continue reading as we dive in!
What is Moonbeam? Why Build on the Moonbeam Network?
Moonbeam was launched in December 2021 as a delegated proof-of-stake (DPoS) EVM-compatible parachain, harnessing the strengths of Polkadot and Ethereum to effortlessly integrate Solidity smart contracts within its ecosystem. This enables the seamless development of cross-chain dapps that utilize unique assets and functionalities from various networks simultaneously!

Why Build on Moonbeam?
There are numerous reasons to build on Moonbeam. Here are four key advantages of the network:
- Cost-Effective & High-Performance: Moonbeam is designed for cost-efficiency and optimal performance. The network leverages Polkadot’s scalability capabilities alongside low gas fees, making it a more economically viable option compared to Ethereum.
- Seamless Developer Experience: As an EVM chain, Moonbeam is fully compatible with Ethereum tools, ensuring a smooth transition from Ethereum to the Polkadot ecosystem. Tools such as MetaMask, Remix, and Truffle are at your disposal.
- Multi-Chain Capabilities: Moonbeam, as a parachain, enhances cross-chain interoperability within the Polkadot ecosystem, expanding the functionality and reach of your Web3 applications.
- EVM & Polkadot Compatibility: With EVM and Polkadot compatibility, you can easily migrate and deploy existing Ethereum projects on Polkadot without major code modifications.
This offers an overview of the reasons to develop on Moonbeam. Let’s now further explore the Moonbeam ecosystem!
Exploring the Moonbeam Ecosystem
The Moonbeam ecosystem boasts an impressive array of promising projects. Here are three notable examples:
- Moonwell: A leading lending, borrowing, and DeFi protocol operating on both Moonriver and Moonbeam. With a user-friendly interface, Moonwell aims to provide an efficient user experience, allowing users to optimize the value of their digital assets.
- Beamswap: A decentralized exchange (DEX) and DeFi hub utilizing a concentrated liquidity market maker (CLMM) protocol to enhance transaction efficiency. Beamswap enables users to conduct instant peer-to-peer transactions and earn rewards for providing liquidity to the protocol.
- SushiSwap: This DEX allows users to trade cryptocurrencies seamlessly without intermediaries. SushiSwap employs an automated market maker (AMM) system for facilitating peer-to-peer transactions.

Glimmer Token Explained
A crucial component of Moonbeam is its native token, Glimmer. Below are three significant use cases of Glimmer:
- Transaction Fees: The Glimmer token is utilized to pay for transactions on Moonbeam, making it essential for anyone wishing to engage with the network.
- Gas Metering: Gas calculations on the Moonbeam network are expressed and measured in terms of Glimmer.
- On-Chain Governance: Glimmer plays a vital role in the on-chain governance of Moonbeam. Holders can propose protocol changes, participate in voting on significant matters, and elect council members within the ecosystem.
This provides an overview of the Moonbeam ecosystem. Next, we will introduce you to Moralis and our tools tailored for Moonbeam Web3 development!
Moralis x Moonbeam – The Premier Moonbeam API
Moralis is recognized as the top Web3 data provider, featuring high-quality RPC nodes and Web3 APIs that facilitate an enhanced developer experience. Our suite of Moonbeam-compatible development tools includes interfaces such as the Wallet API, Token API, NFT API, and much more. As a result, Moralis allows you to access all crypto data from a single location!

Why Build on Moonbeam with Moralis?
So, why choose to build on Moonbeam using Moralis? Let’s examine three advantages of our APIs and RPC nodes:
- One Call – All the Data: Our APIs and Extended RPC Methods are crafted with results in mind, allowing you to retrieve extensive data with fewer requests. Access a wallet’s complete history, token balances, prices, NFT metadata, and more in a single call.
- Multi-Chain Compatibility: Moralis provides support for all major chains, including Moonbeam, Ethereum, Polygon, Optimism, Base, and more. With our tools, you can smoothen your developer journey by utilizing a single provider for all data needs.
- Secure & Reliable: Moralis is SOC 2 Type 2 certified, demonstrating our commitment to high standards of reliability and security.
To illustrate the benefits of Moralis further, let’s take a closer look at our development tools!
Moralis Deep Dive
Moralis provides a variety of industry-leading development tools. In the upcoming sections, we will explore both our Web3 APIs and RPC nodes in detail. Let’s get started!

Web3 APIs
Moralis’ Web3 API suite includes several interfaces compatible with Moonbeam. Here are five key examples:
- Wallet API: Retrieve any wallet’s full transaction history, token balances, net worth, profitability, and more in single API requests. This tool is ideal for developers looking to build wallets or integrate wallet features into dapps.
- Token API: Easily obtain token balances, transactions, prices, and other information without hassle. The Token API facilitates the integration of ERC-20 data into your dapps.
- NFT API: Access NFT balances, updated metadata, prices, transfers, and more with simple lines of code. Utilize this premium interface for creating everything from NFT marketplaces to Web3 games.
- Price API: Obtain historical and real-time prices for NFTs and ERC-20 tokens alike. Use the Price API to effortlessly integrate precise and reliable price data into your dapps.
- Streams API: The leading real-time data solution in the industry, enabling you to establish Web3 data pipelines with just a few clicks. Employ the Streams API to seamlessly integrate real-time alerts into your dapps, fill databases with data, or incorporate current, actionable insights into your projects.
To explore all our interfaces, please visit our Web3 API page!
RPC Nodes
Moralis is a premier provider of next-generation RPC nodes. With our user-friendly point-and-click interface, you can easily configure nodes for all major chains, including Moonbeam, Ethereum, Optimism, and many others!

What distinguishes our RPC nodes?
- Speed: Our nodes set the standard for speed in the industry, with response times starting from 70 ms.
- Reliability: With a 99.9% uptime, our RPC nodes offer enterprise-level reliability.
- Extended RPC Methods: Take advantage of Extended RPC Methods to obtain decoded, human-readable data via our next-generation RPC nodes.
To learn more about this, check out our RPC nodes page!
Full Tutorial: How to Get On-Chain Data from Moonbeam in 3 Steps
Having provided an overview of Moralis, we’ll now guide you through a tutorial on obtaining on-chain data from Moonbeam using our APIs. Specifically, we will demonstrate how to fetch the price of any token. Thanks to the sheer usability of our Web3 APIs, you can obtain this data in just three simple steps:
- Obtain a Moralis API Key
- Create a Script
- Execute the Code
Before we proceed, make sure to take care of a few prerequisites!
Prerequisites
Ensure you have the following prepared to follow this tutorial:
Step 1: Obtain a Moralis API Key
Your first step is creating a Moralis account. If you haven’t done this yet, click the “Start for Free” button at the top right to sign up with Moralis:

Once you are logged in, your API key can be found directly beneath the “Home” tab:

Make sure to copy and retain your key, as you will require it in the next step.
Step 2: Write a Script
Open your integrated development environment (IDE), create a folder, and initialize your project using the terminal command below:
npm init
Next, install the required dependencies with these terminal commands:
npm install node-fetch --save npm install moralis @moralisweb3/common-evm-utils
Open your “package.json” file and add ”type”: ”module”
to the list:

Create an “index.js” file and insert the following code into it:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://deep-index.moralis.io/api/v2.2/erc20/0xE57eBd2d67B462E9926e04a8e33f01cD0D64346D/price?chain=0x504&include=percent_change', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Be sure to replace YOUR_API_KEY
with the key you copied earlier, and adjust the address
parameter according to your needs:

Step 3: Execute the Code
Open a new terminal and run the following command in your project root directory to execute the code:
node index.js
You will receive the token price in both Glimmer and USD in response. Additionally, the response will include token logos, historical price changes, spam indications, and more. Here’s an example of what that response may look like:
{ tokenName: 'Wrapped BTC', tokenSymbol: 'WBTC', tokenLogo: null, tokenDecimals: '8', nativePrice: { value: '361716720517110579889317', decimals: 18, name: 'Moonbeam', symbol: 'GLMR', address: '0xacc15dc74880c9944775448304b263d191c6077f' }, usdPrice: 57333.47928669679, usdPriceFormatted: '57333.479286696792189825', exchangeName: 'StellaSwap', exchangeAddress: '0x68A384D826D3678f78BB9FB1533c7E9577dACc0E', tokenAddress: '0xe57ebd2d67b462e9926e04a8e33f01cd0d64346d', priceLastChangedAtBlock: '7395637', blockTimestamp: '1725934212000', possibleSpam: false, verifiedContract: false, pairAddress: '0xf8f5e8b9ee84664695b14862212d8092e16331f6', pairTotalLiquidityUsd: '6512.06', '24hrPercentChange': '4.2813011084629755', securityScore: 64 }
And that’s all there is to it; fetching data from Moonbeam is that simple. You can also follow the same steps to call any other endpoints!
What Can You Build on Moonbeam? – Use Case Exploration
Now that you have learned how to obtain on-chain data from Moonbeam, let’s look at some significant use cases:
- Web3 Wallets: These are tools used for storing and managing digital assets, such as NFTs and ERC-20 tokens. Additionally, wallets typically offer functionalities for buying, selling, and swapping tokens. A well-known example is MetaMask.
- Portfolio Trackers: These tools give users an overview of the performance of their digital assets over time. A leading platform that offers an exceptional portfolio tracking feature is Moralis.
- Tax Tools: These are software designed to assist individuals and businesses in calculating, reporting, and managing taxes related to cryptocurrencies. Koinly is a prominent platform in this space.

Summary: Exploring Moonbeam – Why Build on Moonbeam?
Since its introduction in late 2021, Moonbeam—a DPoS and EVM-compatible parachain—has combined the strengths of Polkadot and Ethereum. This unique framework allows developers to create cross-chain Web3 projects that leverage diverse assets and functionalities from multiple blockchains simultaneously.

So, why is it beneficial to build on Moonbeam?
Let’s revisit the four advantages of the network:
- Cost-Effective & High-Performance: Moonbeam is engineered for optimal performance and cost efficiency, making it a highly appealing platform for developers and users alike.
- Seamless Developer Experience: With EVM compatibility, you can utilize familiar Ethereum tools for building dapps on Moonbeam.
- EVM & Polkadot Compatibility: Easily migrate and launch Ethereum dapps on Polkadot without extensive adjustments to your code.
- Multi-Chain Integration: As a parachain, Moonbeam enables effortless cross-chain communication within the Polkadot ecosystem.
In addition to unveiling the potential of Moonbeam, we also introduced the best tool for building on this blockchain network: Moralis!

Moralis stands as a leading Web3 data provider, granting you easy access to top-notch RPC nodes and Web3 APIs. Our suite includes the Wallet API, Token API, Streams API, among others. With Moralis, all your crypto data is conveniently consolidated in one place.
So, why should you opt to build on Moonbeam with Moralis?
- Comprehensive: Our API responses and Extended RPC Methods provide you with more data while minimizing the number of calls.
- Multi-Chain: Moralis supports all major chains, including Moonbeam, Ethereum, Polygon, Optimism, Base, and more.
- Secure & Reliable: Experience enterprise-level security and reliability with Moralis, the first SOC 2 Type 2 certified Web3 data provider.
If you enjoyed this tutorial on Moonbeam, feel free to check out more exceptional content here at Moralis. For instance, explore our guide, “Why Build on Chiliz,” or learn more about our NFT Rarity API.
And if you’re ready to use our tools, don’t forget to sign up with Moralis!