Vegetables market manegement system.docx

venkatagangaraoy 0 views 92 slides Oct 25, 2025
Slide 1
Slide 1 of 92
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42
Slide 43
43
Slide 44
44
Slide 45
45
Slide 46
46
Slide 47
47
Slide 48
48
Slide 49
49
Slide 50
50
Slide 51
51
Slide 52
52
Slide 53
53
Slide 54
54
Slide 55
55
Slide 56
56
Slide 57
57
Slide 58
58
Slide 59
59
Slide 60
60
Slide 61
61
Slide 62
62
Slide 63
63
Slide 64
64
Slide 65
65
Slide 66
66
Slide 67
67
Slide 68
68
Slide 69
69
Slide 70
70
Slide 71
71
Slide 72
72
Slide 73
73
Slide 74
74
Slide 75
75
Slide 76
76
Slide 77
77
Slide 78
78
Slide 79
79
Slide 80
80
Slide 81
81
Slide 82
82
Slide 83
83
Slide 84
84
Slide 85
85
Slide 86
86
Slide 87
87
Slide 88
88
Slide 89
89
Slide 90
90
Slide 91
91
Slide 92
92

About This Presentation

plagiarism report


Slide Content

A
Project Report
On
“VEGETABLES MARKET MANAGEMENT SYSTEM”
Submitted in partial fulfilment of
BACHELOR OF TECHNOLOGY
IN
“COMPUTER SCIENCE AND ENGINEERING”


1

ABSTRACT


Blockchain is a method in which a confirmation of a transaction is kept by means of a
crypto-currency. The record is maintained transversely, linking several computers in a
peer to peer network. Contracts, transactions, and the records of them define the
economic system of a country. They set boundaries and provide security to the assets.
Considering the features of blockchain such as immutability and maintaining the
footage of transaction details, this paper highlights the usage of blockchain technology
with farmer’s portal that keep the footage of selling and buying information of crops.
The proposed solution uses the python as a programming language in integration with
the blockchain system that will benefit the farmers or vendors and individuals by
preserving the contract of trade. An interface for the farmers is designed using a
python programming language in addition with blockchain technology, which is used
to store the information related to seller, buyer, selling and buying an item and total
value transacted.

2

3

S.N
O
TOPIC
PAGEN
O
1 INTRODUCTION 1
2 SYSTEM ANALYSIS 4
2.1 Existing System 4
2.2 Proposed System 4
2.3 Feasibility Study 5
3 SYSTEM DESIGN 6
3.1 Definition 6
3.2 Output Design 6
3.3 Input Design 7
3.4 System Architecture 8
3.5 Data Flow Diagram 9
3.6 UML Diagram 10
3.7 Data Dictionary 14
4 SYSTEM SPECIFICATIONS 18
4.1 Hardware Requirements 18
4.2 Software Requirements 18
5 OVERVIEW OF LANGUAGE 19
6 IMPLEMENTATION 42
6.1 System modules 42
6.2 Proposed Algorithms 43
6.3 Source Code 43
7 TESTING 66
7.1 Test Cases 68
8 OUTPUT SCREENS 70
9 CONCLUSION 80
BIBLIOGRAPHY 81

LIST OF FIGURES
FIGURE NO FIGURES NAME PAGE NO
Fig 1 System Architecture 8
Fig 2 Data Flow Diagram 9
Fig 3 Sequence Diagram 11
Fig 4 Class Diagram 12
Fig 5 Use-Case Diagram 12
Fig 6 Activity Diagram 13



LIST OF
PLATES
4
Plate No. Plate Name Page No.
8.1 Home Page 70
8.2 Seller Registration 70
8.3 Buyer Registration 71
8.4 Seller Login 71
8.5 Seller Home 72
8.6 Seller Adding Crop Details 72
8.7 Seller Commodities 73
8.8 Updating Crops 73
8.9 User View in Cart 74
8.10 Buyer Login 74
8.11 Buyer Home 75
8.12 Search Results 75
8.13 Buyer Cart View 76
8.14 Block chain 76
8.15 Block chain Transaction 77
8.16 Buyer View Transaction 77
8.17 Purchased Crops 78
8.18 Admin View Blockchain Transaction 78
8.19 Admin Activate Buyers 79
8.20 Admin Activate Seller 79

5

1.INTRODUCTION

Blockchain an open, disseminated and decentralized ledger that evidences transactions involving two
parties capably in a confirmable and stable way (Iansiti, Lakhani 2017). In the above given
definition, open means the blockchain is accessible to one and all, disseminated means that there is
no single party control and decentralized means there is no central third party available, capable
means it is fast and more scalable than the conventional technologies, confirmable means that
everyone can check the validity of the information and stable means that the data is nearly immutable
that is it is nearly impossible to change or tamper the data or information. They verify and validate
the identities and chronological events. They guide every action, transactions that have taken place
among individuals, communities, organizations and nations as well. In this era of digitization, the
way maintained and regulated these type of data must be changed, it must be highly secure and the
blockchain is the solution to this.
In the era of information and communication technology, a farmer's portal has always been helpful
for farmers in many ways, providing ease of use and convenience of information to the farmers [1].
The Government of India has also taken many initiatives for the same. Few examples of such portals
are Krishijagran.com, farmer.gov.in, agricoop.nic.in and agriwatch.com etc. Apart from these some
E-commerce websites are also available; fert.nic.in and enam.gov.in etc. The sectors currently using
blockchain are shown in Fig.1.Using blockchain technology in the field can make available
decentralized computation and information sharing platform that enables multiple authoritative
domains, which do not trust each other, to cooperate, coordinate and collaborate in a rational decision
making process, a reliable information recording system can be made that can contribute for the
development in the agriculture sector. Since blockchain works like a public ledger, so it can be
utilized to ensure many different aspects such as [3]:
● Protocols for Commitment: Ensure that every valid transaction from the clients are committed and
included in the blockchain within a finite time.
● Consensus: Ensure that the local copies are consistent and updated.
● Security: The data needs to be tamper -proof. Note that the client may act maliciously or can be
compromised.
● Privacy and Authenticity: The data or transactions belong to various clients; privacy and
authenticity need to be ensured.
6

Cryptography is a foremost part of the functioning of blockchain technology [4]. Public key
encryption is the root of blockchain wallets and transaction, cryptography hash functions endow with
the trait of immutability and merle trees systematize transactions while enabling blockchain to be
more competent.
Ensuring the above aspects numerous work has been carried out in the field of blockchain. The
presented portal is a contribution over them. It can help to maintain a secure platform for farmers,
where they can trade with the customers electronically. The main objective of this study is to record
the secure transactions between a seller and a buyer that ensures a contract between the two. This can
help farmers to get a legitimate price for their commodity. The system also facilitates a single place
to record the whole trade transaction.
The availability and accessibility of information are the crucial points in taking the optimal decision
at right time. Nowadays, advancement of ICT make possible to retrieve almost any information from
the global repository (internet). The information in internet is primarily maintained in English. So, a
large number of people are deprived from the benefit of internet due to technical and English
language illiteracy. This scenario is very bad in developing country like India where nearly 76 % are
English illiterate 1 . Moreover, a large percentage of the English literate people are also unable to
find their exact need form the large database of internet due to lack of proficient knowledge in
English. Indian farmers belong to such type of people who are not much sound in both technical as
well as in English.
So, they are unable to access required information on the farming life cycle, seed selection,
pesticides, market price etc. from the internet. As a consequence, they are not capable to take optimal
decisions at different stages of farming life cycle, which make huge impact on the farmer’s revenue.
As a result suicide rate has been increased rapidly among the Indian farming community.
According to the reports, those pathetic incidents are mainly happened due to the frustration that they
are unable to pay their debts. These types of situations create huge impact on the agriculture sector.
Consequently, the focus of new generation is shifted from farming sector which will be threatening
the near future in India. Our preliminary studies reveal that farmers require information at the right
stage of the farming life cycle to take the right decisions [1]. However, farmers are unable to get this
information from internet due to English language and technical illiteracy. Recently, some webpages
like –Wikipedia, Indian Railway web page, etc. provide facility of internet access in many users’
language other than English by supporting UTF-8 encoding 3 . However, it is observed that
information is not so useful to the people who are having poor knowledge on internet and web
browsing [2]. Moreover, this type of attempt is meaningless for the illiterate people. A large number
of people from the Indian farmer community are unable to read/write even their own mother tongue.
7

So, it is obvious that text based interface, instead of supporting farmer’s own language, are not able
to provide the required information. The above mentioned scenario states that there is a requirement
of alternative interaction technique(s). By considering this fact, Plauché et al. proposed a speech-
driven agricultural query system for Tamil Nadu state of India [3]. However this work does not able
to address the scenario of total India. Patel et al. designed an interactive voice application for small-
scale farmers in Gujarat, India [4]. However, it doses not provide a feature to search for specified
content in the forum. There, user needs to answer the questions sequentially starting from the most
recent question. User does not have the option to skip any question. Moreover, there is no guarantee
of giving accurate answer, as the questions are answered by other users. Furthermore, this work is
also confined to a particular area of India. In some recent efforts, expert system based text animation
has been proposed for diagnosis of most common diseases occurring in Indian mango [5]. This work
also uses picture based system alongwith the text query for easier understanding of the disease
symptoms. Though, it is a good initiative for Indian farmer, but limited to a particular fruit. Another
notable work was mobile based multimedia social networking platform – GappaGoshti for
information and advice exchange, proposed by Lobo et al. [6]. Ramamritham et al. [7] design an
online multilingual, multimedia based forum for common man of India. However, those forums and
social networking platforms provide limited number of information as compared to the internet.
Moreover, quality of information may not be up to the mark, so illiterate people are unable to get any
information from there. To overcome the limitation of illiteracy, Samanta et al. [2] proposed and
multimodal interface for the Indian common man. However, the iconic module of this work is not
related to the agricultural domain. Other works [8, 9] also highlight the need of a systematic
approach which is required to provide the precise information to farming opportunity. Moreover, not
only providing of the information to farmer, it is also essential to identify that how the farmers are
motivated toward accessing the information [10]. All the aforementioned observations motivate us to
conduct in depth research toward making an interface for Indian farmer community, which will be
more useable, systematical, and needful for them irrespective of language and technical proficiency.
Here, we propose an iconic interface integrated with a text to speech (TTS) engine to access the
agricultural information from the internet’s global repository for Indian farmer community. Further,
we also integrate a local repository with the interface to access urgent information without
connecting the internet.

8

2.SYSTEM ANALYSIS

2.1 EXISTING SYSTEM:
In the existing system Farmers, as well as agriculture, are the foundation of life. Numerous work has
been done towards the enhancement of agriculture by developing technologies that support directly
and indirectly to agriculture. A range of research shows that with the various enhancements in the
field of ICT (Information and Communication Technologies), the farmers are unable to take its
advantage and fail to get the proper sale value for their crops. An interface that benefited the farmers
by providing the information related to the advancement of agriculture techniques. Various technical
approaches made in agriculture, mostly in the field of food and supply chain management. The
incorporation of blockchain technology in agriculture has improved the efficiency of the agriculture
supply chain by reducing the need for verification of data. However, the technology proposed
benefited only the producers in terms of maintaining the accuracy of data for supply.
DISADVANTAGES OF EXISTING SYSTEM:
 Transaction depends on third party.
 Data stored in local servers it means data may be not secure.
2.2 PROPOSED SYSTEM:
The Proposed Farmer’s portal is a single gateway through which the e-commerce activity of crops
can be performed. The users’ experience of the portal can be tailored according to the individual
need. It is a single access point i.e., everything is in a single place, the only thing needed is single
login to approved users.
User: A user can be a buyer or a seller. The seller may be a farmer or a representative of him.
Device: The user can interact through the portal using a computer or a laptop. Interface: To access
the portal, the user needs to register using a sign-up. The registered user logins using the correct
credentials. Once the user signs in successfully. The user will have access to the portal/ interface. A
user can view available items that are crops and seeds with their price.
9

ADVANTAGES OF PROPOSED SYSTEM:
The buyer can buy a product and can search for any product according to the requirement.
They can add the product in cart.
The seller can add a new item, update the existing items, allot and update the price of the
item.
Purchasing an item is considered as a transaction and is added to the blockchain accordingly
with the correct unique digital signature and timestamp so that any user cannot deny the
activity done by them.
2.3 FEASIBILITY 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.
Three key considerations involved in the feasibility analysis are,
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.
10

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.
3. SYSTEM DESIGN
3.1 DEFINITION
The most creative and challenging face of the system development is System Design. It provides the
understanding and procedural details necessary for the logical and physical stages of development. In
designing a new system, the system analyst must have a clear understanding of the objectives, which
the design is aiming to fulfill. The first step is to determine how the output is to be produced and in
what format. Second, input data and master files have to be designed to meet the requirements of the
proposed output. The operational phases are handled through program construction and testing.
Design of the system can be defined as a process of applying various techniques and principles for
the purpose of defining a device, a process or a system in sufficient detail to permit its physical
realization. Thus, system design is a solution to “how to” approach to the creation of a new system.
This important phase provides the understanding and the procedural details necessary for
implementing the system recommended in the feasibility study. The design step provides a data
design, architectural design, and a procedural design

3.2 OUTPUT DESIGN
A quality output is one, which meets the requirements of the end user and presents the information
clearly. In any system results of processing are communicated to the users and to other system
through outputs. In output design it is determined how the information is to be displaced for
immediate need and also the hard copy output. It is the most important and direct source information
to the user. Efficient and intelligent output design improves the system’s relationship to help user
decision-making.
11

1. Designing computer output should proceed in an organized, well thought out manner; the right
output must be developed while ensuring that each output element is designed so that people will
find the system can use easily and effectively. When analysis design computer output, they should
Identify the specific output that is needed to meet the requirements.
2.Select methods for presenting information.
3.Create document, report, or other formats that contain information produced by the system.
The output form of an information system should accomplish one or more of the following
objectives.
Convey information about past activities, current status or projections of the  Future.
Signal important events, opportunities, problems, or warnings.
Trigger an action.
Confirm an action.

3.3 INPUT DESIGN
The input design is the link between the information system and the user. It comprises the
developing specification and procedures for data preparation and those steps are necessary to put
transaction data in to a usable form for processing can be achieved by inspecting the computer to
read data from
written or printed document or it can occur by having people keying the data directly into the system.
The design of input focuses on controlling the amount of input required, controlling the errors,
avoiding delay, avoiding extra steps and keeping the process simple. The input is designed in such a
way so that it provides security and ease of use with retaining the privacy. Input Design considered
the following things:
What data should be given as input?
How the data should be arranged or coded?
The dialog to guide the operating personnel in providing input.
Methods for preparing input validations and steps to follow when error occur.
OBJECTIVES
1.Input Design is the process of converting a user-oriented description of the input into a computer-
based system. This design is important to avoid errors in the data input process and show the correct
direction to the management for getting correct information from the computerized system.
12

2. It is achieved by creating user-friendly screens for the data entry to handle large volume of data.
The goal of designing input is to make data entry easier and to be free from errors. The data entry
screen is designed in such a way that all the data manipulates can be performed. It also provides
record viewing facilities.
3.When the data is entered it will check for its validity. Data can be entered with the help of screens.
Appropriate messages are provided as when needed so that the user will not be in maize of instant.
Thus the objective of input design is to create an input layout that is easy to follow
3.4 SYSTEM ARCHITECTURE
13

Fig: 1 System Architecture

14

3.5 DATA FLOW DIAGRAMS:
The DFD is also called as bubble chart. It is a simple graphical formalism that can be used to
represent a system in terms of input data to the system, various processing carried out on this
data, and the output data is generated by this system.
The data flow diagram (DFD) is one of the most important modeling tools. It is used to model the
system components. These components are the system process, the data used by the process, an
external entity that interacts with the system and the information flows in the system.
DFD shows how the information moves through the system and how it is modified by a series of
transformations. It is a graphical technique that depicts information flow and the transformations
that are applied as data moves from input to output.
DFD is also known as bubble chart. A DFD may be used to represent a system at any level of
abstraction. DFD may be partitioned into levels that represent increasing information flow and
functional detail.
Fig: 2 Data Flow Diagram
15

3.6 UML DIAGRAMS
UML stands for Unified Modelling Language. UML is a standardized general-purpose modeling
language in the field of object-oriented software engineering. The standard is managed, and was
created by, the Object Management Group.
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. In the future, some form of method or process may also be added to; or associated with,
UML.
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 modelling language.
Encourage the growth of OO tools market.
Support higher level development concepts such as collaborations, frameworks, patterns and
components.
Integrate best practices.
16

SEQUENCE DIAGRAM:
A sequence diagram in Unified Modeling Language (UML) is a kind of interaction diagram that
shows how processes operate with one another and in what order. It is a construct of a Message
Sequence Chart. Sequence diagrams are sometimes called event diagrams, event scenarios, and
timing diagrams.

17

Fig: 3 Sequence Diagram
CLASS DIAGRAM:
In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static
structure diagram that describes the structure of a system by showing the system's classes, their
attributes, operations (or methods), and the relationships among the classes. It explains which class
contains information.
18

Fig: 4 Class Diagram
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.
Fig: 5 Use-Case Diagram
ACTIVITY DIAGRAM
Activity diagrams are graphical representations of workflows of stepwise activities and actions with
support for choice, iteration and concurrency. In the Unified Modelling Language, activity diagrams
19

can be used to describe the business and operational step-by-step workflows of components in a
system. An activity diagram shows the overall flow of control.

Fig: 6 Activity Diagram
20

3.7 DATA DICTIONARY:
BLOCKCHAIN TRANSACTIONS:
id
c_sende
r
c_recipie
nt
c_amountc_previous_hash
p_timesta
mp
p_sen
der
p_reci
pient
p_amount
35harish
HDFC
Bank
50.0
38e7551d6e22862e8
89bbcf688ba339cdb5
c840dbb8c412caa7b
796194ac5e10
p_timestam
p
p_sen
der
p_recipi
ent
p_amount
36harish
HDFC
Bank
300.0
9e03e15112b4a62cb
d43149078bcc8d80c
9e93da24e81519be5
724226243f0ea
1602325602
.7917922
harish
HDFC
Bank
50.0
37ramesh
Canara
Bank
495.0
ae83dcd03eda83691
aa254c9ce68231a29a
aa297f2a43ad775475
cfdcda07535
1602325649
.1655002
harish
HDFC
Bank
300.0
38ramesh
Canara
Bank
25.0
b79d3f83920ab7c4f7
db34e8d2b60dc358b
8b8c4add57138e798
b85658e41cce
p_timestam
p
p_sen
der
p_recipi
ent
p_amount
39meghanaSBI Bank534.9
958f8b110a19efef98
570c691e106893399
4cbabac89e5d8dd8a
ad39d07b3812
p_timestam
p
p_sen
der
p_recipi
ent
p_amount
40meghanaSBI Bank534.9
62370fb334e5c713cc
275187f2c49c09b1f3
d03d9629fc7f6940f4f
a560e83a4
1602329385
.0400195
megh
ana
SBI
Bank
534.9
21

41meghanaSBI Bank35.0
b90370042542617a9
d526e8bf202073012
9526ed8eb3d69a94fc
c27c7121bc86
1602329385
.4627755
megh
ana
SBI
Bank
534.9
42bbb
Chase
Bank
100.0
032df54b0893fbaa56
77a171f3a25c8ab598
09ada53a30e39d019
0a03167ad2e
p_timestam
p
p_sen
der
p_recipi
ent
p_amount
BUYER CART TABLE:
id
buyeruserna
me
buyeruseremail
sellernam
e
cropname
descriptio
n
pricestatus
1meghana
[email protected]
om
alex Tomato
A red
Tomato For
Health
25.0purchased
3meghana
[email protected]
om
alex
STRAWBERR
Y
A great
Choice if
you have
150.0purchased
4meghana
[email protected]
om
alex Green Beans
Healthy
Diet
95.0purchased
6meghana
[email protected]
om
sagar CARROTS
Best For
Health
89.9purchased
7meghana
[email protected]
om
alex Tomato
A red
Tomato For
Health
25.0purchased
8harish
[email protected]
om
alex Tomato
A red
Tomato For
Health
25.0purchased
9harish
[email protected]
om
alex Tomato
A red
Tomato For
Health
25.0purchased
10ramesh [email protected] alex Green BeansHealty Diet95.0purchased
11ramesh [email protected] alex
STRAWBERR
Y
A great
Choice if
you have
150.0purchased
12ramesh [email protected] sagar BROCOLLI
A new
Choice To
Digest
250.0purchased
13meghana
[email protected]
om
alex
STRAWBERR
Y
A great
Choice if
you have
150.0purchased
14harish [email protected] STRAWBERRA great 150.0purchased
22

om Y
Choice if
you have
15harish
[email protected]
om
alex
STRAWBERR
Y
A great
Choice if
you have
150.0purchased
16ramesh [email protected] alex Tomato
A red
Tomato For
Health
25.0purchased
17ramesh [email protected] sagar CARROTS
Best For
Health
89.9waiting
18meghana
[email protected]
om
sravani Onion
A
Maharstra
onion
35.0purchased
19haseeb
mohdabdulhaseeb@gmail.
com
adnan Apple
100%
Natural
100.0waiting
20haseeb
mohdabdulhaseeb@gmail.
com
adnan Apple
100%
Natural
100.0waiting
21bbb [email protected] aaa Apple
100%
Natural
100.0purchased
BUYER TRANSACTION TABLE:
idbuyernametotalamountrecipientnamecardnumber nameoncardcvvcardexpiry
35harish 50.0HDFC Bank 2500458096963652
Harish
Gangishetti
6452022-12
36harish 300.0HDFC Bank 2512898965653214Rashna 2562029-01
37ramesh 495.0Canara Bank 4589100250026001
Arumalla
kattamma
5682022-12
38ramesh 25.0Canara Bank 2500787895951001Suresh 2562021-12
39meghana 534.9SBI Bank 2560123489892525Arumalla 2562022-01
40meghana 534.9SBI Bank 2560123489892525Arumalla 2562022-01
41meghana 35.0SBI Bank 5890123589745658Susritha 2472022-01
42bbb 100.0Chase Bank 9870768546739998bbb 4352022-12
BUYER REGISTRATIONS:
idnameloginidpassword mobileaddress city state status
1
Megha
na
meghanaMeghana@141 9566089897
#201,
Moulana
Steets
VijayawadaAndhrapradeshactivated
2HarishharishHarish@141 9568878789#303 NewMarkapuramAndhrapradeshactivated
3RameshrameshRamesh@141 9849045458# new Hyderabd Telangana activated
23

Vakilpally
Flots, 10-
25,
Centanary
Colony
4haseebhaseebHaseeb123 9700493122Abcd HyderabadTelangana activated
5bbb bbb Buyer@123 9701319983abcd hyderabadtelangana activated
FARMER CROPS:
idsellername selleremail cropnamepricedescription cdate
1alex [email protected] Tomato 25.0
A red Tomato
For Helth
2020-10-09
05:31:16.073617
2alex [email protected] Green Beans95.0Healty Diet
2020-10-09
05:32:30.864581
3alex [email protected] STRAWBERRY150.0
A great Choice
ifyou have
2020-10-09
05:33:06.761501
4sagar [email protected] BROCOLLI 250.0
A new Choice To
Digest
2020-10-09
05:36:03.449656
5sagar [email protected] CARROTS 89.9Best For Health
2020-10-09
05:36:42.967998
7sravani [email protected] Onion 35.0
A Maharstra
onion
2020-10-10
11:28:52.581144
8adnan [email protected] Apple 100.0100% Natural
2022-05-21
05:06:10.000300
9aaa
[email protected]
om
Apple 100.0100% Natural
2022-05-30
05:09:55.830805
SELLER REGISTRATIONS:
idnameloginidpassword mobile address city statestatus
1alexalex Alex@141 9849098490#303, East StreetsHyderabad Telanganaactivated
2SagarsagarSagarbabu@1419700596968#302, madinaguda
Godavarikhan
i
Telanganaactivated
3sravanisravaniSravani@141 9849012345#303, Noida Warangal Telanganaactivated
4adnanadnanAdnan123 9701319983abcd hyderabad telanganaactivated
5aaa aaa Seller@123 9700493122hyd hyd ts activated
6faisalfaisalFaisal@123 9700456789abcd hyderBAD telanganaactivated
24

4.SYSTEM SPECIFICATIONS
4.1 Hardware Specification:-
System : Intel i3
Hard Disk : 1 TB.
Monitor : 14’ Colour Monitor.
Mouse : Optical Mouse.
Ram : 4GB.


4.2 Software Specification:-
Operating system : Windows 10.
Coding Language : Python.
Front-End : Html,CSS.
Designing : Html,css,javascript.
Data Base : SQLite.

25

5.OVERVIEW OF LANGUAGE
PYTHON
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming
language. An interpreted language, Python has a design philosophy that emphasizes
code readability (notably using whitespace indentation to delimit code blocks rather than curly
brackets or keywords), and a syntax that allows programmers to express concepts in fewer lines of
code than might be used in languages such as C++or Java. It provides constructs that enable clear
programming on both small and large scales. Python interpreters are available for many operating
systems. CPython, the reference implementation of Python, is open source software and has a
community-based development model, as do nearly all of its variant implementations. CPython is
managed by the non-profit Python Software Foundation. Python features a dynamic type system and
automatic memory management. It supports multiple programming paradigms, including object-
oriented, imperative, functional and procedural, and has a large and comprehensive standard library.
Interactive Mode Programming
Invoking the interpreter without passing a script file as a parameter brings up the following prompt −
$ python
Python 2.4.3 (#1, Nov 11 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Type the following text at the Python prompt and press the Enter −
>>> print "Hello, Python!"
If you are running new version of Python, then you would need to use print statement with
parenthesis as in print ("Hello, Python!");. However in Python version 2.4.3, this produces the
following result −
26

Hello, Python!
Script Mode Programming
Invoking the interpreter with a script parameter begins execution of the script and continues until the
script is finished. When the script is finished, the interpreter is no longer active.
Let us write a simple Python program in a script. Python files have extension .py. Type the following
source code in a test.py file −
Live Demo
print "Hello, Python!"
We assume that you have Python interpreter set in PATH variable. Now, try to run this program as
follows −
$ python test.py
This produces the following result −
Hello, Python!
Let us try another way to execute a Python script. Here is the modified test.py file −
Live Demo
#!/usr/bin/python
print "Hello, Python!"
We assume that you have Python interpreter available in /usr/bin directory. Now, try to run this
program as follows −
$ chmod +x test.py # This is to make file executable
$./test.py
This produces the following result −
27

Hello, Python!
Python Identifiers
A Python identifier is a name used to identify a variable, function, class, module or other object. An
identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters,
underscores and digits (0 to 9).
Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case
sensitive programming language. Thus, Manpower and manpower are two different identifiers in
Python.
Here are naming conventions for Python identifiers −
Class names start with an uppercase letter. All other identifiers start with a lowercase letter.
Starting an identifier with a single leading underscore indicates that the identifier is private.
Starting an identifier with two leading underscores indicates a strongly private identifier.
If the identifier also ends with two trailing underscores, the identifier is a language-defined special
name.
Reserved Words
The following list shows the Python keywords. These are reserved words and you cannot use them as
constant or variable or any other identifier names. All the Python keywords contain lowercase letters
only.
andexecnot
28

assertfinallyor
breakforpass
classfromprint
continue globalraise
defif return
delimporttry
elifin while
elseis with
exceptlambdayield
Lines and Indentation
Python provides no braces to indicate blocks of code for class and function definitions or flow
control. Blocks of code are denoted by line indentation, which is rigidly enforced.
The number of spaces in the indentation is variable, but all statements within the block must be
indented the same amount. For example −
if True:
print "True"
else:
print "False"
However, the following block generates an error −
if True:
print "Answer"
print "True"
else:
print "Answer"
print "False"
Thus, in Python all the continuous lines indented with same number of spaces would form a block.
The following example has various statement blocks −
Note − Do not try to understand the logic at this point of time. Just make sure you understood various
blocks even if they are without braces.
29

#!/usr/bin/python
import sys
try:
# open file stream
file = open(file_name, "w")
except IOError:
print "There was an error writing to", file_name
sys.exit()
print "Enter '", file_finish,
print "' When finished"
while file_text != file_finish:
file_text = raw_input("Enter text: ")
if file_text == file_finish:
# close the file
file.close
break
file.write(file_text)
file.write("\n")
file.close()
file_name = raw_input("Enter filename: ")
if len(file_name) == 0:
print "Next time please enter something"
sys.exit()
try:
file = open(file_name, "r")
except IOError:
print "There was an error reading file"
sys.exit()
file_text = file.read()
file.close()
print file_text
Multi-Line Statements
30

Statements in Python typically end with a new line. Python does, however, allow the use of the line
continuation character (\) to denote that the line should continue. For example −
total = item_one + \
item_two + \
item_three
Statements contained within the [], {}, or () brackets do not need to use the line continuation
character. For example −
days = ['Monday', 'Tuesday', 'Wednesday',
'Thursday', 'Friday']
Quotation in Python
Python accepts single ('), double (") and triple (''' or """) quotes to denote string literals, as long as the
same type of quote starts and ends the string.
The triple quotes are used to span the string across multiple lines. For example, all the following are
legal −
word = 'word'
sentence = "This is a sentence."
paragraph = """This is a paragraph. It is
made up of multiple lines and sentences."""
Comments in Python
A hash sign (#) that is not inside a string literal begins a comment. All characters after the # and up to
the end of the physical line are part of the comment and the Python interpreter ignores them.
Live Demo
#!/usr/bin/python
# First comment
print "Hello, Python!" # second comment
This produces the following result −
Hello, Python!
31

You can type a comment on the same line after a statement or expression −
name = "Madisetti" # This is again comment
You can comment multiple lines as follows −
# This is a comment.
# This is a comment, too.
# This is a comment, too.
# I said that already.
Following triple-quoted string is also ignored by Python interpreter and can be used as a multiline
comments:
'''
This is a multiline
comment.
'''
Using Blank Lines
A line containing only whitespace, possibly with a comment, is known as a blank line and Python
totally ignores it.
In an interactive interpreter session, you must enter an empty physical line to terminate a multiline
statement.
Waiting for the User
The following line of the program displays the prompt, the statement saying “Press the enter key to
exit”, and waits for the user to take action −
#!/usr/bin/python
raw_input("\n\nPress the enter key to exit.")
Here, "\n\n" is used to create two new lines before displaying the actual line. Once the user presses
the key, the program ends. This is a nice trick to keep a console window open until the user is done
with an application.
Multiple Statements on a Single Line
The semicolon ( ; ) allows multiple statements on the single line given that neither statement starts a
new code block. Here is a sample snip using the semicolon.
32

import sys; x = 'foo'; sys.stdout.write(x + '\n')
Multiple Statement Groups as Suites
A group of individual statements, which make a single code block are called suites in Python.
Compound or complex statements, such as if, while, def, and class require a header line and a suite.
Header lines begin the statement (with the keyword) and terminate with a colon ( : ) and are followed
by one or more lines which make up the suite. For example −
if expression :
suite
elif expression :
suite
else :
suite
Command Line Arguments
Many programs can be run to provide you with some basic information about how they should be
run. Python enables you to do this with -h −
$ python -h
usage: python [option] ... [-c cmd | -m mod | file | -] [arg] ...
Options and arguments (and corresponding environment variables):
-c cmd : program passed in as string (terminates option list)
-d : debug output from parser (also PYTHONDEBUG=x)
-E : ignore environment variables (such as PYTHONPATH)
-h : print this help message and exit
You can also program your script in such a way that it should accept various options. Command Line
Arguments is an advanced topic and should be studied a bit later once you have gone through rest of
the Python concepts.
Python Lists
The list is a most versatile datatype available in Python which can be written as a list of comma-
separated values (items) between square brackets. Important thing about a list is that items in a list
need not be of the same type.
33

Creating a list is as simple as putting different comma-separated values between square brackets. For
example −
list1 = ['physics', 'chemistry', 1997, 2000];
list2 = [1, 2, 3, 4, 5 ];
list3 = ["a", "b", "c", "d"]
Similar to string indices, list indices start at 0, and lists can be sliced, concatenated and so on.
A tuple is a sequence of immutable Python objects. Tuples are sequences, just like lists. The
differences between tuples and lists are, the tuples cannot be changed unlike lists and tuples use
parentheses, whereas lists use square brackets.
Creating a tuple is as simple as putting different comma-separated values. Optionally you can put
these comma-separated values between parentheses also. For example −
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5 );
tup3 = "a", "b", "c", "d";
The empty tuple is written as two parentheses containing nothing −
tup1 = ();
To write a tuple containing a single value you have to include a comma, even though there is only
one value −
tup1 = (50,);
Like string indices, tuple indices start at 0, and they can be sliced, concatenated, and so on.
Accessing Values in Tuples
To access values in tuple, use the square brackets for slicing along with the index or indices to obtain
value available at that index. For example −
Live Demo
#!/usr/bin/python
tup1 = ('physics', 'chemistry', 1997, 2000);
tup2 = (1, 2, 3, 4, 5, 6, 7 );
34

print "tup1[0]: ", tup1[0];
print "tup2[1:5]: ", tup2[1:5];
When the above code is executed, it produces the following result −
tup1[0]: physics
tup2[1:5]: [2, 3, 4, 5]
Updating Tuples
Accessing Values in Dictionary
To access dictionary elements, you can use the familiar square brackets along with the key to obtain
its value. Following is a simple example –
Live Demo
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
print "dict['Name']: ", dict['Name']
print "dict['Age']: ", dict['Age']
When the above code is executed, it produces the following result −
dict['Name']: Zara
dict['Age']: 7
If we attempt to access a data item with a key, which is not part of the dictionary, we get an error as
follows −
Live Demo
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
print "dict['Alice']: ", dict['Alice']
When the above code is executed, it produces the following result −
dict['Alice']:
Traceback (most recent call last):
File "test.py", line 4, in <module>
print "dict['Alice']: ", dict['Alice'];
35

KeyError: 'Alice'
Updating Dictionary
You can update a dictionary by adding a new entry or a key-value pair, modifying an existing entry,
or deleting an existing entry as shown below in the simple example −
Live Demo
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
dict['Age'] = 8; # update existing entry
dict['School'] = "DPS School"; # Add new entry
print "dict['Age']: ", dict['Age']
print "dict['School']: ", dict['School']
When the above code is executed, it produces the following result −
dict['Age']: 8
dict['School']: DPS School
Delete Dictionary Elements
You can either remove individual dictionary elements or clear the entire contents of a dictionary.
You can also delete entire dictionary in a single operation.
To explicitly remove an entire dictionary, just use the del statement. Following is a simple example −
Live Demo
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Class': 'First'}
del dict['Name']; # remove entry with key 'Name'
dict.clear(); # remove all entries in dict
del dict ; # delete entire dictionary
36

print "dict['Age']: ", dict['Age']
print "dict['School']: ", dict['School']
This produces the following result. Note that an exception is raised because after del dict dictionary
does not exist any more −
dict['Age']:
Traceback (most recent call last):
File "test.py", line 8, in <module>
print "dict['Age']: ", dict['Age'];
TypeError: 'type' object is unsubscriptable
Note − del() method is discussed in subsequent section.
Properties of Dictionary Keys
Dictionary values have no restrictions. They can be any arbitrary Python object, either standard
objects or user-defined objects. However, same is not true for the keys.
There are two important points to remember about dictionary keys −
(a) More than one entry per key not allowed. Which means no duplicate key is allowed. When
duplicate keys encountered during assignment, the last assignment wins. For example −
Live Demo
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7, 'Name': 'Manni'}
print "dict['Name']: ", dict['Name']
When the above code is executed, it produces the following result −
dict['Name']: Manni
(b) Keys must be immutable. Which means you can use strings, numbers or tuples as dictionary keys
but something like ['key'] is not allowed. Following is a simple example −
37

Live Demo
#!/usr/bin/python
dict = {['Name']: 'Zara', 'Age': 7}
print "dict['Name']: ", dict['Name']
When the above code is executed, it produces the following result −
Traceback (most recent call last):
File "test.py", line 3, in <module>
dict = {['Name']: 'Zara', 'Age': 7};
TypeError: unhashable type: 'list'
Tuples are immutable which means you cannot update or change the values of tuple elements. You
are able to take portions of existing tuples to create new tuples as the following example
demonstrates −
Live Demo
#!/usr/bin/python
tup1 = (12, 34.56);
tup2 = ('abc', 'xyz');
# Following action is not valid for tuples
# tup1[0] = 100;
# So let's create a new tuple as follows
tup3 = tup1 + tup2;
print tup3;
When the above code is executed, it produces the following result −
(12, 34.56, 'abc', 'xyz')
Delete Tuple Elements
Removing individual tuple elements is not possible. There is, of course, nothing wrong with putting
together another tuple with the undesired elements discarded.
38

To explicitly remove an entire tuple, just use the del statement. For example −
Live Demo
#!/usr/bin/python
tup = ('physics', 'chemistry', 1997, 2000);
print tup;
del tup;
print "After deleting tup : ";
print tup;
This produces the following result. Note an exception raised, this is because after del tup tuple does
not exist any more −
('physics', 'chemistry', 1997, 2000)
After deleting tup :
Traceback (most recent call last):
File "test.py", line 9, in <module>
print tup;
NameError: name 'tup' is not defined
DJANGO
Django is a high-level Python Web framework that encourages rapid development and clean,
pragmatic design. Built by experienced developers, it takes care of much of the hassle of Web
development, so you can focus on writing your app without needing to reinvent the wheel. It’s free
and open source.
Django's primary goal is to ease the creation of complex, database-driven websites. Django
emphasizes reusabilityand "pluggability" of components, rapid development, and the principle
of don't repeat yourself. Python is used throughout, even for settings files and data models.
39

Django also provides an optional administrative create, read, update and delete interface that is
generated dynamically through introspection and configured via admin models
Create a Project
Whether you are on Windows or Linux, just get a terminal or a cmd prompt and navigate to the place
you want your project to be created, then use this code −
$ django-admin startproject myproject
This will create a "myproject" folder with the following structure −
40

myproject/
manage.py
myproject/
__init__.py
settings.py
urls.py
wsgi.py
The Project Structure
The “myproject” folder is just your project container, it actually contains two elements −
manage.py − This file is kind of your project local django-admin for interacting with your project via
command line (start the development server, sync db...). To get a full list of command accessible via
manage.py you can use the code −
$ python manage.py help
The “myproject” subfolder − This folder is the actual python package of your project. It contains four
files −
__init__.py − Just for python, treat this folder as package.
settings.py − As the name indicates, your project settings.
urls.py − All links of your project and the function to call. A kind of ToC of your project.
wsgi.py − If you need to deploy your project over WSGI.
Setting Up Your Project
Your project is set up in the subfolder myproject/settings.py. Following are some important options
you might need to set −
DEBUG = True
41

This option lets you set if your project is in debug mode or not. Debug mode lets you get more
information about your project's error. Never set it to ‘True’ for a live project. However, this has to
be set to ‘True’ if you want the Django light server to serve static files. Do it only in the development
mode.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'database.sql',
'USER': '',
'PASSWORD': '',
'HOST': '',
'PORT': '',
}
}
Database is set in the ‘Database’ dictionary. The example above is for SQLite engine. As stated
earlier, Django also supports −
MySQL (django.db.backends.mysql)
PostGreSQL (django.db.backends.postgresql_psycopg2)
Oracle (django.db.backends.oracle) and NoSQL DB
MongoDB (django_mongodb_engine)
Before setting any new engine, make sure you have the correct db driver installed.
You can also set others options like: TIME_ZONE, LANGUAGE_CODE, TEMPLATE…
Now that your project is created and configured make sure it's working −
$ python manage.py runserver
You will get something like the following on running the above code −
Validating models...
42

0 errors found
September 03, 2015 - 11:41:50
Django version 1.6.11, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
A project is a sum of many applications. Every application has an objective and can be reused into
another project, like the contact form on a website can be an application, and can be reused for
others. See it as a module of your project.
Create an Application
We assume you are in your project folder. In our main “myproject” folder, the same folder then
manage.py −
$ python manage.py startapp myapp
You just created myapp application and like project, Django create a “myapp” folder with the
application structure −
myapp/
__init__.py
admin.py
models.py
tests.py
views.py
__init__.py − Just to make sure python handles this folder as a package.
admin.py − This file helps you make the app modifiable in the admin interface.
models.py − This is where all the application models are stored.
tests.py − This is where your unit tests are.
views.py − This is where your application views are.
43

Get the Project to Know About Your Application
At this stage we have our "myapp" application, now we need to register it with our Django project
"myproject". To do so, update INSTALLED_APPS tuple in the settings.py file of your project (add
your app name) −
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'myapp',
)
Creating forms in Django, is really similar to creating a model. Here again, we just need to inherit
from Django class and the class attributes will be the form fields. Let's add a forms.py file in myapp
folder to contain our app forms. We will create a login form.
myapp/forms.py
#-*- coding: utf-8 -*-
from django import forms
class LoginForm(forms.Form):
user = forms.CharField(max_length = 100)
password = forms.CharField(widget = forms.PasswordInput())
As seen above, the field type can take "widget" argument for html rendering; in our case, we want
the password to be hidden, not displayed. Many others widget are present in Django: DateInput for
dates, CheckboxInput for checkboxes, etc.
Using Form in a View
44

There are two kinds of HTTP requests, GET and POST. In Django, the request object passed as
parameter to your view has an attribute called "method" where the type of the request is set, and all
data passed via POST can be accessed via the request.POST dictionary.
Let's create a login view in our myapp/views.py −
#-*- coding: utf-8 -*-
from myapp.forms import LoginForm
def login(request):
username = "not logged in"

if request.method == "POST":
#Get the posted form
MyLoginForm = LoginForm(request.POST)

if MyLoginForm.is_valid():
username = MyLoginForm.cleaned_data['username']
else:
MyLoginForm = Loginform()
return render(request, 'loggedin.html', {"username" : username})
The view will display the result of the login form posted through the loggedin.html. To test it, we
will first need the login form template. Let's call it login.html.
<html>
<body>

<form name = "form" action = "{% url "myapp.views.login" %}"
method = "POST" >{% csrf_token %}

<div style = "max-width:470px;">
<center>
<input type = "text" style = "margin-left:20%;"
45

placeholder = "Identifiant" name = "username" />
</center>
</div>
<br>

<div style = "max-width:470px;">
<center>
<input type = "password" style = "margin-left:20%;"
placeholder = "password" name = "password" />
</center>
</div>
<br>

<div style = "max-width:470px;">
<center>

<button style = "border:0px; background-color:#4285F4; margin-top:8%;
height:35px; width:80%;margin-left:19%;" type = "submit"
value = "Login" >
<strong>Login</strong>
</button>

</center>
</div>

</form>

</body>
</html>
The template will display a login form and post the result to our login view above. You have
probably noticed the tag in the template, which is just to prevent Cross-site Request Forgery (CSRF)
attack on your site.
46

{% csrf_token %}
Once we have the login template, we need the loggedin.html template that will be rendered after
form treatment.
<html>

<body>
You are : <strong>{{username}}</strong>
</body>

</html>
Now, we just need our pair of URLs to get started: myapp/urls.py
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
urlpatterns = patterns('myapp.views',
url(r'^connection/',TemplateView.as_view(template_name = 'login.html')),
url(r'^login/', 'login', name = 'login'))
When accessing "/myapp/connection", we will get the following login.html template rendered −
Setting Up Sessions
In Django, enabling session is done in your project settings.py, by adding some lines to the
MIDDLEWARE_CLASSES and the INSTALLED_APPS options. This should be done while
creating the project, but it's always good to know, so MIDDLEWARE_CLASSES should have −
'django.contrib.sessions.middleware.SessionMiddleware'
And INSTALLED_APPS should have −
'django.contrib.sessions'
By default, Django saves session information in database (django_session table or collection), but
you can configure the engine to store information using other ways like: in file or in cache.
47

When session is enabled, every request (first argument of any view in Django) has a session (dict)
attribute.
Let's create a simple sample to see how to create and save sessions. We have built a simple login
system before (see Django form processing chapter and Django Cookies Handling chapter). Let us
save the username in a cookie so, if not signed out, when accessing our login page you won’t see the
login form. Basically, let's make our login system we used in Django Cookies handling more secure,
by saving cookies server side.
For this, first lets change our login view to save our username cookie server side −
def login(request):
username = 'not logged in'

if request.method == 'POST':
MyLoginForm = LoginForm(request.POST)

if MyLoginForm.is_valid():
username = MyLoginForm.cleaned_data['username']
request.session['username'] = username
else:
MyLoginForm = LoginForm()
return render(request, 'loggedin.html', {"username" : username}
Then let us create formView view for the login form, where we won’t display the form if cookie is
set −
def formView(request):
if request.session.has_key('username'):
username = request.session['username']
return render(request, 'loggedin.html', {"username" : username})
else:
return render(request, 'login.html', {})
Now let us change the url.py file to change the url so it pairs with our new view −
48

from django.conf.urls import patterns, url
from django.views.generic import TemplateView
urlpatterns = patterns('myapp.views',
url(r'^connection/','formView', name = 'loginform'),
url(r'^login/', 'login', name = 'login'))
When accessing /myapp/connection, you will get to see the following page

49

6.IMPLEMENTATION
6.1 System M 6.1 SYSTEM MODULES:
Sellers
Buyers
Admins
Blockchain
MODULES DESCRIPTION:
Sellers:
The Seller User can register the first. While registering he required a valid user email and mobile for
further communications. Once the user register then admin can activate the Sellers. Once admin
activated the Seller then he/She can login into our system. The seller can add a new item, update the
existing items, allot and update the price of the item. It will increase the market reach and will also
eliminate the middleman.
Buyers:
The Seller User can register the first. While registering he required a valid user email and mobile for
further communications. Once the user register then admin can activate the Sellers. Once admin
activated the Seller then he/She can login into our system. The buyer can buy a product and can
search for any product according to the requirement. They can add the product in cart and delete crop
from the cart. After finalizing the product to buy and verifying the cart user can check out.
Admin:
Admin can login with his credentials. Once he login he can activate the sellers and buyers. The
activated user only login in our applications. The admin user can view the all transaction which is
done by buyer user. In the admin frame can view all block chain transaction with its previous block
details and hash values.
Blockchain:
Every activity related to introducing a new item and purchasing an item is considered as a transaction
and is added to the blockchain accordingly with the correct unique digital signature and timestamp so
that any user cannot deny the activity done by them. All these transactions are visible to everyone in
50

the network. The blockchain is a peer to peer transaction based on distributed node systems by
means of data encryption, time stamping and consensus. It makes the portal more secure at the data
as it is immutable, transparent and accessible to all.
6.2 PROPOSED ALGORITHMS:
There are many consensus algorithms available for any blockchain. Each algorithm has their own
principle and can be used as per the nature of the blockchain.
Let’s have a look at various blockchain algorithms and how they work – 
PoW – PoW stands for Proof of Work. It was introduced in 1993 by Dwork and Naor and
reintroduced by Satoshi Nakamoto in bitcoin ledger in 2008. PoW selects a miner for generating
the next block. The idea behind PoW is to find a solution for a complex mathematical puzzle.
The miner who first solves the puzzle gets to mine the next block. This algorithm is used by
bitcoin and requires a lot of computational power for finding the solution of the puzzle.
PoS – PoS stands for Proof of Stake. PoS was introduced in 2011 as a low-cost, low-energy
consuming alternative to PoW. In PoS, miners don’t need expensive hardware for solving a
complex puzzle instead the miners lock up their coins as stake and validate the block by placing a
bet. Once a new block is added all the validators get rewarded proportionate to their bets and
increase the state accordingly. Ethereum uses this algorithm for mining.
DPoS – DPoS stands for delegated Proof-of-Stake. It was introduced by Daniel Larimer. In
DPos, delegates vote for their favourite validator to reach consensus for a new block and the
elected validator is responsible for maintaining the network and validating the transaction. In
return the validator gets rewarded with transaction fees for the work. EOS, Bitshares, Steem,
Tezos, etc use this consensus algorithm for validating transactions in the block.
PoB – PoB stands for Proof of Burn. As the name suggests, in PoB validators ‘burn’ coins by
sending them to an address where they are not recoverable. It’s on miners to burn the native
currency or any of the currency of their choice. More the number of coins a miner burns, the
higher is his chances of his selection to mine the next block. Though PoB wastes resources, PoB
is a good alternative for PoW. The only coin which uses Proof-of-Burn is Slimcoin, it uses a
combination of PoS, PoW and PoB.
PoC – PoC stands for Proof of Capacity. In Proof of Capacity algorithms, instead of burning
coins or investing in expensive hardware resources, validators are supposed to invest in  their
hard drive space. More the hard drive space validators allocate, the better are the validators
chances of getting selected for mining the next block for earning the block rewards.
6.2 Propo 6.2 SOURCE CODE
Buyer user Side views.py
from django.shortcuts import render,HttpResponse, redirect
from django.contrib import messages
from .forms import BuyerUserRegistrationForm
51

from .models import BuyerUserRegistrationModel,
BuyerCropCartModels,BuyerTransactionModels,BlockChainTransactionModel
from sellers.models import FarmersCropsModels
from .utility.BlockChainImpl import Blockchain
from django.db.models import Sum
import random
blockchain = Blockchain()
# Create your views here.
def BuyerUserRegisterActions(request):
if request.method == 'POST':
form = BuyerUserRegistrationForm(request.POST)
if form.is_valid():
print('Data is Valid')
form.save()
messages.success(request, 'You have been successfully registered')
form = BuyerUserRegistrationForm()
return render(request, 'BuyerUserRegistrations.html', {'form': form})
else:
messages.success(request, 'Email or Mobile Already Existed')
print("Invalid form")
else:
form = BuyerUserRegistrationForm()
return render(request, 'BuyerUserRegistrations.html', {'form': form})
def BuyerUserLoginCheck(request):
if request.method == "POST":
loginid = request.POST.get('loginname')
pswd = request.POST.get('pswd')
print("Login ID = ", loginid, ' Password = ', pswd)
try:
check = BuyerUserRegistrationModel.objects.get(loginid=loginid, password=pswd)
status = check.status
print('Status is = ', status)
if status == "activated":
52

request.session['id'] = check.id
request.session['loggeduser'] = check.name
request.session['loginid'] = loginid
request.session['email'] = check.email
print("User id At", check.id, status)
cartin = checkCartCount(loginid)
return render(request, 'buyers/BuyerUserHome.html', {'count':cartin})
else:
messages.success(request, 'Your Account Not at activated')
return render(request, 'BuyerLogin.html')
except Exception as e:
print('Exception is ', str(e))
pass
messages.success(request, 'Invalid Login id and password')
return render(request, 'BuyerLogin.html', {})
def BuyerUserHome(request):
loginid = request.session['loginid']
cartin = checkCartCount(loginid)
return render(request, 'buyers/BuyerUserHome.html', {'count':cartin})
def BuyerSearchProductsForm(request):
loginid = request.session['loginid']
cartin = checkCartCount(loginid)
return render(request,"buyers/BuyerSearchProducts.html",{'count':cartin})
def BuyerSearchCropsAction(request):
if request.method=='POST':
crpname = request.POST.get('cropname')
search_data = FarmersCropsModels.objects.filter(cropname__icontains=crpname)
loginid = request.session['loginid']
cartin = checkCartCount(loginid)
return render(request, 'buyers/BuyerSearchResults.html',{'data':search_data,'count':cartin})
53

def BuyerAddCropsToCart(request):
crop_id = request.GET.get('cropid')
crop = FarmersCropsModels.objects.get(id=crop_id)
sellername = crop.sellername
cropname = crop.cropname
price = crop.price
description = crop.description
file = crop.file
buyerUser = request.session['loginid']
buyeremail = request.session['email']
cartStatus = 'waiting'

BuyerCropCartModels.objects.create(buyerusername=buyerUser,buyeruseremail=buyeremail,selle
rname=sellername,cropname=cropname, description=description, price=price,
file=file,status=cartStatus)
print("Seller name ",sellername)
search_data = FarmersCropsModels.objects.filter(cropname__icontains=cropname)
cartin = checkCartCount(buyerUser)
print("Cart Count = ",cartin)
loginid = request.session['loginid']
cartin = checkCartCount(loginid)
return render(request, 'buyers/BuyerSearchResults.html', {'data': search_data,'count':cartin})
def checkCartCount(buyername):
cartin =
BuyerCropCartModels.objects.filter(buyerusername=buyername,status='waiting').count()
return cartin
def BuyyerCheckCartData(request):
buyerName =request.GET.get('buyerUser')
data = BuyerCropCartModels.objects.filter(buyerusername=buyerName, status='waiting')
54

return render(request,"buyers/BuyerCheckInCart.html",{'data':data})
def BuyerDeleteanItemfromCart(request):
cropid = request.GET.get('cropid')
BuyerCropCartModels.objects.filter(id=cropid).delete()
buyerName = request.session['loginid']
cartin = checkCartCount(buyerName)
data = BuyerCropCartModels.objects.filter(buyerusername=buyerName, status='waiting')
return render(request, "buyers/BuyerCheckInCart.html", {'data': data,'count':cartin})
def startBlockChainProcess(request):
blockchain = Blockchain()
t1 = blockchain.new_transaction("Satoshi", "Mike", '5 BTC')
blockchain.new_block(12346)
t2 = blockchain.new_transaction("Mike", "Satoshi", '1 BTC')
t3 = blockchain.new_transaction("Satoshi", "Hal Finney", '5 BTC')
blockchain.new_block(12345)
print("Genesis block: ", blockchain.chain)
return HttpResponse("Block Chain Started")
def BuyerTotalAmountCheckOut(request):
buyerName = request.GET.get('buyername')
cartstatuc = 'waiting'
total_price = BuyerCropCartModels.objects.filter(buyerusername=buyerName,
status='waiting').aggregate(Sum('price'))
total_price = total_price['price__sum']
print('Total Price ',total_price)
bank = ('SBI Bank','Union Bank','ICICI Bank','Axis Bank','Canara Bank','HDFC Bank','FDI
Bank','Chase Bank')
recipient = random.choice(bank)
return render(request, 'buyers/BuyerInitiateTransactionForm.html',
{'buyername':buyerName,'totaPrice':total_price,'bank':recipient})
def StartBlockChainTransaction(request):
55

if request.method=='POST':
## Block Chain Data
buyername = request.POST.get('buyername')
totalamount = request.POST.get('totalamount')
recipientnmae = request.POST.get('recipientnmae')
#Transaction Data
cardnumber = request.POST.get('cardnumber')
nameoncard = request.POST.get('nameoncard')
cvv = request.POST.get('cvv')
cardexpiry = request.POST.get('cardexpiry')
t1 = blockchain.new_transaction(buyername, recipientnmae, totalamount)
proofId = ''.join([str(random.randint(0, 999)).zfill(3) for _ in range(2)])
blockchain.new_block(int(proofId))
print("Genesis block: ", blockchain.chain)
print("T1 is ",t1)
currentTrnx = blockchain.chain[-1]
previousTranx = blockchain.chain[-2]
### Current Tranasction Details
c_transactions = currentTrnx.get('transactions')
c_tnx_Dict = c_transactions[0]
c_index = currentTrnx.get('index')
c_timestamp = currentTrnx.get('timestamp')
c_sender = c_tnx_Dict.get('sender')
c_recipient = c_tnx_Dict.get('recipient')
c_amount = c_tnx_Dict.get('amount')
c_proof = currentTrnx.get('proof')
c_previous_hash = currentTrnx.get('previous_hash')
c_dict_rslt =
{'c_index':c_index,'c_timestamp':c_timestamp,'c_sender':c_sender,'c_recipient':c_recipient,'c_amo
unt':c_amount,'c_proof':c_proof,'c_previous_hash':c_previous_hash}
56

# previous Transaction
p_dict_rslt = {}
p_transactions = previousTranx.get('transactions')
if(len(p_transactions)!=0):
p_tnx_Dict = p_transactions[0]
p_index = previousTranx.get('index')
p_timestamp = previousTranx.get('timestamp')
p_sender = p_tnx_Dict.get('sender')
p_recipient = p_tnx_Dict.get('recipient')
p_amount = p_tnx_Dict.get('amount')
p_proof = previousTranx.get('proof')
p_previous_hash = previousTranx.get('previous_hash')
BuyerTransactionModels.objects.create(buyername=buyername,
totalamount=totalamount,recipientname=recipientnmae,cradnumber=cardnumber,nameoncard=na
meoncard,cvv=cvv, cardexpiry=cardexpiry)
p_dict_rslt = {'p_index': p_index, 'p_timestamp': p_timestamp, 'p_sender': p_sender,
'p_recipient': p_recipient, 'p_amount': p_amount, 'p_proof': p_proof, 'p_previous_hash':
p_previous_hash}

BlockChainTransactionModel.objects.create(c_index=c_index,c_timestamp=c_timestamp,c_sende
r=c_sender,c_recipient=c_recipient,
c_amount=c_amount,c_proof=c_proof,c_previous_hash=c_previous_hash,p_index=p_index,
p_timestamp=p_timestamp,p_sender=p_sender,p_recipient=p_recipient,p_amount=p_amount,p_pr
oof=p_proof,p_previous_hash=p_previous_hash)
buyer_name = request.session['loginid']
print('buyername =',buyer_name)
qs =
BuyerCropCartModels.objects.filter(buyerusername=buyer_name).update(status='purchased')
else:
BuyerTransactionModels.objects.create(buyername=buyername, totalamount=totalamount,
recipientname=recipientnmae, cradnumber=cardnumber,
57

nameoncard=nameoncard, cvv=cvv, cardexpiry=cardexpiry)
BlockChainTransactionModel.objects.create(c_index=c_index, c_timestamp=c_timestamp,
c_sender=c_sender,
c_recipient=c_recipient, c_amount=c_amount, c_proof=c_proof,
c_previous_hash=c_previous_hash, p_index='p_index',
p_timestamp='p_timestamp', p_sender='p_sender',
p_recipient="p_recipient", p_amount="p_amount",
p_proof="p_proof",
p_previous_hash="p_previous_hash")
buyer_name = request.session['loginid']
print('buyername =', buyer_name)
qs =
BuyerCropCartModels.objects.filter(buyerusername=buyer_name).update(status='purchased')
return render(request, 'buyers/TransactionResults.html',
{'c_dict_rslt':c_dict_rslt,'p_dict_rslt':p_dict_rslt})
def BuyerViewPurchasedDetails(request):
buyer_name = request.session['loginid']
cartin = checkCartCount(buyer_name)
data = BuyerCropCartModels.objects.filter(buyerusername=buyer_name,status='purchased')
return render(request, 'buyers/BuyersViewPurchasedData.html',{'data':data,'count':cartin})
def BuyerViewTransactinDetails(request):
bd_name = request.session['loginid']
print('buyer_name',bd_name)
data = BuyerTransactionModels.objects.filter(buyername = ' '+bd_name)
cartin = checkCartCount(bd_name)
return render(request, 'buyers/BuyersViewTransactionDetails.html',{'data':data,'count':cartin})
BlockChain.py
import hashlib
import json
from time import time
58

class Blockchain(object):
def __init__(self):
self.chain = []
self.pending_transactions = []
self.new_block(previous_hash="The Times 03/Oct/2020 A Study of Blockchain Technology
in Farmer’s Portal.",proof=100)
# Create a new block listing key/value pairs of block information in a JSON object. Reset the list
of pending transactions & append the newest block to the chain.
def new_block(self, proof, previous_hash=None):
block = {
'index': len(self.chain) + 1,
'timestamp': time(),
'transactions': self.pending_transactions,
'proof': proof,
'previous_hash': previous_hash or self.hash(self.chain[-1]),
}
self.pending_transactions = []
self.chain.append(block)
return block
# Search the blockchain for the most recent block.
@property
def last_block(self):
return self.chain[-1]
# Add a transaction with relevant info to the 'blockpool' - list of pending tx's.
def new_transaction(self, sender, recipient, amount):
59

transaction = {
'sender': sender,
'recipient': recipient,
'amount': amount
}
self.pending_transactions.append(transaction)
return self.last_block['index'] + 1
# receive one block. Turn it into a string, turn that into Unicode (for hashing). Hash with
SHA256 encryption, then translate the Unicode into a hexidecimal string.
def hash(self, block):
string_object = json.dumps(block, sort_keys=True)
block_string = string_object.encode()
raw_hash = hashlib.sha256(block_string)
hex_hash = raw_hash.hexdigest()
return hex_hash
Buyer Models:
from django.db import models
# Create your models here.
class BuyerUserRegistrationModel(models.Model):
name = models.CharField(max_length=100)
loginid = models.CharField(unique=True, max_length=100)
password = models.CharField(max_length=100)
mobile = models.CharField(unique=True, max_length=100)
email = models.CharField(unique=True, max_length=100)
locality = models.CharField(max_length=100)
address = models.CharField(max_length=1000)
60

city = models.CharField(max_length=100)
state = models.CharField(max_length=100)
status = models.CharField(max_length=100)
def __str__(self):
return self.loginid
class Meta:
db_table = 'BuyersRegistrations'
class BuyerCropCartModels(models.Model):
buyerusername = models.CharField(max_length=100)
buyeruseremail = models.CharField(max_length=100)
sellername = models.CharField(max_length=100)
cropname = models.CharField(max_length=100)
description = models.CharField(max_length=100000)
price = models.FloatField()
file = models.FileField(upload_to='files/')
cdate = models.DateTimeField(auto_now_add=True)
status = models.CharField(max_length=50)
def __str__(self):
return self.buyerusername
class Meta:
db_table = "BuyerCartTable"
class BuyerTransactionModels(models.Model):
buyername = models.CharField(max_length=100)
totalamount = models.FloatField()
recipientname = models.CharField(max_length=100)
61

cradnumber = models.IntegerField()
nameoncard = models.CharField(max_length=100)
cvv = models.IntegerField()
cardexpiry = models.CharField(max_length=200)
trnx_date = models.DateTimeField(auto_now_add=True)
def __str__(self):
#return self.id
return self.buyername
class Meta:
db_table = "BuyerTransactionTable"
class BlockChainTransactionModel(models.Model):
c_index = models.CharField(max_length=100)
c_timestamp = models.CharField(max_length=100)
c_sender = models.CharField(max_length=100)
c_recipient = models.CharField(max_length=100)
c_amount = models.CharField(max_length=100)
c_proof = models.CharField(max_length=100)
c_previous_hash = models.CharField(max_length=100)
p_index = models.CharField(max_length=100)
p_timestamp = models.CharField(max_length=100)
p_sender = models.CharField(max_length=100)
p_recipient = models.CharField(max_length=100)
p_amount = models.CharField(max_length=100)
p_proof = models.CharField(max_length=100)
p_previous_hash = models.CharField(max_length=100)
def __str__(self):
return self.id
class Meta:
db_table = "BlockChainTransactiontable"
62

Sellers side views.py
from django.shortcuts import render,HttpResponse
from django.contrib import messages
from .forms import SellerUserRegistrationForm
from .models import SellerUserRegistrationModel, FarmersCropsModels
from django.core.files.storage import FileSystemStorage
from buyers.models import BuyerCropCartModels
# Create your views here.
def SellerUserRegisterActions(request):
if request.method == 'POST':
form = SellerUserRegistrationForm(request.POST)
if form.is_valid():
print('Data is Valid')
form.save()
messages.success(request, 'You have been successfully registered')
form = SellerUserRegistrationForm()
return render(request, 'SellerUserRegistrations.html', {'form': form})
else:
messages.success(request, 'Email or Mobile Already Existed')
print("Invalid form")
else:
form = SellerUserRegistrationForm()
return render(request, 'SellerUserRegistrations.html', {'form': form})
def SellerUserLoginCheck(request):
if request.method == "POST":
loginid = request.POST.get('loginname')
pswd = request.POST.get('pswd')
print("Login ID = ", loginid, ' Password = ', pswd)
try:
check = SellerUserRegistrationModel.objects.get(loginid=loginid, password=pswd)
status = check.status
print('Status is = ', status)
63

if status == "activated":
request.session['id'] = check.id
request.session['loggeduser'] = check.name
request.session['loginid'] = loginid
request.session['email'] = check.email
print("User id At", check.id, status)
return render(request, 'sellers/SellerUserHome.html', {})
else:
messages.success(request, 'Your Account Not at activated')
return render(request, 'SellerLogin.html')
except Exception as e:
print('Exception is ', str(e))
pass
messages.success(request, 'Invalid Login id and password')
return render(request, 'SellerLogin.html', {})
def SellerUserHome(request):
return render(request, 'sellers/SellerUserHome.html', {})
def SellerAddItemsForm(request):
return render(request, 'sellers/SellerAddItems.html',{})
def SellerAddItemsAction(request):
if request.method=='POST':
cropname = request.POST.get('cropname')
price = request.POST.get('price')
description = request.POST.get('description')
image_file = request.FILES['file']
# let's check if it is a csv file
if not image_file.name.endswith('.jpg'):
messages.error(request, 'THIS IS NOT A JPG FILE')
fs = FileSystemStorage()
filename = fs.save(image_file.name, image_file)
64

detect_filename = fs.save(image_file.name, image_file)
uploaded_file_url = fs.url(filename)
loginid = request.session['loginid']
email = request.session['email']
FarmersCropsModels.objects.create(sellername=loginid, selleremail=email,
cropname=cropname,price=price, description=description,file=uploaded_file_url)
messages.success(request, 'Crop Data Addedd Success')
return render(request, 'sellers/SellerAddItems.html', {})
def SellersCommodities(request):
loginid = request.session['loginid']
data = FarmersCropsModels.objects.filter(sellername=loginid)
return render(request, 'sellers/SellersCommoditiesData.html',{'data':data})
def SellerUpdateProducts(request):
cropid = request.GET.get('cropid')
data = FarmersCropsModels.objects.get(id=cropid)
return render(request, 'sellers/CropsUpdatesbySeller.html', {'data': data})
return HttpResponse("Update products Working Success")
def SellerDeleteProducts(request):
cropid = request.GET.get('cropid')
FarmersCropsModels.objects.filter(id=cropid).delete()
loginid = request.session['loginid']
data = FarmersCropsModels.objects.filter(sellername=loginid)
return render(request, 'sellers/SellersCommoditiesData.html', {'data': data})
def SellerCropUpdateAction(request):
#MyModel.objects.filter(pk=some_value).update(field1='some value')
cropname = request.POST.get('cropname')
price = request.POST.get('price')
cropid = request.POST.get('cropid')
65

description = request.POST.get('description')
image_file = request.FILES['file']
# let's check if it is a csv file
if not image_file.name.endswith('.jpg'):
messages.error(request, 'THIS IS NOT A JPG FILE')
fs = FileSystemStorage()
filename = fs.save(image_file.name, image_file)
detect_filename = fs.save(image_file.name, image_file)
uploaded_file_url = fs.url(filename)
FarmersCropsModels.objects.filter(id=cropid).update(cropname=cropname, price=price,
description=description, file=uploaded_file_url)
loginid = request.session['loginid']
data = FarmersCropsModels.objects.filter(sellername=loginid)
return render(request, 'sellers/SellersCommoditiesData.html', {'data': data})
def SellerViewCarts(request):
sellername = request.session['loginid']
data = BuyerCropCartModels.objects.filter(sellername=sellername)
return render(request,'sellers/SellersViewCart.html',{'data':data})
Sellers Side models.py
from django.db import models
# Create your models here.
class SellerUserRegistrationModel(models.Model):
name = models.CharField(max_length=100)
loginid = models.CharField(unique=True, max_length=100)
password = models.CharField(max_length=100)
mobile = models.CharField(unique=True, max_length=100)
email = models.CharField(unique=True, max_length=100)
locality = models.CharField(max_length=100)
address = models.CharField(max_length=1000)
city = models.CharField(max_length=100)
66

state = models.CharField(max_length=100)
status = models.CharField(max_length=100)
def __str__(self):
return self.loginid
class Meta:
db_table = 'SellerRegistrations'
class FarmersCropDataModels(models.Model):
sellername = models.CharField(max_length=100)
selleremail = models.CharField(max_length=100)
cropname = models.CharField(max_length=100)
price = models.FloatField()
description = models.CharField(max_length=100000)
file = models.FileField(upload_to='files/')
cdate = models.DateTimeField(auto_now_add=True)
def __str__(self):
return self.loginid
class Meta:
db_table = "Farmerscroptable"
class FarmersCropsModels(models.Model):
sellername = models.CharField(max_length=100)
selleremail = models.CharField(max_length=100)
cropname = models.CharField(max_length=100)
price = models.FloatField()
description = models.CharField(max_length=100000)
file = models.FileField(upload_to='files/')
cdate = models.DateTimeField(auto_now_add=True)
def __str__(self):
67

return self.loginid
class Meta:
db_table = "FarmersCrops"
Base.html
<!DOCTYPE html>
{%load static%}
<html lang="en">
<head>
<title>Study of Blockchain</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=Poppins:200,300,400,500,600,700,800&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Lora:400,400i,700,700i&display=swap"
rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Amatic+SC:400,700&display=swap"
rel="stylesheet">
<link rel="stylesheet" href="{%static 'css/open-iconic-bootstrap.min.css'%}">
<link rel="stylesheet" href="{%static 'css/animate.css'%}">
<link rel="stylesheet" href="{%static 'css/owl.carousel.min.css'%}">
<link rel="stylesheet" href="{%static 'css/owl.theme.default.min.css'%}">
<link rel="stylesheet" href="{%static 'css/magnific-popup.css'%}">
<link rel="stylesheet" href="{%static 'css/aos.css'%}">
<link rel="stylesheet" href="{%static 'css/ionicons.min.css'%}">
<link rel="stylesheet" href="{%static 'css/bootstrap-datepicker.css'%}">
68

<link rel="stylesheet" href="{%static 'css/jquery.timepicker.css'%}">
<link rel="stylesheet" href="{%static 'css/flaticon.css'%}">
<link rel="stylesheet" href="{%static 'css/icomoon.css'%}">
<link rel="stylesheet" href="{%static 'css/style.css'%}">
</head>
<body class="goto-here">
<nav class="navbar navbar-expand-lg navbar-dark ftco_navbar bg-dark ftco-navbar-light"
id="ftco-navbar">
<div class="container">
<a class="navbar-brand" href="{%url 'index'%}">Study of Blockchain Technology in
Farmer’s</a>
<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="oi oi-menu"></span> Menu
</button>
<div class="collapse navbar-collapse" id="ftco-nav">
<ul class="navbar-nav ml-auto">
<li class="nav-item active"><a href="{%url 'index'%}" class="nav-link">Home</a></li>
<li class="nav-item"><a href="{%url 'SellerLogin'%}" class="nav-link">Seller</a></li>
<li class="nav-item"><a href="{%url 'BuyerLogin'%}" class="nav-link">Buyer</a></li>
<li class="nav-item"><a href="{%url 'AdminLogin'%}"
class="nav-link">Admin</a></li>
<li class="nav-item"><a href="{%url 'SellerRegister'%}" class="nav-
link">SellerRegister</a></li>
<li class="nav-item"><a href="{%url 'BuyerRegister'%}" class="nav-
link">BuyerRegister</a></li>
</ul>
</div>
</div>
</nav>
69

<!-- END nav -->
{%block contents%}
{%endblock%}
<hr>
<footer class="ftco-footer ftco-section">
<div class="container">
<div class="row">
</div>
<div class="row">
<div class="col-md-12 text-center">
<p>
Copyright &copy;<script>document.write(new Date().getFullYear());</script> All
rights reserved | This template is made with <i class="icon-heart color-danger" aria-
hidden="true"></i> by <a href="#" target="_blank">Alex Corporations</a>
</p>
</div>
</div>
</div>
</footer>
<!-- loader -->
<div id="ftco-loader" class="show fullscreen"><svg class="circular" width="48px"
height="48px"><circle class="path-bg" cx="24" cy="24" r="22" fill="none" stroke-width="4"
stroke="#eeeeee"/><circle class="path" cx="24" cy="24" r="22" fill="none" stroke-width="4"
stroke-miterlimit="10" stroke="#F96D00"/></svg></div>
70

<script src="{%static 'js/jquery.min.js'%}"></script>
<script src="{%static 'js/jquery-migrate-3.0.1.min.js'%}"></script>
<script src="{%static 'js/popper.min.js'%}"></script>
<script src="{%static 'js/bootstrap.min.js'%}"></script>
<script src="{%static 'js/jquery.easing.1.3.js'%}"></script>
<script src="{%static 'js/jquery.waypoints.min.js'%}"></script>
<script src="{%static 'js/jquery.stellar.min.js'%}"></script>
<script src="{%static 'js/owl.carousel.min.js'%}"></script>
<script src="{%static 'js/jquery.magnific-popup.min.js'%}"></script>
<script src="{%static 'js/aos.js'%}"></script>
<script src="{%static 'js/jquery.animateNumber.min.js'%}"></script>
<script src="{%static 'js/bootstrap-datepicker.js'%}"></script>
<script src="{%static 'js/scrollax.min.js'%}"></script>
<script src="https://maps.googleapis.com/maps/api/js?
key=AIzaSyBVWaKrjvy3MaE7SQ74_uJiULgl1JY0H2s&sensor=false"></script>
<script src="{%static 'js/google-map.js'%}"></script>
<script src="{%static 'js/main.js'%}"></script>
</body>
</html>
BuyerRegistrations.html
{%extends 'base.html'%}
{%load static%}
{%block contents%}
<section class="ftco-section ftco-no-pt ftco-no-pb py-5 bg-light">
<div class="container py-4">
<div class="row d-flex justify-content-center py-5">
<div class="col-md-6">
<center>
<h2 style="font-size: 22px;" class="mb-0">Buyer Register Form</h2>
<span>&nbsp;</span>
71

<form action="{%url 'BuyerUserRegisterActions'%}" method="POST" class="text-
primary"
style="width:100%">
{% csrf_token %}
<table>
<tr>
<td></td>
<td class="text-primary">Customer Name</td>
<td>{{form.name}}</td>
</tr>
<tr>
<td></td>
<td>Login ID</td>
<td>{{form.loginid}}</td>
</tr>
<tr>
<td></td>
<td>Password</td>
<td>{{form.password}}</td>
</tr>
<tr>
<td></td>
<td>Mobile</td>
<td>{{form.mobile}}</td>
</tr>
<tr>
<td></td>
<td>email</td>
<td>{{form.email}}</td>
</tr>
<tr>
<td></td>
<td>Locality</td>
72

<td>{{form.locality}}</td>
</tr>
<tr>
<td></td>
<td>Address</td>
<td>{{form.address}}</td>
</tr>
<tr>
<td></td>
<td>City</td>
<td>{{form.city}}</td>
</tr>
<tr>
<td></td>
<td>State</td>
<td>{{form.state}}</td>
</tr>
<tr>
<td></td>
<td></td>
<td>{{form.status}}</td>
</tr>
<tr>
<td></td>
<td></td>
<td>
<button type="submit" value="Register" class="btn btn-primary">
Register
</button>
</td>
</tr>
<tr>
<td>
<div class="form-group mt-3">
73

<span>&nbsp;</span>
</div>
</td>
</tr>
{% if messages %}
{% for message in messages %}
<font color='GREEN'> {{ message }}</font>
{% endfor %}
{% endif %}
</table>
</form>
</center>
</div>
</div>
</div>
</section>
{%endblock%}
74

7.TESTING

The purpose of testing is to discover errors. Testing is the process of trying to discover every
conceivable fault or weakness in a work product. It provides a way to check the functionality of
components, sub assemblies, assemblies and/or a finished product It is the process of exercising
software with the intent of ensuring that the Software system meets its requirements and user
expectations and does not fail in an unacceptable manner. There are various types of test. Each test
type addresses a specific testing requirement.
TYPES OF TESTS
Unit testing
Unit testing involves the design of test cases that validate that the internal program logic
is functioning properly, and that program inputs produce valid outputs. All decision branches and
internal code flow should be validated. It is the testing of individual software units of the
application .it is done after the completion of an individual unit before integration. This is a structural
testing, that relies on knowledge of its construction and is invasive. Unit tests perform basic tests at
component level and test a specific business process, application, and/or system configuration. Unit
tests ensure that each unique path of a business process performs accurately to the documented
specifications and contains clearly defined inputs and expected results.
75

Integration testing
Integration tests are designed to test integrated software components to determine
if they actually run as one program. Testing is event driven and is more concerned with the basic
outcome of screens or fields. Integration tests demonstrate that although the components were
individually satisfaction, as shown by successfully unit testing, the combination of components is
correct and consistent. Integration testing is specifically aimed at exposing the problems that arise
from the combination of components.
Functional test
Functional tests provide systematic demonstrations that functions tested are available as
specified by the business and technical requirements, system documentation, and user manuals.
Functional testing is centered on the following items:
Valid Input : identified classes of valid input must be accepted.
Invalid Input : identified classes of invalid input must be rejected.
Functions : identified functions must be exercised.
Output : identified classes of application outputs must be exercised.
Systems/Procedures : interfacing systems or procedures must be invoked.
Organization and preparation of functional tests is focused on requirements, key
functions, or special test cases. In addition, systematic coverage pertaining to identify Business
process flows; data fields, predefined processes, and successive processes must be considered for
testing. Before functional testing is complete, additional tests are identified and the effective value of
current tests is determined.
System Test
System testing ensures that the entire integrated software system meets requirements.
It tests a configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions and
flows, emphasizing pre-driven process links and integration points.
White Box Testing
White Box Testing is a testing in which in which the software tester has knowledge of
the inner workings, structure and language of the software, or at least its purpose. It is purpose. It is
used to test areas that cannot be reached from a black box level.
76

Black Box Testing
Black Box Testing is testing the software without any knowledge of the inner
workings, structure or language of the module being tested. Black box tests, as most other kinds of
tests, must be written from a definitive source document, such as specification or requirements
document, such as specification or requirements document. It is a testing in which the software under
test is treated, as a black box .you cannot “see” into it. The test provides inputs and responds to
outputs without considering how the software works.
Unit Testing
Unit testing is usually conducted as part of a combined code and unit test phase of the
software lifecycle, although it is not uncommon for coding and unit testing to be conducted as two
distinct phases.
Test strategy and approach
Field testing will be performed manually and functional tests will be written in
detail.
Test objectives
All field entries must work properly.
Pages must be activated from the identified link.
The entry screen, messages and responses must not be delayed.
Features to be tested
Verify that the entries are of the correct format
No duplicate entries should be allowed
All links should take the user to the correct page.
Integration Testing
Software integration testing is the incremental integration testing of two or more
integrated software components on a single platform to produce failures caused by interface defects.
The task of the integration test is to check that components or software applications, e.g. components
in a software system or – one step up – software applications at the company level – interact without
error.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
77

Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant participation by
the end user. It also ensures that the system meets the functional requirements.
Test Results: All the test cases mentioned above passed successfully. No defects encountered.
7.1 TEST CASES:
Sample Test Cases:
S.no Test CaseExcepted ResultResult
Remarks(IF
Fails)
1.
Sellers
Registration
If Seller User
registration
successfully.
Pass
If already user
email exist then it
fails.
2. Seller User Login
If User name and
password is correct then
it will getting valid
page.
Pass
Un Register Users
will not logged in.
3.
Buyers
Registrations
If Buyers User
registration
successfully.
Pass
If already user
email exist then it
fails.
4. Buyer User Login
If User name and
password is correct then
it will getting valid
page.
Pass
Un Register Users
will not logged in.
5.
Adding crops for
sell
Seller user will add the
crops price and images
Pass
If model object
not defined the
failed
6.
Buyer Search the
crops
Based on seller crops
the search nearly
matching crops will be
displayed
Pass
If model not
properly trained
the failed
7.
Start the
transaction
When Buyer user start
the transaction then a
block added to block
chain
Pass
Block Chain
object must be
defined
8.
View previos
transactions
In the buyer
tranasaction can view
its previous transaction
details
Pass
Blockchain object
required
9. Admin login
Admin can login with
his login credential. If
success he get his home
page
Pass
Invalid login
details will not
allowed here
10.
Admin can
activate the
register users
Admin can activate the
register user id
Pass
If user id not
found then it
won’t login.
78

8.OUTPUT SCREEN
Home page:
79

Plate 8.1
Seller Registraion:
Plate 8.2
Buyer Registration:
80

Plate 8.3
Seller Login:
Plate 8.4
Seller Home:
Plate 8.5
81

Seller Adding crops Details
Plate 8.6
Seller Commodities:
Plate 8.7
82

Updating Crops:
Plate 8.8
User View In Cart
83

Plate 8.9
Buyer Login:
Plate 8.10
Buyer Home:
84

Plate 8.11
Search Results:
Plate 8.12
85

Buyer Cart View:
Plate 8.13
Block chain :
Plate 8.14
86

Blockchain Transaction:
Plate 8.15
Buyer View Transaction
87

Plate 8.16
Admin Activate Buyers
Plate 8.19
Admin Activate Sellers:
88

Plate 8.20


89

9. CONCLUSION
Blockchain Technology in the field of agriculture can bring a revolutionary enhancement in the
area of maintaining farmers data securely, ensuring the quality of seed, monitoring of moisture
content in the soil, data of crop yield and lastly demand and s ale price of crops. In this work, a
blockchain-based portal is proposed to deal with the issue of demand and sale price of crops which
in result ensure crop security to farmers as well as to get fair price of the crop. For this, a portal is
proposed on which a farmer can register and sell his crops, recording a transaction on a blockchain
at a point when buyers commit to buy a farmer's crop. This transaction is capable of recording
crop details, the price at which it is committed to buying and quantity of crop purchased. This
immutable nature of blockchain technology will fortify farmers to get a legit image price of crop
and reduce the cost of operation for selling and buying crops when compared to traditional
methods.
Akin kind of portal can be implemented by the government and its confederate bureaus to ensure
amelioration in the field of farming and commerce of crops which will improve the prominence of
the nation’s farmers. This application can be more refined with increasing integration of
blockchain in a spectrum of areas and constellating it into a single paramount portal for farmers.
This can be done by putting farme r’s crop details to the blockchain, buyer’s data to the
blockchain and adding more features and services to the single portal and bringing all possible
facilities for farmers of the nation under sui generis awning. Information integrity and precision
issues can be solved using open, protected and trusted systems presumptuous; the infrastructure
dispensation and footage connections are protected and suitably provided. The blockchain
technology did not promise the information reliability in the footage. Thus realizat ion in
blockchain faces several boundaries that might require a vital authority or protected footage of
confirmation.




90

BIBLIOGRAPHY
[1] Lakhani, Karim R., and M. Iansit i. "The t ruth about blockchain." Harvard Business Review 95
(2017): 118-127.
[2] Hileman, Garrick, and Michel Rauchs. "2017 global blockchain benchmarking study." Available
at SSRN 3040224 (2017).
[3] Mohanta, Bhabendu K., Debasish Jena, Soumyashree S. Panda, and Srichandan Sobhanayak.
"Blockchain Technology: A Survey on Applicat ions and Security Privacy Challenges." Internet of
Things (2019): 100107.
[4] Yadav, Vinay Surendra, and A. R. Singh. "A Systemat ic Literature Review of Blockchain
Technology in Agriculture."
[5] Ghosh, Soumalya, A. B. Garg, Sayan Sarcar, PSV S. Sridhar, Ojasvi Maleyvar, and Raveesh
Kapoor. "Krishi-Bharat i: an interface for Indian farmer." In Proceedings of the 2014 IEEE Students'
Technology Symposium, pp. 259-263. IEEE, 2014.
[6] Singhal, Manav, Kshit ij Verma, and Anupam Shukla. "Krishi Ville— Android based solut ion
for Indian agriculture." In 2011 Fifth IEEE internat ional conference on advanced telecommunicat
ion systems and networks (ANTS), pp. 1-5. IEEE, 2011.
[7] Potts, Jason. "Blockchain in Agriculture." Available at SSRN 3397786 (2019).
[8] Hua, Jing, Xiujuan Wang, Mengzhen Kang, Haoyu Wang, and Fei-Yue Wang. "Blockchain based
provenance for agricultural products: A dist ributed platform with duplicated and shared
bookkeeping." In 2018 IEEE Intelligent Vehicles Symposium (IV), pp. 97-101. IEEE, 2018.
[9] Zhu, Xingxiong, and Dong Wang. "Research on Blockchain Applicat ion for E-Commerce,
Finance and Energy." In IOP Conference Series: Earth and Environmental Science, vol. 252, no. 4, p.
042126. IOP Publishing, 2019.
[10] Tschorsch, Florian, and Björn Scheuermann. "Bitcoin and beyond: A technical survey on
decentralized digital currencies." IEEE Communications Surveys & Tutorials 18, no. 3 (2016): 2084-
2123.
[11] Suma, V. "SECURITY AND PRIVACY MECHANISM USING BLOCKCHAIN." Journal of
Ubiquitous Comput ing and Communication Technologies (UCCT) 1, no. 01 (2019): 45-54.
91

[12] Gilbert , Henri, and Helena Handschuh. "Security analysis of SHA- 256 and sisters." In Internat
ional workshop on selected areas in cryptography, pp. 175-193. Springer, Berlin, Heidelberg, 2003.
92