Blockchain is becoming a mainstream adoption technology as it offers multiple benefits. Several organizations across industries such as finance, healthcare, food supply chain, logistics, energy, and entertainment almost everyone is waking up to the purposive use cases of blockchain and taking steps toward its adoption. This digitally distributed, open, and shared ledger is maintained on nodes.
This article is all about Blockchain Nodes whose prime purpose is to enhance the security of the data, maintain the integrity of the data and also provide credibility to the blockchain network. Do you know each node is distinguished from the rest by its trades? If you aren’t fully informed, this piece of writing can be of your help. Let’s take a dive to understand what blockchain nodes are and how they work.
What Constitutes a Node?
Blockchain by its definition is a peer-to-peer network where the participants share their resources. Peers within the network act as client-requesting resources from other peers as well as server-providing services to other peers. These peers in a blockchain network are called nodes.
What are the tasks a node can perform?
A participant in a blockchain network can perform many functionalities like:
>> Keep a copy of transactions occurring in the blockchain.
>> Verify each transaction occurring in the network.
>> Connect with other nodes in the network and provide services to them.
>> Participate in the consensus mechanism: create blocks, vote, and other consensus-related activities.
>> Operate a wallet: a facility for managing accounts.
How to run a Blockchain node?
Nodes are set up by running blockchain clients. Clients are the software implementations that enable users to participate in a blockchain network. A blockchain may support multiple clients. Users may execute these software implementations in different modes, creating a decentralized network.
Here is a list of clients of Bitcoin and Ethereum.
When a node is configured, it must synchronize with the blockchain’s current state to participate in the network. Syncing needs to retrieve state data from peers, verify transactions, and build a local copy of the blockchain. The sync time depends on the size of the data being retrieved. Users will select the sync mode based on the available disk space, sync time, and the purpose of the node being set up.
Theoretically, we assume every node in the blockchain network has a copy of the entire blockchain. But do you think this is practical? The whole blockchain size ranges of public blockchains are in terabytes. Can all the peers hold the complete blockchain copy? Though it’s possible, not all nodes choose to store the entire blockchain copy.
Nodes assume various roles based on the type of data they hold and the tasks they do. Let’s take a look at the types of nodes.
Types of Nodes
A simple classification of nodes will be full nodes and lightweight nodes. Full nodes hold a complete copy of the blockchain. They can verify all transactions. The full nodes that create blocks are termed miners or node validators. Lightweight nodes are interested only in their transactions. They will only keep a portion of the entire blockchain.
As the research in the blockchain field improved, the tasks performed by nodes also started changing. As nodes began to take up new responsibilities, they started getting new titles also — adding to the list of node categories. Let’s see some of them.
Full Node
Generally, when someone says “blockchain node,” they refer to a full node. The full nodes hold a complete copy of the blockchain. Apart from the transaction data recorded in the blockchain, a blockchain also relies on other data structures to store its state. The state of a blockchain refers to the current snapshot of the various accounts and balances. It includes record-keeping models — like the UTXO set, a record-keeping model used in bitcoin to keep track of the bitcoins and their owners. Ethereum maintains its state data as Merkle Patricia Tries, which are stored in key-value databases. Full nodes will be having a copy of the state data also.
Since they have the history data, full nodes can independently verify incoming transactions and check whether it is valid. Running a full node does not fetch any direct economic incentives. So, full nodes are usually maintained by businesses such as exchanges or node providers who provide services to other nodes.
Full nodes are also called auditor nodes.
The data held by full nodes grow drastically over time, causing a heavy toll on the storage requirement. Consequently, the cost of running a full node also rises. Pruning methods have been devised to reduce the storage overhead and allow devices with lower storage capacity to perform the functionalities of a full node.
Pruned node
A pruned node can perform all the functionalities of a full node but with a storage limitation. Data pruning refers to the removal of old blocks and state data. Many pruning algorithms are proposed to delete stale data so that it will not affect the transaction verification process.
A pruned node has only a limited history, unlike a full node. In case of missing data, it can query the same by using other full nodes in the network. Also, if pruning is done by deleting data from state tries, all of the information necessary to recreate that state trie will still be available in the local data copy.
A full node prunes the blockchain data to save disk space and reduce the sync time. It stores enough data to recalculate the missing history if required. In Ethereum, a full node will be periodically pruned; hence, it will be storing only some number of recent blocks (128 for most Ethereum clients). If old states need to be reconstructed, it will be done by querying archive nodes.
Archive Node / Archival Node
An archive node stores everything in the full node and builds an archive of historical states since the genesis block. It saves all the intermediate states and transactions of each block right from the genesis block (the first block of a blockchain). Full nodes have historical data available, which allows them to reconstruct an intermediate state, whereas archive nodes have cached the intermediate states, which can be accessed directly without reconstruction overhead.
Archive nodes are helpful if you want to keep track of changes over time. Syncing an archive node may need months to reach completion. Due to massive storage requirements and syncing overhead, archival nodes are usually run by block explorers and node providers.
Miner nodes
Mining is a term associated with proof of work consensus. Miners refer to those full nodes which are involved in the network consensus. They accept and validate incoming transactions, try to solve the puzzle, and create blocks.
This requires highly complex computing devices and consumes a lot of electricity. Once a miner node succeeds in solving the puzzle and adding a block to the blockchain, it is rewarded with a specific amount of native cryptocurrency.
Validator nodes
Validators are the participants in a consensus mechanism who validate transactions and blocks.
In proof of stake, they are also termed stakers since they lock a specific amount of native cryptocurrency on the blockchain (stake) and take part in the consensus mechanism by validating the transactions and creating blocks when appointed by the network.
Validator nodes consume lesser electricity than miner nodes to validate transactions.
Light Nodes
Light nodes store only block headers that contain summary information about the contents of the blocks. They keep minimal blockchain data required to ease daily tasks or enable quicker transactions. Light nodes can also connect with full nodes to get necessary data and validate information like account balance or transaction details. The light node can then independently verify the data they receive against the state roots in the block headers.
Simplified Payment Verification (SPV) nodes are light nodes. They use the Merkle path to verify that a transaction is included in a block.
Running a light node requires the least resources and technical expertise. They can run on devices with limited memory resources, like smartphones and laptops. Light nodes enable users to participate in the blockchain network without the expensive hardware or high bandwidth required to run full nodes.
Should a blockchain user run a node?
Running our blockchain node can be challenging and unaffordable. Various services run public blockchain nodes and provide services to others.
Wallets are available if users need to do transactions(token transfers) in a blockchain. Wallets are lightweight apps that manage user accounts. They communicate with the nodes at the backend and route the requests to and from the blockchain network.
Should a blockchain developer run a node?
Developers may need blockchain node connectivity to deploy their smart contracts to the network. In public blockchain networks like Ethereum, this is usually done with the help of node service providers. Node service providers run distributed node clients. These services typically provide an API key that developers can use to write to and read from the blockchain. They often include access to public testnets in addition to Mainnet. Node services will run a variety of node clients and types, providing access to various services.
References
[1] Bhutta, Muhammad Nasir Mumtaz & Khwaja, Amir & Nadeem Al Hassan, Adnan & Ahmad, Hafiz & Khan, Khurram & Hanif, Moataz & Song, Houbing & Alshamari, Majed & Cao, Yue. (2021). A Survey on Blockchain Technology: Evolution, Architecture and Security. IEEE Access. PP. 1–1. 10.1109/ACCESS.2021.3072849.
[2] https://geekflare.com/blockchain-nodes-guide/
[3] https://www.coinbase.com/cloud/discover/dev-foundations/blockchain-client-types
[4] https://ethereum.org/en/developers/docs/nodes-and-clients/
[5] https://chainstack.com/evm-nodes-a-dive-into-the-full-vs-archive-mode/
Image Courtesy: https://www.flaticon.com/