Skip to content

Implementing a simplified fork choice algorithm that is used in the Ethereum blockchain

Notifications You must be signed in to change notification settings

shaurya-clemson/simplified-fork-choice-algorithm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Simplified-Fork-Choice-Algorithm

Problem Statement:

Description

We will implement a “modified” PoS-based voting algorithm. The original Casper FFG consists of two layers:

  1. The bottom layer is the tree of transactions.
  2. The top layer is the sub-tree of checkpoints extracted from the tree of transactions.

For the sake of simplicity, the following assumptions are made:

  1. There are 10 validators in the system. The set of the validators are fixed. The deposits of the validators are given in the table below:
Validator ID 0 1 2 3 4 5 6 7 8 9
Deposit Amount 500 100 300 250 150 500 600 350 200 150
  1. The checkpoint tree is already given.
  2. The checkpoint tree is a full binary tree.
  3. Each node/checkpoint in the checkpoint tree has a number associated with it. Given a node of number n, its left child is 2n + 1, and its right child is 2n + 2. The root node is labeled 0.
  4. The length of the link contained in each vote is always 1. This means a validator cannot skip any checkpoint in its vote, i.e., the target of the link is either the left child or the right child of the source. (Note: in the real Casper FFG, a vote can skip some checkpoints. An example is given on page 27 of the slides, where link b2 → b3 skips two checkpoints.)
  5. For each vote, the probability of selecting the left child as the target is the same as the probability of selecting the right child.
  6. If the sum of the deposits of the validators voting for a link L exceeds 1/2 of the total deposit, L is the supermajority link. (Note: this is different from the 2/3 rule used in real Casper FFG.)

In our program, starting from the genesis node, we will run the Proof-of-Stake (PoS)-based voting 10 rounds, which yields 10 supermajority links.

Output

  • The blockchain formed by the 10 supermajority links, which is a list of the node/checkpoint numbers; and
  • The IDs of the validators who finalized each checkpoint.

About

Implementing a simplified fork choice algorithm that is used in the Ethereum blockchain

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages