Department of Computer Science
Information
Technology
University http://www.itu.edu.pk
Assist. Prof. Dr. Muhammad Umar
Blockchain
Assignment # 02
100 Marks
Q1: Implement a Merkel tree using a large text file having size of 1 gigabyte and
provide a working code for checking whether: (60)
a) The data block is a part of Merkle tree (Proof of membership)
b) The data is not part of Merkle tree (Proof of non-membership)
Note: This assignment should be done in Python and only students without any experience with
Python should choose another language.
Instruction for text file generation:
Step 1: Copy and paste the generate_random_text_file function into your Python script. Ensure that this
function is included in your code.
Step 2: To generate a text file with a specific size, call the generate_random_text_file function in your
script and provide two arguments:
file_path: A string specifying the file name and path where you want to save the generated text
file.
file_size: An integer representing the desired file size in gigabyte (GB).
Step 3: Run your Python script containing the function call.
Step 4: Check the directory where your Python script is located, and you will find the generated text file
with the name and path you provided in file_path.
Example 1: Generating a 10MB File:
generate_random_text_file('sample_10mb.txt', 10*1024) # This creates a 10 MB file named
'sample_10mb.txt'.
Q2: Explain the difference between verkle tree and merkle tree. (20)
Q3: Explain the differences between the following consensus algorithms: (20)
1. Proof of Work (PoW)
2. Proof of Stake (PoS)
3. Proof of Ownership (PoO)
4. Proof of Authority (PoA)
5. Delegated Proof of Stake (DPoS)
6. Proof of Burn (PoB)
For each, briefly describe how the algorithm works and its key characteristics.
Submission Details:
Submit your code and pdf report containing solution of above three questions in a
single zip file with the name FirstName_RollNumber_01.zip
Your report must contain output of your merkle tree proofs and explanation of your
results.
Submit a single zip file containing
(a) Code file (b) Pdf Report
Follow the naming convention.
For each convention, there is a 3% penalty if you don’t follow it.
Email instructor or TA if there are any questions.
Plagiarism will lead to a straight zero with additional consequences as well.
10% (of obtained marks) deduction per day for a late submission.
Deadline September 30, 2024