0% found this document useful (0 votes)
24 views79 pages

Blockchain Report Final

Uploaded by

shankar shankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views79 pages

Blockchain Report Final

Uploaded by

shankar shankar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 79

TABLE OF CONTENTS:

CHAPTER TITLE PAGE NO


NO

I ABSTRACT vii

II LIST OF FIGURES viii

III LIST OF ABBREVIATIONS x

1 INTRODUCTION 1

1.1SYNOPSIS 1

1.2 SCOPE 3

2 LITERATURE SURVEY 6

SYSTEM ANALYSIS 9

3.1 EXISTING SYSTEM 9


3

3.1.1 MANUAL VERIFICATION SYSTEM 9

3.1.2 PAPER-BASED DOCUMENTATION 9


SYSTEMS

3.2 PROPSED SYSTEM 11

3.2.1 BLOCK DIAGRAM 12


iv
14
REQUIREMENTS & SPECIFICATIONS

4.1 SOFTWARE REQUIREMENTS 14

4.1.1 SOLIDITY FEATURES 14

4.1.2 SOLIDITY LIBRARIES 14

4.1.3 DEVELOPMENT ENVIRONMENT 15

4.1.4 REMIX ETHERUM IDE 16

4.1.5 GANACHE 16

4.1.6 METHODS 17

4.2 METAMASK 17
4
4.2.1 METAMASK WALLET 17

4.3 ETHERUM 18

4.4 SHA-256 ALGORIITHM 18

4.4.1 WORKING OF SHA ALGORITHM 18

4.4.2 SHA-512 18

4.5 HARDWARE REQUIREMENTS 19

4.5.1 QR CODE SCANNER 19

4.5.2 COMPUTERS/SERVERS 20
4.5.3 GRAPHICS PROCESSING
UNIT(GPU) 21

4.5.4 STORAGE 21

SYSTEM DESIGN & DEVELOPMENT 23

5.1 MANUFACTURE MODULE 23

v
5.2 DISTRIBUTOR MODULE 24

5.3 RETAILER MODULE 25

5.4 CONSUMER MODULE 26


5
5.5 SYSTEM ARCHITECTURE 26

5.6 USE CASE DIAGRAM 27

5.7 DATA FLOW DIAGRAM 28

6 RESULTS 30

7 CONCLUSION AND APPENDIX 31

8 REFERENCES 71

vi
ABSTRACT:

In today's global market, the proliferation of counterfeit products poses a


significant challenge, threatening consumer safety, brand reputation, and
economic integrity. Addressing this issue requires effective identification and
mitigation strategies. This project aims to develop and implement a robust system
for the detection of fake products utilizing advanced technologies such as machine
learning, computer vision, and blockchain. Leveraging data analytics and pattern
recognition algorithms, the system will analyze various attributes including
packaging, serial numbers, and product characteristics to distinguish genuine
items from counterfeits. Integration with blockchain technology will provide
immutable product verification, enhancing transparency and trust throughout the
supply chain. Through collaboration with stakeholders including manufacturers,
regulatory agencies, and consumers, this initiative seeks to combat the
proliferation of counterfeit goods, safeguarding both businesses and consumers
against the detrimental impacts of fraudulent products.

vii
LIST OF FIGURES

FIGURE NO. NAME PAGE NO

3.1 Block diagram 12

4.1 QR Code Scanner 19

Comparsion of Gas Fees with

4.2 20
RFID

4.3 Camera 20

4.4 Laptop 20

4.5 Processor 20

4.6 GPU 21

4.7 SSD 22

4.8 HDD 22

5.1 Manufacture Module 23

5.2 Distrbuter Module 24

5.3 Retailer Module 25

viii
5.4 Consumer Module 26

5.5 System Architecture 26

5.6 Use Case Diagram 27

6.1 Data Flow Diagram 28

6.2 Sequence Diagram 29

ix
LIST OF ABBREVATIONS

JDK Java Devlopment kit

DEX Dalvik Executables

IDE Integrated Development Environment

IOU Intersection Over Union

OCR Optical Character Recognition

ROI Region of Interest

GPU Graphics Processing Units

USB Universal Serial Bus

GUI Graphical Universal Interface

ETH Test Ether

HDD Hard Disk Drive

SSD Solid State Drive

MM Manufacture Manager

PM Product Manager

x
CHAPTER 1

INTRODUCTION

1.1 SYNOPSIS

The project focuses on developing a comprehensive system for identifying


counterfeit products using advanced technologies like machine learning,
computer vision, and blockchain. By analyzing various attributes such as
packaging, serial numbers, and product characteristics, the system aims to
distinguish genuine items from counterfeits. Integration with blockchain
technology will provide immutable product verification, ensuring transparency
and trust in the supply chain. Collaboration with stakeholders and the
application of data analytics will enhance the system's effectiveness in
combating the proliferation of fake goods.

1. Background:
The proliferation of counterfeit goods is fueled by advancements in
technology, globalization, and the anonymity of online marketplaces.
Counterfeiters exploit vulnerabilities in supply chains, manufacturing processes,
and consumer trust to flood the market with fake products that are often
indistinguishable from genuine ones. Traditional methods of counterfeit
detection, such as manual inspection and authentication, are becoming
increasingly ineffective in the face of sophisticated counterfeit operations.

2. Objectives:
The primary objective of this project is to develop a comprehensive
system for the identification and mitigation of counterfeit products across
various industries. Key objectives include:
 Utilizing advanced technologies such as machine learning, computer
vision, and blockchain to enhance counterfeit detection capabilities.
 Analyzing and integrating multiple data sources, including product
attributes, supply chain information, and consumer feedback, to
improve the accuracy and reliability of counterfeit identification.
 Establishing partnerships and collaboration with stakeholders,
including manufacturers, regulatory agencies, law enforcement, and
consumers, to facilitate information sharing and coordinated efforts
in combating counterfeit goods.
 Developing scalable and adaptable solutions that can be

1
implemented across different sectors and regions, addressing the
diverse challenges posed by counterfeit products in the global
marketplace.

3. Methodology:
The methodology encompasses a systematic approach to develop a
counterfeit product identification system. It begins with thorough research and
data collection, followed by data preprocessing and feature engineering to
extract meaningful attributes indicative of counterfeit products. Machine
learning algorithms are then employed for model development, alongside the
integration of computer vision techniques for visual analysis. Blockchain
technology is utilized for secure product verification. Model evaluation and
validation are conducted rigorously, with a focus on metrics such as accuracy
and robustness. Upon successful validation, deployment and integration with
existing systems follow, with continuous monitoring and improvement
mechanisms implemented to adapt to evolving threats. Documentation and
knowledge sharing ensure transparency and facilitate future replication and
advancement in counterfeit detection methodologies
4.Implementation:
The project will adopt a multi-disciplinary approach, combining
expertise in technology, data analytics, supply chain management, and
regulatory compliance. Leveraging insights from research and industry best
practices, the project team will design and implement a robust counterfeit
detection system that leverages the strengths of each technology and
methodology. Key components of the approach include:

 Data collection and analysis: Gathering and analyzing data from


various sources, including product specifications, distribution
channels, market trends, and consumer feedback, to identify patterns
and indicators of counterfeit activity.
 Technology integration: Integrating machine learning algorithms,
computer vision techniques, and blockchain technology to develop
an intelligent and secure counterfeit detection system
 Stakeholder engagement: Collaborating with manufacturers,
distributors, retailers, regulatory agencies, and consumers to gather
insights, validate solutions, and foster collective action against
counterfeit goods.
 Continuous improvement: Implementing mechanisms for ongoing
monitoring, evaluation, and optimization of the counterfeit detection
system to adapt to evolving threats and enhance effectiveness over
time.
2
5.Significance:
The significance of this project lies in its potential to mitigate the
adverse effects of counterfeit products on consumer safety, brand integrity, and
economic stability. By developing innovative technologies and collaborative
strategies for counterfeit detection, the project aims to restore trust and
confidence in the marketplace, protect the interests of legitimate businesses, and
safeguard the well-being of consumers worldwide

6.Motivation:
The motivation behind this project stems from the urgent need to combat
the growing threat of counterfeit products and protect both consumers and
businesses from their adverse effects. Counterfeit goods not only erode
consumer confidence but also pose serious health and safety risks, particularly
in industries such as pharmaceuticals and automotive parts. Moreover, the
economic impact of counterfeiting is staggering, with billions of dollars lost
annually due to lost revenue, legal costs, and damage to brand reputation.

7.Conclusion:
In conclusion, the fake product identification project represents a
concerted effort to address the pervasive problem of counterfeit goods through
innovation, collaboration, and technology-driven solutions. By leveraging
advanced technologies, data analytics, and stakeholder engagement, the project
seeks to empower businesses and consumers with the tools and knowledge
needed to identify and mitigate the risks posed by counterfeit products,
ultimately fostering a safer, more transparent, and trustworthy marketplace for
all.

1.2 SCOPE
The project scope is multifaceted, encompassing a comprehensive
approach to counterfeit product identification that spans across various
industries, technological domains, stakeholder collaborations, global
considerations, scalability requirements, continuous improvement strategies,
and ethical and legal considerations.

1. Multi-Industry Focus:
The project aims to address counterfeit detection challenges across a wide
range of industries, including but not limited to electronics, pharmaceuticals,
fashion, automotive, and consumer goods. Each industry presents unique
counterfeit threats and requires tailored detection methodologies.
3
2. Technological Integration:
Integration of cutting-edge technologies such as machine learning,
computer vision, and blockchain forms the cornerstone of the project. These
technologies synergistically complement each other to enhance counterfeit
detection capabilities, ensuring robustness, accuracy, and scalability across
different product categories and market segments.

3. Data-Driven Approach:
The project adopts a data-driven approach, leveraging diverse data
sources to train and validate counterfeit detection models. These sources include
product specifications, distribution channels, market trends, consumer feedback,
historical counterfeit incidents, and more. By harnessing the power of big data
analytics, the project aims to extract meaningful insights and patterns crucial for
accurate counterfeit identification.

4. Stakeholder Collaboration:
Collaboration with a wide range of stakeholders is fundamental to the
success of the project. These stakeholders include manufacturers, regulatory
agencies, law enforcement, retailers, industry associations, and consumers. By
fostering open communication and collaboration, the project seeks to gather
insights, validate solutions, and foster collective action against counterfeit
goods.

5. Scalability and Adaptability:


The developed counterfeit detection system is designed to be scalable
and adaptable, capable of being tailored to specific industry requirements and
easily integrated with existing supply chain management systems and retail
platforms. This ensures seamless deployment and adoption across different
organizational contexts without compromising performance or efficiency.
Adaptability is facilitated by flexible architectures, open standards, and
configurable parameters, empowering users to integrate new data sources,
algorithms, and technologies seamlessly, ensuring the system remains relevant
and effective in the face of emerging counterfeit threats and evolving market
conditions.

6. Further Enhancements:
Continuous improvement is a core principle guiding the project's
implementation. Mechanisms for ongoing monitoring, feedback collection, and
model refinement are established to adapt to evolving counterfeit threats and
market dynamics. By embracing a culture of continuous learning and

4
adaptation, the project aims to ensure sustained effectiveness and relevance over
time. The scope of the fake product identification project encompasses the
development and implementation of a comprehensive system to detect
counterfeit goods across various industries. It involves leveraging advanced
technologies like machine learning, computer vision, and blockchain, alongside
collaboration with stakeholders such as manufacturers, regulatory agencies, and
consumers. The project aims for a global reach, with considerations for
scalability, adaptability, and continuous improvement. Adherence to ethical and
legal standards is paramount throughout the project lifecycle. Overall, the
project seeks to combat the proliferation of counterfeit products, safeguard
consumer trust, and uphold the integrity of the global marketplace.

5
CHAPTER 2

LITERATURE SURVEY

The purpose of the Literature Survey is to give a brief overview and also to
develop complete knowledge about the reference papers. The goal of the
Literature Survey is to completely specify the technical details related to the
main project concisely and unambiguously.

1.Paper: “Blockchain-based Secure Traceability Framework for


Counterfeit Product Detection” by Zhang.(2023).
Description: In their groundbreaking research, the authors propose a
robust Blockchain-based Anonymous Anti-Counterfeit (BA2C) supply chain
framework. This innovative system combines Radio Frequency Identification
(RFID) technology with blockchain to tackle the pervasive issue of counterfeit
products. Key features include smart contracts for automated verification,
product registration on the Ethereum blockchain, and the use of zk-SNARKS
for confidentiality. The advantages lie in increased transparency, reduced fraud,
and improved consumer trust. However, challenges such as scalability,
interoperability, and regulatory compliance must be addressed for successful
implementation. The paper underscores the potential of blockchain in securing
supply chains and protecting consumers from fake goods
Advantages:
1. Offers transparent and tamper-proof product verification.
2. Enhances supply chain visibility and enables efficient identification of
counterfeit products.
3. Facilitates trust and authenticity verification throughout the supply chain.
Disadvantages:
1. May encounter scalability issues related to managing large volumes of
transaction data.
2. Concerns regarding privacy and data protection may arise, requiring
careful consideration of regulatory compliance and data governance
frameworks.

2.Paper: “Integrating QR Code with Blockchain for Enhanced Product


Authentication” by Chong, K. C.(2024)
Description: In this research paper, the authors propose a novel approach to
enhance product authentication and traceability using a combination of QR
codes and blockchain technology. The challenge of counterfeit products in the
retail market is addressed by leveraging the strengths of both these technologies.
QR Codes: Each product receives a unique QR code that serves as an instant
gateway to unalterable information stored in the blockchain.Blockchain
6
Integration: The supply chain history of products is stored at each transaction
stage using QR codes. The decentralized nature of the blockchain ensures that
this data remains secure and protected from third-party interference.Customer
Verification: Consumers can scan a product’s QR code to view its complete
history, including details such as origin, manufacturer, and distribution path.
This aids in verifying the product’s authenticity before purchase.Supply Chain
Efficiency: Manufacturers and retailers can track the movement of products,
preventing diversion to unauthorized channels. Eliminating middlemen reduces
distribution costs and improves transparency and accountability in the supply
chain.
Advantages:
1. Offers a user-friendly and accessible solution for product authentication.
2. Enhances product traceability and enables real-time tracking of product
movements across the supply chain.
Disadvantages:
1. Susceptible to cloning and tampering.
2. Reliance on mobile devices and internet connectivity for QR code
scanning may limit accessibility in certain regions or among specific
demographic groups.

3.Paper:"A Comprehensive Review of Blockchain Technology for Supply


Chain Management" by L. Misra(2023)
Description: In this comprehensive review, the authors conduct a holistic
literature analysis on Blockchain Technology (BCT) features, implementations,
and business implications. By reviewing and analyzing 2265 up-to-date articles,
the study reveals BCT’s applications across various fields. Notably, traceability
emerges as a key characteristic fueling BCT’s adoption in supply chain
management (SCM). The research has been particularly active in SCM,
healthcare, and government contexts, while declining in banking and
cybersecurity. Geographically, China, the U.S., and India lead in BCT-related
publications. The study emphasizes the potential for exploring BCT in
environmental sciences and agriculture. Overall, BCT holds promise for
enhancing supply chain transparency, reducing fraud, and improving consumer
trust
Advantages:
1. Offers a comprehensive overview of existing research and
implementations in the field.
2. Provides insights into the application of blockchain technology for
counterfeit product detection and supply chain transparency.
Disadvantages:
1. May lack empirical evidence and case studies to validate the
effectiveness of proposed solutions.
2. Some papers may focus more on theoretical aspects than practical
implementation

7
4.Paper:"Blockchain and Artificial Intelligence for Product Authentication
and Traceability in Supply Chains" by Vina Lomte (2023)
Description: In this study, the authors propose an integrated approach that
combines Blockchain Technology (BCT) and Artificial Intelligence (AI) to
enhance product authentication and traceability within supply chains. BCT
ensures transparency by securely recording the entire supply chain history,
while AI analyzes data patterns and predicts risks. The proposed framework
aims to drive value delivery, improve sustainability, and prevent fraud in
modern supply chains.
Advantages:
1. Explores synergies between blockchain and AI technologies, offering
insights into their combined potential for counterfeit detection and supply
chain traceability.
2. Provides a forward-looking perspective on emerging trends in supply
chain management.
Disadvantages:
1. May lack comprehensive evaluation of proposed solutions and their real-
world applicability.
2. Some technical challenges and implementation barriers may not be fully
addressed.

8
CHAPTER 3

SYSTEM ANALYSIS

3.1 Existing method:

1.Manual Verification Systems:


Manual verification systems rely on physical inspection and human
intervention to authenticate products and verify their authenticity. This process
typically involves visual inspection of product features, such as packaging,
labeling, and physical characteristics, to detect signs of counterfeit
manipulation.
Advantages:
 Familiarity: Companies and inspectors are accustomed to manual
verification methods, making them relatively easy to implement and
understand.
 Low Cost: Manual verification systems often require minimal investment
in technology and infrastructure, as they primarily rely on human labor
and existing resources.

Disadvantages:
 Subjectivity: Manual verification processes are subjective and prone to
human error, leading to inconsistencies in product authentication and
traceability.
 Time-Consuming: Manual inspection can be time-consuming, especially
for large volumes of products, resulting in delays and inefficiencies in
supply chain operations.
 Limited Scalability: Manual verification systems may struggle to scale
effectively with growing product volumes and supply chain complexity,
leading to bottlenecks and operational challenges.
2. Paper-Based Documentation Systems:
Paper-based documentation systems involve the use of physical records
and documents to track product movements, transactions, and authenticity
verification. These systems often rely on handwritten logs, invoices, and
certificates to record supply chain activities and product information.
Advantages:
 Accessibility: Paper-based documentation systems are accessible to users
with basic literacy skills and do not require specialized technology or
training.
 Low Cost: Paper-based systems are cost-effective to implement and
maintain, as they primarily involve the use of paper, pens, and filing
cabinets.
9
Disadvantages:
 Prone to Loss and Damage: Paper records are susceptible to loss, damage,
and deterioration over time, leading to data loss and inconsistencies in
supply chain documentation.
 Lack of Real-Time Information: Paper-based systems lack real-time
visibility into supply chain activities, making it challenging to track
product movements and identify counterfeit risks promptly.
 Limited Security: Paper documents are vulnerable to theft, tampering,
and unauthorized access, compromising the integrity and confidentiality
of supply chain information.

In conclusion, existing systems for counterfeit product identification,


comprising manual verification, paper-based documentation, and
spreadsheet/database systems, demonstrate familiarity and accessibility but
suffer from limitations such as subjectivity, inefficiencies, and security
vulnerabilities. While manual verification is labor-intensive and prone to human
error, paper-based systems lack real-time visibility and are vulnerable to loss or
damage. Spreadsheet and database systems offer improved organization but
may suffer from data silos and cybersecurity risks. Overall, these traditional
systems fall short in providing the robustness and efficiency required to combat
counterfeit infiltration effectively. Integration of advanced technologies like
blockchain and QR code systems presents a promising solution to enhance
traceability, transparency, and authenticity verification in supply chains, thereby
mitigating counterfeit risks and safeguarding supply chain integrity.

10
3.2 Proposed system:
As most people shop from remote places, there is the possibility of
getting Counterfeit or fake products. This fake product affects the customer as
well as company name. They have to face major loss from this situation. There
is no right solution before dealing with this problem. As easily copied barcodes
there is no guarantee system, or a good solution to distinguish counterfeit
products from real products. Blockchain is the most promising technology
emerging in recent years that can help to solve that type of problem. Blockchain
Technology can be used to monitor and keep track of shipped products so that
users only get the right product. The main purpose of the project was to bring
transparency about the product during customer purchasing and help customers
to see if the product they are buying is original or counterfeit easily

In this proposed system, we do Fake product Identification Using


Blockchain Technology. The first step is to bring all the manufacturers to the
blockchain network and collect their major product information. Product
verification is done by registering and providing them with the correct id and
password. The manufacturer will be the main owner of the item. The
manufacturer will ask the manager to add the product to the network while the
QR code will be assigned to that product

The regulator will register the product and the manufacturer on


the network if the applicant is the actual manufacturer. Once the product is
recorded on the network it will create a smart contract with the unique QR code
of the product where the product details are stated in the encrypted text form.
To protect the QR code from copying there is a Copy Sensitive digital image in
the QR code. In the next step the manufacturer will send the product to the
distributor and the status is set as shipping; it will not change the ownership of
the product until a request from both parties for the purchase and sale of the
product is approved. As soon as both parties agree to a joint venture, its
ownership in the blockchain network will be transferred in the form of a smart
contract automatically after payment has been made. At this stage clients will be
provided with the Android app and consumers can scan the QR code assigned to
the object using the Android app. The scanner scans the product and removes
the encrypted text in the algorithm provided and receives information about the
current manufacturer and owner of the product and can decide whether to
purchase the item or not.

MODULES:
Type of Logins: Three Type of login. Manufacturer, User and Admin.
Registration: User have to register to become a part of project.
Login: User have to login themself to access in project.
Add Product : After Manufacturer Login Manufacturer can add product
using java script and smart Contract in Block chain Database.
11
Generate QR Code: All Product data display in admin side and admin verify
that product and generate qr code of that related product using python and add
in block chain database.
Scan QR Code: User Scan that QR code using Android Application And then
Display All information of product in our mobile screen.

ADVANTAGES OF PROPOSED SYSTEM:


The information used for this proposed system is obtained by distributed
computers throughout the world. All distributed computers show their
computational power to make information secure and immutable.
 Using functions and power allocations, the entire blockchain system
uses authentication, delivery, and data management on the local side.
Blockchain technology is not dependent on additional external controls,
has no internal controls, and is independent.
 The move to the blockchain is completely transferable and
straightforward. Anyone can come to them from anywhere in the world.
 We use cryptography algorithms to add a special identifier of the
individual information in the blockchain and we implant such
identifiers in the Blockchains.
 It is not possible to reproduce the substance from any identifier since
we utilize single-direction cryptographic functions(hashes).
 Blockchain facilitates faster transactions by allowing P2P cross-border
transfers with digital currency.

3.1.1 BLOCK DIAGRAM


SOFTWARE SIDE

FIGURE 3.1 BLOCK DIAGRAM

12
In conclusion, the proposed system for counterfeit product identification,
leveraging blockchain technology integrated with QR code systems, presents a
robust and innovative solution to combat counterfeit infiltration in supply
chains. By harnessing the decentralized and immutable nature of blockchain,
coupled with the accessibility and versatility of QR codes, the system offers
transparent, secure, and efficient product authentication and traceability
mechanisms. Through the registration of products on the blockchain and the
generation of unique QR codes, stakeholders gain real-time access to product
information and authenticity status, empowering them to make informed
decisions and mitigate counterfeit risks effectively. The system enhances supply
chain transparency, facilitates efficient detection of counterfeit products, and
strengthens traceability efforts across the entire supply chain. Continuous
monitoring, feedback mechanisms, and collaboration with industry partners
ensure the system's scalability, reliability, and widespread adoption. Overall, the
proposed system represents a significant advancement in supply chain integrity,
consumer protection, and counterfeit mitigation efforts, contributing to a safer
and more trustworthy marketplace for all stakeholders involved.

13
CHAPTER 4

REQUIREMENTS & SPECIFICATIONS


The requirements specification is a technical specification of
requirements for Hardware and software products. It is the first step in the
requirements analysis process. The purpose is of the hardware and software
requirements specification is to provide a detailed overview of the project, its
parameter and goals.
4.1SOFTWAREREQUIREMENTS

SOLIDITY:

Solidity is a high-level programming language specifically


designed for creating smart contracts on the Ethereum blockchain. It enables
developers to define rules, automate transactions, and manage assets in a
decentralized and secure manner. Solidity is widely used for creating custom
tokens (such as ERC-20 tokens) and building decentralized applications
(DApps)

4.1.1 SOLIDITY FEATURES:


Solidity, the programming language for Ethereum smart contracts, offers a
robust set of features tailored for decentralized applications (DApps) and
blockchain development. Its syntax is similar to JavaScript, making it accessible
to developers familiar with web development. Key features include support for
contract-oriented programming, allowing developers to define smart contracts
with functions, data types, and inheritance. Solidity also facilitates secure
coding practices, with built-in protections against common vulnerabilities such
as reentrancy and integer overflow. Additionally, it provides extensive libraries
and frameworks for interacting with the Ethereum Virtual Machine (EVM),
enabling seamless integration of smart contracts with decentralized networks.
Solidity's versatility, security features, and interoperability make it a powerful
tool for building decentralized applications and implementing complex business
logic on the Ethereum blockchain.

4.1.2 SOLIDITY LIBRARIES:


Solidity offers a variety of built-in and external libraries that developers
can leverage to enhance the functionality and efficiency of their smart contracts.
Some notable Solidity libraries include:

1.SafeMath: A library that provides arithmetic operations with overflow and


underflow protection, preventing vulnerabilities such as integer overflow and
underflow.
14
2.Ownable: A simple smart contract library that allows developers to easily
implement access control mechanisms by specifying contract ownership and
restricting certain functions to the contract owner.

3.ERC20: The ERC20 standard interface for fungible tokens on the Ethereum
blockchain. This library provides a common set of functions and events for
managing token balances, transfers, and approvals.

4.ERC721: The ERC721 standard interface for non-fungible tokens (NFTs) on


the Ethereum blockchain. This library enables the creation and management of
unique, indivisible tokens with distinct properties and ownership.

5.OpenZeppelin Contracts: A comprehensive library of reusable, audited smart


contracts for building secure and interoperable decentralized applications. It
includes implementations of various standards such as ERC20, ERC721, and
access control mechanisms.

6.Chainlink: A decentralized oracle network that provides external data to smart


contracts on the blockchain. The Chainlink library enables developers to
securely access off-chain data, such as price feeds and real-world events, within
their smart contracts.

7. Uniswap: A decentralized exchange protocol on Ethereum for swapping


ERC20 tokens without the need for intermediaries. The Uniswap library allows
developers to integrate decentralized token trading functionalities into their
smart contracts.

These are just a few examples of Solidity libraries available to developers. By


utilizing these libraries, developers can accelerate smart contract development,
enhance security, and tap into a wide range of functionalities and standards
already established within the Ethereum ecosystem.

4.1.3 DEPLOYMENT ENVIRONMENT


The deployment environment for a project involving blockchain
with QR code systems encompasses the selection and configuration of
blockchain networks, node infrastructure, and smart contract deployment tools.
It includes setting up nodes on cloud platforms like AWS or Azure, deploying
smart contracts using tools like Truffle or Remix, and integrating QR code
generation functionalities within web or mobile applications. Backend services
handle interactions with the blockchain network, while frontend applications
enable user interaction. Integration, testing, and monitoring ensure system
reliability, scalability, and compliance with regulations, facilitating the seamless
15
operation and maintenance of the deployed system while adhering to best
practices in blockchain deployment and data management.

Graph for ETH consumption in RFID and QR code

4.1.4 REMIX ETHERUM IDE


Remix Project is a platform for development tools that use a plugin
architecture. It encompasses sub-projects including Remix Plugin Engine,
Remix Libraries, and of course Remix IDE.

Remix IDE is an open source web and desktop application. It


fosters a fast development cycle and has a rich set of plugins with intuitive
GUIs. Remix is used for the entire journey of contract development with
Solidity language as well as a playground for learning and teaching Ethereum.

4.1.5 GANACHE
Ganache is a personal blockchain for rapid Ethereum and Corda
distributed application development. You can use Ganache across the entire
development cycle; enabling you to develop, deploy, and test your dApps in a
safe and deterministic environment. Ganache comes in two flavors: a UI and
16
CLI. Ganache UI is a desktop application supporting both Ethereum and Corda
technology. The command-line tool, ganache-cli (formerly known as the
TestRPC), is available for Ethereum development. Ganache is used for setting
up a personal Ethereum Blockchain for testing your Solidity contracts. It
provides more features when compared to Remix. You will learn about the
features when you work out with Ganache. Before you begin using Ganache,
you must first download and install the Blockchain on your local machine

4.1.6 METHODS
Array scalars have exactly the same methods as arrays. The default
behavior of these methods is to internally convert the scalar to an equivalent 0-
dimensional array and to call the corresponding array method. In addition math
operations on array scalars are defined so that the same hardware flags are set
and used to interpret the results as for ufunc, so that the error state used for
ufuncs also carries over to the math on array scalars.

4.2 METAMASK
MetaMask is a browser plugin that serves as an Ethereum
wallet, and is installed like any other browser plugin. Once it's installed, it
allows users to store Ether and other ERC-20 tokens, enabling them to
transact with any Ethereum address.

4.2.1 METAMASK-WALLET
MetaMask’s open platform also plays a key role in promoting
Ethereum-based dApp development for coders and technologists. For
developers building a dApp, Metamask is pre- loaded with fast connections
to Ethereum and several test networks via Infura. These built-in connections
allow developers to begin building a new dApp on Ethereum without the
need to set up and run a full network node. This can be helpful for
bootstrapped entrepreneurs looking to build immediately, whether they are
creating a simple browser-friendly user interface (UI) or a full-fledged,
mainnet-ready dApp that will support an entirely new decentralized
marketplace.

By connecting to MetaMask to Ethereum-based dapps, users can


spend their coins in games, stake tokens in gambling applications, and trade
them on decentralized exchanges (DEXs). It also provides users with an
entry point into the emerging world of decentralized finance, or DeFi,
providing a way to access DeFi apps such as Compound and PoolTogether.

Additionally, since MetaMask extensions are compatible with popular


browsers like Chrome, Firefox, and Safari, the application makes it easier for
17
developers to create new applications that are designed to work within
traditional browsers. Thus, MetaMask’s role in blockchain

4.3 ETHEREUM(ETH)
Ethereum is a permissionless, non-hierarchical network of computers
(nodes) that build and come to a consensus on an ever-growing series of
"blocks", or batches of transactions, known as the blockchain. Each block
contains an identifier of the chain that must precede it if the block is to be
considered valid. Whenever a node adds a block to its chain, it executes the
transactions in the block in the order they are listed, thereby altering the ETH
balances and other storage values of Ethereum accounts. These balances and
values, collectively known as the "state", are maintained on the node
separately from the blockchain, in a Merkle tree.

Each node communicates with a relatively small subset of the


network—its "peers". Whenever a node wishes to include a new transaction
in the blockchain, it sends a copy of the transaction to each of its peers, who
then send a copy to each of their peers, and so on. In this way, it propagates
throughout the network. Certain nodes, called miners, maintain a list of all of
these new transactions and use them to create new blocks, which they then
send to the rest of the network. Whenever a node receives a block, it checks
the validity of the block and of all of the transactions therein and, if it finds
the block to be valid, adds it to its blockchain and executes all of those
transactions. Since block creation and broadcasting are permissionless, a
node may receive multiple blocks competing to be the successor to a
particular block. The node keeps track of all of the valid chains that result
from this and regularly drops the shortest one: According to the Ethereum
protocol, the longest chain at any given time is to be considered the
canonical one.

Ether (ETH) is the cryptocurrency generated by the Ethereum protocol


as a reward to miners in a proof-of-work system for adding blocks to the
blockchain. It is the only currency accepted to pay for transaction fees,
which also go to miners. The block-addition reward together with the
transaction fees provide the incentive to miners to keep the blockchain
growing (i.e. to keep processing new transactions). Therefore, ETH is
fundamental to the operation of the network. Each Ethereum account has an
ETH balance and may send ETH to any other account. The smallest subunit
of ETH is known as a Wei, named after cryptocurrency pioneer Wei Dai,
and is equal to 10−18 ETH.

4.4 SHA-256
Secure Hashing Algorithm (SHA) - 256 is the hash capacity and
mining calculation of the Bitcoin convention, alluding to the cryptographic
18
hash work that yields a 256 pieces in length esteem. It directs the creation
and the executives of addresses, and is likewise utilized for exchange check.
Bitcoin utilizes twofold SHA-256, implying that it applies the hash
capacities two times.
The calculation is a variation of the SHA-2 (Secure Hash Algorithm
2), created by the National Security Agency (NSA). SHA-256 is likewise
utilized in well known encryption conventions.

Proof of Work (PoW) is the original consensus algorithm in a


blockchain network. The algorithm is used to confirm the transaction and
creates a new block to the chain. In this algorithm, minors (a group of
people) compete against each other to complete the transaction on the
network. The process of competing against each other is called mining. As
soon as miners successfully created a valid block, he gets rewarded. The
most famous application of Proof of Work (PoW) is Bitcoin.

Producing proof of work can be a random process with low


probability. In this, a lot of trial and error is required before a valid proof of
work is generated. The main working principle of proof of work is a
mathematical puzzle which can easily prove the solution. Proof of work can
be implemented in a blockchain by the Hashcash proof of work system.

4.5 HARDWARE REQUIREMENTS

4.5.1 QR CODE SCANNER


When considering QR code scanners for a project, various options are
available, each with distinct advantages and use cases. Hardware QR code
scanners offer dedicated functionality and are commonly used in retail,
logistics, and ticketing systems. These devices come in different forms,
including handheld, desktop, and integrated modules for POS systems,
providing efficient and reliable scanning capabilities. On the other hand,
mobile devices equipped with built-in cameras serve as versatile QR code
scanners, leveraging native camera functionality or downloadable apps. They
offer flexibility and convenience, allowing users to scan QR codes on the go.
Additionally, webcams attached to computers or laptops, when paired with
software applications, can function as QR code scanners, suitable for web-
based interactions.
Software-based solutions, utilizing libraries like ZXing or Quaggajs,
offer customization and integration flexibility for implementing QR code
scanning functionality into custom applications, catering to specific project
requirements. When selecting a QR code scanner, factors such as scanning
speed, accuracy, compatibility, and ease of integration should be considered
to ensure optimal performance and user experience.

19
FIGURE 4.1. QR SCANNER

4.5.2 Computer/Server:
Processor: The processor is the brain of the computer/server and plays a
crucial role in the system's performance. Look for a multicore processor with a
high clock speed, such as an Intel Core i7 or higher. The higher the number of
cores, the better the system can handle parallel processing tasks, and a higher
clock speed ensures faster execution of computations.

RAM: Random Access Memory (RAM) is temporary storage that the


computer uses to quickly access and manipulate data. For efficient processing of
the vehicle number plate recognition algorithms, it is recommended to have a
significant amount of RAM, such as 16 GB or more. Ample RAM ensures that
the system can handle the large amount of data involved in real-time image
processing without experiencing bottlenecks.Consider using a combination of
solid-state drives (SSDs) and hard disk drives (HDDs) for storage purposes.
SSDs provide faster data access speeds and improved system responsiveness,
making them ideal for storing datasets, captured images, and intermediate
results. HDDs offer larger storage capacities at a lower cost, making them
suitable for long-term storage of less frequently accessed data. You can
configure the storage setup based on your specific needs and budget.

FIGURE 4.2. LAPTOP FIGURE 4.3. PROCESSOR


20
4.5.2. Graphics Processing Unit (GPU):

NVIDIA GPUs: NVIDIA GPUs are widely used for deep learning tasks
due to their excellent compute performance and support for popular deep
learning frameworks like YOLOv5. GPUs from the NVIDIA GeForce or
NVIDIA Tesla series are recommended choices. Look for a GPU with a suitable
amount of VRAM (video memory), such as 8 GB or more, as it directly impacts
the model's capacity and the size of input images the system can handle
efficiently.Compute Power: GPUs with a high number of CUDA cores and high
compute capability deliver faster and more efficient parallel processing. More
CUDA cores allow for parallel execution of computations, while higher
compute capability indicates the GPU's overall processing power. These factors
contribute to improved performance and faster inference times when running
the YOLOv5 algorithm

FIGURE 4.4. GPU

4.5.3. Storage:
High-capacity Storage: The vehicle number plate recognition system
requires sufficient storage capacity to store various types of data. Consider
using a high-capacity solid-state drive (SSD) or multiple hard disk drives
(HDDs) with a minimum capacity of 1 TB. This ensures ample space to store
the captured images, video data, datasets, intermediate results, and any
additional files generated during the recognition process. Having ample storage
capacity avoids the need for frequent data purging or storage management.

RAID Configuration: Implementing a RAID (Redundant Array of


Independent Disks) configuration offers benefits such as improved data
redundancy and performance. RAID configurations like RAID 0 (striping),
RAID 1 (mirroring), or RAID 5 (striping with parity) can be utilized based on
your specific requirements. RAID provides data redundancy by distributing data
21
across multiple drives, allowing for data recovery in case of drive failure.
Additionally, certain RAID configurations can enhance read/write performance
for faster data access.

FIGURE 4.5.SSD FIGURE 4.6.HDD

By considering these detailed hardware requirements, you can ensure that


your vehicle number plate recognition system has the necessary computational
power, storage capacity, and memory to effectively process and analyze the
captured data. Remember to assess your specific project needs and consult with
hardware experts to determine the most suitable hardware configuration for
your system.

22
CHAPTER 5

SYSTEM DESIGN AND DEVELOPMENT

5.1 MANUFACTURE MODULE


Completion of updating the
Storing
Manufacturer Registration Product details Blockchain
Registration Registration Details

Generation of Scanning And


QR Code Shipping to
Distributer

FIGURE 5.1. MANUFACTURE MODULE

MM is mainly composed of two functions: (i) enrolling the


manufacturer’s information in the blockchain and (ii) checking the authorship
for a requesting manufacturer to enroll the product’s EPC.Alg. 1 shows the
pseudo-code of enroll Manufacturer(), which enrolls the manufacturer’s
information required when its product is stored in the blockchain. Since our
POMS requires that only one administrator, e.g. GS1, can enroll the
manufacturer’s information, this condition is checked at step 1. If it is True,
then the admin enrolls the manufacturer’s information in the blockchain.

MM (Manufacturers Manager) and PM (Products Manager). On the


one hand, MM offers functions for managing the information of
manufacturers, e.g. enrollment of a company prefix registered in GS1 and
manufacturer’s address. On the other hand, PM is operated by each
manufacturer and offers functions to manage the information of products,e.g.
enrollment of a new product and ownership transfer.In contrast to PM, in MM
we assume the existence of an administrator who manages the manufacturers’
information. To avoid impersonation, only the administrators can modify any
break the assumption of fully decentralized system, it is inevitable in order to
avoid impersonators, e.g. counterfeiters, from registering themselves as if they
are legitimate manufacturers. Actually, it might be possible to make our MM
decentralized by leveraging the notion of Namecoin . Namecoin is a
decentralized domain name system and avoids ―massive‖ registration by

23
imposing cost for enrollment. However, if our MM might be constructed by
introducing registering fee like Namecoin, there could be a chance for
counterfeiters to illegally register themselves as genuine companies by paying
the appropriate fees. However, it still might be possible to make MM
decentralized. This is one of the open questions regarding the blockchain-
based POMS.

5.2 DISTRIBUTER MODULE


Completion of Storing the

Registration location hub Processing And


Distributer Scanning Shipment Sending To
Registration Received Shipment

Transaction
Complete
FIGURE 5.2.DISTRUBUTOR MODULE

In contrast to MM, the contract DM is created by each manufacturer and


consists of four main functions:

1. enrollProduct() : Invoked when a manufacturer M first enrolls its


own product specified by unique EPC and claims its initial
ownership;

2. shipProduct() : Invoked when a current owner parts with a


product and specifies the recipient;

3. receiveProduct() : Invoked by the new owner to successfully


transfer its ownership when a product is successfully received;

This describes the receive Product() which is for the receiver to confirm
the arrival of the product. The function checks that the claimed EPC is
specified by the current owner and that the status of EPC is Shipped. If this is
True, the ownership is successfully transferred to the message sender’s
address. In addition, the manufacturer of the product gives incentive,some

24
ETH, to the message sender as a reward for obeying the protocol. Since
Ethereum requires an execution fee for each transaction, when the current
owner sends a product to the recipient, he/she might be reluctant to issue a
transaction ship Product(). To avoid this kind of situation, the following
procedure is introduced. If the ownership transfer has been successfully
completed, a financial reward transfer Reward is paid back to the previous
owner by the product’s manufacturer. The reason why the manufacturer
should pay such reward is that in this way counterfeits can be detected and
thus identified thanks to their cooperation. It is noted that, in order to avoid the
case where two parties repeatedly transfer back and. Selecting appropriate
values for transfer Reward and MAXTRANSFER will depend on the actual
investment made by the manufacturer for the implementation of POMS.
However, such topic is outside the scope of our current research, and thus it
will not be considered further.

5.3 RETAILER MODULE

Completion of Storing the

registration location hub


Retailer Scanning Shipment Verification Of
Registration Product
Recieved

New

Blockchain

Product Ready To
Sell

FIGURE 5.3.RETAILER MODULE

Retailer after the registration is done can see the product details such as
the manufacturer where the manufacturer has stored after the scanning process
take place in this process in back the execution take place where all the
product is scanned and the stored location is sent to the verification of the
product where there are many information are stored in the hub and the
following new blockchain is created and the following product is ready to sell
and given to the following consumers.

25
5.4 CONSUMER MODULE

Completion of Storing the

Consumer Registration Scanning Bought location hub Verifying The


Registration Shipment Recieved Product

FIGURE 5.4 CONSUMER MODULE

Consumers register itself and after the completion of


registration scanning of the particular product take place respectively where all
the storage of the location hub take place and the verification of the product
happens as the product gets verified the product is identified in this process
respectively.

5.5 SYSTEM ARCHITECTURE

FIGURE 5.5.SYSTEM ARCHITECTURE

The system architecture for integrating blockchain with QR code


systems involves several layers and components working together seamlessly.
At its core lies the blockchain network, composed of decentralized nodes

26
maintaining transaction records. Smart contracts, deployed on the blockchain,
enforce business logic governing product registration, authentication, and
supply chain transparency. Backend services manage interactions between
frontend applications and the blockchain network, overseeing processes like
product registration, transaction processing, and QR code validation.
Additionally, a database management system stores non-blockchain data such
as user accounts and transaction logs, ensuring data integrity and accessibility.

In parallel, modules for QR code generation and scanning play pivotal


roles. The QR code generation module dynamically creates unique codes for
products during registration, while the QR code scanning module enables
users to authenticate products by scanning these codes using their device
cameras.

These modules interact with the backend system to validate QR codes


against blockchain records, providing real-time authentication feedback.
Integration layers facilitate seamless communication between components,
and robust security measures safeguard sensitive data and maintain system
integrity. By meticulously designing and implementing this architecture,
developers can create a cohesive solution that enhances product authentication
and transparency within supply chains.

5.6 USE CASE DIAGRAM

FIGURE 5.6 USE CASE DIAGRAM

27
The use case diagram for the integration of blockchain with QR code
systems illustrates the various interactions and functionalities available to
different actors within the system. Actors include manufacturers, distributors,
retailers, and consumers, each with specific roles and access privileges.

For manufacturers, primary use cases include product registration,


where they input product information into the system and generate QR codes
for product labeling. Distributors and retailers interact with the system to
access product information, verify authenticity, and update product status as
they move through the supply chain. Consumers, on the other hand, utilize the
system to scan QR codes and verify product authenticity, ensuring confidence
in their purchases.

The use case diagram depicts these interactions through various use
cases such as "Register Product," "Generate QR Code," "Verify Authenticity,"
and "Update Product Status." These use cases illustrate the core functionalities
available to each actor, facilitating transparent and secure product
authentication throughout the supply chain.

5.7 DATA FLOW DIAGRAM

FIGURE 5.7.DATA FLOW DIAGRAM

28
The Data Flow Diagram (DFD) for the integration of blockchain with
QR code systems illustrates the flow of data within the system and the
processes involved in managing product information and authentication. The
diagram typically consists of four main components: external entities,
processes, data stores, and data flows.External entities represent actors
interacting with the system, such as manufacturers, distributors, retailers, and
consumers. Processes depict the actions or operations performed on the data,
including product registration, QR code generation, authentication
verification, and product status updates. Data stores represent repositories
where data is stored and retrieved, such as databases storing product
information, transaction logs, and blockchain records. Data flows depict the
movement of data between processes, external entities, and data stores,
representing the flow of information within the system.

In the DFD, data flows from external entities to processes, where it is


processed and stored in data stores. For example, manufacturers input product
information into the system during the product registration process, which
then flows to the QR code generation process to create unique QR codes for
product labeling. Consumers interact with the system by scanning QR codes,
initiating the authentication verification process, where data flows to the
blockchain network to verify product authenticity. The DFD provides a visual
representation of the system's data flow and processes, facilitating
understanding and analysis of system functionalities and interactions.

FIGURE 5.9.SEQUENCE DIAGRAM

29
CHAPTER 6

RESULT

The integration of blockchain with QR code systems offers


transformative benefits across the supply chain landscape. By leveraging
blockchain's immutable ledger and QR codes' accessibility, manufacturers can
securely register products and create unique digital identities stored on the
blockchain. This process enables transparent tracking of products from
production to consumption, empowering distributors and retailers to verify
authenticity and ensure product integrity. For consumers, scanning QR codes
provides instant access to product information and authentication status,
fostering trust and confidence in their purchases. Moreover, this integration
strengthens supply chain transparency, facilitates efficient counterfeit
detection, and enables proactive measures to combat illicit activities. Overall,
it establishes a robust ecosystem that enhances product traceability, consumer
protection, and market integrity.This proposed gives a better edge with least
gas cost for each transaction, the QR code is generated and through the each
scan certain amount of gas is deducted. It is user friendly where the products
QR code can be directly scanned through inbuilt Scanner. The ETH that is
used for each transaction is very minimal in this web application. The location
updating while scanning enables easy tracking of product for other peers in the
blockchain.

Used mode for tracking Gas cost efficient

SHA with QR code 0.01595334 ETH Comparatively less compared


to RFID

SHA with RFID 0.14327623 ETH This takes more transaction


time.

Table 5 comparison between QR code and RFID

30
CHAPTER 7

CONCLUSION

This system is the first blockchain system to propose a fully functional


anti- counterfeiting system. By paying a very low transaction fee, users of our
system no longer have to worry about the possibility of purchasing a counterfeit
product. Manufacturers can use the system to store relevant information about
product sales in blockchain for everyone to see. The total amount of sales that
can be sold by the seller and the number of products that the seller currently has
left are transparent. The user can use the functions provided by our system to
carry out manufacturer verification immediately. The system provides identity
verification using digital signatures. There are no other means of decrypting the
key owner's private key unless the key owner accidentally loses their key.In our
system analysis result, the cost of the initial product record contract is only
$1.2893394289 US, and the cost of each product sales process
is$0.17415436749 US. Both costs are much lower than working with reliable
large chain stores and well-established direct selling stores. Our system can
effectively lower the anti-counterfeiting threshold of branded goods and provide
companies with limited financial resources with an easier approach to reassure
consumers that they will not buy counterfeit goods.

Blockchain technology is still in its general early stages in terms of usage,


therefore more research is required. Future work on this framework may be
proof of the simplicity of the code. The customer can believe that the proper
applications and due to the simplicity of the code, without excessive code, will
have additional use. With the experience gained in this project, it is clear that
when assigning a chain of blocks that is counterfeit-resistant and traceable, then
platform improvement is warranted by a move toward genuine product
warranties. This would improve the customer experience by making the entire
supply chain framework more open and transparent. In addition, it is hoped that
a buyers' intellectual framework can be built on cross-line product tracing,
providing more accurate and far-reaching product and seller tracing information
to administrative authorities around the world. Obtaining data of such quality
will be conceivable with estimates of coordinated efforts, for example,
administrative support, framework creation, and data sharing.

31
APPENDIX-SOURCE CODE

MIGRATION.SOL

contract Migrations {
address public owner = msg.sender;
uint public last_completed_migration;

modifier restricted() {
require(
msg.sender == owner,
"This function is restricted to the contract's owner"
);
_;
}

function setCompleted(uint completed) public restricted {


last_completed_migration = completed;
}
}

PRODUCT.SOL

pragma solidity ^0.8.12;

contract product {

uint256 sellerCount;
uint256 productCount;

struct seller{
uint256 sellerId;
bytes32 sellerName;
bytes32 sellerBrand;
bytes32 sellerCode;
uint256 sellerNum;
bytes32 sellerManager;
bytes32 sellerAddress;
}
mapping(uint=>seller) public sellers;

struct productItem{

32
uint256 productId;
bytes32 productSN;
bytes32 productName;
bytes32 productBrand;
uint256 productPrice;
bytes32 productStatus;
}

mapping(uint256=>productItem) public productItems;


mapping(bytes32=>uint256) public productMap;
mapping(bytes32=>bytes32) public productsManufactured;
mapping(bytes32=>bytes32) public productsForSale;
mapping(bytes32=>bytes32) public productsSold;
mapping(bytes32=>bytes32[]) public productsWithSeller;
mapping(bytes32=>bytes32[]) public productsWithConsumer;
mapping(bytes32=>bytes32[]) public sellersWithManufacturer;

//SELLER SECTION

function addSeller(bytes32 _manufacturerId, bytes32 _sellerName, bytes32


_sellerBrand, bytes32 _sellerCode,
uint256 _sellerNum, bytes32 _sellerManager, bytes32 _sellerAddress) public{
sellers[sellerCount] = seller(sellerCount, _sellerName, _sellerBrand,
_sellerCode,
_sellerNum, _sellerManager, _sellerAddress);
sellerCount++;

sellersWithManufacturer[_manufacturerId].push(_sellerCode);
}

function viewSellers () public view returns(uint256[] memory, bytes32[] memory,


bytes32[] memory, bytes32[] memory, uint256[] memory, bytes32[] memory,
bytes32[] memory) {
uint256[] memory ids = new uint256[](sellerCount);
bytes32[] memory snames = new bytes32[](sellerCount);
bytes32[] memory sbrands = new bytes32[](sellerCount);
bytes32[] memory scodes = new bytes32[](sellerCount);
uint256[] memory snums = new uint256[](sellerCount);
bytes32[] memory smanagers = new bytes32[](sellerCount);
bytes32[] memory saddress = new bytes32[](sellerCount);

33
for(uint i=0; i<sellerCount; i++){
ids[i] = sellers[i].sellerId;
snames[i] = sellers[i].sellerName;
sbrands[i] = sellers[i].sellerBrand;
scodes[i] = sellers[i].sellerCode;
snums[i] = sellers[i].sellerNum;
smanagers[i] = sellers[i].sellerManager;
saddress[i] = sellers[i].sellerAddress;
}
return(ids, snames, sbrands, scodes, snums, smanagers, saddress);
}

//PRODUCT SECTION

function addProduct(bytes32 _manufactuerID, bytes32 _productName, bytes32


_productSN, bytes32 _productBrand,
uint256 _productPrice) public{
productItems[productCount] = productItem(productCount, _productSN,
_productName, _productBrand,
_productPrice, "Available");
productMap[_productSN] = productCount;
productCount++;
productsManufactured[_productSN] = _manufactuerID;
}

function viewProductItems () public view returns(uint256[] memory, bytes32[]


memory, bytes32[] memory, bytes32[] memory, uint256[] memory, bytes32[]
memory) {
uint256[] memory pids = new uint256[](productCount);
bytes32[] memory pSNs = new bytes32[](productCount);
bytes32[] memory pnames = new bytes32[](productCount);
bytes32[] memory pbrands = new bytes32[](productCount);
uint256[] memory pprices = new uint256[](productCount);
bytes32[] memory pstatus = new bytes32[](productCount);

for(uint i=0; i<productCount; i++){


pids[i] = productItems[i].productId;
pSNs[i] = productItems[i].productSN;
pnames[i] = productItems[i].productName;
pbrands[i] = productItems[i].productBrand;
pprices[i] = productItems[i].productPrice;
pstatus[i] = productItems[i].productStatus;

34
}
return(pids, pSNs, pnames, pbrands, pprices, pstatus);
}

//SELL Product

function manufacturerSellProduct(bytes32 _productSN, bytes32 _sellerCode)


public{
productsWithSeller[_sellerCode].push(_productSN);
productsForSale[_productSN] = _sellerCode;

function sellerSellProduct(bytes32 _productSN, bytes32 _consumerCode) public{


bytes32 pStatus;
uint256 i;
uint256 j=0;

if(productCount>0) {
for(i=0;i<productCount;i++) {
if(productItems[i].productSN == _productSN) {
j=i;
}
}
}

pStatus = productItems[j].productStatus;
if(pStatus == "Available") {
productItems[j].productStatus = "NA";
productsWithConsumer[_consumerCode].push(_productSN);
productsSold[_productSN] = _consumerCode;
}

}
function queryProductsList(bytes32 _sellerCode) public view returns(uint256[]
memory, bytes32[] memory, bytes32[] memory, bytes32[] memory, uint256[] memory,
bytes32[] memory){
bytes32[] memory productSNs = productsWithSeller[_sellerCode];
uint256 k=0;

uint256[] memory pids = new uint256[](productCount);


bytes32[] memory pSNs = new bytes32[](productCount);

35
bytes32[] memory pnames = new bytes32[](productCount);
bytes32[] memory pbrands = new bytes32[](productCount);
uint256[] memory pprices = new uint256[](productCount);
bytes32[] memory pstatus = new bytes32[](productCount);

for(uint i=0; i<productCount; i++){


for(uint j=0; j<productSNs.length; j++){
if(productItems[i].productSN==productSNs[j]){
pids[k] = productItems[i].productId;
pSNs[k] = productItems[i].productSN;
pnames[k] = productItems[i].productName;
pbrands[k] = productItems[i].productBrand;
pprices[k] = productItems[i].productPrice;
pstatus[k] = productItems[i].productStatus;
k++;
}
}
}
return(pids, pSNs, pnames, pbrands, pprices, pstatus);
}

function querySellersList (bytes32 _manufacturerCode) public view


returns(uint256[] memory, bytes32[] memory, bytes32[] memory, bytes32[] memory,
uint256[] memory, bytes32[] memory, bytes32[] memory) {
bytes32[] memory sellerCodes = sellersWithManufacturer[_manufacturerCode];
uint256 k=0;
uint256[] memory ids = new uint256[](sellerCount);
bytes32[] memory snames = new bytes32[](sellerCount);
bytes32[] memory sbrands = new bytes32[](sellerCount);
bytes32[] memory scodes = new bytes32[](sellerCount);
uint256[] memory snums = new uint256[](sellerCount);
bytes32[] memory smanagers = new bytes32[](sellerCount);
bytes32[] memory saddress = new bytes32[](sellerCount);

for(uint i=0; i<sellerCount; i++){


for(uint j=0; j<sellerCodes.length; j++){
if(sellers[i].sellerCode==sellerCodes[j]){
ids[k] = sellers[i].sellerId;
snames[k] = sellers[i].sellerName;
sbrands[k] = sellers[i].sellerBrand;
scodes[k] = sellers[i].sellerCode;
snums[k] = sellers[i].sellerNum;

36
smanagers[k] = sellers[i].sellerManager;
saddress[k] = sellers[i].sellerAddress;
k++;
break;
}
}
}

return(ids, snames, sbrands, scodes, snums, smanagers, saddress);


}

function getPurchaseHistory(bytes32 _consumerCode) public view returns


(bytes32[] memory, bytes32[] memory, bytes32[] memory){
bytes32[] memory productSNs = productsWithConsumer[_consumerCode];
bytes32[] memory sellerCodes = new bytes32[](productSNs.length);
bytes32[] memory manufacturerCodes = new bytes32[](productSNs.length);
for(uint i=0; i<productSNs.length; i++){
sellerCodes[i] = productsForSale[productSNs[i]];
manufacturerCodes[i] = productsManufactured[productSNs[i]];
}
return (productSNs, sellerCodes, manufacturerCodes);
}

//Verify

function verifyProduct(bytes32 _productSN, bytes32 _consumerCode) public view


returns(bool){
if(productsSold[_productSN] == _consumerCode){
return true;
}
else{
return false;
}
}
}

INITIAL_MIGRATION.JS

const Migrations = artifacts.require("Migrations");

module.exports = function (deployer) {


deployer.deploy(Migrations);
};

37
DEPLOY_CONTRACT.JS
const Migrations = artifacts.require("Migrations");

module.exports = function (deployer) {


deployer.deploy(Migrations);
};

ADDPRODUCT.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/qr_code_box.css">

</head>
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

</form>
</div>

38
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-


target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>
<li class="nav-item "><a href="manufacturer.html"
class="nav-link">Manufacturer</a></li>
<li class="nav-item"><a href="seller.html" class="nav-
link">Seller</a></li>
<li class="nav-item"><a href="consumer.html" class="nav-
link">Consumer</a></li>
</ul>
</div>
</div>
</nav>
<!-- END nav -->

</section>
<section>
<div class="container">
<h2>Add Product</h2>

<div class="matrix">
<table width="100%">

39
<tr width="100%">
<td width="15%" align="center">
<label for="manufacturerID">Manufacturer
ID</label>
</td>
<td width = "30%">
<input class="form-control"
id="manufacturerID" name="Manufacturer ID" type="text" />
</td>
<td width="15" align="center">
<label for="name">Product Name</label>
</td>
<td width = "30%" >
<input class="form-control" id="productName"
name="productName" type="text" />
</td>
</tr>

<tr width="100%">
<td width="15%" align="center">
<label for="productSN">Product SN:</label>
</td>
<td width = "30%">
<input class="form-control" id="productSN"
name="productSN" type="text" />
</td>
<td width="15" align="center">
<label for="name">Product Brand</label>
</td>
<td width = "30%" >
<input class="form-control" id="productBrand"
name="productBrand" type="text" />
</td>
</tr>

<tr width="100%">
<td width="15%" align="center">
<label for="productPrice">Product Price</label>
</td>
<td width = "30%">
<input class="form-control" id="productPrice"
name="productPrice" type="text" />

40
</td>
</tr>

</tr>
</table>
</div>
<div class="clear" >&nbsp;</div>
<div align="center">
<button type="submit" class="btn btn-warning btn-register"
id="register" onclick="fetchQR()">Add the Product</button>
</div>
<br></br>
</div>
</section>

<!-- <br></br> -->


<div class="qr-code">
<div align="center">
<img align="center" hidden id="imgQR" src="" alt="qr-code" >
</div>
<br></br>
<div align="center">
<button align="center" hidden type="submit" class="btn btn-
warning" id="download" onclick="saveImage()">Download QR Code</button>
</div>
</div>

<br></br>

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/productApp.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/2.0.0/FileSaver.min.js"></scri
pt>
<script>

41
var src;
var qrValue;
function fetchQR(){
qrValue = document.getElementById('productSN').value;
qrImage = document.querySelector(".qr-code");
qrImageResult = qrImage.querySelector("img");
src = qrImageResult.src = `https://api.qrserver.com/v1/create-qr-
code/?size=200x200&data=${qrValue}`;

downloadQrImg = document.getElementById('imgQR');
downloadQrBtn = document.getElementById('download');
downloadQrImg.removeAttribute('hidden');
downloadQrBtn.removeAttribute('hidden');

function saveImage(){
saveAs(src,qrValue);
downloadQrImg.setAttribute('hidden', 'hidden');
downloadQrBtn.setAttribute('hidden', 'hidden');
}
</script>

</body>
</html>

ADDSELLER.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">

</head>

42
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-


target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>
<li class="nav-item "><a href="manufacturer.html"
class="nav-link">Manufacturer</a></li>
<li class="nav-item"><a href="seller.html" class="nav-

43
link">Seller</a></li>
<li class="nav-item"><a href="consumer.html" class="nav-
link">Consumer</a></li>
</ul>
</div>
</div>
</nav>
<!-- END nav -->

</section>
<section>
<div class="container">
<h2>Add Seller</h2>

<div>
<table width="100%">

CONSUMER.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">

</head>
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">

44
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-


target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>
<li class="nav-item"><a href="consumerPurchaseHistory.html"
class="nav-link">Consumer Purchase History</a></li>
<li class="nav-item"><a href="verifyProducts.html" class="nav-
link">Product Verification</a></li>
</ul>
</div>
</div>
</nav>

<section>

45
<div class="container">
<h2>
Consumer
</h2>
<h3>
Go to navigation bar to perform operations.
</h3>
</section>
<!-- END nav -->

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/sellerDataApp.js"></script>
</body>
</html>

CONSUMERPURCHASEHISTORY.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">

</head>
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">

46
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-


target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>
<li class="nav-item "><a href="manufacturer.html"
class="nav-link">Manufacturer</a></li>
<li class="nav-item"><a href="seller.html" class="nav-
link">Seller</a></li>
<li class="nav-item"><a href="consumer.html" class="nav-
link">Consumer</a></li>
</ul>

47
</div>
</div>
</nav>
<!-- END nav -->

<section>
<div class="container">
<h2>Consumer Product History</h2>

<div class="form-group">
<label for="consumerCode">Consumer Code</label>
<input type="text" class="form-control" id="consumerCode"
placeholder="Enter Consumer Code" name="consumerCode">
</div>

<button type="submit" class="btn btn-warning btn-register"


id="register">Get Products</button>
</div>
</section>

</section>
<section>
<div class="container">
<h2>Products purchased by consumer</h2>
<table class="table">
<thead>
<tr>
<th>Product SN</th>
<th>Seller Code</th>
<th>Manufacturer Code</th>
</tr>
</thead>
<tbody id="logdata">

</tbody>
</table>
<center><p>Your address is <b id="add"></b></p></center>
</div>
</section>

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

48
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/consumerPurchaseHistory.js"></script>
</body>
</html>

INDEX.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification </title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">

</head>
</ul>
</div>
</div>
</nav>
<!-- END nav -->

</section>

<div class="container-fluid px-md-5">


<div class="row justify-content-between">
<div class="col-md-12 order-md-last">
<div class="row">
<div class="col-md-12 text-center">
<!-- <a class="navbar-brand"
href="index.html">WELCOME </a> -->
</div>

49
<center><img
src="https://cdn.pixabay.com/photo/2017/10/15/09/47/block-chain-
2853054_1280.jpg" height="300" width="1350"></center>
<div class="col-md-6 d-md-flex justify-content-end mb-
md-0 mb-3">

<form action="#" class="searchform order-lg-


last">

</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</section>

<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>

</body>
</html>

MANUFACTURER.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">

50
</head>
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-


target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>
<li class="nav-item"><a href="addProduct.html" class="nav-link">Add

51
Product</a></li>
<li class="nav-item "><a href="addSeller.html" class="nav-
link">Add Seller</a></li>

<li class="nav-item"><a href="sellProductManufacturer.html" class="nav-


link">Sell Product To Seller</a></li>
<li class="nav-item"><a href="querySeller.html" class="nav-
link">Query Seller</a></li>

</ul>
</div>
</div>
</nav>
<!-- END nav -->

</section>

<section>
<div class="container">
<h2>
Manufacturer
</h2>
<h3>
Go to navigation bar to perform operations.
</h3>
</section>

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
</body>
</html>

QUERYSELLER.HTML

<!doctype html>
<html lang="en">
<head>

52
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">

</head>
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-

53
target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>
<li class="nav-item "><a href="manufacturer.html"
class="nav-link">Manufacturer</a></li>
<li class="nav-item"><a href="seller.html" class="nav-
link">Seller</a></li>
<li class="nav-item"><a href="consumer.html" class="nav-
link">Consumer</a></li>
</ul>
</div>
</div>
</nav>
<!-- END nav -->

<section>
<div class="container">
<h2>Query Sellers</h2>

<div class="form-group">
<label for="email">Manufacturer Code</label>
<input type="email" class="form-control" id="manufacturerCode"
placeholder="Enter manufacturer Code" name="manufacturerCode">
</div>

<button type="submit" class="btn btn-warning btn-register"


id="register">Get Sellers</button>
</div>
</section>

</section>
<section>
<div class="container">
<h2>Sellers</h2>
<p>Following are the sellers registered through Blockchain Network</p>
<table class="table">
<thead>

54
<tr>
<th>ID</th>
<th>Name</th>
<th>Brand</th>
<th>Code</th>
<th>Number</th>
<th>Manager</th>
<th>Address</th>
</tr>
</thead>
<tbody id="logdata">

</tbody>
</table>
<center><p>Your address is <b id="add"></b></p></center>
</div>
</section>

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/sellerDataApp.js"></script>
</body>
</html>

SELLER.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">

55
<link rel="stylesheet" href="css/style.css">

</head>
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-


target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>

56
<li class="nav-item"><a href="sellProductSeller.html" class="nav-
link">Sell Product To Consumer</a></li>
<li class="nav-item"><a href="queryProducts.html" class="nav-
link">Products For sale</a></li>
</ul>
</div>
</div>
</nav>
<!-- END nav -->

<section>
<div class="container">
<h2>
Seller
</h2>
<h3>
Go to navigation bar to perform operations.
</h3>
</section>

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/sellerDataApp.js"></script>
</body>
</html>

SELLPRODUCTMANUFACTURER.HTML
</td>
<td width = "30%">
<input class="form-control" id="sellerCode"
name="sellerCode" type="text" />
</td>

</tr>

</tr>

57
</table>
</div>
<div class="clear">&nbsp;</div>

<button type="submit" class="btn btn-warning btn-register"


id="register">Sell to Seller</button>
</div>
</section>

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/sellProductManufacturer.js"></script>
<script src="https://unpkg.com/html5-qrcode"></script>
<script>
var decodedText = "Enter Product SN";
function docReady(fn) {
// see if DOM is already available
if (document.readyState === "complete"
|| document.readyState === "interactive") {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}

docReady(function () {
var resultContainer = document.getElementById('qr-reader-results');
var lastResult, countResults = 0;
function onScanSuccess(decodedText, decodedResult) {
if (decodedText !== lastResult) {
++countResults;
lastResult = decodedText;
// Handle on success condition with the decoded message.
var audio = new Audio('beep.wav');

58
audio.play();
// console.log(`Scan result ${decodedText}`, decodedResult);
document.getElementById('qr-reader-results').innerHTML=decodedText;
document.getElementById("productSN").value =
decodedText;
//App.init(decodedText);

}
}

var html5QrcodeScanner = new Html5QrcodeScanner(


"qr-reader", { fps: 10, qrbox: 250 });
html5QrcodeScanner.render(onScanSuccess);
});
</script>
</body>
</html>

SELLPRODUCTSELLER.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">

</head>
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through

59
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-


target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>
<li class="nav-item "><a href="manufacturer.html"
class="nav-link">Manufacturer</a></li>
<li class="nav-item"><a href="seller.html" class="nav-
link">Seller</a></li>
<li class="nav-item"><a href="consumer.html" class="nav-
link">Consumer</a></li>
</ul>
</div>
</div>
</nav>
<!-- END nav -->

60
</section>

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/popper.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/sellProductSeller.js"></script>
<script src="https://unpkg.com/html5-qrcode"></script>
<script>
var decodedText = "Enter Product SN";
function docReady(fn) {
// see if DOM is already available
if (document.readyState === "complete"
|| document.readyState === "interactive") {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}

docReady(function () {
var resultContainer = document.getElementById('qr-reader-results');
var lastResult, countResults = 0;
function onScanSuccess(decodedText, decodedResult) {
if (decodedText !== lastResult) {
++countResults;
lastResult = decodedText;
// Handle on success condition with the decoded message.
var audio = new Audio('beep.wav');
audio.play();
// console.log(`Scan result ${decodedText}`, decodedResult);
document.getElementById('qr-reader-results').innerHTML=decodedText;
document.getElementById("productSN").value =
decodedText;
//App.init(decodedText);

}
}

61
var html5QrcodeScanner = new Html5QrcodeScanner(
"qr-reader", { fps: 10, qrbox: 250 });
html5QrcodeScanner.render(onScanSuccess);
});
</script>
</body>
</html>

VERIFYPRODUCTS.HTML

<!doctype html>
<html lang="en">
<head>
<title>Fake Product Identification</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-
fit=no">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,100,300,700'
rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-
awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/style.css">

</head>
<body>
<section class="ftco-section">
<div class="container-fluid px-md-5">
<div class="row justify-content-between">
<div class="col-md-8 order-md-last">
<div class="row">
<div class="col-md-6 text-center">
<a class="navbar-brand"
href="index.html">Fake Product Identification <span>through
Blockchain</span></a>
</div>
<div class="col-md-6 d-md-flex justify-content-
end mb-md-0 mb-3">
<form action="#" class="searchform order-
lg-last">

62
</form>
</div>
</div>
</div>
<div class="col-md-4 d-flex">
<div class="social-media">

</div>
</div>
</div>
</div>
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark
ftco-navbar-light" id="ftco-navbar">
<div class="container-fluid">

<button class="navbar-toggler" type="button" data-toggle="collapse" data-


target="#ftco-nav" aria-controls="ftco-nav" aria-expanded="false" aria-
label="Toggle navigation">
<span class="fa fa-bars"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav m-auto">
<li class="nav-item"><a href="index.html" class="nav-
link">Home</a></li>
<li class="nav-item "><a href="manufacturer.html"
class="nav-link">Manufacturer</a></li>
<li class="nav-item"><a href="seller.html" class="nav-
link">Seller</a></li>
<li class="nav-item"><a href="consumer.html" class="nav-
link">Consumer</a></li>
</ul>
</div>
</div>
</nav>
<!-- END nav -->

<section>
<div class="container">
<h2>Verify Products</h2>

<section>
<div class="container-fluid">
<center>

63
<div id="qr-reader" style="width:300px"></div>
<div id="qr-reader-results"></div>
</center>
</div>
</section>

<div class="form-group">
<label for="productSN">Product SN:</label>
<input disabled type="text" class="form-control" id="productSN"
placeholder="Enter Product SN" name="productSN">

<label for="consumerCode">Consumer Code</label>


<input type="text" class="form-control" id="consumerCode"
placeholder="Enter Consumer Code" name="consumerCode">
</div>

<button type="submit" class="btn btn-warning btn-register"


id="register">Get Product Status</button>
</div>
</section>

<br/>
<section>
<div class="container">
<h2>Is the product sold to cunsumer is fake or not?</h2>
<table class="table">
<thead>
<tr>
<th>Product Verification Result</th>
</tr>
</thead>
<tbody id="logdata">

</tbody>
</table>
<center><p>Your address is <b id="add"></b></p></center>
</div>
</section>

<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="js/popper.js"></script>

64
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
<script src="js/web3.min.js"></script>
<script src="js/truffle-contract.js"></script>
<script src="js/verifyProduct.js"></script>
<script src="https://unpkg.com/html5-qrcode"></script>
<script>
var decodedText = "Enter Product SN";
function docReady(fn) {
// see if DOM is already available
if (document.readyState === "complete"
|| document.readyState === "interactive") {
// call on next available tick
setTimeout(fn, 1);
} else {
document.addEventListener("DOMContentLoaded", fn);
}
}

docReady(function () {
var resultContainer = document.getElementById('qr-reader-results');
var lastResult, countResults = 0;
function onScanSuccess(decodedText, decodedResult) {
if (decodedText !== lastResult) {
++countResults;
lastResult = decodedText;
// Handle on success condition with the decoded message.
var audio = new Audio('beep.wav');
audio.play();
// console.log(`Scan result ${decodedText}`, decodedResult);
document.getElementById('qr-reader-results').innerHTML=decodedText;
document.getElementById("productSN").value =
decodedText;
//App.init(decodedText);

}
}

var html5QrcodeScanner = new Html5QrcodeScanner(


"qr-reader", { fps: 10, qrbox: 250 });
html5QrcodeScanner.render(onScanSuccess);
});
</script></body></html

65
Gas Estimation for Transaction

GANACHE BLOCKCHAIN

66
BLOCK GENERATED

TRANSACTION RECORDED

67
HOME PAGE

MANUFACTURER DETAILS

68
SELLER DETAILS

QR CODE GENERATION

69
PRODUCT TRACK DISPLAY

FINAL OUTPUT

70
REFERENCES

[1] G. Khalil, R. Doss, M. Chowdhury, IEEE Access 8, 47952 (2020) [12] M.A.
Habib, M.B. Sardar, S. Jabbar, C.N. Faisal, N. Mahmood, M. Ahmad,
Blockchain-based supply chain for the automation of transaction

[2]. Rishabh Sushil Bhatnagar, Sneha Manoj Jha , Shrey Surendra Singh,
Rajkumar Shende ―Product Traceability using Blockchain‖, 2020 2nd
International Conference on Advances in Computing, Communication
Control and Networking (ICACCCN).

[3]. Si Chen , Rui Shi , Zhuangyu Ren , Jiaqi Yan , Yani shi , Jinyu Zhang,― A
Blockchain-based Supply Chain Quality Management Framework‖, 2017
IEEE 14th International Conference on e-Business Engineering (ICEBE)

[4]. M.C.Jayaprasanna, .V.A.Soundharya , M.Suhana, S.Sujatha,‖ A Block


Chain based Management System for Detecting Counterfeit Product in
Supply Chain‖ ,IEEE 2021 Third International Conference on Intelligent
Communication Technologies and Virtual Mobile Networks (ICICV)
[5]. Jinhua Ma , Shih-Ya Lin , Xin Chen , Hung-Min Sun,A Blockchain-Based
Application System for Product Anti-Counterfeiting‖ International Journal
Of Scientific & Technology Research Volume 8, Issue 12, December 2019
issn 2277-8616.

[6]. B. M. A. L. Basnayake, C. Rajapakse,‖ A Blockchain-based decentralized


system to ensure the transparency of organic food supply chain‖ ,IEEE 2019
International Research Conference on Smart Computing and Systems
Engineering (SCSE)

[7]. Atima Tharatipyakul and Suporn Pongnumkul, ―User Interface of


Blockchain-Based Agri-Food Traceability Applications‖, IEEE vol 9,
2019,pp.82909-82929.

[8]. Shuai Wang , Liwei Ouyang , Yong Yuan, Xiaochun Ni , Xuan Han and Fei-
Yue Wang,―Blockchain-Enabled Smart Contracts: Architecture,
Applications, and Future Trends‖, IEEE Transactions on Systems, Man, and
Cybernetics: Systems ,2019, pp.2266 – 2277

[9]. Shuai Wang , Liwei Ouyang , Yong Yuan, Xiaochun Ni , Xuan Han and Fei-
Yue Wang,―Blockchain-Enabled Smart Contracts: Architecture,
Applications, and Future Trends‖, IEEE Transactions on Systems, Man, and
Cybernetics: Systems ,2019, pp.2266 – 2277

71
[10].Laura Ricci, Damiano Di Francesco Maesa, Alfredo Favenza and Enrico
Ferro, ―Blockchains for COVID-19 Contact Tracing and Vaccine Support: A
Systematic Review‖, IEEE 2021,pp.37936 - 37950.

[11] Zignuts Technolab, How blockchain architecture works? basic understanding


of blockchain and its architecture.

72

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy