Block Chain
Block Chain
DESCRIPTION OF BLOCKCHAIN
The first blockchain was conceptualized by an anonymous person or group known as Satoshi
Nakamoto in 2008. A blockchain is a data structure and set of algorithms designed specifically for
achieving Byzantine fault tolerant consensus around the state of a global transaction ledger.a block
chain ,also called a distributed ledger which is an append only datastructure that is amintained by a set
of nodes which do not fully trust each other. All nodes in a blockchain network agree on an ordered set
of blocks,each containing multiple transactions, thus the blockchain can be viewed as a log of ordered
transactions. The most common definition of a blockchain is described as a decentralized and
distributed digital ledger that is used to record transactions across many computers so that the
record cannot be altered retroactively without the alteration of all subsequent blocks and the
collusion of the network.
Generally , bitcoin and blockchain are usually used interchangeably but the truth is Bitcoin is the first
implementation of the conceptualized Blockchain described by Satoshi Nakamoto in 2008.
The key principles of the blockchain data structure as used in Bitcoin may be summarized thus:
(1) Transactions are bundled into blocks. For a block to be valid, all its constituent transactions must also
be valid according to the global ‘start’ state.
(2) Blocks have parent blocks. The global ‘start’ state corresponding to any given block may be
reconstructed by replaying all of its ancestor blocks in normal chronological order. For a block to be
valid, all of its parent blocks must also be valid.
(3) Blocks also carry certain data used to prove that a certain amount of computation power was
expended in its creation. For a block to be valid, its Proof of Work data must be valid according to the
scheme being used.
(4) Consensus among “correct” participants requires that they eventually all converge on the same
history. Bitcoin participants take as the ‘most recent’ block some valid block for which the total
estimated work of the block and its ancestors is greatest. As long as blocks are always being added by
“correct” participants to the block they believe is “most recent”, and the “correct” participants
outnumber the “incorrect” participants in terms of computing power, the “correct” participants do tend
to converge to the same global state.
(5)“Correct” participants are given an incentive to continue creating blocks. In Bitcoin, this incentive
takes the form of currency issuance; a successful block creator can issue itself currency according to
agreed upon rules.
FEATURES OF BLOCKCHAIN
(1) DIGITAL – all information on the blockchain is digitized, eliminating the need for manual
documentation.
(2) DISTRUBUTED LEDGER – indistinguishable copies of information shared on the blockchain.
Blockchain participants independently validate information without a central authority.even
when one node fails, the remaining nodes continue to operate ensuring that no disruption
occurs.
(3) CHRONOLOGICAL AND TIME-STAMPED – BLOCKCHAIN consists of chain of blocks that act as a
repository which stores information pertaining to a transaction and links to the previous blocks
in the same transactions.these connected blocks form a chronological chainproviding a trail of
the underlying transactions.
(4) CRYPTOGRAPHICALLY SEALED - blocks created are cryptographically sealed in the chain which
implies that it is impossible to manipulate already created blocks and put on the network,
thereby creating true digital assets and ensuring high level of robustness and trust. Even in the
event of failure of large amount of network participants,the blockchain remains available .
eliminating the single point of failure. Data stored in the blockchain is immutable.
(5) CONSENSUS BASED – A transaction on the blockchain can only be executed only if all the parties
on the network unanimously approves it. However,consensus based rules can be altered to suit
various circumstances.
BLOCKCHAIN ARCHITECTURE
2. DIGITAL SIGNATURE
Traditionally, authentication systems relied on symmetric algorithms such as secure hash algorithms
(SHA) that require secret keys. The management and protection of the secret keys, however, can be
challenging. A welcome alternative to this logistics problem is elliptic curve cryptography (ECC),
where all participating devices have a pair of keys called “private key” and “public key.” The private
key is used by the originator to sign a message, and the recipient uses the originator’s public key to
verify the authenticity of the signature. If a message is modified on its way to the recipient, the
signature verification fails because the original signature is not valid for the modified message.
The typical digital signature algoritm used in blockchain is the eliptic curve digital signature
algorithm(ECDSA). The 3 important concepts that are related to the eliptic curve digital signature
algorithm(ECDSA) are;
1. Private key - A private key is a tiny bit of code that is paired with a public key to set off
algorithms for text encryption and decryption. It is created as part of public key cryptography
during asymmetric-key encryption and used to decrypt and transform a message to a readable
format. Public and private keys are paired for secure communication, such as email.A private
key is also known as a secret key.
2. Public key - A public key is created in public key encryption cryptography that uses asymmetric-
key encryption algorithms. Public keys are used to convert a message into an unreadable
format. Data that is encrypted with the public key can be decrypted only with the
corresponding private key.
3. Digital Signature – A mathematical technique used to validate the authenticity and integrity of a
message. Digital signatures can provide the added assurances of evidence to origin, identity and
status of an electronic document, transaction or message, as well as acknowledging informed
consent by the signer.
1. Public Blockchain - A public blockchain is a blockchain that anyone in the world can read, anyone
in the world can send transactions to and expect to see them included if they are valid, and
anyone in the world can participate in the consensus process – the process for determining what
blocks get added to the chain and what the current state is. As a substitute for centralized or
quasi-centralized trust, public blockchains are secured by cryptoeconomics – the combination of
economic incentives and cryptographic verification using mechanisms such as proof of work or
proof of stake, following a general principle that the degree to which someone can have an
influence in the consensus process is proportional to the quantity of economic resources that
they can bring to bear. These blockchains are generally considered to be “fully decentralized”. A
public blockchain is a blockchain that consist of multiple nodes which fully do not trust each
other. Majority of the nodes are honest while some nodes exhibit Byzantine behaviour. The
nodes maintain a set of shared,global states and perform transactions modifying the states. All
nodes in the system agree on the transaction and their order as stored on the block chain.
2. Private Blockchain – A fully private blockchain is a blockchain where write permissions are kept
centralized to one organization. Read permissions may be public or restricted to an arbitrary
extent. A private blockchain is a blockchain that has an access control layer built into the
protocol. This means the network participants have control over who can join the network, and
who can participate in the consensus process of the blockchain. Private blockchains require
different entities to come together and agree to a common set of standards by which it will
operate. it is fully controlled by one organization and the organization could determine the final
consensus.
BLOCKCHAIN CONSENSUS
The blockchain consensus problem is for the non-faulty or correct processes of a distributed system to
agree on one block of transaction at a given index of a chain of block. This consensus problem can be
stated along three properties:
(ii) validity: the decided block is a block that was proposed by one process;
A protocol solving the consensus problem is necessary to guarantee that blocks are totally ordered,
hence preventing concurrently appended blocks from containing conflicting transactions.Below are 6
common approaches to reach consensus in BlockChain;
(1)Proof of Work(PoW) – is essentially one -CPU-one-vote which solves the problem of determining
representation in majority decision making. The majority decision is represented by the longest chain
which has the greatest proof of work invested in it. If majority of CPU power is controlled by honest
nodes, the honest chain will grow the fatest and outpace any competing nodes.to compensate for
increasing hardware speed and varying interest in running nodes over time,the proof of work difficulty is
determined by a moving average targeting an average number of blocks per hour. If they are generated
too fast , the difficulty increases.
In PoW , each node on the network is calculating a hash value of the block header. The block header
contains a nonce and miners would change the nonce frequently to get different hash values. The
consensus requires that the calculated value must be equal or lesser to a cetain given value and when
one node reaches the target value,it would broadcast the block to other nodes and all nodes must
mutually confirm the correctness of the hash value. If block is validated, other miners would append this
new block to their own blockchain. Nodes that calculate the hash values are called miners and the PoW
is called mining.
(2) Proof of Stake(PoS)- Proof of Stake (PoS) is a category of consensus algorithms for public blockchains
that depend on a validator's economic stake in the network. In PoS-based public blockchains ,a set of
validators take turns proposing and voting on the next block, and the weight of each validator's vote
depends on the size of its deposit (i.e. stake).
From an algorithmic perspective, there are two major types of Proof of Stake(PoS): chain-based proof of
stake and Byzantine Fault Tolerant(BFT) -style proof of stake.
In chain-based proof of stake, the algorithm pseudo-randomly selects a validator during each time slot
(eg. every period of 10 seconds might be a time slot), and assigns that validator the right to create a
single block, and this block must point to some previous block (normally the block at the end of the
previously longest chain), and so over time most blocks converge into a single constantly growing chain.
It is also an energy saving alternative to Proof of Work(PoW). Miners in PoS have to prove ownership of
the amount of Currency. The idea behind proof of stake is simple: instead of mining power, the
probability to create a block and receive the associated reward is proportional to a user’s ownership
stake in the system. An individual stakeholder who has p fraction of the total number of coins in
circulation creates a new block with p probability. The rationale behind proof of stake is the following:
users with the highest stakes in the system have the most interest to maintain a secure network, as they
will suffer the most if the reputation and price of the cryptocurrency would diminish because of the
attacks. To mount a successful attack, an outside attacker would need to acquire most of the currency,
which would be prohibitively expensive for a popular system.
(3) Delegated Proof of Stake(DPOS) - Delegated Proof of Stake (DPOS) is a new method of securing a
crypto-currency’s network. DPOS attempts to solve the problems of both Bitcoin’s traditional Proof of
Work system, and the Proof of Stake system of Peercoin and NXT. DPOS implements a layer of
technological democracy to offset the negative effects of centralization. Delegated proof of stake
mitigates the potential negative impacts of centralization through the use of witnesses (formaly
called delegates). A total of N witnesses sign the blocks and are voted on by those using the network
with every transaction that gets made. By using a decentralized voting process, DPOS is by design more
democratic than comparable systems. Rather than eliminating the need for trust all together, DPOS has
safeguards in place the ensure that those trusted with signing blocks on behalf of the network are doing
so correctly and without bias. Additionally, each block signed must have a verification that the block
before it was signed by a trusted node. DPOS eliminates the need to wait until a certain number of
untrusted nodes have verified a transaction before it can be confirmed. In a delegated proof of stake
system centralization still occurs, but it is controlled. Unlike other methods of securing cryptocurrency
networks, every client in a DPOS system has the ability to decide who is trusted rather than trust
concentrating in the hands of those with the most resources. DPOS allows the network to reap some of
the major advantages of centralization, while still maintaining some calculated measure of
decentralization. This system is enforced by a fair election process where anyone could potentially
become a delegated representative of the majority of users.
(4) Practical byzantine fault tolerance(PBFT) - A Byzantine Fault is an incorrect operation (algorithm)
that occurs in a distributed system that can be classified as:
(i)Omission Failure – a failure of not being present such as failing to respond to a request or not
receiving a request.
(ii) Execution Failure or Lying – a failure due to sending incorrect or inconsistent data, corrupting the
local state or responding to a request incorrectly.
It is also a replication algorithm to tolerate byzantine faults since it can handle up to 1/3 malicious
byzantine replicas and a replica maintains several logical copies of the service state:
A faulty node is one which experiences errors which may be honest (due to data corruption,
implementation errors, etc.), or malicious (Byzantine errors) and since malicious attacks and software
errors can cause faulty nodes to exhibit Byzantine (arbitrary) behavior, Byzantine-fault-tolerant
algorithms are increasingly important.
A blockchain is a distributed ledger system in which participants connect with each other via a peer-
to-peer network. All messages within it will be sent by broadcasting. Two types of roles exist:
(i)Ordinary nodes - Ordinary nodes use the system to transfer and exchange, accepting ledger data;
(ii)Bookkeeping nodes. while bookkeeping nodes provide accounting service for the entire network
and maintain the ledger.
In a typical blockchain system, messages may subject to loss, damage, latency and repetition. Also,
the sending order may not necessarily be consistent with the receiving order of messages. The
activities of nodes could be arbitrary, they may join and quit the network at any time; they may also
dump and falsify information or simply stop working. Artificial or non-artificial glitches may occur as
well.
In reaching consensus, 𝑛 = |𝑅| which suggests the total number of nodes joined in the consensus
making while R stands for the set of consensus nodes.
Given 𝑓 = ⌊ (𝑛−1) / 3 ⌋ ,
𝑓 stands for the maximum number of erroneous nodes allowed in the system.
The total ledger is maintained by bookkeeping nodes while ordinary nodes do not participate in the
consensus making.
All consensus nodes are required to maintain a state table to record current consensus status. The
data set used for a consensus from its beginning to its end is called a View. If consensus cannot be
reached within the current View, a View Change will be required. We identify each View with a
number v, starting from 0 and it may increase till achieving the consensus.
Each consensus node is identified with a number, starting from 0 and the last node is numbered n −
1. For each round of consensus making, a node will play speaker of the house while other nodes play
congressmen. A new block will be generated with each round of consensus, with at least 𝑛 − 𝑓
signatures from bookkeeping nodes.
Upon the generation of a block, a new round of consensus making shall begin, resetting v=0.
(6)Tendermint - Participants in the protocol are called validators; they take turns proposing
blocks of transactions and voting on them. Blocks are committed in a chain, with one block at
each height. A block may fail to be committed, in which case the protocol moves to the
next round, and a new validator gets to propose a block for that height. Two stages of voting
are required to successfully commit a block; we call them pre-vote and pre-commit. A block is
committed when more than 2/3 of validators pre-commit for the same block in the same round.
Validators may fail to commit a block for a number of reasons; the current proposer may
be offline, or the network may be slow. Tendermint allows them to establish that a
validator should be skipped. Validators wait a small amount of time to receive a
complete proposal block from the proposer before voting to move to the next round.
This reliance on a timeout is what makes Tendermint a weakly synchronous protocol,
rather than an asynchronous one. However, the rest of the protocol is asynchronous,
and validators only make progress after hearing from more than two-thirds of the
validator set. A simplifying element of Tendermint is that it uses the same mechanism to
commit a block as it does to skip to the next round.
Assuming less than one-third of the validators are Byzantine, Tendermint guarantees
that safety will never be violated - that is, validators will never commit conflicting blocks
at the same height. To do this it introduces a few locking rules which modulate which
paths can be followed in the flow diagram. Once a validator precommits a block, it is
locked on that block. Then,