Do I Need a Blockchain Node Provider For My Web3 dApp

Untitled

Share This Post

What Are Blockchain Nodes?

Blockchain nodes are connection points in a decentralized, distributed peer-to-peer (P2P) network. Each node is responsible for independently validating and maintaining a shared public ledger. There are two primary goals for a blockchain node: validation and consensus. Validation is the process of cryptographically ensuring the integrity of the blocks, and consensus has to do with the correct ordering of these blocks.

As you can agree, coming to a consensus on anything where you have many opinions isn’t easy!  The two most common agreement methods in Blockchain are Proof-Of-Work (PoW) and Proof-Of-Stake (PoS). No matter what is used, they have one thing in common: they rely on full nodes to validate transactions. In public blockchains, anyone can run a full node, which is how decentralization is achieved.

Nervos uses NC-MAX, a tweaked version of the PoW mechanism that Bitcoin relies on for validation.  PoW is a consensus mechanism that requires blocks to be validated and ordered by solving non-trivial, computationally challenging puzzles.

In the case of PoW, when a miner has found the correct answer to the puzzle, they can send it out to the network for validation. If enough miners validate the solution, the blockchain adds the block.

In terms of storage, some blockchains might require nodes to store the entire set of blocks, like in Bitcoin, and others might require just the block header of the previous transaction, like in Bitcoin Light. Other blockchains can have different schemes based on the intention and design of the network.

In summary, the three essential functions of a blockchain node include the following:

  1. Approving and rejecting blockchain transactions
  2. Storing blocks in the correct order
  3. Communicating with other nodes in the blockchain

What Kinds Of Nodes Exist?

Untitled

Source

There are many types of blockchain nodes. The two main categories are full nodes and lightweight nodes.  Full nodes contain the entire blockchain history and allow operators to participate in that blockchain’s consensus. In contrast, lightweight nodes require operators to store only the block headers, saving users’ storage space.

Full Nodes

Full nodes are constantly communicating with other nodes in the network to try and come to an agreement (consensus) on the state of the blockchain. In doing so, full nodes are compensated for their work (in the case of PoW) or stake (in the case of PoS) through block rewards. Full-node operators can help shape the future of a network by voting on proposals. Sometimes disagreements occur, leading to a forked version of the blockchain, as with Bitcoin Cash.

Lightweight (SPV) Nodes

Lightweight nodes, or Simple Payment Verification (SPV) nodes, query the current status for which block is the latest one and broadcast transactions for processing. These nodes are not resource-intensive and allow users to transact with blockchains easily.

Lightning Nodes

Lightning Nodes are also known as payment channels. The idea is to create connections between users outside of a blockchain. Users can use the blockchain to open and close a payment channel, eliminating the need to fill the network with space-wasting data.

Pruned Full Node

A pruned full node allows users to set a storage limit of their choice and only retain the block headers of old blocks. To accomplish this requires the user to download the blocks from the beginning, and once the storage limit is reached, the oldest blocks get deleted, and their headers are retained.

Archive Nodes

An archive node is synonymous with a full node; they store the full history of the blockchain. It should be noted that not all archival nodes can add blocks to the blockchain.

Master Nodes

Master nodes allow users to keep a record of transactions and validate them to earn rewards. However, master nodes do not add blocks to the blockchain. Master nodes allow a large investment, and setup isn’t always easy.

Mining Nodes

Mining nodes are what you likely are already familiar with. These nodes allow users to add blocks to the network by verifying transactions.

Staking Nodes

Staking nodes allow users to buy coins, hold them, and receive interest back as a reward.  The main characteristic of a staking node is that the more coins “staked,” the higher the chance you get to create the next block and thus receive the block rewards for that block.  Factors can include how long you’ve held your coins, how many you have, and luck!

Authority Nodes

You may be familiar with the blockchain trilemma, which states that you can’t have security, scalability, and decentralization simultaneously.  At best, you can have two. Authority nodes are permission-based, centralized nodes that favor scalability over security and decentralization. They have few storage requirements, lower levels of trust, and increased vulnerability. These kinds of nodes, such as Delegated Proof of Stake, Delegated Byzantine Fault Tolerance, Proof of Authority, and others, solve the slow transaction times experienced by many blockchains today.

Why Does Your dApp Need Nodes?

Untitled

Source

If you are creating applications that need a blockchain, then you need a way for that application to communicate. Your application could be anything from a Web3 game that stores NFTs that give users privileges, a decentralized music-sharing platform, a simple bot that sends notifications about transactions, or a complicated payment system that requires lightning-fast transactions. All of these applications, and their respective transactions, require a node to communicate with the network.

For a dApp developer, there are different ways that communication happens when it comes to their projects and the nodes they use.

dApp Only Communication With the Blockchain

You may create a dApp that handles all communications with the blockchain directly, having the user interact only with the dApp website. In this scenario, you might have set a goal to shelter the user from unnecessary details that don’t add to their experience.

User Communicates Directly With Blockchain

You may create a dApp that only queries the blockchain to help build transactions. Then the user interacts directly with the blockchain to process those bundled transactions. Use cases might include users signing their signature on smart contract transactions.

A developer may choose their dApp to run on a full or lightweight node hosted either on a node they run themselves or on a hosted server via 3rd party intermediary. These choices all depend on the project’s requirements for security, scalability, and decentralization, as well as the developer’s level of skill in setting up a node, desire to maintain the nodes, and ability to secure the necessary hardware to host a node properly.

Running Your Own Nodes

Running your own node means you don’t ask other people what their version of the blockchain is–you have a full copy yourself.  The whole goal of the crypto space is to make things as decentralized as possible. Running your own node helps create a more secure network and has other usability benefits.

Running Your Own Node – Increases Privacy

Did you know that there are surveillance companies that run nodes on blockchains? When your wallet polls the network for your account balance, it does so by a random node. That random node could belong to a surveillance company!  Yes, it’s true!  These companies can potentially get your IP address (which can be used to identify you), your wallet, and balances on that wallet, now and in the future. Not a spectacular scenario. Running your own node protects your privacy.

Running Your Own Node – Gives Increases Decentralization

Since you do not need to rely on any intermediary, having your own node is one of the most secure ways of operating on a blockchain. Running your own node also helps strengthen the network overall, and each node added makes the network more secure.  This increased security is tied directly to the overall decentralization of the blockchain.

Running Your Own Node – Gives You Faster Queries

When using a local full node, querying is much faster. If you are a developer, this gives the best experience to your users if you need to pull data to display to them. Many projects find that parsing the blockchain for specific data is exponentially faster on a local copy when compared to querying a node using a 3rd party intermediary.

Running Your Own Node – Has Better Monetary Incentives

This one is pretty obvious. Running your own full node allows you to participate in that blockchain’s consensus mechanism and earn block rewards for mining or validating blocks.

Running Your Own Node – Gives You More Control

Hosted nodes can go down from time to time. If you rely on them, you are subject to their issues and are at their mercy regarding the urgency they take in fixing these situations. Node providers are often lackluster in the maintenance of their nodes, and the software can become outdated. For instance, some providers might only support a mainnet but no testnet.  Lastly, node providers are often the target of malicious hacks.

Why Wouldn’t I Run My Own Node?

You wouldn’t want to run your own node for a few reasons.  It might be overkill for your project, have high setup and maintenance requirements, you might not have the storage space or bandwidth requirements, and it might be prohibitively costly to acquire these.  In addition, if your project means you will be working primarily with mobile phone applications, mobile phones can not run full nodes, typically due to the storage size required for downloading a full blockchain.

Using Node Providers

Untitled

Alchemy as a Node Provider

Good node providers like Alchemy, shown in the image above, take the headache out of managing your own nodes so you can focus on developing great dApps for your users. Using a node provider means you are shifting the responsibility to a trusted third party to connect your dApp to the blockchain ecosystem of your choice.

We already covered why you wouldn’t want to do this and, instead, opt for setting up and running your own nodes, so here are the reasons why you would like to.

Node Providers – Do the Setup and Sync

Setting up a node is a fairly technical process to do it correctly. Syncing can take a long time, and even minor errors in the setup process can cause you to start the syncing process from scratch. At this time, the Ethereum mainnet alone has 16,084,635 blocks that need to be downloaded, which can take weeks.

Node Providers – Supply the Equipment

You will need a lot of disk space, especially for full nodes, and you will also need a good amount of RAM. Just to run one Ethereum node requires fast processors, a minimum of 16 GB of RAM, and a fast SSD with at least 500 GB of free space. Running a full Bitcoin node requires 7 GB of free disk space, and a minimum of 100 MB/s read/write ability. You’ll also need a high-speed internet connection with high download speeds.

Node Providers – Do the Maintenance

Running a node requires you to stay online as long as possible to keep the node healthy. What if your node crashes at 2 am on a Friday night while you are away?  Who will debug it and keep your system operational?  Nodes often need to be upgraded every few weeks and sometimes rebuilt from scratch. Node providers take care of all of this maintenance.

Node Providers – Help You Scale

What if you need 2+ nodes for your projects? This is where things can get tricky. It is incredibly challenging to keep these nodes in sync.  Node providers have the proper hardware and, as a result, the bandwidth and storage to provide proper syncing and scaling of multiple nodes.

Here are a few node providers we recommend to help you get started quickly and easily:

  • CryptoNodes.io is known for having a dedicated service that is constantly updated.
  • NowNodes is a multi-chain node provider featuring nodes on over 45 blockchains.
  • Coinbase is excellent for payment methods and exchange rate dApps.
  • Bitcore is great for dApps that have large transaction volumes.
  • Blockchain is excellent as a Bitcoin API and node provider.
  • Infura is the best for Ethereum dApps.
  • Alchemy is one of the best overall web3 development platforms

Nervos Nodes,

Untitled

So we finally get to running full nodes on the Nervos Network.

For Nervos, we have the Neuron wallet, which runs a full node. Users are connected directly to the blockchain and have a complete copy. For dApps running on a desktop, Neuron is great but requires too much storage for a mobile wallet. However, Nervos is launching a new light client that will allow users of Neuron and future mobile wallets to sync in minutes instead of days using a concise proof representation that is a form of “flyclient.”

The light client still relies on full nodes for additional information, just like all other lightweight nodes. It is recommended that a dApp with many users use a full node on the back end, either hosted or run by the project. The new light client will be more suitable for low-volume requests or projects that haven’t reached a critical number of users.

Release Note as of 11/30/2022:

Currently, the Nervos CKB Layer 1 light client is not fully released, and Godwoken Layer 2 has no light client.

Listed below are the current resources for Nervos L1 and Godwoken L2 Nodes you can run on your own or from a hosted service:

CKB L1 Nodes

Run your own Nervos CKB L1 Testnet Node.

Run your own Nervos CKB L1 Mainnet Node.

Run your own Nervos CKB L1 DevNet Node.

Run a Nervos CKB L1 hosted Node.

Godwoken L2 Nodes

Run a hosted Godwoken L2 Testnet Node.

Run a hosted Godwoken L2 Mainnet Node.

Conclusion

As we covered earlier, the essential functions of a blockchain node include the approval or rejection of blockchain transactions, storing blocks in the correct order, and communicating with other nodes in the blockchain. The two main types of nodes are full nodes and lightweight nodes. The right to participate in blockchain consensus is reserved for full nodes, while lightweight nodes allow easy access to the blockchain with minor storage requirements.

dApps need nodes to communicate with blockchains, and they can do that by either having the user directly interact with the blockchain or by hiding these details from the user, depending on the use case. There are pros and cons to running your node vs. using a hosted node. These all come down to the goals and preferences of each project. Still, as always, the blockchain trilemma will be your compass–the direction you go will depend on how you answer the question of do you prefer decentralization, security, or scalability?

With Nervos, you can run your own nodes or use hosted services. With Godwoken, for now, you can use hosted nodes. This will likely one day change, allowing you to run your own Godwoken nodes.

Regardless of how you proceed with your project, we wish you the best of luck!

Exported with Wordable

More To Explore

Image1
Blockchain Professional

My 1st Experience With Tenderly – A Guest Blog

A Guest Blog by Travis Richardson In blockchain development, where every transaction carries real value and network fees can be costly, ensuring smooth and error-free

NFTs and Mass Adoption
Blockchain Professional

NFTs and Mass Adoption – A Report

Introduction The cryptocurrency world has rapidly evolved over the past few years, with NFTs emerging as one of the industry’s most exciting and promising developments.