DTUnit 1 & 2
DTUnit 1 & 2
Cryptocurrencies
Dr. K. Prakash
Assistant Professor - CS
PG
Unit 1
Introduction to Distributed Database
• Transparency:
✔ Location Transparency: Users do not need to know the physical location of the
data.
✔ Replication Transparency: Users are unaware of the replication process and
the number of replicas.
✔ Fragmentation Transparency: Users do not need to know how data is
fragmented and stored.
• Consistency:
✔ Ensuring that all users see a consistent view of data, even though data
may be distributed across different sites.
• Scalability:
✔ The system can scale horizontally by adding more machines to
accommodate more data or handle more load.
• Fault Tolerance:
✔ The system can continue to function even if one or more nodes fail,
thanks to data replication and distributed architecture.
• Concurrency Control:
✔ Mechanisms are in place to manage simultaneous operations on the
database without leading to conflicts or inconsistencies.
The Two General Problem
Byzantine Generals Problem and Fault Tolerance are
fundamental concepts in distributed computing and systems
design. They address the challenges of ensuring reliability and
consistency in systems with multiple components, especially when
communication between these components can be unreliable or
compromised.
DataNode(SlaveNode):
• Run on slave nodes.
• Worker nodes works like reading, writing, processing etc.
• Also performs creation, deletion, and replication upon instruction from the master.
• They can be deployed on commodity hardware.
Distributed Hash table (DHT)
A distributed hash table (DHT) is a type of distributed
system that provides a lookup service similar to a hash table.
Data is stored and retrieved using keys, and the keys are
used to determine the location of the data in the table.
The data is distributed across multiple nodes in a
network rather than being stored in a single table.
Each node is responsible for storing and managing a
portion of the data.
For Examle, 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.
Applications
• Peer-to-peer (P2P) networks −
Facilitate the sharing of resources, such as files or data, between peers.
• Distributed databases −
Provides a scalable and efficient way to store and retrieve large amounts of data.
• Decentralised & Autonomous: Nodes collectively form the system without any
central authority.
• 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.
The nodes in a DHT are connected together through an overlay network in which
neighboring nodes are connected. This network allows the nodes to find any given key
in the key-space.
Cryptography
Cryptography is the technique of concealing or
encoding(changing its original form) the information in
such a way that only the authenticated person can
decode(get the original form) it. This technique of
cryptography plays an important role in keeping our data
safe. The data or information can be bank cards, computer
passwords or online transactions and other private data.
• Protecting our data in the applications by securing user data, like passwords and personal
information.
• Confidentiality
• Integrity
• Authentication
• Non-repudiation
Cryptography usage areas
• Authentication
• Internet of Things
• Card Payments
• Ecommerce Websites
• Digital currency
• Digital Signatures
Top languages for Cryptography
• Python
• Go
• Ruby
• C++
• C#
• Java
• PHP
Hash Functions
A hash function is a cryptographic algorithm that takes an input (or "message") and
returns a fixed-size string of bytes. The output, typically called a hash value or digest, is
unique to each unique input.
• Deterministic: The same input will always produce the same output.
• Small changes in input drastically change the output: Even a tiny alteration to the input
should produce a vastly different hash.
• Collision resistance: It should be infeasible to find two different inputs that produce the
same hash output
Features of Hash functions in
cryptography
• Data Integrity: Ensuring that data has not been altered
during transmission or storage.
• Password Storage: Storing passwords as hashes rather
than plaintext, which enhances security.
• Digital Signatures: Hash functions play a critical role in
creating digital signatures.
Digital Signatures
• Merits
Secure and robust against attacks, as altering the blockchain
would require significant computational power.
• Demerits
Energy-intensive and slower, leading to scalability issues.
• Proof of Stake (PoS)
Nodes (validators) are chosen to propose new blocks based on
the number of coins they hold and are willing to "stake" as
collateral.
Validators are incentivized to act honestly, as dishonest
behavior can result in a loss of their staked coins.
• Merits
Energy-efficient and can offer faster transaction processing
compared to PoW.
• Demerits
May lead to centralization if a few holders control most of the
• Byzantine Fault Tolerance (BFT)
BFT algorithms are designed to reach consensus even if
some nodes act maliciously or provide incorrect
information.
Practical Byzantine Fault Tolerance (PBFT) is an example
that ensures a system can tolerate Byzantine faults and
continue functioning correctly.
• Merits
Fast finality and high efficiency for smaller, permissioned
networks.
• Demerits
Less scalable for larger, public networks.
Importance of Distributed Consensus
• Security
Consensus mechanisms prevent double-spending and
ensure that only valid transactions are added to the
blockchain.
• Decentralization
With consensus, decision-making is distributed across
multiple nodes rather than controlled by a central authority.
• Fault Tolerance
Consensus mechanisms help the system remain
operational even when some nodes fail or act maliciously.
Life of Block chain applications
Miners
Miners are participants in a blockchain network who use
their computational power to validate and verify
transactions, add them to the blockchain, and secure the
network.