VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF COMPUTER SCIENCE AND ENGINEERING CAPSTONE PROJECT Application of Blockchain technology in verification of agriculture products identity Major: Computer Science THESIS COMMITTEE: CC-CS 12 REVIEWER: Mrs. Le Thanh Van SUPERVISOR: Assoc. Nguyen Duc Thai, PhD —o0o— STUDENT 1: Le Quang Khoi (2053151) STUDENT 2: Luu Trinh Thien (2053451) STUDENT 3: Ngo Quang Nguyen (2053276) HO CHI MINH CITY, April 2024 VIETNAM NATIONAL UNIVERSITY HO CHI MINH CITY HO CHI MINH UNIVERSITY OF TECHNOLOGY FACULTY OF COMPUTER SCIENCE AND ENGINEERING CAPSTONE PROJECT Application of Blockchain technology in verification of agriculture products identity Major: Computer Science THESIS COMMITTEE: CC-CS 12 REVIEWER: Mrs. Le Thanh Van SUPERVISOR: Assoc.
Nguyen Duc Thai, PhD —o0o— STUDENT 1: Le Quang Khoi (2053151) STUDENT 2: Luu Trinh Thien (2053451) STUDENT 3: Ngo Quang Nguyen (2053276) HO CHI MINH CITY, April 2024 ĐẠI HỌC QUỐC GIA TP.HCM CỘNG HÒA XÃ HỘI CHỦ NGHĨA VIỆT NAM ---------- Độc lập - Tự do - Hạnh phúc TRƯỜNG ĐẠI HỌC BÁCH KHOA KHOA: KH&KT Máy tính NHIỆM VỤ LUẬN ÁN TỐT NGHIỆP BỘ MÔN: Hệ thống & Mạng máy tính Chú ý: Sinh viên phải dán tờ này vào trang nhất của bản thuyết trình HỌ VÀ TÊN: Lê Quang Khôi – Student ID: 2053151 Ngô Quang Nguyên – StudentID: 2053276 Lưu Trịnh Thiên – StudentID: 2053451 NGÀNH: Khoa học Máy tính LỚP: 1. Đầu đề luận án: Application of Blockchain Technology in Verification of Agriculture Products Identity. Nhiệm vụ (yêu cầu về nội dung và số liệu ban đầu): - To do research on blockchain technology - To apply blockchain technology to trace agricultural products with using Hyperledger. Ngày giao nhiệm vụ luận án: 22/01/2024 4.
Ngày hoàn thành nhiệm vụ: 07/06/2024 5. Họ tên giảng viên hướng dẫn: TS. Nguyễn Đức Thái Nội dung và yêu cầu LVTN đã được thông qua Bộ môn. Ngày 22 tháng 01 năm 2024 CHỦ NHIỆM BỘ MÔN GIẢNG VIÊN HƯỚNG DẪN CHÍNH (Ký và ghi rõ họ tên) (Ký và ghi rõ họ tên) TS.
Nguyễn Đức Thái TS. Nguyễn Đức Thái PHẦN DÀNH CHO KHOA, BỘ MÔN: Người duyệt (chấm sơ bộ): _______________________ Đơn vị: _______________________________________ Ngày bảo vệ: __________________________________ Điểm tổng kết: _________________________________ Nơi lưu trữ luận án: _____________________________ iii Declaration of Authorship We, Luu Trinh Thien, Ngo Quang Nguyen and Le Quang Khoi, declare that this project titled “Application of Blockchain technology in verification of agriculture products iden- tity” and the work presented in it are our own. We confirm that: • This work was done genuinely under the instruction of Dr. Nguyen Duc Thai.
• Where we have consulted the published work of others, this is always clearly at- tributed. • Where we have quoted from the work of others, the source is always given. With the exception of such quotations, this project is entirely my own work. • We have acknowledged all main sources of help.
• We will take full responsibility under any circumstances of content-related fraud or cheating in our group’s Specialized Project. Signed: Date: v HO CHI MINH UNIVERSITY OF TECHNOLOGY Abstract FACULTY OF COMPUTER SCIENCE AND ENGINEERING Department of Computer Science Application of Blockchain technology in verification of agriculture products identity by Luu Trinh Thien, Ngo Quang Nguyen and Le Quang Khoi Nowadays, counterfeit products has been a pressing and complicated challenge in today’s global marketplace. counterfeit products, often produced without acceptance to quality standards or property rights, pose significant risks to both consumers and businesses. One of the many kinds of products that easily get counterfeited is agriculture products, due to a lack of ways of verification.
In this project, we aim to leverage Blockchain technology to establish a secure and transparent system for the verification of agricultural product iden- tities. Traditional methods of verifying the origin and authenticity of agriculture products often lack transparency, traceability, and are easy to cheat. The proposed solution employs Blockchain’s decentralized to deal with these challenges. With these said statements, we will create a system that records every significant event in the life cycle of an agricultural product, from seeding to distribution.
Each participant in the supply chain, including farmers, distributors, retailers, and consumers, will have a unique cryptographic identity, ensuring traceability at every stage. The transparency of the Blockchain will allow consumers to access a record of the product’s journey, includ- ing information about the seeding process, certifications obtained, and transportation de- tails. This ensures that end-users can make good decisions based on accurate and verified data. By implementing a Blockchain-based verification system for agricultural products, the project aims to build trust among consumers, reduce fraud, enhance the efficiency of supply chain operations, and ultimately promote the overall integrity of the agricultural industry.
Keywords: Imitation goods, Blockchain technology, cryptographic identity vii Acknowledgements This specialized project was completed under the guidance of Dr. Nguyen Duc Thai, De- partment of Computer Science and Engineering, Ho Chi Minh city University of Technol- ogy. We would like to sincerely thank Dr. Nguyen Duc Thai for helping us with expertise, discussions, suggestions and facilitation convenient for us to complete the project.
We would also like to express our deep gratitude to the teachers of the Faculty of Com- puter Science and Engineering, Ho Chi Minh city University of Technology, who imparted professional knowledge, helped us to improve our learning and growing over the past time. Finally, we would like to express our sincere thanks to our families, who have always supported and encouraged us throughout the project. ix Contents Declaration of Authorship iii Abstract v Acknowledgements vii 1 Introduction 1 1.1 Website application development .2 Mobile application development .3 Front-end development .4 Front-end programming .1 The production units .2 The processing units .3 The distribution units. 16 User registration and authentication.
16 Verification of product identity. 16 Integration with Ethereum wallets .2 Non-Functional requirements. 17 Privacy and Compliance .1 System usecase diagram .4 Add wallet for authenticate .5 Create and update business information .6 Update product’s diary .3 Add wallet for authenticate .4 Create and update business information .5 Update product’s diary .1 Build private contract Hyperledger Fabric .2 Build public Blockchain for recording diary of products .2 Business’s Blockchain interaction .4 View, controller and database .2 Verify the JWT .1 Log out of all devices features .1 Introduction to Redis .2 Comparing Redis with Other Databases - Differences from RDBMS (relational database management system) .3 Comparing Redis with Other Databases - Differences from Other NoSQL Databases .2 Using hash function to hash the passwords .3 The problem of keeping private_key for users .1 Usage and Deployment .2 Enums and Structs .3 Constructor and Modifiers .2 The private key encryption .2 Create artifacts and running the network .3 Chaincode implementation and deploy .4 Fabric SDK in Nodejs .2 Sign in with wallet address .3 View and Update business information .4 Register new products .5 View and Update product diary .2 Update product diary .6 View history of transactions .7 Verify product by QR code. 99 10 Evaluation and Conclusion 101 10.1 Summary of Results .2 Challenges and troubles.
103 Reference 105 xv List of Figures 5.1 System Usecase diagram .2 Authenticate Usecase diagram .3 Authenticate Usecase description .4 Register Usecase diagram .5 Register Usecase description .6 Add wallet Usecase diagram .7 Add wallet Usecase description .8 Create and update information Usecase diagram .9 Create and update information Usecase description .10 Update product diary Usecase diagram .11 Update product diary Usecase description .12 Register product Usecase diagram .13 Register product Usecase description .14 Verify product Usecase diagram .15 Verify product Usecase description .16 Build contract Usecase diagram .17 Build contract Usecase description .18 Authenticate activity diagram .19 Register activity diagram .20 Add wallet activity diagram .21 Update information activity diagram .22 Update product diary activity diagram .23 Register product activity diagram .24 Verify product activity diagram .25 Build contract activity diagram .26 Architecture design for build private contract between two business .27 Architecture design for tracking product system .28 System class diagram .30 Business’s Blockchain interaction .32 View, controller and database .34 Verify the JWT .1 How Redis is typpcially used.3 How does an RSA work .1 The JWT’s content.2 The token is still valid .3 The JWT is blocked.4 Redis Cloud service.6 Send the image to the IPFS and recieve a CID.9 Running the network with docker .10 Create the channel with shell scripts .12 An example of our chaincode .13 Query a contract by stakeholder .14 Query a contract by its Id .1 Email and Password .3 Connect wallet page .4 Enter business information .6 View profile of a company .5 View business information .7 Update business information page .8 Register new product .11 Transfer ownership to other company .12 History of all transactions .14 Consumers view product on their phones .15 Consumers view product on their phones. 95 xvii List of Tables 6.1 Comparison between Redis and RDBMS .2 Comparison between Redis and NoSQL Databases .3 Comparison between Redis and Traditional database. 102 xix List of Abbreviations DApp Decentralized Application UX User Experience QR Quick Response EVM Ethereum Virtual Machine IPFS Interplanetary File System CID Content Identifier OTP One Time Password JWT JSON Web Token SDK Software Development Kit MSP Membership Service Provider RDBMS Relational Database Management System 1 Chapter 1 Introduction In today’s global marketplace, counterfeit products present a significant and complex chal- lenge. These products, often lacking adherence to quality standards and property rights, pose considerable risks to both consumers and businesses.
Agricultural products are par- ticularly susceptible to counterfeiting due to a lack of reliable verification methods. This project focuses on leveraging Blockchain technology to establish a secure and transpar- ent system for verifying the identities of agricultural products. Traditional methods of confirming the origin and authenticity of these products often lack transparency, trace- ability, and are vulnerable to manipulation. The proposed solution utilizes Blockchain’s decentralized nature to address these challenges.
The system will record every significant event in the life cycle of an agricultural product, from seeding to distribution. Each partici- pant in the supply chain, such as farmers, distributors, retailers, and consumers, will have a unique cryptographic identity, ensuring traceability at every stage. The transparency of the Blockchain will enable consumers to access a comprehensive record of the prod- uct’s journey, including information about the seeding process, certifications obtained, and transportation details. This ensures that end-users can make informed decisions based on accurate and verified data.
By implementing a Blockchain-based verification system for agricultural products, the project aims to build trust among consumers, reduce fraud, enhance the efficiency of supply chain operations, and ultimately promote the overall in- tegrity of the agricultural industry.1 Problem statement One of the biggest challenges when a consumer wants to buy a product is identifying the product’s origin. And tracking the product’s origin becomes more crucial when they are agricultural victuals which have a long supply chain, from breed level to processing unit, from manufacturer to distributor, and from retailers to end consumers. This kind of prod- uct plays a necessary role and could be the products usually consumed by the customers. However, with their long life on the supply chain, they become troublesome to control, and could be counterfeited.
Let’s go to an example, where we explain everything in a more intuitive way. Imagine a consumer - Lan wants to buy some vegetables for her family’s dinner. From gossiping with the housewives in her neighborhood, she knows that vegetables from the VNVG (an example business) have high quality but affordable prices. When she goes to the supermarket, she seems to be confused because there are a lot of vegetables with the VNVG brand and they have different prices for the same kind of vegetables.
This is the problem we mentioned above - the Counterfeit consumer goods. Even though there is only a product with the VNVG brand, that product has nothing to be sure it is from the original company- the VNVG.