In this Blockchain tutorial, we are going to learn about Blockchain architecture. And we will also discuss various components that are there in the architecture. In the end, we will see how this blockchain technology works. The list of topics that we are going to cover is given below.
- What is a Node in Blockchain
- What is a Block in Blockchain
- What is a Transaction in Blockchain
- Consensus Algorithm in Blockchain
- Distributed P2P Network
- How Blockchain Transaction works
Before going through the architecture of a blockchain, we should be aware of what is blockchain.
In a Blockchain, data is stored digitally in a block, and multiple blocks are linked together to form a chain.
Now, to understand Blockchain Architecture, we need to understand various components of the architecture. These generalized components of the architecture are modified by numerous companies result in the formation of various projects like Bitcoin, Ethereum, Hyperledger, etc.
Read Types Of Blockchain
What is a Node
Blockchain technology works on a peer-to-peer network that uses IP protocol to communicate. In this network, a node is a single machine or computer which processes and validates a transaction.
And every node in the network carries a copy of the whole blockchain database, which contains details of all transactions. Now, when many nodes hold similar transactional details, they are considered to be in consensus(agreement).
The role of a node comes to play when a new transaction or a modification to an existing one is requested. After this, a certain proposed algorithm for the transaction is evaluated in each node.
Now, the transaction is considered to be valid only if a large number of nodes come to a consensus. And then, the transaction is recorded into the ledger and a new block is added to the blockchain.
Check out, Consensus in Blockchain
What is a Transaction
A transaction is a fundamental building block of blockchain technology. A transaction usually consists of a sender address, recipient address, and a value.
In the blockchain, transactions are gathered and sent across nodes in blocks, which are then processed independently by each node. Where if a greater number of nodes come in consensus then, the data is added to the blockchain.
Now, each transaction can have one or more input/output values. Where input refers to the reference value from a previous transaction and output refers to an amount and address.
Read Decentralization in Blockchain
What is a Block
Blocks in a blockchain are used to bundle a group of transactions and distribute them to each node in the network. A block in a blockchain comprises information in the form of a block header and transactions.
Miners are the ones who create blocks in the blockchain using mining. Mining is the process of creating a valid block that will be accepted by the rest of the network.
Nodes collect pending transactions, check their cryptographic accuracy, and package them into blocks to be recorded on the blockchain. And the metadata in a block header is used to verify data in a block.
The contact in the block’s metadata is as follows.
- Version: It represents the current block version.
- Previous block header hash: It represents the reference hash of a block’s parent block.
- Merkel root hash: It is represents a hash of all transactions taking place in this block that is encrypted.
- Time: It represents the time at which a block is created.
- nBits: It represents the encoded form of the target threshold and block’s current difficulty.
- nonce: It is a random number added to a block by the minor.
The rest of the part in the block incorporates transactions. And there can be any number of transactions in a block that is decided by the minor.
Now, there are various types of blocks in a blockchain. Let’s have a look at them as well.
- Main branch blocks: These blocks extend the current main blockchain. And it is also the longest chain in the network.
- Side branch blocks: Blocks that refer to a parent block that is not present in the current main blockchain.
- Orphan blocks: Blocks that refer to a parent block this is hidden to the node processing.
Distributed P2P Network
The blockchain is a peer-to-peer (P2P) network that uses the IP protocol for communication. A peer-to-peer network is a flat topology, and it does not have any centralized node.
In this network, peers contribute to the computational power and storage to keep the network running.
P2P networks are often more secure than centralized networks as it does not consist of any single point of failure or intrusion.
A blockchain network can either be a permissionless network or it can be a permission-based network. A permissionless network is one where anyone can join the network, and it is also known as the public blockchain.
Whereas, a permission-based network is one where a pre-verification of the participant is required. And this network is also known as the private blockchain.
In a standard blockchain architecture, each node in the network keeps a copy of the whole blockchain. And this decentralized nature of the blockchain is mainly because of the peer-to-peer network.
Before moving forward, let’s first understand the term consensus in terms of blockchain.
The term consensus is used to represent the agreement of the maximum number of nodes in the network to have the same blocks. We can also consider it as a set of norms that every block self-enforces harmoniously. In the end, the nodes and miners form an overall consensus with more recent nodes.
A consensus algorithm is used to synchronize all of the copies of a blockchain in the network. These algorithms assure that whatever local copies each participant has are up-to-date and consistent with one another.
The consensus algorithm is considered to be the core of every blockchain architecture. Now, let’s understand some of the main consensus algorithms.
Hashes are one of the most effective ways to avoid tampering with data. But, nowadays, computers are so powerful that they can calculate hundreds of thousands of hashes per second.
Now, to overcome this issue, the blockchain uses Proof-of-Work(POW) algorithm.
This algorithm includes solving a challenging computational puzzle to add new blocks to the blockchain network. It generally includes guessing the string that generates a 256-bit hash using the widely used SHA256 hashing method.
Proof of Stake(POS)
In this method, the nodes in the network are also referred to as validators. And these validators validate a transaction to earn some transaction fees.
Now, these nodes are selected randomly to validate the blocks. And the probability of this random selection is determined by the amount of stake held by each node.
Simplified Byzantine Fault Tolerance(SBFT)
In this method, a single validator is used to bundle the proposed transaction into a new block. Since it is a permission-based ledger, the validator is a known party.
In this method, a consensus is attained when a small portion of other network nodes correct the new block.
Read Introduction to Flow Blockchain
How Blockchain Transaction works
So, after going through various components of the blockchain architecture. Let’s understand how this blockchain transaction works.
And the working implementation involves the following steps.
- First, a transaction is requested by a person. A transaction could be a cryptocurrency, contract, or some other information.
- After this, the requested transaction is broadcasted to the whole peer-to-peer network using nodes.
- Then the network of nodes validates the transaction using some known consensus algorithm.
- Once that transaction is completed, the new block is then added to the existing blockchain. In a method that is both permanent and irreversible.
This brings us to the end of this article. In this, we have learned about Blockchain architecture and its various components. And we have also covered the following topics.
- What is a Node
- What is a Block
- What is a Transaction
- Consensus Algorithm
- Distributed P2P Network
- How Blockchain Transaction works
Related Blockchain tutorials:
- Introduction to Enterprise Blockchain
- What is Corda Blockchain
- Introduction to Blockchain Mining
- Hashgraph vs Blockchain
- Introduction to Quorum Blockchain
- Introduction to Blockchain Wallet
I am Bijay, a Microsoft MVP and founder of TSInfo Technologies, a SharePoint development company. Currently focusing on getting expertise on Ethereum, Solidity, Bitcoin, Cryptocurrency, Blockchain, etc. Sharing my expertise and tutorials on Bitcoin and Ethereum related technologies. Read More…