Implementing Cryptographic Primitives for BlockChain Solution

$30.00 $24.00

Introduction The project has three phases: Developing software for digital signature and blockchain transactions Developing software for proof of work Developing software for other building blocks and integration More information about the phases are given in the subsequent sections. Phase I: Developing software for digital signature and Blockchain Transactions In this phase of the project,…

5/5 – (2 votes)

You’ll get a: zip file solution

 

Description

5/5 – (2 votes)
  • Introduction

The project has three phases:

Developing software for digital signature and blockchain transactions Developing software for proof of work

Developing software for other building blocks and integration

More information about the phases are given in the subsequent sections.

  • Phase I: Developing software for digital signature and Blockchain Transactions

In this phase of the project, you are required to upload two les: \DS.py” and \Tx.py”. We will be able to test your codes using \PhaseI Test.py’. If your software cannot be tested by \PhaseI Test.py’ as it is, you will get no credit.

2.1 Developing software for digital signature

Here, you will develop a Python module \DS.py” that includes functions for signing given any message and verifying the signature. For digital signature (DS) you will use an algorithm, which consists of four functions as follows:

Public parameter generation: Two prime numbers p and q are generated with qjp 1, where q and p are 224-bit and 2048-bit integers, respectively. The generator g generates a subgroup of Zp with q elements. Naturally, gq 1 mod p. Note that in your system q, p, and g are public parameters shared by all users, who have di erent secret/public key pairs. Refer to the slide (with title \DSA Setup” in chapter 10 for an e cient method for parameter generation).

1

Key generation: A user picks a random secret key 0 < < q 1 and computes the public key = g mod p.

Signature generation: Let m be an arbitrary length message. The signature is computed as follows:

1.

h = SHA3

256(m)

(mod q)

2.

k Zq, (i.e., k is a random integer in [1; q 2]).

3.

r = (gk

(mod p))

(mod q)

4.

s = r

k h (mod q)

    1. The signature for m is the tuple (s; r).

Signature veri cation: Let m be a message and the tuple (s; r) is a signature for m. The veri ciation proceeds as follows:

{ h = SHA3 256(m) (mod q)

{ v = h 1 (mod q)

{ z1 = s v (mod q)

{ z2 = r v (mod q)

{ u = (g z1 z2 (mod p)) (mod q)

{ Accept the signature only if u = r { Reject it otherwise.

Note that the signature generation and veri cation of this DS are di erent than those discussed in the lecture.

You are required to develop Python software that implements those four functions; namely Setup for public parameter generation, Key Generation, Signature Generation and Signature Verification. You are required to test your software using the test routines in \PhaseI Test.py” provided in the assignment package.

In this part of \PhaseI Test.py”, there are four basic test functions:

  1. checkDSparams(q; p; g) takes your public parameters (q; p; g) and checks if they are correct. It returns 0 if they are. Otherwise, it returns a code that indicates the problem.

  1. CheckKeys(q; p; g; ; ) takes your public parameters (q; p; g) and key pair ( ; ) and checks if the key pair is correct. It returns 0 if they are; otherwise it returns -1.

  1. CheckSignature(q; p; g; ; ) takes your public parameters (q; p; g), key pair ( ; ) and generates a signature for a random message and veri es the signature. It returns 0 if the signatures veri es; otherwise it returns -1.

  1. CheckTestSignature() reads the le \TestSet.txt” (provided in the assignment package), which contains public parameters, a public key, and 10 randomly chosen messages and their signatures. The test code reads them and runs signature veri cation function. The test code returns 0 if all signatures verify; otherwise it returns -1.

2

2.2 Generating Random Transactions

Here, you will develop a Python module \Tx.py” that includes functions for generating a random Blockchain transaction. A transaction contains information of a payment (transaction) from the payer to the payee and is in the following format:

*** Bitcoin transaction ***

Serial number:

Payer public key (beta):

Payee public key (beta):

Amount:

Signature (s):

Signature (r):

Explanations of these elds are as follows

Serial Number: is a uniformly randomly generated 128-bit integer

Payer public key (beta): is the public key of the person making the payment

Payee public key (beta): is the public key of the person receiving the payment

Amount: is the amount in Satoshi being transferred in range [1, 1000000]

Signature (s): Signature (s part) of the transaction by Payer

Signature (r): Signature (r part) of the transaction by Payer

Note that the payer and payee are identi ed by their public keys in the transaction, which is signed by the private key of the payer. Therefore, the transaction can be veri ed by the public key of the payer.

In this part of \PhaseI Test.py”, there are two test functions:

  1. CheckTransaction(q; p; g) creates a random transaction and veri es its signature. For this, you will develop a function named \gen random tx(q, p, g)” in \Tx.py”.

  1. CheckBlockofTransactions() reads sample transactions given in le \transactions.txt” (also provided in the assignment package) and veri es the signatures of all transactions using your veri cation function in \DS.py”; namely \DS.SignVer”.

3

  • Appendix I: Timeline & Deliverables & Weight & Policies etc.

Project Phases

Deliverables

Due Date

Weight

Project announcement

29/11/2019

First Phase

Source codes

6/12/2019

30%

(DS.py and Tx.py)

Second Phase

TBA

13/12/2019

TBA

Third Phase

TBA

20/12/2019

TBA

3.1 Policies

You may work in groups of two.

You may be asked to demonstrate a project phase to a TA or the instructor.

In every phase, we will provide you with a validation software in Python language that can be used to check your implementation for correctness. We will also use it to check your implementation. If your implementation in a project phase fails to pass the validation, you will get no credit for that phase.

Your codes will be checked for their similarity to other students’ codes; and if the similarity score exceeds a certain threshold you will not get any credit for your work.

4

Implementing Cryptographic Primitives for BlockChain Solution
$30.00 $24.00