Capstone Project Final Report CertNet Blockchain-based certificate storage and verification system LauRa Team Lê Cao Ngun - SE04555 Hồng Đình Quang - SE03459 Group Members Lê Hà Phan - SE04195 Phùng Khắc Thành - SE04131 Trần Bằng Tùng - SE06187 Supervisor Nguyễn Tất Trung Capstone Project Code CERTNET Hanoi, December 23rd, 2018 Table of Contents List of Tables List of Figures List of Acronyms Acknowledgement 11 Chapter 1: Introduction 13 1.1 Purpose 13 1.2 Project Information 13 1.3 The People 13 1.3.1 Supervisor 13 1.3.2 Team Members 13 1.4 Background 13 1.4.1 Paper-based certificates can be forged easily 14 1.4.2 A time-consuming, expensive and labor-intensive process 15 1.4.3 Paper-based certificate is hard to preserve 16 1.5 Literature Review of Existing Systems 16 1.5.1 The Massive Open Online Courses (MOOCs) platforms 16 1.5.2 BlockCerts 17 1.6 The Proposal of System 18 1.6.1 System Functions 18 1.6.2 Business Flows 20 1.6.3 Out-of-scope Functions 21 1.6.4 Special Approaches 21 Chapter 2: Project Plan 23 2.1 Project Organization 23 2.1.1 Purpose 23 2.1.2 Software Process Model 23 2.1.3 Roles and Responsibilities 24 2.1.4 Tools and Techniques 25 2.2 Project Management Plan 26 2.2.1 Tasks 26 2.2.2 Meeting Minutes 26 2.2.3 Conventions 27 2.2.4 Risk Management Plan 27 2.2.5 Communication Plan .29 Chapter 3: Software Requirement Specification 31 3.1 Purpose 31 3.2 Functional Requirement 31 3.2.1 Use Case Diagram 31 3.2.2 Business Rules 32 3.2.3 Use Cases 33 3.3 Non-functional Requirement 86 3.3.1 Security 86 3.3.2 Maintainability & Extensibility .87 3.3.3 Availability and Scalability 87 3.3.4 Performance 87 3.3.5 Usability 88 Chapter 4: Software Design 89 4.1 Purpose 89 4.2 Overview of System Architecture .89 4.2.1 Diagram 89 4.2.2 Protocol Explanation .90 4.2.3 Component Explanation 91 4.3 High-level Architecture Design 97 4.3.1 Architecture Layers Design 97 4.3.2 Database Design 100 4.3.3 Common Design 104 4.4 Application of Blockchain Technology in CertNet 105 4.4.1 Overview of Blockchain .106 4.4.2 Ethereum & Smart Contract 107 4.4.3 Choice of Blockchain Platform 108 4.4.4 Application of Blockchain in CertNet 109 4.5 Detailed Design 117 4.5.1 Detailed Design of Front-End Application 117 4.5.2 Detailed Design of Back-end System 152 4.5.3 Detailed Design of Smart Contract .195 4.5.4 Detailed Design of Use Cases & Processes 199 Chapter 5: Software Testing Documentation 297 5.1 Introduction 297 5.1.1 Purpose 297 5.1.2 Scope of Testing 297 5.2 Test Plan 298 5.2.1 Testing Tools & Environment 298 5.2.2 Resources & Responsibilities 300 5.2.3 Test Strategy 301 5.2.4 Features To Be Tested 304 5.2.5 Features Not To Be Tested 306 5.3 Test Case 306 5.3.1 Automation Testing with API Testing and Unit Testing 306 5.3.2 System Testing 309 5.3.3 Acceptance Test 310 5.3.4 Defect Log 312 5.4 Test Report 313 5.4.1 Automation Test Case Report 313 5.4.2 Automation Test Report 314 5.4.3 System Test Case Report 315 5.4.4 System Test Report 317 Chapter 6: User Manual 319 6.1 Development and Deployment Guideline 319 6.1.1 Development Guideline 319 6.1.2 Deployment Guideline 323 6.2 Continuous Integration/Continuous Delivery (CI/CD) Guideline 328 6.2.1 Create Service Account for GitLab CI on Google Cloud 328 6.2.2 Setup CI on Gitlab 329 6.3 User Guideline 330 6.3.1 Install MetaMask 330 6.3.2 User – Login, Sign Up and Reset Password 331 6.3.3 Verifier – Verify Certificates 333 6.3.4 Guest – View Issuer Information 334 6.3.5 Recipient – Manage Personal Profile 335 6.3.6 Recipient – Manage Received Certificate s 336 6.3.7 Issuer – Manage Certificate Templates .339 6.3.8 Issuer – Issue Certificate Batch 340 6.3.9 Issuer – Manage Issued Certificates 342 6.3.10 Admin – Manage Issuers 344 6.3.11 Admin – Manage Requests 345 List of Tables Table 1.1 – Supervisor’s information 13 Table 1.2 – Team member’s information 13 Table 1.3 – Advantages & disadvantages of MOOC platforms 17 Table 1.4 – Advantages & disadvantages of BlockCerts 18 Table 1.5 – Types of user in the CertNet system 18 Table 2.1 – Project organization structure 24 Table 2.2 – Project team member tree 24 Table 2.3 – Project role description 25 Table 2.4 – Tools & techniques used in project 25 Table 2.5 – Meeting minute template 27 Table 2.6 – Risk register table 29 Table 2.7 – Risk probability – impact matrix 29 Table 3.1 – Business rules 33 Table 3.2 – Actor description 34 Table 3.3 – Use case list 35 Table 3.4 – Security matrix 87 Table 4.1 – CertNet back-end project structure 98 Table 4.2 – CertNet front-end project structure 100 Table 4.3 – Database entity description table 101 Table 4.4 – Entity’s attribute description table 103 Table 5.1 – Testing phases 297 Table 5.2 – Testing environment 300 Table 5.3 – Testing resources and responsibilities 300 Table 5.4 – Testing stages 303 Table 5.5 – Test schedule 304 Table 5.6 – Test deliverables 304 Table 5.7 – List of features to be tested 306 Table 5.8 – Checklist table 312 Table 5.9 – Automation test case report 314 Table 5.10 – Automation test report 315 Table 5.11 – Automation test coverage report 315 Table 5.12 – System test case report 316 Table 5.13 – Test case list 317 Table 5.14 – System test report 318 List of Figures Figure 1.1 - Certificate forgery cases reported in late 2018 .14 Figure 1.2 – Google search result of certificate forgery services in Hanoi 14 Figure 1.3 – A typical process of submitting certificate to local employer 15 Figure 1.4 – A typical process of submitting certificate to foreign employer 16 Figure 1.5 – Example of certificate issued by Coursera 17 Figure 1.6 – BlockCerts homepage 17 Figure 1.7 – Currently supporting visual certificate templates on CertNet system 19 Figure 1.8 – Example of certificate image generated by CertNet system 20 Figure 1.9 – Process of issuing certificate on CertNet system 20 Figure 1.10 – Process of verifying certificate on CertNet system 21 Figure 1.11 – Process of revoking certificate on CertNet system .21 Figure 2.1 – Iterative & Incremental Software Process Model 23 Figure 2.2 – Project management plan .26 Figure 3.1 – Use case diagram of CertNet system 31 Figure 3.2 – Use case diagram of Guest actor 36 Figure 3.3 – Use case diagram of Verifier actor .40 Figure 3.4 – Use case diagram of User actor 42 Figure 3.5 – Use case diagram of Recipient actor 47 Figure 3.6 – Use case diagram of Issuer actor 55 Figure 3.7 – Use case diagram of Admin actor 72 Figure 4.1 – CertNet system architecture 89 Figure 4.2 – CertNet back-end layer design .97 Figure 4.3 – CertNet front-end layer design .99 Figure 4.4 – CertNet database diagram 101 Figure 4.5 – Message queue working mechanism 105 Figure 4.6 – Blockchain data structure 106 Figure 4.7 – An example of smart contract written in Solidity 107 Figure 4.8 – Bitcoin average block time chart 108 Figure 4.9 – Ethereum average block time chart 108 Figure 4.10 – Proof of Existence homepage 109 Figure 4.11 – Calculating the nodes in a Merkle Tree 110 Figure 4.12 – A Merkle path used to prove inclusion of a certificate 111 Figure 4.13 – Certificate issuance algorithm flowchart 112 Figure 4.14 – Example of certificate signature stored in database 113 Figure 4.15 – Certificate verification algorithm flowchart .114 Figure 4.16 – Smart Contract logic to revoke a certificate batch 115 Figure 4.17 – Smart Contract logic to revoke a single certificate 116 Figure 4.18 – Class diagram of front-end application 117 Figure 4.19 – Class diagram of back-end system 152 Figure 4.20 – Class diagram of models 163 Figure 5.1 – V-Model .301 Figure 5.2 – Project development dependencies in package.json file 307 Figure 5.3 – Test environment configuration file 307 Figure 5.4 – Test directory structure 307 Figure 5.5 – Unit test case sample 308 Figure 5.6 – Running test by console command 308 Figure 5.7 – NPM test script in package.json file 309 Figure 5.8 – Automation test report generated by Istanbul 309 Figure 5.9 – Example of test evidence 310 Figure 5.10 – Control tasks and bugs with Pivotal Tracker 312 Figure 5.11 – Example of bug details 313 Figure 6.1 – Install JetBrains WebStorm 319 Figure 6.2 – Interface of WebStorm 320 Figure 6.3 – Install Docker 320 Figure 6.4 – Running Docker in Terminal 321 Figure 6.5 – Interface of Ganache 321 Figure 6.6 – Create storage 322 Figure 6.7 – Create Kubernetes cluster on Google Cloud 324 Figure 6.8 – Deploy services to Kubernetes cluster 325 Figure 6.9 – Register account on CloudFlare 325 Figure 6.10 – Add website on CloudFlare 326 Figure 6.11 – Configure DNS records on CloudFlare 326 Figure 6.12 – MailGun sandbox domain 326 Figure 6.13 – MailGun credentials 327 Figure 6.14 – Register account on Infura 327 Figure 6.15 – Create project on Infura 328 Figure 6.16 – Infura API key 328 Figure 6.17 – Create service account key on Google Cloud Platform 329 Figure 6.18 – Setup CI on GitLab 329 Figure 6.19 – GitLab CI Pipeline 330 Figure 6.20 – Register account on MetaMask 330 Figure 6.21 – Confirm seed phrase 331 Figure 6.22 – Sign Up 331 Figure 6.23 – Login 332 Figure 6.24 – Reset password 333 Figure 6.25 – CertNet home page 333 Figure 6.26 – Verify certificate 334 Figure 6.27 – View all issuers 334 Figure 6.28 – Search issuers by name 335 Figure 6.29 – View public issuer profile 335 Figure 6.30 – View personal profile 335 Figure 6.31 – Import Ethereum address 336 Figure 6.32 – Request to become issuer 336 Figure 6.33 – View all received certificates 337 Figure 6.34 – View certificate content 337 Figure 6.35 – Create share URL 338 Figure 6.36 – View all share URLs 338 Figure 6.37 – Delete share URL 338 Figure 6.38 – View all templates 339 Figure 6.39 – Create new template 339 Figure 6.40 – Template field recommendation .340 Figure 6.41 – Template actions .340 Figure 6.42 – Issue certificate batch – initialize data 340 Figure 6.43 – Issue certificate batch – select visual template 341 Figure 6.44 – Visual template auto-mapping 341 Figure 6.45 – Issue certificate batch – confirm transaction 342 Figure 6.46 – View all issued certificate batches 342 Figure 6.47 – Filter certificate batches 343 Figure 6.48 – Revoke certificate batch 343 Figure 6.49 – View certificate batch details 343 Figure 6.50 – Revoke individual certificate 344 Figure 6.51 – View all issuers .344 Figure 6.52 – Filter issuers 344 Figure 6.53 – Change issuability status 345 Figure 6.54 – View individual issuer profile 345 Figure 6.55 – View all requests 346 Figure 6.56 – Filter request .346 Figure 6.57 – View request details 346 Login • Access homepage via: http://www.certnet.info • Click “Login” on navigator • Enter email and password then click button “Login” Figure 6.23 – Login Reset password • Access homepage via: http://www.certnet.info • Click “Login” on navigator • Click “Don't remember your password?” • Enter email to receive email reset password • Click button “Send email” 332 Figure 6.24 – Reset password 6.3.3 Verifier – Verify Certificates Verifier access homepage • Verifier access homepage via: http://www.certnet.info Figure 6.25 – CertNet home page Verify certificates • Enter token, URL or upload image contains QR code to verify certificate, result will be displayed 333 Figure 6.26 – Verify certificate 6.3.4 Guest – View Issuer Information View all issuers • On navigator, move to “Partner” tab Figure 6.27 – View all issuers Search issuer by name • Enter Issuer’s name in input field 334 Figure 6.28 – Search issuers by name View public issuer profile • Click on logo or name to view public issuer profile Figure 6.29 – View public issuer profile 6.3.5 Recipient – Manage Personal Profile View personal profile • • Login with recipient account On navigator, move to “account” tab Figure 6.30 – View personal profile Update Ethereum address • • • Click button “Add Address” Enter Ethereum address Click button “Import” 335 Figure 6.31 – Import Ethereum address Request to become issuer • • • Click button “Request to be Issuer” Fill all information Click button “Send Request” Figure 6.32 – Request to become issuer 6.3.6 Recipient – Manage Received Certificate s View all received certificates • On navigator, move to “Recipient” tab 336 Figure 6.33 – View all received certificates View certificate content • Click in certificate card to view detail Figure 6.34 – View certificate content Create share URL • Recipient selects certificates that want to share • Select “Duration days” of the share URL • Click button “Get Link” 337 Figure 6.35 – Create share URL View all share URLs • On navigator, move to “Manage Link” tab Figure 6.36 – View all share URLs Delete share URL • Click button “Delete” if you want to delete link Figure 6.37 – Delete share URL 338 6.3.7 Issuer – Manage Certificate Templates View all templates • Login with Issuer account • On navigator, move to “Issuer” tab, then “Manage Certificate Template” tab Figure 6.38 – View all templates Create new template • Click button “Create new template” • Issuer can use suggest question to create template’s fields Figure 6.39 – Create new template 339 Figure 6.40 – Template field recommendation Issuer can delete, duplicate, export, edit template with these buttons Figure 6.41 – Template actions 6.3.8 Issuer – Issue Certificate Batch Initialize information • Login with Issuer Account, on navigator, move to “Issue Certificate Batch” tab • Access “Issue Certificate Batch” tab, and fill information: • Click button “Next” Figure 6.42 – Issue certificate batch – initialize data Create visual template • Select template • Map all fields 340 • Click button “Next” Figure 6.43 – Issue certificate batch – select visual template Figure 6.44 – Visual template auto-mapping Confirm issue batch • After step 2, Issuer can update data directly • Finally, Issuer issues batch via MetaMask 341 Figure 6.45 – Issue certificate batch – confirm transaction 6.3.9 Issuer – Manage Issued Certificates View all issued certificate batches • Login with Issuer Account, on navigator, move to “Manage Issued Certificates” tab Figure 6.46 – View all issued certificate batches Filter batch by name, description or tags • Enter in input fields to filter batch by name, description or tags 342 Figure 6.47 – Filter certificate batches Revoke certificate batch • Click button “Revoke” to revoke certificate batch Figure 6.48 – Revoke certificate batch View certificate batch details • Click button “View” to view certificate batch details Figure 6.49 – View certificate batch details Revoke individual certificate • Click button “Revoke” to individual certificate 343 Figure 6.50 – Revoke individual certificate 6.3.10 Admin – Manage Issuers View all issuers • Login with Admin Account, on navigator, move to “Admin” tab, then click “Manage Issuer” tab Figure 6.51 – View all issuers Filter issuer • Enter name, email or phone to filter Issuer Figure 6.52 – Filter issuers 344 Change issuer’s issuability status • Admin can change issuer’s issuability status by switch button Figure 6.53 – Change issuability status View individual issuer profile • Click button “view” to view individual issuer profile, admin can update issuer’s information Figure 6.54 – View individual issuer profile 6.3.11 Admin – Manage Requests View all request • Login with Admin Account, on navigator, move to “Admin” tab 345 Figure 6.55 – View all requests Filter request Enter name, email, phone, or select status to filter requests Figure 6.56 – Filter request View request details • Click button “View” to view request’s detail Admin can update request information, and approve or reject request here Figure 6.57 – View request details 346 ... Test Report 313 5.4.1 Automation Test Case Report 313 5.4.2 Automation Test Report 314 5.4.3 System Test Case Report 315 5.4.4 System Test Report. .. Automation test case report 314 Table 5.10 – Automation test report 315 Table 5.11 – Automation test coverage report 315 Table 5.12 – System test case report ... Figure 4.1 – CertNet system architecture 89 Figure 4.2 – CertNet back-end layer design .97 Figure 4.3 – CertNet front-end layer design .99 Figure 4.4 – CertNet database