Skip to content

This is the repository of the simulation of the Selfish Mining attack over the P2P Cryptocurrency Network.

Notifications You must be signed in to change notification settings

raaghavraaj/selfish-mining-attack-simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Selfish-Mining-Attack

This is the repository for Simulating a selfish mining attack using the P2P Cryptocurrency Network, Course Assignment for CS765: Blockchain and Smart Contracts.

Team Members:

  1. Aneesh Garg - 180050007
  2. Raaghav Raaj - 180050082
  3. Shivam Goel - 180050098

Running the simulator

  1. Head into the directory Source_Code and open file main.cpp.
  2. In lines 19-35 set the parameters for the simulation. The variables have their standard meanings. The boolean variable invalid is supposed to be set true only when you want a peer to generate invalid blocks
  3. Open terminal and run the make command as shown:
180050007_180050082_180050098/Source_Code $ make
  1. This generates a file named output. Run the output script as shown:
180050007_180050082_180050098/Source_Code $ ./output
  1. This generates peer_info.txt files for every peer which contains the time of arrival of every block in the tree.
  2. 4th step would also generate a file tree.txt which contains the description of the edges of the global blockchain tree.
  3. If the invalid is set to True, the program also prints the block IDs of all the invalid blocks.
  4. To visualise a tree, we have also provided a python script showTree.py which opens tree.txt and prints a tree on the terminal itself. This can be done in the following manner:
180050007_180050082_180050098/Source_Code $ pip3 install treelib
180050007_180050082_180050098/Source_Code $ python3 showTree.py

About

This is the repository of the simulation of the Selfish Mining attack over the P2P Cryptocurrency Network.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published