RRR Finall
RRR Finall
On
NOVEL AUTOMATIC FOOD TRADING SYSTEM USING
BLOCKCHAIN
Submitted in partial fulfilment of the requirements for the award of the degree of
BACHELOR OF TECHNOLOGY
In
INFORMATION TECHNOLOGY
By
M Raghu Ram Reddy
19261A1234
Under the guidance of
Mr. B. Lokesh
Assistant Professor, IT
1
CERTIFICATE
i
DECLARATION
No part of the work is copied from books/journals/internet and wherever the portion is
taken, the same has been duly referred in the text. The report is based on the work done
entirely by us and not copied from any other source.
ii
ACKNOWLEDGEMENT
The satisfaction that accompanies the successful completion of any task would
be incomplete without introducing the people who made it possible and whose constant
guidance and encouragement crowns all efforts with success. They have been a guiding
light and source of inspiration towards the completion of the Project Stage-II.
We would like to express our sincere gratitude and indebtedness to our project guide
Mr. B. Lokesh , Assistant Professor, Dept. of IT, who has supported us throughout our
project with immense patience and expertise.
We convey our heartfelt thanks to the lab staff for allowing us to use the required
equipment whenever needed.
Finally, we would like to take this opportunity to thank our families for their support all
through the work. We sincerely acknowledge and thank all those who gave directly or
indirectly their support in completion of this work.
iii
ABSTRACT
The blockchain functions as a decentralized and collectively maintained ledger that
allows anyone to contribute. It provides a secure and readily accessible source of
information concerning farms, inventories, and contracts in the agricultural sector,
where acquiring such data can sometimes be costly. By tracing the origin of food,
blockchain technology supports the establishment of trustworthy food supply chains
and fosters trust between producers and consumers. Its reliable data storage capabilities
enable the implementation of data-driven solutions to enhance farming practices.
Furthermore, when combined with smart contracts, blockchain technology facilitates
prompt payments by linking them to recorded data changes within the blockchain.
Technological advancements promises safety and security in every step that takes place
in internet. Through blockchain it is possible to maintain transparency and keep track
of transactions by upholding the security. Blockchain is most trending technologies
through which maximum security can be achieved, while use. Making any purchase
either it from the farmer or from the retailer.
iv
TABLE OF CONTENTS
DESCRIPTION PAGE NUMBER
Certificate i
Declaration ii
Acknowledgement iii
Abstract iv
List of Figures vii
List of Tables vii
Abbreviations viii
1. Introduction 1
1.1 Problem Statement 3
1.2 Existing System 4
1.3 Proposed System 5
1.4 Objectives 5
2. Requirement Specification 6
2.1 Software Requirements 7
2.2 Hardware Requirements 7
3. Literature Survey 8
4. System Analysis 11
4.1 System Study 12
5. Design and Methodology 14
5.1 System Architecture 15
5.2 UML Diagrams 16
5.2.1 Use Case Diagram 17
5.2.2 Class Diagram 17
5.2.3 Sequence Diagram 18
v
5.2.4 Collabration Diagram 19
6. Implementation 20
6.1 Modules 21
6.2 Model Training Source Code 21
6.3 Software Environment 31
7. Results 34
8. System Testing 48
8.1 Software Testing Strategies 49
8.1.1 Static Testing 49
8.1.2 Structural Testing 50
8.1.3 Behavioral Testing 50
8.2 Test cases 51
9. Conclusion and Future Scope 52
Bibiliography 54
Appendix 55
vi
LIST OF FIGURES
Figure 5.1 : Design and Methodology 15
Figure 5.2.1: Use Case Diagram 17
Figure 5.2.2 : Class Diagram 18
Figure 5.2.3 : Sequence Diagram 18
Figure 5.2.4 : Collabration Diagram 19
Figure 7 : Results 35
Figure 8.1.1 :Static Testing 49
Figure 8.1.2 : Structural Testing 50
Figure 8.1.3 : Behavioral Testing 50
LIST OF TABLES
Table 8.2 Test cases 51
vii
ABBREVIATIONS
FRP – Fair and Remunerative price
viii
1. INTRODUCTION
1
1. INTRODUCTION
To ensure product safety, handling the growth of farming products and effective
management of logistics -chain in agricultural supply chain is censorious. That cover
about food safety and the risk of contamination has renewed the prominence of tracing
power across the supply chain Moreover, farming goods exchanged across multiple
nations require accurate tracking and compliance with nation-specific regulations
Tracing of goods in the agricultural field requires to gather, communicate and maintain
critical data by specifically identifying the source, multiple data exchanges in the
logistic network. High-spirited nature of data in the agricultural / food supply chain
where products are manufactured, processed and sent through multiple intermediaries
allows tracking and tracing difficult. Contamination of products and its public health
consequences highlight traceability as the required policy instrument for tracking food
quality and safety. The present traceability practice in the supply chain of agriculture is
mainly affected by data fragmentation and centralized controls that are susceptible to
both information modification and management. In case of contamination that identifies
the source and isolates the product quickly from the supply chain. Today's supply chain
is becoming really complex. At various stage multiple stakeholder are present. All these
Stakeholder need to collaborate with each other in various direction for efficient and
effective management. To deal with food scares and accidents, the food industry
becoming more customer-oriented and need quicker response time. Good traceability
mechanisms help reduce the manufacture and sale of dangerous or low quality goods,
mitigating the risk for false ads, liability and recalls. Reducing the impacts of food
safety. Improving food safety, and providing a means to verify food quality attribute are
driving the development of traceability initiatives in agri-food system. The United
Nation Food and Agriculture Organization (FAO) and the International
Telecommunications Union (ITU) are continuing to work together to facilitate the use
of innovation Information and communication technologies (ICTs) in agriculture. The
importance of traceability has significantly increased with the globalization of the food
industries. Therefore, the need for a reliable identification and tracking system is
necessary to ensure the quality and safety of food which reaches the consumer. Block
chain for Supply Chain is a natural fusion of two technologies, built for mutual or
2
common ledge transactions. A supply chain often reflects a distribution of products
through industries, and is also cross-border. Food provenance is one pf FSC’s most
difficult issue. This issue companies are facing today. A global supply chain network
with asymmetric food regulation and multiple operating procedure between various
countries makes end-to-end food tracking incidental to the food industry. Distributed
ledger/Block chain is very important technology that can significantly impact the supply
chain management. This paper shows the possibility of block chain technology using
supply chain for both perishable product and manufacturing.
There is no computerized system in place to trace the cost of agriculture. Agricultural products cannot
be obtained by the farmer.72 percent of the population in India is dependent on the farming industry.
Farmers get enormous quantities of crop manufacturing, but they have not got the correct price
because they can survive the present circumstances. So they are suicide and nothing is done by the
government. So we are attempting to fix this issue in the suggested scheme by tracing the cost of the
agricultural product from farmer to client.
• Poor efficiency
• Insufficient parameters
• No Accuracy
• Limited Dataset
3
• Less classification rate
• High time complexity
Block chain is a distributed database containing all networked transactions. Each part
of this database is a "block" As transaction state shifts , a block with a connection to the
previous block is added to the block chain in a linear and sequential order. Then the new
block is replicated over the network, so that each node has the same block chain. Each
participant in this transaction has a copy of a block chain on it. Therefore, any
participant can validate a particular transaction. This approach removed the need for the
centralized, trusted confirmation of transactions by third parties . Block chain
technology has a wide variety of uses, and tremendous innovation potential. Therefore,
business leaders will use this technology to explore the range of opportunities open to
their company and their industry. There are three different phase and each phase are
connected with each other to play a vital role.
• Farmer: Farmer is first block of the block chain which contain the farmer details like
name, address, mobile no, crop name, crop selling price(FRP). All details are added into
smart contract and smart contract generate the hash code using sha256 algorithm. Then
block chain mine the block and added to block chain network.
• Miller: Miller contain the login registration which can hold the crop price details
which are fix by the government and particular organization. The block chain is
immutable so no one can change the crop price and farmer’s details. So miller contains
his own data and previous hash code of the farmer.
• Consumer: Consumer is last entity of the block chain which are purchase the product.
He does not know the exact price of the product so we can give authenticate permission
to check the price of the product from farmer to consumer. So consumer can get the all
chain details and price details.
4
ADVANTAGES OF PROPOSED SYSTEM
• Customer can get appropriate price of the product.
• Farmer can get the FRP price for his product or crop.
• Government can trace the price of the crop and control the corruption between brokers.
• High accuracy and high efficiency.
1.4 OBJECTIVES
The main objective is to create a secure transactions between the farmers and the dealer
and see that these rates and quantity is not know to any one. By doing this the crop prize
inflation can be controlled and the buyer are benefited.
5
2. REQUIREMENT SPECIFICATION
6
2. REQUIREMENT SPECIFICATION
2.1 SOFTWARE REQUIREMENTS
7
3. LITERATURE SURVEY
8
3. LITERATURE SURVEY
3.1 AUTHOR: D. Mao, Z. Hao, F. Wang Novel automatic food trading system using
consortium blockchain
ABSTRACT: Agri-food trade has a profound impact on social stability and sustainable
economic development. However, there are several technological problems in current
agricultural product transactions. For example, it is almost impossible to improve the
efficiency of transactions and maintain market stability. This paper designs a novel Food
Trading System with COnsortium blockchaiN (FTSCON) to eliminate information
asymmetry in the food trade, in order to establish a sustainable and credible trading
environment, the system uses consortium blockchain technology to meet the challenge
of different authentications and permissions for different roles in food trade.
Meanwhile, we have used the online double auction mechanism to eliminate
competition. We also have designed a improved Practical Byzantine Fault Tolerance
(iPBFT) algorithm to improve efficiency. In addition, a case study based on a series of
data from Shandong Province, China indicate that the FTSCON can achieve profit
improvement of merchants. Therefore, the proposed system proved to have high
commercial value.
2.1.2 AUTHOR: L. U. Opara and F. Mazaud Food traceability from _eld to plate
ABSTRACT: Several factors have led to intensified public scrutiny of the human food
supply chain. Consumer concerns for food safety, animal welfare, and the
environmental and ecological impact of food production and agro-processing have
become increasingly important. These concerns have been exacerbated by several
factors, including the trend towards further globalization of the food supply chain, the
incidence of new and emerging safety hazards such as the human form of BSE (mad
cow disease), and illnesses and deaths resulting from contamination of fresh and
processed food. As a consequence of these growing concerns, consumers and other
stakeholders in agroindustry now demand transparency in the way food is grown and
handled throughout the supply chain, resulting in the emergence of 'traceability' as an
important policy issue in food quality and safety. This paper provides a global overview
of 'traceability' as a quality index in food trade, and discusses some of the drivers in
9
both developed and developing countries. Policy changes are necessary specifically to
incorporate traceability into existing food safety regulations and trade agreements. This
will require further investments in information technology for data capture, storage and
retrieval. Small-scale farmers in many developing regions moving towards market
orientation face considerable technical and financial challenges in implementing
appropriate food traceability systems in order to meet marketing compliance
requirements.
10
4. SYSTEM ANALYSIS
11
4.1. SYSTEM STUDY
The feasibility of the project is analyzed in this phase and business proposal is put forth
with a very general plan for the project and some cost estimates. During system analysis
the feasibility study of the proposed system is to be carried out. This is to ensure that
the proposed system is not a burden to the company. For feasibility analysis, some
understanding of the major requirements for the system is essential.
• ECONOMICAL FEASIBILITY
• TECHNICAL FEASIBILITY
• SOCIAL FEASIBILITY
ECONOMICAL FEASIBILITY
This study is carried out to check the economic impact that the system will have on the
organization. The amount of fund that the company can pour into the research and
development of the system is limited. The expenditures must be justified. Thus the
developed system as well within the budget and this was achieved because most of the
technologies used are freely available. Only the customized products had to be
purchased.
TECHNICAL FEASIBILITY
This study is carried out to check the technical feasibility, that is, the technical
requirements of the system. Any system developed must not have a high demand on the
available technical resources. This will lead to high demands on the available technical
resources. This will lead to high demands being placed on the client. The developed
system must have a modest requirement, as only minimal or null changes are required
for implementing this system.
12
SOCIAL FEASIBILITY
The aspect of study is to check the level of acceptance of the system by the user. This
includes the process of training the user to use the system efficiently. The user must not
feel threatened by the system, instead must accept it as a necessity. The level of
acceptance by the users solely depends on the methods that are employed to educate the
user about the system and to make him familiar with it. His level of confidence must be
raised so that he is also able to make some constructive criticism, which is welcomed,
as he is the final user of the system.
13
5. DESIGN AND METHODOLOGY
14
5. DESIGN AND METHODOLOGY
5.1 SYSTEM ARCHITECTURE
15
5.2 UML DIAGRAMS
UML stands for Unified Modeling Language. UML is a standardized general-purpose
modeling language in the field of object-oriented software engineering.
The goal is for UML to become a common language for creating models of object
oriented computer software. In its current form UML is comprised of two major
components: a Meta-model and a notation.
The Unified Modeling Language is a standard language for specifying, Visualization,
Constructing and documenting the artifacts of software system, as well as for business
modeling and other non-software systems.
The UML represents a collection of best engineering practices that have proven
successful in the modeling of large and complex systems.
The UML is a very important part of developing objects oriented software and the
software development process. The UML uses mostly graphical notations to express the
design of software projects.
GOALS
The Primary goals in the design of the UML are as follows:
• Provide users a ready-to-use, expressive visual modeling Language so that they
can develop and exchange meaningful models.
• Provide extendibility and specialization mechanisms to extend the core concepts.
• Be independent of particular programming languages and development process.
• Provide a formal basis for understanding the modeling language.
• Encourage the growth of OO tools market.
• Support higher level development concepts such as collaborations, frameworks,
patterns and components.
• Integrate best practices.
16
5.2.1 USE CASE DIAGRAM
A use case diagram in the Unified Modeling Language (UML) is a type of behavioral
diagram defined by and created from a Use-case analysis. Its purpose is to present a
graphical overview of the functionality provided by a system in terms of actors, their
goals (represented as use cases), and any dependencies between those use cases. The
main purpose of a use case diagram is to show what system functions are performed for
which actor. Roles of the actors in the system can be depicted.
The class diagram is used to refine the use case diagram and define a detailed design of
the system. The class diagram classifies the actors defined in the use case diagram into
a set of interrelated classes. The relationship or association between the classes can be
either an "is-a" or "has-a" relationship. Each class in the class diagram may be capable
of providing certain functionalities. These functionalities provided by the class are
17
termed "methods" of the class. Apart from this, each class may have certain "attributes"
that uniquely identify the class.
18
5.2.4 COLLABRATION DIAGRAM:
19
6. IMPLEMENTATION
20
6. IMPLEMENTATION
6.1 MODULES
Upload MRI images dataset : use this button to get upload images.
Generate images train & test model : use this button to get generate images train &
test model.
Generate deep learning CNN model : use this button to get deep learning
CNN model.
Get drive HQ images: using this button to get open drive HQ
Predict tumor :use this button to get predict tumor.
global usertype
blockchain = Blockchain()
if os.path.exists('blockchain_contract.txt'):
blockchain = pickle.load(fileinput)
fileinput.close()
21
#===========================miller requets
def ConsumerSaleAction(request):
if request.method == 'POST':
today = date.today()
data = "consumersale#"+product+"#"+consumer+"#"+quantity+"#"+str(today)
enc = blockchain.encrypt(str(data))
enc = str(base64.b64encode(enc),'utf-8')
blockchain.add_new_transaction(enc)
hash = blockchain.mine()
b = blockchain.chain[len(blockchain.chain)-1]
blockchain.save_object(blockchain,'blockchain_contract.txt')
22
if i > 0:
b = blockchain.chain[i]
data = b.transactions[0]
data = base64.b64decode(data)
decrypt = blockchain.decrypt(data)
decrypt = decrypt.decode("utf-8")
arr = decrypt.split("#")
if arr[0] == 'addproduct':
output+=''<option value=’+arr[2]+’>’[2]+’</option>’
output+=”</select></td></tr>”
context= {'data1':output}
return render(request, 'SaleToConsumer.html', context)
def MillerBookOrder(request):
if request.method == 'GET':
pid = request.GET['crop']
user = ''
with open("session.txt", "r") as file:
for line in file:
user = line.strip('\n')
file.close()
details = ''
today = date.today()
data = "bookorder#"+pid+"#"+user+"#"+details+"#"+str(today)
enc = blockchain.encrypt(str(data))
enc = str(base64.b64encode(enc),'utf-8')
blockchain.add_new_transaction(enc)
hash = blockchain.mine()
b = blockchain.chain[len(blockchain.chain)-1]
blockchain.save_object(blockchain,'blockchain_contract.txt')
print("Previous Hash : "+str(b.previous_hash)+" Block No : "+str(b.index)+" Current
Hash : "+str(b.hash))
23
bc = “Previous Hash : “+str(b.previous_hash)+”<br/>Block No:
”+str(b.index)+”<br/>Current Hash : “+str(b.hash)
output = 'Your Order details Updated<br/>'+bc
context= {'data':output}
return render(request, 'MillerScreen.html', context)
def PurchaseProducts(request):
if request.method == 'GET':
output = ‘<tr><td><font size=””
color=”black”>Crop Name</font></td><td><select name=”t1”>’
output+=”</select></td></tr>”
context={‘data1’:output}
return render(request, 'PurchaseProducts.html', context)
#miller end here=================================================
def BookOrder(request):
if request.method == 'GET':
pid = request.GET['crop']
user = '' with open("session.txt", "r") as file:
for line in file:
user = line.strip('\n')
file.close()
details = ''
for i in range(len(blockchain.chain)):
if i > 0:
b = blockchain.chain[i]
data = b.transactions[0]
data = base64.b64decode(data)
decrypt = blockchain.decrypt(data)
decrypt = decrypt.decode("utf-8")
arr = decrypt.split("#")
if arr[0] == "signup":
if arr[1] == user:
24
details = arr[3]+","+arr[4]+","+arr[5]+","+arr[6]
break
today = date.today()
data = "bookorder#"+pid+"#"+user+"#"+details+"#"+str(today)
enc = blockchain.encrypt(str(data))
enc = str(base64.b64encode(enc),'utf-8')
blockchain.add_new_transaction(enc)
hash = blockchain.mine()
b = blockchain.chain[len(blockchain.chain)-1]
blockchain.save_object(blockchain,'blockchain_contract.txt')
print("Previous Hash : "+str(b.previous_hash)+" Block No : "+str(b.index)+" Current
Hash : "+str(b.hash))
bc = "Previous Hash : "+str(b.previous_hash)+"<br/>Block No :
"+str(b.index)+"<br/>Current Hash : “+str(b.hash)
output = 'Your Order details Updated<br/>'+bc
context= {'data':output}
return render(request, 'DRSScreen.html', context)
def SearchProductAction(request):
if request.method == 'POST':
ptype = request.POST.get('t1', False)
output = '<table border=1 align=center>’
output+='<tr><th><font size=3 color=black>Farmer Name</font></th>'
output+='<tr><font size=3 color=black>Crop Name</font></th>'
output+='<tr><font size=3 color=black>Quantity </font></th>'
output+='<tr><font size=3 color=black>Description </font></th>'
output+='<tr><font size=3 color=black>Image </font></th>'
output+='<tr><font size=3 color=black>Purchase Crop </font></th></tr>'
for i in range(len(blockchain.chain)):
if i > 0:
b = blockchain.chain[i]
data = b.transactions[0]
25
data = base64.b64decode(data)
decrypt = blockchain.decrypt(data)
decrypt = decrypt.decode("utf-8")
arr = decrypt.split("#")
if arr[0] == 'addproduct':
if arr[2] == ptype:
output+=’<tr><td><font size=3 color=black>’+arr[1]+’</font></td>’
output+=’<td><font size=3 color=black>’+arr[2]+’</font></td>’
output+=’<td><font size=3 color=black>’+str(arr[3])+’</font></td>’
output+=’<td><font size=3 color=black>’+str(arr[4])+’</font></td>’
output+=’<td><font size=3 color=black>’+arr[5]+’</font></td>’
output+=’<td><img src=/static/crop/’+arr[6] width=200 height=200></img></td>’
output+=”</table><br/><br/><br/><br/><br/><br/>”
context= {‘data’:output}
return render(request,’SearchProducts.html’,context)
def BrowseProducts(request):
if request.method == 'GET':
output = ‘<tr><td>font size=””
color=”black”>Crop Name</font></td><td><select name=”t1”>’
for i in range(len(blockchain.chain)):
if i > 0:
b = blockchain.chain[i]
data = b.transactions[0]
data = base64.b64decode(data)
decrypt = blockchain.decrypt(data)
decrypt = decrypt.decode("utf-8")
arr = decrypt.split("#")
if arr[0] == 'addproduct':
output+=’<option value=’+arr[2[+’>'+arr[2]+'</option>’
output+=”</select></td></tr>”
context= {'data1':output}
26
return render(request, 'BrowseProducts.html', context)
def ViewOrdersForFarmer(request):
if request.method == 'GET':
user = ''
with open("session.txt", "r") as file:
for line in file:
user = line.strip('\n')
file.close()
output = ‘<table border=1 align=center>’
output+=’<tr><th>font size=3 color=black>Product Name</font></th>’
output+=’<th>font size=3 color=black>Order From</font></th>’
output+=’<th>font size=3 color=black>Contact No</font></th>’
output+=’<th>font size=3 color=black>Email ID</font></th>’
output+=’<th>font size=3 color=black>Address</font></th>’
output+=’<th>font size=3 color=black>User Type </font></th>’
output+=’<th>font size=3 color=black>Ordered Date</font></th></tr>’
def FertilizerInfo(request):
if request.method == 'GET':
return render(request, 'FertilizerInfo.html', {})
def UploadCrop(request):
if request.method == 'GET':
return render(request, 'UploadCrop.html', {})
def UploadCropAction(request):
if request.method == 'POST':
cname = request.POST.get('t1', False)
qty = request.POST.get('t2', False)
price = request.POST.get('t3', False)
desc = request.POST.get('t4', False)
image = request.FILES['t5']
imagename = request.FILES['t5'].name
user = ''
27
with open("session.txt", "r") as file:
for line in file:
user = line.strip('\n')
file.close()
data =
"addproduct#"+user+"#"+cname+"#"+price+"#"+qty+"#"+desc+"#"+imagename
enc = blockchain.encrypt(str(data))
enc = str(base64.b64encode(enc),'utf-8')
blockchain.add_new_transaction(enc)
hash = blockchain.mine()
b = blockchain.chain[len(blockchain.chain)-1]
print("Blockchain Details : "+str(b.transactions[0])+" Previous Hash :
"+str(b.previous_hash)+" Block No : "+str(b.index)+" Current Hash : "+str(b.hash))
bc = "Blockchain Details : "+str(b.transactions[0])+" Previous Hash :
"+str(b.previous_hash)+"
Block No : "+str(b.index)+"Current Hash : "+str(b.hash)
blockchain.save_object(blockchain,'blockchain_contract.txt')
fs = FileSystemStorage()
filename = fs.save('AgricultureApp/static/crop/'+imagename, image)
context= {'data':'Crop details added.<br/>’+bc}
return render(request, 'UploadCrop.html', context)
def index(request):
if request.method == 'GET':
return render(request, 'index.html', {})
def Login(request):
if request.method == 'GET':
return render(request, 'Login.html', {})
def Register(request):
if request.method == 'GET':
return render(request, 'Register.html', {})
def RegisterAction(request):
28
if request.method == 'POST':
username = request.POST.get('t1', False)
password = request.POST.get('t2', False)
contact = request.POST.get('t3', False)
email = request.POST.get('t4', False)
address = request.POST.get('t5', False)
usertype = request.POST.get('t6', False)
record = 'none'
if record == 'none':
data =
"signup#"+username+"#"+password+"#"+contact+"#"+email+"#"+address+"#"+usert
ype
enc = blockchain.encrypt(str(data))
enc = str(base64.b64encode(enc),'utf-8')
blockchain.add_new_transaction(enc)
hash = blockchain.mine()
b = blockchain.chain[len(blockchain.chain)-1]
print("Blockchain Details : "+str(b.transactions[0])+" Previous Hash :
"+str(b.previous_hash)+" Block No : "+str(b.index)+" Current Hash : "+str(b.hash))
bc = "Blockchain Details : "+str(b.transactions[0])+" Previous Hash :
"+str(b.previous_hash)+"
Block No : "+str(b.index)+"<br/>Current Hash : "+str(b.hash)
blockchain.save_object(blockchain,'blockchain_contract.txt')
context= {'data':'Signup process completd and record saved in Blockchain with below
hashcodes.<br/>'+bc}
return render(request, 'Register.html', context)
else:
context= {'data':username+'Username already exists'}
return render(request, 'Register.html', context)
def UserLogin(request):
if request.method == 'POST':
29
global usertype
username = request.POST.get('t1', False)
password = request.POST.get('t2', False)
usertype = request.POST.get('t3', False)
status = 'none'
if status == 'success' and usertype == 'Farmer':
file = open('session.txt','w')
file.write(username)
file.close()
context= {'data':"Welcome "+username}
return render(request, 'FarmerScreen.html', context)
elif status == 'success' and usertype == 'DRS':
file = open('session.txt','w')
file.write(username)
file.close()
context= {'data':"Welcome "+username}
return render(request, 'DRSScreen.html', context)
elif status == 'success' and usertype == 'Miller':
file = open('session.txt','w')
file.write(username)
file.close()
context= {'data':"Welcome "+username}
return render(request, 'MillerScreen.html', context)
else:
context= {'data':'Invalid login details'}
return render(request, 'Login.html', context)
30
6.3 SOFTWARE ENVIRONMENT
PYTHON LANGUAGE:
LIBRARIES
Tensorflow
TensorFlow is a free and open-source software library for dataflow and differentiable
programming across a range of tasks. It is a symbolic math library, and is also used
for machine learning applications such as neural networks. It is used for both research
and production at Google.
31
Numpy
Matplotlib
Scikit – learn
32
7. RESULTS
33
7. RESULTS
In this project we are migrating agriculture crop sale details to Blockchain technologies
as centralized servers can data can be altered or attack as this centralized maintain data
in single server and if this server crash, hack then all services will be disturbed. Any
employee maintaining server can alter database data on server. To overcome from above
issue we are migrating it to Blockchain technology where all data is stored at multiple
nodes or servers in the form of block/transaction and associate each block with unique
hash code and before storing new block Blockchain will verify hash code in each block
and server and if any node data alter then its hash code verification will be failed and
attack can be detected and due to this reason Blockchain data is called as immutable
(cannot alter data by unauthorized users). In this project we are designing Blockchain
based online application for FARMERS, Distributors and Miller. Farmers can sign up
with the application and then login and after login can upload crop details, view orders
from distributors or millers and can view fertilizers or pesticides details.
Distributors/Retailers/Consumer: This user can also signup, login and can view crop
details and can purchase those crops Miller: Can sign up, login and purchase crop from
farmer and sale to consumer. All above transaction data will be saved in Blockchain. In
below screen you can see code to store data in Blockchain and verification will be done
as POW (proof of work). In below screen shots read red colour comments to understand
Blockchain code.
34
To run project double click on ‘run.bat’ file to start DJango Server and to get below
screen
35
In above screen server started and now open browser and enter URL as
‘http://127.0.0.1:8000/index.htm’ and press enter key to get below screen
In above screen click on ‘New User Signup’ link to get below screen
36
In above screen user is signup and select desire user as Farmer or distributor or Miller
and then press submit button to get below output
In above screen in red colour text we can see data is stored in Blockchain and we see
hash code of previous and new blocks and similarly you can add distributor and miller
user. Now click on ‘User Login’ link to get below screen
37
In above screen kumar farmer user is login and after login will get below screen
In above screen click on ‘Upload Crop Details’ link to upload crop details and get below
screen
38
In above screen farmer is uploading crop details with images and then click on ‘Upload
Crop Details’ button to get below output
In above screen crop details added in Blockchain and we can see hash code of old and
new block. Similarly you can add any number of crops and now click on
‘Fertilizers/Pesticide Info’ link to view fertilizers details
39
In above screen farmer can view crop names and the require fertilizers and now logout
and login as other users to purchase crops
In above screen distributor user is login and after login will get below screen
40
In above screen click on ‘Browse Products’ link to get products details
In above screen distributor user can select desire crop and then click button to get below
output
41
In above screen distributor can view all details and then click on ‘Click Here’ link to
make purchase
In above screen in red colour text we can see distributor order is confirmed and now
logout and login as Miller
42
In above screen miller user is login and after login will get below screen
In above screen click on ‘Purchase Products from Farmer’ link to get crop screen
43
In above screen select the crop and press button to view crop details like below screen
In above screen all crop details can be view by Miller and then click on ‘Click Here’
link to get below purchase screen
44
In above screen order details updated and this order will be view and fulfilled by farmer
and now click on ‘Sale To Consumer’ link to get below screen
In above screen Miller will sale crop to consumer and press button to get below output
45
In above screen sale to consumer order is updated and now logout and login as farmer
to view orders like below screen
In above screen farmer is login and after login will get below output
46
In above screen click on ‘View Orders’ link to get below orders details
In above screen farmer can view details of purchaser like crop name, quantity and
their contact details with user type as DRS (distributor/ retailer/ consumer) or Miller
and then complete the order
47
8. SYSTEM TESTING
48
8. SYSTEM TESTING
System testing, also referred to as system-level tests or system-integration testing, is the
process in which a quality assurance (QA) team evaluates how the various components
of an application interact together in the full, integrated system or application. System
testing verifies that an application performs tasks as designed. This step, a kind of black
box testing, focuses on the functionality of an application. System testing, for example,
might check that every kind of user input produces the intended output across the
application.
Optimization of the approach to testing in software engineering is the best way to make
it effective. A software testing strategy defines what, when, and how to do whatever is
necessary to make an end-product of high quality. Usually, the following software
testing strategies and their combinations are used to achieve this major objective:
The early-stage testing strategy is static testing: it is performed without actually running
the developing product. Basically, such desk-checking is required to detect bugs and
issues that are present in the code itself. Such a check-up is important at the pre-
deployment stage as it helps avoid problems caused by errors in the code and software
structure deficits.
49
8.1.2 STRUCTURAL TESTING
It is not possible to effectively test software without running it. Structural testing, also
known as white-box testing, is required to detect and fix bugs and errors emerging
during the pre-production stage of the software development process. At this stage, unit
testing based on the software structure is performed using regression testing.
Developers and QA engineers have full access to the software’s structure and data flows
(data flows testing), so they could track any changes (mutation testing) in the system’s
behavior by comparing the tests’ outcomes with the results of previous iterations
(control flow testing).
The final stage of testing focuses on the software’s reactions to various activities rather
than on the mechanisms behind these reactions. In other words, behavioral testing, also
known as black-box testing, presupposes running numerous tests, mostly manual, to see
the product from the user’s point of view. QA engineers usually have some specific
information about a business or other purposes of the software (‘the black box’) to run
usability tests. Behavioral testing also may include automation (regression tests) to
eliminate human error if repetitive activities are required.
50
8.2 TEST CASES
S.NO
Test Case Input Expected Actual Remarks
Output Output
51
9. CONCLUSION AND FUTURE SCOPE
52
9. CONCLUSION AND FUTURE SCOPE
In our paper, we proposed generic framework and solution using smart technologies and
block chain to control, track and execute company operations eliminating
intermediaries and the main processing point for crop price traceability in the
agricultural supply chain We provided entity-relationship diagrams, sequence diagram,
architecture, interactions and execution algorithm with details and elements relating to
the scheme. We have shown how our solution is use to monitor crop prices in the supply
chain. Nonetheless, the aforementioned elements and knowledge are sufficiently
general and can be apply to provide decentralized traceability and reliability for any
crop in the agricultural supply chain. Block chain technology also take issues with the
concerning enforcement, authentication of identity, scalability, privacy, norms, and
legislation. In our paper, we proposed generic framework and solution using smart
technologies and block chain to control, track and execute company operations
eliminating intermediaries and the main processing point for crop price traceability in
the agricultural supply chain. We provided entity-relationship diagrams, sequence
diagram, architecture, interactions, and execution algorithm with details and elements
relating to the scheme. We have shown how our solution is used to monitor crop prices
in the supply chain. Nonetheless, the aforementioned elements and knowledge are
sufficiently general and can be applied to provide decentralized traceability and
reliability for any crop in the agricultural supply chain. Block chain technology also
take issues with the concerning enforcement, authentication of identity, scalability,
privacy, norms, and legislation.
53
BIBILIOGRAPHY
[1] M. M. Aung and Y. S. Chang, ``Traceability in a food supply chain: Safety and
quality perspectives,'' Food Control, vol. 39, pp. 172_184, May 2014.
[3] J. Hobbs, ``Liability and traceability in agri-food supply chains,'' in Quan- tifying
the AgriFood Supply Chain. Springer, 2006, pp. 87_102.
[4] D. Mao, Z. Hao, F. Wang, and H. Li, ``Novel automatic food trading system using
consortium blockchain,'' Arabian J. Sci. Eng., vol. 44, no. 4, pp. 3439_3455, Apr. 2018.
[5] L. U. Opara and F. Mazaud, ``Food traceability from _eld to plate,'' Outlook
Agricult., vol. 30, no. 2, pp. 239_247, 2001.
[6]. Li, Q., Wang, M., Gu, W.: Computer Vision Based Systemfor Apple Surface Defect
Detection. Computers and Electronics in Agriculture 36, page 215-223 .
[7]. Kim, M.S., Lefcourt, A.M., Chen, Y.R., Tao, Y.:Automated Detection of Fecal
Contamination of Apples Based on Multispectral Fluorescence Image Fusion. Journal
of food engineering 71, page 85-91 .
[8]. Dubey, S.R.: Automatic Recognition of Fruits and Vegetables and Detection of Fruit
Diseases. Master‘s theses ©2021 IEEE 1328 Authorized licensed use limited to:
Carleton University. Downloaded on May 28,2021 at 13:38:12 UTC from IEEE Xplore.
Restrictions apply.
[9]. Dubey, S.R., Jalal, A.S.: Adapted Approach for Fruit Disease Identification using
Images. International Journal of Computer Vision and Image Processing 2(3), page 51
– 65.
[10]. Kleynen, O., Leemans, V., Destain, M.F.: Development of a Multi-Spectral Vision
System for the Detection of Defects on Apples. Journal of Food Engineering 69, page
41-49.
54
APPENDIX
Publication Details
Journal Name : International Journal for Research in Applied Science & Engineering
Technology (IJRASET)
Website : www.ijraset.com
Volume : 11
Issue : VI
Paper Id : IJRASET54285
ISSN : 2321-9653
IC Value : 45.98
DOI : https://doi.org/10.22214/ijraset.2023.54285
Citation : M.Raghu Ram Reddy, P. Deepak, R. Anurrag, Asst Prof. Mr. B. Lokesh.
“Novel Automatic Food Trading System using Blockchain”, volume 11, Issue V1,
International Journal for Research in Applied Science and Engineering
Technology(IJRASET) Page No: 3598-3601, ISSN : 2321-9653, www.ijraset.com.
55