Web3 Provider – Why Blockchain Developers Should Use One

Various elements such as the Ethereum blockchain, a crypto wallet, nodes, etc., and a text that says "Web3 providers - Why Blockchain Developers Should Use One".
Table of Contents

Knowing what a Web3 provider is, how a provider operates, and how to utilize one is imperative for any legacy dev wanting to transition to Web3. While the blockchain tech stack contains many providers, not all offer the same services. With that in mind, it’s important to know what you want to accomplish to determine what kind of Web3 provider you require. After all, in many instances, a reliable provider offering blockchain-based authentication is all you need to bring your killer dapp idea to fruition. Further, it all depends on what type of on-chain interactions you want to integrate and offer to your end users. 

Moving forward, this article first answers the “what is a Web3 provider?” question. That way, we introduce some additional clarity into today’s discussion. Next, we’ll explain why Web3 providers are important and much needed. We’ll also take a closer look at some Web3 provider examples. Last but not least, we’ll show you how to connect to the ultimate Web3 API provider, enabling you to develop excellent dapps easily. This means you will learn how to import Moralis’ JS SDK. Additionally, we’ll demonstrate how to implement Web3 authentication effortlessly. Of course, to make the most out of this article, we recommend you create your free Moralis account and follow our lead.

A digital globe with the word "Web 3.0" on it.

What is a Web3 Provider?

First, you must remember that Web3 is a relatively new era. Consequently, there’s a lot of inconsistency when it comes to all sorts of terms and phrases related to blockchain technology. This also comes to light when focusing on Web3 providers. As such, you’ll see many platforms and articles out there correlate Web3 providers with Web3 node providers. However, node providers are just specific types of providers. You also have Web3 API providers, Web3 wallet and authentication providers, and other blockchain development tool providers. To better understand our definition of Web3 providers, it helps to take a look at the current blockchain tech stack:

The five layers outlined that contain dapps, Web3 and Web2 dev tools, APIs, Nodes, and Networks.

If you’d like to dive deeper into each of the five layers, use the “blockchain tech stack” link stated at the outset of this article.

Looking at the above image, you can see that there are five layers of the blockchain tech stack. Essentially, each of the above-presented five layers contributes to Web3. Accordingly, it’s technically correct to classify most Web3 dev platforms, tools, and even utility dapps as Web3 providers. Nonetheless, even every programmable blockchain (the first layer above) is a Web3 provider. After all, without blockchain networks, such as Ethereum, Solana, and BNB Chain, Web3 would not be possible.

Ultimately, a Web3 provider is a service, or a tool, that supports Web3 development and interaction with blockchains. Moreover, the most common and essential Web3 providers come in the form of Web3 node and Web3 API providers. Hence, we’ll focus on these two types in this article. 

A digital art piece showing three digital users at a desk with various Web3 tools, such as computers.

Why They are Needed

Now that you know what Web3 providers are, it’s time you learn why we need them. When it comes to blockchain network providers, they create the foundation of Web3. All other types of providers make blockchain development a whole lot simpler. Without these providers, developers would need to run their own full nodes and build an entire backend infrastructure from scratch. That said, let’s take a closer look at what purpose Web3 node providers and Web3 API providers serve. 

An illustrative image showing multiple lines connecting each other.

Why We Need Nodes and Web3 Node Providers

In case you’re not yet familiar with RPC nodes, note that they are pieces of software that connect with other nodes on the same blockchain. Also, full nodes have a complete copy of the current specific blockchain’s state. So, for instance, Ethereum RPC nodes connect to other nodes and contain the state for the Ethereum chain.  

It also helps to use a CPU analogy for blockchains: “Just like you don’t interact with the CPU when creating applications, you wouldn’t want to interact directly with the chains when building dapps“. This is where the need for nodes appears. Hence, the core purpose of Web3 nodes is to communicate with blockchains. Basically, nodes enable us to speak with the blockchain and access its data. 

Moreover, it’s worth pointing out that, technically, anyone can run a node. However, in many cases, running a node is a full-time job that requires a team for maintenance, proper backups, and much more. Accordingly, it would be extremely impractical if all Web3 developers needed to run their own nodes. With that in mind, let the Web3 node providers worry about running the nodes. 

A motherboard with a core with "Crypto API" embroidered.

Why We Need Web3 APIs and API Providers

While nodes are great, they are still rather primitive pieces of technology. For instance, a Web3 node is not able to provide you with details, such as users’ balances. Also, nodes are only able to focus on one chain and aren’t able to cover multiple smart contracts. Furthermore, nodes only give you the raw data from the blockchain, and you would need to develop your own infrastructure to use that raw data. Fortunately, you can use Web3 APIs instead. 

APIs are sets of definitions and protocols for building and integrating applications. With that in mind, Web3 APIs support dapp development. Essentially, Web3 APIs are some of the core tools that enable dapp developers to avoid reinventing the wheel. After all, APIs offer a straightforward way for a piece of software to interact with other pieces of software. Moreover, reliable APIs enable consistent coding in a stable environment. Hence, there’s obviously a great need for high-quality Web3 API providers. Fortunately, there are already several reliable solutions at your disposal.

So, by using these Web3 providers offering APIs, you can utilize their established connections with the nodes. As such, by using a reliable API provider, you don’t have to worry about connecting to nodes. Moreover, when interacting with these providers, you effortlessly obtain all sorts of precious precompiled and precalculated on-chain data. 

Outlining various Web3 providers with their logos, including Moralis, Covalent, The Graph, QuickNode, and Alchemy.

Examples of Providers

New parties are entering and presenting themselves as reliable Web3 providers regularly. However, only a handful of Web3 node and API providers stand out and prove to be reliable, solid options. You can find them listed below.

Leading Web3 Node Providers:

  • Infura
  • Alchemy
  • Chainstack
  • GetBlock
  • Pocket Network
  • QuickNode
  • RunNode 

Leading Web3 API Providers:

  • Moralis
  • Covalent
  • QuickNode
  • The Graph
  • Bitquery
  • Alchemy
  • Biconomy

There’s a reason why Moralis is listed at the top of the API list – it is the ultimate Web3 API provider. It’s also the leading Web3 authentication provider and the foremost NodeJS Web3 provider. Hence, it enables you to implement any top Web3 authentication method with single lines of code. Moreover, it is the go-to tool that allows you to use the NodeJS environment to cover your dapps’ backend. This means that you can develop killer dapps using your JavaScript proficiency. 

In addition, Moralis is also fully cross-platform interoperable. As such, it supports all leading legacy programming languages and dev platforms. Nonetheless, this authentication provider is also all about cross-chain interoperability. Thus, you easily deploy your dapps to any of the leading blockchains. As a result, you future-proof your work by never being stuck to any particular crypto network.  

A purple background with a world map on top of it and a digital cloud that has connections to each continent.

Now that you know what Moralis is, it’s time we show you how to connect to this NodeJS Web3 provider without breaking a sweat.

How to Connect to a Web3 Provider?

When it comes to using Moralis as a NodeJS Web3 provider, you can choose between the basic and advanced Moralis SDK initialization. The basic setup will suit most of your needs. However, use the advanced setup if you want more control over what modules to add to Moralis. By looking at the details below, you will understand what we mean. 

A wizzard pointing at a text that says "Moralis - Ultimate Web3 Provider".

Basic Initialization of the Ultimate NodeJS Web3 Provider

Start by installing Moralis via your favorite package manager. Remember that the easiest way to integrate the Moralis SDK into your JavaScript project is through the npm module. 

  • If you use yarn, enter:
yarn add moralis
  • If you use npm, enter:
npm install moralis
  • If you use pnpm, enter:
pnpm add moralis

After successfully installing Moralis, you need to initialize it. To do so, use the “start” method:

import Moralis from 'moralis';

Moralis.start({
  apiKey: '<YOUR_API_KEY>',
});

Looking at the above lines of code, you can see that you need your Moralis Web3 API key. As such, make sure to log in to your Moralis account. By doing so, you’ll land on your admin area, where you can copy your API key:

Showing a user's admin page after logging in to Moralis. We also see the Web3 API page where the user can fetch their API key.

Then, replace the “<YOUR_API_KEY>” placeholder with your actual API key. With your key in place, you can use any Moralis functionalities defined in Moralis’ NodeJS SDK references.

Furthermore, you can also set a specific configuration by calling “Moralis.start(config)“. Here’s an example of that:

Moralis.start({
  apiKey: "YOUR_API_KEY",
  formatEvmAddress: 'checksum',
  formatEvmChainId: 'decimal',
  logLevel: 'verbose'
})

Moreover, use the following image to find the possible options for the configuration:

Showing various commands to implement into the user's code editor.

Advanced Initialization of the Ultimate NodeJS Web3 Provider

As noted above, the basic initialization of the ultimate NodeJS Web3 provider will work in most instances. However, in some specific situations, you might want to install only specific packages instead of the “moralis” umbrella package. These are the currently available packages:

  • @moralisweb3/core
  • @moralisweb3/auth
  • @moralisweb3/evm-api
  • @moralisweb3/sol-api
  • @moralisweb3/evm-utils
  • @moralisweb3/sol-utils

In addition to any of the above-listed packages, you always need to install the “@moralisweb3/core” package. Let’s look at an example to clear the air. So, here are the commands to use in case you want to focus on the Moralis EVM API:

  • If you use yarn, enter:
yarn add @moralisweb3/core @moralisweb3/evm-api
  • If you use npm, enter:
npm i @moralisweb3/core @moralisweb3/evm-api
  • If you use pnpm, enter:
pnpm add @moralisweb3/core @moralisweb3/evm-api

Next, you need to register the modules to the core package at the top of your code: 

import MoralisCore from '@moralisweb3/core';
import MoralisEvmApi from '@moralisweb3/evm-api';

const core = MoralisCore.create();
// Register all imported modules to the @moralisweb3/core module
core.registerModules([MoralisEvmApi]);

With the modules registered, you get to initialize the app in a similar manner as described in the steps covering the basic initialization of the ultimate NodeJS Web3 provider:

core.start({
  apiKey: '<YOUR_API_KEY>',
  // ...and any other configuration
});

Following the above lines of code, you can use any functionality included in the installed modules. Of course, you also need to call the correct module in your code:

import MoralisEvmApi from '@moralisweb3/evm-api';
import { EvmChain } from '@moralisweb3/evm-utils';

const evmApi = core.getModule<MoralisEvmApi>(MoralisEvmApi.moduleName);
evmApi.block.getBlock({
    chain: EvmChain.ETHEREUM,
    blockNumberOrHash: "",
});

Using the Ultimate Web3 Authentication Provider

At this point, you already know that you can use the power of Moralis’ Web3 Auth API by initializing the “moralis” umbrella package or the “@moralisweb3/auth” package. With that in place, you can start implementing various Web3 login solutions offered by this Web3 authentication provider. As such, you can equip your dapps with the following verification solutions:

  • MetaMask
  • WalletConnect
  • RainbowKit
  • Web3Auth
  • Magic.Link  

MetaMask and WalletConnect are the leading options when targeting experienced crypto users. However, if you wish to onboard Web2 users, you may want to focus on dynamic Web3 authentication alternatives offered by Web3Auth and Magic.Link. Moreover, if you want to understand exactly how Moralis as a Web3 authentication provider works, check out Moralis’ Auth API overview. Also, you can find demos for all supported Web3 login solutions in the Moralis docs (the “HOW TO GUIDES” section):

Showing Moralis' documentation page and its left-navigation tab with multiple tutorials.

Finally, let’s look at an example of what a simple frontend with MetaMask authentication would look like when using Moralis’ MetaMask integration. Here is an entire Web3 authentication sequence: 

Web3 provider MetaMask's login sequence.

If you’d like to build that sort of dapp, check out the “Sign In with MetaMask” tutorial.

Web3 Provider – Why Blockchain Developers Should Use One – Summary

We covered quite a distance in today’s article. First, we explained what a Web3 provider is and why you may want to use one. As such, you discovered that when using Web3 node and API providers, you can save time and resources when creating dapps. Moreover, we listed some of the reputable Web3 node and API providers, and you saw that Moralis is the ultimate Web3 API provider. Furthermore, you learned why Moralis is also the best NodeJS Web3 provider and Web3 authentication provider. Last but not least, we demonstrated how to initialize Moralis’ JS SDK. As a result, you now know how to use JavaScript to utilize Moralis’ full power.

If you are ready to start building, we encourage you to start with the tutorials this article shares. However, feel free to explore other example projects covered in the Moralis docs, on the Moralis YouTube channel, and the Moralis blog. These resources can help you become a Web3 developer for free using your legacy programming knowledge. Moreover, they are excellent sources for continuous, free blockchain development education. For instance, some of the latest topics explain how to create an NFT project, what the Sui blockchain is, how to go about building Ethereum dapps, how to create a Web3 Firebase login with MetaMask, and much more. 

On the other hand, you might be interested in going full-time crypto sooner rather than later. In that case, you may want to consider becoming blockchain certified by completing some of the courses at Moralis Academy. In case you’re new to the crypto realm, we recommend starting with the “Blockchain and Bitcoin 101” course!

November 6, 2022
Join the Moralis Community
Get the latest Moralis Web3 news and updates via email.
Search
Generic filters
MOralis launched
Streams API
Real-Time blockchain data delivered to your backend via webhooks. Used by the biggest dapps.
Real-Time blockchain data delivered to your backend via webhooks. Used by the biggest dapps.
Follow us on Twitter
Real-Time blockchain data delivered to your backend via webhooks. Used by the biggest dapps.
Related Articles