Lec9 ConsensusProtocols Students Ver
Lec9 ConsensusProtocols Students Ver
1
BLOCKCHAIN CONSNSUS
PROTOCOLS
LECTURE 9
❑ Other nodes validate the Block and TXs and vote in favor of the
block by extending the chain by creating a new block by
referring to the previous one
❑ If the consensus could not be achieved over previous block,
chain will be forked and ultimately the longest chain will be
accepted
Bitcoin TX Validation
✔ Format of the TX
Ethereum TXs
❑ To mine a block in Ethereum, miners fetch random slices of data
from the state, compute some randomly selected transactions
from the previous N blocks in the blockchain, and return the hash
of the result
❑ The miner and full nodes need to store the entire state with each
block, moreover these nodes also validate the smart contracts by
executing them during TX validation
Ethereum TX Validation
✔ Valid Signature
✔ Valid nonce
Low Latency
High Latency (limited by the propagation
delay of the network only)
Decouples Leader
System Freeze b/w
Election & TX
Leader Election
Serialization
Adverse effects of reducing Block Interval & Increasing the Block Size
t
❑ Divides time into epochs
Reducing Latency
Reducing Latency
t
❑ Two types of blocks are generated Key Blocks and micro blocks
❑ Once a node generates a Key Block, it becomes the leader
❑ The leader generates Micro blocks containing TXs, at a set rate
❑ Each block references to the previous block hash
t
• Contains reference to previous • Reference to previous block
block (mostly it’s the micro block • Time stamp
• Time stamp • Hash of TXs
• Coinbase TX to payout the reward • Signed by the leader
• Target value (generator)
• Nonce
• Pub Key of the leader
Ledger Entries
t
❑ Size of micro-blocks is bounded by a pre-defined max (not given)
❑ Rate of micro-blocks is smaller than a pre-defined max
(deterministic)
❑ Micro-blocks do not involve PoW, so they do not affect the weight
of the chain
t
Validity of Micro-blocks
❑ If the time stamp is in future (different from system time)
❑ If the difference in time from its predecessor is less than min
Check: To prevent a malicious leader from flooding the system with
micro-blocks
❑ All TXs must be valid as per rules of the State Machine
❑ Valid signatures of the leader
ADVANCED TOPIC IN INFORMATION SECURITY - Dr Imran Makhdoom 28
CONSENSUS PROTOCOLS Contd..
Reducing Latency
micro micro
t
Reward for KeyBlock generation
❑ TX fee is distributed between current and next leader by the ratio of
40% and 60%
❑ Reward can be spent only after 100 KeyBlocks as in bitcoin
ADVANCED TOPIC IN INFORMATION SECURITY - Dr Imran Makhdoom 30
CONSENSUS PROTOCOLS Contd..
Minimizing Selfish Mining
t
❑ 40% and 60% ratio is derived to prevent selfish behaviour by
the nodes
❑ Nodes are now incentivised and motivated to mine a block on
top of other node’s TXs (microBlocks)
ADVANCED TOPIC IN INFORMATION SECURITY - Dr Imran Makhdoom 31
CONSENSUS PROTOCOLS
Prevent Double Spending
40% fee 60%
t
❑ A Poison TX is published, that invalidates the revenue of the fraudulent
leader
❑ It includes the header of the first Block of the pruned branch as a proof
of fraud (Every microBlock is signed by its generator)
❑ Poison TX is to be published before a node can spend its reward
❑ 5% of the invalidated revenue is granted to the current leader
ADVANCED TOPIC IN INFORMATION SECURITY - Dr Imran Makhdoom 32
CONSENSUS PROTOCOLS
Fast Transactions
40%
t
Fast TX Confirmation as compared to Bitcoin
❑ If a merchant wants to accept a 0 confirmation TX. It is very risky
in Bitcoin as for next 10 mins there is no confirmation
❑ However in Bitcoin-NG, the microBlocks generated between
KeyBlocks give some level of security to the merchant to accept 0
confirmation TXs
ADVANCED TOPIC IN INFORMATION SECURITY - Dr Imran Makhdoom 33
CONSENSUS PROTOCOLS
Punishment
t
Malicious TXs
❑ A miner engaging in a microblock fork in Bitcoin-NG
will lose his block reward and fees
t
Resilience to Mining Power Variation
❑ Mining power varies depends upon coin exchange rate (lower
the rate less is the profit in capital currency for the miner)
t
Resilience to Mining Power Variation
❑ Higher the difficulty, more is the cost of mining a Block
(energy and computation)
❑ Miners are subject to shifting to suitable coins for mining
t
Resilience to Mining Power Variation
❑ Due to this variation the Block generation rate is affected thus also
affecting the TX confirmations
❑ However, in Bitcoin-NG the TX processing rate is constant as it does not
depend upon PoW
ADVANCED TOPIC IN INFORMATION SECURITY - Dr Imran Makhdoom 37
CONSENSUS PROTOCOLS
Recovering from Forks
micro micro micro micro
Forks
• Bitcoin-NG also resists frequent keyBlock forks, as the small
keyBlocks with low frequency, propagate very fast in the network
Vulnerability Vulnerable to 51% Attack or >= 25% computing More than 33% faulty nodes
power acquired by an adversary
Both are at the opposite ends of scalability with respect to each other
Correctness Rarely come with detailed security and BFT protocols are required to satisfy
Proof distributed protocol analysis security proofs for academic scrutiny
Limitations High computation power, high energy High communication overhead, less faulty
requirement, size of Blockchain, latency in TX node tolerance, subject to DoS attack (due
confirmation to network latency), vulnerability to Sybil
attack, suitable only for small network with
10-100 nodes
❑ P-2-P Network
IOTA
Blockchain
TX Transaction
Tangle Graph Directed Acyclic Graph called Tangle, is a ledger for storing TXs
These are the transactions (issued by the nodes) represented on the tangle
Site Set
graph
Genesis TX The first Transaction (All the tokens were created in the genesis )
X-t
X
X-2
X-4
X-t
X
X-2
X-4
❑ In an Asynchronous Network, all the nodes may not see the same set of TXs
❑ Nodes do not have to achieve consensus on, which • Therevalid
is noTXs to rule
fixed be included
for in the
ledger selecting the TXs to
❑ Nodes, just check, whether the two other TXs are approve
conflicting or not
• All nodes in the network
❑ For a TX ‘X’ to be valid, the node has to solve some
may cryptographic puzzle just like in
follow some reference
Bitcoin rule
❑ The genesis TX is directly or indirectly approved by all other TXs
X-t
X
X-2
X-4
X-t
X
X-2
X-4
F
9 4 B
3 3
E
2
1
1 C
1
Weighted TXs
❑ Each TX has a “Weight”, which is proportional to the amount of work invested into it
by the issuing node
❑ The only values the weight may assume – 3n
(n is a positive int and belongs to some non-empty interval of acceptable values)
F
9 4 B
3 3
E
2
1
1 C
1
Weighted TXs
❑ Cumulative weight of a TX
⮚ Own weight of TX + Sum of own weights of all TX that approve it
directly or indirectly
F
9 4 B
3 3
XX
3
E 3
2 C
1
1
1
Weighted TXs
❑ The only un-approved TXs are A and C
❑ When a new TX ‘X’ comes and approves A and C, then X becomes the only tip, and
cumulative weight of all other TXs increases by 3 (the weight of X)
F
12 7 B X
3 3
3
E 3
5
1
4 C
1
Weighted TXs
❑ The only un-approved TXs are A and C
❑ When a new TX ‘X’ comes and approves A and C, then X becomes the only tip, and
cumulative weight of all other TXs increases by 3 (the weight of X)
1
3
❑ Height
Length of longest oriented path to the genesis TX
❑ Depth
Length of longest reverse oriented path to some Tip
• No data privacy
71
ADVANCED TOPIC IN INFORMATION SECURITY - Dr Imran Makhdoom
CONSENSUS PROTOCOLS Contd..
Requirements for IoT Systems
Feature Existing Protocol (If implemented)
Sybil Attack • In PoW and PoS, a Sybil Node has to invest
in energy and coinbase to make an impact
• In Voting based consensus, a randomized
selection of consensus quorum in each
epoch
Fault Detection in BFT • Based on request and response messages
only
72
ADVANCED TOPIC IN INFORMATION SECURITY - Dr Imran Makhdoom
THANKS