100% found this document useful (1 vote)
113 views6 pages

Blockchain Mid 1 Paper

The document is the title page for a 1 hour, 40 mark blockchain and cryptocurrency exam consisting of 4 questions across 6 pages. It provides instructions for students such as only using permanent ink pens and attempting all questions in order. The exam is closed book. The questions cover topics such as Merkle tree calculation optimization using the Monero approach, calculating expected annual rewards for a proof-of-stake blockchain validator, selecting highest fee transactions to include in a new block from the transaction mempool, and determining the number of padding bits needed for a SHA-512 hash of a 2590 bit message.

Uploaded by

Dr-Anwar Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
113 views6 pages

Blockchain Mid 1 Paper

The document is the title page for a 1 hour, 40 mark blockchain and cryptocurrency exam consisting of 4 questions across 6 pages. It provides instructions for students such as only using permanent ink pens and attempting all questions in order. The exam is closed book. The questions cover topics such as Merkle tree calculation optimization using the Monero approach, calculating expected annual rewards for a proof-of-stake blockchain validator, selecting highest fee transactions to include in a new block from the transaction mempool, and determining the number of padding bits needed for a SHA-512 hash of a 2590 bit message.

Uploaded by

Dr-Anwar Shah
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

CS4049 Blockchain and Serial No:

1st Sessional Exam


Cryptocurrency Total Time:1 Hour
Tuesday, February 28, 2023 Total Marks: 40
Course Instructor
________________
Asst. Prof. Dr. Anwar Shah Signature of Invigilator

_____________________ . .
Roll No Section Signature

DO NOT OPEN THE QUESTION BOOK OR START UNTIL INSTRUCTED .


Instructions:
1. Verify at the start of the exam that you have a total of four (4) questions printed on
six (6) pages including this title page.
2. Attempt all questions on the question-book and in the given order.
3. The exam is closed books, closed notes. Please see that the area in your threshold
is free of any material classified as ‘useful in the paper’ or else there may a charge
of cheating.
4. Read the questions carefully for clarity of context and understanding of meaning
and make assumptions wherever required, for neither the invigilator will address
your queries, nor the teacher/examiner will come to the examination hall for any
assistance.
5. Fit in all your answers in the provided space. You may use extra space on the last
page if required. If you do so, clearly mark question/part number on that page to
avoid confusion.
6. Use only your own stationery and calculator. If you do not have your own
calculator, use manual calculations.
7. Use only permanent ink-pens. Only the questions attempted with permanent ink-
pens will be considered. Any part of paper done in lead pencil cannot be claimed
for checking/rechecking.

Q-1 Q-2 Q-3 Q-4 Total


Total
10 10 10 10 40
Marks
Marks
Obtained

Vetted By: ___HOD - Computer Science____Vetter Signature: _____________________


University Answer Sheet No Yes
Required:

Section A Blockchain
National University of Computer and Emerging Sciences
Department of Computer Science Chiniot-Faisalabad Campus
Optimizing Merkle Calculation: Monero Style
Q No 1: The Monero approach could be described as converting the hash tree to a perfect
binary tree. It hashes enough leaf nodes in the first iteration, so that the following iterations
will always have some variant of 2ˣ (a power of 2) nodes.
Suppose a miner, Rocky has 2480 transactions in the mempool. He took 27 and 36
transactions in two consecutive block mining processes. The Merkle root has been computed
based on 27 and 36 transactions. The Merkle root optimizes the odd number of transactions
using the monero approach. What will be the values in the first iteration and the second
iteration for both blocks?

Transactions Values in First Iteration Values in Second Iteration


27 22 16
36 8 32

For 27:

2^5 = 32

1st Sessional Spring-2023 Page 2 of 6


National University of Computer and Emerging Sciences
Department of Computer Science Chiniot-Faisalabad Campus

Consensus Protocol – Proof-of-Stack


Q No 2: Consensus protocols are mechanisms used by distributed systems to ensure that all
nodes in the network agree on a common state.
Scenario: Bob wants to participate in a proof-of-stake blockchain that requires a minimum of
1,000 tokens to become a validator. The blockchain has a total supply of 10 million tokens,
and the current circulating supply is 2.5 million tokens, where 2 million tokens became
stacked. Bob owns 10,000 tokens, and the current annual reward rate for validators is 5% of
the staked tokens.
Note: Annual reward rate refers to the percentage of the total cryptocurrency supply that is
distributed as a reward to participants in a blockchain network, such as miners or validators,
over the course of a year. In proof-of-work blockchain networks, this reward is given to
miners who successfully validate transactions and create new blocks on the chain. In proof-
of-stake networks, this reward is given to validators who participate in the consensus process
by staking their tokens as collateral.

The annual reward rate is typically set by the network protocol and can be adjusted over time
based on factors such as network usage, transaction volume, and the total supply of tokens.
The reward rate is designed to incentivize participation in the network and provide
compensation for the resources and effort required to maintain the network's security and
integrity.

Question: What is the expected annual reward that Bob can earn as a validator in this proof-
of-stake blockchain?

1st Sessional Spring-2023 Page 3 of 6


National University of Computer and Emerging Sciences
Department of Computer Science Chiniot-Faisalabad Campus

Section B Cryptocurrency
Mempool
Q No 3: A mempool, short for memory pool, is a data structure used by Bitcoin and other
cryptocurrencies to store unconfirmed transactions. When a user sends a transaction, it is first
broadcasted to the network and then added to each node's mempool. Each node validates the
transaction and checks that it is not a duplicate or spending more than the user has available,
before adding it to the mempool. Miners use the mempool to select transactions to include in
the next block they mine, typically choosing the ones with the highest transaction fees first.
Once a transaction is included in a block and confirmed, it is removed from the mempool and
added to the blockchain.

Suppose a cryptocurrency mempool contains the following six unconfirmed transactions:

Transaction Fee rate (satoshi/byte) Transaction size (bytes)

Tx1 60 200

Tx2 90 400

Tx3 120 300

Tx4 150 250

Tx5 180 150

Tx6 210 500

Assume that the current block size limit is 1000 bytes and that the miners always choose
transactions with the highest fee rates first.
What is the maximum amount of transaction fees that can be collected in the next block?
What is the reward (total) in BTC that can be collected in the next block?
Note: 1 BTC = 100000000 Satoshi

1st Sessional Spring-2023 Page 4 of 6


National University of Computer and Emerging Sciences
Department of Computer Science Chiniot-Faisalabad Campus

1st Sessional Spring-2023 Page 5 of 6


National University of Computer and Emerging Sciences
Department of Computer Science Chiniot-Faisalabad Campus

Section C Cryptography
SHA-512
SHA-512 is a secure cryptographic hash function that produces a fixed-size output of 512
bits. It uses a compression function that iteratively processes input message blocks and
updates an initial hash state. The resulting hash value is unique to the input message and is
computationally infeasible to reverse or tamper with.

Q No 4: What is the number of padding bits if the length of the original message is 2590
bits?

1st Sessional Spring-2023 Page 6 of 6

You might also like