Module-1&2_miss
Module-1&2_miss
Blockchain
Technologies
Module 1
Introduction to Cryptography
Secret key: given as input into the encryption algorithm that has a value
independent of the plaintext and of the algorithm and produce a different output
depending on the specific key being used at the time.
A stream cipher is one that encrypts a digital data stream one bit
or one byte at a time.
Eg: Caeser cipher, Vigenere cipher
First, the 64-bit plaintext passes through an initial permutation (IP) that rearranges the bits to produce
the permuted input.
This is followed by a phase consisting of sixteen rounds of the same function, which involves both
permutation and substitution functions.
The output of the last (sixteenth) round consists of 64 bits that are a function of the input plaintext
and
the key.
The left and right halves of the output are swapped to produce the preoutput.
Finally, the preoutput is passed through a permutation that is the inverse of the initial permutation
function, to produce the 64-bit ciphertext
Data Encryption Standard (DES)
Then, for each of the sixteen rounds, a subkey (Ki ) is produced by the
combination of a left circular shift and a permutation.
The permutation function is the same for each round, but a different subkey is
produced because of the repeated shifts of the key bits.
The Initial permutation and its inverse are defined by below tables
The key length can be 16, 24, or 32 bytes (128, 192, or 256 bits).
The final round contains only three transformations, and there is a initial single
transformation (AddRoundKey) before the first round which can be considered
Round 0.
Each transformation takes one or more matrices as input and produces a 4x4
matrix as output
Advanced Encryption Standard (AES)
key expansion function generates N+1 round keys, each of which is a 4x4 distinct
matrix.
Each round key serve as one of the inputs to the AddRoundKey transformation in
each round.
AES instead processes the entire data block as a single matrix during each round
using substitutions and permutation.
The key that is provided as input is expanded into an array of forty-four 32-bit
words, w[i]. Four distinct words (128 bits) serve as a round key for each round
Advanced Encryption Standard (AES)
Four different stages are used, one of permutation and three of substitution:
the block
Only the AddRoundKey stage makes use of the key. For this reason, the cipher begins and ends with an
AddRoundKey stage.
Advanced Encryption Standard (AES)
AddRoundKey stage is, in effect, a form of Vernam cipher
AES defines a 16x16 matrix of byte values, called an S-box, that contains a
permutation of all possible 256 8-bit values.
Each individual byte of State is mapped into a new byte in the following way:
The leftmost 4 bits of the byte are used as a row value and the rightmost 4 bits
are used as a column value.
These row and column values serve as indexes into the S-box to select a unique
8-bit output value.
128 bits of State are bitwise XORed with the 128 bits of the
The first matrix is State, and the second matrix is the round
key.
ShiftRows For the third row, a 2-byte circular left shift is performed.
Transformation For the fourth row, a 3-byte circular left shift is performed.
It is a decentralized-distributed system
Other technologies include Merkle trees, hash functions, and hash chains.
Definition
This means that there is no central controller in the network, and all participants
talk to each other directly.
This property allows for cash transactions to be exchanged directly among the
peers without a third-party involvement, such as by a bank.
decentralization
Cryptographically-secure
cryptography has been used to provide security services which make this ledger
secure against tampering and misuse.
A good practice is for users to generate a new address for each transaction in order to avoid
linking transactions to the common owner, thus preventing identification.
Block: A block is composed of multiple transactions and other elements, such as the previous
block hash (hash pointer), timestamp, and nonce.
Generic elements of a blockchain
Node: A node in a blockchain network performs various functions such as propose
and validate transactions and perform mining to facilitate consensus and secure
the blockchain.
Nodes are either miners who create new blocks and mint cryptocurrency (coins) or
block signers who validates and digitally sign the transactions.
Transactions are first created by nodes and then also digitally signed by nodes using
private keys as proof that they are the legitimate owner of the asset that they wish to
transfer to someone else on the blockchain network.
Smart contract: These programs run on top of the blockchain and encapsulate the business
logic to be executed when certain conditions are met. These programs are enforceable and
automatically executable.
Use cases (identity management, trade finance, record management, insurance, and e-
governance.
Transparency and trust: Because blockchains are shared and everyone can see
what is on the blockchain, this allows the system to be transparent. As a result,
trust is established.
Immutability: Once the data has been written to the blockchain, it is extremely
difficult to change it back. It is not genuinely immutable, but because changing
data is so challenging and nearly impossible, this is seen as a benefit to
maintaining an immutable ledger of transactions.
Benefits and Limitations of Blockchain
High availability: As the system is based on thousands of nodes in a peer-to-peer
network, and the data is replicated and updated on every node, the system becomes
highly available. Even if some nodes leave the network or become inaccessible, the
network as a whole continues to work, thus making it highly available.
• Scalability
• Adaptability
• Regulation
• Privacy
Basic concepts
•Distributed ledgers
•Distributed Ledger Technology (DLT)
•Blockchains
•Ledgers
Distributed ledgers
Distributed ledgers are a type of digital database that is decentralized and maintained by multiple
participants (or nodes) in a network
All blockchains are fundamentally distributed ledgers, all distributed ledgers are not necessarily
a blockchain.
A critical difference between a distributed ledger and blockchain is that a distributed ledger does
not necessarily consist of blocks of transactions to keep the ledger growing.
Rather, a blockchain is a special type of shared database that is comprised of blocks of transactions.
R3's Corda. Corda is a distributed ledger which is developed to record and manage agreements
and is especially focused on financial services industry. On the other hand, more widely-known
blockchains like Bitcoin and Ethereum make use of blocks to update the shared database.
Distributed ledgers
A distributed ledger is distributed among its participants and spread across
multiple sites or organizations. This type of ledger can be either private or
public.
DLTs usually serve as a shared database, with all participants known and
verified.
Public blockchain
Private blockchain
Based on accessibility:
Permissioned
Permissionless
Based on visibility of network:
PUBLIC P R I VAT E
Anyone can read, write and join they are open only to a consortium
the network or group of individuals or
Public Permission-less.
Public Permissioned.
Private Permission-less.
Private Permissioned.
Public Permission-less Blockchain
• Anyone can participate without permission.
Require Native Assets (Crypto-Currency).
Low Scalable
Example:–Bitcoin, Ethereum
• Only participants with known identity can join and read data.
•Data is confidential.
•High Scalability.
• Enterprise Oriented
just a concept today, and no real world POCs have yet been developed.
they are still valuable in situations where there is no need to transfer value
between nodes and only the sharing of data among various trusted parties
is required.
• Termination: All honest nodes terminate execution of the consensus process and eventually reach a
decision
• Validity: The value agreed upon by all honest nodes must be the same as the initial value proposed
by at least one honest node
• Fault tolerant: The consensus algorithm should be able to run in the presence of faulty or malicious
nodes (Byzantine nodes)
• Integrity: This is a requirement that no node can make the decision more than once in a single
consensus cycle
Types of consensus mechanisms
All consensus mechanisms are developed to deal with faults in a distributed system
and to allow distributed systems to reach a final state of agreement.
It was introduced by Leslie Lamport in 1989. With Paxos, nodes are assigned
various roles such as Proposer, Acceptor, and Learner.
With Bitcoin and the advent of blockchain technology, this model has changed
and now the technology exists, which allows anyone to start a decentralized
system and operate it with no single point of failure or single trusted authority.
Decentralization
using blockchain
Data and computation are spread across multiple nodes in the network.
The main difference between these systems is that in a parallel computing system, computation
is performed by all nodes simultaneously in order to achieve the result;
for example, parallel computing platforms are used in weather research and forecasting,
simulation and financial modeling.
On the other hand, in a distributed system, computation may not happen in parallel and data is
replicated across multiple nodes that users view as a single, coherent system.
Variations of both of these models are used with to achieve fault tolerance and speed.
In the parallel system model, there is still a central authority that has control over all nodes,
which governs processing.
This mechanism came into play with Bitcoin, and it enables a user to agree
on something via a consensus algorithm without the need for a central,
trusted third party, intermediary, or service provider.
Methods of decentralization
This method will not result in full decentralization, but it allows smart
contracts to make a free choice based on the criteria just mentioned.
On the left-hand side, the conventional approach is shown
where a central system is in control; on the right-hand side,
Scale of complete disintermediation is achieved as intermediaries are
decentralizati entirely removed. Competing intermediaries or service
on providers are shown in the center. At that level, intermediaries
or service providers are selected based on reputation or voting,
thus achieving partial decentralization.
Decentralization
A D VA N TA G E S D I S A D VA N TA G E S
A significant disadvantage of this approach is that a blockchain is not suitable for storing large
amounts of data by design.
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.
DHT research was made popular by the CAN, Chord, Pastry, and Tapestry projects.
The issue with BitTorrent and the others is that there is no incentive for users to keep the files
indefinitely.
Storage
Two primary requirements here are high availability and link stability,
which means that data should be available when required and network
links also should always be accessible.
InterPlanetary File System (IPFS) by Juan Benet possesses both of
these properties, and its vision is to provide a decentralized World Wide
Web by replacing the HTTP protocol.
IPFS uses Kademlia DHT and Merkle Directed Acyclic Graph (DAG) to
provide storage and searching functionality, respectively.
Tutorial 3
Explore IPFS and DHT
Ethereum Swarm
Whisper protocol
BitAuth
OpenID
BigchainDB
Storage
The incentive mechanism for storing data is based on a protocol known as Filecoin, which
pays incentives to nodes that store data using the Bitswap mechanism.
Bitswap mechanism lets nodes keep a simple ledger of bytes sent or bytes received in a
one-to-one relationship.
Git-based version control mechanism is used in IPFS to provide structure and control
over the versioning of data.
Ethereum has its own decentralized and distributed ecosystem that uses Swarm for storage
and the Whisper protocol for communication.
Services such as email and online storage are now all based on a paradigm where
the service provider is in control, and users trust such providers to grant them
access to the service as requested.
Over the years, with the advent of large-scale service providers such as Google,
Amazon, and eBay, control is shifting towards these big players.
For example, email is a decentralized system at its core; that is, anyone can run an
email server with minimal effort and can start sending and receiving emails.
Computing power and decentralization
On the next layer up, a storage layer uses technologies such as IPFS and
BigchainDB to enable decentralization.
Finally, at the next level up, you can see that blockchain serves as a decentralized
processing (computation) layer.
Blockchain can, in a limited way, provide a storage layer too, but that severely
hampers the speed and capacity of the system.
Therefore, other solutions such as IPFS and BigchainDB are more suitable to store
large amounts of data in a decentralized way.
Computing
power and
decentralization
The Identity, Wealth layers are
shown at the top level.
Systems such as BitAuth and
OpenID provide authentication
and identification services with
varying degrees of
decentralization and security
assumptions
Computing
power and
decentralization
A concept relevant to identity known
as Zooko's Triangle requires that the
naming system in a network protocol
be secure, decentralized, and is able to
provide human-meaningful and
memorable names to the users
Smart contracts
A smart contract is a decentralized program.
A smart contract usually contains some business logic and a limited amount of
data.
Actors or participants in the blockchain use these smart contracts, or they run
autonomously on behalf of the network participants.
Decentralized Organizations
DOs are software programs that run on a blockchain and are based on the
idea of actual organizations with people and protocols.
DAOs are autonomous, which means that they are fully automated and contain
artificially-intelligent logic.
DOs, on the other hand, lack this feature and rely on human input to execute
business logic
The Ethereum blockchain led the way with the initial introduction of DAOs.
Decentralized Autonomous Corporations
DAOs are usually considered to be nonprofit; whereas DACs can earn a
profit via shares offered to the participants and to whom they can pay
dividends.
If a government is corrupt and central systems do not provide the satisfactory levels
of trust that a society needs, then that society can start its own virtual one on a
blockchain that is driven by decentralized consensus and transparency.
Decentralized Applications (DApps)
DAOs, DACs, and DOs are DApps that run on top of a blockchain in a peer-to-
peer network.
Because DApps are decentralized, they are free from the control and
interference of a single authority
DApps, are software programs that can run on their respective blockchains, use
an existing established blockchain, or use only the protocols of an existing
blockchain.
These are called Type I, Type II, and Type III DApps.
Requirements of a Decentralized Application
The DApp should be fully open source and autonomous, and no single entity
should be in control of a majority of its tokens.
MaidSafe
Lisk
Ethereum
Ethereum tops the list as being the first blockchain to introduce a Turing-
complete language and the concept of a virtual machine.
This is in stark contrast to the limited scripting language in Bitcoin and many
other cryptocurrencies.
This blockchain was first proposed in 2013 by Vitalik Buterin, and it provides
a public blockchain to develop smart contracts and decentralized applications.
The files on the network are divided into small chunks of data, which are
encrypted and distributed randomly throughout the network.
It allows developers to use JavaScript to build decentralized applications and host them in their
respective sidechains.
Lisk uses the Delegated Proof of Stake (DPOS) mechanism for consensus whereby 101 nodes
can be elected to secure the network and propose blocks.
It uses the Node.js and JavaScript backend, while the frontend allows the use of standard
technologies, such as CSS3, HTML5, and JavaScript.
Another derivative of Lisk is Rise, which is a Lisk-based decentralized application and digital
currency platform.