module 1 _- Introduction to Blockchain
module 1 _- Introduction to Blockchain
Blockchain:- The term "blockchain" refers to a digital transaction ledger maintained by a network of
computers in a way that makes it difficult to tamper with or modify the data. By eliminating the
middleman or other third party, the technology provides a safe way for people to transact with one
another.
Figure :-Blockchain
A blockchain is a constantly growing ledger which keeps a permanent record of all the transactions
that have taken place in a secure, chronological, and immutable way.
○ Permanent: It means once the transaction goes inside a blockchain, you can put up it
permanently in the ledger.
○ Secure: Blockchain places information in a secure way. It uses very advanced cryptography to
make sure that the information is locked inside the blockchain.
○ Chronological: Chronological means every transaction happens after the previous one.
○ Immutable: It means as you build all the transactions onto the blockchain, this ledger can never
be changed.
A blockchain is a chain of blocks which contain information. Each block records all of the recent
transactions, and once completed goes into the blockchain as a permanent database. Each time a
block gets completed, a new block is generated.
Need of Blockchain
○ Time reduction: In the financial industry, blockchain can allow the quicker settlement of trades.
It does not take a lengthy process for verification, settlement, and clearance. It is because of a single
version of agreed-upon data available between all stakeholders.
○ Security: Blockchain uses very advanced cryptography to make sure that the information is
locked inside the blockchain. It uses Distributed Ledger Technology where each party holds a copy
of the original chain, so the system remains operative, even if the large number of other nodes fall.
○ Collaboration: It allows each party to transact directly with each other without requiring a third-
party intermediary.
Components of Blockchain
The components of a Blockchain network –
1. Node
2. Ledger
3. Wallet
4. Nonce
5. Hash
1. Node –
It is of two types – Full Node and Partial Node.
● Full Node –
It maintains a full copy of all the transactions. It has the capacity to validate, accept and reject the
transactions.
● Partial Node –
It is also called a Lightweight Node because it doesn’t maintain the whole copy of the blockchain
ledger. It maintains only the hash value of the transaction. The whole transaction is accessed using
this hash value only. These nodes have low storage and low computational power.
2. Ledger –
It is a digital database of information. Here, we have used the term ‘digital’ because the currency
exchanged between different nodes is digital i.e cryptocurrency. There are three types of ledger.
They are –
1. Public Ledger –
It is open and transparent to all. Anyone in the blockchain network can read or write something.
2. Distributed Ledger –
In this ledger, all nodes have a local copy of the database. Here, a group of nodes collectively
execute the job i.e verify transactions, add blocks in the blockchain.
3. Decentralized Ledger –
In this ledger, no one node or group of nodes has a central control. Every node participates in the
execution of the job.
3. Wallet –
It is a digital wallet that allows user to store their cryptocurrency. Every node in the blockchain
network has a Wallet. Privacy of a wallet in a blockchain network is maintained using public and
private key pairs. In a wallet, there is no need for currency conversion as the currency in the wallet is
universally acceptable. Cryptocurrency wallets are mainly of two types –
1. Hot Wallet –
These wallets are used for online day-to-day transactions connected to the internet. Hackers can
attack this wallet as it is connected to the internet. Hot wallets are further classified into two types –
a. Online/ Web wallets –
These wallets run on the cloud platform. Examples – MyEther Wallet, MetaMask Wallet.
b. Software wallets –
It consists of desktop wallets and mobile wallets. Desktop wallets can be downloaded on a desktop
and the user has full control of the wallet. An example of a desktop wallet is Electrum.
c. Mobile wallets –
They are designed to operate on smartphone devices. Example – mycelium.
2. Cold Wallet –
These wallets are not connected to the internet. It is very safe and hackers cannot attack it. These
wallets are purchased by the user. Example – Paper wallet, hardware wallet.
a. Paper wallet –
They are offline wallets in which a piece of paper is used that contains the crypto address. The
private key is printed in QR code format. QR code is scanned for cryptocurrency transactions.
b. Hardware wallet –
It is a physical electronic device that uses a random number generator that is associated with the
wallet.
1. Privacy
3. Easy to use
Privacy of a wallet is maintained using public and private key pairs. Transactions are made secure as
a private key is used both to send funds and to open the encrypted message.
4. Nonce –
A nonce is an abbreviation for “number only used once,” which is a number added to a hashed or
encrypted block in a blockchain. It is the 32-bit number generated randomly only one time that
assists to create a new block or validate a transaction. It is used to make the transaction more secure.
It is hard to select the number which can be used as the nonce. It requires a vital amount of trial-and-
error. First, a miner guesses a nonce. Then, it appends the guessed nonce to the hash of the current
header. After that, it rehashes the value and compares this to the target hash. Now it checks whether
the resulting hash value meets the requirements or not. If all the conditions are met, it means that the
miner has created an answer and is granted the block.
5. Hash –
The data is mapped to a fixed size using hashing. It plays a very important role in cryptography. In a
blockchain network hash value of one transaction is the input of another transaction. Properties of
the hash function are as follows –
● Collision resistant
● Hiding
● Puzzle friendliness
Features of Blockchain
Immutable
○ Blockchain technology works by utilizing a network of nodes; every network node has a copy of
the digital ledger, and it assesses a transaction prior to adding it to the network.
○ If the majority of the nodes accept that it is authentic, the transaction is added. It implies that no
transaction blocks can be added to the ledger without obtaining the approval of the majority of
nodes.
○ Any records/data that have been verified can't be changed or reversed; this indicates that they
cannot be edited, changed, or deleted by any user on the network.
Decentralized
The blockchain network is decentralized, indicating that not only one entity will be in charge of
making all of the choices. Instead, a group of nodes creates and maintains the network, and each
node has an identical copy of the ledger. The blockchain network's decentralization feature offers
several benefits:
○ It makes it simpler to create a transparent profile for every network user; as a result, each change
is traceable and more concrete.
○ Users can have control over their properties and do not need to depend on third-party to maintain
and administer them.
Secure
Each record on the blockchain is individually encrypted, further enhancing the security of the
network's process. As there is no centralized authority, it isn't possible to simply add, modify, or
remove data from the network.
All the information on the chain is hashed using cryptography, providing each one a unique identity
on the network. Any attempt to modify the information would necessitate modifying every hash ID,
which is simply not possible. Each block contains its own special hash and the previous block's hash.
The blocks are "cryptographically" connected together due to this feature.
Consensus
Consensus is a method of making decisions that allow a group of network nodes to reach an
agreement swiftly and effectively, ensuring the system's smooth functioning. Every blockchain has a
consensus system that enables the network to make decisions quickly and unbiasedly. Even though
nodes may not have much trust in one another, they might have trust in the network's central
algorithm. A consensus algorithm is required for any blockchain, or it will lose value. There are
numerous available consensus algorithms, each having advantages and disadvantages.
Before records are approved into the network, all the participants must concur that they are
legitimate. A node should receive the consent of the majority in order to add a block to the network,
or else, the block can't be added. It is not possible for a node to simply insert, alter, or erase data
from the network. Every record is updated at once, spreading quickly across the network. Thus, no
modifications can be performed until a majority of the network's nodes consent to them.
Blockchain and Block Header
Blockchain is a database, or broadly distributed database, used mainly for concurrent transactions
and one of the most popular implementations of blockchain is Bitcoin. Blockchain has several
blocks, also called nodes, and all the blocks are managed with the help of the block header.
1. Timestamp
2. Version
3. Merkle Root
4. Difficulty Target
5. Nonce
6. Previous Hash
Timestamp :
Timestamp in the blockchain is used as proof that the particular block is used at what instance of a
time, also this timestamp is used as a parameter to verify the authenticity of any block.
Version :
It states the version that the particular block is using, there are three types of Blockchain version.
1. Blockchain Version 1.0(cryptocurrency)-It used a public ledger to store the data, for example,
Bitcoin.
2. Blockchain Version 2.0(smart Contract)- It is called smart contracts which is self-executing
programs, for example, Ethereum.
3. Blockchain Version 3.0(DAPPS)- It is used to create a decentralized structure, for example, tor
Browser.
4. Blockchain Version 4.0(Blockchain for Industry)- It is used to create a scalable, affordable
blockchain network such that more people could use it.
Merkle Root :
A Merkle root uses mathematical formulas to check if the data is not corrupted, hacked, or
manipulated. For example, Suppose one block has 10 transactions, then to identify that block we
need 10 transactions to combine and form one Hash Value, so it uses the concept of the binary tree
to create the hash of the block and that value is called the Merkle Root(Please refer article
Introduction to Merkle tree).
Difficulty Target :
It specifies the complexity and the computation power required to mine the network, if we are
having a high difficulty target then it implies that we need more a computationally expensive
machine to mine it. For example, in order to increase the difficulty target algorithms such as SHA-2,
SHA-3. RIPEMD, MD5,BLAKE2 is used.
Nonce :
It is abbreviated as ‘number only used once’ and it is a number which blockchain miners are finding
and on average, it takes almost 10 times to find out the correct nonce. A nonce is a 32-bit number,
having the maximum value as 2^(32) total possible value, so the job of the bitcoins miners is to find
out the correct integer value which is a random integer between 0 and 2^(32), so it becomes
computationally expensive.
Previous Hash :
As Blockchain is a collection of several interconnected nodes also called a block, so previous hash
stores the hashed value of the previous node’s address, First block in the blockchain is called the
Genesis Block and has no previous block hash value.
1. Proof of Work (PoW): This consensus algorithm is used to select a miner for the next block
generation. Bitcoin uses this PoW consensus algorithm. The central idea behind this algorithm is to
solve a complex mathematical puzzle and easily give out a solution. This mathematical puzzle
requires a lot of computational power and thus, the node who solves the puzzle as soon as possible
gets to mine the next block. For more details on PoW, please read Proof of Work (PoW) Consensus
2. Practical Byzantine Fault Tolerance (PBFT): Please refer to the existing article on practical
Byzantine Fault Tolerance(pBFT).
3. Proof of Stake (PoS): This is the most common alternative to PoW. Ethereum has shifted from
PoW to PoS consensus. In this type of consensus algorithm, instead of investing in expensive
hardware to solve a complex puzzle, validators invest in the coins of the system by locking up some
of their coins as stakes. After that, all the validators will start validating the blocks. Validators will
validate blocks by placing a bet on them if they discover a block that they think can be added to the
chain. Based on the actual blocks added in the Blockchain, all the validators get a reward
proportionate to their bets, and their stake increase accordingly. In the end, a validator is chosen to
generate a new block based on its economic stake in the network. Thus, PoS encourages validators
through an incentive mechanism to reach to an agreement.
4. Delegated Proof Of Stake (DPoS): This is another type of Proof of Stake consensus algorithm.
This type of consensus mechanism depends on the basis of the delegation of votes. The users
delegate their votes to other users. Whichever user then mines the block will distribute the rewards
to the users who delegated to that particular vote. Refer to the article Delegated Proof of Stake for
more.
5. Proof of Burn (PoB): With PoB, instead of investing in expensive hardware equipment,
validators ‘burn’ coins by sending them to an address from where they are irretrievable. By
committing the coins to an unreachable address, validators earn the privilege to mine on the system
based on a random selection process. Thus, burning coins here means that validators have a long-
term commitment in exchange for their short-term loss. Depending on how the PoB is implemented,
miners may burn the native currency of the Blockchain application or the currency of an alternative
chain, such as bitcoin. The more coins they burn, the better their chances of being selected to mine
the next block. While PoB is an interesting alternative to PoW, the protocol still wastes resources
needlessly. And it is also questioned that mining power simply goes to those who are willing to burn
more money.
6. Proof of Capacity: In the Proof of Capacity consensus, validators are supposed to invest their
hard drive space instead of investing in expensive hardware or burning coins. The more hard drive
space validators have, the better their chances of getting selected for mining the next block and
earning the block reward.
7. Proof of Elapsed Time: PoET is one of the fairest consensus algorithms which chooses the next
block using fair means only. It is widely used in permissioned Blockchain networks. In this
algorithm, every validator on the network gets a fair chance to create their own block. All the nodes
do so by waiting for a random amount of time, adding proof of their wait in the block. The created
blocks are broadcasted to the network for others’ consideration. The winner is the validator which
has the least timer value in the proof part. The block from the winning validator node gets appended
to the Blockchain. There are additional checks in the algorithm to stop nodes from always winning
the election, and stop nodes from generating the lowest timer value.
1. Open: One of the major advantages of blockchain technology is that it is accessible to all means
anyone can become a participant in the contribution to blockchain technology, one does not require
any permission from anybody to join the distributed network.
5. Tighter Security: Blockchain uses hashing techniques to store each transaction on a block that
is connected to each other so it has tighter security. It uses SHA 256 hashing technique for storing
transactions.
6. Immutability: Data cannot be tampered with in blockchain technology due to its decentralized
structure so any change will be reflected in all the nodes so one cannot do fraud here, hence it can be
claimed that transactions are tamper-proof.
7. Transparency: It makes histories of transactions transparent everywhere all the nodes in the
network have a copy of the transaction in the network. If any changes occur in the transaction it is
visible to the other nodes.
8. Efficiency: Blockchain removes any third-party intervention between transactions and removes
the mistake making the system efficient and faster. Settlement is made easier and smooth.
9. Cost Reduction: As blockchain needs no third man it reduces the cost for the businesses and
gives trust to the other partner.
4. Time-Consuming: To add the next block in the chain miners need to compute nonce values
many times so this is a time-consuming process and needs to be speed up to be used for industrial
purposes.
5. Legal Formalities: In some countries, the use of blockchain technology applications is banned
like cryptocurrency due to some environmental issues they are not promoting to use blockchain
technology in the commercial sector.
6. Storage: Blockchain databases are stored on all the nodes of the network creates an issue with
the storage, increasing number of transactions will require more storage.
7. Regulations: Blockchain faces challenges with some financial institution. Other aspects of
technology will be required in order to adopt blockchain in wider aspect.
● Transaction Speed: Current blockchain networks, like Bitcoin and Ethereum, have limited
transaction processing capabilities. For instance, Bitcoin processes about 7 transactions per second
(TPS), while Ethereum handles around 30 TPS. This is far below traditional payment systems like
Visa, which processes thousands of TPS.
● Network Congestion: High demand can lead to network congestion, resulting in slower
transaction times and higher fees.
Energy Consumption:
● Proof of Work (PoW): Many blockchains, especially Bitcoin, use PoW for consensus, which
requires significant computational power and energy. This leads to environmental concerns due to
the high energy consumption of mining activities.
Security Concerns:
● 51% Attacks: If a single entity or group controls more than 50% of the network's mining power,
they can potentially manipulate the blockchain, reversing transactions and double-spending.
● Smart Contract Vulnerabilities: Bugs in smart contracts can lead to significant financial losses,
as seen in the DAO hack on the Ethereum network.
Interoperability:
● Multiple Blockchains: There are numerous blockchain networks, each with its own protocols
and standards. Ensuring seamless communication and interaction between these networks is
challenging.
Privacy Issues:
● Public Ledgers: While transactions on public blockchains are pseudonymous, they are not
entirely private. Sophisticated analysis can sometimes link transactions to individuals.
● Data Protection: Compliance with data protection regulations, like GDPR, can be difficult since
data recorded on a blockchain is immutable.
User Experience:
● Complexity: The technology can be complex and difficult for the average user to understand and
use effectively.
● Usability: Wallet management, private key security, and transaction processes can be
cumbersome for users.
● Business Integration: Integrating blockchain with existing business processes and systems can
be challenging and costly.
● Network Effects: The value of a blockchain network increases with the number of users.
Achieving critical mass for widespread adoption is difficult.
Cost: