Report MP
Report MP
compromise brand integrity, and pose substantial risks to public safety. This project
Identification
The core functionality involves the creation and utilization of smart contracts, which
utilizes key technologies, including Truffle for smart contract development, Ganache
for local blockchain setup, and Web3.js for seamless interaction with the blockchain
network.
transactions and interactions with the blockchain. The deployment process involves
the generation of QR codes, serving as a convenient and efficient means for end-
showcasing its ability to effectively thwart counterfeit attempts and enhance the
overall trustworthiness of products in the market. The proposed system not only
counterfeiting but also contributes to the broader discourse on the secure and
iii
CONTENTS
Title....................................................................................................................... i
Certificate ............................................................................................................ ii
Acknowledgement ............................................................................................... iv
Abstract ................................................................................................................ v
List of Abbreviations........................................................................................... xi
Chapter 1: INTRODUCTION
1.5 Features……………………………………………………. 13
iv
2.4 Requirements……………………………………………… 27
Chapter 3: TOOLS AND LANGAUGES USED
3.1 Solidity………………..…………………………………… 28
3.3 Ganache…….……………………………………………… 33
3.5 Truffle………………………………..….………………..... 40
3.6 Web3.js.…….……………………………………………… 44
3.7 Nodejs…………..……..…………………………………… 47
4.3 Conclusion..………………………………………………. 58
Chapter 5: IMPLEMENTATION
5.1 UI Module….…….………………………………………. 59
5.2 Backend….………………………………………………... 61
5.3 Blockchain..………………………………………………. 64
5.4 Code…….....………………………………………………. 66
Chapter 6: TESTING
v
6.2 Evaluation.………………………………………………... 70
6.3 Outputs…...………………………………………………. 71
SUMMARY………………………………………………………………
………73
REFERENCES…………………………………………………………………..74
vi
LIST OF FIGURES
1.1 Blockchain 9
1.2 Functioning Workflow 11
1.3 Features 13
3.1 Solidity Logo 28
3.2 Ganache Logo 33
3.3 Smart contracts working 37
3.4 Truffle logo 40
3.5 Web3.js Logo 44
3.6 Nodejs Logo 47
3.7 HTML&CSS Logo 51
4.1 System Architecture 56
5.1 Server Implementation 65
5.2 migrations.sol 66
5.3 initial_migration.js 66
5.4 deploy_contract.js 67
5.5 product.sol 67
6.1 Output 1 71
6.2 Output 2 71
6.3 MetaMask 72
vii
LIST OF ABBREVIATIONS
Abbreviations Explanation
DOM Document Object Model
JS Java Script
viii
CHAPTER 1
INTRODUCTION
1.1 INTRODUCTION
reputation, and market integrity, the need for robust and innovative anti-
by counterfeit goods. At its core, the system harnesses the power of blockchain
identification and verification. The utilization of smart contracts not only enhances
security but also mitigates the risks of tampering or fraudulent activities, providing a
To facilitate user engagement and streamline the verification process, the system is
MetaMask extension for secure interactions with the blockchain. The deployment of
As we delve into the intricate details of the project, we explore not only the technical
aspects but also the broader implications of utilizing blockchain in the fight against
1
counterfeiting. This endeavour represents a significant step forward in fostering a
project's objectives, methodologies, results, and its potential impact on the landscape
Tech Stack:
• HTML
• CSS
• JavaScript
• Solidity
• Truffle
• Ganache
• Web3.js
• MetaMask
brand reputation, and posing significant threats to public safety. As industries grapple
2
blockchain technology. The following points encapsulate the key dimensions of the
problem:
consumers.
counterfeit products.
3
• A need exists for a more robust and technologically advanced solution
By addressing these facets of the problem, the proposed Fake Product Identification
trustworthy marketplace.
Objectives
substances.
4
o Implement a robust product identification system to protect the integrity
5
o Enable seamless integration with existing technologies, such as web
various stages.
Identification System that not only addresses the immediate challenges posed by
counterfeit goods but also sets a precedent for the integration of advanced
6
1.3 IDEA CONTENT
The project revolves around the development and implementation of a "Fake Product
various industries. At its core, the system leverages the transformative capabilities of
reliable and immutable source of truth, enhancing product authenticity and mitigating
The technological backbone of the project includes key components such as Truffle
for smart contract development, Ganache for local blockchain setup, and Web3.js for
seamless interaction with the blockchain network. This integrated approach ensures a
Beyond its technical dimensions, the project addresses the broader challenges
to brand integrity, and the economic impact on legitimate businesses. By setting clear
economic losses, the Fake Product Identification System aims to establish a secure,
transparent, and user-friendly framework. This endeavour not only contributes to the
7
immediate fight against counterfeit products but also lays the foundation for future
1. Vulnerability to Replication:
measures.
3. Susceptibility to Tampering:
8
5. Manual Verification Processes:
entity holds unilateral control over the records. This decentralized consensus, achieved
through mechanisms like Proof of Work or Proof of Stake, plays a pivotal role in fortifying
can be made.
design of blockchain. Each block within the chain possesses a unique cryptographic hash
9
that is intricately linked to the information within the block and the hash of the preceding
block. This cryptographic linkage not only enhances security but creates an immutable
chain, making any retroactive alteration to a single block an impractical and detectable
records.
immutability of records. Once deployed, smart contracts are immutable and execute as
processes. Moreover, the transparent and auditable nature of blockchain ensures that all
participants within the network can openly scrutinize the complete history of transactions
accountability, and integrity of recorded data in areas ranging from financial transactions to
10
1.4 FUNCTIONING WORKFLOW
1. Record Creation:
o The workflow begins with the creation of a new record. This record
2. Block Formation:
creating a secure link between all blocks in the chain. This linkage
task.
11
3. Consensus Mechanism:
4. Cryptographic Hashing:
hash. This hash is generated based on the content of the block and the
hash of the previous block. The hashing process not only secures the
integrity of the data within the block but also forms an irreversible
5. Tamper Resistance:
ensure that any tampering with a single block would disrupt the entire
and are immutable once deployed. Smart contracts add another layer
12
7. Transparent Access and Auditing:
8. Continuous Repetition:
1.5 FEATURES
13
Fig 1.3 Features
and adapt to various types of data, making it highly versatile for different
the integrity and protection of each record. With a tamper-evident design and
breaches, and tampering. This inherent security instills trust in the recorded
integrity is paramount.
open and accessible nature of the blockchain. Participants within the network
have clear visibility into the entire history of transactions or records. The
14
verify the overall integrity of the ledger, cryptographic techniques preserve
is paramount.
that no single authority has complete control over the records, enhancing the
eliminates the risks associated with centralized control, making the records
1. Centralized Databases:
organization.
users.
2. Paper-Based Systems:
15
o Current System: Some sectors still heavily rely on paper-based
transactions.
paced environments.
and security questions are widely used to secure access to systems and
data.
16
entire supply chain. Additionally, these systems may struggle to adapt
sectors.
can lead to high fees and slow settlement times. Moreover, these
The limitations of these current systems underscore the need for innovative solutions
systems, can mitigate these limitations and usher in a new era of secure, transparent,
of a product.
17
2. Mitigate Counterfeiting Risks:
products.
system that not only deters counterfeiters but also ensures that
substances.
market.
18
demonstrate the feasibility and effectiveness of integrating blockchain
19
CHAPTER 2
SYSTEM ANALYSIS
Introduction:
20
Product Information Storage, QR Code Generation, and User Verification Interface.
identification details within smart contracts and generating QR codes for user-
friendly verification, the system aims to empower consumers to easily confirm the
trustworthy marketplace.
Modules:
• Functionality:
• Factors Considered:
21
• Best and fastest possible User Experience.
• Functionality:
• Objective: Provide the base to form smart contract and push them to the
blockchain.
• Functionality:
1. Technical Feasibility:
technology.
22
o Considerations: The technical expertise required for development,
2. Economic Feasibility:
expenses.
3. Operational Feasibility:
technology.
23
o Considerations: Regular updates to comply with evolving
considerations.
5. Schedule Feasibility:
6. Market Feasibility:
1. Technical Risks:
24
software bugs, vulnerabilities, and integration challenges with existing
systems.
compatibility.
2. Security Risks:
3. Regulatory Risks:
4. Adoption Risks:
25
o Mitigation: Conduct effective user training, implement a user-friendly
5. Operational Risks:
encountering issues.
7. Scalability Risks:
26
o Mitigation: Design the system with scalability in mind, regularly
of privacy protection.
strategies will be crucial for the success and resilience of the blockchain-based Fake
project lifecycle will help address emerging risks and ensure its overall effectiveness.
2.4 REQUIREMENTS
Hardware Requirements
27
2. Any computing Device
Software Requirements
2. Ganache
3. Solidity
4. Nodejs/npm
5. Web3.js
6. HTML, CSS
7. Truffle
8. Any browser
CHAPTER 3
28
3.1 Solidity
contracts for blockchain platforms, notably finding its home within the Ethereum
the creation and execution of self-enforcing contracts. With its roots deeply
Features of Solidity:
the blockchain.
29
2. Syntax Inspired by Familiar Languages:
like integers and strings to more complex types like arrays and
4. Security-Focused Design:
Pros of Solidity:
1. Ecosystem Integration:
30
o Solidity has become integral to the Ethereum ecosystem, offering
of Solidity, sharing best practices, tools, and libraries for the benefit of
all stakeholders.
Cons of Solidity:
1. Security Challenges:
overflow.
2. Learning Curve:
31
security considerations, demand a comprehensive understanding of
the language.
3. EVM Limitations:
EVM when optimizing for efficiency and scalability. This can pose
Solidity has emerged as the preeminent language for developing smart contracts, and
its widespread adoption is rooted in several key attributes that position it as the go-to
the Ethereum ecosystem, one of the most prominent and widely used
for their decentralized applications invariably turn to Solidity for its seamless
32
languages like JavaScript and C++, simplifies the process for developers,
making it an accessible and efficient choice for creating intricate smart contract
logic.
support, continual improvements, and the sharing of best practices. The wealth
developers.
Virtual Machine (EVM). The EVM serves as the runtime environment for
integration with the EVM ensures that smart contracts written in Solidity can
33
In summary, Solidity's prominence as the go-to language for smart contracts is
grounded in its deep integration with the Ethereum ecosystem, purposeful design for
position Solidity as the language of choice for those embarking on the journey of
applications.
3.3 Ganache
34
and test their applications before deploying them on the live blockchain, fostering a
Ganache is particularly renowned for its ease of use and feature-rich environment,
and debugging.
2. User-Friendly Interface:
35
4. Built-in Block Explorer:
Ganache apart. Developers can inspect the details of each block, view
transaction histories, and gain insights into the inner workings of the
network.
36
straightforward controls contribute to a more efficient and enjoyable
development experience.
with.
37
configurations, potentially complicating the development setup for
limitations, such as its Ethereum-centric focus and the need for additional tools to
development, extending their influence across multiple platforms and use cases.
38
Smart contracts revolutionize traditional contract execution by leveraging the
1. Self-Executing Code:
eliminates
2. Decentralization:
3. Immutable Record-Keeping:
4. Trustless Transactions:
39
o Smart contracts facilitate trustless transactions by automatically
efficiency of transactions.
5. Tamper-Resistant Security:
contractual obligations.
1. Immutability Challenges:
2. Code Vulnerabilities:
and adhering to best practices can pose a steep learning curve for
41
3.5 Truffle
that enhance the efficiency and effectiveness of smart contract development. Initially
introduced in 2015, Truffle has become a go-to solution for Ethereum developers,
Features of Truffle:
42
smart contracts. This ensures the reliability and robustness of smart
trustworthy
DApp.
networks.
Pros of Truffle:
43
o Truffle provides a comprehensive and integrated development
the need for developers to use disparate tools, fostering a cohesive and
Truffle ecosystem.
development lifecycle.
Cons of Truffle:
44
2. Limited Multi-Chain Support:
3.6 Web3.js
45
(DApps). Introduced to the community alongside Ethereum, web3.js serves as a
build applications that seamlessly interact with smart contracts and decentralized
developers to create dynamic and engaging user experiences while leveraging the
Features of web3.js:
applications
programmability.
46
crucial for creating real-time and responsive applications that react to
4. Account Management:
Pros of web3.js:
47
3. Enhanced User Experience:
Users can interact with decentralized features without the need for
Cons of web3.js:
powerful features for interacting with the blockchain and creating decentralized
decentralized applications.
3.7 Nodejs
49
the server, providing a non-blocking, event-driven architecture. Introduced in 2009,
Node.js has gained widespread adoption for its efficiency, scalability, and the ability
developers.
Features of Node.js:
Developers can utilize their JavaScript skills across the entire web
development.
4. Scalability:
50
o Node.js is designed with scalability in mind. Its non-blocking,
interactions.
development.
Pros of Node.js:
1. High Performance:
stack.
51
o Node.js has a large and active community that continually contributes
Cons of Node.js:
o Node.js is best suited for I/O-bound tasks and applications with many
52
3.8 HTML & CSS
53
Fig 3.6: HTML&CSS Logo
HTML (Hypertext Markup Language) and CSS (Cascading Style Sheets) form the
backbone of web development, providing the essential building blocks for creating
structured, visually appealing, and interactive websites. HTML defines the structure
and content of a webpage, while CSS adds style and formatting to enhance the
presentation. Together, HTML and CSS constitute the core technologies for crafting
rules for styling and layout. It enables developers to control the visual
3. Responsive Design:
54
ensuring a seamless user experience across desktops, tablets, and
mobile devices.
o HTML and CSS are known for their simplicity and ease of learning.
elements like forms and links, while CSS adds animations, transitions,
experience.
2. Separation of Concerns:
55
o HTML and CSS are versatile and extensible, accommodating a variety
o HTML and CSS are primarily static languages, and while they
o While the basics of HTML and CSS are easy to grasp, mastering more
capabilities.
providing the essential tools for structuring content and creating visually appealing
designs. Their simplicity, versatility, and widespread support make them fundamental
56
for building modern websites, while considerations for dynamic functionality and
CHAPTER 4
SYSTEM DESIGN
4.1 Introduction
and immutable. Truffle, a robust development framework, takes center stage in the
a controlled testing environment for developers to refine and validate their smart
57
The interaction between the web interface and the blockchain is facilitated by
Web3.js, a JavaScript library that ensures smooth communication. The web interface,
designed using HTML, CSS, and JavaScript, serves as the user's gateway to the
system. Through this interface, users can register new products or verify the
an extra layer of security and convenience, allowing users to manage their wallets
and sign transactions securely. The entire system is architected to prioritize user
experience, ensuring that product identification processes are not only secure but also
With the integration of these technologies, the system design fosters an ecosystem
where trust in product authenticity is paramount, reshaping the landscape of product
58
Fig 4.1: System Architecture
59
o Truffle, a powerful development framework, facilitates the seamless
o Web3.js acts as the bridge between the web interface and the
iteration.
60
o The immutability inherent in blockchain records ensures that once
4.3 Conclusion:
solution in the fight against counterfeit products. The integration of Truffle, Ganache,
redefining the way product authenticity is verified. This project not only addresses
the challenges posed by counterfeit goods but also lays the foundation for a future
where trust and transparency become integral aspects of the consumer experience.
CHAPTER 5
61
IMPLEMENTATION
The user interface (UI) module plays a pivotal role in the Fake Product Identification
System, serving as the gateway for users to interact with the blockchain-based
UI module empowers users to register new products, verify product authenticity, and
1. Intuitive Design:
• The UI module boasts an intuitive design crafted with HTML, CSS, and
processes effortlessly.
2. Product Registration:
• Users can register new products by providing relevant details through the UI.
information.
3. Product Verification:
• The verification process is seamlessly integrated into the UI, allowing users
to input product details and receive instant feedback on the authenticity of the
62
product. The UI communicates with the smart contracts on the blockchain,
4. Metamask Integration:
module. Users can seamlessly connect their wallets to the local blockchain,
5. Responsive Design:
experience, whether users are accessing the system from a desktop, tablet, or
mobile device.
6. Transaction Feedback:
with clear and concise information about the status of their transactions.
Visual cues and notifications guide users through each step, enhancing the
7. Accessibility Features:
63
• Accessibility features are implemented to cater to a diverse user base. The UI
guidance in case of user errors. Clear error messages and prompts assist users
the system.
In essence, the User Interface Module in the Fake Product Identification System is a
between users and the blockchain but also prioritizes design principles that enhance
user experience, security, and accessibility. With its intuitive design and
The backend module of the Fake Product Identification System orchestrates the
interaction between the user interface and the blockchain, managing smart contracts
written in Solidity and powered by the Node.js server. This backend functionality is
communication with the Ethereum blockchain, and handling business logic related to
product identification.
64
1. Smart Contract Deployment:
• Truffle, as part of the backend, takes charge of compiling and deploying the
the deployment workflow and ensuring that the latest version of the smart
• Web3.js, integrated into the backend, acts as the bridge between the Node.js
• The Node.js server, as the backend logic handler, executes the business logic
65
• The backend handles events emitted by the smart contracts, capturing
7. Server-Side Validation:
interacting with the smart contracts. This validation ensures that only valid
and properly formatted data is sent to the blockchain, enhancing the overall
8. Asynchronous Operations:
system remains responsive and efficient, even when waiting for blockchain
transactions to be mined.
smart contract deployment to seamless interaction with the Ethereum blockchain, the
66
backend plays a pivotal role in ensuring the reliability, security, and efficiency of the
In this setup:
67
5. Quick Feedback Loop: Ganache shortens the development feedback loop by
without involving real transactions. This ensures that testing activities do not
5.4 CODE
Some snippets of the major part of the code are given below:
68
Code: migrations.sol
Fig 5.2:migrations.sol
Code: initial_migration.js
Code: deploy_contract.js
69
Fig 5.4: deploy_contract.js
Code: products.sol
CHAPTER 6
TESTING
70
6.1 TESTING A PART OF SDLC
component to identify any discrepancies between the expected and actual behaviour.
The primary goal of testing is to ensure that the software or system meets specified
2. Validation: Ensuring that the end product satisfies the intended use and
meets the needs of the users. This involves dynamic testing where the
development phase.
4. Types of Testing:
• Manual Testing: Testers manually execute test cases without the use
testing.
71
• Unit Testing: Testing individual units or components of the software
in isolation.
components or systems.
specifications.
testing.
6. Challenges:
72
• Incomplete Requirements: Lack of clear and complete specifications
guarantee the immutability of product records and safeguard against potential threats.
combating counterfeit products and fostering trust within industries and markets.
73
6.2 OUTPUT INTERFACE
74
Fig 6.3: MetaMask
75
SUMMARY
technology to address the pervasive issue of counterfeit products in the market. The
Metamask to establish a secure and transparent platform for product verification. The
To set up the system, users are guided through a comprehensive process that includes
Ganache, and integrating Metamask for secure wallet management. The user
interface, crafted with HTML, CSS, and JavaScript, ensures an intuitive experience
for users to register new products and verify their authenticity seamlessly.
interaction through Web3.js, and handles business logic execution. The integration of
environment for quick feedback during development. The system prioritizes accuracy
76
REFERENCES
[4] Trade in fake goods is now 3.3% of world trade and rising, March
goods-isnow-33-of-world-trade-and-rising.html.
battle against fakes may be too little too late, May 2021, [online] Available:
https://www.fastcompany.com/90636859/the-volume-of-the-problem-
isastonishing-amazons-battle-against-fakes-may-be-too-little-too-late.
Counterfeit Product Over the Past Year Per Report, June 2021, [online]
Available:
https://www.thefashionlaw.com/nearly-1-in-10-eu-consumers-
havemistakenly-bought-a-counterfeit-product-over-the-past-year-per-report/.
77
Integration, pp. 32-39, 2019.
78