Are you searching for the easiest way to run Fantom RPC nodes? If so, look no further! In today’s tutorial, we’ll show you how to set up a Fantom node for free using Moralis, the industry’s foremost node provider. With our easy-to-use interface, you can now set up nodes for 35+ chains with the click of a button. Are you eager to learn more? Check out our brief summary of the entire process below:
- Step 3: Select “Fantom”, then “Mainnet”, and press the “Create Node” button:
In return, you’ll get two URLs for your Fantom RPC nodes that you can copy and integrate into your projects to interact with the blockchain:
That’s it! It’s super easy to set up Fantom nodes when leveraging Moralis. However, if you’re looking for a more in-depth walkthrough of the steps above, further information about the chain, and a tutorial on how to call your Fantom RPC nodes, then stick around as we cover it all in this guide!
Ready to immediately set up your own Fantom node? If so, don’t forget to register an account with Moralis. Doing so will give you immediate access to all our industry-leading tools so you can streamline your developer experience today!
Overview
Are you looking to run Fantom RPC nodes on your own? If so, you might want to reconsider. Setting up a Fantom node from scratch can be quite a tedious task. It requires a complex underlying infrastructure that demands a lot of bandwidth, computational power, and storage capacity, which takes time to set up and maintain. Fortunately, you can now avoid all associated challenges with a node provider like Moralis!
At Moralis, we take care of all the underlying complexities of running blockchain nodes. In return, you can use our user-friendly interface to set up nodes for 35+ chains with the click of a button. Want to learn more about how this works? Join us in this guide as we show you how to set up your very own Fantom node for free. Let’s dive straight in!
What is Fantom?
Fantom is a permissionless, decentralized, open-source smart contract platform designed for digital assets and decentralized applications (dapps). Launched in 2019, Fantom aims to offer an alternative to Ethereum by addressing the blockchain trilemma. As such, its architecture is crafted to balance security, scalability, and decentralization, making it a robust solution for various blockchain needs.
But why should you build on Fantom? Here are four key benefits of the network:
- High-Speed Transactions: Fantom offers near-instant transaction finality, significantly enhancing the efficiency and user experience of Web3 platforms.
- EVM Compatibility: Fully compatible with the Ethereum Virtual Machine (EVM), Fantom allows developers to use familiar Ethereum tools, frameworks, and programming languages when building dapps for the network.
- Scalability & Security: Fantom’s innovative consensus mechanism and robust architecture provide a secure and scalable environment for blockchain-based projects, making it a great choice for developers.
- Extensive Ecosystem: Fantom supports a vast ecosystem of dapps across various industries, including finance, gaming, DeFi, and more.
What are Fantom RPC Nodes?
Fantom RPC nodes are servers, computers, and other devices responsible for storing data, validating transactions, propagating blocks, and much more. The Fantom blockchain consists of thousands of these nodes that together uphold the network’s security, operations, and efficiency.
So, what are Fantom RPC nodes used for?
- Data Storage: Nodes store blockchain data. Some store the entire history of the network, while others store only the most recent blocks.
- Transaction Validation: Fantom nodes are responsible for validating transactions and propagating new blocks across the network.
- Web3 Development: Nodes serve as gateways to the Fantom network, facilitating both the reading and writing of on-chain data. This makes them essential for developing dapps.
This overview highlights the crucial roles of Fantom RPC nodes. In the next section, we’ll introduce you to Moralis, which is the easiest way to set up a Fantom node for free!
Introducing Moralis – The Easiest Way to Set up a Fantom Node
Moralis is the Web3 industry’s most prominent node provider. With our intuitive user interface, you can seamlessly run blockchain nodes for 35+ chains at the click of a few buttons. As such, it has never been easier to set up a Fantom node than when working with Moralis!
But why choose Moralis?
- Speed: Our nodes boast quick response times from 70 ms, ensuring you get the data you need instantly.
- Reliability: We offer an impressive 99.9% uptime for all RPC nodes, built to the highest reliability standards.
- Security: Moralis is the only Web3 infrastructure provider with SOC 2 Type 2 certification, ensuring top-notch data security.
That gives you a quick introduction to our node service. In the next section, we’ll show you how to set up your own Fantom node for free using Moralis!
3-Step Tutorial: How to Set Up a Fantom Node for Free
We’ll now show you how to set up a Fantom node using Moralis. And thanks to the accessibility of our premier service, you can do so in three simple steps:
- Sign Up with Moralis
- Configure Your Node
- Integrate Your Node
Step 1: Sign Up with Moralis
To get started, the first step is to sign up with Moralis. To do so, simply click the “Start for Free” button located at the top right corner of the page:
Step 2: Configure Your Node
Visit “https://admin.developers.moralis.com/nodes” and click “+ Create Node”:
Select “Fantom”, followed by “Mainnet”, and hit “Create Node”:
Step 3: Integrate Your Node
Copy one of the URLs for your Fantom RPC nodes and integrate it into your project to interact with the chain:
That’s it; setting up a Fantom node is easy when using Moralis!
How To Call Your Fantom RPC Nodes
With your Fantom RPC nodes up and running, we’ll now show you how to use them in practice. More specifically, we’ll demonstrate how to fetch the native balance of a Fantom wallet using Ethers.js.
However, before you get started, make sure you have the following ready:
From here, you can now follow the five steps below:
- Step 1: Open your preferred integrated development environment (IDE), set up a new folder, launch the terminal, and initialize a project with this command:
npm init
- Step 2: Install Ethers.js with the following terminal command:
npm install ethers
- Step 3: Open “package.json” and add
"type": "module"
to the list:
- Step 4: Create a new “index.js” file and add the following code:
import { ethers } from "ethers"; const provider = new ethers.providers.JsonRpcProvider("YOUR_NODE_URL"); const address = "0xFC00FACE00000000000000000000000000000000"; const balance = await provider.getBalance(address); console.log("Balance: ", ethers.utils.formatEther(balance));
Replace YOUR_NODE_URL
with one of the URLs from your Fantom RPC nodes and configure the address
parameter to fit your request:
- Step 5: Execute the script with this terminal command:
node index.js
In return, you’ll get the balance displayed in the console. It should look something like this:
Balance: 1376515028.186726979773209772
Congratulations! You now know how to fetch data seamlessly using your Fantom RPC nodes!
However, if you want a more in-depth walkthrough of the above steps, along with additional examples of the types of data you can get with your nodes, check out the Moralis YouTube video below:
Exploring the Limitations of Fantom RPC Nodes
While querying data using RPC nodes is possible, it’s important to understand their limitations. As such, let’s explore three major drawbacks of using nodes:
- Chain-Specific: Blockchain nodes are tied to a specific network, meaning you need to run and maintain a node for each chain you intend to interact with. This can become expensive and resource-intensive, especially if you’re building cross-chain dapps.
- Complex to Query: Nodes don’t support straightforward queries such as, “What tokens does address X hold?” To get this info, you need to make multiple requests and manually compile the data.
- Raw Data: Nodes provide raw blockchain data that needs to be decoded, interpreted, and formatted before it becomes useful. This process can be both time- and resource-intensive.
So, what’s the alternative?
A more efficient option for querying on-chain data is using Moralis’ Web3 APIs. These premier interfaces allow you to query decoded data with single API calls, saving you time and effort. To learn more about how Moralis can streamline your workflow, join us in the next section!
Beyond Fantom RPC Nodes – Diving Deeper Into Moralis
Moralis is an industry-leading Web3 API provider, supplying you with over ten specialized interfaces for all major use cases. Some prominent examples include the NFT API, Wallet API, Token API, and many more. With these tools, you can effortlessly fetch decoded data with single lines of code for your wallets, portfolio trackers, decentralized exchanges (DEXs), or any other Web3 platforms you might be building!
But what makes our APIs industry-leading?
- One API – All the Data: Moralis’ Web3 APIs are outcome-oriented, designed to minimize the requests you need to build sophisticated dapps. Get data from both on-chain and off-chain sources in a single request.
- Streamlined Developer Experience: Our APIs are truly cross-chain compatible, giving you full feature parity across all major chains, including Fantom, Ethereum, Polygon, and many more. As such, when using Moralis, you can streamline your developer experience as you don’t have to integrate a new provider for each chain you intend to interact with.
- Trusted by Industry Leaders: Moralis is used and trusted by some of the biggest names in Web3, including MetaMask, Opera, and Blockchain.com.
That gives you a brief overview of Moralis. Let’s now dive a bit deeper into our suite of Web3 APIs and take a closer look at three prominent interfaces!
Wallet API
Moralis’ Wallet API offers a robust suite of features, exceptional flexibility, and unmatched scalability. Also, it supports over 500 million addresses across major blockchain networks, including Fantom, Ethereum, BSC, and many others, making it an ideal tool for developing cryptocurrency wallets.
With the Wallet API, you can effortlessly retrieve a wallet’s history, token balances, profitability, net worth, and more through ready-to-use endpoints. To demonstrate the accessibility and power of this tool, let’s explore the Wallet History endpoint as an example.
With just a single line of code, you can obtain a comprehensive history of a wallet, complete with automatic category tags, event summaries, and more. Here’s what it might look like:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://deep-index.developers.moralis.com/api/v2.2/wallets/0xF977814e90dA44bFA03b6295A0616a897441aceC/history?chain=0xfa', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Response:
{ [ { "hash": "0x35945e38cb85972ca9e71160e23a75ae2cdf3caf8709642e2e1251d42de5eea2", "nonce": "1559323", "transaction_index": "3", "from_address": "0xebf4fbb9c81b84dd5cf89bc75588e5d0018501b3", "from_address_label": null, "to_address": "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590", "to_address_label": "StargateToken (STG)", //... "erc20_transfers": [ { "token_name": "StargateToken", "token_symbol": "STG", "token_logo": "https://logo.developers.moralis.com/0xfa_0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590_d6716573db024088ab4aab0e69aa976f", "token_decimals": "18", "from_address": "0xebf4fbb9c81b84dd5cf89bc75588e5d0018501b3", "from_address_label": null, "to_address": "0xf977814e90da44bfa03b6295a0616a897441acec", "to_address_label": null, "address": "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590", "log_index": 4, "value": "5526914355000000000000000", "possible_spam": false, "verified_contract": true, "direction": "receive", "value_formatted": "5526914.355" } ], "native_transfers": [], "summary": "Received 5,526,914.35 STG from 0xeb...01b3", "possible_spam": false, "category": "token receive" }, //... ] }
Visit our Wallet API page to discover more about the capabilities of this industry-leading tool!
Token API
The Token API supports every single token across all the biggest chains. This includes stablecoins, meme coins, and everything in between. As such, with this tool, you can seamlessly streamline ERC-20 data integration for all your dapps without breaking a sweat.
With Moralis’ Token API, you only need a few lines of code to get token balances, transfers, liquidity data, metadata, and much more. To highlight the accessibility of this tool, we’ll look at our Token Balances with Prices endpoint as an example.
With just one call, you can get any wallet’s token balances with prices. Here’s what it might look like:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://deep-index.developers.moralis.com/api/v2.2/wallets/0xF977814e90dA44bFA03b6295A0616a897441aceC/tokens?chain=0xfa', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Response:
{ //... "result": [ { "token_address": "0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590", "symbol": "STG", "name": "StargateToken", "logo": "https://logo.developers.moralis.com/0xfa_0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590_d6716573db024088ab4aab0e69aa976f", "thumbnail": "https://logo.developers.moralis.com/0xfa_0x2f6f07cdcf3588944bf4c42ac74ff24bf56e7590_d6716573db024088ab4aab0e69aa976f", "decimals": 18, "balance": "5526914355000000000000000", "possible_spam": false, "verified_contract": true, "total_supply": "23157352728493329565962830", "total_supply_formatted": "23157352.72849332956596283", "percentage_relative_to_total_supply": 23.86677967814326, "balance_formatted": "5526914.355", "usd_price": 0.40294395256782295, "usd_price_24hr_percent_change": 9.211802565854372, "usd_price_24hr_usd_change": 0.03398753659359799, "usd_value": 2227036.71570754, "usd_value_24hr_usd_change": 187846.2038902447, "native_token": false, "portfolio_percentage": 3.3397 }, //... ] }
Check out our Token API page to learn more about the features and benefits of this premier tool!
NFT API
Moralis’ NFT API powers some of the biggest names in Web3, including MetaMask, Delta, and many more. This premier interface supports over three million NFT collections across the biggest chains, from established projects like Pudgy Penguins to tokens that dropped just seconds ago.
With the NFT API, you can seamlessly fetch NFT metadata, prices, balances, and much more. As such, this interface provides you with the tools to build powerful NFT-based projects. And to give you an example, we’ll explore our NFT Balance endpoint.
With just one line of code, you can effortlessly get the NFT balance of any wallet. Here’s what it can look like:
import fetch from 'node-fetch'; const options = { method: 'GET', headers: { accept: 'application/json', 'X-API-Key': 'YOUR_API_KEY' }, }; fetch('https://deep-index.developers.moralis.com/api/v2.2/0x727a10ae1afc91754d357b4748f6d793c9795026/nft?chain=0xfa', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Response:
{ //... "result": [ { "amount": "1", "token_id": "207", "token_address": "0xff35b597f47bbf952457c076e6b01480c896c1dc", "contract_type": "ERC721", "owner_of": "0x727a10ae1afc91754d357b4748f6d793c9795026", "last_metadata_sync": "2024-03-10T16:00:30.761Z", "last_token_uri_sync": "2024-03-10T16:00:29.971Z", "metadata": "{\"name\":\"Puff Panda\",\"description\":\"This Panda can puff, puff pass with the best\",\"image\":\"ipfs://QmZJfA4XwLAAy1YGJcbcUs5W6UidnxBnApG37FqL4mCvg9/puff-panda.png\",\"attributes\":{\"bunnyId\":\"0\"}}", "block_number": "34967253", "block_number_minted": "34967253", "name": "True Degenerates", "symbol": "TD", "token_hash": "3e4fdaf920a0c777bc4e4a7a777ced5f", "token_uri": "https://ipfs.developers.moralis.com:2053/ipfs/QmTqStASCgUuW1Qz6mL5rZPKgsJCxbijWYGnbcXAwu22sL/puff-panda.json", "minter_address": "0x727a10ae1afc91754d357b4748f6d793c9795026", "verified_collection": false, "possible_spam": false, "collection_logo": null, "collection_banner_image": null }, ] }
Visit our NFT API page to learn more about this premier interface!
Summary: How to Run Fantom RPC Nodes with Moralis
Setting up a Fantom node on your own can be a bothersome task. It requires a complicated underlying infrastructure that needs a lot of computational power, storage capacity, and bandwidth, which takes time and money to set up. Fortunately, you can now circumvent all associated challenges with a node provider like Moralis!
At Moralis, we handle all the underlying complexities for you. In return, you can use our simple point-and-click interface to run nodes for 35+ chains, including Fantom, at the click of a button. Here’s a quick breakdown of how it works:
- Step 3: Select “Fantom”, followed by “Mainnet”, and click “Create Node”:
In return, you’ll get two URLs for your Fantom RPC nodes:
That’s it! Setting up Fantom RPC nodes is simple when leveraging Moralis!
If you liked this Fantom RPC nodes tutorial, consider checking out more content here on the blog. Here are a few similar articles:
Also, if you want to run your own Fantom RPC nodes, remember to register an account with Moralis. You can sign up for free, and you’ll get immediate access to our industry-leading development tools!