If you’re building a Binance project, you will, in all likelihood, need to have a node. For example, you might need to have a node in order to upload smart contracts. You need a node to switch your MetaMask from Ethereum to Binance Smart Chain. In order to check the current balances of different users, you may need a node. However, finding a Binance Smart Chain node, especially a full-archive Binance Smart Chain node, is not always easy. This is why this article breaks down all the steps you need to connect to a Binance Smart Chain node. In this article, we show you the best place and method for getting your Binance Smart Chain code – in a fast, reliable, and stable way. Read on to learn more!
Are you confused about connecting to a Binance Smart Chain node? The best way to connect to a Binance Smart Chain Node – or BSC node – is, of course, by using Moralis. For those of you unaware, Moralis is a fully managed, infinitely scalable Web3 app backend infrastructure tool. Moralis handles all the hassle you might typically associate with setting up, launching, and managing a dApp or Web3 app backend. Read on for the best way to connect to a Binance Smart Chain node and be amazed at how easy Moralis makes it!
For those of you who do not yet feel ready to build your own dApps or Web3 apps, fret not! There’s an easy solution for you as well. Simply join the world’s largest blockchain academy at Ivan on Tech Academy, and enroll in cutting-edge crypto-related courses. We offer courses that’ll take you from complete beginner to C++ Programming and JavaScript Programming for Blockchain. What are you waiting for? Enroll today!
Connecting to a Binance Smart Chain Node (BSC Node)
What you will need in order to connect to a Binance Smart Chain node easily is a so-called Speedy Node. We will go into greater detail about what constitutes a Speedy Node further on in this article. To get a Binance Smart Chain Speedy Node, you will need to go to moralis.io and sign up. Once you’ve done this, you then go to Speedy Nodes in the menu on the right-hand side of your screen.
When you’ve navigated to this page, you should click on the Endpoints button on the yellow Binance Smart Chain icon. This will present you with both mainnet and testnet URLs. Best of all, this gives you access to both normal nodes and archive nodes.
For those unfamiliar with what an archive node represents, this is essentially a node containing a lot of previous states. So, what does this mean in practices? Well, the fact that it contains many previous states means you can essentially ”go back in time” using your archive node. You can see what balances, what smart contracts, and what things happened at previous points in time. As such, archive nodes give you data for days.
Moralis Endpoint URLs for BSC Nodes
So, how does this actually work? You will see that Moralis presents you with URLs for the different Endpoints or nodes. You are going to need to choose the URL you want and decide whether you want a URL for the mainnet or testnet. Moralis gives you these different URLs right on the Endpoints screen.
Put very simply, you can regard the URL as being your node. Specifically, you can interact with this URL from the command line, you can query it from the command line, you can use it in the command line, and you can use it in different projects. Essentially, this is your node that you can talk to and ask whatever you want. Those of you with prior experience with nodes can liken this to a Geth node for Ethereum you would ask what the current block is, what the current balance is, what is happening on the blockchain etc.
Set Up MetaMask with Speedy Node
Once you’ve gotten to this stage, it is to integrate MetaMask and get MetaMask to use Speedy Node. First of all, you copy the URL for the Binance Smart Chain node – or BSC node – and go to MetaMask. In MetaMask, you should go to Networks and choose custom RPC. At this point, you need to give the network a Network Name, such as ”BSC Mainnet”. Additionally, you need to give it a New RPC URL, which is your Speedy Node URL from Moralis.
For MetaMask implementations of this, you won’t need to bother with archive nodes. As we’ve stated previously, you might need archive nodes in more technical projects that require access to historical states. Nevertheless, in most casual use cases like this, you will be fine without using archive nodes. The final steps to setting up your Binance is providing the Chain ID for Binance Smart Chain, which is 56. Additionally, you will need to add the currency symbol (BNB), and a block explorer URL like https://bscscan.com. After this, you simply hit Save, and now you’ll have your account running on Binance Smart Chain. Now you’re done with this part!
It is worth mentioning that this works even when you are querying from the command line. For example, if you use cURL for a post request in the command line, you can, e.g., ask the node for the current block number. If you execute this, you will get the current block number result in hexadecimal. Simply go to Google to translate the hexadecimal number to decimal. If you then go to, e.g., bscscan.com to cross-reference this, you’ll see that this block was produced roughly 20 seconds ago (when you executed the command). Albeit unnecessary, this demonstrates that Speedy Node URLs work even in the command line!
What is Speedy Node?
If you want to learn more about the technology underpinning this easy way to connect to a BSC node, or Binance Smart Chain node, read on! You can see that a big part of Moralis’ ease-of-use for this specific use case is Speedy Node. So, what is Speedy Node? Speedy Node is a very special type of node that has both exceptional stability and exceptional speed. In that Speedy Nodes provide both quick and reliable nodes, they are incredibly versatile for developers. What’s more, Moralis’ Speedy Nodes provide support for Ethereum, Binance Smart Chain, Polygon (formerly Matic) and many yet more to come.
As previously discussed in the guide for connecting to a BSC node, Speedy Node makes it exceedingly easy to get your node URL. You can choose freely between separate node URLs for mainnet, testnet, mainnet archive nodes, and testnet archive nodes. Once you’ve clicked on the network you’d like (ETH Network, BSC Network, or Polygon Network) copy the desired environment link. Furthermore, Speedy Nodes are for those who need a fast and reliable full node but might already have their own backend. It is possible to connect to your Speedy Node by importing either a web3.js library or an ethers.js library. If you need a more comprehensive walkthrough, be sure to check out the Moralis YouTube channel for daily updates on Speedy Node!
You can easily get access to Speedy Nodes by signing up for a free Moralis account at moralis.io! Be sure to take advantage of Speedy Nodes and the many, many other innovative features Moralis provides!
What is an Archive Node?
Seeing as Moralis also features support for archive nodes through Moralis Speedy Node, it might be worth going through this. As we’ve previously alluded to, archive nodes are a certain type of nodes you might sometimes work with. Although archive nodes aren’t necessary when you are going to connect to a BSC node, they are still useful. In our instructions explaining the best way to connect to a Binance Smart Chain node, we mention that archive nodes are nodes containing previous states. What does this mean in practice?
Well, an archive node is a node that keeps everything that is also kept in the full node. Moreover, they build an archive of many different historical states. This essentially gives you the ability to look into the past of the node. An archive node means you are not merely limited to the current state of the node. Instead, you can see past states of the node. This can be useful, for example, when using block explorers.
Essentially, an archive node is, therefore, really only useful when you must see a past state at a given block. Naturally, archive nodes exist both for mainnet nodes and testnet nodes and provide a history of the chosen network.
To put it simply, an archive node is a type of node that stores the full history of a blockchain. They work much in the same way that a normal node does. However, seeing as an archive node contains many different historical states of a network, they tend to be very large. Archive nodes are not always necessary, but when they are necessary, Moralis is always very useful in providing them.
Best Way to Connect to a Binance Smart Chain Node – Summary
To summarize, all you need to do to connect to a Binance Smart Chain node is go to Moralis. When at moralis.io, you simply sign up with an account, and you go to Speedy Nodes. You then go to Binance Smart Chain and click Endpoints. Here you will see all the information you’ll need for connecting to both nodes for mainnet and testnet. Additionally, Moralis comes with support for archive nodes. You can then easily copy the URL for the environment you desire. Follow the steps outlined in this article, and you’ll be able to connect to a BSC node in no time!
If you think this way to connect to a BSC node seems revolutionary, you should check out more of Moralis! In a nutshell, Moralis is the way Web3 apps and dApps should be built. Importantly, Moralis is built by a highly skilled team that we can strongly vouch for. As such, you can be sure that Moralis will be of the same high quality you’ve come to expect.
What’s more, if you are still too new to blockchain, crypto, and Web3 to be interested in developing your own dApp, don’t worry! Ivan on Tech Academy is still the best place to go for blockchain education. Join over 30,000 existing students that are going from zero to blockchain hero using Ivan on Tech Academy. Enroll and get access to world-class courses like our popular entry-level courses discussing Blockchain and Bitcoin or Ethereum.