Assignments and Projects done during the course CS 765 - Introduction to Blockchains, Cryptocurrency and Smart Contracts taught by Prof. Vinay Ribeiro.
Link to Report of Part 1 of Project
Compile the main.cpp
file using g++ main.cpp
.
./a.out <SimulationTime> <NumberOfNodes> <percentSlowNodes> <lambda for transaction> <lambda for block>
The directory contains the following files:
main.cpp
: Contains the main blockchain simulator code. Takes in the following arguments:
- Simulation time (in seconds)
- Number of nodes in the network
- Percentage of slow nodes (in % between 0 to 100)
- Probability with which two arbitrary nodes are neighbours in the network
-
functions.h
: Contains the utility functions required for the simulation. -
globalvariables.h
: Contains the the global variables that are initialised and updated by variaous other functions. -
structures.h
: Contains the following user-defined structures: node, block, event, transaction and their constructors.
blockData.txt
: Information of the generated blocksBlockChain_*.txt
: Blockchain tree for each node, with other detailsinitialCoins.txt
: Coins owned by each node at the start of simulationFinalCoins.txt
: Coins owned by each node at the end of simulation
Link to Report of Part 2 of Project
Compile the main.cpp
file using g++ main.cpp
.
./a.out <NumberOfNodes> <SimulationTime> <lambda for transaction> <lambda for block> <zeta> <alpha>
The directory contains two folders selfish
and stubborn
. Each directory has the following files:
-
main.cpp
: Contains the main blockchain simulator code. Takes in the following arguments as stated above. -
functions.h
: Contains the utility functions required for the simulation. -
globalvariables.h
: Contains the the global variables that are initialised and updated by variaous other functions. -
structures.h
: Contains the following user-defined structures: node, block, event, transaction and their constructors. -
mg.sh
: A bash script used to make blockchain tree plots.
blockData.txt
: Information of the generated blocksBlockChain_*.txt
: Blockchain tree for each node, with other detailsinitialCoins.txt
: Coins owned by each node at the start of simulationFinalCoins.txt
: Coins owned by each node at the end of simulationMPU.txt
: Contains the required ratios (MPU, effective alpha, etc.) for analysis
Link to Report of Part 3 of Project
- Run the following command and copy the address to the genesis.json in the alloc section that adds the balance to the geth account.
geth --datadir $HOME/HW3/test-eth1/ --password ./password.txt account new
- Run the following command to set up the Ethereum node.
sh runEthereumNode.sh
- execute the run.py file from a different terminal window
python3 run.py