0% found this document useful (0 votes)
3 views100 pages

Understanding Distributed Databases and BFT

The document discusses distributed databases, highlighting their types (homogeneous and heterogeneous), management processes (replication and duplication), and applications in various fields. It also covers the Byzantine Generals Problem and Byzantine Fault Tolerance, emphasizing the challenges of achieving consensus in decentralized systems. Additionally, it explains the Hadoop Distributed File System (HDFS), its architecture, features, limitations, and concepts like hashing and distributed hash tables, along with blockchain technology and its relation to Turing completeness.

Uploaded by

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

Understanding Distributed Databases and BFT

The document discusses distributed databases, highlighting their types (homogeneous and heterogeneous), management processes (replication and duplication), and applications in various fields. It also covers the Byzantine Generals Problem and Byzantine Fault Tolerance, emphasizing the challenges of achieving consensus in decentralized systems. Additionally, it explains the Hadoop Distributed File System (HDFS), its architecture, features, limitations, and concepts like hashing and distributed hash tables, along with blockchain technology and its relation to Turing completeness.

Uploaded by

THEJASHWINI M
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

Module-2

Distributed Database
Distributed Database
• A distributed database is a database that consists of two or more files located in
different sites either on the same network or on entirely different networks.
• A distributed database is basically a database that is not limited to one system,
it is spread over different sites, i.e, on multiple computers or over a network of
computers.
• A distributed database system is located on various sites that don’t share
physical components.
• This may be required when a particular database needs to be accessed by
various users globally.
• It needs to be managed such that for the users it looks like one single database.
Types
1. Homogeneous Database:
• In a homogeneous database, all different sites store database identically.
• The operating system, database management system, and the data
structures used – all are the same at all sites. Hence, they’re easy to manage.
2. Heterogeneous Database:
• In a heterogeneous distributed database, different sites can use different
schema and software that can lead to problems in query processing and
transactions.
• Also, a particular site might be completely unaware of the other sites.
Different computers may use a different operating system, different database
application. They may even use different data models for the database.
Hence, translations are required for different sites to communicate.
• Two processes ensure that the distributed databases remain up-to-
date and current: replication and duplication.
• Replication involves using specialized software that looks for changes
in the distributive database. Once the changes have been identified,
the replication process makes all the databases look the same. The
replication process can be complex and time-consuming, depending
on the size and number of the distributed databases. This process can
also require much time and computer resources.
• Duplication, on the other hand, has less complexity. It identifies one
database as a master and then duplicates that database. The
duplication process is normally done at a set time after hours. This is
to ensure that each distributed location has the same data. In the
duplication process, users may change only the master database. This
ensures that local data will not be overwritten.
• Applications of Distributed Database:

• It is used in Corporate Management Information System.


• It is used in multimedia applications.
• Used in Military’s control system, Hotel chains etc.
• It is also used in manufacturing control system.
Two General Problem
• The problem arises when the two generals cannot come to a common
conclusion of whether to fight the war or revoke from it.
• This problem (first published in 1975 and given its name in 1978) describes a
scenario where two generals are attacking a common enemy. General 1 is
considered the leader and the other is considered the follower. Each general’s
army on its own is not enough to defeat the enemy army successfully, thus they
need to cooperate and attack at the same time.
• In order for them to communicate and decide on a time, General 1 has to send
a messenger across the enemy’s camp that will deliver the time of the attack to
General 2. However, there is a possibility that the messenger will get captured
by the enemies and thus the message won’t be delivered. That will result in
General 1 attacking while General 2 and his army hold their grounds.
• Even if the first message goes through, General 2 has to acknowledge
(ACK, notice the similarity to the 3-way handshake of TCP ) that he
received the message, so he sends a messenger back, thus repeating
the previous scenario where the messenger can get caught. This
extends to infinite ACK’s and thus the generals are unable to reach an
agreement.
• There is no way to guarantee the second requirement that each
general be sure the other has agreed to the attack plan. Both generals
will always be left wondering whether their last messenger got
through.
Byzantine General’s Problem
• In 1982, The Byzantine General’s Problem was invented by Leslie
Lamport, Robert Shostak, and Marshall Pease.
• Byzantine Generals Problem is an impossibility result which means
that the solution to this problem has not been found yet as well as
helps us to understand the importance of blockchain.
• It is basically a game theory problem that provides a description of
the extent to which decentralized parties experience difficulties in
reaching consensus without any trusted central parties.
• The Byzantine army is divided into many battalions in this classic
problem called the Byzantine General’s problem, with each division led
by a general.
• The generals connect via messenger in order to agree to a joint plan of
action in which all battalions coordinate and attack from all sides in order
to achieve success.
• It is probable that traitors will try to sabotage their plan by intercepting
or changing the messages.
• As a result, the purpose of this challenge is for all of the faithful
commanders to reach an agreement without the imposters tampering
with their plans.
• Centralized systems do not address the Byzantine Generals problem,
which requires that truth be verified in an explicitly transparent way,
yet centralized systems give no transparency, increasing the likelihood
of data corruption.
• The fundamental issue of centralized systems, however, is that they
are open to corruption by the central authority, which implies that the
data can be manipulated by anyone who has control of the database
itself because the centralized system concentrates all power on one
central decision maker.
Byzantine Fault Tolerance (BFT)

• The Byzantine Fault Tolerance was developed as inspiration in order


to address the Byzantine General’s Problem.
• The Byzantine General’s Problem, a logical thought experiment where
multiple generals must attack a city, is where the idea for BFT
originated.
• When two-thirds of the network can agree or reach a consensus and
the system still continues to operate properly, it is said to have BFT.
Hadoop Distributed File
System(HDFS)
• With growing data velocity the data size easily outgrows the storage
limit of a machine. A solution would be to store the data across a
network of machines. Such filesystems are called distributed
filesystems. Since data is stored across a network all the complications
of a network come in.
• HDFS provides one of the most reliable filesystems. HDFS (Hadoop
Distributed File System) is a unique design that provides storage for
extremely large files with streaming data access pattern and it runs on
commodity hardware.
• Extremely large files: Here we are talking about the data in range of
petabytes(1000 TB).
• Streaming Data Access Pattern: HDFS is designed on principle of
write-once and read-many-times. Once data is written large portions
of dataset can be processed any number times.
• Commodity hardware: Hardware that is inexpensive and easily
available in the market. This is one of feature which specially
distinguishes HDFS from other file system.
Nodes: Master-slave nodes typically
forms the HDFS cluster.
NameNode(MasterNode):
• Manages all the slave nodes and assign work to them.
• It executes filesystem namespace operations like opening, closing, renaming files
and directories.
• It should be deployed on reliable hardware which has the high config. not on
commodity hardware.
DataNode(SlaveNode):
• Actual worker nodes, who do the actual work like reading, writing, processing etc.
• They also perform creation, deletion, and replication upon instruction from the
master.
• They can be deployed on commodity hardware.
HDFS daemons
• Daemons are the processes running in background.
Namenodes:
• Run on the master node.
• Store metadata (data about data) like file path, the number of blocks, block Ids. etc.
• Require high amount of RAM.
• Store meta-data in RAM for fast retrieval i.e to reduce seek time. Though a
persistent copy of it is kept on disk.
DataNodes:
• Run on slave nodes.
• Require high memory as data is actually stored here.
Data storage in HDFS
• Lets assume that 100TB file is inserted, then masternode(namenode)
will first divide the file into blocks of 10TB (default size is 128 MB in
Hadoop 2.x and above).
• Then these blocks are stored across different datanodes(slavenode).
• Datanodes(slavenode)replicate the blocks among themselves and the
information of what blocks they contain is sent to the master.
• Default replication factor is 3 means for each block 3 replicas are
created (including itself).
• MasterNode has the record of everything, it knows the location and
info of each and every single data nodes and the blocks they contain,
i.e. nothing is done without the permission of masternode.
• No two replicas of the same block are present on the same datanode.
Why divide the file into blocks?
• Let’s assume that we don’t divide, now it’s very difficult to store a 100
TB file on a single machine.
• Even if we store, then each read and write operation on that whole
file is going to take very high seek time.
• But if we have multiple blocks of size 128MB then its become easy to
perform various read and write operations on it compared to doing it
on a whole file at once.
• So we divide the file to have faster data access i.e. reduce seek time.
Why replicate the blocks in data
nodes while storing?
• Let’s assume we don’t replicate and only one yellow block is present
on datanode D1.
• Now if the data node D1 crashes we will lose the block and which will
make the overall data inconsistent and faulty.
• So we replicate the blocks to achieve fault-tolerance.
Terms related to HDFS:
• HeartBeat : It is the signal that datanode continuously sends to
namenode. If namenode doesn’t receive heartbeat from a datanode
then it will consider it dead.
• Balancing : If a datanode is crashed the blocks present on it will be
gone too and the blocks will be under-replicated compared to the
remaining blocks. Here master node(namenode) will give a signal to
datanodes containing replicas of those lost blocks to replicate so that
overall distribution of blocks is balanced.
• Replication: It is done by datanode.
Features
Distributed data storage.
• Blocks reduce seek time.
• The data is highly available as the same block is present at multiple
datanodes.
• Even if multiple datanodes are down we can still do our work, thus
making it highly reliable.
• High fault tolerance.
Limitations:
• Low latency data access: Applications that require low-latency access
to data i.e in the range of milliseconds will not work well with HDFS,
because HDFS is designed keeping in mind that we need high-
throughput of data even at the cost of latency.
• Small file problem: Having lots of small files will result in lots of seeks
and lots of movement from one datanode to another datanode to
retrieve each small file, this whole process is a very inefficient data
access pattern.
Hashing
• Hashing is the process of transforming any given key or a string of
characters into another value.
• This is usually represented by a shorter, fixed-length value or key that
represents and makes it easier to find or employ the original string.
• The most popular use for hashing is the implementation of hash tables.
• A hash table stores key and value pairs in a list that is accessible through
its index.
• Because key and value pairs are unlimited, the hash function will map the
keys to the table size.
• A hash value then becomes the index for a specific element.
Distributed Hash Table
• A Distributed Hash Table is a decentralized data store that looks up data
based on key-value pairs.
• Every node in a distributed hash table is responsible for a set of keys and
their associated values.
• The key is a unique identifier for its associated data value, created by
running the value through a hashing function.
• The data values can be any form of data.
• Distributed hash tables are decentralized, so all nodes form the collective
system without any centralized coordination.
• They are generally fault-tolerant because data is replicated across multiple
nodes.
• Distributed hash tables can scale for large volumes of data across many
nodes.
• Distributed hash tables provide an easy way to find information in a
large collection of data because all keys are in a consistent format,
and the entire set of keys can be partitioned in a way that allows fast
identification on where the key/value pair resides.
• The nodes participating in a distributed hash table act as peers to find
specific data values, as each node stores the key partitioning scheme
so that if it receives a request to access a given key, it can quickly map
the key to the node that stores the data.
• It then sends the request to that node.
• Also, nodes in a distributed hash table can be easily added or
removed without forcing a significant amount of re-balancing of the
data in the cluster.
• Cluster rebalancing, especially for large data sets, can often be a time-
consuming task that also impacts performance.
• Having a quick and easy means for growing or shrinking a cluster
ensures that changes in data size does not disrupt the operation of
the applications that access data in the distributed hash table.
ASIC Resistance
• ASIC-resistant is the property of a cryptocurrency that is “immune” to ASIC
mining.
• ASICs are integrated circuits that are created to serve a specific use case,
performing a particular computing task.
• In the world of cryptocurrencies, ASIC devices are designed to participate in the
process of mining Bitcoin (or other cryptocurrencies).
• As such, Bitcoin is an example of a cryptocurrency that cannot be considered
ASIC-resistant.
• An ASIC-resistant cryptocurrency has its protocol and mining algorithm
configured in such a way that using ASIC machines to mine the coin is either
impossible or brings no significant benefit when compared to traditional GPU
mining.
• In some cases, using ASICs on ASIC-resistant cryptocurrencies may be even worse
than using the more conventional hardware.
• Since mining involves multiple attempts of finding a solution for a sort of
mathematical problem, the job of an ASIC is to perform as many attempts as
possible (i.e., as many hashing functions per second as possible).
• This means that using ASICs to mine Bitcoin or other Proof of Work
cryptocurrencies is much better than using a general-purpose piece of
hardware, such as a GPU card.
• However, the process of making a cryptocurrency ASIC-resistant is a
defensive game, which requires continued development and modifications.
• This is due to the reason that ASIC designers and manufacturers are
constantly producing new models of ASIC miners, and sometimes, the newer
models are able to bypass the ASIC-resistance of certain cryptocurrencies.
Turing Complete
• Turing Complete refers to a machine that, given enough time and
memory along with the necessary instructions, can solve any
computational problem, no matter how complex.
• The term is normally used to describe modern programming
languages as most of them are Turing Complete (C++, Python,
JavaScript, etc.).
• A device or programming language is considered to be Turing
Complete when it can replicate a Turing Machine by running any
program or solving any problem the Turing Machine could run or
solve.
• On the other hand, if a device or programming language is not able to
do it, then it is said to be Turing Incomplete.
• A simple calculator is an example of a system which is Turing
Incomplete since it can only do a few types of calculations.
• In contrast, a programmable scientific calculator (able to perform all
kinds of calculations) can be deemed as a Turing Machine.
Blockchain and Turing
Completeness
• While some applications of blockchain technology are Turing
Complete, others are Turing Incomplete.
• This varies according to the scripting technology implemented. For
example, the 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, on the other hand, is built as a Turing Complete
blockchain.
• This is important because it needs to understand the agreements
which make up smart contracts.
• By being Turing Complete, Ethereum has the capability to understand
and implement any future agreement, even those that have not been
thought of yet.
• In other words, 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.
Blockchain security
• Blockchain security is built on two concepts Cryptography and
Hashing.
• In the blockchain, cryptography is used to secure transactions taking
place between two nodes in a blockchain network. Cryptography is
used to encrypt messages in a P2P network.
• Hashing is used to secure the block information and the link blocks in
a blockchain.
Cryptography in Blockchain
• Cryptography primarily focuses on ensuring the security of
participants, transactions, and safeguards against double-spending.
• It helps in securing different transactions on the blockchain network.
It ensures that only the individuals for whom the transaction data is
intended can obtain, read and process the transaction.
• Blockchain is developed with a range of different cryptography
concepts. The development of cryptography technology promotes
restrictions for the further development of blockchain.
• In the blockchain, cryptography is mainly used to protect user privacy
and transaction information and ensure data consistency.
• The core technologies of cryptography include symmetric encryption
and asymmetric encryption.
• Asymmetric cryptography uses digital signatures for verification
purposes, every transaction recorded to the block is signed by the
sender by digital signature and ensures that the data is not
corrupted.
Cryptography
• Cryptography is a technique or a set of protocols that secure information
from any third party during a process of communication.
• It is also made up of two Greek terms, Kryptos term meaning “hidden” and
Graphein, a term meaning “to write”.
• Some terminologies related to Cryptography:
• Encryption: Conversion of normal text to a random sequence of bits.
• Key: Some amount of information is required to get the information of the
cryptographic algorithm.
• Decryption: The inverse process of encryption, conversion of a Random sequence of
bits to plaintext.
• Cipher: The mathematical function, i.e. a cryptographic algorithm which is used to
convert plaintext to ciphertext(Random sequence of bits).
Types of Cryptography

• The two types of cryptography are:

• Symmetric-key cryptography.
• Asymmetric-key cryptography.
Symmetric-key Encryption
• It focuses on a similar key for encryption as well as decryption.
• Most importantly, the symmetric key encryption method is also applicable to secure
website connections or encryption of data. It is also referred to as secret-key
cryptography.
• The only problem is that the sender and receiver exchange keys in a secure manner.
• The popular symmetric-key cryptography system is Data Encryption System(DES).
• The cryptographic algorithm utilizes the key in a cipher to encrypt the data and the
data must be accessed. A person entrusted with the secret key can decrypt the
data. Examples: AES, DES, etc.
• Features:
• It is also known as Secret key cryptography.
• Both parties have the same key to keeping secrets.
• It is suited for bulk encryptions.
• It requires less computational power and faster transfer.
Asymmetric-key Encryption
• This cryptographic method uses different keys for the encryption and
decryption process. This encryption method uses public and private key
methods.
• This public key method help completely unknown parties to share
information between them like email id. private key helps to decrypt the
messages and it also helps in the verification of the digital signature.
• The mathematical relation between the keys is that the private key cannot
be derived from the public key, but the public key can be derived from the
private key. Example: ECC,DSS etc.
• Features:
• It is also known as Public-key cryptography.
• It is often used for sharing secret keys of symmetric cryptography.
• It requires a long processing time for execution.
• Plays a significant role in website server authenticity.
Cryptography Hash Function in
Blockchain
• One of the most notable uses of cryptography is cryptographic hashing.
Hashing enables immutability in the blockchain.
• The encryption in cryptographic hashing does not involve any use of keys.
• When a transaction is verified hash algorithm adds the hash to the block,
and a new unique hash is added to the block from the original transaction.
• Hashing continues to combine or make new hashes, but the original
footprint is still accessible.
• The single combined hash is called the root hash.
• Hash Function helps in linking the block as well as maintaining the integrity
of data inside the block and any alteration in the block data leads to a break
of the blockchain.
• Some commonly used hashed function is MD5 and SHA-1.
Properties of Cryptographic Hash

• For a particular message hash function does not change.


• Every minor change in data will result in a change in a major change in
the hash value.
• The input value cannot be guessed from the output hash function.
• They are fast and efficient as they largely rely on bitwise operations.
Benefits of Hash function in
Blockchain

• Reduce the bandwidth of the transaction.


• Prevent the modification in the data block.
• Make verification of the transaction easier.
Use of Cryptographic Hash
Functions
• As the blockchain is also public to everyone it is important to secure data
in the blockchain and keeps the data of the user safe from malicious
hands. So, this can be achieved easily by cryptography.
• When the transaction is verified through a hash algorithm, it is added to
the blockchain, and as the transaction becomes confirmed it is added to
the network making a chain of blocks.
• Cryptography uses mathematical codes, it ensures the users to whom
the data is intended can obtain it for reading and processing the
transaction.
• Many new tools related to the application of cryptography in blockchain
have emerged over the years with diverse functionalities.
Benefits of Cryptography in
Blockchain
• Encryption: Cryptography uses asymmetric encryption to ensure that the
transaction on their network guards the information and communication
against unauthorized revelation and access to information.
• Immutability: This feature of cryptography makes it important for blockchain
and makes it possible for blocks to get securely linked by other blocks and also
to ensure the reliability of data stored in the blockchain, it also ensures that no
attacker can derive a valid signature for unposed queries from previous queries
and their corresponding signatures.
• Security: Cryptography makes the records of transactions easier using
encryption of data, and accessing of data using public and private keys.
Cryptographic hashing tampering with data is not possible, making blockchain
more secure.
• Scalability: Cryptography makes the transaction irreversible giving the
assurance that all users can rely on the accuracy of the digital ledger. It allows
limitless transactions to be recorded securely in the network.
• Non-repudiation: The digital signature provides the non-repudiation service
to guard against any denial of a message passed by the sender. This benefit
can be associated with collision resistance i.e.; since every input value has a
unique hash function so there is no clash between the messages that are sent
and one message can be easily differentiated from the other.
• Prevent hackers: The digital signature prevents hackers from altering the data
because if the data changes, the digital signature becomes invalid. With the
help of cryptography, it protects the data from hackers and makes
cryptography in blockchain unstoppable.
Limitations of Cryptography in
Blockchain
• Information difficult to access: Strongly encrypted and digitally signed
information can be difficult to access even for a legitimate user at the most
critical time of decision-making. The network can be attacked and rendered
non-functional by an intruder.
• High availability: It is one of the fundamental aspects of information security,
and cannot be ensured through the use of cryptography. Other methods are
needed to guard against the threats such as denial of service or complete
breakdown of the information systems.
• No protection against vulnerabilities: Cryptography does not guard against
the vulnerabilities and threats that emerge from the poor design of
protocols, procedures, and systems. These issues need to be fixed with the
proper design of the defense infrastructure.
• Expensive: Cryptography needs huge time and money investments.
Public key cryptography needs setting up and maintenance of public
key infrastructure which requires huge investment. Addition of
cryptographic techniques while sending messages and information
processing adds to the delay.
• Vulnerability: The security of cryptographic techniques depends on
the complexity and difficulty of the mathematical problem. Any
breakthrough in solving such mathematical problems can make
cryptographic techniques vulnerable.
Wallets And Digital Signatures
• A blockchain wallet is a special software or a hardware device that is
used to keep the transaction information and personal information of
the user. Blockchain wallets do not contain the actual currency. The
wallets are used to keep private keys and maintain a transaction
balance.
• Wallets are only a communication tool to communicate, to carry out
transactions with other users. The real data or currency is stored in
blocks in the blockchain.
• Digital Signatures are like proofs that the user gives to the recipient
and other nodes in the network to prove that it is a legitimate node in
the network to carry out transactions.
• While initiating a transaction with other nodes in the blockchain
network, the user first has to create a unique digital signature by
combining the transaction data with the user’s private key using a
special algorithm.
• This process will guarantee the authenticity of the node and the
integrity of the data.
Digital Signatures
• The objective of digital signatures is to authenticate and verify documents and
data.
• This is necessary to avoid tampering and digital modification or forgery during
the transmission of official documents.
• With one exception, they work on the public key cryptography architecture.
• Typically, an asymmetric key system encrypts using a public key and decrypts
with a private key. For digital signatures, however, the reverse is true.
• The signature is encrypted using the private key and decrypted with the public
key.
• Because the keys are linked, decoding it with the public key verifies that the
proper private key was used to sign the document, thereby verifying the
signature's provenance.
M - Plaintext

H - Hash function

h - Hash digest

‘+’ - Bundle both plaintext and digest

E - Encryption

D - Decryption
• Step 1: M, the original message is first passed to a hash function denoted
by H# to create a digest.
• Step 2: Next, it bundles the message together with the hash digest h and
encrypts it using the sender’s private key.
• Step 3: It sends the encrypted bundle to the receiver, who can decrypt it
using the sender’s public key.
• Step 4: Once it decrypts the message, it is passed through the same hash
function (H#), to generate a similar digest.
• Step 5: It compares the newly generated hash with the bundled hash value
received along with the message. If they match, it verifies data integrity.
DSA
• Digital Signature Algorithm
• The DSA works in the framework of public-key cryptosystems and is
based on the algebraic properties of modular exponentiation, together
with the discrete logarithm problem, which is considered to be
computationally intractable.
• The algorithm uses a key pair consisting of a public key and a private key.
• The private key is used to generate a digital signature for a message, and
such a signature can be verified by using the signer's corresponding
public key.
• The digital signature provides message authentication , integrity and
non-repudiation.
• The DSA algorithm involves four operations:
• Key generation (which creates the key pair)
• Key distribution
• Signing
• Signature verification.
Key generation
• Key generation has two phases.
• The first phase is a choice of algorithm parameters which may be shared
between different users of the system.
• The second phase computes a single key pair for one user.
Parameter Generation
• Choose an approved cryptographic hash function H with output length |H| bits.
• Choose a key length L
• Choose the modulus length N such that N<L and N<|H. FIPS 186-4 specifies L and
N to have one of the values: (1024, 160), (2048, 224), (2048, 256), or (3072, 256)
• Choose an N-bit prime q.
• Choose an L-bit prime p such that p-1 is a multiple of q.
• Choose an integer h randomly from {2………p-2}
• Compute g:=h^{(p-1)/q} mod p. In the rare case that g=1, try again with a
different h. Commonly h=2 is used.
• The algorithm parameters are (p, q, g). These may be shared between different
users of the system.
Per-user keys
• Given a set of parameters, the second phase computes the key pair
for a single user:
• Choose an integer x randomly from {1…………q-1}.
• Compute y:=g^{x} mod p
• x is the private key and y is the public key
Key distribution
• The signer should publish the public key y .
• That is, they should send the key to the receiver via a reliable, but not
necessarily secret, mechanism.
• The signer should keep the private key x secret.
Signing
• A message m is signed as follows:
• Choose an integer k randomly from {1……q-1}
• Compute r:= (g^{k} mod p) mod q. In the unlikely case that r=0, start again with a different
random k.
• Compute s:=(k^{-1} (H(m)+xr)) mod q. In the unlikely case that s=0, start again with a
different random k.
• The signature is (r,s)
• The calculation of k and r amounts to creating a new per-message key.
• The modular exponentiation in computing r is the most computationally expensive
part of the signing operation, but it may be computed before the message is known.
• Calculating the modular inverse k^{-1} mod q is the second most expensive part,
and it may also be computed before the message is known
• One can verify that a signature (r,s) is a valid signature for a message
m as follows:
• Verify that 0<r<q and 0<s<q
• Compute w:=s^{-1} mod q.
• Compute u1:=H(m) . w mod q.
• Compute u2:=r . w mod q.
• Compute v:=(g^{u1} . y^{u2}. mod p) (mod q)
• The signature is valid if and only if v = r.
Sensitivity of DSA
• With DSA, the entropy, secrecy, and uniqueness of the random
signature value k are critical.
• It is so critical that violating any one of those three requirements can
reveal the entire private key to an attacker.
• Using the same value twice (even while keeping k secret), using a
predictable value, or leaking even a few bits of k in each of several
signatures, is enough to reveal the private key x.
• This issue can be prevented by deriving k deterministically from the
private key and the message hash. This ensures that k is different for
each H(m) and unpredictable for attackers who do not know the
private key x.
ECDSA
• In cryptography, the Elliptic Curve Digital Signature Algorithm (ECDSA)
offers a variant of the Digital Signature Algorithm (DSA) which uses
elliptic-curve cryptography.
• As with elliptic-curve cryptography in general, the bit size of the
private key believed to be needed for ECDSA is about twice the size of
the security level, in bits.
• For example, at a security level of 80 bits—meaning an attacker
requires a maximum of about 2^{80} operations to find the private
key—the size of an ECDSA private key would be 160 bits.
• On the other hand, the signature size is the same for both DSA and
ECDSA: approximately 4t bits, where t is the security level measured
in bits, that is, about 320 bits for a security level of 80 bits.
Signature generation algorithm
• Suppose Alice wants to send a signed message to Bob, Initially, they
must agree on the curve parameters (CURVE,G,n).
• In addition to the field and equation of the curve, we need G, a
basepoint of prime order on the curve;
• n is the multiplicative order of the point G
Signature Verification Algorithm
MEMORY HARD ALGORITHM
• 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 were introduced to prevent the centralization of mining power on the
blockchain network, as ASICs can be expensive to purchase and maintain.
• Examples of memory-hard algorithms used in blockchain include Ethash, Equihash, and CryptoNight.
• These algorithms require miners to access data from memory continuously, which slows down the
mining process, ensuring that mining remains decentralized and accessible to all.
• This makes it more difficult for attackers to create a parallel blockchain, as they would need to have a
large amount of memory available to support their fork.
USE OF MEMORY HARD ALGORITHM:

• Memory-hardness is particularly useful in the setting of password


hashing and cryptocurrencies, as memory cost is platform-
independent and efficient special-purpose hardware for brute-forcing
attacks becomes much harder to be built.
ZKP

• Zero-knowledge Proof is an encryption scheme proposed by MIT researchers.

• It is a digital protocol that allows for data to be shared between two parties without the use
of a password or any other information associated with the transaction.

• It is a type of cryptography that keeps the details of a transaction hidden.

• Each transaction has a ‘verifier’ and a ‘prover’.

• In a transaction using ZKPs, the prover attempts to prove something to the verifier without
telling the verifier anything else about that thing.
ZERO KNOWLEDGE PROOF
EXAMPLE
Properties of ZKP
NON INTERACTIVE ZKP(NIZKP)
Where to implement ZKP in Blockchain System?

• 1)MESSAGING
• 2)AUTHENTICATION
• 3)STORAGE PRODUCTION
• 4)SENDING PRIVATE BLOCKCHAIN TRANSACTION
• 5)COMPLEX DOCUMENTATION
• 6)FILE SYSTEM CONTROL
• 7)SECURITY FOR SENSTIVE INFORMATION
[Link]

You might also like