If you’re looking to build dApps (decentralized applications), you’ll find that you’ll often need to have access to a full node. This is true whether your dApp is, for example, an Ethereum, Binance Smart Chain or Polygon project. A node can make the development process a lot easier since it can be used to upload smart contracts, check the balance of different users, and change MetaMask from Ethereum to the desired network. However, manually setting up your own node can be a major pain. This is why blockchain node providers are becoming increasingly popular, and Moralis’ Speedy Nodes provide some of the fastest nodes on the market. Let us in this article take a closer look at the process of how to connect to Polygon nodes with Moralis.
Without a service like Moralis, the process for how to connect to Polygon nodes can be truly challenging. However, Speedy Nodes makes connecting to Polygon nodes a lot more manageable, and hugely simplified. As such, you should keep in mind that the best way to connect to a Polygon node is by using Moralis – now we’ll explain why!
Moralis is an easy-to-use platform for developing serverless dApps. The platform provides everything needed for deploying dApps. What’s more, Moralis’ infinitely scalable Web3 backend infrastructure makes the development process more comfortable. As this is the best way to connect to Polygon nodes, we will take this article to focus on how this is done using Moralis.
What makes it even more convenient is that it is possible to join Moralis completely free! It is possible to design and build a dApp in just a few minutes with the tools provided by Moralis. If you have an interest in becoming a dApp developer, then do not hesitate to sign up with Moralis right away!
What is Polygon?
Before diving deeper into how to connect to Polygon nodes, it might be a good idea to take a closer look at what Polygon is.
Polygon is a framework and protocol for building Ethereum-compatible blockchain networks. Polygon supports a multi-chain Ethereum ecosystem and aims to solve some of the main issues with other networks. According to their website, the protocol solves issues with high gas fees and the speed at which transactions occur. Furthermore, they solve these issues all while keeping a high level of security.
As this is a multi-chain system, Polygon combines the Ethereum blockchain with sovereign blockchains. Moreover, this combination provides the protocol with a great set of features. Here are some of the main features of Polygon:
- Scalability – Polygon features scalability; for example, they provide a scalable consensus mechanism and customizable Wasm environments.
- Security – They provide a modular security-as-a-service model. This can be either supplied by Ethereum or by a set of validators.
- User Experience – The user experience of Polygon is supposedly comparable to that of a traditional Web2 service. There is also a possibility for ”zero gas” transactions and instant transaction finality.
- Modularity — Polygon offers a high degree of customizability, upgradability, and extensibility. Furthermore, Polygon offers a short time-to-market which in many cases can be convenient for developers.
However, this is not all that they offer, and if you want to learn more about the Polygon Network, formerly known as the Matic Network, a place to start would be to visit their official website. Here you will find more in-depth information regarding the protocol and how to use it.
How to Connect to Polygon Nodes Using Moralis
The first thing that you need to do to start the process of connecting to Polygon nodes is to sign up for free at the Moralis website. As soon as your account is created, the next step is to log into the account.
Once logged in, you will find a menu at the left of the screen with a selection of different tabs. To connect, you will click the ”Speedy Nodes” tab. Once clicked, you will be presented with three different alternative networks, the ETH Network, BSC Network, and, of course, the Polygon Network. As we are looking closer at how to connect to Polygon nodes, this is the alternative that we will click on. Clicking the ”Endpoints” button will provide us with URLs for both the Polygon mainnet and the Mumbai testnet. Furthermore, Moralis also provides the users with access to an archive node for both the mainnet and testnet.
For those unfamiliar with this concept, an archive node is a node containing previous states of the blockchain. This means that we can go back in time and examine the state of the blockchain at a given time. Therefore, we can discover balances, smart contracts, and other interesting information that might be of use to us at any given time of the chain’s existence.
Moralis Endpoints for Connecting to Polygon Nodes
So, what exactly are these endpoints that you get access to when signing up with Moralis? You can basically regard the URLs that Moralis provides as the Polygon node itself. It does not matter which URLs you choose; it is possible to interact with the URLs in, for example, the command line and in different projects. This means that it is possible to communicate with the URL and use it to create applications through Moralis.
In the following video, you will get a more in-depth tutorial on connecting to Polygon nodes. Along with detailed instructions on how to complete the process, the walk-through also provides two examples of how to use the URL when making two simple applications. Furthermore, one of the examples demonstrates how an archive node works and in what situations they are helpful.
Setting up MetaMask with a Polygon Node
Along with using the nodes when developing dApps, it is also possible to connect your MetaMask wallet with the nodes. If you are unfamiliar with MetaMask, we recommend that you look at the following article, which is a breakdown of MetaMask and how to set up an account.
If you do not already have a MetaMask account, this is the first thing that you need to do. As you are logged into your account, you will need to add a new network. To add a new network, all you need to do is to press the ”Networks” tab at the top of the MetaMask application and choose the ”Custom RPC” alternative.
If this alternative is clicked, you will have the option to add a custom network. To do this, you will give the network a name, preferably ”Polygon”, in this case. Furthermore, the network requires a URL which can be acquired in the same way as before. So, here you need to decide if you want the mainnet or the testnet. In the case of connecting to MetaMask, the archive nodes do not really fulfill a function; therefore, we recommend that you just use the regular nodes. The reason for this is that the archive nodes are more useful when developing technical projects that need to access the historical data of the chain.
Furthermore, the dropdown menu will also ask for a Chain ID and a Currency Symbol when adding a new network. The Currency Symbol for Polygon is MATIC, and the Chain ID is 137. However, if there is any trouble with the Chain ID, the MetaMask application will suggest another ID that will work. Once you are done inputting the information, you can hit the ”Save” button, and your MetaMask account will be connected to Polygon.
What are Speedy Nodes?
We previously mentioned Moralis’ Speedy Nodes functionality. However, we recognize that this might be a term some are unfamiliar with. As this could be the case, let us look at what Moralis’ Speedy Nodes are and why they are helpful.
Moralis Speedy Nodes help you with the setup of connecting our projects, as well as our MetaMask accounts to the desired network. As this is the case, it is evident that the Speedy Nodes are part of the convenience that Moralis brings to its users. So, what exactly are Speedy Node, and what do they entail?
Essentially, a Speedy Node is a type of node that is useful in that they are very developer-friendly. Speedy Nodes have all the same functionality you would expect from a regular ETH, BSC or Polygon node, but have exceptional speed, high reliability, and are fully integrated with Moralis. They are, therefore, much appreciated when developing dApps.
Furthermore, Moralis does not only provide Speedy Nodes for Polygon; there are also alternatives for both Ethereum and the Binance Smart Chain. Be sure to check out this article if you are interested in learning more about how to connect to a Binance Smart Chain node.
Essentially, Speedy Nodes makes it easier to run a node. It is possible to choose between the test/mainnets and whether your node should be an archive node. This means that Speedy Nodes are an efficient and reliable way to acquire a node for all developers who need to run a node.
However, if you want more detailed guides on using these nodes, we recommend checking out the Moralis YouTube channel. Here, for example, you will find a great video of Ivan on Tech explaining what Speedy Nodes are in more detail:
What are Archive Nodes?
We touched on what an archive node is previously in the article, but we will dive a bit deeper to understand these nodes better. As we mentioned, Moralis’ Speedy Nodes feature so-called full archive nodes. These nodes are quite unique and can, in some cases, be very useful for development. Archive nodes are essentially nodes that contain previous states of a chain.
This means that archive nodes contain everything that’s kept in the full node, plus a record of different historical states. As a record of the states exists, it is possible to look into the past. This means that it is possible to see past states of the nodes and access historical information. The ability to do so can be helpful when, for example, using block explorers.
This essentially means that it is possible to find information regarding past states at a given block. However, as archive nodes function in the same way as a regular node, and provide the history, it consequently means that they are very large. Moreover, it is not always necessary to use archive nodes, but in some cases, they can behelpful. Furthermore, they are always available to Moralis users, for any circumstances when they might be useful.
There is more information available about all Speedy Nodes on the Moralis YouTube channel. Here you will find guides for both Polygon and Binance Smart Chain, whichever one you are interested in connecting to your projects.
How to Connect to Polygon Nodes – Summary
Having access to nodes of major networks such as the Polygon protocol makes your development process dramatically easier. The ability to upload contracts, check transaction history and connect MetaMask to Polygon are just ways nodes can be used.
However, the process of finding a working, reliable and fast node can be challenging in some cases. Luckily for you, all you need to access a fully functioning Polygon node is to sign up with Moralis.
Moralis provides its users with easy access to nodes, such as Ethereum, Binance Smart Chain, and, of course, Polygon. These are Moralis’ Speedy Nodes, and are great for Web3 app or dApp development in that they are both stable and fast. Along with this, Moralis also provides archive versions of the nodes.
These nodes can be used to access historical states of the blockchains and see, for example, what smart contracts were running and what balances users had at a given time. What’s more, Moralis’ Endpoints are free, and can be accessed as soon as an account has been created.
However, if you are interested in learning more about connecting to Polygon nodes, we suggest that you take a closer look at the official Moralis documentation. In the documentation, you will find a couple of videos explaining the process and how to connect MetaMask to Polygon. This means that you can follow along in the video and not miss a beat.
Furthermore, if you are interested in becoming a dApp developer, we recommend signing up for free with Moralis. By doing so, you will receive access to a variety of tools helpful for dApp development.