Module 1
Module 1
Module 1
SYLLABUS
Module-1
Blockchain Hyperledger and Ethereum for Business
What is blockchain? - Internet versus blockchain - How
blockchain works - The building blocks of blockchain –
Ethereum Private versus public blockchain - Create a Block
Chain, Create Block Chain Network. Crypto currency Basics,
Wallets on the Block Chain, Crypto currency Transactions,
Creating a Crypto currency.
2
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
SYLLABUS
Module-2
Hyperledger – Blockchain for Businesses
Technical requirements Hyperledger overview - Blockchain-as-a-
service (BaaS), Architecture and core components, Hyperledger
Fabric model, Hyperledger Fabric capabilities, Smart Contract
Basics, Creating a Smart contract
Module-3
Blockchain on the CIA Security Triad and Deploying PKI-
Based Identity
CIA security triad, understanding blockchain on confidentiality,
Blockchain on integrity - Understanding blockchain on availability,
PKI - Challenges of the existing PKI model, Role of blockchain in
implementing PKI
3
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1 SYLLABUS
Module-4
Two-Factor Authentication with Blockchain and DNS security
Platform
Two factor Authentication (2FA), Blockchain for
2FA – Installation of [Link], Turning up Ethereum - Turning up
the smart contract, Testing and verification - DNS, Understanding
DNS components - DNS structure and hierarchy, DNS topology for
large enterprises, Challenges with current DNS, Ethereum-based
secure DNS Infrastructure.
Module-5
Deploying Blockchain-Based DDoS Protection and Cyber
Security
DDoS attacks, Types of DDoS attacks, Challenges with current
DDoS solutions, Transformation of DDoS protection using
Blockchain. Facts about Blockchain and Cyber Security, Decision
path for blockchain - Challenges with blockchain, The future of
cybersecurity with blockchain
4
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
TOPICS
MODULE-1
Blockchain Hyperledger and Ethereum for Business
What is blockchain? - Internet versus blockchain - How
blockchain works - The building blocks of blockchain –
Ethereum Private versus public blockchain - Create a Block
Chain, Create Block Chain Network. Crypto currency Basics,
Wallets on the Block Chain, Crypto currency Transactions,
Creating a Crypto currency.
5
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
What is Blockchain?
7
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
8
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
11
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
12
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
13
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
14
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
i) Transaction preparation:
At this stage, party A creates a transaction that includes information
including
the public address of the receiver,
a source digital signature, and
a transaction message.
•Now, this transaction is made available to all of the nodes in the
blockchain.
15
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
How Blockchain works (Contd…)
ii) Transaction Verification:
The blockchain nodes work in a trustless model,
where each node (the machine running the blockchain client
software) receives this transaction, and
verifies the digital signature with party A's public key.
After successful verification, this authenticated transaction is
parked in the ledger queue and
waits until all the nodes successfully verify the same transaction
iii) Block generation: The queued transactions are arranged together
and a block is created by one of the nodes in the network.
•In the Bitcoin blockchain, Bitcoins are rewarded when a Bitcoin
node, also known as a miner, creates a block by solving some
mathematically complex problem.
16
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
18
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
19
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
20
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
21
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
22
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
BLOCK FORMAT
A block consists of a block header and a block body:
•Block header: A block header helps us identify a specific block in the
blockchain. It contains a set of metadata:
•Block body: This part of the block consists of a list of transactions. In
the Bitcoin world, one block consists of more than 500 transactions
on average.
Each transaction has to be digitally signed; otherwise, it is treated as
invalid.
To do that, a hashing function is used to apply the algorithm over an
actual transaction with a private key / secret key.
– Version: It's a 4-byte field that's used to track software or
protocol grades.
– Timestamp: This is a 4-byte field that indicates the creation time
of the block in seconds.
23
Module No.-1
24
Module No.-1
motion or at rest.
•The SHA-256 algorithm is used to produce a fixed-length 256-bit
hash or message digest against each block.
25
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
• [Link]
.
• In blockchain, a node arranges the entire ledger in the form of
chronologically connected blocks.
• To ensure that the ledger remains tamper-proof, each block is
made dependable on the previous block.
• In other words, a new block can't be produced without having the
hash of a previous block.
• Before adding a new block in the ledger, this has to be approved
and verified by every node in the blockchain.
• This allows anyone to tamper or alter with the ledger except in the
case of a hacker, who is capable enough of infecting and
compromising all of the millions of nodes in the blockchain at the
same time.
26
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
• Only the first block called the genesis block is produced itself and
points to itself.
27
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
• Every block points to the hash of the previous hash block, and
this becomes the backbone of the blockchain's immutable system.
• Now, even if a block in between is altered or disturbed by any
means,
a hacker can never achieve the same blockchain as a small
change in the block can result in a drastic change in the resulting
hash.
28
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
Merkle Tree
•To avoid this complex work, a comprehensive hash tree has been
developed named the Merkle tree. The following diagram shows
the Merkle tree:
29
Module No.-1
30
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
31
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
Consensus – the core of blockchain
•Consensus is an integral component of the blockchain system and is responsible
for achieving agreement in a distributed environment.
Four key methods
i) PoW: A new transaction is broadcast to all the nodes in the network, and
each node keeps listening to these transactions.
•Nodes that want to gain incentives through Bitcoin are known as miners, but
they don't just listen, they collect transactions.
•Miners have to solve some complex mathematical problems with a PoW
algorithm.
•Mathematical problem the process of achieving a desired hash with hashing
applied to a set of transactions and a nonce (a 32-bit random number)
•If the output results in a hash that is smaller than the target hash, the miner
wins the block and achieve the consensus.
32
Module No.-1 Etherum-Concept of Bitcoin Mining
Pr
ev
Ha
Da
sh
ta
No
nc
BLOCK
Ha
e
sh
The one who solves it first gets
rewarded with Bitcoin.
SHA-256
Finally, verified blocks are added Hashing
to the blockchain of every miner. Algorithm
33
34
Consensus Models /Mechanism And trust
Frame Work
•The puzzle is designed such that solving the puzzle is difficult, but
checking that a solution is valid is easy.
•This enables all other nodes to easily validate any proposed next
blocks, and
any proposed block that did not satisfy the puzzle would be
rejected.
•A common puzzle method is to require that the hash digest of a
block header be less than a target value.
Proof – of –Work (PoW) Consensus Model
• Publishing nodes make many small changes to their block header
(e.g., changing the nonce)
trying to find a hash digest that meets the requirement.
For each attempt, the publishing node must compute the hash for
the entire block header.
• Hashing the block header many times becomes a computationally
intensive process.
•The target value may be modified over time to adjust the difficulty
(up or down) to influence how often blocks are being published
SHA256("blockchain0") =
0xbd4824d8ee63fc82392a6441444166d22ed84eaa6dab11d492307597
5acab938 (not solved) SHA256("blockchain1") =
0xdb0b9c1cb5e9c680dfff7482f1a8efad0e786f41b6b89a758fb26d9e22
3e0a10 (not solved)
…
SHA256("blockchain10730895") =
0x000000ca1415e0bec568f6f605fcc83d18cac7a4e6c219a957c10c6879
d67587 (solved)
Proof – of –Work (PoW) Consensus Model
•To solve this puzzle, it took 10,730,896 guesses (completed in 54 seconds on
relatively old hardware, starting at 0 and testing one value at a time).
•In this example, each additional “leading zero” value increases the difficulty.
By increasing the target by one additional leading zero (“0000000”), the
same hardware took 934,224,175 guesses to solve the puzzle (completed in
1 hour, 18 minutes, 12 seconds):
•The recipient nodes verify that the new block fulfills the puzzle
requirement, then add the block to their copy of the blockchain and resend
the block to their peer nodes.
•In this manner, the new block gets quickly distributed throughout the
network of participating nodes. Verification of the nonce is easy since only a
single hash needs to be done to check to see if it solves the puzzle
•For many proof of work based blockchain networks, publishing nodes tend
to organize themselves into “pools” or “collectives” whereby they work
together to solve puzzles and split the reward.
The following result was the first to be found to solve the puzzle:
SHA256("blockchain1700876653") =
0x00000003ba55d20c9cbd1b6fb34dd81c3553360ed918d07acf16dc9e75d7
c7f1
•This is a completely new nonce, but still one that solved the puzzle. It took
90,263,918 guesses (completed in 10 minutes, 14 seconds).
•Dividing up the work amongst many more machines yields much better
results, as well as more consistent rewards in a proof of work model.
Proof – of –Work (PoW) Consensus Model
•“Sybil Attack” – a computer security attack (not limited to blockchain
networks ) where an attacker can create many nodes (i.e., creating multiple
identities) to gain influence and exert control.
[Link]
Proof of Stake (PoS) Consensus Model
•The proof of stake (PoS) model is based on the idea that the more
stake a user has invested into the system,
the more likely they will want the system to succeed, and the
less likely they will want to subvert it.
46
iii) Coin Age System:
•When the choice of block publisher is through a coin age system referred
to as a coin age proof of stake,
staked cryptocurrency has an age property.
•It is calculated by multiplying the number of coins by the average amount
of time in blocks they have been possessed.
•For example, 3 BTC that have been possessed for 4 days would have a
coin age of 12 BTC-days (3 x 4 = 12).
•Under Proof of Stake, possessing a higher coin age increases the chance
of mining a block.
•After a certain amount of time (such as 30 days) the staked
cryptocurrency can count towards the owning user being selected to
publish the next block.
•This method allows for users with more stake to publish more blocks, but
to not dominate the system
47
iv) Delegate System
•When the choice of block publisher is through a delegate system,
users vote for nodes to become publishing nodes therefore creating
blocks on their behalf.
•Blockchain network users’ voting power is tied to their stake so the
larger the stake, the more weight the vote has.
•Nodes who receive the most votes become publishing nodes and can
validate and publish blocks.
•Blockchain network users can also vote against an established
publishing node, to try to remove them from the set of publishing
nodes.
•Voting for publishing nodes is continuous and remaining a publishing
node can be quite competitive.
• The threat of losing publishing node status, and therefore
rewards and reputation is constant so publishing nodes are
incentivized to not act maliciously.
49
Proof of Authority / Proof of Identity Consensus Model
• The proof of authority (also referred to as proof of identity)
consensus model relies on the partial trust of publishing nodes
through their known link to real world identities.
• Publishing nodes must have their identities proven and verifiable
within the blockchain network
The secure hardware time source will generate a random wait time and
random time they are given and become idle for that duration. Once a
Verified and trusted software can run in these secure execution environments and
cannot be altered by outside programs.
A publishing node would query software running in this secure environment for a
random time and then wait for that time to pass.
After waiting the assigned time, the publishing node could request a signed
certificate that the publishing node waited
the randomly assigned time.
The publishing node then publishes the certificate along with the block.
56
Ethereum
Ethereum is a decentralized blockchain with
smart contract functionality.
57
Module No.-1
Ethereum
58
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
Ethereum
59
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
Smart Contracts
•Smart contracts are programs stored on a blockchain that run when
predetermined conditions are met.
•They typically are used to automate the execution of an agreement
•Ethereum allows developers to code their own smart contracts.
Smart contracts can be used to do the following:
(i) Streamline the process of claim settlement by automatically
triggering a claim when certain events occur
(ii) Manage agreements between users
(iii) Storing information about application such as health records and
KYC information
60
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
Smart Contracts
•In Ethereum, each contract is given an address so that it can be
uniquely identified.
61
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
EVM (Ethereum Virtual Machine)
•EVM is a decentralized runtime environment for building and
managing smart contracts.
•In Ethereum, with every program, a network of thousands of computers
processes it.
•Smart contracts are compiled into bytecode, which a feature called
EVM can read and execute.
•All of the nodes execute this contract using their EVMs.
•Every node in the network holds a copy of the transaction and the
smart contract's history of the network
•EVM is responsible for executing a contract with the rules pre-
programmed by the developer.
•EVM computes this data through stack-based bytecode, whereas a
developer writes the smart contract in a high-level language, such as
Solidity or Serpent.
62
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
Gas
•Gas - the fee required to execute a transaction on Ethereum, regardless of
transaction success or failure
•It costs a lot of energy when a smart contract is executed by every single
node in the Ethereum network.
•Because consumption of more energy costs more money, it is also
dependent on the level of smart contract programming.
•In other words, each low-level opcode in the EVM costs a specific amount
of gas to produce its desired output.
•Gas just indicates the cost of performing a computation and helps
developers understand energy consumption against their smart contract
code.
•Like the Bitcoin market, the value of gas is determined by the market.
•If a higher gas price is paid, the node will prioritize the transactions for
profit.
63
Module No.-1
dApp
•dApp uses incentives such as crypto-tokens and inbuilt consensus
mechanisms.
•A distributed application does not need to store all of its states;
however, an Ethereum-based distributed application does store
trusted states, and this results in an economical solution for end
users.
•The dApp client is required to program the frontend, except the client
interfaces with the Ethereum blockchain.
•The dApp browser makes use of the dApp client, which is usually
written in JavaScript,
to interface with an Ethereum node that then communicates with
a smart contract.
64
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
dApp
• dApp ensures a connection with the Ethereum node and
provides an easy process to change the connection.
• It also provides an account interface for the user so that they can
easily interface with these dApp’s.
65
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
66
Module No.-1
67
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
•It is built to provide better privacy over transactions and is suited for
banking and other financial institutions.
68
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
69
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
Business Adaptation
•FinTech: Financial organizations are always in need of adapting an
emerging technology to solve key security challenges and enhance
user experience. Because of the risk of downtime (service
disruption) involved in technology refreshes, organizations
prefer to wait till they get feedback and use cases from the majority
of their industry players.
•InsurTech: In general, to fill up an insurance policy, there is a need
for a third-party such as a broker, an insurance company sales
person, or maybe a lawyer.
•Healthcare: Healthcare operations are more than just a standard
business operation. With increasing data breaches and
ransomware incidents in healthcare industries, it is critical
that they come up with a technology that facilitates security from
the foundation layer.
70
M R Padma Priya Assistant Professor School of CS & IT
Module No.-1
71
M R Padma Priya Assistant Professor School of CS & IT
Cryptocurrency Basics
Cryptocurrency is a type of digital or virtual currency that uses
cryptography for security. Unlike traditional currencies issued by
governments (fiat currencies), cryptocurrencies operate on
decentralized networks based on blockchain technology.
Key Concepts:
•Decentralization: Cryptocurrencies are typically decentralized,
meaning they are not controlled by any central authority (like a
government or financial institution). Instead, they rely on a
network of nodes (computers) to validate and record
transactions.
•Blockchain: A blockchain is a distributed ledger that records all
transactions across a network of computers. Each block contains a
list of transactions and is linked to the previous block, forming a
chain. 72
• Cryptography: Cryptocurrencies use cryptographic
techniques to secure transactions, control the
creation of new units, and verify the transfer of
assets.
• Public and private keys are essential to this
[Link] and Demand: The value of a
cryptocurrency is driven by supply and demand.
Some cryptocurrencies, like Bitcoin, have a fixed
supply, which can contribute to their value.
73
Examples of Popular Cryptocurrencies:
74
Wallets on the Blockchain
75
Types of Wallets:
77
• Public Key: A cryptographic code that allows a user to
receive cryptocurrency. It is similar to a bank account
number and can be shared publicly.
• Private Key: A cryptographic code that allows a user
to access and manage their cryptocurrency. It must
be kept secure and private.
• Seed Phrase: A sequence of words generated by the
wallet that can be used to recover the wallet if lost. It
must be stored securely.
78
Cryptocurrency Transactions
• Cryptocurrency transactions involve the transfer of
digital assets from one wallet to another.
• These transactions are recorded on the blockchain,
ensuring transparency and security.
• Steps in a Cryptocurrency Transaction:
Initiation: The sender initiates a transaction by inputting
the recipient's public address, the amount to be
transferred, and possibly a transaction fee.
79
• Broadcasting: The transaction is broadcasted to the
network of nodes (computers) that make up the
blockchain.
• Validation: The network nodes verify the transaction
to ensure that the sender has sufficient funds and
that the transaction is valid.
• This process often involves solving complex
mathematical problems (Proof-of-Work) or staking
tokens (Proof-of-Stake).
80
• Mining (for Proof-of-Work Blockchains): Once
validated, the transaction is grouped with others into
a block, which is then added to the blockchain.
Miners (nodes that validate and add transactions to
the blockchain) are rewarded with newly created
cryptocurrency or transaction fees.
• Confirmation: Once the block is added to the
blockchain, the transaction is confirmed. Multiple
confirmations may be required for a transaction to be
considered secure and irreversible.
81
Creating a Cryptocurrency
• Creating a cryptocurrency involves several steps, from
defining its purpose and underlying technology to
launching it on the blockchain.
• Steps to Create a Cryptocurrency:
[Link] a Consensus Mechanism:Proof-of-Work
(PoW): Requires miners to solve complex problems to
validate transactions and create new blocks.
Proof-of-Stake (PoS): Validators are chosen based on the
number of tokens they hold and are willing to "stake"
as collateral.
82
[Link] on the Blockchain:
•You can either create a new blockchain from scratch or
use an existing platform like Ethereum to create a
token.
•Custom Blockchain: Requires extensive knowledge of
blockchain development. Examples include Bitcoin and
Ethereum.
•Existing Blockchain: Easier and quicker. You can create
a token using platforms like Ethereum (ERC-20
standard) or Binance Smart Chain.
83
[Link] the Nodes:
•Determine how nodes will operate in your network.
Nodes are responsible for validating transactions and
maintaining the blockchain.
•Decide whether your network will be public, private, or
consortium.
84
[Link] the Blockchain Architecture:
•Define how the blockchain will operate, including
transaction structure, block structure, and how new
blocks will be added.
•This step involves choosing the programming
language (e.g., C++, Python, Go) and creating the
necessary software.
85
[Link] Smart Contracts:
•If using a platform like Ethereum, you’ll need to
develop smart contracts that define the rules and
behavior of your cryptocurrency.
•Smart contracts are self-executing contracts with
the terms of the agreement directly written into
code.
86
6. Launch the Cryptocurrency:
•Once everything is developed and tested, you can
launch your cryptocurrency on the blockchain.
•This involves creating the genesis block (the first block
in your blockchain) and making your cryptocurrency
available for use.
87
Module No.-1
88