COMP1011 Programming Fundamentals 2018/19 Semester 2Department of ComputingProgramming FundamentalsAssignment 3A Simple Blockchain[Deadline: 23:00:00 30th April, 2019]BackgroundBlockchain, a cryptographic tool, is extensively used in Fintech applications nowadays forprotecting chronological order of transactions.The blocks are “linked” together by enforcing a specific relationship between blocks. That is,a block must contain a “fingerprint”, which is a hash value, of the data of the previous block.A hash function can condense arbitrary message (the block information) to a fixed size (e.g.,160 bits) and produces a fingerprint of the message.Hash of Block 1 Hash of Block 2 Hash of Block 3COMP1011 Programming Fundamentals 2018/19 Semester 2Department of ComputingThe Hong Kong Polytechnic University- 2 -After a block is added to the end of the chain, it can neither be removed or modified. If thereare malicious changes to the transaction data, it can be detected by checking the hash valuestored in the next block.In short, blockchain is essentially a linked list data structure, which links the transaction datastored in blocks. And the integrity of the blocks can be verified by using hash values.What you have to doImplement a Blockchain using linked list as the data structure. The following template fileshave been given to you (available in Blackboard). Import the files in a new C++ project anduse them as the starting point of your code:Blockchain.hIt is a class of linked list corresponds to the structure of block, it includes all the datanecessary to enter in a block, for example, sender, receiver, amount_of_transactionetc. You DO NOT have to modify this file.Blockchain.cppThis file contains the implementation of Blockchain (linked list). This includes five functions:1. Linked_List(). //(Constructor)2. ~Linked_List(). //(Destructor)3. add(). //Function to add blocks4. print(). //Function to print the blockchain5. Verify(). //Function to check the validity of blockchainConsolas You DO NOT have to modify this file.SHA1.hThis file contains the declarations of sha1. You DO NOT have to modify this file.SHA1.cppThis file contains the core logic of generating a 160-bit value hash value based on SecureHash Algorithm version 1 (SHA-1). You DO NOT have to modify this file.Assignment_3.cppCOMP1011 Programming Fundamentals 2018/19 Semester 2Department of ComputingThe Hong Kong Polytechnic University- 3 -This file contains the main() program. Use it as a testing driver of your code. Here are somesteps you can follow in main().1. Make some transactions by add() functions.2. Use the verify() function to check the validity of your chain.3. Now manipulate the data of any the blocks.4. Now again check the validity of you chain.You DO NOT have to modify this file.Read carefully the details of each file first before coding. The existing coding may shed yousome light on how to code the missing parts.The following is a visual representation of the blockchain, to be implemented by yourprogram:BlockBlockDatatransactionNULLhash of previoustransactionBlockBlockDatatransactionBlockchainB代做COMP1011作业、Programming留学生作业代写、C/C++课程设计作业代做、c/c++编程作业调试 帮做lockBlockDatatransactionhash of previoustransactionhash of previoustransactionIn the real world, the hash value has to be digitally signed by the creator of the block sochanges on the hash value is not possible by the attacker. In this assignment, we just assumethe hash value cannot be changed after the block is created.COMP1011 Programming Fundamentals 2018/19 Semester 2Department of ComputingThe Hong Kong Polytechnic University- 4 -Below shows the output of Assignment_3.cpp if the implementation is successful:Example for the use of SHA1.cpp It produces a string of 160 bits no matter how long or small the input is. COMP1011 Programming Fundamentals 2018/19 Semester 2Department of ComputingThe Hong Kong Polytechnic University- 5 -AssessmentThis assignment is divided into multiple levels of difficulty. Try to accomplish theassignment from the easiest level first and proceed to the next level. It helps you break downthe problem into smaller pieces and build up the program progressively. You will be awardeda maximum mark for each level. Only if you complete all requirement of this assignment,you will get full marks.Level 1 (30 marks) Implement the constructor Linked_List() and destructor ~Linked_List()functions in Blockchain.cpp.Level 2 (20 marks) Implement the print() in Blockchain.cpp.Level 3 (50 marks) Implement the add() and verify() functions in Blockchain.cpp.At the beginning of Assignment_3.cpp, type your information using the following C++comment template://============================================================================// Author : // Student No. : // Description : COMP1011 Assignment 3//============================================================================Warning: Any compilation error will be awarded ZERO mark, regardless of what youhave coded. Therefore, if you are unable to complete the whole program, try to accomplishsome of the implementations. In this case, you may edit Assignment_3.cpp as well as otherfiles so that the project can be compiled and the program can be run successfully.SubmissionCOMP1011 Programming Fundamentals 2018/19 Semester 2Department of ComputingThe Hong Kong Polytechnic University- 6 -Follow the steps below:1. Create a folder and name it as _.E.g., 12345678d_CHANTaiMan2. Put the following .h and .cpp files into the folder:1. Blockchain.h2. Blockchain.cpp3. Assignment_3.cpp4. SHA1.h5. SHA1.cpp3. Compress the folder (.zip, .7z, .rar, or .jar) and submit the compressed file toBlackboard.The deadline of this assignment is 23:00:00 30th April, 2019. No late submission is allowed.This assignment is an individual work. All work must be done on your own. Plagiarismis serious offence. The Moss (https://theory.stanford.edu/~aiken/moss/) system will beadopted for plagiarism checking. Submissions with high similarity, in terms of codepatterns and structures, in addition to direct-copy-and-paste, will be treated asplagiarism. Copying code from web resources is prohibited as well. Any plagiarismcases (both copier and copiee) will be given ZERO mark in this assignment.转自:http://www.7daixie.com/2019050148152204.html
网友评论