You are on page 1of 69

EOD PAYMENT SYSTEM USING

CRYPTOCURRENCY
A PROJECT REPORT
Submitted by

P RAJENDRA 211801390016

T YADHUVAMSI 211801390029

P SUNANDITHA 211801390024

P SRILAKSMI 211801390036

V HARSHITH 211801390035

B MAHI SAI SUJAN 211801390008

M ABHISHEK 211801390030

Under the esteemed guidance of

SIDDHARTH KUMAR, B. Tech,


Assistant Professor
in partial fulfilment for the award of the degree of

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


SCHOOL OF ENGINEERING AND TECHNOLOGY
VIZIANAGARAM CAMPUS
BONAFIDE CERTIFICATE

Certified that this project report Application of Image Analytics for


“EOD PAYMENT SYSTEM USING CRYPTOCURRENCY” is the bonafide work
of “BLOCKCHAIN DOMAIN” who carried out the project work under my
supervision. This is to further certify to the best of my knowledge, that this project
has not been carried out earlier in this institute and the university.

SIGNATURE SIGNATURE
SIDDHARTH KUMAR DR. P SUBRAT KUMAR
ASSISTANT PROFESSOR HOD, Associate Professor

Certified that the above-mentioned project has been duly carried out as per the norms of the college
and statutes of the university.

EXTERNAL SIGNATURE
ACKNOWLEDGEMENT

It is with at most pleasure and excitement we submit our project partial fulfilment of the
requirement for the award of Bachelor of Technology. The project is a result of the cumulative
efforts, support, guidance, encouragement and inspiration from many of those for whom we must
give our truthful honor and express gratitude through bringing out this project at the outset as
per our knowledge. We convey special thanks to our Project Guide, who has guided us and
encouraged us to enhance our knowledge with present working of this project to enrich the
quality of project. We expressed our appreciation to SIDDHARTH KUMAR, B.Tech, Teaching
Assistant, who facilitated us to providing a friendly environment which helped to enhance our
skills in the present project.
DECLERATION

We hereby declare that the project entitled "EOD PAYMENT SYSTEM USING
CRYPTOCURRENCY" submitted to the fulfilment of award the degree of B. TECH (CSE) at
CENTURION UNIVERSITY OF TECHNOLOGY AND MANAGEMENT (A.P). This project work
in original has not been submitted so far in any part or full for any other university or institute for the
award of any degree or diploma.

P RAJENDRA 211801390016

T YADHUVAMSI 211801390029

P SUNANDITHA 211801390024

P SRILAKSMI 211801390036

V HARSHITH 211801390035

B MAHI SAI SUJAN 211801390008

M ABHISHEK 211801390030
ABSTRACT
The project "Exam on Demand Payment System Using Cryptocurrency" proposes a
novel approach to facilitate secure and efficient payment transactions for on-demand
examinations using cryptocurrency technology. Traditional payment systems often
face challenges such as high transaction fees, delays, and lack of transparency. By
leveraging cryptocurrency, this project aims to address these issues by implementing
a decentralized payment system that offers lower transaction costs, faster processing
times, and increased transparency. The system will allow users to seamlessly pay for
exam services, access study materials, and receive exam results in a secure and
decentralized manner. Through the integration of cryptocurrency technology, the
project seeks to revolutionize the payment landscape for on-demand examinations,
providing users with a more convenient and reliable payment solution.
Table of Contents

Title ............................................................................................................................... i
Certification ..................................................................................................................
ii
Acknowledgement .......................................................................................................
iii
Declaration ..................................................................................................................
iv
Abstract ......................................................................................................................... i

List of Figures .............................................................................................................. v

List of Abbreviations ................................................................................................... 6

Chapter 1: Introduction ................................................................................................ 7

1.2 Problem Statement ............................................................................................. 7


1.3 Aim ..................................................................................................................... 8
1.4 Specific Objectives............................................................................................. 8
1.5 Justification ........................................................................................................ 9
1.6 Scope and Limitations ........................................................................................ 9
1.6.1 Scope .......................................................................................................... 9
1.6.2 Limitations ................................................................................................. 9
Chapter 2: Literature Review..................................................................................... 10

2.1 Introduction ...................................................................................................... 10


2.2 Current Mentoring Systems ............................................................................. 10
2.2.1 Strathmore University Mentoring System Error! Bookmark not defined.
2.2.2 Elizabeth City State University Mentoring SystemError! Bookmark not
defined.
2.2.3 Mumbai University Student Mentoring and Assessment System ..... Error!
Bookmark not defined.
2.3 Drawbacks of the current system ......................................................................11
2.4 Technological solutions to help improve mentoring systems ...........................11
2.5 Conceptual Framework .....................................................................................11
Chapter 3: Research Methodology ............................................................................ 13

ii
3.1 Introduction ...................................................................................................... 13
3.2 System Analysis ............................................................................................... 13
3.2.1 Methods to be used to Gather the Functional and Non-Functional
Requirements ..................................................................................................... 13
3.2.2 Proposed Functional and Non-Functional Requirements ........................ 13
3.3 Prototyping Methodology ................................................................................ 14
3.3.1 Requirement gathering and analysis ........................................................ 14
3.3.2 Quick design ............................................................................................ 14
3.3.3 Build a prototype...................................................................................... 15
3.3.4 Initial user evaluation ............................................................................... 15
3.3.5 Refining prototype ................................................................................... 15
3.3.6 Implement product and maintenance ....................................................... 15
3.4 Justification of Methodology ........................................................................... 15
3.5 System Design.................................................................................................. 16
3.6 Tools and Techniques ....................................................................................... 16
3.7 Method to be used to test the proposed system ................................................ 17
3.8 Domain of Execution ....................................................................................... 17
3.9 Developed Modules and System Architecture ................................................. 18
3.10 Ethical Considerations ................................................................................... 18
Chapter 4: System Analysis and Design .................................................................... 19

4.1 Introduction ...................................................................................................... 19


4.2 Requirements Gathering .................................................................................. 19
4.3 Systems Requirements ..................................................................................... 20
4.3.1 Functional Requirements ......................................................................... 20
4.3.2 Non- Functional Requirements ................................................................ 20
4.4 System Architecture ......................................................................................... 21
4.5 System Designs ................................................................................................ 22
4.5.1 Use Case Diagram .................................................................................... 22
4.5.2 Class Diagram .......................................................................................... 25
4.5.3 Sequence Diagram ................................................................................... 26
4.5.4 Entity Related Diagram............................................................................ 28
4.5.5 Database Schema ..................................................................................... 29
iii
Chapter 5: System Implementation and Testing ........................................................ 30

5.1 Introduction ...................................................................................................... 30


5.2 System Implementation.................................................................................... 30
5.2.1 Installation Procedure .............................................................................. 30
5.2.2 System Manual......................................................................................... 32
5.3 System Testing ................................................................................................. 36
5.3.1 Test Cases ................................................................................................. 36
5.3.2 Test Results .............................................................................................. 40
Chapter 6: Conclusions, Recommendations and Future Works................................. 42

6.1 Introduction ...................................................................................................... 42


6.2 Discussion ........................................................................................................ 42
6.3 Conclusion ....................................................................................................... 43
6.4 Recommendation and Future Work.................................................................. 43
References .................................................................................................................. 44

1.1 Background ...................................................................................................... 77


Appendix: Gantt Chart ............................................................................................... 48

iv
List of Figures
Figure 1: Conceptual Framework .............................................................................. 15
Figure 2: Prototyping Methodology (Despa, 2014) ................................................... 18
Figure 3: System Architecture ................................................................................... 24
Figure 4: Use Case ..................................................................................................... 25
Figure 5: Class Diagram............................................................................................. 28
Figure 6: General System Diagram ............................................................................ 29
Figure 7:Admin module ............................................................................................. 30
Figure 8: Mentee module ........................................................................................... 30
Figure 9: Mentor Module ........................................................................................... 31
Figure 10: ERD .......................................................................................................... 32
Figure 11;Database Schema ....................................................................................... 33
Figure 12: Cloning snippet ......................................................................................... 34
Figure 13: Clone Snippet ........................................................................................... 35
Figure 14: Xammp installation snippet ...................................................................... 36
Figure 15: Admin dashboard ...................................................................................... 37
Figure 16: Mentor Dashboard .................................................................................... 38
Figure 17:Mentee Dashboard ..................................................................................... 38

v
List of Abbreviations

CSS Cascading Style Sheet


HTML Hyper Text Markup Language
IDE Integrated Development Environment
PHP Hypertext Pre-processor
JS Java Script

6
Chapter 1: Introduction
1.1 Background
The modern educational landscape is witnessing a paradigm shift towards flexible
learning models, where students seek greater autonomy over their academic journey.
This evolution necessitates innovative approaches to assessment methods, prompting
the exploration of novel payment systems to accommodate the diverse needs of
learners. In response to this demand, the concept of an Exam on Demand Payment
System using cryptocurrency emerges as a groundbreaking solution.

Traditional assessment frameworks often pose logistical challenges, such as rigid


scheduling and limited accessibility, hindering the seamless integration of
assessments into students' schedules. Moreover, conventional payment methods can
be cumbersome, especially for international students or those without access to
traditional banking services. These limitations underscore the need for a more agile
and inclusive payment system that aligns with the evolving nature of education.

Cryptocurrency, with its decentralized nature and borderless transactions, presents a


compelling alternative for facilitating payments within educational contexts. By
leveraging blockchain technology, an Exam on Demand Payment System can offer
students the flexibility to schedule exams at their convenience while streamlining the
payment process through secure and efficient cryptocurrency transactions.

This project aims to explore the feasibility and efficacy of implementing such a
system within educational institutions. Through a comprehensive analysis of existing
payment and assessment systems, including case studies of mentoring systems in
various universities, the project seeks to identify the shortcomings of current
frameworks and propose a technologically advanced solution.

7
The introduction of an Exam on Demand Payment System using cryptocurrency
holds the promise of revolutionizing the assessment landscape, empowering students
to take control of their learning journey while enhancing accessibility and inclusivity.
This project endeavors to contribute to the ongoing discourse on innovative
educational technologies and pave the way for a more efficient and learner-centric
assessment ecosystem.

1.2 Problem Statement


Traditional mentoring systems lacks an effective mentoring process as students lack
information on mentoring, have difficulty on following up on mentoring sessions.
The solution seeks to develop a web-based mentoring platform that will allow time
flexibility by allowing students and mentors to be able to schedule meetings, track
the progress of the mentee, provide reports on the mentoring sessions, allow students
to login to system.

1.3 Aim
The aim of the project "Exam on Demand Payment System Using Cryptocurrency"
is to develop a secure and efficient payment system that leverages cryptocurrency
technology to facilitate seamless transactions for accessing on-demand exams.

1.4 Specific Objectives


Specific Objectives for the project "Exam on Demand Payment System Using
Cryptocurrency" could include:

1. To design a secure and user-friendly payment system for accessing exams on


demand.
2. To integrate cryptocurrency as the primary mode of payment within the exam
platform.

8
3. To develop a robust backend infrastructure that supports cryptocurrency
transactions securely.
4. To implement a user authentication and authorization mechanism for accessing
exams and making payments.
5. To ensure real-time transaction processing and confirmation using blockchain
technology.

1.5 Justification
The implementation of an Exam on Demand Payment System using cryptocurrency
can offer numerous benefits such as enhanced security, lower transaction costs,
global accessibility, faster settlement times, innovation, reduced fraud risk, and
educational opportunities, making it a compelling choice for modernizing exam fee
payment systems in educational institutions.

1.6 Scope and Limitations


1.6.1 Scope
The scope of the project "Exam on Demand Payment System Using Cryptocurrency"
includes the development of a digital payment system specifically tailored for the
examination process. This system aims to facilitate the payment process for exams
using cryptocurrency, offering a secure and efficient method for students to pay their
examination fees. The scope encompasses the design and implementation of a user-
friendly interface for both students and administrative staff to initiate, track, and
manage exam payments seamlessly. Additionally, the scope involves integration with
existing examination management systems to ensure compatibility and smooth
operation. The system will provide transparency in transaction records and enhance
the overall efficiency of the examination fee payment process.

9
1.6.2 Limitations

Challenges include regulatory compliance for cryptocurrency transactions, security


risks associated with hacking and fraud, and potential adoption barriers due to
cryptocurrency volatility and technical complexity.

Chapter 2: Literature Review


2.1 Introduction
The literature review for the project "Exam on Demand Payment System Using
Cryptocurrency" delves into the existing knowledge landscape surrounding both
payment systems and cryptocurrency utilization within educational settings. This
introduction sets the stage by outlining the importance of payment systems in
facilitating seamless transactions in educational institutions and the potential of
cryptocurrency to revolutionize traditional payment methods.

2.2 Current EOD Systems


The current exam on demand payment system streamlines user registration and
authentication processes, allowing individuals to conveniently schedule exams from
a catalog of options. Payment processing is seamlessly integrated, offering various
secure payment methods such as credit/debit cards and digital wallets. Upon
successful payment, users receive confirmation and access to exam materials.
Stringent security measures are in place to protect user data and ensure compliance
with industry standards. Results are promptly delivered, enabling users to review

10
their performance and provide feedback for continual improvement. Customer
support channels are readily available to address any queries or concerns. The
platform is designed for scalability and performance, capable of accommodating a
growing user base while maintaining efficiency and reliability.

2.3 Drawbacks of the current EOD system


Existing EOD systems often encounter challenges related to transaction speed,
security, and transparency. Traditional payment methods may involve intermediaries,
leading to delays and higher transaction costs. Moreover, the reliance on fiat
currencies limits accessibility and introduces currency conversion complexities.

2.4 Technological solutions to help improve EOD systems


In recent years, technological innovations, particularly blockchain and
cryptocurrencies, have emerged as potential solutions to enhance payment systems.
Blockchain offers decentralized, immutable ledger technology, ensuring transparency
and security in transactions. Cryptocurrencies facilitate peer-to-peer transactions,
eliminating the need for intermediaries and reducing transaction costs.

2.5 Conceptual Framework


The conceptual framework for the "Exam on Demand Payment System Using
Cryptocurrency" project revolves around leveraging blockchain technology and
cryptocurrencies to streamline exam payment processes. By building upon the existing
infrastructure of mentoring systems, the project aims to introduce a secure, efficient,
and transparent payment mechanism for on-demand exams.

11
Figure 1: Conceptual Framework

12
Chapter 3: Research Methodology
3.1 Introduction

The research methodology employed in developing the Exam on Demand Payment


System using cryptocurrency involves a structured approach to gather, analyze,
design, implement, and test the proposed system. This chapter outlines the strategies
and techniques that will be utilized to ensure the successful completion of the project.

Given the dynamic nature of both the cryptocurrency landscape and the education
sector, a robust methodology is essential to address the complexities inherent in
developing such a system. By leveraging established methodologies and adapting
them to the specific requirements of this project, we aim to deliver a reliable, secure,
and efficient payment system tailored for the educational domain.

3.2 System Analysis


The system analysis adopted for the cryptocurrency-based exam system is the
Object-Oriented Analysis and Design (OOAD), chosen for its modular approach
and code reusability, which can enhance system quality while reducing time and
costs.
3.2.1 Methods to be used to Gather the Functional and Non-Functional
Requirements
Functional and non-functional requirements were gathered by analyzing
existing Computer-Based Information Systems (CBIS) and employing
questionnaires to understand user needs.

3.2.2 Proposed Functional and Non-Functional Requirements

3.2.2.1 Functional Requirements


Some of the functional requirements the system should have are:
Authentication: Secure login for students, admin, and examiners.
Administrative Functions: Admin capabilities to manage system users and access the
dashboard.

13
Exam Scheduling: Facilitation of exam booking and scheduling by students.
Payment Processing: Integration of cryptocurrency transactions for exam fees.
Information Provision: Accessibility to information about the exam scheduling process
and cryptocurrency usage.

3.2.2.2 Non-Functional Requirements


Some of the non-functional requirements the system should have are:
Usability: Intuitive and user-friendly interfaces.
Security: Robust protection of user data and transaction integrity.
Accuracy: Precise handling and representation of user-provided data.
Performance: Efficient responsiveness and resource management for seamless user
experience.
The system should be responsive and less resource intensive to improve the efficiency
of the system. It should not take long for the user to access the system.

3.3 Prototyping Methodology


The prototyping methodology follows Burns & Dennis (1985), involving iterative
creation and refinement of the system's prototypes based on user feedback.

3.3.1 Requirement gathering and analysis


For the "Exam on Demand" payment system utilizing cryptocurrency, requirement
gathering and analysis involved engaging with potential users to understand their
needs, examining current exam scheduling and payment processes, and considering
the unique aspects of cryptocurrency transactions to ensure a secure, efficient, and
user-friendly experience. This phase was critical for aligning the system's capabilities
with user expectations and regulatory standards.

3.3.2 Quick design


A preliminary design phase established the system's structure, identifying necessary
classes, attributes, and methods.

14
3.3.3 Build a prototype
A working prototype was constructed, reflecting user requirements and considering
development costs.

3.3.4 Initial user evaluation


User feedback on the prototype was sought, with subsequent refinements based on
their inputs.

3.3.5 Refining prototype


This iterative phase continued until the user requirements were fully satisfied.

3.3.6 Implement product and maintenance


Following user approval, the final system was tested, deployed, and entered the
maintenance phase to ensure ongoing reliability.

Figure 2: Prototyping Methodology

3.4 Justification of Methodology


Tozer (2003) advocates for prototyping, particularly where user interaction and system
testing are concerned, highlighting the methodology's effectiveness in preventing
conflicts and ensuring a successful delivery of a functional system. For the
cryptocurrency-based "Exam on Demand" payment system, this approach allows for
real-world testing and user feedback on the complex mechanisms of cryptocurrency
transactions within the system.

15
3.5 System Design
The developed system used the OOAD method where the following diagrams will be
drawn:
i. Use case diagram
Use case diagram is the graphic representation that is used to show the interactions
of different elements of the system like the user and different use cases in which the
user is involved. This will be used in the interaction between different elements in
the system.
ii. Class diagrams
Class diagram will be used to describe the attributes and operations of the class as well

as the constraints in the system. It will show the system’s class, attributes, relationships

and methods.

iii. Sequence diagrams


Sequence diagram outlines how and the order in which objects in a system function.
iv. Database schema
Database schema is the structure of the database that is presented in a logical format
which defines how data is organized and the association of relations.
v. GUI mock-ups
GUI mock-ups is used to show different graphical user interfaces that are to be created
like forms.

3.6 Tools and Techniques


To ensure a robust test environment for the "Exam on Demand" payment system, we
utilized a hardware and software configuration that includes a Windows 10, 64-bit
operating system, an Intel Core i7-8565U CPU @ 1.80GHz, and 8.00 GB RAM. The
Apache HTTP server served as our web server.

16
For development tools, we employed the PHP integrated development environment.
The system was built using the PHP programming language and the Laravel web
framework for robust back-end operations.
The front-end development utilized a combination of programming languages
including PHP, JavaScript, with HTML and CSS bringing the design elements to life,
ensuring a seamless and interactive user experience.
In the exam on demand payment system leveraging cryptocurrency, MetaMask
facilitates seamless payment transactions by allowing users to securely manage
Ethereum assets directly from their web browsers. EtherScan enhances transparency
by enabling users to verify payment transactions on the Ethereum blockchain, ensuring
accountability and trust in the payment process. Together, these tools streamline
cryptocurrency payments, enhancing user experience and providing real-time
transaction verification.

3.7 Method to be used to test the proposed system


The testing of the system was conducted using two primary methods: usability
testing, which assessed whether the system's design matched the required workflows,
and unit testing, which verified the functionality of individual system units against
the specified requirements.

3.8 Domain of Execution


The system execution employed a web-based approach, expanding accessibility to a
broader user base. This method requires only a basic internet connection, alleviating
the need for users to download, update, or manage any software, and ensures that
users always interact with the most current version of the system.

17
3.9 Developed Modules and System Architecture
The system's architecture supports seamless interaction between students and
examination facilitators. Through the web-based platform, students can select and
schedule exams, pay using cryptocurrency, and access exam-related materials.

The core modules developed include:

Authentication Module: Validates user credentials.

Payment Module: Manages cryptocurrency transactions and exam fee processing.

Scheduling Module: Allows students to book and manage examination times.

Reporting Module: Generates reports on transactions and scheduling analytics.

3.10 Ethical Considerations


Ethical practices are integral to our research and system deployment. The "Exam on
Demand" payment system adheres to the following ethical guidelines:

Voluntary Participation: Ensuring users are participating of their own free will and can
opt out at any time.
Language Usage: Maintaining respectful communication within the system.
Anonymity: Guaranteeing user privacy and anonymity where required.
Acknowledgment: Properly citing and referencing third-party work.
Participant Safety: Ensuring the system does not cause physical or
psychological harm to users.

18
Chapter 4: System Analysis and Design
4.1 Introduction
The proposed project, "Exam on Demand Payment System Using Cryptocurrency,"
aims to leverage the advantages offered by cryptocurrencies to streamline and
enhance the process of paying for examinations on demand. Traditional payment
methods for exam fees often involve intermediaries, such as banks or payment
processors, which can introduce delays, incur transaction fees, and pose security
risks. By implementing a payment system based on cryptocurrencies, these
drawbacks can be mitigated, offering a more efficient, secure, and cost-effective
solution.

4.2 Requirements Gathering


1. User Interviews and Surveys: Conduct interviews and surveys with stakeholders
to gather their requirements, preferences, and pain points regarding the current
payment system for exams.

2. Review Existing Systems: Analyze existing payment systems within educational


institutions or similar contexts to understand their features, functionalities, and
shortcomings.

3. Document Analysis: Review documents such as organizational policies, financial


records, and technical specifications to gain insights into the requirements and
constraints of the new payment system.

4. Requirement Prioritization: Prioritize requirements based on their importance,


urgency, and feasibility to ensure that the most critical features are addressed first.

5. Security and Compliance Requirements: Gather security and compliance


requirements specific to cryptocurrency transactions, including encryption
standards, data protection measures, and regulatory compliance.

19
4.3 Systems Requirements
4.3.1 Functional Requirements
Requirement ID Requirement Description

FRQ1 The system should allow mentees to select a mentor

FRQ2 The system should allow mentees to request for meetings

FRQ3 The system should allow admins and mentors to post mentoring
materials

FRQ4 The system should allow the mentors and mentees to have a session
via a chat stream

FRQ5 The system should allow the admin the view reports.

FRQ6 The users should be able to login to the systems

4.3.2 Non- Functional Requirements


Requirement ID Requirement Category Requirement Description

NFRQ1 Usability The system should notify the mentor


when a meeting request is sent

NFRQ2 Usability The system should notify the mentee on


whether the request is accepted or the
mentor has asked for reschedule.

20
NFRQ3 Usability The system should be easy to use and
navigate for end users.

NFRQ4 Performance The system should cater for the requests


of the users at optimal speed

NFRQ5 Supportability The system should be able to run on


multiple devices without crashing.

4.4 System Architecture

Figure 3: System Architecture

21
4.5 System Designs
4.5.1 Use Case Diagram

Figure 4: Use Case

Name EOD PAYMENT SYSTEM USING


CRYPTOCURRENCY

Description An payment system that allows Admin and


Student have interactions, access materials and
store all details.

Primary Actors Admin


Student

Secondary Actors Administrator

22
Pre-Conditions Since the domain of execution is web-based
therefore the system must be connected to the
internet.
All Admin and Student should have access to
the system.
The admin should have access to the system.
The mentor should access the mentor’s
information.

Post Conditions The users should be able to log out.


The system should be able to store data from
previous sessions.
The sessions should end once the users have
logout.

Main Flow Admin


The admin should be able to add all users to
the system.
The admin should be able to access reports.
The admin should be able to add or remove
mentors and mentees from the system.

Student
The mentors should be able to login to the
system.
The mentors should be able to start sessions
with mentees.

23
The mentors should be able to provide
mentoring materials to their mentees.
The mentors should be able to have access to
mentees background information.

Student
The mentees should be able to login to the
system.
The mentees should be able to access materials
on mentoring.
The mentees should be able to request for
meetings.
Alternate Courses For incorrect credentials, the system should be
able to validate the login and provide an error
message.
In case the users forget their password, they
should be able to reset it.

24
4.5.2 Class Diagram

Figure 5: Class Diagram

25
4.5.3 Sequence Diagram

Figure 6: General System Diagram

26
Figure 7:Admin module

Figure 8: Student module

27
4.5.4 Entity Related Diagram

Figure 10: ERD

28
4.5.5 Database Schema

Figure 11;Database Schema

29
Chapter 5: System Implementation and Testing
5.1 Introduction
In the implementation phase of the Exam on Demand Payment System utilizing
Cryptocurrency, the focus shifts from conceptualization and design to the actual
development and deployment of the system. This phase marks a crucial step in
realizing the project's objectives by translating theoretical concepts into a functional
and practical solution. Implementation involves the installation, configuration, and
integration of software components, as well as the development of supporting
documentation and manuals.

5.2 System Implementation


This section outlines the steps involved in implementing the Exam on Demand

Payment System using Cryptocurrency.

5.2.1 Installation Procedure


This section will explain the steps that the user will take in order to install and set up
the system. i.
The user can download the project as a zip folder or can clone it by copying the
URL.

30
Figure 12: Cloning snippet

ii. You go to the terminal of your choice and clone the project to the directory of your
choice.

31
Figure 13: Clone Snippet iii. You then run the following commands one by one to

ensure the modules and libraries that keep it running are in place.

-Composer
update -npm
install.
-npm run dev.
-composer require larasocket-driver - npm i laravel-echo larasocket-js -npm run
dev -php artisan migrate:fresh -php artisan db:seed -php artisan key:generate
-Lastly you run php artisan serve to serve the project
and you can access the system with the URL provided
in the terminal.

iv. The command php artisan db:seed gives you dummy data to access the mentor
and admin
accounts, to get a mentee to register through the sign-up.

5.2.2 System Manual


The system which is an online mentoring system has been developed to meet the
needs of mentees and mentors and to be able to carry out sessions on the web. It is
only accessible to users who have created accounts and have access to stable
internet connection.

5.2.2.1 Pre-setup
i. Download XAMPP from the internet. Go to
https://www.apachefriends.org/index.html and select the installer for your
specific Operating system.

32
ii. Select the downloaded file and this will open the XAMPP setup window, you
many have to
click OK on a warning if you have a User Account Control activated on your computer.
iii. You leave the default options that have been selected and click next

Figure 14: Xampp installation snippet

iii. Use the default folder location to install the software and click next. v.
Once the Xampp setup wizard is completed click the Finish button.

33
5.2.2.2 Getting Started
i.After you have followed the steps stated in the installation procedure, you have to
access the URL printed in the terminal. Mostly the URL is http://127.0.0.1:8000,
though it may vary depending on the ports. ii.You then use the dummy data produced
by the php artisan db:seed command to access the admin dashboard. The email can
be found in the database while the default password is “password”, once you log in
successfully, you can have an overview of the systems and various functionality
available to the admin.

Figure 15: Admin login iii.To access the mentor’s dashboard you can use the data in
the database to access the email, and the password is “password” by default. Once you
successfully log in you can look at the list of mentees, check session requests, add a
blog and start a mentoring session.

34
Figure 16: Student login

iv.To sign in as a mentee you will need to fill in your details in the registration page and
from there you will log in the system to access the dashboard with the functionalities.

Figure 17:Student Dashboard

35
5.3 System Testing
The focus of this section is on what the system does and if it succeeds on the different
functionalities as stated in the functional and non-functional requirements. This
section will also detect system failures and classify each test according to priority.

5.3.1 Test Cases

Test Requirement Inspection Preconditions Test Data Priority


check
ID ID Level

T1 FRQ1 Does the The admin Email:admin@gmail.com High


system should be
allow the able to fill in Password: password
admin to the sign in
sign up and form and
save the submit it
data to the
database?

T2 FRQ2 Does the There should Mentor1@gmail,com low


system be a list
Tulshi.patel@strathmore.edu
allow the of
admin to mentors and
view the mentees in the
mentors in system.
the system?

36
T3 FRQ3 Does the The admin Email: mentor1@gmail High
system should
allow be able
admins to to add admins
add to the system.

mentors to
the system?

T4 FRQ4 Does the The mentor Email: mentor1@gmail.com High


system should be Password: password
allow
mentors to able to fill
login and in the login
save the
only if they
data to the
database ? have been
added by
the admin

T5 FRQ5 Does the The mentee Mentee name: Edalia High


system should first
Meeting details: could we
allow send a
mentors to request to please meet at 2pm. I am
view have a depressed.
session session with
requests the mentor Preferred date: 2021-01-28
sent by the Status: Accept or
mentees? Reschedule

37
T6 FRQ6 Can the The mentee The mentor accepts the medium
mentor should first request and if he selects the
accept or send a reschedule button he is able
reschedule request to to give an alternative time
the request have a and date for the meeting in
and give session with the form of a text and send it
another the mentor to the mentee
time and
date to the
mentee?

T7 FRQ7 Does the The mentee Name: Tulshi High


system should be

allow the able to fill Email:


in the sign
mentee to Tulshi.patel@strathmore.edu
up form and
fill in the submit it Password: password
sign up Confirm password: password
form?
Submit
T8 FRQ8 Does the The mentee Email: High
system should be
Tulshi.patel@strathmore.edu
allow the able to login
mentee to successfully Password: password
login? provided
the
credentials
are right

38
T9 FRQ9 Does the Upon The mentee selected mentor2 Medium
system
registration
allow the
mentee to the mentee
select a should
mentor?
select
a
mentor
from the list
of mentors
provided
T10 FRQ10 Does the The mentee Meeting details: could we Medium
system allow
should be meet at 2 pm. I am feeling
the mentee to
request for a able to anxious.
session? request for a Meeting date: 2021-01-28
session
from the
mentor by
inputting the
meeting

details and
meeting date

39
T11 FRQ11 Does the The mentee Sending messages
system should
allow a chat request for a
session session and
between the mentor
mentor and to
mentee? accept the
request

5.3.2 Test Results

Test ID Expected Actual Result Status Remarks


Result
T1 The system The system Pass The test was
should allow the allows the carried out
mentee to fill in successfully and
mentee to details and select the results were
request for a a date in order to as expected.
session have a session.

40
T2 The system The system Pass The test was
should allow carried out
allowed the
mentors to view successfully and
the request and mentor to accept the results were
either accept or the request and as expected.
reschedule the
session also allowed the
mentor to
reschedule
giving the
mentee a day and
time when they
can have a
session.

T3 The system The mentee can Pass The test was


should allow the select any carried out
mentee to select a mentor based on successfully and
mentor of choice the list provided the results were
upon login as expected.

T4 The system The system has Fail This was not


should have a no feedback area implemented
feedback area however it will be
added in the
recommendations
for future work

41
Chapter 6: Conclusions, Recommendations and Future Works
6.1 Introduction
Earlier in Chapter Two, we addressed the conventional exam scheduling process,
which involved lengthy administrative procedures and fixed timetables, hindering
flexibility and immediate student needs. The "Exam on Demand" system we have
developed aims to mitigate these problems by integrating cryptocurrency as a means
of transaction and facilitating instant exam scheduling.
The system allows for seamless transactions using cryptocurrency, ensuring secure,
fast, and transparent handling of fees associated with exam scheduling. The
flexibility afforded by this system revolutionizes the way students can approach their
examinations, allowing for scheduling that aligns with their preparedness and
personal timetables, thus reducing stress and potentially improving performance.

6.2 Discussion
In chapter two we talked about the process of meeting your mentor by emailing them
and going to meet them in school hours at a designated location. This however had
some limitations that the system that has been developed has tried solving.
The system that has been developed allows users to request for sessions and have
live chat sessions with their mentors at their own comfort and at flexible times that
solves the issues related to time consumption, disruption of classes and
inconvenience. The developed system also provides blogs that educate mentees and
guide them throughout.
The developed system also has an admin module that adds mentors to the system.
The admin module is also able to monitor both mentors and mentees. The admin is
also able to generate reports.

42
6.3 Conclusion
Examinations are a critical component of the academic journey, and the ability to
schedule them as per one's convenience can greatly enhance the learning experience.
The "Exam on Demand" system, while novel in its approach by integrating
cryptocurrency, recognizes the unique challenges faced by students in today's fast-
paced academic environments. By offering a system that aligns with modern
technological advancements and financial trends, it empowers students to take control
of their assessment timelines. However, the requirement for a stable internet
connection and the system's current limitation to a single university are factors that
may restrict its accessibility and widespread adoption.
6.4 Recommendation and Future Work
Future enhancements for the "Exam on Demand" system will focus on broadening
reach through inter-university integration and developing offline functionalities to
reduce internet dependency. A mobile application is in the works to facilitate greater
access and convenience for users. The system will also integrate with university
academic modules for a seamless experience, ensuring scalability to support a growing
user base. Continuous investment in security will remain a priority to protect against
fraud and maintain transaction integrity, keeping the system at the forefront of
academic and technological advancements..

43
REFERENCES
[1] M. Abdelsalam, M. Shokry, and A. M. Idrees, “A Proposed Model for Improving the
Reliability of Online Exam Results Using Blockchain,” no. July 2023, pp. 7719–7733,
2024.
[2] P. Katsiampa, K. Moutsianas, and A. Urquhart, “Information demand and
cryptocurrency market activity,” Econ. Lett., vol. 185, p. 108714, Dec. 2019, doi:
10.1016/j.econlet.2019.108714.
[3] K. Grobys and J. Junttila, “Speculation and lottery-like demand in cryptocurrency
markets,” J. Int. Financ. Mark. Institutions Money, vol. 71, p. 101289, Mar. 2021, doi:
10.1016/j.intfin.2021.101289.
[4] H. Chey, “Cryptocurrencies and the IPE of money: an agenda for research,” Rev. Int.
Polit. Econ., vol. 30, no. 4, pp. 1605–1620, Jul. 2023, doi:
10.1080/09692290.2022.2109188.
[5] V. Manahov, “The rapid growth of cryptocurrencies: How profitable is trading in
digital money?,” Int. J. Financ. Econ., vol. 29, no. 2, pp. 2214–2229, Apr. 2024, doi:
10.1002/ijfe.2778.
[6] M. Abraham, “Studying the patterns and long-run dynamics in cryptocurrency
prices,” J. Corp. Account. Financ., vol. 31, no. 3, pp. 98–113, Jul. 2020, doi:
10.1002/jcaf.22427.
[7] K. Soska, J.-D. Dong, A. Khodaverdian, A. Zetlin-Jones, B. Routledge, and N. Christin,
“Towards Understanding Cryptocurrency Derivatives:A Case Study of BitMEX,” in
Proceedings of the Web Conference 2021, New York, NY, USA: ACM, Apr. 2021, pp.
45–57. doi: 10.1145/3442381.3450059.
[8] M. Gronwald, “How explosive are cryptocurrency prices?,” Financ. Res. Lett., vol. 38,
p. 101603, Jan. 2021, doi: 10.1016/j.frl.2020.101603.
[9] S. Demiralay and P. Golitsis, “On the dynamic equicorrelations in cryptocurrency
market,” Q. Rev. Econ. Financ., vol. 80, pp. 524–533, May 2021, doi:
10.1016/j.qref.2021.04.002.
[10] P. P. Baboshkin, A. Y. Mikhaylov, and Z. A. Shaikh, “Sustainable Cryptocurrency
Growth Impossible? Impact of Network Power Demand on Bitcoin Price,” Financ. J.,
vol. 14, no. 3, pp. 116–130, Jun. 2022, doi: 10.31107/2075-1990-2022-3-116-130.
[11] D. Zięba, R. Kokoszczyński, and K. Śledziewska, “Shock transmission in the
cryptocurrency market. Is Bitcoin the most influential?,” Int. Rev. Financ. Anal., vol.

44
64, pp. 102–125, Jul. 2019, doi: 10.1016/j.irfa.2019.04.009.
[12] A. Aspris, S. Foley, J. Svec, and L. Wang, “Decentralized exchanges: The ‘wild west’ of
cryptocurrency trading,” Int. Rev. Financ. Anal., vol. 77, p. 101845, Oct. 2021, doi:
10.1016/j.irfa.2021.101845.
[13] N. Jonker, “What drives the adoption of crypto-payments by online retailers?,”
Electron. Commer. Res. Appl., vol. 35, p. 100848, May 2019, doi:
10.1016/j.elerap.2019.100848.

45
APPENDIX: SOURCE CODE

LoginPage:html

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Login</title>
<link rel="stylesheet" href="./css/login.css">
</head>
<body>
<h2>Student Login</h2>
<form action="login.php" method="post">
<label for="registration_number">Registration Number:</label>
<input type="text" id="registration_number" name="registration_number"
required><br><br>

<label for="password">Password:</label>
<input type="password" id="password" name="password" required><br><br>

<input type="submit" value="Login">


</form>
</body>
</html>

AdminPage:Php

<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Details</title>

46
<link rel="stylesheet" href="./css/adminPage.css">
<link rel="stylesheet" href="./css/insert.css">

<style>

*{
margin: 0;
padding: 0;
}

header {
background-color: #b7b2b2;
color: #fff;
padding: 10px 20px;
display: flex;
justify-content: space-between;
align-items: center;
}

/* Styles for the logo */


.logo img {
width: 100px;
height: 100px;
}

/* Styles for the search input field */


.search-container {
display: flex;
flex-direction: row;
align-items: center;
}

.search-input {
padding: 5px;
border-radius: 5px;
border: 1px solid #fff;
margin-right: 10px;
}

/* Styles for the search button */


.search-button {
padding: 8px 20px;
border-radius: 5px;

47
border: none;
background-color: #007bff;
color: #fff;
cursor: pointer;
}

/* Styles for the buttons */


.header-button {
padding: 8px 20px;
border-radius: 5px;
border: none;
cursor: pointer;
}

.header-button.primary {
background-color: #007bff;
color: #fff;
margin-right: 5px;
}

.header-button.danger {
background-color: #dc3545;
color: #fff;
margin-right: 5px;
}

body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f8f8f8;
}

h2 {
text-align: center;
margin-top: 20px;
}

form {
text-align: center;
margin-top: 20px;
}

label {

48
font-weight: bold;
}

input[type="text"],
input[type="submit"] {
padding: 8px;
margin: 5px;
border-radius: 5px;
border: 1px solid #ccc;
}

input[type="submit"] {
background-color: #4CAF50;
color: white;
cursor: pointer;
}

input[type="submit"]:hover {
background-color: #45a049;
}

.container {
max-width: 1000px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(220, 67, 67, 0.5);
margin-top: 20px;
}

table {
border-collapse: collapse;
width: 100%;
}

th,
td {
border: 1px solid #ddd;
padding: 8px;
text-align: left;
}

th {

49
background-color: #f2f2f2;
}
.copy-text:hover{
cursor: pointer;
}

body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f8f8f8;
}
h2 {
text-align: center;
margin-top: 20px;
color: #333;
}
form {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-top: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
input[type="text"],
input[type="submit"] {
width: calc(100% - 10px);
padding: 8px;
margin: 5px 0 10px;
border-radius: 5px;
border: 1px solid #ccc;
box-sizing: border-box;
font-size: 16px;
}
input[type="submit"] {

50
background-color: #4CAF50;
color: white;
cursor: pointer;
transition: background-color 0.3s ease;
}
input[type="submit"]:hover {
background-color: #45a049;
}
p.error {
color: red;
margin-top: 10px;
}
p.success {
color: green;
margin-top: 10px;
}

</style>
</head>

<body>

<header>
<!-- Logo -->
<div class="logo">
<img src="./image/collegeLogo.png" alt="Logo">
</div>

<!-- Search input field with button -->


<div class="search-container">
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"
method="post">
<input type="text" id="search_registration_number"
name="search_registration_number" placeholder="Search by Registration Number">
<input type="submit" value="Search">
</form>
</div>

<!-- Buttons -->


<button class="header-button danger">Delete</button>
<button class="header-button primary">Update</button>
<button class="header-button primary" onclick="showAddForm()">Add</button>

51
<a href="https://sepolia.etherscan.io/" target="_blank"><button class="header-button
primary">Check Transaction</button></a>
</header>

<!-- Content for retrieve.php -->


<div id="addForm" style="display:none;">
<h2>Insert Student Details</h2>
<form action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>"
method="post" id="insert_form">
<label for="insert_registration_number">Registration Number:</label>
<input type="text" id="insert_registration_number" name="registration_number"
required>

<label for="insert_name">Student Name:</label>


<input type="text" id="insert_name" name="name" required>

<label for="insert_branch">Student Branch:</label>


<input type="text" id="insert_branch" name="branch" required>

<label for="insert_course">Student Course:</label>


<input type="text" id="insert_course" name="course" required>

<label for="insert_subject_name">Subject Name:</label>


<input type="text" id="insert_subject_name" name="subject_name" required>

<label for="insert_subject_code">Subject Code:</label>


<input type="text" id="insert_subject_code" name="subject_code" required>

<!-- New input fields for rupees and ethers -->


<label for="insert_amount_rupees">Amount in Rupees:</label>
<input type="text" id="insert_amount_rupees" name="amount_rupees">

<label for="insert_amount_ethers">Amount in Ethers:</label>


<input type="text" id="insert_amount_ethers" name="amount_ethers">

<input type="submit" value="Submit">


</form>

<?php
// Check if the form is submitted
if ($_SERVER["REQUEST_METHOD"] == "POST") {
// Check if all form fields are set and not empty
if(isset($_POST['registration_number']) &&
!empty($_POST['registration_number']) &&

52
isset($_POST['name']) && !empty($_POST['name']) &&
isset($_POST['branch']) && !empty($_POST['branch']) &&
isset($_POST['course']) && !empty($_POST['course']) &&
isset($_POST['subject_name']) && !empty($_POST['subject_name']) &&
isset($_POST['subject_code']) && !empty($_POST['subject_code']) &&
isset($_POST['amount_rupees']) && !empty($_POST['amount_rupees']) &&
isset($_POST['amount_ethers']) && !empty($_POST['amount_ethers'])) {

// Retrieve form data


$registration_number = $_POST['registration_number'];
$name = $_POST['name'];
$branch = $_POST['branch'];
$course = $_POST['course'];
$subject_name = $_POST['subject_name'];
$subject_code = $_POST['subject_code'];
$amount_rupees = $_POST['amount_rupees'];
$amount_ethers = $_POST['amount_ethers'];

// Establish database connection


$conn = mysqli_connect("localhost", "root", "", "students");

// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}

// Check if the student already exists based on registration number


$check_student_query = "SELECT * FROM Students WHERE
Registration_Number = '$registration_number'";
$check_student_result = mysqli_query($conn, $check_student_query);

if (mysqli_num_rows($check_student_result) > 0) {
// Student already exists, check if the name matches
$existing_student = mysqli_fetch_assoc($check_student_result);
if ($existing_student['Name'] !== $name) {
// Different name for existing registration number, show error
echo "<p>Error: A student with the same registration number already exists
but with a different name.</p>";
exit; // Stop further execution
}
// Get the Student_ID of the existing student
$student_id = $existing_student['Student_ID'];
} else {
// Student doesn't exist, insert new student

53
$insert_student_query = "INSERT INTO Students (Registration_Number,
Name,branch,course) VALUES ('$registration_number', '$name','$branch','$course')";
mysqli_query($conn, $insert_student_query);
// Get the Student_ID of the newly inserted student
$student_id = mysqli_insert_id($conn);
}

// Check if the subject already exists for this student


$check_subject_query = "SELECT * FROM Failed_Subjects WHERE Student_ID
= $student_id AND Subject_Code = '$subject_code'";
$check_subject_result = mysqli_query($conn, $check_subject_query);

if (mysqli_num_rows($check_subject_result) > 0) {
// Subject already exists for this student, show error
echo "<p>Error: This subject already exists for this student.</p>";
exit; // Stop further execution
}

// Insert failed subject details into Failed_Subjects table


$insert_failed_subject_query = "INSERT INTO Failed_Subjects (Student_ID,
Subject_Name, Subject_Code, amountRupees, amountEthers) VALUES ($student_id,
'$subject_name', '$subject_code', '$amount_rupees', '$amount_ethers')";
mysqli_query($conn, $insert_failed_subject_query);

// Close database connection


mysqli_close($conn);

// Display success message


echo "<p class='success'>Student details inserted successfully.</p>";

} else {
// Handle the case when form fields are not properly submitted
echo "Error: Form fields are not properly submitted.";
}
}
?>
<div id="insert_error_message" style="display:none;"></div>
</div>

<div class="container" >


<div id="student_info">
<h2>Student Details</h2>
<?php
// Check if the form is submitted

54
if ($_SERVER["REQUEST_METHOD"] == "POST" &&
isset($_POST['search_registration_number'])) {
// Retrieve the registration number entered by the user
$registration_number = $_POST['search_registration_number'];

// Validate registration number format if needed

// Establish database connection


$conn = mysqli_connect("localhost", "root", "", "students");

// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}

// Retrieve student details based on registration number


$student_query = "SELECT * FROM Students WHERE Registration_Number =
'$registration_number'";
$student_result = mysqli_query($conn, $student_query);

if (mysqli_num_rows($student_result) > 0) {
// Display student details
$student_row = mysqli_fetch_assoc($student_result);
echo "<p><strong>Registration Number:</strong> " .
htmlspecialchars($student_row['Registration_Number'] ?
$student_row['Registration_Number'] : "NULL") . "</p>";
echo "<p><strong>Name:</strong> " . htmlspecialchars($student_row['Name'] ?
$student_row['Name'] : "NULL") . "</p>";
echo "<p><strong>Course:</strong> " . htmlspecialchars($student_row['course'] ?
$student_row['course'] : "NULL") . "</p>";
echo "<p><strong>Branch:</strong> " . htmlspecialchars($student_row['branch']
? $student_row['branch'] : "NULL") . "</p>";

// Retrieve failed subjects of the student including amount from transactions


$failed_subjects_query = "SELECT failed_subjects.Subject_Name,
failed_subjects.Subject_Code, transactions.Payment_Type, Transactions.Transaction_ID,
failed_subjects.amountEthers
FROM Failed_Subjects
LEFT JOIN transactions ON failed_Subjects.Student_ID =
transactions.Student_ID
WHERE Failed_Subjects.Student_ID = (SELECT Student_ID
FROM Students WHERE Registration_Number = '$registration_number')";
$failed_subjects_result = mysqli_query($conn, $failed_subjects_query);

55
if (mysqli_num_rows($failed_subjects_result) > 0) {
// Display failed subjects in a table
// Display failed subjects in a table
echo "<h3>Failed Subjects:</h3>";
echo "<table>";
echo "<tr><th>Subject Name</th><th>Subject Code</th><th>Payment
Type</th><th>Transaction ID</th><th>Amount</th><th>Update</th></tr>";
while ($failed_subject_row = mysqli_fetch_assoc($failed_subjects_result)) {
echo "<tr>";
echo "<td>" . htmlspecialchars($failed_subject_row['Subject_Name'] ?
$failed_subject_row['Subject_Name'] : "NULL") . "</td>";
echo "<td>" . htmlspecialchars($failed_subject_row['Subject_Code'] ?
$failed_subject_row['Subject_Code'] : "NULL") . "</td>";
echo "<td>" . htmlspecialchars($failed_subject_row['Payment_Type'] ?
$failed_subject_row['Payment_Type'] : "NULL") . "</td>";
echo "<td><span class='copy-text'>" .
htmlspecialchars($failed_subject_row['Transaction_ID'] ?
$failed_subject_row['Transaction_ID'] : "NULL") . "</span></td>";
echo "<td>" . htmlspecialchars($failed_subject_row['amountEthers'] ?
$failed_subject_row['amountEthers'] : "NULL") . "</td>";
echo "<td><input type='checkbox' name='select_subject[]' class='cyberpunk-checkbox'
value='" . htmlspecialchars($failed_subject_row['Subject_Code']) . "'></td>";
echo "</tr>";
}
echo "</table>";

} else {
echo "<p>No failed subjects found.</p>";
}
} else {
echo "<p>No Student found with the Registration Number : " .
htmlspecialchars($registration_number) . "</p>";
}

// Close database connection


mysqli_close($conn);
}
?>
</div>
</div>
<script src="./scripts/adminPage.js"></script>
<script>
// Client-side form validation

56
document.getElementById("insert_form").addEventListener("submit", function(event)
{
var registrationNumber =
document.getElementById("insert_registration_number").value.trim();
var name = document.getElementById("insert_name").value.trim();
var branch = document.getElementById("insert_branch").value.trim();
var course = document.getElementById("insert_course").value.trim();
var subjectName = document.getElementById("insert_subject_name").value.trim();
var subjectCode = document.getElementById("insert_subject_code").value.trim();
var amountRupees =
document.getElementById("insert_amount_rupees").value.trim();
var amountEthers =
document.getElementById("insert_amount_ethers").value.trim();

if (!registrationNumber || !name || !branch || !course || !subjectName || !subjectCode ||


!amountRupees || !amountEthers) {
// Display error message
document.getElementById("insert_error_message").innerText = "All fields are
required.";
document.getElementById("insert_error_message").style.display = "block";
// Prevent form submission
event.preventDefault();
}
});
</script>
</body>

</html>

EthersPyament:Php

<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Student Details</title>
<link rel="stylesheet" href="./css/ethersPayment.css">

57
<script
src="https://cdn.ethers.io/scripts/ethers-v3.min.js"
charset="utf-8"
type="text/javascript"
></script>
</head>
<body>
<div class="container">
<div class="card">
<?php
session_start(); // Start the session

// Check if the registration number is provided in the URL


if (isset($_GET['registration_number'])) {
$registrationNumber = $_GET['registration_number'];

// Database connection
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "students";

// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}

// Fetch student details from database


$sql = "SELECT Registration_Number, Name, branch, course FROM students
WHERE Registration_Number = '$registrationNumber'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// Output student details
while ($row = $result->fetch_assoc()) {
// Store student details in variables
$registrationNumber = $row['Registration_Number'];
$name = $row['Name'];
$branch = $row['branch'];
$course = $row['course'];

58
// Output student details
echo "<h2>Student Details</h2>";
echo "<p>Registration Number: " . $registrationNumber . "</p>";
echo "<p>Name: " . $name . "</p>";
echo "<p>Branch: " . $branch . "</p>";
echo "<p>Course: " . $course . "</p>";
}
} else {
echo "<p>No student details found.</p>";
}

$conn->close();
} else {
echo "<p>No registration number provided.</p>";
}
?>
</div>
<div class="card">
<h2>Selected Subjects</h2>
<table>
<thead>
<tr>
<th>Index</th>
<th>Subject Name</th>
<th>Subject Code</th>
<th>Ethers</th>
</tr>
</thead>
<tbody id="selectedRowsBody"></tbody>
</table>
</div>
</div>
<div class="card">
<h2>Pay with Crypto</h2>
<!-- Placeholder content for cryptocurrency payment -->
<div class="cryptoPaymentContent">
<h1>Transfer Funds via MetaMask</h1>
<div id="accountDetailsDiv">
<!-- Account details will be displayed here -->
</div>
<br />
<button id="connectButton">Connect Metamask</button>
<!-- Add id attribute to the Transfer Funds button -->
<div id="amount"></div>

59
<button id="transferButton">Transfer Funds</button>
</div>
</div>
<div id="transactionDetailsDiv" class="receipt" style="display: none;">
<!-- Transaction details will be displayed here -->
<h1>Receipt</h1>
<?php
// Check if student details are available
if (isset($registrationNumber) && isset($name) && isset($branch) && isset($course)) {
echo "<p><strong>Registration Number:</strong> $registrationNumber</p>";
echo "<p><strong>Name:</strong> $name</p>";
echo "<p><strong>Branch:</strong> $branch</p>";
echo "<p><strong>Course:</strong> $course</p>";
}
?>
<p><strong>Payment Type:</strong> Ethers</p>
<p><strong>Amount:</strong> <span id="paymentAmount"></span> Eth</p>
<p><strong>Transaction ID:</strong> <span id="transactionId"></span></p>
<p><strong>From Address:</strong> <span id="fromAddress"></span></p>
<p><strong>To Address:</strong> <span id="toAddress"></span></p>
<p><strong>Timestamp:</strong> <span id="timestamp"></span></p>
<h2>Selected Subjects</h2>
<table>
<thead>
<tr>
<th>Index</th>
<th>Subject Name</th>
<th>Subject Code</th>
<th>Ethers</th>
</tr>
</thead>
<tbody id="additionalTableBody"></tbody>
</table>
<!-- Add print button here -->
<button id="printButton">Print Receipt</button>
</div>

<script>
// Retrieve selected rows from session storage
document.getElementById("amount").innerText =sessionStorage.getItem('ethersSum');
var selectedRows = JSON.parse(sessionStorage.getItem("selectedRows"));

// Display selected rows


var selectedRowsBody = document.getElementById("selectedRowsBody");

60
var index = 1;
if (selectedRows) {
selectedRows.forEach(function (row) {
var newRow = document.createElement("tr");
newRow.innerHTML = `
<td>${index}</td>
<td>${row.Subject_Name}</td>
<td>${row.Subject_Code}</td>
<td>${row.Ethers}</td>
`;
selectedRowsBody.appendChild(newRow);
index++;
});
}

// Display selected rows in the receipt


var additionalTableBody = document.getElementById("additionalTableBody");
if (selectedRows) {
selectedRows.forEach(function (row, index) {
var newRow = document.createElement("tr");
newRow.innerHTML = `
<td>${index + 1}</td>
<td>${row.Subject_Name}</td>
<td>${row.Subject_Code}</td>
<td>${row.Ethers}</td>
`;
additionalTableBody.appendChild(newRow);
});
}

const connectButton = document.getElementById("connectButton");


const accountDetailsDiv = document.getElementById("accountDetailsDiv");

async function updateAccountDetails(accounts) {


try {
const selectedAddress = ethereum.selectedAddress;
if (!selectedAddress) {
alert(
"No account selected in MetaMask. Please select an account to proceed."
);
return;
}

const provider = new ethers.providers.Web3Provider(window.ethereum);

61
const balance = await provider.getBalance(selectedAddress);

// Convert balance from Wei to Ether


const balanceInEther = ethers.utils.formatEther(balance);

// Update account details in HTML


accountDetailsDiv.innerHTML = `
<p>Connected account: ${selectedAddress}</p>
<p>Account balance: ${balanceInEther} ETH</p>
`;
} catch (error) {
console.error("Error updating account details:", error);
}
}

async function transferFunds() {


if (!ethereum.selectedAddress) {
alert("Please connect to the wallet");
return;
}
const walletAddress = "0xa6Bf6462CFC22F4c2F1fe23d54eFF968d19Afa4A";

const ethersSum = sessionStorage.getItem("ethersSum");


const registrationNumber = <?php echo isset($registrationNumber) ? $registrationNumber
: "null"; ?>;
const selectedRows = JSON.parse(sessionStorage.getItem("selectedRows")); // Retrieve
selected rows data

try {
const selectedAddress = ethereum.selectedAddress;
if (!selectedAddress) {
throw new Error(
"No account selected in MetaMask. Please select an account to proceed."
);
}

// Update the database with transaction details and selected rows data

const provider = new ethers.providers.Web3Provider(window.ethereum);


const signer = provider.getSigner(selectedAddress);

const transactionResponse = await signer.sendTransaction({


to: walletAddress,
value: ethers.utils.parseEther(ethersSum.toString()),

62
});

// Store transaction details in session storage


sessionStorage.setItem("transactionId", transactionResponse.hash);
sessionStorage.setItem("fromAddress", selectedAddress);
sessionStorage.setItem("toAddress", walletAddress);
sessionStorage.setItem("timestamp", new Date().toLocaleString());
document.getElementById("printButton").style.display = "block";

// Display receipt
displayReceipt();

const response = await fetch('update_database.php', {


method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({
transactionId: sessionStorage.getItem("transactionId"),
registrationNumber: registrationNumber,
ethersSum: ethersSum,
selectedRows: selectedRows // Include selected rows data
})
});

if (!response.ok) {
throw new Error('Failed to update database');
}
document.querySelector('.cryptoPaymentContent').style.display = 'none';
// Show print button
document.getElementById("printButton").style.display = "block";

alert("Transaction sent successfully!");


} catch (error) {
console.error("Error:", error.message);
alert(
"Failed to send transaction. Please check console for error details."
);
}
}

function displayReceipt() {
// Retrieve payment details from session storage

63
var ethersSum = sessionStorage.getItem("ethersSum");
var transactionId = sessionStorage.getItem("transactionId");
var fromAddress = sessionStorage.getItem("fromAddress");
var toAddress = sessionStorage.getItem("toAddress");
var timestamp = sessionStorage.getItem("timestamp");

// Display payment details in the receipt


document.getElementById("paymentAmount").textContent = ethersSum;
document.getElementById("transactionId").textContent = transactionId;
document.getElementById("fromAddress").textContent = fromAddress;
document.getElementById("toAddress").textContent = toAddress;
document.getElementById("timestamp").textContent = timestamp;

// Display receipt
document.getElementById("transactionDetailsDiv").style.display = "block";

// Show print button


document.getElementById("printButton").style.display = "block";
}

// Function to print receipt


function printReceipt() {
var printContents = document.getElementById("transactionDetailsDiv").innerHTML;
var originalContents = document.body.innerHTML;
var printWindow = window.open('', '_blank');
printWindow.document.body.innerHTML = printContents;
printWindow.print();
}

// Bind event listener for the print button


document.getElementById("printButton").addEventListener("click", printReceipt);

// Bind event listener for the "Transfer Funds" button


document
.getElementById("transferButton")
.addEventListener("click", transferFunds);

// Bind event listener for connecting MetaMask


connectButton.addEventListener("click", async () => {
if (typeof window.ethereum !== "undefined") {
try {
const accounts = await window.ethereum.request({
method: "eth_requestAccounts",

64
});
await updateAccountDetails(accounts);
window.ethereum.on("accountsChanged", updateAccountDetails);
} catch (error) {
console.error("Error connecting to MetaMask:", error);
}
} else {
console.error("Metamask not detected.");
}
});

// Handling MetaMask availability and network change


window.ethereum.on("chainChanged", function (chainId) {
alert("Please switch to the correct network to proceed.");
});

</script>
</body>
</html>

65

You might also like