0% found this document useful (0 votes)
65 views180 pages

Block Chain Technology

Uploaded by

lathapriya150599
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views180 pages

Block Chain Technology

Uploaded by

lathapriya150599
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 180

BLOCKCHAIN

Technical Definition:
Blockchain is a peer-to-peer, distributed ledger that is cryptographically-secure,
append-only, immutable (extremely hard to change), and updateable only via
consensus or agreement among peers

 peer-to-peer
no central controller in the network, and all participants talk to each other
directly
 distributed ledger
ledger is spread across the network among all peers in the network, and
each peer holds a copy of the complete ledger.
 cryptographically-secure
cryptography has been used to provide security services which make this
ledger secure against tampering and misuse. Uses SHA256 Algorithm.
 append-only
data can only be added to the blockchain in time-ordered sequential
order. once data is added to the blockchain, it is almost impossible to change that
data and can be considered practically immutable
 updateable only via consensus
any update made to the blockchain is validated against strict criteria
defined by the blockchain protocol and added to the blockchain only after a
consensus has been reached among all participating peers/nodes on the network

Characteristics of Block Chain

Ledger - Append Only


Secure - Cryptographically Secure
Shared - Multiple Participants
Distributed - Scaling od nodes
MERKLE TREE

 Mathematical data structure composed of hashes of different blocks of data,


and which serves as a summary of all the transactions in a block.

 A Merkle tree stores all the transactions in a block by producing a digital fingerprint of
the entire

set of transactions.

 It allows the user to verify whether a transaction can be included in a block or not.

 Merkle trees are created by repeatedly calculating hashing pairs of nodes


until there is only one hash left.

Features of Block Chain

Peer to Peer Network


Decentralized
Incorruptible and Immutable.
DISTRIBUTED LEDGER
PEER TO PEER NETWORK
CRYPTOGRAPHY

 Uses SHA256 Algorithm.


 Each blockchain user has
Private Key and Public Key
 Private key is known only to
the sender. It is used to
confirm the origin of the
transaction is legitimate
 Public key is used to uniquely
identify the user. It is shared
by the sender with every
transaction it floats on the
network
SENDER SIDE
RECEIVER END
Receiver END
 The transaction message is passed through a hash function to
get a hash
value
 This hash is called the Merkle Root, or the Root Hash.

 The Merkle Trees are constructed in a bottom-up approach.

 The Merkle root is stored in the Block header

HOW BLOCKCHAIN WORKS?

 A Blockchain is a distributed ledger with growing lists of records (blocks)


that are securely linked together via cryptographic hashes.

 Each block contains a cryptographic hash of the previous block, a


timestamp, and transaction data.

 Since each block contains information about the previous block, they
effectively form a chain, with each additional block linking to the ones
before it.

 Blockchain transactions are irreversible, once they are recorded, the data in
any given block cannot be altered retroactively without altering
subsequent blocks.

TECHNOLOGIES USED

Blockchain is a combination of three leading technologies:


 Cryptographic keys – Private key and Public key
 A peer-to-peer network containing a shared ledger
 A means of computing, to store the transactions and records
of the network
Blocks:
A block in a blockchain is a combination of three main components:

 1. The header contains metadata such as a timestamp which has a


random number used in the mining process and the previous
block's hash.

 2. The data section contains the main and actual information like
transactions and smart contracts which are stored in the block.

 3. Lastly, the hash is a unique cryptographic value that works as a


representative of the entire block which is used for verification
purposes.

Featers of block Chain

Faster Settlement
Secure
Decenterlized
Census
Distributed
Immutable
HOW BLOCKCHAIN ACCUMULATES BLOCKS

1. A node starts a transaction by first creating and then digitally


signing it with its private key. A transaction can represents
transfer of value between users on the blockchain network.
Transaction data structure usually consists of some logic of
transfer of value, source and destination addresses, and other
validation information.

2. A transaction is propagated by using a flooding protocol, called


Gossip protocol, to peers that validate the transaction based
on preset criteria. Usually, more than one node are required
to verify the transaction

3. Once the transaction is validated, it is included in a block, which is


then propagated onto the network. At this point, the transaction is
considered as confirmed.

4. The newly-created block now becomes part of the ledger, and the
next block links itself cryptographically back to this block. This link
is a hash pointer. At this stage, the transaction gets its second
confirmation and the block gets its first confirmation.

5. Transactions are then reconfirmed every time a new block is


created. Usually, six confirmations in the Bitcoin network are
required to consider the transaction final.
 Immutability means that the blockchain is a permanent and unalterable
network.

 Distributed: All network participants have a copy of the ledger for complete
transparency.

 Decentralized: there is no central authority controlling the network.

 Secure: All the records in the blockchain are individually encrypted.

 Consensus is a decision-making algorithm for the group of nodes active on


the network to reach an agreement quickly and faster and for the smooth
functioning of the system.

 Unanimous: All the network participants agree to the validity of the records
before they can be added to the network. When a node wants to add a block
to the network then it must get majority voting otherwise the block cannot
be added to the network.

THE SECOND GENERATION

 Other blockchains include those that run the several hundred


“altcoins” – other similar currency projects with different rules –
as well as truly different applications, such as:

 Ethereum: the second largest blockchain implementation after


bitcoin. Ethereum distributes a currency called ether, but also
allows for the storage and operation of computer code, allowing
for smart contracts.

 Ripple: a real-time gross settlement system, currency exchange


and remittance network, based on a public ledger.
HISTORY OF BLOCKCHAIN

 1991
A cryptographically secured chain of blocks is described for the first time by Stuart Haber and W
Scott Stornetta
 19
98 Computer scientist Nick Szabo works on ‘bit gold’, a decentralised digital currency

 20 Stefan Konst publishes his theory of cryptographic secured chains, plus ideas for implementation
00
Developer(s) working under the pseudonym Satoshi Nakamoto release a white paper establishing the model for a blockchain
 20
08 Nakamoto implements the first blockchain as the public ledger for transactions made using bitcoin

Blockchain technology is separated from the currency and its potential for other financial, interorganisational transactions is explored.
 20 Blockchain 2.0 is born, referring to applications beyond currency
09 The Ethereum blockchain system introduces computer programs into the blocks, representing financial instruments such as bonds.
These become known as smart contracts.
 20
14
TIERS OF BLOCKCHAIN TECHNOLOGY

BlockChain 1.0 (Cryptocurrency)

 introduced with the invention of Bitcoin,


and it is primarily used for
cryptocurrencies

 implements DLT (Distributed Ledger


Technology) - first

application based on Crypto currency.

 aimed to introduce a transparent, publicly


accessible, completely decentralised,
immutable ledger and distributed system
of transactions in the global financial
market

 Drawback: Mining of BitCoin was Waste and there was also

lack of Scalability of Network in it

BlockChain 2.0 ( Smart Contracts)

 the BlockChain is not just limited to Cryptocurrencies but it will extend


up to Smart Contracts

 BitCoin is replaced with Ethereum

 Process high number of Transactions on Public network rapidly.

BlockChain 3.0 (DApps)

 DApps is decentralised, i.e. no single owner/authority that ensures


transparency, improved security, data accessible to all, no censorship and
flexible development.
 DApps brings many benefits such as zero downtime, ensuring privacy,
data integrity and trustless yet secure communication (business,
transaction, etc.).

 There are many decentralized Applications like BitMessage, BitTorrent etc.

BENEFITS

 Decentralization
 Transparency and trust
 Immutability
 High availability
 Highly secure
 Simplification of current paradigms
 Faster dealing
 Cost saving:

TYPES OF BLOCKCHAIN

Public Blockchain

 open to the public, and anyone can participate as a node in the


decision-making process.

 All users of these permissionless or unpermissioned ledgers maintain a


copy of the ledger on their local nodes and use a distributed consensus
mechanism to decide the eventual state of the ledger.

 Bitcoin and Ethereum are both considered public blockchains.


Use cases with examples

 Voting: Authorities can conduct public


blockchain voting using credibility and
accountability.

 Fundraising: Organizations or projects can use the open blockchain to


increase trust and accountability

YPES OF BLOCKCHAIN

Private block chains

 open only to a consortium or group of individuals or


organizations who have decided to share the ledger among
themselves.

 Eg: HydraChain and Quorum

Use cases with examples.

 Management of the supply chain: Businesses can use a private blockchain


to administer their supply chain.

 Asset ownership: Assets can be traced and validated


using a private blockchain.

 Internal voting is another area where private blockchain is useful.

Hybrid/Semiprivate blockchains

 hybrid blockchain is as a blend of a private and public blockchain.

 may appear like a consortium blockchain, but it isn't.


Use cases with example

 Real Estate: Hybrid networks can be used for this industry, allowing real
estate firms to use them to operate their systems and share information
with the public.

 Retail: The hybrid network can be used to improve process efficiency.

 Highly Regulated Industries: Hybrid blockchains are perfect for industries


with strict regulations, such as the banking sector.

Consortium Blockchain

 When an organization needs both public and private blockchain functionality, a


consortium blockchain can be used.

 Also referred to as federated blockchains

 Some organizational characteristics in a consortium blockchain are made public,


whereas others are kept private.

Use cases with examples.

 Banking and Payments: A consortium of banks is a group working together.


They have control over which nodes validate transactions.

 Research: Data and findings from research can be shared using a


consortium blockchain.

 It is excellent for meal tracking as well.


TYPES OF BLOCKCHAIN
DECENTRALIZED SYSTEM

 Type of network where nodes are not dependent on a single


master node; instead, control is distributed among many
nodes
 Two methods to achieve decentralization:
 disintermediation
 competition (Contest-driven decentralization)

Eg:
1. Money transfer system 2. Disintermediation 3. Bitcoin 4.
Atomicity

Distributed Systems

 Blockchain is a distributed system at its core.

 Distributed systems are a computing paradigm whereby two or more


nodes work with each other in a coordinated fashion to achieve a common
outcome.

 It is modeled in such a way that end users see it as a single logical platform.

 Example, Google's search engine is based on a large distributed system,


but to a user, it looks like a single, coherent platform.

 Blockchain is a decentralized-distributed system


TYPES OF NETWORKS

Eg:
1. Money transfer system
2. Disintermediation
3. Bitcoin 4. Atomicity
.
 A node can be defined as an individual player in a distributed system.

 All nodes are capable of sending and receiving messages to and


from each other.

 Nodes can be honest, faulty, or malicious, and they have memory


and a processor.

 A node that exhibits irrational behavior is also known as a Byzantine


node
BYZANTINE GENERALS' PROBLEM

 Game theory problem

 The problem states like a group of generals with their army are about
to attack their enemy. They surrounded the enemy’s castle from 4
different directions. Now how would they communicate the decision
of attacking or retreating at the same time?

 The Byzantine generals problem has several key parts that are important

to understand:

 multiple independent parties must coordinate their actions

 the parties cannot rely on a central authority and must coordinate their
actions in a decentralized environment

 can communicate with one another by sending messages

 cannot ensure that the messages are authentic and, therefore,


cannot fully trust one another

 the parties must reach a consensus despite the possibility of deception


and betrayal from other parties
Following are problems that may arise while sharing the decision from one general to
another:

 The messenger might get captured while delivering the decision.

 What if an imposter altered the message received.

 How can a general make sure if he received the message from the expected general?

 What if other generals become traitors and they send the message to attack, but
they
actually retreat.

 How can the system be sure that each general will attack at the same
time from their designated location? Is there no way but to trust each other
completely?

Blockchain seems to resolve this problem with the Byzantine fault tolerance (BFT)
consensus mechanism.

BYZANTINE FAULT TOLERANCE (BFT)

 Byzantine fault tolerance (BFT) is a decentralized permissionless

system’s ability to identify and reject false information.

 The objective of a BFT mechanism is to safeguard against the system


failures by employing collective decision making(both – correct and faulty
nodes) which aims to reduce to influence of the faulty nodes.

 BFT is derived from Byzantine Generals’ Problem.

 BFT system is able to continue operating even if some of the nodes fail or
act maliciously
BYZANTINE FAULT TOLERANCE (BFT)

To ensure the success of the generals’ team, they need an algorithm that could adhere to the
following conditions:

 All the troop generals need to agree on the next action of the plan.

 The generals should be trustworthy and loyal to the system.

 Generals must not get influenced to become network traitors.

 They need to follow the algorithm of the system.

 The group of generals needs to reach a consensus or decision, irrespective of the traitors’
actions.

 The system or network should not lead to a 51% attack at any point of action.

 Byzantine Fault Tolerance (BFT) is a consensus approach that resists a


system to get into the Byzantine Generals’ problem. It also means the system
should stay intact even if one of the nodes (or general) fails. In addition, BFT
aims to reduce the effect of malicious byzantine nodes general) on the
network.

Types of Byzantine failures

 There are two types of Byzantine failures:

 fail-stop and

 arbitrary node.

 Fail-stop failures occur when a node fails and stops working.

 On the contrary, arbitrary node failures can occur when:


 A node replies with a false result.

 Nodes fail to return an outcome.

 A node intentionally replies with an incorrect outcome.

 Nodes respond with differing results to different parts of the network.

PRACTICAL BYZANTINE FAULT TOLERANCE(PBFT)

 Practical Byzantine Fault Tolerance is a consensus algorithm

introduced in the late 90s

 Its goal was to solve many problems associated with already


available Byzantine Fault Tolerance solutions.

 In pBFT, nodes must prove that a message came from a specific


peer node. The algorithm rules also require nodes to verify that a
message was unaltered during transmission.

 A pBFT-based system has one primary node, also called a leader node.

 The rest of the nodes are secondary or backup nodes.

 Any node in the system can become a primary node. For example, if
the primary node fails, a secondary node can become a primary node.

 The primary node is changed with every pBFT consensus round.

 A majority of the honest nodes can also vote to remove a faulty

existing primary node and replace it with the next node in line.
pBFT consensus takes place as follows:

 A client sends a request to the leader node.

 The leader node broadcasts the message to backup nodes.

 All the nodes (primary and secondary) execute the client request.
Next, they send the client a reply.

 The request is successful if the client receives “m+1” replies, where


m represents the maximum number of permitted faulty nodes.
TORAGE

 Data can be stored directly in a blockchain, and with this fact it

achieves decentralization.

 But, blockchain is not suitable for storing large amounts of data

 A better alternative for storing data is to use Distributed


Hash Tables (DHTs).

 DHTs were used initially in peer-to-peer file sharing software, such


as BitTorrent, Napster, Kazaa, and Gnutella

DISTRIBUTED HASH TABLE (DHT)

 A Distributed Hash Table is a decentralized data store that looks up data


based on key-value pairs.

 provide an easy way to find information in a large collection of data

 the keys are used to determine the location of the data in the table.

 In a DHT, each node is responsible for storing and managing a portion of the
data.

 When a client wants to retrieve or store data, it sends a request to the


network. The request is then forwarded to the appropriate node based on
the key of the data being requested. The node then responds to the request
and either retrieves or stores the data.
 A hash table is a data structure
that is used to map keys to
values.

 Internally, a hash function is


used to calculate an index into
an array of buckets from which
the required value can be
found.

 Buckets have records stored in


them using a hash key and are
organized into a particular .
HOW DHT WORKS?

 Data is passed through a hash function, which then generates a

compact key.

 This key is then linked with the data (values) on the peer-to-
peer network.

 When users on the network request the data (via the


filename), the filename can be hashed again to produce the
same key, and any node on the network can then be
requested to find the corresponding data

DHTs have the following properties:

 Decentralised & Autonomous: Nodes colle

 Fault Tolerant: System is reliable with lots of nodes joining, leaving, and
failing at all times.

 Scalable: System should function efficiently with even thousands or

millions of nodes.

Just like hash tables, DHTs support the following 2 functions:

 put (key, value)

 get (key)
HADOOP DISTRIBUTED FILE SYSTEM

What is DFS?
DFS stands for the distributed file system, it is a concept of
storing the file in multiple nodes in a distributed manner.

 we can store a file of size 40TB in a single system then why we


need this DFS.

 This is because the disk capacity of a system can only increase


up to an extent.

 Suppose you have a file of size 40TB to process. On a single


machine, it will take suppose 4hrs to process it completely but
if you use a DFS File of size 40TB is distributed among the 4
nodes in a cluster each node stores the 10TB of file. As all
these nodes are working simultaneously it will take the only 1
Hour to completely process it which is Fastest

HIGH LEVEL ARCHITECTURE OF HADOOP

Data storage Nodes in HDFS.

 NameNode(Master)
 DataNode(Slave)
HDFS

 HDFS is designed for storing the data in a large chunk of blocks

rather than storing small data blocks.

 HDFS stores the data in the form of the block where the size of
each data block is 128MB in size which is configurable means
you can change it according to your requirement in hdfs-
site.xml file in your Hadoop directory.

FEATURES OF HDFS

 HDFS also provides high availability and fault tolerance.

 Data is stored in distributed manner i.e. various


Datanodes are responsible for storing the data.

 HDFS provides Replication because of which no fear of Data Loss.

 HDFS Provides High Reliability

 HDFS has in-built servers in Name node and Data Node that helps

them to easily retrieve the cluster information.

 Provides high throughput.


NAMENODE:

 NameNode works as a Master in a


Hadoop cluster that guides the
Datanode(Slaves).

 used for storing the Metadata i.e. the data about the data.

 Meta Data can be the transaction logs that keep track of the user’s activity in
a Hadoop cluster.

 Meta Data can also be the name of the file, size, and the information
about the location(Block number, Block ids) of Datanode that
Namenode stores to find the closest DataNode for Faster
Communication.

 Namenode instructs the DataNodes with the operation like delete,


create, Replicate, etc

DATANODE:

 DataNodes works as a Slave DataNodes are mainly utilized for


storing the data in a Hadoop cluster, the number of
DataNodes can be from 1 to 500 or even more than that.

 The more number of DataNode, the Hadoop cluster will be


able to store more data.

 So generally the DataNode should have High storing capacity to

store a large number of file blocks.


FEATURES OF HDFS

 Highly Scalable - HDFS is highly scalable as it can scale hundreds of nodes in


a single cluster.

 Replication - HDFS always maintains the copy of data on a different machine.

 Fault tolerance - The HDFS is highly fault-tolerant that if any machine fails,
the other machine containing the copy of that data automatically become
active.

 Distributed data storage - Here, data is divided into multiple blocks and

stored into nodes.

 Portable - HDFS is designed in such a way that it can easily portable from

platform to another.

ASIC

 Application-Specific Integrated Circuit

 In the world of cryptocurrencies, ASIC devices are designed to participate in


the process of mining Bitcoin

 "mining" refers to the process of validating and adding new transactions to a


blockchain

 Mining plays a crucial role in maintaining the integrity, security, and


decentralization of
many blockchain networks.

 Mining requires lot of space and time, so miners need to set up entire device
or partition memory for mining purpose.

 Biggest producer of ASIC in Bitmain, china based company.

 As the bitcoin value goes up, ASICs began dominating the mining industry. Its
impossible for people to mine bitcoins with their home computers.
ASIC RESISTANCE

 ASIC Resistance refers to crypto currencies

 Developing ASIC-resistant coins is the


only way to keep cryptos

decentralized

 The main reason to introduce ASIC-resistance technology is to give


everyone a chance to mine crypto and contribute to the hash rate.

 By allowing ordinary people with ordinary machines to share rewards,


ASIC-resistant mining ensures that the cryptosphere remains
decentralized — and doesn’t end up being controlled by a powerful
few.

LIST OF ASIC-RESISTANT COINS

 Ethereum (ETH, or Ether): The ETH coin uses the Keccak256 hashing

algorithm, which is designed to resist hashes from ASIC machines.

 Monero (XMR): This is yet another blockchain network popular among


miners. The unique CryptoNight protocol uses a RandomX hash function
to create new coins.

 Safex Cash (SFX): Its mining algorithm, RandomSFX, was developed based on
Monero's algorithm, RandomX

 Ethereum Classic (ETC)

 Horizen (ZEN): This coin uses the ASIC-resistant Equihash algorithm,

and it's one of the easiest coins to mine.


ADVANTAGES OF ASIC-RESISTANT COINS

 From a miner's perspective, ASIC-resistant coins give them a


fair chance to use home computers to mine cryptos without
wasting thousands of dollars in ASIC hardware.

From the developer's perspective, ASIC-resistant technology is the only solution to keep the
crypto sphere decentralized.

TURING COMPLETE

 Turing complete is the ability of a system to compute any possible


calculation or program.
 some applications of blockchain technology are Turing Complete, others are
Turing Incomplete.

 Depends on the scripting technology implemented.

Bitcoin is Turing Incomplete

 Scripting language used in Bitcoin is intentionally designed as


Turing Incomplete because it serves its purpose and
increased complexity would potentially introduce problems.
 By keeping it simple, the developers can predict with high accuracy how it is
going to react in the finite number of situations in which it is used.

Ethereum is Turing Complete blockchain

 It needs to understand the agreements which make up smart contracts.

 Ethereum has the capability to understand and implement any


future agreement, even those that have not been thought of yet.
 Ethereum’s Turing Completeness means that it is able to use its
code base to perform virtually any task, as long as it has the
correct instructions, enough time and processing power.

 Solidity is the programming language used to write Ethereum


smart contracts

CRYPTOGRAPHY
 HASHING
 DIGITAL SIGNATURE

* brings desired security level in blockchain with cryptography

WHAT IS HASHING?
Hashing is converting an original piece of data into a digest or hash.
 Cryptographic hash functions are irreversible. That means it’s
a 1- way function, and one can’t generate the message back
using the digest.

REQUIREMENTS FOR A CRYPTOGRAPHIC HASH FUNCTION:

 The input can be of any length.


 The output has a fixed length.
 The hash function is relatively easy to compute for any input.
 The hash function is one-way

 The hash function is collision-free (there can’t be two different

messages producing the same hash value).

 Cryptographic hash functions are widely used

in cryptocurrencies to pass transaction information anonymously.


For example,
 Bitcoin,uses the SHA-256 cryptographic hash
function in its algorithm.
 Ethereum,uses Keccak-256 to hash information.

SHA - SECURE HASH ALGORITHM

 SHA-1, SHA-2, SHA-3, are government standard hash


functions promoted by the National Institute of
Standards and Technology (NIST).
 SHA-1 takes an input of virtually any length and produces a 160-
bit message.
 processes a message in 512-bit blocks.

 pads the message with data until the length reaches the next highest

multiple of 512-bit.
 SHA-1 is no longer considered secure against well-funded
adversaries. All major web browser manufacturers stopped
accepting SHA-1 SSL certificates in 2017.

SHA-2

 SHA-256 produces a 256-bit message digest using a 512-bit block size.

 SHA-224 uses a truncated version of the SHA-256 hash and produces a


224-bit digest using a 512-bit block size.

 SHA-512 produces a 512-bit message digest using a 1,024-bit block size.

 SHA-384 uses a truncated version of the SHA-512 hash and produces a


384-bit digest using a 1,024-bit block size.
CHARACTERISTICS OF HASH FUNCTION
SHA 256
SHA algorithms as involving two essential stages:
 Preprocessing — This is where the message is padded, broken
down into smaller blocks, and initialization values are set.
 Hash computation — This process involves a series of
operations that result in a series of hash values. The 256-bit
resulting hash digest we get at the very end is generated by
computing these various hash values.

WHAT MAKES SHA-256 AN IDEAL CANDIDATE FOR BLOCKCHAIN?

 Collision resistant: No two input values can produce the same hash
output. This ensures that every block in the blockchain ledger is
assigned a unique hash value.
 Preimage resistance: The input can not be recreated given a hash
value. This ensures that during the proof of work in bitcoin, the
miners cannot guess the value of nonce by converting the acceptable
hash back into the input
 Large output: The 256-bit output adds up to 22562256 possibilities
making it impossible to apply the brute force solution to crack the hash.
 Avalanche effect: If there is a small change in the input, the output
changes dramatically. This makes sure that the hash value can not
be guessed based on the input values. This makes the hash more
secure.

DIGITAL SIGNATURES
 A digital signature is a mathematical technique used to
validate the authenticity and integrity of a message,
software, or digital document.
The steps followed in creating digital signature are :
 Message digest is computed by applying hash function on the message
and then message digest is encrypted using private key of sender to form
the digital signature.
 Digital signature is then transmitted with the message.
 Receiver decrypts the digital signature using the public key of sender.
 The receiver now has the message digest.
 The receiver can compute the message digest from the message
 The message digest computed by receiver and the message
digest (got by decryption on digital signature) need to be
same for ensuring integrity.

Digital signature serves following purposes:

 The message has been created by a known sender.


This is also known as authentication.
 The sender cannot deny having sent the message. This is
known as non-repudiation.
 The messages has not been altered during
transmission. This is integrity.
DIGITAL SIGNATURE
BENEFITS OF DIGITAL SIGNATURES

 Sales contracts: Digital signing of contracts and sales contracts


authenticates the identity of the seller and the buyer, and both parties
can be sure that the signatures are legally binding and that the terms of
the agreement have not been changed.
 Health Data: In the healthcare industry, privacy is paramount for both
patient records and research data. Digital signatures ensure that this
confidential information was not modified when it was transmitted
between the consenting parties.
 Financial Documents: Finance departments digitally sign invoices so
customers can trust that the payment request is from the right seller, not
from a bad actor trying to trick the buyer into sending payments to a
fraudulent account.
 Shipping Documents: Helps manufacturers avoid costly shipping errors by
ensuring cargo manifests or bills of lading are always correct.
 Public, Key, Cryptogr, APHY
 Security protocol that ensures the safety of data that we exchange through
a transaction in a blockchain network.
 asymmetric type of cryptography where we use a pair of keys (public key and
private key) to encrypt/decrypt the information and verify the users.
 The process of public-key cryptography ensures two things i.e,

1. Encryption of the information at the sender’s end using the public


key.

• Only the intended receiver can decrypt and read the message using its own
private key

2. Signing the message or information for verification using the


sender’s private key.
 This authenticates the identity of the sender and states that he
is a legitimate node in the blockchain network. The receiver
verifies this by using the public key of the sender. This
verification process of users in a network is done through
digital signatures
 public-key cryptography is a way of providing a digital identity to
the user.
 Through this one can carry out secure transactions within a blockchain
network.
 3 key elements in public-key cryptography:

(i) Pair of keys; Private and public key,


(ii) Cryptography wallet and wallet address, and
(iii) Digital signature.
 Each of these three elements contributes significantly to creating an
authentic digital identity just like our bank account, account number, and
password.

 public-key cryptography ensures the integrity of the information, the

authenticity of the user, and the legitimacy of the transaction.


 A private key is like an account password for a user.

PUBLIC KEY AND PRIVATE KEY

 Both of these keys are generated using the Elliptic Curve cryptography
method.

 Firstly, it creates the private key and then it creates a public key from the
private key using the Elliptic Curve Algorithm (aka ECDSA).

 Therefore, both the private and public keys are cryptographically


and mathematically linked to each other.

 The process of generating a public key from the private key is


irreversible.

 It requires a lot of computational power and time to brute force the private
key which is next to impossible.
DIGITAL WALLET
 private key, public key, and the public address is kept secure in a software
known as Wallet.

DIGITAL SIGNATURES

 No transaction in a blockchain network is secure if it is not

digitally signed by the sender’s private key.

 digital signing intends to authenticate the sender.


 It does not secure the document.

ELLIPTIC CURVE DIGITAL SIGNATURE ALGORITHM

 ECDSA is a digital signature algorithm that makes use of ECC to create


the key pairs used in the signing and verification process of the digital
signature

 ECDSA is a cryptographic algorithm used by Bitcoin to ensure that funds can


only be spent by their rightful owners.

 It is dependent on the curve order and hash function used.

 For bitcoin these are Secp256k1 and SHA256 respectively.

COMPONENTS OF ECDSA:

 Elliptic curve selection


 Key pair generation (private and public keys)
 Signature generation and verification
HOW ECDSA WORKS - KEY GENERATION

 Choose a random positive integer ("d" or "k“) as the


private key. The private key should be kept secret at
all times.
 The public key is derived from the private key using scalar
multiplication on the elliptic curve.
 The scalar multiplication involves multiplying the base point
(G) by the private key (d) to obtain the corresponding public
key point (Q):
Q=d*G

 The private key is used to create digital signatures in ECDSA,

while the public key is used to verify those signatures.

HOW ECDSA WORKS - SIGNATURE GENERATION


Steps involved in creating a digital signature using ECDSA:

 Hashing the message


 Generating a random number (k)
 Computing R and S values
- R (Recovery Parameter)
R=k*G
- S (Signature Component)
S = (H(m) + d * x₁) / k (mod n)
where:
 G is the base point
 "H(m)" is the cryptographic hash of the message being signed.
 "d" is the private key of the signer.
 "x₁" is the x-coordinate of the point R.
 "k" is the random number used to compute R.
 "n" is the order of the elliptic curve.

 Creating the signature


 The resulting pair (R, S) forms the digital signature for the given
message. Both R and S needed for signature verification
HOW ECDSA WORKS - SIGNATURE VERIFICATION

Steps involved in verifying an ECDSA signature:

 Recalculating R and S
 formula:
S' = (H(m) / e) (mod n)
Here's what these terms represent:
 "H(m)" is the hash of the message.

 "e" is the x-coordinate of W (i.e., e = x-coordinate(W)).

 "n" is the order of the elliptic curve.

 Checking if they match the original signature


 Validating the message's integrity

HOW ECDSA IS USED IN BLOCKCHAIN TECHNOLOGY

1. Transaction Signing and Verification:

 Transaction Signing: In blockchain, when a user wants to send


cryptocurrency, they sign the transaction with their private key using
ECDSA. This creates a unique digital signature to every transaction.

 Transaction Verification: Nodes in the blockchain network verify the


authenticity of transactions by using the sender's public key and the
ECDSA signature. If the signature is valid, the transaction is considered
legitimate.

2. Address Generation:

 Cryptocurrency addresses in blockchain systems are typically derived


from the user's ECDSA public key. The public key is transformed into a
shorter, more user-friendly format that serves as the recipient's
HOW ECDSA IS USED IN BLOCKCHAIN TECHNOLOGY

3. Block Validation:

 In Proof of Stake (PoS) and Delegated Proof of Stake (DPoS) blockchain


consensus mechanisms, validators (staking nodes or delegates) sign
blocks to confirm their authenticity. These signatures are generated using
ECDSA.

4. Creating Digital Assets:

 Many blockchain platforms use ECDSA to generate the public and private keys for
creating
digital assets, tokens, or non-fungible tokens (NFTs).

5. Immutable Records:

 ECDSA signatures contribute to the security and immutability of


blockchain records - making it extremely difficult for unauthorized
modifications.

6. Smart Contracts: rely on ECDSA signatures for authorization and execution of


contract actions.

ZERO-KNOWLEDGE PROOFS

 ZKPs were introduced by Goldwasser, Micali, and Rackoff in 1985

 used to prove the validity of an assertion without revealing any information


whatsoever about the assertion.

 At a high level, a zero-knowledge proof works by having the verifier


ask the prover to perform a series of actions that can only be
performed accurately if the prover knows the underlying
information.
 If the prover is only guessing as to the result of these actions, then they will
eventually beproven wrong by the verifier’s test with a high degree of probability.

THE STEPS OF A ZKP:

 Setup: Initialization and parameters.

 Commitment: Prover commits to a statement.

 Challenge: Verifier issues a challenge.

 Response: Prover responds to the challenge.

 Verification: Verifier checks the response.

EXAMPLE: ZKP PROTOCOL

 Statement and Secret Knowledge:


 Suppose there's a statement or claim that the prover wants to prove to the
verifier. This statement could be anything say "I know the password," or "I
have a valid cryptocurrency transaction."

 Commitment Phase:
 In the commitment phase, the prover initially commits to the truth of the
statement without revealing any specifics. This commitment is like saying, "I
can prove this statement is true, but I won't reveal how just yet."

 Challenge from the Verifier:


 The verifier responds by issuing a challenge, which can be a request for the
prover to prove their knowledge of the statement. The verifier might ask, "If
you know the password, tell me the first character of it“.
ZKP PROTOCOL

 Response from the Prover:

 In the response phase, the prover provides a convincing response to the verifier's
challenge, effectively demonstrating their knowledge or possession of the secret.
However, this response doesn't reveal the actual secret itself. It only proves that
the prover has the necessary information to make such a response.

 Verification by the Verifier:


 The verifier then verifies the response provided by the prover. If the response is
valid and satisfies certain conditions, the verifier is convinced that the prover
indeed knows the secret and the statement is true. Importantly, the verifier does
not gain any insight into the secret during this process.

THREE PROPERTIES OF ZKPS:

 Completeness :

If a statement is true, then an honest verifier can be


convinced by an honest prover that they possess knowledge about the
correct input.

 Soundness

If a statement is false, then no dishonest prover can


unilaterally convince an honest verifier that they possess
knowledge about the correct input.

 Zero-knowledge property

If the state is true, then the verifier learns nothing


more from the prover other than the statement is true.
APPLICATIONS OF ZKPS IN CRYPTOGRAPHY

 Privacy coins (e.g., Zcash)

 Secure credential verification

 Scalable blockchain solutions

 Smart contract security

 Data auditing and authentication

TYPES OF ZERO-KNOWLEDGE PROOFS

 Interactive Zero-Knowledge Proofs (iZKPs)

 Non-Interactive Zero-Knowledge Proofs (niZKPs)

INTERACTIVE ZERO-KNOWLEDGE PROOFS (IZKPS)

 Interactive Zero-Knowledge Proofs involve a series of


interactions between the prover and verifier.

Example of iZKPs:
 Zero-Knowledge Proof of Knowledge (ZK-PoK): Proves
that the prover knows a secret without revealing the
secret itself.

Use Cases for iZKPs:


 Authentication: Proving identity without revealing a
password or private key.
 Cryptocurrency: Enhancing privacy in transactions.

BENEFITS AND LIMITATIONS OF ZKPS:

 Privacy enhancement
 Improved security
 Complexity and computational cost
 Scalability concerns NON-INTERACTIVE ZERO-KNOWLEDGE PROOFS (NIZKPS)

 Non-Interactive Zero-Knowledge Proofs allow the prover to


generate a proof independently, without requiring back-and-forth
communication with the verifier. The prover creates a single proof
that can be verified by anyone without further interaction.

Examples of NIZKPs:
 zk-SNARKs (Zero-Knowledge Succinct Non-Interactive Argument of
Knowledge): Used in privacy-focused cryptocurrencies like Zcash.
 Bulletproofs: Efficient NIZKPs for proving the correctness of
arithmetic computations.

Use Cases for NIZKPs:


 Privacy coins: Enabling private transactions in cryptocurrencies.
 Data privacy: Proving statements about sensitive data without
revealing the data itself.

MEMORY-HARD ALGORITHMS

 Cryptocurrency mining involves solving complex


cryptographic puzzles to add new transactions to the
blockchain.

 miners with specialized hardware can solve puzzles faster and mine more
cryptocurrency.
This can discourage individual miners or smaller operations from participating.

 A memory-hard algorithm in the blockchain is a type of computational


puzzle that requires a large amount of memory to solve, making it
resistant to ASIC-based mining.
 Memory-hard algorithms are computer programs designed to use a lot
of computer memory (RAM) during their operation.

 Examples of memory-hard algorithms used in blockchain include


Ethash, Equihash, and CryptoNight.

MEMORY-HARD ALGORITHMS IN CRYPTOCURRENCY MINING

 Ensure that miners with different levels of resources can participate

competitively.

 Promotes a fairer and more inclusive mining environment, aligning with


the principles of decentralization and security at the core of BC Tech.

 Reduces the risk of a single entity or group dominating the


network, which could undermine trust and fairness in the
cryptocurrency ecosystem.

ETHASH

 Ethereum,uses a memory-hard algorithm called Ethash as part of its consensus


mechanism.

 Ethash plays a crucial role in ensuring the security, decentralization, and fairness of
the
Ethereum network.

HOW ETHASH IS USED IN ETHEREUM:

Mining Process:

 Ethereum uses a proof-of-work (PoW) consensus mechanism, similar to Bitcoin.


Miners compete to solve complex mathematical puzzles to validate transactions
and add new blocks to the blockchain.
 Ethash is the hashing algorithm used in Ethereum's PoW process. It
requires miners to perform memory-intensive calculations to find a valid
block hash.

ADVANTAGES:

 Security Enhancement

 Fairness and Decentralization

 Resistance to Specialized Hardware like GPUs,ASIC

 Privacy Protection

Memory-Hard Characteristics:

 Ethash is designed to be memory-hard. i.e., it requires a significant amount of

RAM to compute the proof of work.

 The algorithm uses a large dataset known as the "DAG" (Directed Acyclic
Graph), which is stored in memory. The size of the DAG grows over time,
forcing miners to have a substantial amount of memory to mine efficiently.

Leveling the Playing Field:

 Ethash's memory-hard properties are aimed at leveling the playing


field for miners.

 This ensures that mining remains accessible to individual miners and


smaller mining operations, promoting decentralization.
Reducing Centralization Risk:

 Miners with access to large amounts of computational power alone cannot


easily dominate
the network, as memory becomes a limiting factor.

 This contributes to the decentralization of the network and enhances its overall
security.

Fairness and Security:

 Ethash enhances the fairness of Ethereum's PoW consensus


mechanism by allowing a broader range of participants to mine
and receive rewards.
 The memory-hard nature of Ethash also adds a layer of security, making it
more resistant to 51% attacks and other malicious activities.

Constantly Evolving DAG:

 Ethereum's DAG size increases over time. Miners must keep up


with these changes by upgrading their hardware to maintain
competitiveness.
 This dynamic feature ensures that the memory requirements remain a
significant factor in
Ethereum mining, preventing miners from relying solely on computational
power.
HISTORY OF CRYPTOCURRENCY
DISTRIBUTED LEDGER

 A distributed ledger is a database that is synchronized and accessible

across different sites and geographies by multiple participants.

 The need for a central authority to keep a


check against manipulation is eliminated by the use of a distributed ledger.

CATEGORIES OF DISTRIBUTED LEDGERS:

 Permissioned

Nodes have to take permission from a central authority to access or make any
changes in the network. Mostly these types of permissions include identity verification.

 Permissionless

There is no central authority to validate transactions, rather existing nodes are


collectively responsible for validating the transactions. Various consensus mechanisms are used
to validate transactions based on predefined algorithms. In the case of bitcoin proof of work
consensus mechanism is used.

 Hybrid
HOW DLT WORKS

 DLT works based on principles of decentralization.


 DLT operates on a peer-to-peer (P2P) network, where multiple nodes store, validate
and update the ledger simultaneously.

 This eliminates the need for a central authority and reduces the

risk of a single point of failure.


 To ensure consensus, all participating nodes employ a consensus algorithm that
determines the correct version of the ledger.
 Once a consensus is reached, the updated ledger is propagated to all nodes, ensuring
synchronization and accuracy.

 DLT uses cryptography to securely store data and cryptographic

signatures and keys to allow access only to authorized users.


 The technology also creates an immutable database.

WHY ARE DISTRIBUTED LEDGER TECHNOLOGIES USEFUL?

REMOVE THE MIDDLE MAN AND ENGAGE IN DIRECT TRUSTED TRANSACTIONS.

INCREASE ACCESSIBILITY AND BUILD TRANSPARENT APPLICATIONS.

PROTECT THE LEDGER WITH CONTROLLED MUTABILITY AND TAMPER APPARENCE

TYPES OF DLT

 Blockchain:

 Here transactions are stored in the form chain of blocks and each block produces a unique
hash that can be used as proof of valid transactions.

 Each node has a copy of the ledger which makes it more transparent.
 Directed Acyclic Graphs (DAG):

 This uses a different data structure to organize the data that brings
more consensus.

 Validation of transactions mostly requires the majority of support from the nodes in the
network.

 Every node on the network has to provide proof of transactions on the ledger and then can
initiate transactions. In this nodes have to verify at least two of the previous transactions
on the ledger to confirm their transaction.

 Hashgraph:

 Records are stored in the form of a directed acyclic graph.

 It uses a different consensus mechanism, using virtual voting as the form consensus
mechanism for gaining network consensus. Hence nodes do not have to validate each
transaction on the network.

 Holochain:

 much more decentralized than blockchain.

 Each node will run on a chain of its own. Therefore nodes or miners have the freedom
to operate autonomously. It basically moves to the agent-centric structure. Here agent
means computer, node, miner,etc.

 Tempo or Radix:
 Tempo uses the method of making a partition of the ledger this is termed sharding and then
all the events that happened in the network are ordered properly. Basically, transactions are
added to the ledger on basis of the order of events than the timestamp.
ADVANTAGES OF DISTRIBUTED LEDGER TECHNOLOGY

 High Transparency
 Decentralized
 Time Efficient
 Scalable

USES OF DLT

HEALTH CARE

SUPPLY CHAIN

BANKING

GOVERNANCE,CYBER SECURITY

REAL ESTATE

DISADVANTAGES

 51% Attack
 Costs of Transaction
 Slow Transaction Speed
 Scalability Issues
 Lack of Regulation
 Energy Consumption
 Complexity
 Privacy Concerns
 Lack of Interoperability
HOW ARE BLOCKCHAIN AND DISTRIBUTED LEDGER DIFFERENT?
MINING STRATEGIES & REWARDS

 Miners receive two types of rewards for mining:

 new coins created with each new block,

 transaction fees from all the transactions included in the block.

 To earn this reward, the miners compete to solve a difficult mathematical


problem based on a cryptographic hash algorithm.

BLOCK REWARDS

 A Block Reward is basically a reward given to a Bitcoin Miner for every Block for which he
has solved the complex mathematical algorithm, and thus, the transaction records are
added to the Blockchain.

 Halving Process is associated with Bitcoin that the Block Reward just halves itself once
every 2016 Blocks are mined, every 4 years.

 Bitcoin every 4 years-

 2009-50.00 BTC.

 2012- 25.00 BTC.

 2016- 12.50 BTC.

 2020- 6.25 BTC.

WHAT YOU NEED TO MINE CRYPTOCURRENCY

 three basic components to a mining operation:


 wallet,
 mining software, and
 mining hardware.
TYPES OF CRYPTOCURRENCY MINING

 ASIC mining: This type of device is made to mine a specific cryptocurrency. It's expensive, but
it also typically provides the highest hash rate, meaning it offers more mining power.
 GPU mining: Mining using GPUs, commonly known as graphics cards. These also provide
considerable mining power but at a somewhat high up-front cost.
 CPU mining: Mining using a computer's CPU. CPUs don't have nearly as much mining power as
ASICs and GPUs.
 Mining pools: Groups of miners who work together to mine crypto and share block rewards.
Miners pay a small percentage of those block rewards as a pool fee.
 Solo mining: Mining on your own. It's much harder to earn block rewards this way, so mining
pools are often the better choice.
 Cloud mining: Paying a company to mine crypto on your behalf with its own mining devices.
Cloud mining requires a contract, and the terms almost always favor the company and not the
miner.

ETHEREUM

 Ethereum is a Blockchain network that introduced a built-in Turing- complete


programming language that can be used for creating various decentralized
applications(also called Dapps).

 The Ethereum network is fueled by its own cryptocurrency called


‘ether’.

 famous for the implementation of smart contracts.

 Smart contracts can be thought of as ‘cryptographic bank lockers’


which contain certain values.

 These cryptographic lockers can only be unlocked when certain conditions are met.

 Ethereum is often called Blockchain 2.0

 The consensus mechanism used in Ethereum is


Stakes(PoS).
HISTORY OF ETHEREUM

 2013: Ethereum was first described in Vitalik Buterin’s white paper in 2013 with the goal of
developing decentralized applications.

 2014: In 2014, EVM was specified in a paper by Gavin Wood, and the formal development
of the software also began.

 2015: In 2015, Ethereum created its genesis block marking the official launch of the platform.

 2018: In 2018, Ethereum took second place in Bitcoin in terms of market

capitalization.

 2021: In 2021, a major network upgrade named London included Ethereum improvement
proposal 1559 and introduced a mechanism for reducing transaction fee volatility.

 2022: In 2022, Ethereum has shifted from PoW( Proof-of-Work ) to PoS( Proof- of-State )
consensus mechanism, which is also known as Ethereum Merge. It has reduced Ethereum’s
energy consumption by ~ 99.95%.

WHAT IS ETHEREUM USED FOR?

Decentralized finance (DeFi)


 A global, open alternative to the current financial system.
 Products that let you borrow, save, invest, trade, and more.
 Based on open-source technology that anyone can program with.

Non-fungible tokens (NFT)


 They are blockchain based tokens that each represent a unique asset like, piece of art, digital
content, or media.
 An NFT can be thought of as an irrevocable digital certificate of ownership and authenticity for
a given asset, whether digital or physical.
 NFTs are designed to be verifiable , unique or scarce and cryptographically easily
transferable
 EG: NFT Stamps (STAMPSDAQ is one of the leading projects on the market that stands for exactly
these NFT values.)
Decentralized autonomous organizations (DAOs)
 Member-owned communities without centralized leadership.
 A safe way to collaborate with internet strangers.
 A safe place to commit funds to a specific cause.

Decentralized applications (dapps)


 application built on a decentralized network that combines a smart contract and a frontend user
interface

DECENTRALIZED AUTONOMOUS ORGANIZATION

 DAO is an organization that allows implementing rules. These rules are encoded as a computer
program and are not owned by the government.

 In DAO lots of people collectively own and manage.

 A DAO is a collectively-owned, blockchain-governed organization working towards a shared mission.

 DAOs allow us to work with like-minded folks around the globe without trusting a benevolent
leader to manage the funds or operations.

 There is no CEO who can spend funds on a whim. Instead, blockchain-based rules baked into the
code define how the organization works and how funds are spent.

 The distributed ledger technology and smart contracts are at the heart of the DAO ecosystem,
where governance rules are written, automated and enforced using software, and the participants
oversee contributed funds, eliminating the need for third-party involvement.
HOW DAO WORKS?

 Smart contracts are used to construct the DAO's rules, which are set by a core team of community members.

 These smart contracts are evident, verifiable and publicly auditable and lay the groundwork for the DAO's operations.

 They allow any potential member to comprehend how the protocol will operate at all times fully.

 The next step is for the DAO to work out how to receive financing and how to impart governance once these rules have been
formally inscribed onto the blockchain.
HOW DAO WORKS?
 Funding is generally gathered using the token issuance method, wherein the protocol sells
tokens in exchange for funds.

 Token holders receive voting rights in exchange for their money, which are usually
proportional to their holdings.

 The stakeholders of the DAO decide the rules, and these rules and transaction records are
stored on a blockchain with complete transparency.

 The DAO is ready for deployment once funding is completed.

 One of the most remarkable aspects of DAOs is that, once the codes are written and

implemented, they cannot be changed and no member holds any special authority to

make it happen.

 Any changes to be made have to first gather member voting, and upon

reaching the consensus, the specific changes in concern are made.

 If there is a need for a change to be made, it is generally suggested through proposals. It

is when the proposal gathers votes from a majority of stakeholders or when the proposal

fulfills a certain set of rules in the network consensus rules that the changes are

implemented.

 REFERENCE VIDEO: https://www.youtube.com/watch?v=tbO-tfZX3sc


COMPONENTS OF DAO

 Token Holders (Community): Individuals or entities that hold tokens in the DAO,
representing their ownership and influence over the organization.

 Smart Contract (DAO's Code Rules): The heart of the DAO, consisting of code that defines
the rules, governance, and functionalities of the organization. It automates decision-making
processes.

 Proposals and Voting (Decisions and Governance): Token holders can create proposals to
suggest actions or changes within the DAO. These proposals are voted upon by token
holders to reach a consensus on whether to execute them.

 Execution of Actions: Once a proposal is approved through voting, the smart contract
automatically executes the specified action, which can include transferring funds,
distributing rewards, or implementing changes in rules.
TYPES OF DAO

Protocol DAOs

 When tokens serve as a voting metric for implementing any changes in the protocol, such a
governance structure represents protocol DAOs

Examples

 MakerDAO: MakerDAO is a decentralized organization built on Ethereum to allow lending and


borrowing of cryptocurrencies without the need for a middle man.

 It has created a protocol allowing anyone with ETH and a MetaMask wallet to
lend themselves money in the form of a stablecoin called DAI.

Protocol DAOs.

Maker DAO
UNISWAP
YEARN Finance
DAOS
COLLECTOR DAOS

 Pool funds together so that the collective community can invest treasury funds in blue
chip NFT art and other collectibles, where each member owns a share corresponding to
their personal investment. Flamingo and Constitution

Example:

 Flamingo DAO: aims to explore emerging investment opportunities for ownable,


blockchain-based assets and supports crypto transactions, enabling users to create,
monetize, and incentivize online digital content.

GRANT DAOS

 The primary objective of a Grant DAO is to offer financial support to projects that drive
meaningful change, ultimately working towards a future that is fairer and more sustainable.

Examples:

 MolochDAO : Its noble objective is to contribute capital with a singular purpose: to allocate
funds towards the development and sustenance of Ethereum’s infrastructure, a crucial digital
public good.

 GitCoin DAO: helping thousands of projects grow their open source ecosystems and
distributed millions in funding.

 MetaCartel: creates financial funding to projects and provides


operational support for early-stage dapps.

PHILANTHROPY DAOS

 Philanthropy DAOs aim to help progress social responsibility by organizing around a shared
purpose to create impact in the world of Web3.

PLEASRDAO, BIG GREEN DAO and UKRAINE DAO


 Big Green DAO: food justice charity that teaches people how to grow food to improve nutrition
security, mental health, and climate impact.

 UkraineDAO uses the ENS domain, ukrainedao.eth, to send donations to Ukrainian soldiers, and
support the Ukrainian organization, Come Back Alive.

SOCIAL DAOS

 Collaboration platforms for social networking in the crypto space like Blockster
are called Social DAOs. Such platforms offer digital democracy where everyone's
opinions are heard, and people can share their common interests.

Examples:

 Developer DAO is a collective of web3 developers focused on building the future


of web3.

 Friends With Benefits, is a web3 creator DAO focused on building community


and fostering creativity

INVESTMENT DAOS

 Also called Venture DAOs

 They allow capital pooling to democratize investing for various DeFi operations.

 Transparent and open to anyone globally.

Example:

 Krause House: governed by basketball fans to operate the National Basketball Association.

 META CARTEL

 BESSEMER DAO
MEDIA DAOS

 allow product owners of content (i.e., readers) to contribute directly without


involving advertisers for the native token as a reward in return for their
contributions.

Example:

 BanklessDAO is a decentralized community to coordinate and propagate


bankless media, culture, and education. Its goal is to drive the adoption of a truly
bankless money system.

 Decrypt is another media DAO example that empowers users to vote on what
types of content they want to see.

SMART CONTRACT

 A Smart Contract (or cryptocontract) is a computer program that directly and automatically
controls the transfer of digital assets between the parties under certain conditions.
HOW DOES SMART CONTRACT WORKS?

 Identify Agreement: Multiple parties identify the cooperative


opportunity and
desired outcomes and agreements could include business processes, asset swaps, etc.

 Set conditions: Smart contracts could be initiated by parties themselves or when


certain conditions are met like financial market indices, events like GPS locations, etc.

 Code business logic: A computer program is written that


will be executed
automatically when the conditional parameters are met.

 Encryption and blockchain technology: Encryption provides secure authentication and


transfer of messages between parties relating to smart contracts.

 Execution and processing: In blockchain iteration, whenever consensus is reached between


the parties regarding authentication and verification then the code is executed and the
outcomes are memorialized for compliance and verification.

 Network updates: After smart contracts are executed, all the nodes on the network update
their ledger to reflect the new state. Once the record is posted and verified on the
blockchain network, it cannot be modified, it is in append mode only.

VULNERABILITY, ATTACKS

 Attacks to blockchains vary according to whether

they’re public or private networks

 four primary ways hackers threaten blockchains:

 Phishing, SYBIL

 Routing, 51% Attacks


PHISHING ATTACKS

 This scam attempts to attain a user’s credentials without their knowledge through
email.

 Fraudulent emails, messages, or websites can trick users into


revealing sensitive information, such as private keys.

 Fraudsters send wallet key owners emails posing as a legitimate, authoritative source
asking users for their credentials using fake hyperlinks.

 User’s credentials and other sensitive information in possession of hackers can result in
losses for the user and the blockchain network

TO PREVENT PHISHING ATTACKS:

• Improve browser security by installing a verified add-on or

extension to notify you about unsafe websites.

• Improve device security by putting in malicious link detection software similarly as


dependable antivirus software.

• Reconfirm with the support or partner if you receive an email requesting login details
regarding the problem.

• Don’t click on the links until you've thoroughly reviewed it. Rather than clicking on the links,
enter the address into your browser’s private tab.

• Avoid open or public cafe’s Wi-Fi networks.

• Confirm your system and software is up to date.


ROUTING ATTACKS

 An attack on the Internet Service Provider level to affect uptime or participation in a

blockchain.

 An attacker can divide a network into two (or more) distinct components using routing

attacks. The attacker blocks the communication between nodes in a certain chain and the

ones that are outside of it.

 attacker creates parallel blockchains. When the attack is over, all blocks mined within the

smaller chain are discarded. Any transactions and the earnings of the miners are discarded

as well.

 Hackers can intercept data as it’s transferring to internet service providers hijacking IP

prefixes or dropping connections momentarily, preventing the system from reaching

consensus.

ROUTING ATTACKS

 In a routing attack, blockchain participants typically can’t see the threat, so everything looks
normal. However, fraudsters have extracted confidential data or currencies

 To prevent routing attacks:

• Use encryption.

• Implement secure routing protocols (with certificates).

• Change passwords regularly; use strong passwords.

•Educate yourself and your workers about the risks associated with information
security.
SYBIL ATTACKS

 In a Sybil attack, hackers create and use many false network identities to flood
the network and crash the system.

 Hackers create multiple accounts, hosts, or computers to take

over a network and cause blockchain failures

 using those nodes, the hacker will acquire majority consensus and disrupt the chain’s
transactions. As a result, a large-scale Sybil assault is nothing quite a 51% attack.

 To prevent Sybil attacks:

• Use appropriate consensus algorithms.

• Monitor other nodes’ behavior and check for the nodes that are only
forwarding blocks from one user.

51% ATTACKS

 Cryptocurrency mining requires a vast amount of computing power,

especially for large-scale public blockchains.

 But if a miner, or a group of miners, could rally enough resources, they could attain more
than 50% of a blockchain network’s mining power. Having more than 50% of the power
means controlling the ledger and manipulating it to reverse transactions.

 In 2018, three renowned cryptocurrency platforms experienced issues from 51% attacks.

 The three platforms were Ethereum Classic, ZenCash, and Verge. Globally, enterprises lose
around $20 million annually due to 51% attacks
51% ATTACKS

 A 51% attack occurs when a single individual or organization (malicious hackers) collects
more than half of the hash rate and seizes control of the entire system, which can be
disastrous.

 Hackers can modify the order of transactions and prevent them from being confirmed.
They can even reverse previously completed transactions, resulting in double-spending.

 To prevent 51% attacks:

• Improve mining pool monitoring.

• Make certain that the hash rate is higher.

• Avoid using proof-of-work (PoW) consensus procedures.

SIDECHAIN

 A sidechain is a separate, independent blockchain linked to the main blockchain


(mainchain) using a two-way bridge.

 It enables tokens or other digital assets to be transferred between the mainchain and the
sidechain.

 It is designed to address scalability issues and allows for the exploration of unique
blockchain functionalities.

 A sidechain can be public or private, and each sidechain has its own token, protocol,
consensus mechanism, and security.

 Sidechains can be used to run blockchain applications like decentralised apps (dapps),
taking some computational load off the mainchain and helping to scale the blockchain.

 Popular sidechains include Polygon for Ethereum and Rootstock for Bitcoin.
HOW DO SIDECHAINS WORK?

 A sidechain is a blockchain that stems from the main blockchain and runs in parallel to
it.
 It is attached to the main blockchain by means of a two-way peg.
 This enables the interchangeability of digital assets between the parent
blockchain and its sidechain.

KEY COMPONENTS OF SIDECHAIN:

Two-way peg:

 A two-way peg enables a seamless transfer of cryptocurrency between the main


blockchain and the sidechain while maintaining a consistent value between the two.

 It’s called a “two-way” peg because the connection can go both ways — from the main
blockchain to the sidechain and back again.

Smart contracts:

 Smart contracts, to put it simply, are blockchain-based algorithms that execute when
certain criteria are satisfied.

 They are often used to automate the implementation of an agreement so that all parties
can be certain of the conclusion right away, without the need for an intermediary or
additional delay.

 They can also automate a workflow such that when circumstances are met, the following
action is executed. By requiring validators on the mainnet and sidechain to perform
honestly while validating cross-chain transactions, smart contracts are utilized to ensure
that fraud is kept to a minimum.

 A smart contract will alert the mainnet that an event has


transpired once a transaction has taken place.
TYPES OF SIDECHAINS

Permissioned Sidechains

 Require permission to access and use.

 They are primarily used by businesses and organizations that need to control who has
access to the sidechain and the data contained therein.

 This control allows these organizations to harness the benefits of blockchain


technology while maintaining data privacy and security.

 They also allow for more control over consensus mechanisms,


making them adaptable to specific needs.

PUBLIC SIDECHAINS

The operate under the same principles as public blockchains, meaning anyone can participate in their
consensus protocol and validate transactions.
 Public sidechains are ideal for applications that require transparency and open

participation, such as decentralized applications (dApps) or public financial

systems.

FEDERATED SIDECHAINS

 Federated sidechainsoperate under a consortium of select participants who control


the consensus protocol.

 They are not fully open like public sidechains, they are also

not fully restricted like permission sidechains.

 Federated sidechains can offer a balance between control and openness, making
them ideal for applications that require some level of privacy but also want to
leverage the consensus benefits of a larger, select group of participants.
BENEFITS

Scalability
Interoperability
Customized Functionallty

Limitation:

Security Risk
Centralization Concern
Regulatory and Compliance Issues.

EXAMPLES OF SIDECHAIN IMPLEMENTATIONS

Liquid Network

 The Liquid Network is a federated sidechain for Bitcoin designed by Blockstream


in 2018.

 open-source sidechain over the Bitcoin parent blockchain.

 It leverages the prominent features of sidechains for reducing the block discovery
time to one minute, in comparison to the ten minutes of the Bitcoin mainnet.

 It enables fast, secure, and confidential transactions, providing a solution for financial
institutions and exchanges that require speedy and private Bitcoin transactions.

HOW DOES LIQUID NETWORK WORK?


 Liquid Network allow users to transfer BTC to and from the Bitcoin mainchain via a two-way peg.

 Liquid issues its own native asset, Liquid Bitcoin (L-BTC), which is a “wrapped” version of BTC. L-
BTC is always created and burned by an equal amount of BTC locked on the mainchain by the
Liquid governance.

Peg-Ins for Liquid Bitcoin


 To transfer BTC to the Liquid blockchain, users must initiate a “peg-in.” This process is completed
by sending BTC to a Bitcoin address managed by the Liquid Federation.
PRG OUT for BIT Coin

 When a user wants to swap their L-BTC back to BTC on the Bitcoin network, they can do so
by initiating a “peg-out.” To start the process, the L-BTC must first be sent to a burn
address, where the funds will be permanently removed from the Liquid Network. Once this
transaction is confirmed, the Liquid Federation will release an equivalent amount of BTC
on the Bitcoin network and send it back to the user.

HOW DOES LIQUID NETWORK IMPROVE BITCOIN?

 Higher transaction throughput


 Confidential transactions
 Asset issuance

EXAMPLES OF SIDECHAIN IMPLEMENTATIONS

RSK (Rootstock)
 Open-source smart contract platform with a 2-way peg to Bitcoin.

 It merges the capabilities of Ethereum's smart contracts with the Bitcoin network, effectively
bringing the flexibility and versatility of Ethereum to Bitcoin.

 RSK enhances the Bitcoin ecosystem by enabling more complex applications without compromising
the security of the Bitcoin network.

 RSK has created a robust platform for smart contract development and
execution.

 It enables developers to build dapps using Solidity, the same programming language used
in Ethereum.

 PowPeg is a proof-of-work secured, two-way peg used by RTS to evaluate Bitcoin consensus rules
and allow users to convert BTC to RBTC and vice versa.
RSK (ROOTSTOCK)

 Every smart contract deployed on Rootstock can also be deployed on Ethereum with full
compatibility.

 RSK network has three defining features for improving Bitcoin:

Scalability

 Transactions on RSK can be confirmed, bundled, and then sent to Bitcoin’s base layer for final
settlement. Bundling increases Bitcoin’s throughput, therefore expanding the network’s capacity
to host many more users, applications, and transactions.

Near-instant settlement

 RSK creates new blocks about every 33 seconds. This is remarkably faster than Bitcoin’s 10-
minute block time. RSK can also process about 10-20 transactions per second (tps), which is more
efficient than Bitcoin’s capacity of about 5 transactions per second.

Smart contracts

 Rootstock's smart contracts are fully autonomous and eliminate the need for an intermediary to
facilitate transactions. Since Bitcoin’s base layer has limited programmability, RSK implements
smart contract functionality to build decentralized applications on top of the larger Bitcoin
network.

Merged Mining

 Miners can engage in merged mining to mine for the Bitcoin and RSK blockchains
simultaneously.

 Bitcoin and RSK consume the same mining computing power, so miners can contribute
hash rate to mine blocks on RSK.

 Merged mining can increase a miner’s profitability without requiring

additional resources.
 Merged mining allows RSK to validate transactions, create blocks, and send them to
Bitcoin

RSK DEFI APPS

 Sovryn - A non-custodial, smart contract platform for lending, borrowing, and


margin trading with Bitcoin.
 RSK Swap - A decentralized exchange on RSK that is forked from
Ethereum’s Uniswap protocol.
 Tropykus - A digital savings protocol that removes many hurdles and limitations present
in traditional banking.

RSK BRIDGES
 Powpeg - RSK's 2-way peg used to complete conversions between BTC and R-BTC.

 RSK ETH - A token bridge for moving ERC20 tokens between


Ethereum and RSK.
 RSK BSC - A cross-chain bridge created by Sovryn for moving digital assets between Binance
Smart Chain and RSK.

Plasma

 Plasma is a framework for building scalable decentralized applications on the Ethereum


network.

 It's essentially a network of sidechains (also known as child chains) designed to perform
complex operations off the Ethereum mainnet, reducing the load on the main Ethereum
blockchain and enhancing its scalability.

 Each Plasma sidechain can operate independently and handle its transactions, reducing the
overall load on the Ethereum mainnet.

 This means the Ethereum network can handle more transactions and operate more
efficiently, making it more scalable.
NAMECOIN

 Namecoin is "a peer-to-peer naming system based on Bitcoin" created in 2011 from a fork
of the Bitcoin blockchain.

 It is designed to act as a blockchain and token for a decentralized domain name system
(DNS), where token holders can claim a specific name for their websites.

 It was developed to decentralize the Internet infrastructure,

reduce censorship, and increase privacy and security.

 Namecoin attempts to replace existing domain name server technology with blockchain
technology.

 It was first to implement merged mining and a decentralized

DNS.

NAMECOIN

 DNS translates human-readable domain names (for example, www.investopedia.com) to


machine-readable IP addresses (for example, 000.0.0.00). DNS is the mechanism by which
domain identities are linked with numerical IP addresses worldwide.

 allows users to protect domain name servers (DNS) by embedding them on a distributed ledger.

 Decentralization of this system was intended to end internet


censorship and enhance Internet-related security and privacy.

 Standard DNS domains use top level domains (such as .com) which are controlled by central
authorities. The central authority which controls a top-level domain is able to disable any
website which uses their top-level domain if it so chooses, which enables censorship.
 The .bit top level domain provided by Namecoin is not controlled by a central authority and
changes to websites which use .bit domains can only be performed using their
corresponding private keys.
 Namecoin uses Bitcoin's Proof of Work (PoW) mechanism for its consensus and distributes
DNS on the blockchain network by securely registering human-readable names.

 Namecoin provides the following three services:

1. Secure storage and transfer of names (keys)

2. Attachment of some value to the names by attaching up to 520 bytes of data

3. Production of a digital currency (Namecoin)

HOW NAMECOINS WORK?

 Namecoins introduced merged mining, which allows a miner to mine on more than one
chain simultaneously.

 The idea is simple but very effective: miners create a Namecoin block and produce a hash
of that block.

 Then the hash is added to a Bitcoin block and miners solve that block at equal to or greater
than the Namecoin block difficulty to prove that enough work has been contributed
towards solving the Namecoin block.

 The coinbase transaction is used to include the hash of the transactions from Namecoin.

 The mining task is to solve Bitcoin blocks whose coinbase scriptSig contains a hash pointer to
Namecoin block

 If a miner manages to solve a hash at the bitcoin blockchain difficulty level, the bitcoin block is
built and becomes part of the Bitcoin network. In this case, the Namecoin hash is ignored by
the bitcoin blockchain.

 On the other hand, if a miner solves a block at Namecoin blockchain difficulty level a new
block is created in the Namecoin blockchain.

 The core benefit of this scheme is that all the computational power spent by
the miners contributes towards securing both Namecoin and Bitcoin.
ADVANTAGES

 Securing Internet Freedom with Namecoin


 Protecting Against Domain Name System Attacks
 Decentralized Identity Management

GHOST

 Greedy Heaviest Observer SubTree

 allows transactions to be processed without broadcasting them

 It is an end-to-end encryption protocol that provides authentication without having to rely


on centralized trust authorities.

 It can be either symmetric or asymmetric

 The principle of GHOST is that the sender only sends a ghost (or dummy) packet to the
receiver, which can then reply with as many packets as it needs.

HOW DOES THE GHOST PROTOCOL WORK?

 The sender creates a digital signature by encrypting the packet with the receiver’s
public key.

 The receiver decrypts it using his private key (the public key is used to encrypt).

 If the decryption was done correctly, the sender is assumed to be who he claims to
be, and the transaction is accepted.

 He may also send this ghost packet to other receivers (i.e., the
transaction is broadcasted) using the same procedure.
 Since there may be more than one receiver, this protocol is called “GHOST”, which stands
for ” Greedy Heaviest Observed Sub-Tree”, as a reference to how it routes packets
through other nodes in addition to its direct route between sender and receiver.

NEED FOR GHOST PROTOCOL

 In PoW blockchains like Bitcoin, Ethereum, etc due to the random nature of hashing two
miners can be working on the same transaction producing two blocks.

 Only one of these transactions can be added to the main blockchain.

 This means that all the work done by the second miner on
verifying the second block is lost (orphaned).

 The miner does not get rewarded. These blocks are called uncle blocks in Ethereum.

 GHOST protocol is a chain selection rule that makes use of previously orphaned blocks and
adds them to the main blockchain and partially rewards the miner also.

CRYPTO CURRENCY: STAKEHOLDERS

Stakeholder

types Primary

 Primary stakeholders are fundamental to the operations of an organization.

 This group includes all those who enjoy an economic relationship with the
organization, such as shareholders, workers, suppliers, and customers.

Secondary

 Secondary stakeholders are all those groups that do not participate directly in any
exchange with a specific company, but they can be affected by the actions of the company.

 This category includes competitors, the media, and non-governmental organizations.


CRYPTOCURRENCY: STAKEHOLDERS

 End Users/Consumers- utilize blockchain applications, products, or services.

 Developers- create and optimize the blockchain protocols that serve networks and design
the architecture of blockchain systems

 Validators, Delegators and Formulators (Miners) - They add transactions, bundled into
blocks, to the network by solving complex mathematical problems and require considerable
computing power and electricity

 Investors (Founders Of Crypto Organizations/Policymakers)

 Payment / Exchange Services (Marketplace)

CRYPTO CURRENCY: REGULATIONS – U.S

 Cryptocurrencies: Not considered legal tender


 Cryptocurrency exchanges: Legal, regulation varies by state

 The Internal Revenue Service (IRS) does not consider cryptocurrency to be legal tender but
defines it as “a digital representation of value that functions as a medium of exchange, a
unit of account, and/or a store of value” and has issued tax guidance accordingly.

 The key has always been to reduce financial crime and bring transparency

to the asset class.

 The Biden administration’s new framework also sees “significant benefits” from creating a

central bank digital currency (CBDC) or a digital form of the U.S. dollar.

 Federal Reserve Chairman Jerome Powell has remarked that the key reason to release a

CBDC would be to eliminate the need for alternative coin use in the country.
BITCOIN STAKEHOLDERS
CANADA
 Cryptocurrencies: Not legal tender

 Cryptocurrency exchanges: Legal, required to register with FinTRAC after


June 1, 2020

 Canada became the first country to approve a Bitcoin exchange-traded fund (ETF), with

several trading on the Toronto Stock Exchange.

 As for crypto trading platforms, the Canadian Securities Administrators (CSA) and

the Investment Industry Regulatory Organization of Canada (IIROC) require that crypto

trading platforms and dealers in the country register with provincial regulators.

 Canada classifies all crypto investment firms as money service businesses (MSBs) and

requires that they register with the Financial Transactions and Reports Analysis Centre of

Canada (FINTRAC).

JAPAN
 Cryptocurrencies: Legal, treated as property
 Cryptocurrency Exchanges: Legal, must register with the Financial Services Agency

 Japan takes a progressive approach to crypto regulations, recognizing cryptocurrencies as legal


property under the Payment Services Act (PSA).

 Meanwhile, crypto exchanges in the country must register with the Financial Services Agency
(FSA) and comply with AML/CFT obligations. Japan established the Japanese Virtual Currency
Exchange Association (JVCEA) in 2020, and all crypto exchanges are members.

 Japan treats trading gains generated from cryptocurrency as miscellaneous income and taxes
investors accordingly.

 The country has been working on several aspects when it comes to regulation, including
taxation. In September 2022, the government announced it would introduce remittance rules
as early as May 2023 to prevent criminals from using cryptocurrency exchanges to launder
money.
CRYPTOCURRENCY REGULATION IN UK
 Cryptocurrencies: Not legal tender
 Cryptocurrency exchanges: Legal, registration requirements with FCA

 The European Union (EU) has accepted blockchain and digital assets as part of the investable
universe. In January 2020, the governing bodies signed the 5th Anti-Money Laundering
Directive (5AMLD) into law, marking the first time cryptocurrency providers will fall under
regulatory purview. The law states that member states must document the identities and
addresses of all digital asset owners.

 Unlike the U.S., where the SEC imposes a standard capital gains tax, EU member states have
different tax rules for cryptocurrencies. Some European countries collect 0 to 50% on derived
profits while others take nothing.

CRYPTOCURRENCY REGULATION IN CHINA

 Cryptocurrencies: Not legal tender


 Cryptocurrency exchanges: Illegal

 China classifies cryptocurrencies as property for the purposes of determining inheritances.

 The People’s Bank of China (PBOC) bans crypto exchanges from operating in the country,
stating that they facilitate public financing without approval.

 Furthermore, China placed a ban on Bitcoin mining in May 2021, forcing many engaging in
the activity to close operations entirely or relocate to jurisdictions with a more favorable
regulatory environment. And in September 2021, cryptocurrencies were banned outright.

 However, the country has been working on developing the digital yuan (e- CNY). In August
2022, it officially began rolling out the next round of its central bank digital currency (CBDC)
pilot test program.
INDIA

 Cryptocurrencies: Not legal tender


 Cryptocurrency exchanges: Regulations being considered
 India remains on the fence regarding crypto regulation,
neither legalizing nor penalizing its use.

 There is a bill in circulation that prohibits all private cryptocurrencies in India, but it has yet
to be voted on.

 There is a 30% tax levied on all crypto investments and a 1% tax deduction at source
(TDS) on crypto trades.

 Overall, India continues to hesitate to ban crypto outright or to regulate it. Current
regulations are unclear at best and don’t provide much guidance for investors. The country
launched its tokenized rupee pilot program in late 2022.

Note:

https://www.investopedia.com/cryptocurrency-regulations-around-the-world-5202122

CRYPTOCURRENCY EXCHANGE

 Cryptocurrency exchanges are digital marketplaces that enable users to buy and sell
cryptocurrencies like Bitcoin, Ethereum, and Tether.

 The crypto exchanges also provide trading of various cryptocurrency such as margin or
lending trading, and future and options trading.

 2 types:

1. Centralized Cryptocurrency Exchanges (CEX)

2. Decentralized Cryptocurrency Exchanges (DEX)


CENTRALIZED CRYPTOCURRENCY EXCHANGES (CEX)

 Centralized cryptocurrency exchanges act as an intermediary between a buyer and a seller and
make money through commissions and transaction fees.

 CEX is similar to a stock exchange but for digital assets.

 Popular Crypto Exchanges are Binance, Coinbase Exchange, Kraken and KuCoin.

 Like stock trading websites, these exchanges allow cryptocurrency investors to buy and sell
digital assets at the prevailing price, called spot, or to leave orders that get executed when the
asset gets to the investor’s desired price target, called limit orders.

CENTRALIZED CRYPTOCURRENCY EXCHANGES

Pros

 Great liquidity.

 Recovery of the user’s fund is possible.

 Able to handle transactions faster.

Cons

 Easier for hackers as CEX stores valuable user data across centralized
servers.

 Have been charged with manipulating trading volume in the past.


10 TOP CRYPTOCURRENCY EXCHANGES

 Binance
 Coinbase Exchange
 Kraken
 KuCoin
 Binance.US
 Bitfinex
 Gemini
 Coincheck
 Bitstamp
 Bybit

DECENTRALIZED CRYPTOCURRENCY EXCHANGES (DEX)

 A decentralized exchange allows peer-to-peer transactions directly from your digital wallet
without going through an intermediary.

 Examples : Uniswap, PancakeSwap, dYdX, and Kyber.

 These decentralized exchanges rely on smart contracts, self-executing pieces of code on a


blockchain. These smart contracts allow for more privacy and less slippage(transaction costs)
than a centralized cryptocurrency exchange.

DECENTRALIZED CRYPTOCURRENCY EXCHANGES (DEX)

Pros
 Full custody of their funds.
 More security and privacy.
 Distributed hosting reduces the risk of cyber attacks.
Cons
 Low liquidity.
TOP DECENTRALIZED EXCHANGES

 Uniswap (v3)
 dYdX
 Curve Finance
 Kine Protocol
 PancakeSwap (v2)
 DODO (Ethereum)
 Sun.io
 ApolloX DEX
 Uniswap (V2)
 Perpetual Protocol

HOW DOES A CRYPTOCURRENCY EXCHANGE FUNCTIONS?

 To place trades on crypto exchanges in India, they have to first register and complete the
Know-Your-Customer (KYC) process. Once the user’s account is opened and verified, then they
can transfer funds in the form of fiat currencies such as INR or digital currency onto the
platform, which can be further used to make purchases.

 Steps to buy your first cryptocurrency via crypto exchange:

 Step 1: Explore and choose a trustworthy and sound cryptocurrency exchange.

 Step 2: Register with the exchange and open an account with them.

 Step 3: Fund your account or crypto wallet either by depositing fiat or digital currencies.

 Step 4: Now, select the cryptocurrency you want to buy and how much. For instance, if you
wish to buy Bitcoin worth INR 10,000.
 Step 5: Follow the necessary steps to initiate and complete a transaction.

 Step 6: Check your account to verify that the transaction was a success.

PROS AND CONS OF CRYPTOCURRENCY EXCHANGES

Pros

 Very easy and hassle-free for users to buy cryptocurrencies.

 Exchanges allow you to place a legitimate trade on cryptocurrencies.

 There are many exchanges which offer their users with tax forms,
making it easier to compute crypto taxes.

Cons

 Too much vulnerable to hacks and cyber theft.

 If the exchanges go bankrupt, users will not be able to access their funds or place
trades.

 In most of the exchanges, users do not have the right to hold their private keys.
KEY DIFFERENCES BETWEEN CRYPTO EXCHANGES AND WALLETS:
BLACK MARKET & GLOBAL ECONOMY

 A black market / illegal market is an economic activity that occurs outside of

government-sanctioned channels.

 Often referred as underground economy

 Underground markets trade in illegal goods and services, legal goods and services to avoid
taxes, or both.

 Examples:

 sale of illegal drugs, weapons, human trafficking, and the illegal wildlife trade.

 Underground markets can have a negative impact on the economy because the

activity is not reported and taxes are not collected on the transactions.

 Underground markets do provide some benefits, such as creating jobs for those who may not
be able to find employment in traditional markets and allowing access to medicine and
healthcare to those individuals that might not have had access otherwise.

UNDERSTANDING THE BLACK MARKET

Underground activities are distinguished into different types

Illegal Economy

 Economic activities that violate legal laws defining the legitimate source of the economy.

 Produce and distribute legally banned goods and services.

Unreported Economy

 Amount of economy not reported to the tax authority. A measure of such an economy
is the tax gap.

 Examples: Underreporting income to avoid taxes.


Informal Economy

 economic activities that operate outside of the formal, regulated economic system. These activities

are often unregistered, untaxed, and not monitored by the government or official institutions.

 It is the part of the economy that is not taxed, included in the gross national product (GNP), or

monitored by the government. It is hidden from the state for various taxes but is legal in every other

aspect.

Unrecorded Economy

 Economic activities that are not officially tracked or documented, often because they take place
outside formal systems.

 unrecorded income that should be recorded in the national accounting system but is not done.

 Eg: cash-based transactions that are not reported to tax authorities.

 After the rise of technology and the internet, most underground market transactions are
now conducted online, such as on the dark web, with the help of digital currencies.

 These markets can take a toll on the economy as they are considered shadow markets
whose economy is not recorded and taxes are not paid.

 Also, these asset classes are out of government control, which means it cannot control
the supply of these assets in the economy. This is what makes it dangerous and harmful
to economic stability.
Regulations-Driven Black Market Conditions

 Due to the shortages created by government-


imposed price ceilings.
TYPES OF UNDERGROUND ACTIVITIES
NECESSITY OF BLACK MARKETS

 people wanted to exchange or buy goods and services prohibited by the government

 reason for black markets is irregularities in the demand and supply equation.

 when people do not want to pay taxes on purchasing legal or illegal

goods and services.

 don't follow government laws, such as not reporting the taxable price of transactions
and not paying employment tax

CONDITIONS DUE TO WHICH BLACK MARKET EXISTS

Licensure-Driven Black Market Conditions

 Licensing restrictions imposed by the government is heavy

 can not afford to invest the time and economy to obtain the necessary licenses.

Trade-Driven Black Market Conditions

 not reporting their jobs or income to the government.

 illegal immigrants obtain jobs, students traveling abroad avail employment without a
proper work visa, child labor.

Economy-Driven Black Market Conditions

 due to high unemployment.

 Earning money but not reporting it legally to the tax authorities is

the main cause of economy-driven illegal market conditions.


UNIT 4 ETHEREUM

ETHEREUM
 Turing-complete language that allows the development of arbitrary programs (smart
contracts) for blockchain and decentralized applications.

 This concept is in contrast to Bitcoin, where the scripting language is limited in nature and allows necessary operations only.

 Ether is the native cryptocurrency


WHY USE ETHEREUM
BITCOIN VS ETHEREUM
ELEMENTS OF ETHEREUM

 Keys and addresses


 Accounts
 Transactions and messages
 Ether cryptocurrency/tokens
 The EVM
 Smart contracts

KEYS AND ADDRESSES

 The private key is generated randomly and is kept secret

 public key is derived from the private key.

 Addresses are derived from the public keys which are a 20-bytes code used to
identify accounts.

 The process of key generation and address derivation is described


here:

1. Private key is randomly chosen (256 bits positive integer) under the rules
defined by elliptic curve specification.

2. Public key is then derived from this private key using ECDSA recovery
function.

3. An address is derived from the public key which is the right most 160 bits of
the Keccak hash of the public key.

ACCOUNTS

 Externally Owned Accounts (EOAs)


 Contract Accounts (CAs)
EXTERNALLY OWNED ACCOUNTS (EOAS)

 controlled by ECDSA signing key pair (pk,sk).

 An individual makes an account on Ethereum and a public- private key pair is


generated for the account. The account is not identified by the person’s name or
any personal information.

 Public key’s hash acts as the account number to which Ether can be sent.

 This account also has some other state fields:

Nonce: number of transactions initiated by the account.

Balance: represents the balance of the account in Wei.

CodeHash: Empty string as EOA does not have any associated code.

Storage: Empty string as EOA does not have any data to store.

CONTRACT ACCOUNTS (CAS)

 Ether is owned and controlled by a piece of code known as the

smart contract instead of an entity.

 They have associated code that is kept in memory/storage on the blockchain.

 They can get triggered and execute code in response to a transaction or a message

from other contracts. The code is executed by Ethereum Virtual Machine (EVM) by

each mining node on the Ethereum network.

ONTRACT ACCOUNTS (CAS)

 This account has a unique address to receive Ether. However, it does not need any
private key to generate the transactions as it is already deployed and trusted by the
network.

 This account also has some other state fields:


 Nonce: number of transactions initiated by the account.

 Balance: represents the balance of the account in Wei.

 CodeHash: The hash of the smart contract code is stored in this field.

 Storage: This field contains the data of the storage variables within the smart
contract.

TRANSACTIONS AND MESSAGES

 digitally signed data packet using a private key that contains the instructions that,
when completed, either result in a message call or contract creation.
TYPES OF TRANSACTION

 Message call transactions:

 result in a state transition.


 A message call derives from an EOA that wants to interact with
another EOA or contract account

 Eg : sending Ether from one account to another, or interacting with a smart


contract

 Contract creation transactions:

 derives from an EOA to create a smart contract account


 result in the creation of a new contract account with the associated
code.

 Eg: deploying a storage smart contract to store data.


CONTRACT CREATION TRANSACTIONS

Parameters that are required when creating an account

 Sender

 Original transactor (transaction originator)

 Available gas

 Gas price

 Endowment, which is the amount of ether allocated

 A byte array of an arbitrary length

 Initialization EVM code

 Current depth of the message call/contract-creation stack (current depth means


the number of items that are already there in the stack)

MESSAGE CALL TRANSACTIONS

 The sender

 The transaction originator

 Recipient

 The account whose code is to be executed (same as the recipient)

 Available gas

 Value

 Gas price

 Arbitrary length byte array

 Input data of the call

 Current depth of the message call/contract creation stack


MESSAGES

 A message is a data packet passed between two accounts.

 data packet contains data and value(amount of Ether).

 It can either be sent via a smart contract or from an external actor in the form of a
transaction that has been digitally signed by the sender.

 Contracts can send messages to other contracts.

 Messages only exist in the execution environment and are never stored.

 Messages are produced by the contracts, whereas transactions are produced by


entities external (externally owned accounts) to the Ethereum environment.

 A message consists of the components mentioned here:


 The sender of the message
 Recipient of the message
 Amount of Wei to transfer and message to the contract address
 Optional data field (Input data for the contract)
 The maximum amount of gas (startgas) that can be consumed

TRANSACTION VALIDATION AND EXECUTION

 A transaction must be well-formed and


RLP-encoded

without any additional trailing bytes

 The digital signature used to sign the transaction is valid

 Transaction nonce must be equal to the sender's account's

current nonce

 Gas limit must not be less than the gas used by the transaction

 The sender's account contains enough balance to cover the execution cost.
THE TRANSACTION SUBSTATE

created during the execution of the transaction that is processed immediately after

the execution completes.

 Suicide set or self-destruct set: a set of accounts (if any) that will be discarded after the

transaction completes.

 Log series: allow the monitoring and notification of contract calls to the entities external

to the Ethereum environment, such as application frontends. It works like a trigger


mechanism that is executed every time a specific function is invoked. Logs are created in
response to events occurring in the smart contract. Archived and indexable checkpoints of
the virtual machine’s code execution.

 Refund balance: amount to be refunded to the sender account after the transaction.

Refunds are not immediately executed; the state is finalized by determining the amount
of unused gas to be refunded to the sender. In addition to the unused gas, the sender is
also refunded some allowance from the “refund balance”

TRANSACTION RECEIPTS

 structures are used to record the outcome of the transaction execution 4

Elements :

 The post-transaction state: state after the transaction has been executed. It is
encoded as a byte array.

 Gas used: total amount of gas used in the block that contains the transaction receipt.
The value is taken immediately after the transaction execution is completed. The total
gas used is expected to be a non-negative integer.

 Set of logs: Log entries contain the logger's address, a series of log topics, and the log
data.

 The bloom filter: created from the information contained in the set of logs. It is a
probabilistic data structure that helps to identify whether an element is likely to be in
a set. It's used to Search for and retrieve data, find transferred tokens etc
ETHER CRYPTOCURRENCY / TOKENS

ETHEREUM VIRTUAL MACHINE (EVM)

 runtime environment for smart contracts in Ethereum

 Turing complete programmable machine, which can execute scripts to produce


arbitrary outcomes.

 Ethereum Virtual Machine ensures that all transactions and smart contracts made
on the Ethereum blockchain are executed in correct and expected manner as
desired by the smart contract code.

 facilitates DApp creation and execution on the blockchain.


 EVM is contained within the client software (e.g., Geth, Nethermind) which is
required to run a node on Ethereum. Nodes on Ethereum keep copies of
transaction data, which the EVM processes to update the distributed ledger.

PARTS OF EVM:

EVM (the part that runs solidity source code):

 Written in C++ and uses LLVM as its compiler.

 full-featured virtual machine with all the features such as support for multiple
programming languages, security features, runtime environments and more.

 Allows to write custom EVM bytecode .

Uncles:

 These are small pieces of smart contracts or data stored on the blockchain.

 allows for you to store metadata about your program

 EVM Assembly: This is the bytecode of EVM, which you can use as
your programming language.

 EVM participates in block creation and transaction execution.

 In block creation, EVM sets standards for managing the state from block to block.
These states are stored in a Merkle Patricia Trie and hold the ground truth state for
Ethereum.

 In transaction execution, the EVM executes tasks (e.g., function calls to a smart
contract) by interpreting the instructions in Opcodes. To get the data into
bytecode, use a programming language such as Solidity (i.e., the native
programming language for smart contracts) to compile and deploy the smart
contract using bytecode.

 When the EVM executes tasks, it is limited to the amount of gas provided by the
transaction and the overall limitations of the EVM.

 Gas is a unit of measure for computing power on Ethereum.


EVM ARCHITECTURE
TYPES OF SPACE IN THE EVM

Stack:

 last-in, first-out container with a fixed size and maximum depth of 1,024 items to
which values can be pushed and popped.

 Each stack item is 256 bits long. This was chosen to facilitate
the Keccak- 256 hash scheme and elliptic- curve computations.

Memory:

 This is a volatile and expandable word-addressed byte array.

Key/value store:

 This is a word-addressable word array.

 used as the long term account storage for the smart contract.

Program counter in an EVM indicates the specific instruction


from the code, that should be read and executed next by the EVM.

HOW DOES THE EVM WORK?

 Developers on Ethereum write their smart contract code in a programming


language called Solidity. The code is then translated to byte code so that the EVM
can read the instructions.

 Instructions are first broken down into ‘opcodes’.

 Every line of code is converted to opcodes so that the EVM knows


exactly how to execute a transaction.

 Every transaction on Ethereum requires a gas fee to be executed.

 The more opcodes there are, the higher your gas fees will be.

 Gas: The amount of computational effort required to execute operations on a


blockchain network. Every EVM computation requires gas fees otherwise, the
transaction will not be processed.
ETHEREUM – GAS AND FEES

 Gas is the energy fueling smart contract execution in EVM

 Gas refers to the unit that measures the amount of computational effort

required to execute specific operations on the Ethereum network.

 The gas fee is the amount of gas used to do some operation, multiplied by the cost
per unit gas.

 The fee is paid regardless of whether a transaction succeeds or fails.

 Gas fees have to be paid in Ethereum's native currency, ether (ETH).

 Gas prices are usually quoted in gwei, which is a denomination of ETH. Each gwei is

equal to one-billionth of an ETH (0.000000001 ETH or 10- 9 ETH).

 The total gas you pay is divided into two components: the base fee and the
priority fee (tip).

 The base fee is set by the protocol - you have to pay at least this

amount for your transaction to be considered valid.

 The priority fee is a tip that you add to the base fee to make your transaction
attractive to validators so that they choose it for inclusion in the next block.

 Max fee: To execute a transaction on the network, users can specify a maximum
limit they are willing to pay for their transaction to be executed. This optional
parameter is known as the maxFeePerGas. For a transaction to be executed, the
max fee must exceed the sum of the base fee and the tip.
HOW ARE GAS FEES CALCULATED?
SMART CONTRACT

 Self executing contracts which contains the terms and conditions of an agreement
between the peers

 Smart contracts are the executable programs that run on the Ethereum blockchain.

 written using specific programming languages like solidity and vyper that compile to
EVM bytecode

 allows secure and trusted transactions between anonymous parties without


consulting a central authority.

WHY SMART CONTRACTS ?


DESIGN METHODOLOGY FOR SMART CONTRACT APPLICATION
USE CASE FOR SMART CONTRACT
ETHEREUM ARCHITECTURE
COMPONENTS OF THE ETHEREUM
Ethereum client:

 Geth runs on the nodes and connects to the peer-to-peer Ethereum network
from where blockchain is downloaded and stored locally

 It provides various functions, such as mining and

account management.

 The local copy of the blockchain is synchronized regularly with the network

web3.js library

 allows interaction with the node in the ethereum network

HOW DOES ETHEREUM WORK?

 When a transaction triggers a smart contract all the nodes of the network will execute

every instruction.

 All the nodes will run the EVM as part of the block verification, where the nodes will go

through the transactions listed in the block and runs the code as triggered by the

transaction in the EVM.

 All the nodes on the network must perform the same calculations for keeping their ledgers

in sync.

 Every transaction must include:


 Gas limit.
 Transaction Fee that the sender is willing to pay for the transaction.

 If the total amount of gas needed to process the transaction is less than or equal to the

gas limit then the transaction will be processed and if the total amount of the gas needed

is more than the gas limit then the transaction will not be processed the fees are still lost.

 Thus it is safe to send transactions with the gas limit above the estimate to increase the

chances of getting it processed.


DECENTRALIZED APPLICATION (DAPP)

 Dapp is an application that uses smart contracts.

 Dapp provides a user-friendly interface to smart contracts

 Dapp main components are smart contract and files for web user interface
front-end/back-end
DAPP CREATION WORKFLOW
SIX MAIN IMPLEMENTATIONS OF ETHERUM PROTOCOL

 Parity written in rust


 Geth written in Go
 Cpp-ethereum written in C++
 Pyethereum written in python
 Mantis written in Scala
 Harmony written in java

GETH & ETHEREUM COMMAND LINE

 It is implemented in GO language
 By installing and running geth, you can take part in frontier
 Mine Ether
 Transfer Fund between different addresses
 Create smart contract and deploy it

WHAT GETH CAN DO?

 Create a node
 Create an account
 Check Account Balance
 Unlock Account
 Start mining
 Transfer funds
 Add fees
 Contract creation
 Deploy Contract etc

TYPES OF ETHEREUM MINING

 Pool Mining
 Solo Mining
 Cloud Mining
ETHEREUM MINING & REWARDS

 Ethereum Mining is a process of creating and adding a block of transactions to the


blockchain network of Ethereum.

 All transactions taking place in the Ethereum network need to get approved by
the miners.

 Miners use a Hashing Scrypt (Ethash) to solve computationally hard puzzles for
successfully mining the blocks of transactions, in the Ethereum Blockchain
Network.

 This process helps secure the network from attacks like hacking or manipulation
of identity.

 Miners get rewards for mining and gas fee

POOL MINING

 Pool Mining is the easiest and fastest way to get started with Ethereum Mining.

 Miners will work along with other people together in a single pool.

 Rewards will be shared by everyone in the pool.

 Important Factors to be considered before joining a Pool are:

 Pool size

 Minimum Payout

 Pool fee
 Pool size is the factor that determines the number of blocks you find in the
Ethereum network and its share rewards. As the number of miners increases, the
chances to get rewards also increase.

 Minimum Payout is the minimum amount of Ethereum you need to mine before
it gets credited to your wallet.

 Pools with large Minimum Payouts are not beneficial as you will have to wait in
the same pool for a longer period before getting your reward.

 Pool fee is the amount to be paid to continue using the pool. This amount is
percentage-based, on the amount of Ethereum you are mining. It mainly varies
between 1% to 3%

SOLO MINING

 In Ethereum Solo Mining, you will get rewarded only if you solve the puzzle and
mine the Ethereum block first.

 Solo Mining is only profitable when you have


plenty of resources

 Disadvantages:

 Electricity costs

 Space

CLOUD MINING

 In Ethereum Cloud Mining, you pay someone else with the equipment to mine
Ethereum for you.

 You pay some amount of money as fees to them for investing their time and
resources, and in return, they provide you with the reward they gain by mining
Ethereum.
HOW DOES THE MINING PROCESS WORK?
HOW DOES THE MINING PROCESS WORK?

 A user requests a transaction with the help of the private key of his

digital wallet account.

 Then the request is shared worldwide with the Ethereum network.

 Next, the requested transaction is added to a list of pending transactions that


need to be added to the Ethereum blockchain network.

 The miner then verifies and validates the requested transaction and

performs a complex mathematical puzzle on the transaction data.

 Once the requested transaction is verified and it stores a copy of it in EVM, the
process of "Proof-of-Work" begins for the respective block.

HOW DOES THE MINING PROCESS WORK?

 Then, the nodes of the Ethereum Network verify that the checksum of
the state of the miner's block matches the checksum of their updated
state of EVM after execution of all transactions.

 Only after that, the block is added to the Ethereum

Blockchain Network.

 On successfully mining the block, it rewards the miner with some


amount of Ether in their wallet.

 Then the requested transaction is approved and credited to the


respective wallet/wallets.
TOOLS TO MINE ETHEREUM

 An Ethereum wallet to store all your currency earned.

 GPU drivers or Graphics Card with a minimum of 3GB RAM.

 A mining software suitable according to your hardware like GPU.

 And a compatible operating system (Windows 7 or 10, 64 bit).

TYPES OF REWARDS

 Block reward
 Gas fee
 Burned fee
 Uncle /Nephew Block reward

Block reward:

 A fixed inflationary reward that only changes at forks.

 The block reward is currently set to 2ETH.

Transaction gas fees:

 Each transaction on Ethereum requires a certain amount of gas


units to execute Opcode commands on the EVM which change the state
of the network.

 The rate at which a user pays for those gas units changes based on a
block’s baseFeePerGas and the user specified
maxPriorityFeePerGas (miner tip).

 The basic formula for calculating the gas fee is


Burned fees:

 The baseFeePerGas is burned/removed from the Ethereum protocol altogether.

 To calculate the total amount of burned fees in a block you can use the following
formula:

Uncle and nephew block rewards:

 An uncle block occurs when two miners create blocks at almost the same time.
While both blocks are valid, the network can only accept one block at a time.
Therefore one block is rejected and labeled as an uncle block.

 Instead of letting this block go stale, a nephew reward equal to 1/32 of a block
reward is issued to any miner willing to later include this uncle block inside a block
they are mining. Additionally, an uncle reward is issued to the miner of the uncle
block.

 The size of the uncle reward is determined by the following formula:

 Currently its 2ETH/32=0.0652 ETH

Miner Reward = Block reward+ gas fee+ uncle block reward – burned fee
Unit 5 Hyper Ledger Frabic

INTRODUCTION

At a high-level, blockchain technology consists of three components:

 Distributed ledger,

 consensus algorithm,

 Smart Contracts

 transactional log that keeps a complete record of the entire history of data changes.
 immutable and append-only

 committed transactions are independently verifiable by each member in a network.

 each member of the network maintains a copy.

Consensus algorithms

 ensure that the members in the network have an agreed-upon method to allow
transactions and data to be committed to the ledger and execution of smart contract
code.

 If the consensus requirements aren't met, then the transaction or operation is considered
invalid.

Smart contracts

 Smart contracts are code that is executed on the blockchain network.

 define the rules of a business contract and are executed programatically when the
preconditions for the contract are met.

HYPERLEDGER

 open-source platform

 Enables to build solutions using distributed ledger technology


 focus on confidentiality, resiliency, and flexibility

 managed by the Linux Foundation

 not a tool and neither a platform like Ethereum

 create and develop enterprise-grade solutions

 Ethereum is a public network, with a generalized protocol

 Hyperledger, enables businesses to create personalized blockchains that tend to the

needs of different businesses

BENEFITS OF HYPERLEDGER

 open-source
 Suitable for Wide-Ranging Industry
 Quality Code

WHY DO WE NEED HYPERLEDGER?

 In blockchain networks, every peer needs to validate each and every transaction and run
consensus at the same time, take a huge blow in terms of scalability.

 Blockchain donot support private and confidential transaction

 Example: Consider a situation when person X wants to buy medicine from person Y, who
was a doctor living in another country.

 In case of public blockchain, every transaction will get updated in the network to all the
peers. In hyperledger, the parties are directly connected and the concerned people’s
ledger will be updated.

 providing privacy and confidentiality.


HYPERLEDGER ARCHITECTURE
HYPERLEDGER VS ETHEREUM
COMPARISON OF HYPERLEDGER WITH BITCOIN & ETHEREUM
HYPERLEDGER TECHNOLOGY LAYERS

Hyperledger-based technology works using these layers:

 A consensus layer, which makes an agreement on order and confirms if the


transactions in a block are correct.

 A smart contract layer, which processes and authorizes transaction requests

 A communication layer, which manages peer-to-


peer (P2P)
message transport.

 An API, which allows other applications to communicate with the blockchain.

 Identity management services, which validates the identities of users and systems.

PROJECTS UNDER HYPERLEDGER

Two categories of projects under Hyperledger

 blockchain projects

 relevant tools or modules that support

blockchains.
HOW DOES HYPERLEDGER WORK?
BLOCKCHAIN FRAMEWORK PROJECTS UNDER HYPERLEDGER

 Hyperledger Fabric, used extensively in supply-chain networks

 Hyperledger Sawtooth, is being used in the fishing industry to track the journey of fishes

 Hyperledger Burrow, which is being used to run Ethereum smart

contracts in a Hyperledger network

 Hyperledger Iroha, finds usage in mobile application optimization with the help of
blockchain

 Hyperledger Indy, is being used as a decentralized identity database service for


businesses

PROJECTS UNDER MODULES

 Hyperledger Cello

 Hyperledger Composer

 Hyperledger Explorer

 Hyperledger Quilt
INDUSTRY USE CASES FOR HYPERLEDGER FABRIC - SUPPLY CHAIN

 Hyperledger Fabric networks can improve supply chain processes by increasing


transparency and traceability of transactions within the network.

 Companies with access to the ledger can view the same immutable data, which enforces
accountability and reduces the risk for counterfeiting.

 Production updates are added to the ledger in real time, which makes tracking
provenance faster and simpler during events like product recalls or food contamination
outbreaks.

INSURANCE

 With Hyperledger Fabric, insurance companies can reference transaction data stored on
the ledger to identify duplicate or falsified claims.

 Blockchain can also make multi-party subrogation claims processing faster by using
smart contracts to automate repayment from the at-fault party back to the insurance
company.

 Insurers can use Hyperledger Fabric to streamline Know Your Customer (KYC) processes
by storing customer data on a distributed ledger and automating the verification of their
identity documents with smart contracts.

TRADING AND ASSET TRANSFER

 Using Hyperledger Fabric, financial and trading consortiums can easily create a

blockchain network where all parties can transact and process trade-related paperwork

electronically, without the need for a central trusted authority.

 Transactions in a Hyperledger Fabric network built using Managed

Blockchain can process instantly.


HYPERLEDGER FABRIC

 popular projects in Hyperledger

 made in cooperation with IBM and Digital Asset

 permissioned blockchain infrastructure

 used to build blockchain-based products, software and applications

 provides a modular architecture that defines roles between nodes, execution of


smart contracts and configurable consensus services.

 Used with integration projects that need a distributed ledger.

 provides a high degree of security, privacy, and scalability

 An organization in a network is defined by a root certificate specific to that organization.

 Each organization has a Fabric certificate authority and one or more peer

nodes to carry out operations on behalf of that organization.

 peer node endorses the transactions, stores and executes smart contract code

and stores a local copy of the ledger for access.

 Fabric clients interact with peer nodes to read the ledger, add new chaincode to the

network, or propose a new transaction.

 An ordering service is shared by all organizations in the network to process

transactions for the network.


HOW DOES HYPERLEDGER FABRIC WORK?
HYPERLEDGER FABRIC TRANSACTION FLOW
3 PEER ROLES
 Committer:

Appends validated transactions to their specific ledger.

 Endorser:

Endorser nodes are responsible for simulating transactions specific to their network
and preventing unreliable and non- deterministic transactions.
 Consenter:

validate the transaction by verifying the result produced by the affiliated peers who
want to proceed with a transaction.

COMPONENTS OF FABRIC

 Ledger
 Chaincode
 Consensus mechanism
 Access control
 Events
 System monitoring and management
 Wallets
 System integration components
TRANSACTIONS

 Transactions in the fabric are private, confidential, and anonymous for general users, but
they can still be traced and linked to the users by authorized auditors.

 As a permissioned network, all participants must register with the membership services
to access the blockchain network.

 This ledger also provided auditability functionality to meet the regulatory and compliance
needs required by the user.

MEMBERSHIP SERVICES

1. User identity verification

2. User registration

3. Assign appropriate permissions to the users depending on their roles

 A certificate authority(CA) support identity management


and authorization operations.

 CA can be internal (Fabric CA), which is a default or an external certificate


authority.

 Fabric CA issues enrollment certificates (E-Certs), to join the blockchain network.

 There are also temporary certificates issued called TCerts, which are used for one-
time transactions.

 All peers and applications are identified using certificate authority.

 Authentication service is provided by the certificate authority.

MEMBERSHIP SERVICE PROVIDER (MSP)

 MSP is a modular component that is used to manage identities on the blockchain

 This provider is used to authenticate clients who want to join the blockchain

network.
 CA is used in MSP to provide identity verification and binding service.

TRANSACTION MESSAGES

 Types:

 Deployment transactions

 Invocation transactions

 Deployment transactions is used to deploy new chaincode to the ledger

 Invocation transactions is used to call functions from the smart contract.

 Transactions can be either public or confidential.

 Public transactions are open and available to all participants

 Confidential transactions are visible only in a channel open to its


participants.

BLOCK STRUCTURE

 Block Header consists of Number, Previous hash, and Data hash.

 Transaction is made up of multiple fields such as transaction type, version, timestamp,


channel ID, transaction ID, epoch, payload visibility, chaincode path, chaincode name,
chaincode version, creator identity, signature, chaincode type, input, timeout, endorser
identities and signatures, proposal hash, chaincode events, response status, namespace, read
set, write set, start key, end key, list of read, and Merkle tree query summary.

 Block Metadata consists of creator identity, relevant signatures, last configuration block
number, flag for each transaction included in the block, and last offset persisted.
PEER TO PEER PROTOCOL

 P2P protocol in the Hyperledger Fabric is built using google RPC (gRPC).

 define the structure of the messages.

 Messages are passed between nodes in order to perform various functions.

 Types of messages in Hyperledger Fabric:

 discovery,

 transaction,

 synchronization, and

 consensus.

 Discovery messages are exchanged between nodes when starting up in order to discover
other peers on the network.

 Transaction messages are used to deploy, invoke, and query transactions

 Consensus messages are exchanged during consensus.

 Synchronization messages are passed between nodes to synchronize and keep the
blockchain updated on all nodes.

LEDGER STORAGE

 by default, LevelDB is used which is available at each peer.

 An alternative is to use CouchDB which provides the ability to run rich queries.

 LevelDB is a key-value store whereas CouchDB stores data as JSON objects

SMART CONTRACTS

 In Hyperledger Fabric same concept of smart contracts is implemented but they are

called chain code.

 They have conditions and parameters to execute transactions and update the ledge.
 Chaincode is usually written in Golang and Java

CHAINCODE SERVICES

 allow the creation of secure containers that are used to execute the chaincode.

 Secure container: Chaincode is deployed in Docker containers that provide a locked down
sandboxed environment for smart contract execution.

 Currently, Golang is supported as the main smart contract language,

 Secure registry: provides a record of all images containing smart contracts.

 Events can be triggered by endorsers and smart contracts.

 External applications can listen to these events and react to them if required via event
adapters.

 An application programming interface provides an interface into the fabric by exposing


various REST APIs

 APIs include interfaces for identity, transactions, chaincode, ledger, network, storage, and
events.

HYPERLEDGER FABRIC CONSENSUS ALGORITHM

 Practical Byzantine Fault Tolerance (PBFT):

provides fault tolerance and reliability in a network.

Suited for networks with a limited number of participants who are trusted and well-
known.

 RAFT:

used to maintain a consistent state across multiple nodes. Suited for networks where the
participants are unknown and potentially untrusted.

 Solo:

used for testing purposes in a single-node network. not suitable for


production use.
CHAINCODE IMPLEMENTATION

 written in Golang or Java.

 can be public, confidential, or access controlled.

 These code files serve as a smart contract that users can interact with via APIs.

 Users can call functions in the chaincode that result in a state change, and consequently
updates the ledger.

 four functions used to implement the chaincode:

 Init(): invoked when chaincode is deployed onto the ledger. This initializes the chaincode and
results in making a state change, which accordingly updates the ledger.

 Invoke(): used when contracts are executed. Results in a state change and writes to the
ledger.

 Query(): used to query the current state of a deployed chaincode. This function does not
make any changes to the ledger.

 4(): This function is executed when a peer deploys its own copy of the chaincode. The
chaincode is registered with the peer using this function.

APPLICATION MODEL

 MVC-B architecture

 Components in this model are Model, View, Control, and Blockchain:

 View logic: This is concerned with the user interface. It can be a desktop, web application,
or mobile frontend.

 Control logic: This is the orchestrator between the user interface, data model, and APIs.

 Data model: This model is used to manage the off-chain data.

 Blockchain logic: This is used to manage the blockchain via the controller and the data
model via transactions.
CONSENSUS IN HYPERLEDGER FABRIC

The consensus mechanism in Hyperledger Fabric consists


of three steps:

1. Transaction endorsement: This process


endorses the transactions by simulating the
transaction execution process.

2. Ordering: This is a service provided by the


cluster of orderers which takes endorsed
transactions and decide on a sequence in which
the transactions will be written to the ledger.

3. Validation and commitment: This process is


executed by committing peers which first
validates the transactions received from the
orderers and then commit that transaction to
the ledger.

TRANSACTION LIFE CYCLE IN HYPERLEDGER FABRIC


TRANSACTION LIFE CYCLE
1. Transaction proposal by clients. This is the first step where a transaction is proposed by
the clients and sent to endorsing peers on the distributed ledger network. All clients need
to be enrolled via membership services before they can propose transactions.

2. The transaction is simulated by endorsers which generates a read-write (RW) set. This is
achieved by executing the chaincode but instead of updating the ledger, only a read-
write set depicting any reads or updates to the ledger is created.

3. The endorsed transaction is sent back to the application.

4. Submission of endorsed transactions and read-write (RW) sets to the ordering service by
the application.

5. The ordering service assembles all endorsed transactions and read-write sets in order into
a block, and sorts them by channel ID.

6. Ordering service broadcasts the assembled block to all committing peers.

7. Committing peers validate the transactions.

8. Committing peers update the ledger.

9. Finally, notification of success or failure of the transaction by committing peers is sent


back to the clients/applications

BENEFITS OF HYPERLEDGER FABRIC

 Open Source

 Private and Confidential

 Access Control

 Chaincode Functionality

 Performance
COMPARISON BETWEEN FABRIC & OTHER TECHNOLOGIES

You might also like