0% found this document useful (0 votes)
31 views44 pages

DETECTION OF FAKE SANGU Final

MCA project final year paython

Uploaded by

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

DETECTION OF FAKE SANGU Final

MCA project final year paython

Uploaded by

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

ABSTRACT

End consumers face threats to their finances, health, and safety when counterfeit or duplicate items
are manufactured and marketed. Through revenue loss, product defamation, downtime,
replacement costs, causing brands to spend money battling counterfeits, compromising partner
confidence, stealing sales, etc., it also has an adverse effect on the economic growth of original
manufacturers and enterprises. A block chain based system is used to identify original items and
detect duplicate products to assure the identification of genuine goods, hence mitigating the critical
impacts of counterfeiting. In this study, bar codes and QR (Quick Response) codes offer a strong
method to reduce the practice of product counterfeiting, given the rapidly developing trends in
wireless technology. Using a camera scanner, which links the product's barcode or QR code to a
block chain to record product details and ensure that each product has a unique code as a block in
the database, bogus items are identified. If the code matches, a notification confirming the
product's authenticity will be sent to the customer; if not, the customer will be informed that the
product is counterfeit or fake, and if the customer accepts the application's request, a notification
informing the manufacturer of the product's purchase location will also be sent. This strategy
makes sure that customers won't have to rely solely on retailers to tell if goods are fake or
authentic.
1. INTRODUCTION

Risk considerations associated with product creation on a worldwide scale include counterfeiting
and duplication, which can negatively impact a company's brand, revenue, and customer happiness.
The sale and exchange of fake goods is expanding dramatically. It has an adverse effect on the
firms' sales, reputation, and earnings. It also presents a serious risk to unwary consumers. A fully
functional block chain system is suggested as a means of ensuring the detection and tracking of
fraudulent items or products across the supply chain and of countering this phenomena. Businesses
merely have to pay extremely little transaction fees and are relieved of the concern that their
customers could get fake goods. Manufacturers confront the greatest issues and significant costs in
terms of revenue loss and brand harm as a result of counterfeit or imitation goods. Block chain
technology may be used to determine the product's uniqueness. Block chains are collections of data
that make it hard or impossible to alter or compromise the system. Block chain technology is a
digital ledger that is distributed, decentralised, and connected by chains. It saves transaction data as
blocks in databases. Every time a new transaction takes place on the block chain, a record of that
transaction is added to each participant's record. Each block in the chain has numerous
transactions.

1.1 PROJECT DESCRIPTION

Distributed Ledger Technology is the name for the decentralised database that is controlled by the
number of participants (DLT). A hash—an unchangeable cryptographic signature—is used to
record transactions in blockchain technology, a sort of distributed ledger technology. Block chain
technology offers a solution to the issue of product counterfeiting. In contrast to previous
technologies, blockchain technology offers more security. A chain of transactions for that product
will be produced after it is stored on the network, allowing for the maintenance of all transaction
records pertaining to the product and its present owner. A hash code will be generated for the
product at that time. Every transaction record will be kept in the blockchain as blocks. In the
suggested system, each product made by the producer is given a unique QR code or barcode that
contains all of the product's details. The end user may then scan the code to obtain all of the
product's information. The user may determine if a product is authentic or phoney by scanning the
barcode or QR code.
1.1.1 PROBLEM STATEMENT

The global proliferation of forged product poses significant risks to companies and consumers
alike, threatening brand reputation, revenue, and customer safety. Duplication and counterfeiting in
the supply chain undermine the legitimacy of products, leading to substantial financial losses and
endangering unsuspecting buyers. To combat this growing issue, a robust and secure solution is
imperative. This paper proposes the implementation creation of a working blockchain system to
guarantee the tracking and identity of products throughout the supply chain. Blockchain
technology, with its decentralized and immutable ledger, provides a secure platform for recording
and verifying transactions. By conveying a distinct barcode or Q R code to each product,
manufacturers can store detailed information on the block chain, allowing customers to confirm the
legitimacy of products by scanning these codes. This approach not only deters counterfeit activities
but also enhances transparency and trust in the market. With blockchain, companies can
significantly reduce the risk of delivering counterfeit products, safeguard their brand integrity, and
improve customer satisfaction, all while incurring minimal transaction fees. This innovative
solution leverages the strengths of blockchain technology to address the critical issue of product
counterfeiting, ensuring a dependable and safe supply chain.

a. Revenue loss for original producers and companies

b. Product defamation and damage to brand reputation

c. Downtime and increased replacement expenses

d. Expenses incurred by brands to fight counterfeiting

e. Loss of trust among business partners

1.1.2 OBJECTIVE OF THE STUDY

 Counterfeiting of products leads to significant financial, health, and safety risks for
end-users. It also impacts the expansion of original manufacturers' and companies'
economies as a result of lost sales, tarnished products, malfunctions, replacement
costs, and a decline in consumer confidence partners.
 To overcome these issues, a blockchain-based system is planned that utilizes QR
codes or barcodes to identify innovative products and detect duplicates.
 The system works by linking the serial number or QR code of a product to a
blockchain, which stores the product details and a unique code for each product as
database chunks.
 When a customer scans the QR code or barcode using a camera scanner, the system
checks Should this code be present matches the one stored in the block chain. If it
matches, the customer is notified that the creation is authentic. If it doesn't match,
the customer is notified that the item is fraudulent or counterfeit, and the
manufacturer is also informed about the location of purchase.

1.1.3 SCOPE OF THE PROJECT:

a. Integrate the system with QR codes or barcodes for product identification

b. Establish a blockchain network to store product details and unique codes

c. Implement mechanisms to link product codes to the blockchain

1.1.4 METHODOLOGY USED

1. System Initialization:
o Blockchain Setup: Establish a decentralized blockchain network involving all
stakeholders, including manufacturers, distributors, and retailers.
o Node Configuration: Set up blockchain nodes for each stakeholder to ensure
distributed ledger technology (DLT) operates effectively.
o Smart Contracts: Develop smart contracts to automate the verification and
recording processes on the blockchain.

2. Product Registration:
o QR Code/Barcode Generation: Assign a unique Barcodes or code with a QR code
to each product at the manufacturing stage. This code includes essential product
details such as serial number, manufacturing date, and batch number.
o Blockchain Entry: Record the blockchain's product information by creating a new
block containing the QR code/barcode and other relevant information. Each block
will have an immutable cryptographic signature (hash) to ensure data integrity.

3. Product Distribution and Tracking:


o Logistics Integration: Integrate the blockchain system with logistics and
management of the supply chain systems to track the movement of products from
the manufacturer to the end consumer.
o Real-Time Updates: Update the blockchain with transaction records each time the
product changes hands within the supply chain. This ensures a comprehensive and
transparent trail of the product's journey.

4. Counterfeit Detection:
o Mobile Application: Develop a mobile application with a camera scanner for
consumers and retailers to scan Barcodes or code with a QR code on products.
o Verification Process: When a QR code or barcode is scanned, the application
queries the blockchain to retrieve the product details.
 Authenticity Check: Compare the scanned code against the blockchain
record.
 Notification System:
 If the code QR codes combined with barcodes matches, Inform the
customer that the goods is real.
 If the code does not match, notify the consumer and the producer
regarding the fake detection. Optionally, capture and report the
position of the scan if the consumer consents.

5. Data Security and Privacy:


o Encryption: Ensure that all data transmitted between the mobile application and the
blockchain is encrypted to maintain user privacy and data security.
o User Consent: Implement mechanisms to obtain user consent for location tracking
and reporting counterfeit detections.

6. Feedback Loop:
o Consumer and Manufacturer Feedback: Allow consumers to provide feedback
on the product's authenticity verification process.
o Continuous Improvement: Use feedback to enhance the system's accuracy and
user experience. Manufacturers can analyze counterfeit detection reports to identify
and address vulnerabilities in the supply chain.

7. System Maintenance and Updates:


o Regular Audits: Conduct periodic audits of the blockchain system to ensure data
integrity and security.
o Software Updates: Implement regular updates to the mobile application and
blockchain nodes to incorporate new security features and improvements.

2. LITERATURE SURVEY
Author: Michal Munk, Aliaksandr Barushka, Petr Hajek

Methodology:

Fake consumer Logo detection has attracted much interest because more and more transactions are
being made online in recent years. Current methods for identifying phoney consumer logos make
use of elements such as product and logoer information, as well as logo content. Nonetheless, new
research indicates that the semantic significance of Logos may be especially crucial for text
categorisation. The emotions that are concealed inside the Logos might also be a sign of bogus
material. Here, we present two neural network models that use the conventional bag-of-words
approach together with word context and customer emotions to enhance the effectiveness of false
Logo identification. To be more precise, the models use three sets of characteristics to learn
document-level representationn-grams, word embeddings, and different lexicon-based emotion
markers are the three main categories. Four domains are employed for the classification of phoney
Logos using such a high-dimensional feature representation. We compare the classification
performance of the provided detection systems with numerous cutting-edge techniques for
detecting fraudulent logos in order to illustrate their efficacy. No matter the product category or
sentiment polarity of the datasets, the suggested solutions exhibit good performance across the
board.

Advantage:

 Time consumption is low.

Disadvantage:

 Preventive actions can be taken against Logos in the aforementioned platforms.


2.3.2Fake online Logos: Literature Logo, summary, as well as recommendations for more
study, 2020
Author: YuanyuanWuabEric,W.T.Ngaib, PengkunWuabc,ChongWua
Methodology:
In e-commerce, fake online logos have a big impact on online shoppers, sellers, and ultimately
market efficiency. There is yet no comprehensive survey that can systematically analyse and
summarise bogus Logos' causes and effects, despite scholarly efforts to investigate it. An
antecedent-consequence-intervention conceptual framework is presented in this study to help
create a preliminary research agenda for the study of phoney Logos. We propose 18 proposals and
indicate 20 potential research issues based on a Logo of the existing literature on this topic.
Notably, a dearth of high-quality datasets frequently limits research on phoney Logos. In order to
mitigate this issue, we thoroughly aggregate and synthesise the current public datasets pertaining to
bogus Logos. We wrap off by outlining the current research's theoretical and applied
consequences.

Advantage:

 The antecedent–consequence–intervention A conceptual framework for (ACI) is put


forward.
 A Logo of forged operational Logos is presented.
 Twenty enquiries for further investigation are noted.

Disadvantage:

 The process is implemented without removing unwanted data.

2.3.3 One Methodology for Spam Logo Recognition Based on Logo Coherence Metrics, 2005

Author: Xinkai Yang

Methodology:

In this paper, we propose a methodology for iterative computing that uses coherent inspection to
identify spam Logos. In order to examine Logo coherence at the sentence level, we first establish a
few consistent metrics in Logos. Next, a detailed discussion of the framework and its evaluation
procedure follows. Only a few attempts have been made up to this point in the difficult and
unexplored field of logo spam detection. In this study, we provide a generic methodology based on
coherent inspection for the detection of spam Logos. After talking about a few spam Logos
presumptions, we construct some consistent metrics for Logos.
Additionally, the framework for iterative computing is given. The goal of our suggested approach
is to examine Logo coherence at the sentence level. Based on the smoothness of the flow between
phrases, we develop two metrics—word concurrence likelihood and word transition probability—
to examine the coherence of sentiment words and other related terms. We want to detect spam
Logos at the semantic level, therefore our suggested model can provide more significant hints
about spam Logos by analysing their word pattern. This technique offers a fresh perspective on
spam Logo identification, and other such methods may be investigated in the future.

Advantage:
 The By employing third-party ratings goods, logo ratings are grouped into unjustly high
and poor ratings.
 The greatest word concurrence can be used to define the sentence concurrence measure for
two consecutive sentences. measure.

2.3.4 Latest Approach in Belief Mining and Feeling Examination, 2013


Author: Erik Cambria, Björn Schuller, Yunqing Xia, Catherine Havasi,
Methodology:
When it comes time to pick between several possibilities or make a decision, the advice of others
may be quite important. People frequently depend on the prior experiences of their peers when
making decisions that require important resources (such as investing time and cash to purchase
goods or services). Up until recently, friends and specialised magazines or websites were the
primary information sources. These days, the "social web" offers new resources for effectively
creating and exchanging ideas with everyone with an internet connection. People can exchange
helpful knowledge through blogs, social networks, content-sharing platforms, forums, and other
channels. However, because it is created for man usage, this data is not organised and cannot be
"machine processed." The technological group is becoming more interested in gathering the
public's view of political movements, social events, business strategies, advertising campaigns, and
product preferences, due to the fascinating open challenges involved. Additionally, the work world
is becoming more interested in gathering the public's understanding of the known adverse impacts
on marketing and potential financial market prediction. Opinion mining and sentiment analysis are
the resultant areas that are already emerging.

Advantage:

• The outcomes of a search engine that is topic-based. Nonetheless, a number of studies indicate
that handling these two responsibilities simultaneously may improve output.

Disadvantage:

 Training time is high.


 Prediction is not accurate.

2.3.5 Sentiment investigation using product Logo data, 2015

Author: Xing Fang and Justin Zhan

Methodology:

Sentiment analysis or opinion mining is one of the main jobs of Natural Language Processing, or
NLP. In recent years, sentiment analysis has drawn a lot of interest. One of the main issues with
sentiment analysis is sentiment polarity categorisation, which is what we want to address in this
work. Detailed process descriptions are provided along with a recommended generic procedure for
sentiment polarity categorisation. Online product logos that were gathered from Amazon.com were
the study's data source. We conduct experiments with encouraging results for both Logo-level and
sentence-level categorisation. Finally, we also provide an outlook on our sentiment analysis
research going forward. A feeling-driven attitude, idea, or judgement is called sentiment. Opinion
mining, another name for sentiment analysis, is the study of people's attitudes towards particular
entities. In terms of sentiment data, the internet is a useful resource. From a user's point of view,
social media platforms like forums, microblogs, and online social networking sites allow users to
publish their own material.

Advantage:

• It is evident from the ROC curves that all three models fared rather well when evaluating data
with high posterior probability.
Disadvantage:
Low accuracy
2.1 EXISTING SYSTEM

In existing system, It becomes a habit to read product evaluations before making a purchase
[3], particularly for prospective buyers. Positive customer feedback may bring a firm
substantial financial rewards, which can then be used to inform decisions about the services it
offers to clients and how best to build new products. In relation to the monetary gains derived
from the favourable customer evaluations of the product or service, the scammers attempted to
take advantage of the current system by creating fictitious reviews and offering an unfair
evaluation in order to support or disparage a good or service. There is currently a dearth of
study on the crucial problem of automatically identifying spammers. In contrast to other forms
of spam, such email or online spam, is significantly more difficult to find on a review. The
primary cause is the ease with which spammers may adopt a false identity. Therefore, it is
challenging for consumers to identify

DISADVANTAGES

 Doesn’t Efficient for handling large volume of data.


 Theoretical Limits
 Incorrect Classification Results.
 Less Prediction Accuracy.

2.1.2 PROPOSED SYSTEM

1. To create a blockchain-based phoney product detection system to safeguard brand value against
duplicate risks. 2. To safeguard and verify the product information that aids in the unique product's
identification and traceability along the supply chain. 3. All product information is safe and kept in
a product ID or QR code that facilitates identification and is kept in tamper-proof blockchain
blocks for further security. 4. The system provides a QR code that the manufacturer may add to
provide product data. Retailers, distributors, and even customers can use the code to confirm they
are acquiring authentic items.

ADVANTAGES

• High performance.

• Provide accurate prediction results.


• It avoid sparsity problems.

2.2 FEASIBILITY ANALYSIS

To conclude whether it is worthwhile to adopt the suggested system, a feasibility study is


conducted. The system that is being suggested will be selected if it is best enough in meeting the
performance requirements.

The feasibility carried out mainly in three sections namely.

• Economic Feasibility

• Technical Feasibility

• Behavioural Feasibility

2.2.1 Economic Viability

The approach most commonly used to assess the efficacy of a put forward system is economic
analysis. As well called as cost-benefit analysis. The predicted savings and advantages of the
suggested system are ascertained through this process. For system development, the hardware in
the structure department is enough.

2.2.3 Technical Feasibility

This study centre around the system’s department hardware, software and how much it can bolster
the suggested system department is having the required hardware and software there is no
question of increasing the cost of implementing the proposed system. The criteria, It is
theoretically possible to implement the suggested system. and the proposed system can be
developed with the existing facility.

2.2.4 Behavioural Practicability

Individuals are naturally reluctant to change, and need sufficient amount of training, which would
result in lot of expenditure for the organization. The proposed system can generate reports with
day-to-day information immediately at the user’s request, instead of getting a report, which
doesn’t contain much detail.
2.3 TOOLS and TECHNOLOGIES USED
One of the few languages that can boast of being both strong and simple is Python. The ease with
which you may focus on the problem's solution instead of the syntax and structure of the
programming language will pleasantly surprise you. According to its official introduction, Python
is a robust and easy-to-learn programming language. Its object-oriented programming methodology
is straightforward but efficient, and its high-level data structures are efficient. Python's interpreted
nature, dynamic typing, and beautiful syntax make it a perfect language for scripting and quick
application development across a wide range of platforms. The majority of these features will be
covered in more detail in the section that follows.

Features of Python
 Simple

 Easy to Learn.

 Permitted and Open Source

 High-level Language

 Portable

 Interpreted

 Object Oriented

 Extensible

 Embeddable

 Extensive Libraries

1. Python:
o Programming Language: Python is the core language used for developing the
blockchain system, mobile application backend, and integrating various components.
o Libraries: Utilize Python libraries such as requests for HTTP requests, json for
handling JSON data, and os for operating system-related tasks.

2. Jupyter Notebook:
3. Interactive Development: Jupyter Notebooks provide an interactive environment for
developing, testing, and debugging code. They are particularly useful for data analysis

4. Pandas:
o Data Manipulation: Pandas is a powerful data manipulation and analysis library. It
can be used for handling and processing data related to product information,
transaction records, and more.

5. NumPy:

Numerical Computing: NumPy offers support for huge, multi-dimensional matrices and
arrays as well as a number of mathematical operations that may be performed on these arrays.
For managing data in the blockchain system, it is helpful.

6. Scikit-learn:
o Machine Learning: If the system incorporates any machine learning models for
pattern detection or anomaly detection, Scikit-learn provides a range of tools and
algorithms for this purpose.

7. Flask:
o Web Framework: Flask is a lightweight WSGI web application framework. It can be
applied to create the backend of the mobile application that interacts with the
blockchain system.

8. SQL Alchemy:
o Database Toolkit: SQL Alchemy provides a full suite of tools for working with
relational databases in Python. It can be used to manage the database that stores
product information and transaction records.

9. PyQRCode:
o QR Code Generation: PyQRCode is a Python library that generates QR codes. It can
be used to create unique QR codes for each product.

10. OpenCV:
o Computer Vision: A robust computer vision library called OpenCV is useful for
scanning and decoding QR codes and barcodes using the camera scanner.

11. Matplotlib and Seaborn:


o Data Visualization: These libraries are useful for visualizing data and analysis results,
such as the distribution of counterfeit products or the geographic locations of detected
fake products.

12. Hyperledger Fabric:


o Blockchain Framework: Hyperledger Fabric is an open-source blockchain framework
that can be integrated with Python to build the blockchain network. It supports smart
contracts and decentralized applications.

13. Requests:
o HTTP Library: The requests library allows you to send HTTP requests, making it
easier to interact with web services and APIs.

Implementation Workflow:

1. Blockchain Setup:
o Use Hyperledger Fabric or a similar framework to set up the blockchain network.
o Develop smart contracts using Python to automate the verification and recording
processes.

2. Product Registration:
o Use PyQRCode to generate unique QR codes for each product.
o Record the QR code and product details on the blockchain using the blockchain
framework's API.

3. Mobile Application Backend:


o Develop the backend using Flask, handling requests to scan QR codes and verify
authenticity.
o Integrate OpenCV to decode QR codes and retrieve product information.

4. Data Handling and Analysis:


o Use Pandas and NumPy to process and analyze product and transaction data.
o Visualize results using Matplotlib and Seaborn to identify trends and insights.

5. Machine Learning Integration (Optional):


o If needed, develop and train machine learning models using Scikit-learn to detect
patterns or anomalies in the data.
3. SOFTWARE REQUIREMENTS
Software Requirements :

 Operating Systems: Windows, macOS, Linux for desktop; iOS, Android for mobile.
 Programming Languages: Python, JavaScript (Node.js), Solidity (for smart contracts).
 Frameworks: Flask or Django for web application; React Native for mobile application.
 Blockchain Platform: Ethereum or Hyperledger Fabric.
 Databases: NoSQL databases like MongoDB for additional data storage.
 Development Tools: Anaconda for Python environment management, VS Code or
PyCharm for IDE.

Hardware Requirements

 CPU: 8-core processor


 RAM: 16 GB
 Storage: 1 TB SSD
 Network: High-speed internet connection Top of Form Bottom of Form
4.SYSTEM DESIGN

4.1 SYSTEM ARCHITECTURE

Enc set

Pre-
Dataset processed Blockchain
data

Dec
set
Prediction Classification

Figure 1: System Architecture of fake product detection

4.2 FLOW DIAGRAM

Start

Select Dataset

Clean Dataset

Count Vectorizer

Feature Selection

Classification

Prediction
Figure 2: flow diagram of fake product detection

5. DETAILED DESIGN

5.1 USE CASE DIAGRAM

Start

Select Dataset

Cleaning

USER Count

Feature

Classification

Prediction

Figure 3: Use case diagram for fake product detection 5.2 SEQUENCE DIAGRAM
Start Select Clean Prediction

Select dataset
Count Vectorizer

Load dataset
Model Selection
Result
Generation
Classification

Figure 4: sequence diagram for fake product detection

5.3 COLLABORATION DIAGRAM

FIGURE 5 : collaboration diagram


5.4 ACTIVITY DIAGRAM

FIGURE 6: Activity diagram

ER DIAGRAM

LOAD
DATASET CLEANING
DATASET

START

DATA COUNT FEATURE


SELECTION VECTORIZE SELECTION
& LOAD R

RESULT CLASSIFICATIO
GENERATION N
FIGURE 7: ER diagram for block chain technology

6 . IMPLEMENTATION

6.1 CODING
SAMPLE CODE

from flask import Flask, render_template, request, redirect, url_for, session, flash

from index import Blockchain

import Json

import smtplib as smtp

from flask import Flask, render_template, request, redirect, jsonify

import Json

app = Flask(__name__)

app.secret_key = "alkdjfalkdjf"

import smtplib
def send_email():

# Email configuration

smtp_server = 'smtp.gmail.com'

smtp_port = 465 # For SSL

sender_email = '[email protected]'

receiver_email = '[email protected]'

password = 'ncfplwzacztjnxyp' # Your email password

# Create a secure SSL connection to the SMTP server

connection = smtplib.SMTP_SSL(smtp_server, smtp_port)

try:

# Login to the email server

connection.login(sender_email, password)

# Construct the email message

subject = 'Fake Product Alert'

body = 'Dear recipient,\n\nThis is to inform you about a fake product.\n\nBest regards,\


nSender'

message = f'Subject: {subject}\n\n{body}'

# Send the email

connection.sendmail(sender_email, receiver_email, message)

print("Email sent successfully!")

except Exception as e:

print(f"Error sending email: {e}")


finally:

# Close the connection

connection.close()

# Test the send_email function

send_email()

@app.route("/")

def home():

if session.get("user"):

return render_template('home.html')

else:

flash("Please login to access Verifier")

return redirect(url_for('login'))

@app.route("/regsister", methods=["POST", "GET"])

def register():

username = request.form['username']

password = request.form['password']

email = request.form['email']

# Load existing user data from the JSON file if it exists

try:

with open('users.json', 'r') as file:

users = json.load(file)

except FileNotFoundError:
users = {}

# Check if the username or email already exists

for user_data in users.values():

if user_data['username'] == username:

return jsonify({"error": "Username already exists. Please choose a different username."})

if user_data['email'] == email:

return jsonify({"error": "Email address already exists. Please use a different email
address."})

# Add the new user to the dictionary

users[username] = {'password': password, 'email': email}

# Save the updated user data to the JSON file

with open('users.json', 'w') as file:

json.dump(users, file)

return redirect(url_for("admin"))

@app.route("/login", methods=["POST", "GET"])

def login():

if request.method == "POST":

user = request.form["username"]

pswd = request.form["password"]

if user == "Admin":

if pswd == "password":
session["user"] = "Admin"

return redirect(url_for("admin"))

elif user == "Nike":

if pswd == "password":

session["user"] = "Nike"

return redirect(url_for("shoes"))

elif user == "Musigny":

if pswd == "password":

session["user"] = "Musigny"

return redirect(url_for("dress"))

elif user == "Lupin":

if pswd == "password":

session["user"] = "Lupin"

return redirect(url_for("medicine"))

elif user == "Kisan":

if pswd == "password":

session["user"] = "Kisan"

return redirect(url_for("fertilizer"))

else:

flash("Invalid Login details")

return redirect(url_for('login'))
else:

return render_template('login.html')

@app.route("/verify/<kid>", methods=["GET"])

def verify(kid):

return render_template('verify.html', keyId=kid)

@app.route("/verify", methods=["POST"])

def success():

post_data = request.form["keyId"]

with open('./NODES/N1/blockchain.json', 'r') as bfile:

n1_data = str(bfile.read())

with open('./NODES/N2/blockchain.json', 'r') as bfile:

n2_data = str(bfile.read())

with open('./NODES/N3/blockchain.json', 'r') as bfile:

n3_data = str(bfile.read())

with open('./NODES/N4/blockchain.json', 'r') as bfile:

n4_data = str(bfile.read())

pd = str(post_data)

if (pd in n1_data) and (pd in n2_data) and (pd in n3_data) and (pd in n4_data):
with open('./NODES/N1/blockchain.json', 'r') as bfile:

for x in bfile:

if pd in x:

a = json.loads(x)["data"]

b = a.replace("'", "\"")

data = json.loads(b)

product_brand = data["Manufacturer"]

product_name = data["ProductName"]

product_batch = data["ProductBatch"]

manuf_date = data["ProductManufacturedDate"]

expiry_date = data["ProductExpiryDate"]

product_id = data["ProductId"]

product_price = data["ProductPrice"]

product_size = data["ProductSize"]

product_type = data["ProductType"]

return render_template('success.html', brand=product_brand, name=product_name,


batch=product_batch, manfdate=manuf_date, exprydate=expiry_date, id=product_id,
price=product_price, size=product_size, type=product_type)

else:

# Call send_email function from mail.py

send_email()

return render_template('fraud.html', message="Fake Product")


@app.route("/addproduct", methods=["POST", "GET"])

def addproduct():

if request.method == "POST":

brand = request.form["brand"]

name = request.form["name"]

batch = request.form["batch"]

pid = request.form["id"]

manfdate = request.form["manfdate"]

exprydate= request.form["exprydate"]

price = request.form["price"]

size = request.form["size"]

ptype = request.form["type"]

print(brand, name, batch, manfdate, exprydate, pid, price, size, ptype)

bc = BlockChain()

bc.addProduct(brand, name, batch, manfdate, exprydate, pid, price, size, ptype)

flash("Product added successfully to the Blockchain")

# return render_template('home.html')

return redirect(url_for('home'))

else:

# return render_template('home.html')

return redirect(url_for('home'))

@app.route("/admin")
def admin():

if session["user"] == "Admin":

return render_template('admin.html')

else:

return redirect(url_for('login'))

@app.route("/verifyNodes")

def verifyNodes():

bc = BlockChain()

isBV = bc.isBlockchainValid()

if isBV:

flash("All Nodes of Blockchain are valid")

return redirect(url_for('admin'))

else:

flash("Blockchain Nodes are not valid")

return redirect(url_for('admin'))

@app.route("/medicine")

def medicine():

return render_template('MedicinePage.html')

@app.route("/fertilizer")

def fertilizer():

return render_template('FertilizersPage.html')
@app.route("/shoes")

def shoes():

return render_template('ShoesPage.html')

@app.route("/dress")

def dress():

return render_template('dressPage.html')

@app.route("/logout")

def logout():

session["user"] = ""

return redirect(url_for('login'))

if __name__ == "__main__":

app.run(debug=True)

session["user"] = ""

6.2 SCREENSHOTS

SAMPLE SCREENSHOT

ADMIN HOME PAGE


Figure 1 Home page admin on Fake product Blockchain

Figure 2 Shoes Register Form on Fake product Blockchain


Figure 3 Verified on Fake product Blockchain

Figure 4 QR Code Generated on Fake product Blockchain


Figure 5 Scanning based QR Code Generated on Fake product Blockchain

Figure 6 Verified based hash data on Fake product Blockchain


Figure 7 Verified based product on Fake product Blockchain

Figure 8 Verified based Fake product Blockchain on QR code


Figure 9 Verified based Fake product
7 SOFTWARE TESTING
7.1 TESTING STRATEGIES

Testing of Product

Before the start of live operations, system evaluation is the phase of application that aims to
ensure that the structure operates correctly and effectively. The process of running a software with
the goal of identifying errors is called testing. A test case that has a high likelihood of identifying
an error is excellent. If a test addresses an error that hasn't been found yet, it's successful.

The system's success depends on testing. System testing logically assumes that the
objective will be accomplished if every component of the system is functioning properly. The
method for candidates is susceptible to variety of tests-on-line response, Volume Street, recovery
and security and usability test. A sequence of trials are done before the structure is ready for the
consumer undertaking testing. Any engineered product can be tested in one of the following
ways. Knowing the specified function that a product has been planned so that tests may be
performed to show that every function is working properly. When a product's internal operation is
understood, testing may be done to make sure that "all gears mesh," or that all internal
components have had enough exercise, and the product operates internally in accordance with
specifications.

7.2 UNIT TESTING

Unit testing is the evaluation of all module and the combination of whole system is finished.
Validation attempts on the tiniest software design unit within the module are transformed into unit
testing. Another name for this is "module testing." Each of the system's modules is tested
independently. This testing is done while the application is being programmed. Each model is
confirmed to be functioning successfully in this trial phase with respect to the anticipated result
from the module. There are some verifying examinations for the fields. For example, the
validation check is carried out to validate information provided by consumer where both format
and validity of the information put in is included. It is rather simple to locate errors in and debug
the system.

7.3 INTEGRATION TESTING

Data can be lost across an interface, one module can have an adverse effect on the other sub
function, when combined, may not produce the desired major function. Integrated testing is
systematic testing that can be done with sample data. The need for the integrated test is to find the
overall system performance. There are two types of integration testing. They are:

i) Top-down integration testing.


ii) Bottom-up integration testing.

3. WHITE BOX TESTING

White Box testing is a test case design technique that drives cases using the procedural design's
control structure. We developed test cases that ensure that each of a module's independent
pathways has been tested at least once by using white box testing techniques.

BLACK BOX CHALLENGING

 Black box testing is carried out to identify malfunctioning or absent functions.

 Interface error
 Access errors to remote databases

 Performance errors
 Errors in initialisation and termination

In ‘functional testing’, is performed to validate an application conforms to its specifications of


correctly performs all its required functions. So, Another name for this testing is "black box
testing." It evaluates the system's outside conduct. Here, the engineered product may be tested
with understanding of the intended use for what it was made, and tests taken to confirm that every
function is completely functional.

7.4VALIDATION ASSESING

Following the completion of black box testing, software is assembled as a package, interface
errors are spotted and handled, and the final lapse of application validation tests commences.
There are distinct methods to term verification testing, but success is defined as the software
operating as the customer would reasonably expect it to.
7.5 USER ACCEPTANCE TESTING

The primary element in determining the system's win is consumer acceptability. By continuously
interacting with probable users of the structure when its being made and make necessary
adjustments, the system under consideration is tested for user approval.

7.6 OUTPUT TESTING

Following validation testing, the proposed system's output should be tested by questioning
the user about the format requirements. This is because a system cannot be considered helpful if it
is unable to provide the necessary output in the appropriate format. The output that the system in
question generates or displays. There are two considerations concerning the output format here.
One is in print format, while the rest is on a screen. Since the format was created during the
system phase depend on consumer demands, it is determined that the output format presented on
the display is accurate. The output for the hard copy likewise meets the user-specified parameters.
Hence, the output testing yields no system connections.
8. CONCLUSION

The research paper offers a fully functional anti-counterfeiting application, making it the only
blockchain system based on smart contract technology. Businesses are going to quickly start to use
it due to its beneficial features. In supply chain management, blockchain has proven to be an
excellent tool for recognizing and getting rid of counterfeit products. By paying an extremely small
transaction fee, the proposed system will enable users to quickly identify and obtain information
about the product they wish to check or verify. As a result, users of this application won't have to
worry about the possibility of purchasing an unreliable counterfeit product. Manufacturers can
utilize the app to store pertinent data about product details in blockchain, making it accessible to
anyone via the app. Thanks to the serialised QR code, the manufacturing head may see the entire
quantity of sales made by the distributor, retailers, and manufacturers and also the quantity of items
that are now in the warehouse. Customers may instantly do manufacturer-side verification by using
all of the capabilities that the program offers. The digitalised QR scanner is utilized by the system
to verify an individual's identification. Users will be able to put belief on the maker and vendor and
make better decisions as a result of this. They will have a simpler and free of chance encounter
because they won't need to depend on others to confirm the legitimacy of the goods. The key
owner's private key cannot be decrypted using any other method other than the Owner of the key
unintentionally releases it.
9 FUTURE ENHANCEMENTS

Future enhancements to the smart contract-based blockchain system for anti-counterfeiting can
significantly elevate its functionality and influence on the management of the supply chain. As it
currently exists designed to combat counterfeit products and ensure authenticity, several advanced
features and improvements can be considered to expand its utility and effectiveness:

1. Advanced Cryptographic Techniques: To further secure the system, integrating advanced


cryptographic techniques such as zero-knowledge proofs and homomorphic encryption
could enhance privacy and security. Zero-knowledge proofs would allow users to verify
information without revealing the underlying data, while homomorphic encryption could
enable computations on encrypted data, thus ensuring that sensitive information remains
confidential even during processing.
2. Interoperability with Other Blockchain Networks: As the blockchain ecosystem
evolves, ensuring interoperability with other blockchain networks can facilitate seamless
integration and data sharing across different platforms. This could involve developing
cross-chain communication protocols or using blockchain bridges to enable interaction with
various blockchain systems, enhancing the system's scalability and adaptability in diverse
environments.
3. Artificial Intellect and Machine Knowledge Integration: Incorporating AI and ML
algorithms could improve product verification processes and fraud detection. AI could
analyze transaction patterns and user behavior to identify potential fraudulent activities,
while machine learning models could enhance the accuracy of counterfeit detection by
recognizing complex patterns and anomalies in product data.
4. Enhanced User Experience with Augmented Reality (AR): Implementing AR
technology could revolutionize product verification by allowing users to scan products and
view detailed, interactive information in real-time. AR could provide visual confirmation of
product authenticity, highlight important details, and guide users through the verification
process, making it more intuitive and engaging.
5. Scalability and Performance Optimization: As the adoption of the system grows,
addressing scalability and performance issues will be crucial. Enhancements such as
optimizing smart contract execution, improving transaction throughput, and reducing
latency will ensure that the system remains efficient and responsive even with a high
volume of transactions and users.
6. Integration with IoT Devices: Leveraging Internet of Things (IoT) technology can provide
real-time tracking and monitoring of products throughout the supply chain. IoT sensors and
devices could collect data on product conditions, location, and handling, which can be
recorded on the blockchain. This integration would offer a comprehensive view of the
product journey, further enhancing transparency and authenticity verification.
7. Regulatory Compliance and Adaptability: As regulations and standards related to
blockchain and product authenticity evolve, the system should be designed to adapt to new
legal requirements. Implementing features that support compliance with emerging
regulations and industry standards will ensure that the system remains relevant and legally
sound.
8. User Education and Awareness: To maximize the effectiveness of the system, educating
users about blockchain technology and the importance of product authenticity is essential.
Developing educational resources, tutorials, and user guides can help users understand how
to use the application effectively and make informed decisions.
BIBILIOGRAPHY

1. "Security mechanisms and data access protocols in innovative wireless networks" by A-SK
Pathan, S Azad, R Khan, and others was published in 2018 by Sage in London.

2. "A network attack discovery algorithm based on unbalanced sampling vehicle evolution
strategy for intrusion detection" was published in the International Journal of Computer
Applications on pages 1–9 in 2017 by Yong-xiong Z, Liang-ming W, and Lu-xia Y.

3. ST Zargar, J Joshi, and D Tipper wrote "An overview of protection components against
circulated forswearing of administration (DDoS) flooding assaults," which was published in IEEE
Correspondences Reviews and Instructional exercises in 2013, volume 15, issue 4, pages 2046-
2069.

4. "Robust detection of MAC layer denial-of-service attacks in CSMA/CA wireless networks" was
the title of a paper written by AL Toledo and X Wang and published in the 2008 issue of IEEE
Transactions on Information Forensics & Security, volume 3, issue 3, pages 347–358.

5. "Demonstrating circulated forswearing of administration assault in cutting-edge metering


foundation," by Y Guo, CW Ten, S Hu, and others, was presented at the 2015 IEEE Power and
Energy Society Creative Brilliant Matrix Advances Gathering (ISGT).

6. In 2016, AA Khan, MH Rehmani, and M Reisslein distributed "Mental radio for savvy lattices:
Overview of structures, range detecting components, and systems administration conventions" in
IEEE Correspondences Reviews and Instructional exercises, volume 18, issue 1, pages 860-898.
7. "The individual identification method of wireless device based on dimensionality reduction"
was published in June 2019 by Y Lin, X Zhu, Z Zheng, Z Dou, and R Zhou in the Journal of
Supercomputing, volume 75, issue 6, pages 3010–3027.

8. "Research on modulation recognition with ensemble learning" was published in 2017 by T Liu,
Y Guan, and Y Lin on page 179 of the EURASIP Journal on Wireless Communications and
Networking.

9. "Semi-administered learning with generative ill-disposed networks on advanced signal balance


order" was published in PCs, Materials, and Continua in 2018, issue 55, pages 243-254. It was
written by Y Tu, Y Lin, J Wang, and J-U Kim.

10. In the November 2017 issue of the EURASIP Diary on Remote Interchanges and Systems
administration, C Shi, Z Dou, Y Lin, and W Li published their paper titled "Unique edge setting for
RF-fueled mental radio organizations in non-Gaussian commotion."

11. In 2018, the paper "Trust the board technique for D2D correspondence in view of RF unique
finger impression ID" was published in IEEE Access, volume 6, pages 66082–66087. It was
written by Z Zhang, X Guo, and Y Lin.

12. "cFractal intricacy based include extraction calculation of correspondence signals" was
distributed in Fractals in June 2017 in volume 25, issue 4, pages 1740008-1-1740008-3 by H
Wang, J Li, L Guo, Z Dou, Y Lin, and R Zhou.

13. In IEEE Transactions on Vehicular Technology, volume 63, issue 3, pages 1204-1222, the
paper "Evolutionary-algorithm-assisted joint channel estimation and turbo multiuser
detection/decoding for OFDM/SDMA" was published in March 2014. J Zhang, S Chen, X Mu, and
L Hanzo wrote it.

14. In IEEE Exchanges on Vehicular Innovation in February 2019, volume 68, issue 2, pages
1916–1929, J Zhang, S Chen, X Guo, J Shi, and L Hanzo published "Helping fronthaul limit:
Worldwide advancement of force sharing for concentrated radio access organization."

15. "Sharp sufficient conditions for stable recovery of block sparse signals by block orthogonal
matching pursuit" was written by J Wen, Z Zhou, Z Liu, M-J Lai, and X Tang. It was published in
Applied and Computational Harmonic Analysis in November 2019, volume 47, pages 948–974.

16. "On the KZ reduction" was written by J Wen and X-W Chang and published in IEEE
Transactions on Information Theory, March 2019, issue 65, pages 1921–1935.

17. "Modeling of non-Gaussian colored noise and application in CR multi-sensor networks" was
the title of a paper that was published on page 192 of the November 2017 issue of the EURASIP
Journal on Wireless Communications and Networking.
18. "Carrier frequency estimation of time-frequency overlapped MASK signals for underlay
cognitive radio network," authored by M Liu, J Zhang, Y Lin, Z Wu, B Shang, and F Gong, was
published in IEEE Access in 2019, volume 7, pages 58277–58285. 19. "Multisensor weakness
examination showing considering the evidence speculation," by Y Lin, Y Li, X Yin, and Z Dou,
was published in IEEE Trades on Unflinching quality in June 2018, volume 67, issue 2, pages 513-
521. 20. H Wang, L Guo, Z Dou, and Y Lin stated "another strategy for mental sign
acknowledgment in view of mixture data entropy and DS proof hypothesis," which was distributed
in Versatile Organizations and Applications in August 2018, volume 23, issue 4, pages 677-685.
21. In IEEE Exchanges on Correspondences, volume 48, issue 2, pages 189 to 193, W Wei and JM
Mendel published their paper titled "Greatest probability arrangement for advanced sufficiency
stage adjustments." 22. "Hierarchical digital modulation classification using cumulants" was
published by A Swami and BM Sadler in IEEE Transactions on Communications, volume 48, issue
3, pages 416–429. 23. "Recognizing Visa distortion by changed Fisher discriminant examination,"
by N Mahmoudi and E Duman, was published in April 2015 in Expert Structures with
Applications, volume 42, issue 5, pages 2510-2516. 24. L Wu, C Shen, and A van nook Hengel's
article, "Profound straight discriminant examination on Fisher organizations: A mixture design for
individual re-ID," was published in Example Acknowledgment in May 2017, volume 65, pages
238-250. 25. S Srivastava and MR Gupta introduced "Appropriation based Bayesian least expected
risk for discriminant examination" in July 2006 at the IEEE Global Discussion on Data Hypothesis,
volume 1, pages 2294-2298.

You might also like