UNIT I OVERVIEW OF BLOCKCHAIN - Blockchain Notes
UNIT I OVERVIEW OF BLOCKCHAIN - Blockchain Notes
UNIT I OVERVIEW OF BLOCKCHAIN - Blockchain Notes
What is Blockchain?
Blockchain comes under Distributed Ledger Technology (DLT). It’s a distributed database
that records– who transacts what to whom and who owns what? Hence, a blockchain is
a decentralized database containing imprints of assets and transactions across a whole
network. Each node/system in the network shares the exact same copy of records, making it
nearly impossible to disrupt or alter.
All nodes or systems are connected peer to peer (P2P) in a network. This distribution is on a
conceptual network level.
Each block header contains the previous block hash, current block hash, nonce, Merkle
root, and other details.
All blocks are connected linearly by carrying the hash of the previous block.
The previous block hash is used to compute the current block hash.
The first block with no previous block hash is called “Genesis Block.”
1
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
For adding a new block to the network, the blockchain follows consensus
mechanisms like proof of work (PoW), proof of stake (PoS), etc.
Structure of a Block
Let’s just draw a conceptual image of a block with reference to a ledger of transactions.
The above image will create a simpler conceptual block visualization in your head. However,
the actual block contains a lot more information than the ledger image above.
Following are the significant elements of a block –
Block Height –
It’s the sequence number of the block in the chain of blocks. Block Height: 1 is the genesis
block (first block in the network).
Block Size –
It’s a 4-bytes or 32-bit field that contains the size of the block. It adds size in Bytes. Ex –
Block Size: 216 Bytes.
Block Reward –
This field contains the amount rewarded to the miner for adding a block of transactions.
Tx Count –
The transaction counter shows the number of transactions contained by the block. The field
has a maximum size of 9 bytes.
Block Header –
The Block header is an 80-Byte field that contains the metadata – the data about the block.
Let’s briefly discuss the 6 components of the Block Header.
2
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Time – It’s the digitally recorded moment of time when the block has been mined. It is
used to validate the transactions.
Version – It’s a 4-bytes field representing the version number of the protocol used.
Usually, for bitcoin, it’s ‘0x1’.
Previous Block Hash – It’s a 32-bytes field that contains a 256-bits hash (created by SHA-
256 cryptographic hashing) of the previous block. This helps to create a linear chain of
blocks.
Bits – It’s a 4-bytes field that tells the complexity to add the block. It’s also known as
“difficulty bits.” According to PoW, the block hash should be less than the difficulty level.
Nonce – It’s a 4-bytes field that contains a 32-bit number. These are the only changeable
element in a block of transactions. In PoW, miners alter nonce until they find the right block
hash.
Merkle Root – A 32-bytes field containing a 256-bit root hash. It’s constructed
hierarchically combining hashes of the individual transactions in a block.
Why Blockchain?
Blockchain is a method of storing data that makes it difficult or impossible to update, hack, or
defraud the system.
A blockchain is simply a digital ledger of transactions that is replicated and distributed across
the blockchain's complete network of computer systems.
Index – This term symbolizes the location of the block inside the blockchain. The first
block is indexed ‘0’, the next ‘1’, and so on.
Hash – Hash is the function that facilitates the rapid classification of data in the dataset
Previous hash – Each and every block in the blockchain data structure, is associated with
its ancestors. This characteristic adds to its immutability as a variety in the order of blocks.
numTx – This wares a tally of the number of transactions enumerated in the block.
Timestamp – It saves the time aspects of when the block was built.
Nonce – It saves the integer (32 or 64bits) that are utilized in the mining method.
3
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Transaction – This is a different track saved as arrays in the frame of the block. They save
the specific version of a transaction executed so far in the block.
Merkel Tree– A Merkle tree, also perceived as a binary hash tree, is a data structure
utilized for efficiently compiling and validating the uprightness of large sets of data.
Block Validation
One of the key mechanisms enabling blockchain functionality is the block validation
process. The two main types of blockchain, Proof of Work (PoW) and Proof of Stake
(PoS), have a distinctively different block validation process.
Who Is a Blockchain Validator?
A blockchain validator is a network node that helps process and validate transaction blocks
on the platform so that they can be added to the permanent ledger of the blockchain. When
using the term “validator,” some people presume the nodes validating transactions on PoS
blockchains. They contrast it with the term “miner,” used on PoW blockchain platforms.
However, block validation is a process equally applicable to both of these blockchain
varieties. The more correct synonym for mining, applicable to PoS blockchains, would
be staking, the process of block validation used on this type of platform.
As transactions on the blockchain are initiated by users, they are queued on the network for
subsequent validation. Validator nodes then batch individual transactions into a block to
verify it. Each blockchain has its own rules pertaining to the number of transactions per
block. When the block has been completed, validators process it to add it to the blockchain as
a permanent record.
On some blockchains, validators may choose which transactions to batch into a block. This
selection is not necessarily in chronological order, but is driven by the validator’s
preferences, typically based on transaction fees involved.
The fees are added to each blockchain transaction by the sender of crypto assets as an
incentive for validators. Senders may choose the fee amount, and could even send a
transaction without any fees at all.
However, transactions with very low or no fees are more likely to be ignored by validators
and, thus, might remain in an unconfirmed state for long periods of time. If, after a while, the
transaction is not added to a block for validation, it is normally dropped from the network.
The actual process of validating a block differs between PoW-based blockchains, such
as Bitcoin (BTC) or Ethereum (ETH), and PoS blockchains, such as Solana
(SOL) or Ethereum 2.0.
4
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Blockchain Validation :
Introduction
For a decentralized network like Blockchain, it’s essential to keep all the network participants
synchronized. However, it seems far-fetched to make everyone agree on one thing.
Blockchain uses a consensus mechanism to establish governance among all the network
participants. In this article, we’ll go through one of the most popular and foundational
consensus protocols, i.e., Proof-of-Work (PoW) in the blockchain.
In simple terms, Consensus means achieving a decision state with which all network
participants agree. For instance, a group of friends agrees to play football without conflicts.
Here, to reach a decision to play football together is a state of consensus or mutual
agreement.
Proof-of-Work (PoW) consensus mechanism is the oldest yet most popular. The idea first
popped in 1993 when Moni Naor and Cynthia Dowrk published an article exploring the
potential of algorithms to prevent fraud. Later, Satoshi Nakamoto coined the algorithm (an
anonymous figure behind the discovery of Bitcoin) in his whitepaper on “Bitcoin: A peer-to-
peer E-Cash system” in 2008.
PoW plays a significant role in the evolution of Blockchain Technology. The idea is to
create a verification system that is hard to crack.
5
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Moreover, every block contains several other pieces of information like timestamp, block
height, transaction records, Merkle Root Hash, block hash, previous block hash, difficulty
level, and many more in the block header. The other section contains a set of financial
transactions whose hashes will convert into the Merkle root eventually. Hence, a blockchain
is a chain of blocks of transactions.
Mining a Block
When it comes to adding a new block to the chain, it’s seen as a new update to the current
system. Therefore, it requires network participants’ permission. In order to make a decision to
add a new block or not, Proof-of-Work (PoW), a consensus mechanism, is used. Only
verified transactions get added to the network.
In contrast, not all blocks are valid. In fact, most proposed blocks are considered invalid by
the network. The Block validity is defined by the Blockchain protocol. A Blockchain
network has an arbitrary “Difficulty” setting managed by the protocol, which changes how
hard it is to mine a block. Here, mining means adding a new block.
Miners propose the new blocks in the chain. They are externals who wish to add their block
to the network. The work required to create a valid block is where the value comes from.
Miners receive rewards in proportion to their share of the computation power they spend to
mine a new block. By mining a valid block, the miner proves the work done.
In Blockchains like the Bitcoin network or Ethereum, the difficulty level can change to
ensure that blocks are created at regular intervals.
A Proof-of-Work (PoW) consensus algorithm works in such a way that each miner needs
to cross the level of difficulty to prove the block valid. A block is only marked as “valid” if
the hash value of the entire block is below the difficulty hash.
A block contains crucial transaction information that can’t be changed. So, the Miners change
the nonce to get the hash lower than the difficulty threshold. The nonce is a component of a
block that can be altered to achieve the difficulty level restrictions.
6
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Harry is a bitcoin miner who wishes to add his block of bitcoin (a digital currency)
transactions to the network. However, to make his block valid. First, he has to change the
block nonce until the hash of his block gets lower to the difficulty threshold.
Let’s say,
Nonce: 8263
For, this, Block Hash > Difficulty Hash, which is considered invalid.
Harry will change the nonce until he gets the first 3 digits as zeroes.
After continuously changing nonce for hours, he finally got the hash.
Nonce: 6778
7
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Now, the difficulty threshold got achieved. Block Hash < Difficulty Hash.
Hence, Harry’s block will be marked as valid and will get added to the blockchain. For
mining a block in the bitcoin blockchain, Harry gets a few bitcoins as block rewards for
spending the computation power to find the valid hash.
This process is entirely based on chance. Hence, the miner’s job is to change the nonce
value until the overall block hash reaches lower than the difficulty hash. There are other
responsibilities of miners, but that’s a topic for another article.
Benefits of PoW
8
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Limitations of PoW
A lot of energy gets wasted as only one miner can eventually add its block.
It requires heavy computation power hence massive resource and energy consumption.
A 51% attack risk on the network. The controlling entity can acquire 51% to dominate the
network.
Spread environmental hazards using additional machinery.
Pow is a time and energy-consuming process.
It needed heavy expenses for hardware.
Risk of denial of service attacks by intruders.
Proof of Stake
Introduction
To keep the decentralized network aligned, protocols need to be established for the whole
network to reach a consensus. All the network participants together have to decide on what
changes, and if the change seems a discrepancy, it should self-correct.
Proof-of-stake overcomes the limitations of proof-of-work like excessive power and energy
consumption. In the case of proof-of-work, all the miners have to do the heavy mathematical
computation, and eventually, only one of them selects. Hence, this way results in massive
wastage of computational and energy resources.
Therefore, unlike PoW, proof-of-stake (PoS) first stakes some coins. That means the
participants (or validators) have to give some of their coins as a stake. If the block they wish
to forge in the network turns out to be fraudulent transactions, they’ll lose that stake. Else,
they’ll get their staked coins.
9
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Note: Proof-of-stake is a mechanism for the network participants who wish to add a new
block of transactions. The purpose is to save the costs of mining a new block in the network
from the beginning.
Hence, there are a number of validators selected. One of them, based on random selection,
gets the chance to add his block. First, other validators check if the chosen validator’s block
is valid or not by attesting. If marked as valid, he gets the reward. Else he loses his stake.
Let’s understand the working of Proof-of-stake and the validation process thoroughly.
Suppose a block attested by all the validators as valid. The block adds to the blockchain
network, and its validator earns rewards.
Else, if it’s fraudulent or creates any discrepancy, it will mark as invalid, and the
participant will lose his staked coins.
10
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
If validators’ blocks are not selected, why would they attest to someone else block?
Well, if any network participant signed up as a validator, they have to participate in the
validation process. Else, they will lose some of their staked coins as a punishment for being
ignorant of the process as a validator. Moreover, this is called slashing the validator.
There are multiple ways to select among participating validators, such as the number of coins
staked or how long they have been staking. These constraints show they are reliable and
trustable. In addition, sometimes a random function uses to select a participant and gives
everyone a fair chance.
For now, it’s not. PoS come in handy after a substantial amount of participants are already
added. Hence, it can’t be too early because it raises the risk of a 51% attack by dominant
network participants. One can start with a consensus mechanism like Proof-of-work (PoW)
afterward can move to PoS like Ethereum is doing.
Proof of Work utilizes the concept Proof of Stake utilizes the concept
of Hashing. of Digital Signing.
There’s a competition among miners for The chosen validator gets to add its
who solves the puzzle first. block. Hence, no competition.
11
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
PoW systems consume a lot of energy and PoS is a cost and energy-efficient
are expensive yet proven solutions. solution. Yet requires more research.
Can achieve more scalability as all nodes in The complete network is not
the network are involved. involved in the verification part.
The mention of proof of stake is incomplete without the new improvement in it, that is,
Delegated proof of stake (DPoS) system. In the process of delegated PoS, validators’
selections are based on an election process. Here, other network participants can vote for
validators they want to choose. The number of tokens owned by a network participant can
give the same number of votes to nominate a validator. Further, validators can create and
validate a new block that gets added to the network.
In short, it’s an additional layer to the PoS mechanism where network participants (or
delegates) have the right to nominate the validators using votes.
Conclusion
The above article goes through the gore details of the proof of stake (PoS) consensus
mechanism. It thoroughly explains the working of PoS with an example and a few questions.
It also covers a comparison table between proof-of-stake (PoS) and proof-of-work (PoW)
consensus algorithms. At last, it highlights the concept of the Delegated proof-of-stake
mechanism.
I hope you enjoyed reading the article. Please share your queries and feedback. And stay
tuned for an upcoming blog on blockchain technology.
Proof of Activity (PoA) in blockchain is a consensus that combines the capabilities of proof
of work (PoW) and Proof of Stake (PoS) algorithms.
12
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Introduction
PoA mechanism ensures that all blocks of transactions added to the network are genuine and
valid. It’s a way that helps miners to get network agreement (or consensus) to add their new
block. Moreover, PoA protects the blockchain network against external and internal attacks.
Proof of Activity combines proof of work (PoW) and proof of Stake (PoS) mechanism.
First, PoA uses the mining concept by proof of work, where miners have to do complex
mathematical computations to prove their efforts and sincerity to the network. However,
instead of mining a block of transactions, PoA allows miners to mine (or add) a blank
template block with header information and mining reward address. Once this almost
empty block gets mined, the mechanism switches to Proof of Stake (PoS).
Then a group of validators is picked at random. They are responsible for validating or
signing the new block. Validators analyze the header information of the block and then mark
it as valid or invalid. This process continues until a block receives the required number of
validators (or signers).
The higher coins the network participant holds, the stronger are their chances of being
picked up as a validator (or signer).
13
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Once the group of validators signs the new block by the miners, it’s marked as a valid,
complete block and gets added to the blockchain network. Finally, the transactions will
get recorded on the newly added block.
At last, the mining fees/rewards distributes among the miners and the group of validators who
contributed to the mining process.
Miners try to submit their almost empty block (with header information and miner’s reward
address) by solving a complex mathematical puzzle (finding the correct nonce and block
hash)—similar to PoW.
Once the miners submit their nearly blank blocks, the consensus approach switches from
PoW to the PoS mechanism.
This step uses the concepts of the Proof of Stake (PoS) mechanism for using network
validators. However, here validators and miners are separate entities.
A group of network participants called validators (or signers) verifies the block submitted by
the miners. These network validators are selected based on their coins in the network. The
higher the coins held by a validator, have the maximum chances of getting their signed block
chosen.
14
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Validators analyze the header information and miners’ reward address of the block and
then mark it as signed or unsigned.
Note: The process of signing continues until a block receives the required number of signs on
their block by the validators.
Once a block gets signed by the required number of validators. It marks a valid and complete
block. Afterward, new transactions from the transaction pool add to the block. Finally, the
block gets added to the blockchain network.
The mining reward is distributed among the winning block’s miner and the validators for
their contribution to the network.
PoA combines to utilize PoW’s hashing system and PoS’s digital signing.
It highly reduces the probability of a 51% attack on the network.
Maintains the difficulty level to protect the network.
PoA has high fault tolerance as the whole system will never shut down completely.
Provide earning opportunities to both miners and network validators.
In Conclusion
In the above article, we discussed proof of Activity in blockchain technology. We covered the
working of the PoA mechanism along with its pros and cons. As PoA combines PoW and
PoS, we showed how and when uses them.
15
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Introduction
This article covers the gore details of the PoET algorithm along with its functioning. It also
covers the difference between Proof of Work and Proof of Elapsed Time. In addition, the
article goes through the benefits and limitations of the PoET consensus algorithm.
The PoET algorithm was developed by Intel Corporation, the processor chip giant, in early
2016. Intel associated with Linux Foundation in the development of Hyperledger Sawtooth.
They aimed to build a highly scalable private blockchain network.
PoET Mechanism assigns an amount of time to each node in the network randomly. The
node must sleep or do another task for that random wait time. Whichever node gets the
shortest waiting time wakes up and add their block to the network. Later, the new update
information floods among other network participants.
16
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
The Proof of Elapsed time in blockchain needs to ensure 3 significant factors for this process
to work:
Ensure that the node or network participant gets the random waiting time indeed.
Check if they are not choosing the shortest waiting time on purpose.
Verify if the node has completed the given waiting time or not.
Let’s dig a bit deeper into working on the Proof of Elapsed Time mechanism.
The time-lottery concept allows everyone in the network an equal chance of winning the
reward and being able to forge a new block to the network. The PoET controller maintains a
stopwatch for each participating node. It ensures their waiting time ended, and now they can
forge a new block. When the node wakes up, it submits the block and a cryptographic test to
the PoET controller for verification.
A newly proposed block selects if the controller approves the newly proposed block by the
first woken up node. Else it gets discarded. And then, the selection process of assigning
waiting time starts again.
Selection Process
First, each participating node has to share its certificate by Intel Software Guard
Extension (SGX), which ensures its validity to generate a new block in the network. After
that, they are eligible to get a timer object.
The numbers assigned to each node as a timer object (waiting countdown time) by Intel’s
random number generation instruction, RAND. It generates difficult to detect random
numbers.
Now, the time object given to each participating node activates.
17
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Generation Process
After the time object ends and the node wakes up, it’s eligible to forge a new block to the
network.
The active node generates the hash (using a hash function like SHA-256) of its block of
transactions and submits it for acceptance. It doesn’t require showing computation work
done by the node.
Afterward, the update gets flooded to the network.
Therefore ends the iteration of mining a new block in a permissioned blockchain network
using the PoET consensus mechanism.
18
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
Proof of Work (PoW) demands computation work from nodes (or miners) to become
eligible for adding a new block. On the other hand, PoET randomly selects the among
participating nodes by distributing waiting time objects. Here, each node is equally eligible to
mine a new block.
PoET is way more time and energy-efficient than PoW. It is backed by one of the renowned
technology giants, Intel corporation, which makes it more trusting and reliable.
In Conclusion
The above article covered the PoET algorithm and its working. It also goes through the
difference between Proof of Work (PoW) and Proof of Elapsed Time (PoET). Moreover, it
adds to the benefits and limitations of the PoET consensus algorithm.
Introduction
We’ve previously discussed several renowned consensus algorithms like proof of work
(PoW), Proof of Stake (PoS), Proof of Capacity (PoC), and many more. Today we picked up
the Proof of Burn (PoB) consensus mechanism in Blockchain.
19
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
The Blockchain network uses a consensus mechanism to ensure that all participants agree to
a new update on the network. Such as adding a new block of transactions to the network,
deciding the network rights, etc. Therefore, to ensure the continuity of the network algorithm
needs to be established.
In the Proof of Burn (PoB) algorithm, miners reach a consensus by burning the coins.
It’s a process in which crypto coins get permanently eliminated from regular
circulation. In such cases, the burning of coins mechanism is used to validate transactions.
Hence, the more coins a miner burns, the higher the chances of adding the block to the
network.
In comparison to the proof of Work (PoW) system, PoB reduces energy consumption.
Moreover, compared with proof of stake (PoS) systems, PoB doesn’t need miners to stake
coins to add a new block to the network.
There are various versions of Proof of Burn in blockchain, with the most acknowledged
version being Iain Stewart’s algorithm. He’s also the inventor of the Proof of Burn
consensus mechanism.
Here, the concept of “burning the coins” means investing the native coins in virtual
mining rigs (mining powers). It allows miners with the most virtual mining rigs or a miner
who invested the most coins – to add his new block of transactions to the network. Hence, the
number of burnt coins shows miners’ commitment to the network.
First, let’s begin with how do the miners burn the coins?
Here, the miners transfer some amount of coins to an unspendable address or an escrow
account. These publicly verified unspendable accounts are randomly created with no private
keys associated. Once coins get received by burn address/accounts, it becomes useless and
inaccessible. Eventually, the burnt coins in the account are used for strengthening
the security of the network.
We have 6 miners, each having their own block of transactions. As per the process, the
miners have to burn some amount of coins to get an opportunity to add their block to the
network.
See the below diagram. Each miner sends some of their coins to the burn address or
unspendable escrow account.
20
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
John wins as he burns the maximum number of coins. Hence, he gets the chance to add his
block of transactions to the network.
Moreover, the block added by John will be verified by other network validators. If the block
is found invalid, then the second-highest (Ross) gets the chance to add a new block.
Proof of Burn in blockchain promotes the periodic burning of coins to avoid partiality
among new and old network participants. It means the virtual power of mining reduces
each time a new block gets mined. Moreover, it motivates miners to make regular
transactions instead of just one-time investments.
Now let’s jump to the pros and cons of using the PoB approach.
Benefits of PoB
Limitations of PoB
It’s not an initial consensus algorithm. It requires a number of wealthy participants to burn
their coins in the network.
PoB has not been proven to be applied on massive networks.
21
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram
MC4013 Cryptocurrency and Blockchain Technologies
It takes more time to validate the block of transactions. Hence, a bit slower mechanism.
Conclusion
The above article covered the details of the proof of Burn (PoB) mechanism. It also covered
the working of PoB and how it is better than popular consensus mechanisms like PoW and
PoS. Moreover, it goes through the pros and cons of the PoB algorithm.
22
Prepared by: Savithri S, Assistant Professor, DSCET , Mamallapuram