2. Achieving Consensus
consensus is when the network agrees on
what information stored in the network is
true and should be kept, and what is not
true and should not be kept.
For Bitcoin, achieving consensus is a
simple matter of coming to agreement on
the set to send and receive of Bitcoin
across the network.
3. Achieving Consensus
Any distributed consensus protocol has three critical
properties:
Safety: The ability of all the nodes on a distributed
network to guarantee that they have the same state or
consistency.
Liveness/Availability: The protocol is guaranteed to
succeed and have the different nodes produce a final
result.
Fault tolerance: The ability of the protocol to deal with
nodes producing faulty or hostile results
4. Achieving Consensus
In blockchain systems, there are currently four primary methods
of achieving consensus. They are as follows:
Practical Byzantine fault tolerance
algorithm
PoW algorithms
PoS algorithms
Delegated PoS algorithms (DPoS)
5. Practical Byzantine fault tolerance
algorithm (PBFT)
Name reason
An ancient Byzantine army moving to capture a city.
Idea : To attack from all sides.
Once the generals of the army reach the city, they must agree on
when and how to attack.
Difficulty : how to agree?
The generals can communicate only by messenger, but the
messengers could be captured by the enemy.
The additional fear that one or more of the generals or their
commanders are traitors
6. Practical Byzantine fault tolerance
algorithm (PBFT)
Name reason (contd…)
The generals need a method to ensure that all the loyal generals
agree on the same plan, and that a small number of possible
traitors cannot cause the mission to fail.
The loyal generals will all do what the method says they will do,
but the traitors might do anything. How can the generals create a
method that ensures that, as long as most of them are loyal, their
plans will succeed?
This allegory is also sometimes called the Chinese general's
problem
7. Practical Byzantine fault tolerance
algorithm (PBFT)
In BlockChain,
Generals computers that are participating in the distributed
network.
Messengers the digital network that these machines are running
on.
Goal for the good computers or generals to decide which
information on the network is valid.
loyal generals the operators of honest nodes that are interested in
ensuring the integrity of the blockchain.
Traitors the many bad actors of the world who would love to falsify
data.
8. Byzantine faults
A Byzantine fault is any event or result that would disrupt the
consistency of a distributed system.
Failure to return any result
Return of an incorrect or inconsistent result
Return of a deliberately misleading result
Any behavior that isn't defined beforehand
9. How PBFT works ?
Hyperledger is the primary blockchain that uses PBFT.
PBFT working:
Each validating node (a computer running the blockchain software and
working to maintain consistency) keeps a copy of the internal state of the
blockchain.
When a node receives a message, it uses the message in conjunction with
their internal state to run a computation on what the new state should be.
Then the node decides what it should do with the message in question: treat
it as valid, ignore it, or take another course of action.
Once a node has reached its decision about the new message, that node
shares that decision with all the other nodes in the system.
10. How PBFT works ?
A consensus decision is determined based on the total decisions submitted by all
nodes:
Submission
Ordering
Execution
11. Proof of WorK
1st consensus algorithm used in blockchains Bitcoin's proof-of-work (PoW).
functions by exploiting a feature of certain cryptographic functions.
PoW has the following characteristics:
Relatively predictable time to solution
Resistant to large increases or decreases in computing power
PoW is most used by Bitcoin, Litecoin, and Ethereum
12. How the PoW problem works in
Bitcoin?
The PoW algorithm starts by taking the longest chain.
Bitcoin takes the chain that is the longest and thus has had the most
computing power applied to it.
Difficult puzzle:
to find an input, when added to the prior block hash and the list of
transactions, produces a hash that starts with a certain number of zeros.
The input to the function is the Merkle root of all transactions and the prior
block hash.
14. How the PoW problem works in
Bitcoin?
Ex: a simple input, such as I love Blockchains.
Easiest possible difficulty: a single zero at the start of the hash
The SHA-256 hash
ef34c91b820b3faf29104f9d8179bfe2c236d1e8252cb3ea6d8cb7c897bb7d96.
it does not begin with 0.
To solve the block for this input, find a string (called a nonce).
To get result (nonce + I love Blockchains) results in a string starting with 0.
This process of trying to find the nonce that results in a proper hash is called
mining.
15. How the PoW problem works in
Bitcoin?
Advantage:
anyone can join a PoW network
well established as a functional consensus mechanism.
Disadvantage
slow speeds and financial costs.
As a result of these downsides, proof-of-stake (PoS) was invented
16. Proof of Stake
PoS has the same objectives as PoW.
Objective:
To secure the network against attack and to allow consensus to occur in an open network
Digital currencies using this method
Peercoin (1st digital currency)
NXT
Dash
PIVX
and so on.
17. Proof of Stake
Blocks are said to be forged instead of mined.
The validators get rewarded by getting paid the transaction fees for each
block.
The chance to be the creator of the next block is determined by the amount
of investment a node has in the network.
18. Proof of Stake
Example:
5 nodes in a PoS network. They have the following balances:
1.10,000 coins
2. 200 coins
3. 300 coins
4. 4,000 coins
5. 20,500 coins The total number of tokens is 35,000 coins.
Assume: That each node is staking 100% of their coins, every
block and the nodes they contain will have the following
likelihoods of being the next block signer:
1. 28.57%
2. 0.57%
3. 0.86%
4. 11.4%
5. 58.6%
19. Proof of Stake
Example:
If a single node ever controls the majority of tokens (or even a large
fraction), then they will have substantial control over the network.
node #5 would end up creating more than half the blocks.
node #5 would be regularly signing blocks, it would also get the majority of
the transaction fees.
In a way, PoS rewards validators with interest on their investment in the form
of additional tokens.
One criticism of PoS networks is that the rich get richer, which can lead to
increasing network centralization and control.
20. The nothing-at-stake attack
Issues in PoS systems
Threat of nothing-at-stake attacks.
A validator actually creates multiple blocks in order to spend tokens multiple times.
Because of the low cost of creating blocks in PoS systems, there is no
financial incentive to the network not to approve all the transactions, causing
consensus to break down.
To avoid, PoS systems have introduced various countermeasures, such as
staking deposits.
21. Variations
Numerous variations on the basic PoS approach.
Each variation will have different requirements
minimum balance needed to have a stake
the potential penalties for bad behavior
the rights and abilities of the stakeholders of the network and modifiers
such as how long an account needs to have had a staked balance in order to be counted
22. Delegated Proof of Stake
DPoS is related to PoS consensus.
The holders of tokens does not do the block validation.
They can use their tokens to elect a node to validate on their behalf—their
delegate (also called a validator).
Major blockchains using this approach
Bitshares, Steemit, EOS, and Lisk
24. Proof of Authority
Idea introduced by Gavin Wood of Parity Technologies
Proof-of-authority (PoA) networks are used only when all blockchain participants
are known.
Each participant is known and registered with the blockchain,(permissioned
chain).
25. Establishing authority
3 main conditions that must be fulfilled for a validator to be established are as
follows:
1. Identity needs to be formally verified and on chain.
2. Eligibility should be difficult to obtain.
Examples are things such as becoming a notary public, submitting to background checks, and posting a
bond.
3. The set of things that must be required of each authority should be well
documented, uniform, and worthy of the network's trust.
26. Proof of Elapsed time
1. The Hyperledger Sawtooth project introduced a new consensus mechanism
called proof-of-elapsed-time or PoET.
2. Deals mostly with permissioned blockchains.
3. The basic approach is simple:
1. Each node must wait a random amount of time.
2. The first node to stop waiting gets to create a block