0% found this document useful (0 votes)
6 views

Report Final (2)

The project report outlines the development of a blockchain-enabled social networking application that incorporates automated content filtering to address issues such as misinformation, data breaches, and lack of effective moderation in traditional platforms. By leveraging blockchain technology, the application aims to enhance user privacy, ensure data credibility, and allow users to earn cryptocurrency through their interactions. The report details the framework, methodologies, and various modules implemented to create a secure and trustworthy social networking environment.

Uploaded by

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

Report Final (2)

The project report outlines the development of a blockchain-enabled social networking application that incorporates automated content filtering to address issues such as misinformation, data breaches, and lack of effective moderation in traditional platforms. By leveraging blockchain technology, the application aims to enhance user privacy, ensure data credibility, and allow users to earn cryptocurrency through their interactions. The report details the framework, methodologies, and various modules implemented to create a secure and trustworthy social networking environment.

Uploaded by

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

BLOCKCHAIN ENABLED SOCIAL

NETWORKING APPLICATION WITH


AUTOMATED CONTENT FILTERING

PROJECT REPORT
Submitted by

AADHITHYANARAYANAN V A
ASI19CS001

AJAY ANTU
ASI19CS018

ASHNA SAJU
ASI19CS037

Under the guidance of

PROF. AJAY BASIL VARGHESE

To

APJ Abdul Kalam Technological University


in partial fulfillment of the requirements for the award of the Degree
of
Bachelor of Technology In Computer Science and Engineering

Department of Computer Science and Engineering


(NBA Accredited Program)

ADI SHANKARA INSTITUTE OF ENGINEERING AND TECHNOLOGY


KALADY

MAY 2023
BLOCKCHAIN ENABLED SOCIAL NETWORKING
APPLICATION WITH AUTOMATED CONTENT
FILTERING

PROJECT REPORT
Submitted by

AADHITHYANARAYANAN V A
ASI19CS001

AJAY ANTU
ASI19CS018

ASHNA SAJU
ASI19CS037

Under the guidance of

PROF. AJAY BASIL VARGHESE

To

APJ Abdul Kalam Technological University


in partial fulfillment of the requirements for the award of the Degree
of
Bachelor of Technology In Computer Science and Engineering

Department of Computer Science and Engineering


(NBA Accredited Program 2022-2025)

ADI SHANKARA INSTITUTE OF ENGINEERING AND TECHNOLOGY


KALADY
MAY 2023
ADI SHANKARA INSTITUTE OF ENGINEERING
AND TECHNOLOGY, KALADY

DEPARTMENT OF COMPUTER SCIENCE


AND ENGINEERING

CERTIFICATE

Certified that this is a bonafide record of the project entitled

“BLOCKCHAIN ENABLED SOCIAL


NETWORKING APPLICATION WITH
AUTOMATED CONTENT
FILTERING”

Submitted by

AADHITHYANARAYANAN V A
ASI19CS001
AJAY ANTU
ASI19CS018
ASHNA SAJU
ASI19CS037

during the year 2022-23 in partial fulfillment of the requirement for


the award of the degree of
Bachelor of Technology in Computer Science and Engineering

Internal Guide Project Coordinator Head of the Department


DECLARATION

We undersigned hereby declare that the project report “Blockchain Enabled Social
Networking Application with Automated Content Filtering” , submitted for partial
fulfillment of the requirements for the award of degree of Bachelor of Technology of APJ
Abdul Kalam Technological University, Kerala is a bonafide work done by us under
supervision of Prof. Ajay Basil Varghese. This submission represents our ideas in our own
words and where ideas or words of others have been included, we have adequately and
accurately cited and referenced the original sources. We also declare that we have adhered to
ethics of academic honesty and integrity and have not misrepresented or fabricated any data
or idea or fact or source in our submission. We understand that any violationof the above will
be a cause for disciplinary action by the institute and/or the University and can also evoke
penal action from the sources which have thus not been properly cited or from whom proper
permission has not been obtained. This report has not been previously formed the basis for
the award of any degree, diploma or similar title of any other University.

PLACE: KALADY SIGNATURE


DATE:

AADHITHYANARAYANAN V A

AJAY ANTU

ASHNA SAJU
ACKNOWLEDGMENT

As the very outset we would like to give the first honors to God, who gave the wisdom and
knowledge to complete this project.

Our extreme thanks to Dr. Sreepriya S., Principal for providing the necessary facilities for
the completion of this project in our college.

We sincerely extend our thanks to Prof . R. Rajaram, Dean Projects & Consultancy for all
the help, motivation and guidance throughout the completion of this project.

We also like to extend our gratitude to Prof. Manesh T. HOD CSE for all the help,
motivation and guidance throughout the project.

We wish to extend our sincere thanks to the project coordinators Prof. Divya K.S. and
Prof. Gripsy Paul and our Project Guide Prof. Ajay Basil Varghese, for their valuable
guidance and support throughout the project.

We also wish to thank all teaching and non-teaching faculty of Computer Science and
Engineering department for their cooperation.

We also thank our Parents, friends and all well-wishers who supported directly or
indirectly during the course of this project.
VISION AND MISSION OF THE DEPARTMENT

VISION

Nurturing globally competent Computer Science and Engineering graduates capable of taking
challenges in the industry and Research & Development activities.

MISSION

● Imparting quality education to meet the needs of industry, and to achieve excellence in
teaching and learning.
● Inculcating value-based, socially committed professionalism for development of society.
● Providing support to promote quality research.
ABSTRACT

Social media has transformed the mode of communication globally by providing an


extensive system for exchanging ideas, initiating business contracts, and proposing new
professional ideas. Social media enable millions of internet users around the world to
exchange information. However, there are many limitations to the use of social media, such
as misinformation, lack of effective content moderation, digital piracy, data breaches,
identity fraud, and fake news. Furthermore, people are spared the agony of being persecuted
for their opinions on social media. In order to address these limitations, several studies have
introduced the application of Blockchain technology in social media. Blockchain can
provide transparency, traceability, tamper-proofing, confidentiality, security, information
control, and supervision. This project proposes a framework for secure, trustworthy social
networking that also creates value for user-generated content by using a blockchain. The
blockchain-based application puts the interests of the users ahead of the corporation.
Furthermore, because there is no centralized authority, users on these networks have more
privacy. As a result, the freedom of speech and expression is preserved. Users can earn
cryptocurrency by posting and interacting on most decentralized social networking
platforms. We have also added many filters to the adding of data to the blockchain. The
immutable nature of blockchain is the reason for including such filter. Filters like violence
detection in chats, inappropriate image detection is included in this project. These filters
make sure data stored in blockchain have some credibility.
CONTENTS
Chapter Title Page No.
1 INTRODUCTION
1.1 Background 1
1.2 Existing system 1
1.3 Problem statement 2
1.4 Scope 4
2 LITERATURE SURVEY
2.1 Decentralized online social network 5
2.2 Blockchain based friends matching scheme 5
2.3 Homomorphic encryption 6
2.4 Privacy enhancing technologies 6
2.5 Federated Learning 7
2.6 Differential privacy in blockchain 7
2.7 Deep learning approach for video classification 8
2.8 Realtime violence detection 9
2.9 Hate speech detection 9
2.10 Blockchain based secure storage & access scheme 10
3 PROPOSED SYSTEM
3.1 Objective 11
3.2 Methodology 11
3.2.1 System Architecture 11
3.2.2 Flow Diagram 12
3.2.3 Functional Requirements 12
3.2.4 Non - Functional Requirements 14
3.2.5 Hardware Requirements 15
3.2.6 Software Requirements 15
3.2.7 Life Cycle used 15
3.2.8 Economic feasibility 18
4 SYSTEM DESIGN
4.1 Use Case Diagram 19
4.2 Class Diagram 20
4.3 Sequence Diagram 21
4.4 Collaboration Diagram 22
4.5 Interaction Diagram 23
5 ARCHITECTURE
5.1 Flow Chart 24
5.2 Data Collection 28
5.3 Module 1 - Login Using Metamask 30
5.4 Module 2 - Text Filtering 31
5.5 Module 3 - Image Filtering 32
5.6 Module 4 - Blockchain Data Storage and Retrieval 33
5.7 Module 5 - IPFS Data Storage 35
5.8 Tech Stack 35
5.9 Blockchain and IPFS Connection 38
6 TESTING
6.1 Test Case
Module
of - 1 41
6.2 Test Case
Module
of - 2 42
6.3 Test Case
Module
of - 3 44
6.4 Test Case
Module
of - 4 45
6.5 Test Case
Module
of - 5 49
7 SAMPLE CODE
7.1 Front end 51
7.2 Image and Text Classification 64
7.3 Blockchain and Smart Contract 68
7.4 Unit Testing of Smart Contract 73
7.5 IPFS Storage 76
8 RESULT AND ANALYSIS
8.1 Screen Shots 77
8.2Analysis 80
9 CONCLUSION 83
10 FUTURE ENHANCEMENT 84
11 REFERENCES 85
LIST OF TABLES

No. Title Page No.

6.1 Comparison of various content filter models 42

6.2 Comparison of various image filter models 44

8.3 Comparison between Ethereum & Polygon 82


LIST OF FIGURES
No. Title Page No.

3.1 Architecture of blockchain based social media platform 12

4.1 Use case Diagram 19

4.2 Class Diagram 20

4.3 Sequence Diagram 21

4.4 Collaboration Diagram 22

4.5 Interaction Diagram 23

6.1 Login using Metamask(Choosing the account) 41

6.2 Login using Metamask(Connecting the account) 42

6.3 Testing of text classifier 43

6.4 Testing of image classifier 44

6.5 Add and view post 45

6.6 Add and view comment 45

6.7 Follow user 46

6.8 Chat Messaging 47

6.9 User Profile Management 48

6.10 View users post 49

6.11 Uploading images to IPFS 49

6.12 Hashes of images stored in IPFS 50

6.13 Image corresponding to an image 50

8.1 Metamask Login 77

8.2 Home Page 77

8.3 Profile 78

8.4 View User Post 78

8.5 View User 79

8.6 Text Filtering 79

8.7 Image classification-Negative image 80

8.8 Image classification-Normal image 80


ABBREVIATIONS

NLP Natural language processing


DOSN Decentralized Online Social Network
OSN Online Social Network
BCOSN Blockchain-based Decentralized OSN

CP-ABE CP-ABE Ciphertext-Policy Attribute-Based Encryption

CT Ciphertext

PET Privacy Enhancing Technologies


IoT Internet of Things
GDPR General Data Protection Regulations
ISO/IEC International Organization for Standardization
PII Personally Identifiable Information
IEC International Electro technical Commission
PPDA-FL Privacy Preserving Decentralized Aggregation for Federated Learning
MPC Multi-Party Computation
DP Differential Privacy
CNN Convolutional Neural Network
RNN Recurrent Neural Network
MSM Motion Saliency Map
TSE Temporal Squeeze-and-Excitation
LSTM Long Short-Term Memory
PDHS Pattern-Based Deep Hate Speech
POS Part-of-Speech
EMR Electronic Medical Record
IPFS InterPlanetary File System
ETH Ethereum
NLTK Natural Language Toolkit
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 1
INTRODUCTION

1.1 Background
Social media platforms are growing in popularity. Platforms such as Twitter and
Facebook have changed the way people around the world communicate by providing a
comprehensive system for sharing ideas, starting commerce, and pitching his ideas for new
careers. People can use social media platforms to share information, greatly enhancing
communication and contact. Connect with new organizations, find former classmates and
friends, and find people with similar interests across political, economic, and geographic
boundaries. As a result, social media makes it easy to share knowledge among millions of
Internet users around the world.

However, social media has certain limitations. Academics, government officials, and
users have raised many important issues, including widespread control by a few companies,
the spread of misinformation, debates over limited or unrestricted dialogue, breaches of
confidentiality, and political restrictions. Recognizing using personal information on social
media raises privacy concerns and poses security risks. Many experts are already working
on solutions to this problem by integrating blockchain technology and social media. As a
response to significant privacy issues over social media, fake news, and censorship, the
decentralisation of social services has gained popularity in recent years and numerous firms
have worked together to create noteworthy breakthroughs for implementing blockchain on
social media.

1.2 Existing system


 Traditional Centralized Social Networking Platforms: The majority of social
networking platforms rely on centralized architectures for data storage and content
moderation. While these platforms offer a convenient way to connect and share
information, they face challenges such as data privacy concerns, vulnerability to
hacking, and limitations in effectively moderating content. Manual content
moderation is time-consuming, often resulting in delays in removing inappropriate
content and ensuring a safe user experience.
 Centralized Content Filtering: Some social networking platforms employ

Department of Computer Science and Engineering, Page 1


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

centralized content filtering mechanisms to identify and remove objectionable content.


However, this approach has its drawbacks. It raises concerns about censorship and
biased decision-making since the responsibility lies with a centralized authority.
Moreover, centralized systems are more prone to hacking and data breaches,
potentially compromising user privacy and security.
 Third-Party Content Moderation Services: Certain platforms outsource content
moderation to third-party services. While this approach offloads the responsibility
of moderation, it can introduce additional costs and dependencies. It also raises
concerns about data privacy, as sensitive user information may be accessed by
third parties. Additionally, the reliance on external services may result in delays
and inconsistencies in content moderation.
 Manual Reporting and Moderation: Many social networking platforms rely on
users reporting inappropriate content. Although reporting systems are useful, they
heavily depend on user vigilance and can be inefficient in detecting emerging or
subtle forms of inappropriate content. Manual moderation can also lead to
inconsistencies in the application of content guidelines, affecting the user
experience.
Limitations of Existing Systems:
 Lack of Transparency: Centralized platforms often lack transparency in their
content moderation processes, leading to concerns about biased decision-making
and lack of accountability. Users have limited visibility into how and why certain
content is filtered or removed.
 Data Privacy and Security Risks: Centralized storage systems can be vulnerable to
data breaches and hacking attempts, exposing sensitive user information. Users
may also be hesitant to share personal data due to privacy concerns.
 Inefficient and Delayed Moderation: Manual content moderation processes can be
time-consuming, leading to delays in removing inappropriate content. Users may
be exposed to offensive or harmful content for extended periods before it is
addressed

1.3 Problem statement


The existing social networking platforms face significant challenges in maintaining a
safe and positive user experience due to the presence of inappropriate content, offensive

Department of Computer Science and Engineering, Page 2


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

comments, and cyberbullying. The limitations of traditional centralized architectures,


manual content moderation processes, and the lack of transparency pose serious concerns for
users and platform administrators. Therefore, there is a need to develop a blockchain-
enabled social networking application with automated content filtering to address these
issues effectively.

The most popular decentralized method in use today is blockchain technology, which
has been explored in creating the next generation of decentralized social websites. Apart
from bitcoin, the application of blockchain has extended too many areas recently. Using
blockchain on social media has many benefits, such as improving user privacy, bypassing
restrictions, and allowing users to conduct cryptocurrency transactions on social media
platforms. The conceptof data protection, which usually refers to the protection of data by an
individual or group that should not be known to outsiders, is a very complex one. Critical
information is protected in a decentralized data store created by blockchain, making it
extremely impossible to hack the data. Blockchains used in social networks offer the
advantage of secure authentication while maintaining anonymity for people living in
repressive regimes or areas where censorship is a problem. By providing a transparent,
immutable, and certifiable registry of operations and creating a secure peer-to-peer
environment for storing and transferring data, blockchain ensuresprovenance,
trustworthiness, and traceability of data we can guarantee it.
The key problems to be addressed by this project include:
 Inappropriate Content Filtering: Existing systems struggle to efficiently and accurately
filter out inappropriate images, comments, and text from user-generated content.
Manual moderation processes are time-consuming and prone to inconsistencies,
leading to delays in removing objectionable content and exposing users to harmful
material.
 Data Privacy and Security: Centralized storage architectures put user data at risk of
unauthorized access, hacking attempts, and data breaches. Users are increasingly
concerned about their privacy and the security of their personal information shared on
social networking platforms.
 Lack of Transparency in Content Moderation: Users often have limited visibility into
the content moderation processes employed by social networking platforms. The lack
of transparency raises concerns about biased decision-making, censorship, and the
inconsistent application of content guidelines.

Department of Computer Science and Engineering, Page 3


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

1.4 Scope
The scope of the project encompasses the development of a blockchain-enabled
social networking application with automated content filtering, utilizing deep learning
models for image filtering and natural language processing models for text filtering. The
project aims to address the limitations of existing social networking platforms by
providing a safer and more transparent user experience. The following aspects fall within
the scope of the project:
 User Registration and Profile Management: Users will be able to register accounts,
create profiles, and manage their personal information. This includes features such as
profile picture upload, bio, and other relevant details.
 Social Networking Functionality: The application will provide standard social
networking features, including the ability to post content, like and comment on posts,
follow other users, and engage in private messaging.
 Decentralized Storage: The project will integrate blockchain technology and IPFS for
decentralized storage of user-generated content, ensuring data resilience, transparency,
and censorship resistance. Content, including images, comments, and text, will be
stored securely on the blockchain and IPFS.
 Automated Content Filtering: Deep learning models will be implemented to
automatically filter out inappropriate images, offensive comments, and text content.
The image filtering model will analyze uploaded images to identify objectionable
content, while the text filtering model will analyze text-based content for offensive
language, hate speech, or inappropriate comments.
 User Interface and User Experience (UI/UX): The application will have an intuitive
and user-friendly interface, providing a seamless and engaging experience for users.
Attention will be given to designing an appealing and responsive UI/UX, considering
factors such as ease of navigation, content visibility, and overall aesthetic appeal.
 Privacy and Security: The project will prioritize user privacy and implement
appropriate security measures to safeguard user data. This includes encryption
techniques, secure user authentication, and adherence to data protection best practices.

Department of Computer Science and Engineering, Page 4


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 2
LITERATURE SURVEY

2.1 Decentralized online social network


L. Jiang et al.[1] Online social networks (OSNs) are becoming more and more
common inpeople's lives, but they face the problem of privacy leakage due to centralized
data management mechanisms. Decentralized NSOs (DOSNs) have the potential to solve the
privacy issue, but they are ineffective at providing essential services like availability of data
and access control. In this article, taking into account the difficulties that OSN and DOSN
must overcome, we propose a novel DOSN framework that makes use of cutting-edge
blockchain technology and combines the benefits of both conventional centralised OSN and
DOSN. Blockchain is utilisedin this case as a trustworthy server for centralised management
services, combining smart contracts. Isolate the storage service in the meantime to provide
users total control over their data. It makes use of the Blockchain-based Decentralized OSN
DOSN platform (BCOSN). In addition to guaranteeing user privacy and data integrity, it
also makes it possible for verifiable user IDs, newsfeed notifications, and useful friend
suggestions. Here, two smart contracts are supposed to implement some functionality
provided by traditional OSN central servers. This is more difficult to achieve with existing
DOSN.

2.2 Blockchain based friends matching scheme


F. Yang et al.[2] It uses a hierarchical, blockchain-based attribute matching scheme
that provides privacy-preserving attribute matching across multiple semi-trusted servers.
This scheme uses CP-ABE and Bloom filter to meet the user's friend-finding needs, and
reduces the user's computational cost by outsourcing CP-ABE decoding. The hierarchical
blockchain also only implements the storage of consensus and matching results on the
blockchain; difficult calculations and huge amounts of data storage are off-chain,
minimising blockchain utilization and increasing efficiency. The suggested technique is
practical and effective, and experimental findings demonstrate that it can withstand single
point failure, collusion attacks, internal attacks, and external attacks. Communication data in
the system includes CTabc, CTapc, CTpcb, and CTbsc. If an external attacker can retrieve
user information or tamper with match results by reproducing and manipulating that data,
the attack will succeed.

Department of Computer Science and Engineering, Page 5


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

2.3 Homomorphic encryption


J. Kim et al.[3] Homomorphic encryption authorizes strategies that are performed on
encrypted information. There are two types of homomorphic encryption: partial and full.
Whilepartial homomorphism can only support one operation, homomorphic encryption can
support two different types of operations at once... Only basic actions like addition and
multiplication can be directed by partial and full homomorphic encryption systems. As a
result, it is inapplicable in situations where complex analytical calculations are needed to
process the data. In contrast, fully homomorphic encryption enables a broad range of
analytical operations on the encrypted data. However, this comes at the expense of
computational latency. Homomorphic encryption is impractical due to the large
computational overhead when applying operations to the encrypted data. Each operation
typically takes 2-5 seconds. This is especially time consuming for most practical
applications. Homomorphic encryption algorithms are therefore still counterproductive for
data-intensive applications, except that the computational overhead is greatly reduced.

2.4 Privacy enhancing technologies


S.-C. Cha et al.[4] The proliferation of Internet of Things (IoT) devices has
revolutionized various aspects of our lives, but it has also raised significant concerns
regarding privacy and the potential misuse of personal data. Privacy Enhancing
Technologies (PETs) have emerged as a crucial solution to address these concerns and
protect users' Personally Identifiable Information (PII). This paper provides an in-depth
analysis of PETs in the IoT domain, focusing on privacy threat issues and privacy
legislation. Through a systematic survey of 120 primary studies published between 2014 and
2017, the paper categorizes and evaluates PET solutions in terms of privacy protection
functions and coverage.
The study covers various aspects, ranging from high-level principles such as the
General Data Protection Regulations (GDPR) and ISO/IEC 29100:2011 requirements to the
practical resolution of privacy threats in IoT. By examining the existing PETs, the paper
aims to identify the current state of development and assess their compliance with legal
principles and privacy standards. The analysis delves into the effectiveness and alignment of
PETs with the evolving legal landscape, providing valuable insights into the gap between
existing solutions and the latest privacy requirements.
Based on the findings, the paper offers recommendations for future research
directions in PET development for the IoT. These recommendations aim to bridge the
Department of Computer Science and Engineering, Page 6
ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

identified gaps and enhance privacy protection in IoT environments. By addressing the
challenges of privacy threats and compliance with privacy standards, this research
contributes to the development of robust and privacy-conscious IoT systems, ensuring the
protection of users' personal data in an increasingly interconnected world.

2.5 Federated learning


B. Jeon et al.[5] Federated learning has emerged as a promising approach for
collaborative machine learning on decentralized data sources while preserving data privacy.
However, privacy concerns still arise during the aggregation phase, where models trained on
local data need to be combined to create a global model. This paper presents a novel
approach called Privacy Preserving Decentralized Aggregation for Federated Learning
(PPDA-FL) to address these concerns.
PPDA-FL leverages cryptographic techniques, specifically secure multi-party
computation (MPC), to enable privacy-preserving aggregation in federated learning settings.
The proposed approach ensures that no individual participant can learn the contributions of
others' local models, thereby protecting sensitive data and preserving privacy. By securely
combining the local models using cryptographic protocols, PPDA-FL achieves accurate and
efficient global model aggregation without compromising data confidentiality.
The paper provides a comprehensive analysis of the PPDA-FL framework, including
the underlying cryptographic protocols and their security guarantees. It also presents
experimental evaluations to assess the performance and effectiveness of the proposed
approach. The experiments demonstrate that PPDA-FL achieves comparable accuracy to
traditional federated learning approaches while providing strong privacy guarantees.
Overall, the paper highlights the significance of privacy-preserving techniques in
federated learning and introduces a practical solution, PPDA-FL, for secure and privacy-
preserving decentralized model aggregation. The findings contribute to advancing the field
of federated learning by addressing the crucial aspect of privacy during the aggregation
phase, enabling wider adoption of this collaborative learning paradigm in privacy-sensitive
domains.

2.6 Differential privacy in blockchain


M U Hassan et al.[6] Differential Privacy (DP) is a guaranteed preferred solution
that provides privacy of record by protecting an individual's personal information. We can
gather and share statistics about our clients in aggregate while maintaining their privacy

Department of Computer Science and Engineering, Page 7


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

thanks to differentiable data protection technology. This is accomplished by adding


statistical noise before sharing the data from each user. Aggregated facts from a dataset can
be extracted by subtracting noise. However, information about unique characters cannot be
inferred. Three main techniques are used for differential data protection: Laplacian,
Exponential, and Gaussian.Laplacian and Gaussian methods are commonly used for numeric
datasets and exponential strategies are used for non-numeric datasets. Differential privacy is
seen as a useful approach for collecting aggregated user data while protecting individual
privacy. However, privacy compromises the accuracy of the information. The quantity of
noise added has a significant impact on the data's accuracy and precision. Using the operator
epsilon, the trade-off between data accuracy and privacy is handled. The utility of the
information is impacted by the high epsilon cost of hiding sensitive information.
Furthermore, differential data protection only applies in circumstances where the use of
aggregated data is advantageous and cannot be applied to the provision of tailored services.

2.7 Deep learning approach for video classification


K. Yousaf et al.[7] The exponential growth of user-generated content on video-sharing
platforms like YouTube has raised concerns about the presence of inappropriate or harmful
content. Traditional content filtering methods often struggle to accurately identify and
classify such content, necessitating more advanced techniques. In this paper, a deep learning-
based approach is proposed for the detection and classification of inappropriate content in
YouTube videos.
The proposed approach leverages the power of deep learning models, specifically
Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs), to
automatically learn and extract relevant features from video frames and associated metadata.
The CNNs are employed to process the visual information in video frames, while the RNNs
analyze the temporal information in the video sequence. By combining these models, the
approach achieves effective detection and classification of inappropriate content across a
range of categories.
To train and evaluate the deep learning models, a large-scale dataset of YouTube
videos with manually annotated labels is utilized. The dataset covers various types of
inappropriate content, including violence, hate speech, nudity, and drug-related content.
Extensive experiments and evaluations are conducted to assess the performance of the
proposed approach in terms of accuracy, precision, recall, and F1-score.

Department of Computer Science and Engineering, Page 8


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

The results demonstrate that the deep learning-based approach outperforms traditional
methods in detecting and classifying inappropriate content in YouTube videos. It showcases
the potential of leveraging deep learning techniques for content filtering and moderation on
video-sharing platforms. The proposed approach not only enhances the accuracy and
efficiency of identifying inappropriate content but also allows for automated and scalable
content moderation, thus promoting a safer and more secure environment for users.
Overall, this paper presents an advanced deep learning-based approach for
inappropriate content detection and classification in YouTube videos. The findings
contribute to the ongoing efforts in developing effective content moderation mechanisms to
mitigate the risks associated with user-generated content on video-sharing platforms.

2.8 Real-time violence detection


M S Kang et al.[8] Violence detection is difficult because it must be performed on
videos captured by many surveillance cameras anytime, anywhere. When a violent crime
occurs, it must be reliably detected in real time and alerted to monitoring personnel quickly.
We thereforesuggest a novel violence detection pipeline in this research that may be used
with a conventional two-dimensional convolutional neural network (2D CNN). It has been
suggested that frame grouping will help 2D CNNs develop spatio-temporal representations
of videos. This straightforward processing technique groups three consecutive channel-
averaged frames as input for a 2D-CNN after channel-averaging the input frames.
Additionally, a lightweight spatial and temporal attention module is also proposed that
continuously enhances the effectiveness of violence detection. Motion Saliency Map
(MSM), a spatial attention module, can use the difference between succeeding frames to
identify salient areas in feature maps created from motion boundaries. The Temporal
Squeeze-and-Excitation (TSE) block is a type of temporal attention module that has the
ability to naturally emphasize times that correspond to target events. The suggested pipeline
has a considerable advantage over existing 3D CNN- based techniques in terms of
performance when compared to 2D CNN, and Long Short-Term Memory (LSTM).

2.9 Hate speech detection


P Sharmila et al.[9] This work aims to classify and detect hate speech as a pre-
trained Transformer language model using a linguistic pattern-based approach. A novel
cross-attention encoder with a two-stage attention mechanism was therefore proposed to
detect the existence of hate speech which uses a new pattern-based deep hate speech (PDHS)

Department of Computer Science and Engineering, Page 9


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

suggested model classifies each tweet into one of three groups (Hate speech, Offensive and
Neutral). For classification it uses POS tagging characteristics, sentiment polarity scores and
word embedding. It is used in order to improve the representation of tweets. The word
Embedding and the POS feature are not concatenated instead the dot product is computed to
extract just adjectives, adverbs, verbs, and nouns.

2.10 Blockchain based secure storage & access scheme


J. Sun et al.[10] Electronic Medical Records (EMRs) are critical assets in healthcare
systems, containing sensitive and confidential patient information. However, traditional EMR
storage and access methods face challenges related to data security, privacy, and
interoperability. In this paper, a blockchain-based secure storage and access scheme for EMRs
in the Interplanetary File System (IPFS) is proposed to address these challenges.

The scheme leverages blockchain technology to establish a decentralized and


immutable ledger for recording the metadata and access control information of EMRs. By
utilizing smart contracts, access permissions can be managed transparently and securely,
ensuring that only authorized individuals or entities can retrieve and modify EMR data.
Additionally, the scheme employs cryptographic techniques to protect the confidentiality and
integrity of EMRs during storage and transmission.

The IPFS is utilized as the underlying distributed file system, providing a resilient and
decentralized storage infrastructure for EMRs. The scheme enhances the security of EMRs by
breaking them into fragments and distributing them across multiple IPFS nodes, thereby
reducing the risk of unauthorized access or data loss. Moreover, the use of IPFS allows for
efficient and scalable retrieval of EMRs, promoting interoperability between healthcare
providers.

The proposed scheme is evaluated through experiments and simulations, demonstrating


its effectiveness in protecting EMR privacy and ensuring secure access. The results indicate
that the scheme provides robust security guarantees while maintaining efficient storage and
retrieval operations for EMRs in a decentralized and trustless environment.

Overall, the paper highlights the potential of blockchain technology and IPFS in
addressing the security and privacy challenges associated with EMR storage and access. The
proposed scheme offers a promising solution for healthcare systems, enabling secure and
efficient management of EMRs while ensuring patient data confidentiality and integrity.

Department of Computer Science and Engineering, Page 10


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 3
PROPOSED SYSTEM
3.1 Objective

The project aims to develop a social media website based on blockchain. There will
be a content filtering mechanism that will filter the contents uploaded by the users using
deep learning mechanism and remove inappropriate contents for all age groups
automatically. Comment section will be available under all the posts and the comments will
be filtered using an NLP model before getting posted. Chat option will be provided for
interaction between twousers and it will be end to end encrypted. It will provide maximum
security for user data as we are not directly saving any of their personal information and the
contents that are getting posted.It supports the option for users with an account and without
an account. For users without an account there will be option to view the post and only the
users with an account will get to access the remaining functionalities. The user’s personal
data and details of content posted willbe saved in a blockchain network.

3.2 Methodology
3.2.1 System Architecture

The project consists of a frontend and a backend. The frontend is the part which
providesthe users an interface to access the platforms functionalities. The platform consists
of features like adding a post, viewing a post, commenting on a post, real-time chatting, user
registration and authentication etc. as shown in Fig 3.1.When the user visits the platform,
he/she will have to undergo a registration process to use all the functionalities. The
unregistered users will only get to view the posts and the platform in general. Once after
registration user can view the post and if theywant to add a post it is also possible for the
registered user. The user can also add a comment on any of the posts. Once the user adds a
post or a comment, it is sent to the backend for processing. On reaching the backend the data
in the post and comments will be send to a filtering mechanism that consist of deep learning
and NLP models. The models are trained such that it can filter all the inappropriate and
violent contents in the post and comments. If the post/comment passes the filtering
mechanism, it is then sent to IPFS(Interplanetary FileSystem) for distributed storage.

Department of Computer Science and Engineering, Page 11


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

IPFS stores the data in a distributed manner. Blockchain is used with IPFS because it
supports file traceability metadata on a distributed file system like IPFS. IPFS assures us
that the data included in this network are unique (they are uniquely identified by an
identifier) and are protected against modifications, making this data immutable. In the event
that this data is changed, a new “hash” identifier is generated, which would not coincide
with the one stored inthe blockchain for the recorded data. After that the hash is it is stored
in the blockchain throughsmart contracts.

There is also an admin who can track only the activities that is happening in the
platform. The admin will not have control over the content that is posted on the platform.

3.2.2 Flow Diagram

Fig 3.1 – Architecture of blockchain based social media


platform

3.2.3 Functional Requirements


Functional Requirement (FR) is a description of the service that the software must
offer. It describes a software system or its components. A function is nothing but inputs to
the software system, its behavior, and outputs. Functional Requirements are also called
Functional Specification.

Below listed are the functional requirements for our system.

Department of Computer Science and Engineering, Page 12


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Login using Metamask


 Creating a Metamask account
 On clicking the login button, Metamask will open and the account can be
connected to the platform by clicking the connect button in the Metamask
window.
Add and view posts
 Taking the post (text and image)
 Calling the smart contract function for adding the post.
 Sending the post text and the image hash (from IPFS) to the blockchain for
storage
Add and view comments on a post
 Taking the comments
 Calling the smart contract function for adding the comments.
 Sending the comments to the blockchain for storage

Follow User
 User is able to follow other accounts in the platform.
 On following a user, the user’s public key will be mapped to the public key of
the followers .It can be retrieved by using the user’s public key.

Chat Messaging
 Allows users to chat with other users.
 A user has to follow the other user to chat with them
 All the chats will be saved in the blockchain and can be retrieved by using a
unique chat code.

User Profile Management


 Allows users to create and update their profile information.
 After filling all their information, these information will be send to the
blockchain for storage.

 If user has not created a profile, a new profile will be created. Else existing
information will be updated.

View Users Post


 User can view the posts created by them

Department of Computer Science and Engineering, Page 13


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 Each time a post is created, the post will be mapped to their public key in the
blockchain and it can be retrieved by using the same key.

Text Filtering
 Taking the contents like post text and comments
 Using NLP to classify the textual data into appropriate and inappropriate
contents
 Preventing any inappropriate text data from getting stored in the blockchain

Image Filtering
 Taking the contents like images uploaded.
 Applying deep learning algorithm on the image to find any violence
content (blood shed, gun, weapons) in images posted.
 Preventing any inappropriate images from getting stored in the IPFS

IPFS storage

 Blockchain has a limitation in terms of storage. So large files like images are
stored on the IPFS.
 IPFS is a decentralized and distributed storage solution to enable efficient
storage and retrieval of data while maintaining data integrity and
decentralization.It optimizes the blockchain storage.

3.2.4 Non - Functional Requirement


The definition of a non-functional requirement is: “Any Requirement That Specifies
How The System Performs A Certain Function.” Non-functional requirements when defined
and executed well will help to make the system easy to use and enhance performance.

Security and Privacy Requirement


 Decentralized storage for posts and comments
 Comments and post filtering for detecting violence and inappropriate contents

Environmental Requirements
 Each user must have a metamask account for login.
 Whenever a user uploads a post in the platform then the filtering mechanism
should check if the contents are appropriate for the platform.

Department of Computer Science and Engineering, Page 14


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 Ethereum blockchain - Once the post goes through a filtering mechanism it is


stored in an ethereum blockchain which works on proof of stake consensus
and the images will be stored in the IPFS storage which generates a unique
hash for a file. The hash is stored in the blockchain.

3.2.5 Hardware Requirements


Computer Hardware Requirements
 Ram
 Monitor
 SSD
 Keyboard
 CPU(preferably AMD or Intel multicore CPUs with minimum 6 cores)
 GPU(preferably NVidia GTX series GPUs)

Computer Hardware Resource Utilization Requirements


 64-bit operating system
 A CPU such as i7 series can increase the training speed of ML models
 Much larger datasets would be needing a higher end GPU like GTX 1080
(8GB) fortraining.

3.2.6 Software Requirements


Computer Software Requirements
 The ML model will be developed using Python
 The NLP model will be created using scikit-learn library
 The Deep learning model created using tensor flow library
 IPFS storage for decentralized storage
 Ethereum blockchain to store the user data and the hash of the images from
IPFS

 React js for the frontend.

3.2.7 Life Cycle Used


Requirements Gathering:

 Gather requirements from stakeholders, including the desired features and


functionalities of the blockchain-enabled social networking application.

Department of Computer Science and Engineering, Page 15


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 Identify specific requirements for text filtering and image filtering, such as
identifying and filtering toxic comments and detecting/filtering inappropriate or
violent images.

System Design:

 Design the overall system architecture, including the integration of text filtering
and image filtering modules.

 Develop a design of the user interfaces in figma

 Define the interactions and interfaces between different modules, such as login
using MetaMask, chat functionality, blockchain data storage and retrieval, IPFS
data storage for images, text filtering, and image filtering.

Implementation:

 Implement the modules of the project based on the defined design.

 Develop the front-end using technologies like React.js, HTML, CSS, and
JavaScript for user interfaces, including login, chat, post creation, comment
management, and viewing functionalities.

 Code the smart contracts using Solidity for blockchain data storage and
retrieval.

 Integrate MetaMask for secure authentication and interaction with the Ethereum
blockchain.

 Implement text filtering using Python and libraries such as Pandas, Scikit-Learn,
and NLTK for natural language processing tasks.

 Develop an NLP model to identify and filter toxic comments, utilizing


techniques like TF-IDF vectorization and classification algorithms like Logistic
Regression.

 Implement image filtering using deep learning frameworks like TensorFlow and
Keras.

 Train an image filtering model on datasets containing violent and non-violent


images, incorporating techniques like mini-batch training, optimization.

Department of Computer Science and Engineering, Page 16


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Testing and Quality Assurance:

 Conduct thorough testing of each module.

 Test the login module using MetaMask for seamless integration and secure
authentication.

 Test the chat module for real-time messaging, user interactions, and data
synchronization.

 Validate the accuracy and effectiveness of the text filtering module using
evaluation metrics like accuracy, precision, recall, and F1-score.

 Evaluate the image filtering module's performance through testing on diverse


images and assessing its ability to detect and classify inappropriate or violent
content.

 Utilize cross-validation approaches like k-fold cross-validation to validate the


generalization abilities of the text and image filtering models.

Deployment:

 Deploy the application to a production environment, including deploying the


smart contracts to the Ethereum mainnet or a suitable testnet, polygon.

 Host Image Filtering Model using Railway and Text Filtering Model is
deployed in a local system with NGrock

 Host the front-end components on platforms like Netlify for user accessibility.

 Integrate IPFS for storing images, with the IPFS hashes stored in the blockchain.

 Integrate web3.storage for efficient IPFS data storage and retrieval.

Maintenance and Support:

 Provide ongoing maintenance and support to the application, addressing bug


fixes, performance optimizations, and feature enhancements.

 Regularly update the text filtering and image filtering modules to adapt to
changing content patterns and user requirements.

Department of Computer Science and Engineering, Page 17


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 Monitor and evaluate the filtering models to ensure their effectiveness,


considering user feedback and system analytics.

3.2.8 Economic Feasibility

The economic feasibility of the blockchain-enabled social networking application


with automated content filtering project involves evaluating its financial viability, including
the costs and potential benefits associated with its development, deployment, and
maintenance.

 Cost of Development: The project's initial cost includes expenses related to software
development, infrastructure setup, and acquiring necessary technologies. This may
involve investments in blockchain development frameworks, deep learning libraries,
and natural language processing tools. Additionally, costs associated with designing an
intuitive user interface, conducting testing, and ensuring compliance with data privacy
regulations should be considered.

 Infrastructure and Maintenance Costs: The project requires a robust infrastructure to


support the social networking application and its associated components, such as
blockchain nodes, IPFS nodes, and server resources.

 Operational Expenses: Ongoing operational costs include hosting, server maintenance,


software updates and bug fixes. These expenses are necessary to ensure the smooth
functioning and reliability of the application.

 Growth Opportunities: This includes evaluating the feasibility of expanding the user
base, introducing new features, exploring partnerships.Growth opportunities contribute
to the long-term economic feasibility and sustainability of the project.

Department of Computer Science and Engineering, Page 18


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 4
SYSTEM DESIGN

4.1 Use Case Diagram

Department of Computer Science and Engineering, Page 19


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

4.2 Class Diagram

Department of Computer Science and Engineering, Page 20


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

4.3 Sequence Diagram

Department of Computer Science and Engineering, Page 21


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

4.4 Collaboration Diagram

Department of Computer Science and Engineering, Page 22


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

4.5 Interaction Diagram

Department of Computer Science and Engineering, Page 23


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 5
ARCHITECTURE

5.1 Flow Chart


5.1.1 Blockchain

A. Identify the Purpose and Requirements

Clearly define the purpose and goals of your DApp. For example, you may want to
create a decentralized crowdfunding platform or a decentralized file storage
system.Determine the specific functionalities and features your DApp should offer. Consider
factors such as user registration, transaction processing, data storage, etc.

B. Choosing a blockchain platform

This phase includes selecting a blockchain platform that aligns with the DApp
requirements. This project uses Ethereum based blockchain. Ethereum has become a leading
platform for blockchain-based applications, providing a foundation for decentralized finance,
non-fungible tokens (NFTs), and a wide range of innovative DApps. Its open-source nature,
extensive developer community, and continuous evolution make Ethereum a prominent force
in the blockchain industry, driving the adoption of decentralized technologies and reshaping
various sectors of the global economy. Alternative platforms like EOS, Tron, or Binance
Smart Chain can be used based on factors such as scalability, transaction costs, and
community support.

C. Smart contract development

This is the important phase in a DApp development. Smart contract development


involves writing code that defines the rules and logic of a decentralized application (DApp)
on a blockchain platform. Specifically, smart contracts are self-executing contracts with the
terms of the agreement directly written into code. They automatically execute actions and
enforce rules without the need for intermediaries or trusted third parties.Smart contracts can
be written and compiled using tools like Remix IDE, hardhat etc.This phase includes
Identifying and defining the data structures needed to store and manipulate data within the
smart contract. This may include defining custom data types, arrays, mappings, and
structs.After data structures have been properly defined, the code to implement the business

Department of Computer Science and Engineering, Page 24


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

logic and functionalities of the DApp is written. This includes defining functions that handle
user interactions, perform calculations, enforce rules, and update the contract state.As smart
contracts are crucial for working of blockchain, It should be properly written free of any bugs
and errors. The contract should be properly audited.

D. Testing the smart contracts

This phase includes testing the smart contracts to check if all the functionalities are
properly working. Tools like remix, hardhat, truffle can be used to create tests for the smart
contract to test it in various aspects.

E. Smart Contract deployment

After the smart contract has been developed and tested the next phase involves
deploying it in a blockchain platform. Tools like Remix, Truffle, hardhat can be used to
compile and deploy the smart contracts. First for testing purpose the smart contract is
deployed on ganache which is a tool for creating a local blockchain. Ganache also gives test
accounts using which we can test the functionalities of the DApp.Then the smart contract is
deployed on Ethereum based testnets like sepolia. The testnets are similar to real blockchain
network.Once properly tested the smart contract can be deployed in the Ethereum mainnet.

F. Frontend Development

The frontend for the application can be developed using Frameworks like React.js,
Angular or Vue. Js. The project uses React.js. React.js is a popular JavaScript library used for
building user interfaces (UIs) for web applications. It was developed by Facebook and
released as an open-source project. React allows developers to create reusable UI components
and efficiently manage the application's state, resulting in scalable and high-performing web
applications.Libraries such as Web3 js, Ethers js can be used to interact with smart contracts
from the frontend. This project uses Ethers js. Ethers.js simplifies the process of interacting
with smart contracts. It provides a Contract API that allows developers to interact with smart
contracts by creating contract instances from their ABI (Application Binary Interface).
Developers can easily call contract functions, send transactions, and listen to contract
events.Metamask is used in the frontend to interact with blockchain. MetaMask is a popular
browser extension and cryptocurrency wallet that allows users to interact with Ethereum-
based decentralized applications (DApps) directly from their web browsers.When interacting
with DApps, MetaMask securely signs Ethereum transactions on the user's behalf. It prompts

Department of Computer Science and Engineering, Page 25


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

the user to review and approve transaction details before signing, ensuring that users have full
control over their funds and preventing unauthorized transactions.

5.1.2 Interplanetary File System

A. Install Dependencies
Install the necessary dependencies for working with IPFS and web3.storage, such as the
IPFS JavaScript library and the web3.storage client library.
B. Connect to web3.storage API
Connect to the web3.storage API using the web3.storage client library. This allows you
to interact with the web3.storage service for storing and retrieving data.
C. Initialise IPFS
The access token required to authenticate and acces the IPFS network is retrieved.A new
instance of web3 storage client is created and initialized with the access token.
D. Upload Image
Obtain the image file to be uploaded from the user post. Upload the image to IPFS .Use the
web3.storage client library to store the Blob object on IPFS. This will upload the image to
IPFS and return a CID (Content Identifier) that uniquely identifies the stored image.
E. Store CID in Blockchain
Once you have the CID for the uploaded image, you can store it in the blockchain. This
can be done by invoking a smart contract function or making a transaction that stores the CID
in the blockchain along with the post
F. Retrieving Images
To retrieve an image, you can retrieve the CID from the blockchain and use the
web3.storage client library to retrieve the image data from IPFS based on the CID.

5.1.3 Text Filtering

Python is used for the implementation, and a number of libraries, including Pandas and
Scikit-Learn, are used. The Google Collaboratory, a web-based platform that offers an
integrated development environment for Jupyter notebooks, is used to build the technique.

A. Dataset Selection and Preprocessing

We used a toxic comment detection dataset that includes a wide variety of remarks that
have been classified as hazardous or non-toxic. To reduce noise, such as HTML elements,

Department of Computer Science and Engineering, Page 26


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

punctuation, and special characters, the dataset was preprocessed. To reduce dimensionality,
stop words were also removed, and the remaining text was tokenized and lemmatized.

B. Feature Extraction

The Term Frequency-Inverse Document Frequency (TFIDF) vectorizer was used to


translate the pre-processed text data into numerical representations. Based on a phrase's
frequency in a remark and its inverse document frequency throughout the collection, TF-IDF
provides weights to each term.

C. Classificarion Model

Using the Logistic Regression technique and the one-vsrest strategy, we were able to
categorise comments into harmful and non-toxic categories. A popular binaryclassification
methodology, logistic regression, is extended by the one-vs-rest method to successfully
handle multiclassclassification tasks. Using the pre-processed text input and related labels, the
model was trained.

D. Evaluation & Validation

We used common assessment metrics, such as accuracy,precision, recall, and F1-score,


to evaluate the effectiveness of the text filtering model. The generalisation abilities of
themodel were validated using cross-validation approaches,such as k-fold cross-validation.

5.1.4 Image Classification

A. Dataset Selection and Pre-processing

We used the Open Images V6 dataset of violent images, which includes a wide range of
pictures classified as violent or not. We also included photos from the ImageNet dataset and
the Iris dataset to improve the model's capability to reliably detect and classify different visual
components. The datasets were pre-processed by normalising the pixel values and resizing the
photos to a constant resolution..

B. Model Architecture

Three convolutional layers with 16, 32, and 16 filters a piece, each employing a 3x3
kernel and a stride of 1, make up the architecture. After each convolutional layer, the ReLU
activation function is used to add non-linearity. After each convolutional layer, max pooling
layers with a default 2x2 pool size are added to limit the number of spatial dimensions and
capture significant features. Flattened output feature maps are coupled to a dense layer of 256

Department of Computer Science and Engineering, Page 27


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

units that uses the ReLU activation function. To lessen overfitting, a dropout layer with a
predetermined dropout rate is implemented.Finally, binary classification is performed using a
dense layer with a single unit and sigmoid activation.

C. Training & Optimization

Using the pre-processed dataset, the image filtering model was trained. Mini-batch
training is a technique we used to update the model's weights by using a portion of the dataset
in each training iteration. The model's loss function was minimised and its predictive power
was increased by using an optimisation technique like stochastic gradient descent (SGD) or
Adam. The performance of the model was optimised through hyperparameter adjustment,
which included learning rate, batch size, and number of epochs.

D. Evaluation & Validation

We have used a common assessment criterion, such as accuracy, precision, recall, and
F1-score, to assess the effectiveness of the image filtering model. A hold-out validation set or
cross-validation methods were used to validate the model in order to evaluate its robustness
and generalizability.

5.2 Data collection


5.2.1 Text Filtering
The data chosen is the “toxic comment detection dataset” which is a collection of
labelled comments that are annotated for their toxicity. This dataset is commonly used to train
and evaluate NLP models for identifying and classifying toxic comments. The details are:

 Size: The dataset consists of a large number of comments, typically ranging from
thousands to millions, depending on the specific dataset chosen. The size of the dataset
allows for robust training and evaluation of the NLP model.
 Comment Text: Each comment in the dataset is represented as a text string. The
comments are usually sourced from online platforms, such as social media platforms or
discussion forums, where toxic comments are prevalent.
 Labels: The comments in the dataset are labelled to indicate their toxicity. Commonly
used labels include binary labels (toxic/non-toxic) or multi-class labels (e.g., toxic,
severe toxic, obscene, threat, insult, identity hate) to capture different types of toxicity.
The labels are assigned by human annotators who review and classify the comments
based on their content.

Department of Computer Science and Engineering, Page 28


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 Annotation Guidelines: The dataset is typically annotated based on specific annotation


guidelines provided to the annotators. These guidelines help ensure consistency in
labelling and provide instructions on identifying different forms of toxic content.
 Diversity of Toxicity: The dataset aims to capture a diverse range of toxic comments,
including different forms of offensive or harmful language, hate speech, insults,
personal attacks, or discriminatory content. The inclusion of various types of toxicity
allows the NLP model to learn patterns and features specific to different toxic
behaviours.
 Data Balance: The dataset may have varying degrees of class imbalance, with toxic
comments being a minority class compared to non-toxic comments. This imbalance can
impact the model's training and evaluation, requiring techniques such as data
augmentation or balancing strategies to address it.
 Preprocessing: The dataset may undergo preprocessing steps to remove noise, correct
spelling errors, handle special characters, or anonymize personal information.
Preprocessing ensures that the text data is in a standardized format and ready for further
analysis.

 The toxic comment detection dataset serves as the foundation for training and
evaluating NLP models that aim to identify and classify toxic comments accurately. It
provides a representative sample of real-world comments with labelled toxicity,
enabling the development of effective models for automated toxic comment detection
and moderation.

5.2.2 Image Filtering


The violence image detection dataset is a collection of images that are annotated for the
presence of violent content. The dataset is created by combining images from multiple
sources, including the OpenImages V6 dataset, the Iris dataset, and the ImageNet dataset. The
details are:

 Sources:
OpenImages V6: This dataset contains a large collection of images with annotations for
various object classes. Images that depict violent scenes or contain objects related to
violence are selected from the OpenImages V6 dataset to contribute to the violence
image detection dataset.

Department of Computer Science and Engineering, Page 29


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Iris dataset: The Iris dataset is another source of images used for violence image
detection. It provides a curated collection of images with annotations specifically
focused on violence-related content.

ImageNet: ImageNet is a widely used dataset for object recognition. Images from the
ImageNet dataset that are relevant to violent content or contain objects related to
violence are included in the violence image detection dataset.

 Data Diversity: The dataset aims to capture a diverse range of violent content, including
images depicting physical violence, weapons, aggressive behavior, or scenes associated
with violent acts. The inclusion of various types of violence allows the model to learn
patterns and features specific to different violent behaviors.

 Dataset Size: The violence image detection dataset can vary in size, depending on the
number of images selected from the sources. It is typically designed to provide a
sufficient number of training and testing samples to train and evaluate the violence
image detection model effectively.

 Preprocessing: The images in the dataset may undergo preprocessing steps such as
resizing, cropping, or normalization to ensure they are in a standardized format for
training and evaluation.

 The violence image detection dataset, created using the OpenImages V6 dataset, Iris
dataset, and ImageNet dataset, provides a collection of annotated images that enable the
development and evaluation of models for automated violence detection in images. By
leveraging images from multiple sources, the dataset aims to cover a wide range of
violent content, enhancing the model's ability to detect violence accurately.

5.3 Module 1 - Login Using MetaMask

The "Login Using MetaMask" module provides a secure and convenient login
mechanism for users of the blockchain-enabled social networking application. It leverages the
MetaMask browser extension, which acts as a digital wallet and identity provider, to enable
users to authenticate themselves on the application.

With MetaMask installed in their browser, users can securely create and manage
Ethereum accounts, which serve as their digital identities within the blockchain network. The

Department of Computer Science and Engineering, Page 30


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

module integrates MetaMask into the frontend of the application, allowing users to initiate the
login process by connecting their MetaMask account.

When a user clicks on the login button, the application prompts them to select their
MetaMask account. MetaMask securely handles the account authentication and private key
management, ensuring the safety of the user's credentials. Once the user approves the login
request, the application establishes a secure connection with MetaMask and retrieves the
necessary account information.

The retrieved account information, such as the Ethereum address associated with the
MetaMask account, is then used by the application to identify the user and grant them access
to their blockchain-enabled social networking account. This process ensures that only
authorized users with valid MetaMask accounts can log in to the application, enhancing
security and preventing unauthorized access.

By leveraging MetaMask for authentication, the module provides several advantages.


First, it eliminates the need for users to create separate login credentials for the social
networking application, streamlining the login process and reducing the risk of password-
related security breaches. Second, MetaMask's encryption and private key management
mechanisms ensure that sensitive user data remains secure. Third, by relying on MetaMask's
established reputation and security features, users can trust the authentication process and
have confidence in the integrity of their digital identities

5.4 Module 2 - Text Filtering


The text filtering module is designed to enhance the content moderation capabilities of a
social media platform. It leverages the TFIDF (Term Frequency-Inverse Document
Frequency) vectorizer and logistic regression with a one-vs-rest classifier to accurately
classify text data and identify potentially harmful or inappropriate content. The module is
built using Python and incorporates the Flask framework to create a user-friendly API.

The module's workflow begins with the preprocessing of text data, where it tokenizes
the input text into individual words and removes any irrelevant or stop words. Next, the
TFIDF vectorizer transforms the text data into numerical feature vectors, capturing the
significance of each word in relation to the entire dataset. This step enables the module to
analyze the textual content more effectively.

Department of Computer Science and Engineering, Page 31


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

The logistic regression model, trained on labeled data, is then employed for
classification. The one-vs-rest approach allows the model to handle multiple classes
simultaneously, determining the probability of each class for a given input text. Based on
these probabilities, the module identifies the most appropriate class label for the text, enabling
accurate content filtering.

To facilitate integration with the social media platform, the module provides a RESTful
API implemented using Flask. The API receives text inputs from users and returns the
predicted class label and associated probabilities, allowing the platform to take appropriate
actions based on the content classification results.

For deployment and accessibility, the module utilizes ngrok, a secure tunneling service
that provides public URLs for local development environments. This enables seamless
integration of the text filtering module into the social media platform, ensuring real-time
content moderation and a safer user experience.

5.5 Module 3 - Image Filtering


The image classification module is designed to enable accurate and efficient
classification of images uploaded to a social media platform. The module utilizes a
convolutional neural network (CNN) architecture implemented in Python using the Keras
library.

The CNN model is constructed with multiple layers to effectively extract features from
the input images. The architecture consists of convolutional layers, max-pooling layers, and
dense layers. The model begins with a 3x3 convolutional layer with 16 filters, followed by a
max-pooling layer to downsample the feature maps. This process is repeated with a 3x3
convolutional layer with 32 filters and another max-pooling layer. Finally, a 3x3
convolutional layer with 16 filters is added, followed by a max-pooling layer.

After the convolutional layers, the feature maps are flattened to a 1D vector and passed
through a dense layer with 256 neurons, using the ReLU activation function to capture higher-
level representations. A dropout layer is incorporated to prevent overfitting by randomly
setting a fraction of the input units to 0 during training. The final dense layer with a single
neuron and the sigmoid activation function is used for binary classification, providing a
probability score for the presence or absence of the target class.

Department of Computer Science and Engineering, Page 32


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

The module is integrated with a Flask framework to create an API that handles image
uploads and returns the classification results. The API receives images from users and
processes them through the trained CNN model. The model predicts the probability of the
target class, which can be interpreted as the likelihood of the image belonging to a specific
category. The classification results are then returned through the API, allowing the social
media platform to take appropriate actions based on the image classification.

For deployment and accessibility, the module utilizes Railway, a platform for hosting
web applications. This ensures that the image classification module is easily accessible and
can seamlessly integrate with the social media platform, providing real-time image
classification capabilities.

5.6 Module 4 - Blockchain Data Storage and Retrieval


The module enables users to perform various actions such as adding and viewing
posts, adding and viewing comments, following other users, engaging in chat messaging,
managing their user profile, and viewing posts from other users. The primary goal is to
leverage the decentralized and immutable nature of blockchain technology to ensure data
integrity, transparency, and security within the social networking application.

Adding and Viewing Posts:

 Users can create and publish posts on the social networking application.

 The post content, including text, images is stored securely on the blockchain.

 Each image post is associated with a unique identifier or transaction hash,


ensuring its traceability and immutability.

 Users can view posts created by themselves and other users on the platform.

Adding and Viewing Comments:

 Users can comment on posts created by themselves or other users.

 Comments are also stored on the blockchain, providing transparency and


preventing unauthorized modifications.

 Users can view and interact with comments associated with posts.

Department of Computer Science and Engineering, Page 33


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Following Users:

 Users have the ability to follow other users within the social networking
application.

 Following a user allows for personalized content recommendations and


notifications.

 The information about user relationships (followers and followings) is stored on


the blockchain, ensuring transparency and data integrity.

Chat Messaging:

 Users can engage in chat messaging with other users on the platform.

• The "Chat" facilitates real-time communication and interaction among users


within the blockchain-enabled social networking application. It provides a chat
feature that allows users to exchange messages, share information, and engage in
conversations with each other.
• When users access the chat functionality, they are presented with a user-friendly
interface where they can view ongoing conversations and can have private one-
on-one conversations.
User Profile Management:

 Users have the ability to manage and update their user profile information.

 Profile details such as username, bio, profile picture, and other relevant
information are stored on the blockchain.

 Users can modify their profile information and view the profiles of other users.

Viewing Users' Posts:

 Users can explore and view posts from other users on the social networking
application.

 It allows the users to discover and interact with a variety of content.

 Users can like, comment, or engage with posts from other users.

Department of Computer Science and Engineering, Page 34


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

5.7 Module 5 - IPFS Data Storage


The "IPFS Data Storage" module is responsible for storing images posted by users in
the blockchain-enabled social networking application using the InterPlanetary File System
(IPFS). This module utilizes IPFS, a decentralized and distributed file storage system, to
ensure efficient and reliable storage of image files while maintaining their integrity.

Image Upload and Hash Storage:

Users can upload images as part of their posts within the social networking
application.The module securely stores these images in IPFS, which breaks them down into
smaller chunks and distributes them across the IPFS network.After uploading an image, the
module generates a unique hash value (content identifier) for each image file.

Blockchain Integration:

The generated hash for each image is stored on the blockchain, associated with the
corresponding post or user profile.Storing the hash on the blockchain provides a reference to
the image stored in IPFS and ensures the immutability and traceability of the image's location.

Image Retrieval:

When users view posts or profiles that include images, the module retrieves the
corresponding hash from the blockchain.Using the hash, the module interacts with the IPFS
network to fetch the image from the distributed storage.Users can seamlessly view the images
associated with posts or user profiles, enhancing their visual experience within the
application.

By leveraging IPFS for image storage, the module provides a robust and decentralized
solution, ensuring the availability and integrity of images posted within the blockchain-
enabled social networking application. The combination of blockchain and IPFS technologies
allows for a seamless integration of image storage and retrieval, offering users a reliable and
efficient way to share and view images within the application.

5.8 Tech Stack


5.8.1 Blockchain and Smart Contracts:

 Ethereum: A blockchain platform for decentralized applications.

Department of Computer Science and Engineering, Page 35


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 Remix IDE: An integrated development environment for writing and compiling smart
contracts.

 Hardhat: A development environment and testing framework for Ethereum smart


contracts.

 Ganache: A tool for creating a local blockchain for testing smart contracts.

 Sepolia (or other Ethereum-based testnet): A test network for deploying and testing
smart contracts in an environment similar to the mainnet.

 Solidity: Language to develop secure and reliable smart contracts

 Polygon: A scaling solution and Ethereum sidechain, suitable for deploying smart
contracts and DApps.It provides more increased speed and more transaction

5.8.2 Interplanetary File System:

 IPFS (InterPlanetary File System): A decentralized and distributed file storage system
used for storing images.

 Web3Storage: A service provided by web3.storage website that simplifies integration


with IPFS and provides convenient APIs for storing and retrieving files.

5.8.3 Frontend Development:

 React.js: A JavaScript library for building user interfaces.

 MetaMask: A browser extension that allows users to interact with the Ethereum
blockchain from the frontend.

5.8.4 JavaScript Libraries:

 Ethers.js: A library for interacting with Ethereum smart contracts, simplifying the
process of sending transactions and retrieving data.

 Web3.storage: It provides a convenient way to interact with the IPFS network.

5.8.5 Text Filtering Model:

 Python: A versatile language for data manipulation, analysis, and machine learning.

Department of Computer Science and Engineering, Page 36


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 Pandas: A data manipulation library for handling and analyzing structured data.

 Scikit-Learn: A machine learning library that provides tools for classification and
evaluation.

 NLTK (Natural Language Toolkit): A library for natural language processing tasks.

 Jupyter Notebook: An interactive development environment for running Python code


and creating data analysis workflows.

 Flask: Web framework for building web applications in Python. It is used to create API

5.8.6 Image Filtering Model:

 TensorFlow: An open-source deep learning framework for building and training neural
networks.

 Keras: A high-level neural networks API that can work with TensorFlow as its backend.

 Open Images V6 dataset: A dataset containing labeled images, including violent and
non-violent categories.

 ImageNet dataset: A large-scale image dataset widely used for training deep learning
models.

 Iris dataset: A dataset of flower images, potentially used to improve the model's
classification capabilities.

 Image AU: A python package used to extract features by reading an image.

 Flask: Web framework for building web applications in Python. It is used to create API

5.8.7 Deployment:

 Netlify: A popular cloud platform for deploying static websites and frontend
applications.

 Railway: A deployment platform for machine learning models, which allows hosting
and serving trained models.

Department of Computer Science and Engineering, Page 37


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 Local System with NGrock: A tool that creates a secure tunnel to expose your local
server to the internet, allowing you to deploy and access your text filtering model
locally.

 Alchemy: It is utilized for interacting with the Ethereum blockchain. Alchemy provides
developers with powerful APIs and developer tools that simplify the process of building
blockchain applications.

5.8.8 Additional Tools:

 Git: A version control system for tracking changes in the codebase.

 Thunderclient: It is a testing tool to validate and assess the functionality of the API
endpoints.

 Remix, Hardhat: Tools for compiling, testing, and deploying smart contracts.

5.9 Blockchain and IPFS Connection


5.9.1 Blockchain

The project utilizes the Ethereum blockchain for its decentralized and secure data
storage and retrieval capabilities. The connection between the project and the Ethereum
blockchain is established through the use of smart contracts.

Smart contracts are self-executing contracts with the terms of the agreement directly
written into code. In this project, smart contracts are deployed on the Ethereum blockchain to
define the logic and functionality of the application. The smart contracts facilitate interactions
and transactions between different entities within the system.

To connect with the deployed smart contracts on the Ethereum blockchain, the project
utilizes the Ether.js library. Ether.js is a JavaScript library that simplifies the process of
interacting with Ethereum smart contracts. It provides a set of APIs and utilities for sending
transactions, calling contract functions, and retrieving data from the blockchain.Using Ether.js,
the project establishes a connection with the Ethereum network by specifying the network
provider and the address of the deployed smart contract. Once the connection is established, the
project can interact with the smart contract by calling its functions and sending transactions.
Ether.js provides convenient methods for encoding function calls, signing transactions, and
handling the communication with the Ethereum network. It abstracts away the complexities of

Department of Computer Science and Engineering, Page 38


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

low-level Ethereum interactions and provides a higher-level interface for developers to interact
with the smart contract.

By leveraging Ether.js and connecting with the address of the deployed smart contract,
the project can securely and efficiently interact with the Ethereum blockchain. It can read data
from the smart contract, update its state, and perform transactions based on the defined contract
functions. This integration with the blockchain enables the project to leverage the decentralized
and immutable nature of Ethereum for reliable data storage and retrieval.

The code segment provided below demonstrates the interaction with a deployed smart
contract using ethers.js.

const contractAddress = "0x85C2Ad2d8d9e4d26301566C06523f00b19D290e3";

This line declares a constant variable contractAddress and assigns it the value of the Ethereum
address where the smart contract is deployed. This address uniquely identifies the deployed
contract on the blockchain.

const contractAbi = abi.abi;

This line declares a constant variable contractAbi and assigns it the value of the contract's ABI
(Application Binary Interface). The ABI defines the interface and functions of the smart
contract, allowing the interaction with its methods.

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

This line creates a new instance of the Web3Provider class from ethers.js. It uses the ethereum
object provided by the browser's Ethereum provider to connect to the Ethereum network. The
provider instance will be used to send transactions and interact with the deployed contract.

const signer = provider.getSigner();

This line retrieves the Signer object from the provider. The Signer is responsible for
signing Ethereum transactions and authenticating the user. In this case, it gets the Signer
associated with the current Ethereum account.

const contract = new ethers.Contract(contractAddress, contractAbi, signer);

This line creates a new instance of the Contract class from ethers.js. It represents the deployed

Department of Computer Science and Engineering, Page 39


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

smart contract and provides an interface to interact with its functions and properties.
The contract object is instantiated by passing the contract address, ABI, and Signer
object.

5.9.2 Interplanetary File system

The code to integrate IPFS into the frontend using the web3.storage library allows to
upload files to IPFS and retrieve the Content Identifier (CID).

The script imports necessary dependencies, including process for command-line


arguments handling, minimist for parsing command-line options, and Web3Storage and
getFilesFromPath from the web3.storage library.The main function is defined, which is the
entry point of the script. It retrieves the API token from the command-line arguments and
checks its presence.The script expects at least one file or directory path to be provided as a
command-line argument. If none are provided, an error message is logged.

An instance of Web3Storage is created using the API token.The script collects all the
files from the provided paths using the getFilesFromPath function and stores them in the files
array.The number of files to be uploaded is logged.

The put method of Web3Storage is called with the files array to upload the files to
IPFS. It returns a CID (Content Identifier) representing the uploaded content.The CID is logged
to the console.The main function is executed.

To run the script, provide the API token using the --token flag, followed by the paths of
the files or directories you want to upload.

node put-files.js --token=<YOUR_TOKEN> ~/filename1 ~/filename2 ~/filenameN

Replace <YOUR_TOKEN> with your actual API token, and provide the paths of the files or
directories you want to upload. The script will output the CID associated with the uploaded
content.

Department of Computer Science and Engineering, Page 40


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 6
TESTING
6.1 Test Case of Module 1 (Login Using MetaMask)

To conduct manual testing for the login module using MetaMask, several steps need to
be followed to ensure the proper functioning and integration of the application with the
MetaMask extension.

First, it is important to verify that the application's user interface includes a login option
specifically for MetaMask. This ensures that users are aware of the MetaMask integration and
can easily access the login functionality.

When testing the MetaMask connection, clicking on the MetaMask login option should
trigger the MetaMask extension to open and prompt the user for authorization. It is crucial to
ensure that the authentication process occurs seamlessly and that the user is able to authenticate
with MetaMask using their selected account.

Fig 6.1 – Login using metamask(Choosing the account)

During the authentication process, the application should request the necessary
permissions from MetaMask, such as access to the account address and network. After
authorization, the application should retrieve the connected MetaMask account address

Department of Computer Science and Engineering, Page 41


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

accurately. This address should match the authorized MetaMask account, confirming the
successful connection and authentication.

Fig 6.2 – Login using metamask(Connecting the account to the platform)

If the application includes a logout functionality, it should be tested as well. Clicking on


the logout option should disconnect the application from MetaMask and prompt the user to re-
authenticate if necessary.

To ensure cross-browser compatibility, it is recommended to test the login functionality


using MetaMask on different browsers. This helps identify any inconsistencies or compatibility
issues and ensures a smooth user experience across various browser environments.

6.2 Test Case of Module 2 (Text Filtering)

Table 6.1 Comparison of various content filter models

Model Accuracy Precision Recall F1 Score


Profanity – Check 0.79 078 0.70 0.74

Profanity – Filter 0.84 0.83 0.79 0.80

Profanity 0.89 0.88 0.84 0.85


Our model using Logistic Regression 0.97 0.91 0.88 0.89
and TFIDF Vectorizer

Department of Computer Science and Engineering, Page 42


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

The NLP (Natural Language Processing) model developed for profanity detection and
filtering underwent comprehensive testing to assess its performance and accuracy. The model
was designed to check, filter, and classify text based on profanity content using logistic
regression and TFIDF vectorization techniques.

During the testing phase, the model's performance was evaluated using a separate
testing dataset that accounted for 20% of the total available data. The results of the testing
process provided valuable metrics to gauge the model's effectiveness in detecting and filtering
profanity in text.

Result shown in table.xx these results demonstrate the effectiveness of the NLP model
in accurately identifying and filtering profanity in text content. The high accuracy of 0.97
signifies that the model has learned to differentiate between profane and non-profane text with
remarkable precision. The precision score of 0.91 indicates a low false-positive rate, ensuring
that the model correctly identifies profanity without flagging non-offensive text incorrectly.

To evaluate the performance of the model's API, Thunderclient was utilized it is shown
in image.xx. The API was tested using JSON-formatted data, with a response time of 680m
milliseconds recorded. This rapid response time ensures that users of the social media platform
can enjoy real-time profanity detection and filtering, enhancing their experience and
maintaining a respectful online environment. In conclusion, the extensive testing conducted on
the NLP model demonstrated its high accuracy and reliability in detecting and filtering
profanity in text. The model's performance metrics, combined with the efficient API response
time, guarantee an effective and seamless user experience. By employing logistic regression
and TFIDF vectorization techniques, the model achieves a superior level of accuracy, precision,
recall, and F1 score, making it a valuable component of the social media platform's text
filtering module.

Fig 6.3 – Testing of text classifier

Department of Computer Science and Engineering, Page 43


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

6.3 Test Case of Module 3 (Image Filtering)


The deep learning model developed for image classification has undergone rigorous
testing to evaluate its accuracy and performance. The testing process involved using a separate
dataset, distinct from the training data, to assess the model's ability to generalize and make
accurate predictions on unseen images.

During testing, the model achieved an impressive accuracy of 98%. This indicates that the
model performs exceptionally well in correctly classifying images based on the trained
categories. The testing dataset was carefully prepared and comprised 20% of the total available
data, ensuring a diverse and representative set of images for evaluation.

Table 6.2 Comparison of various image filter models

Model Accuracy
Pre Trained Model ( eg. VG16 ) 0.89

Proposed Deep Learning Model 0.98

In addition to accuracy, the performance of the model was assessed to measure its
efficiency in processing requests. To evaluate the response time of the model's API, a tool
called Thunderclient was employed. The API was tested using a data size of 43 bytes. The
results demonstrated that the API provided an output in an impressive time of 986 milliseconds.
This quick response time ensures that users can experience smooth and efficient image
classification within the social media platform. The result of API testing is shown below

Fig 6.4 – Testing of image classifier

Department of Computer Science and Engineering, Page 44


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

6.4 Test Case of Module 4 (Blockchain Data Storage and Retrieval)


6.4.1 Add and view post
 This test ensures that users can create a post on the SocialMedia contract.
 It first deploys the contract and obtains the owner's address.
 Then, it adds a post with a specific post content and an image hash.
 After adding the post, it retrieves the post details from the blockchain and verifies that the
post content and the user ID match the provided values

Fig 6.5 – Add and view post

6.4.2 Add and view comment


 This test verifies the functionality to add a comment to a post in the SocialMedia contract.
 Similar to the previous test, it deploys the contract and gets the owner's address.
 It adds a post with a sample post content and retrieves the post details.
 Then, it adds a comment to the post with a specific comment content.
 After adding the comment, it retrieves the comment from the blockchain and verifies that
the comment content matches the provided value.

Fig 6.6 – Add and view comment

Department of Computer Science and Engineering, Page 45


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

6.4.3 Follow user


"should allow users to follow other users"

 This test ensures that users can follow other users on the SocialMedia contract.
 It deploys the contract and obtains the addresses of two users (owner1 and owner2).
 It updates the profile of owner1 using the updateProfile function.
 Then, it follows owner2 using the follow function and retrieves the list of followers for
owner1.
 Finally, it verifies that the follower's public key matches owner2's

address. "User cannot follow himself/herself"

 This test checks the validation to prevent a user from following themselves.
 It deploys the contract and obtains the addresses of two users (owner1 and owner2).
 It verifies that trying to follow owner1 with their own address reverts with the error
message "Cannot follow yourself."

"User cannot follow if profile not updated"

 This test ensures that a user must update their profile before following others.
 It deploys the contract and obtains the addresses of two users (owner1 and owner2).
 It verifies that trying to follow owner2 without updating owner1's profile reverts with the
error message "Update profile first."

Fig 6.7 – Follow user

6.4.4 Chat Messaging


 This test verifies the functionality to send and read messages between users on the
SocialMedia contract.

Department of Computer Science and Engineering, Page 46


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 It deploys the contract and obtains the addresses of two users (owner1 and owner2).
 It updates owner1's profile using the updateProfile function.
 Then, it follows owner2 using the follow function.
 It sends a message from owner1 to owner2 with a specific message content.
 After sending the message, it retrieves the message from owner2's inbox and verifies that
the message content matches the provided value.

Fig 6.8 – Chat Messaging

6.4.5 User Profile Management


 The test case first deploys the "SocialMedia" contract.
 The owner's address is defined.
 The owner's profile is fetched using the getProfile function of the contract.
 The test case logs the profile before updating and verifies that the profile flag is initially
set to 0.
 The owner updates their profile using the updateProfile function of the contract.
 The owner's profile is fetched again using the getProfile function of the contract and
is verified that the flag is now set to 1 to show that profile have been successuly
updated

Department of Computer Science and Engineering, Page 47


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Fig 6.9 – User Profile Management

6.4.6 View users post


This test case checks if users can successfully view their own posts on the SocialMedia
contract.
 The test case first deploys the "SocialMedia" contract.
 The owner's address is obtained.
 The owner adds a post to the contract by calling the addPost function with a post content.
 The post is fetched from the blockchain using the viewPost function.
 The test case logs the first post saved to the blockchain.
 The owner's posts are fetched using the viewUserPost function.

Department of Computer Science and Engineering, Page 48


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

 The test case verifies that the post content of the user's post matches the post content
fetched earlier.

Fig 6.10 – View users post

6.5 Test Case of Module 5 (IPFS Data Storage)


The manual testing process of IPFS storage involves verifying the successful storage of
files on IPFS, the accurate recording of hashes in the blockchain, the creation and accessibility
of URLs for accessing the stored images, and handling duplicate image storage.The file storage
on IPFS needs to be tested. This involves selecting a file for uploading and using the
web3.storage platform to store the file on IPFS. The testing process should ensure that the
upload completes without any errors and that the resulting CID (Content Identifier) of the
uploaded file is valid and unique.

Fig 6.11 – Uploading images to IPFS

Department of Computer Science and Engineering, Page 49


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

The creation and accessibility of URLs for accessing the stored images should also be
tested. By obtaining the CID of the uploaded file, the URL should be generated following the
specified format. Clicking on the URL or accessing it through a web browser should display
the associated image correctly. The URL should remain functional even after multiple accesses
or refreshes.

Fig 6.12 – Hashes of images stored in IPFS

Fig 6.13 – Image corresponding to an image

To handle duplicate image storage, the testing process should confirm that storing the
same image multiple times results in the same hash being returned. By uploading a previously
stored image and comparing the hash with the previously recorded hash, it should be ensured
that both hashes are identical, indicating consistency in the storage process.By conducting
comprehensive manual testing based on these test cases, the implementation of IPFS storage
using Web3Storage can be validated. It ensures the successful storage of files on IPFS,
Creation of hashes, proper creation and accessibility of URLs for accessing images, consistency
in duplicate image storage.

Department of Computer Science and Engineering, Page 50


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 7
SAMPLE CODE

7.1 Front end


7.1.1 Social media context

import React,{useEffect,useState} from 'react'


import { ethers } from 'ethers';
import abi from "../../src/contracts/SocialMedia.json"
import axios from 'axios';
const { ethereum } = window;
export const SocialMediaContext = React.createContext();
export const SocialMediaProvider = ({ children }) =>
{ const [post,setPost] = useState(null);
const [state,setState] = useState({
provider:null,
signer:null,
contract:null
})
const [currentAccount, setCurrentAccount] = useState("");
const [filterFeedback,setFilterFeedback] = useState({
isEnable:false,
msg:"",
color:""
})
const [progress,setProgress] = useState({
msg:"",
prog:0
})
const [isVisible,setIsvisible] = useState(false)
const [openView, setOpenView] =
useState(false) const openViewModal = ()=>{
setOpenView(true)
}

Department of Computer Science and Engineering, Page 51


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

const closeViewModal = ()=>{


setOpenView(false)
}
const [openPeople, setOpenPeople] =
useState(false) const openPeopleModal = ()=>{
setOpenPeople(true)
}
const closePeopleModal = ()=>{
setOpenPeople(false)
}
const checkIfWalletIsConnect = async ()=>{
if(!ethereum){
return alert("Install metamask first");
}
if(currentAccount){
return 1
}
const accounts = await ethereum.request({method:"eth_accounts"});
if(accounts.length>0) {
setCurrentAccount(accounts[0]);
const contractAddres ="";
const contractAbi = abi.abi;
const provider = new ethers.providers.Web3Provider(ethereum)
const signer = provider.getSigner();
const contract = new ethers.Contract(contractAddres,contractAbi,signer);
setState({provider,signer,contract})
}
else {
console.log("No accounts found");
}}
const connectWallet = async ()=>{
if (!ethereum)
{
return 0 }

Department of Computer Science and Engineering, Page 52


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

if(currentAccount){
return 1}
const accounts = await ethereum.request({ method: "eth_requestAccounts", });
setCurrentAccount(accounts[0]);
const contractAddres = process.env.REACT_APP_BLOCKCHAIN;
const contractAbi = abi.abi;
const provider = new ethers.providers.Web3Provider(window.ethereum)
const signer = provider.getSigner();
const contract = new ethers.Contract(contractAddres,contractAbi,signer);
setState({provider,signer,contract})
return 1;
}
const filterText = async
(input,flag=0)=>{ let data;
if(flag===1){
data = {
comment:input
}}
else{ dat
a={
comment:input.post_text
}}
const result = axios.post(`${process.env.REACT_APP_ML}/media/text`,data)
return result
}
const filterImage = async (input)=>{
const formData = new FormData()
formData.append('file', input[0]);
const response = await fetch(`${process.env.REACT_APP_ML}/media/image`,
{ method: 'POST',
mode: 'cors',
body: formData
});
const result = await response.json()

Department of Computer Science and Engineering, Page 53


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

return result
}
useEffect(() => {
checkIfWalletIsConnect();
// eslint-disable-next-line
},[]);
return (
<SocialMediaContext.Provider
value={{
connectWallet,
currentAccount,
filterText,
state,
post,
setPost,
isVisible,
setIsvisible,
openView,
openViewModal,
closeViewModal,
openPeople,
openPeopleModal,
closePeopleModal,
filterImage,
filterFeedback,
setFilterFeedback,
progress,
setProgress
}}
>
{children}
</SocialMediaContext.Provider>
);}

Department of Computer Science and Engineering, Page 54


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

7.1.2 Chatting page

function Chatting() {
const { state,currentAccount } = useContext(SocialMediaContext);
const { contract } = state
const { userId } = useParams();
const [chatUser,setChatUser] = useState(null)
const [chatText,setChatText] = useState("")
const [chats,setChats] = useState(null)
const handleChange = (e)=>{
setChatText(e.target.value)
}
const handleSubmit = async()=>{
await contract.sendMessage(userId,chatText);
setChats([...chats,{
sender:1,
message:chatText
}])
}
const myStyle = {
backgroundColor:"#666585",
color:"white",
borderBottomRightRadius:"8px",
borderTopLeftRadius: "8px",
borderBottomLeftRadius: "8px",
}
const myStyle1={
alignItems:"flex-end"
}
const senderStyle = {
backgroundColor:"#505050",
color:"white",
borderTopRightRadius:"8px",
borderTopLeftRadius: "8px",

Department of Computer Science and Engineering, Page 55


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

borderBottomRightRadius: "8px",
}
const senderStyle1={
alignItems:"flex-start"
}
useEffect(()=>{
const getProf = async()=>{
const fri = await contract.getProfile(userId)
const chats = await contract.readMessage(userId)
setChats(chats)
setChatUser(fri)
}
contract && getProf()
},[contract])
return (
<>
<SideBar />
<div className="user_chat_main_container">
<div className="user_chat_container">
<div className="user_chat_box">
<div className="user_top_part">
<img src={pic} alt="" />
<div className="names">
<p className='name'>{chatUser && chatUser.name}</p>
<p className='username'>@{chatUser && chatUser.username}</p>
</div>
</div>
<div className="chat_part">
{
chats && chats.length>0 && chats.map((ch,index)=>{
return(
<divclassName="chat_item"style={chatUser.userId!=ch.sender?myStyle1:senderStyle1}
key={index}>

Department of Computer Science and Engineering, Page 56


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

<divclassName="chat_item_container" style={chatUser.userId!
=ch.sender?myStyle:senderStyle}>
<p className="sender">{chatUser.userId!=ch.sender?"you":chatUser.name}</p>
<p className="chat_text">{ch.message}</p>
</div>
</div>
)}) }
</div>
<div className="send_part">
<inputname="chat"type="text"placeholder='Sendamessage.....'value={chatText}
onChange={handleChange} />
<div className="send_chat" onClick={handleSubmit}>
<i className='bx bxs-send'></i>
</div></div></div></div></div>
</>)}
export default Chatting

7.1.3 Posts section

function Postitem(props) {
const [isVisible,setIsVisible] = useState(false)
const handleShowComment = (e)=>{
const ele=e.target.parentElement.parentElement.parentElement.querySelector
(".comments_main_container");
const visibility = ele.getAttribute('data-visible');
if (visibility === "true") {
ele.setAttribute("data-visible", false);
setIsVisible(false)
}
else{
ele.setAttribute("data-visible", true);
setIsVisible(true)
}}
return (

Department of Computer Science and Engineering, Page 57


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

<div className="post_item">
<div className="user_details">
<img src={pic1} alt="" />
<div className="name_details">
<p className="username">@{props.user.username}</p>
<p className="name">{props.user.name}</p>
</div>
</div>
<div className="post_contents">
<span>{props.postText}</span>
<img src={props.pic?`https://${props.pic}`:""} alt="" />
</div>
<div className="post_controls">
<div className="like">
<i className="bx bx-like" />
<span>Like</span>
</div>
<div className="comment" onClick={handleShowComment}>
<i className="bx bx-message-dots" />
<span>Comment</span>
</div>
<div className="share">
<i className='bx bx-share'></i>
<span>Share</span>
</div>
</div>
<div className="comments_main_container" data-visible="false">
{isVisible && <CommentMainItem postId={props.postId} />}
</div>
</div>
)}
export default Postitem

7.1.4 Profile page

Department of Computer Science and Engineering, Page 58


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

function Profile() {
const { state,currentAccount } = useContext(SocialMediaContext); const
{ contract } = state
const [disableInput,setDisableInput] = useState(true) const
[inputVal,setInputVal] = useState("")
const handleEnable=()=>{
setDisableInput(false)
}
const handleChange=(e)=>{
setInputVal(e.target.value)
}
const handleUpdate=async ()=>{
contract && await contract.updateProfile(inputVal,currentAccount);
}
useEffect(()=>{
const getProf = async()=>{
const prof = await contract.getProfile(currentAccount)
setInputVal(prof.accountCid)
}
getProf()
// eslint-disable-next-line
},[contract]) return (
<>
<SideBar />
<div className="profile_container">
<div className="profile_content">
<div className="edit" onClick={handleEnable}>
<i class='bx bxs-edit-alt'></i>
</div>
<inputvalue={inputVal}type="text"name="username"disabled={disableInput} className='profile_name'
onChange={handleChange} />
<button onClick={handleUpdate}>Update</button>
</div>

Department of Computer Science and Engineering, Page 59


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

</div>
</>)}
export default Profile

7.1.5 User post page

function UserPost() {
const { state,currentAccount } = useContext(SocialMediaContext);
const { contract } = state
const [userposts,setUserposts] = useState([]);
useEffect(()=>{
const getUserPost = async()=>{
const uposts = await contract.viewUserPost(currentAccount)
setUserposts(uposts)
}
contract && getUserPost()
},[contract])
return (
<>
<Navbar />
<SideBar />
<div className="userpost_container">
<h1>Your Posts</h1>
<div className="userpost">
{
userposts.length>0?userposts.map((post,index)=>{
return (
<div className="userpost_item" key={index}>
<div className="userpost_img">
<img src={`https://${post.imgUrl}`} alt="" />
</div>
<p>{post.postText}</p>
</div>)
}):<p className='nopost'>You have not posted yet</p>}

Department of Computer Science and Engineering, Page 60


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

</div>
</div>
</>)}
export default UserPost

7.1.6 Add post component

return (
<>
<div className="modal" id="modal">
<div className="modal_top">
<h1 className='modal_title'>Add Post</h1>
<div className="close-icon" onClick={handleModalClose}>
<istyle={{cursor:"pointer",color:"red"}}className='bxbx-x-circlebx-sm'
onClick={handleModalClose}></i>
</div>
</div>
<div className="modal_body">
<div className="modal-container">
<textareaclassName='post_text' name="post_text" id="" rows="5" onChange={handleChange}
placeholder="Enter your post" ></textarea>
<input type="file" onChange={getFiles} />
</div>
<button className='modal-qstn-submit' onClick={handleSubmit}>Submit</button>
</div>
<Message />
{enableProgress && <ProgressBar />}
</div>
<div id="overlay" onClick={handleModalClose}></div>
</>
)

7.1.7 Follow component

const FriendModal = () => {

Department of Computer Science and Engineering, Page 61


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

const handleModalClose = ()=>{


const modal = document.querySelector("#FriendModal");
const overlay = document.querySelector("#overlay");
modal.classList.remove("active");
overlay.classList.remove("active");
}
const { state,currentAccount } = useContext(SocialMediaContext);
const { contract } = state
const [friends,setFriends] = useState(null)
useEffect(()=>{
const getFriends = async()=>{
const fri = await contract.getFollowers(currentAccount)
setFriends(fri)
}
contract && getFriends()
},[contract])
return (
<>
<div className='FriendModal' id='FriendModal'>
<div className="header">
<div className="heading"><b>Friends</b></div>
<istyle={{cursor:"pointer",color:"red"}}className='bxbx-x-circlebx-sm'
onClick={handleModalClose}></i>
</div>
<div className="list">
{
friends && friends.map((fr,index)=>{
return(
<div className="user" key={index}>
<div className='info'>
<img src={userimg} alt="" width={50} />
<div className="name">
<b><p>{fr.name}</p></b>
<span>@{fr.username}</span>

Department of Computer Science and Engineering, Page 62


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

</div></div>
<div className="btn">
Following
</div></div>
)})}
</div></div>
</>)}
7.1.8 Comment section

function CommentMainItem(props) {
const { state,filterText,setFilterFeedback } = useContext(SocialMediaContext);
const { contract } = state
const [commentData,setCommentData] = useState(null)
const [comment,setComment] = useState("");
const handleCommentChange=(e)=>{
setComment(e.target.value)
}
const handlePostComment= async
()=>{ const res = await
filterText(comment,1) if(res.data.msg==1)
{
contract && await contract.addComment(props.postId-1,comment);
window.location.reload()
}
else{ setFilterFeedba
ck({ isEnable:true,
msg:"Violence content found in your comment..."
})}}
useEffect(()=>{ document.querySelector(`.input_comment$
{props.postId} input`).focus() const getComments = async()=>{
const comments = await contract.viewPostComment(props.postId-1);
setCommentData(comments)
}

Department of Computer Science and Engineering, Page 63


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

getComments()
// eslint-disable-next-line
},[contract])
return (
<>
<div className="add_comment">
<div className="user_img">
<img src={pic1} alt="" />
</div>
<div className={`input_comment input_comment${props.postId}`}>
<input type="text" placeholder="Add a comment..." value={comment}
onChange={handleCommentChange} />
<div className="send_comment" onClick={handlePostComment}>
<i className='bx bxs-send'></i>
</div></div></div>
<Message />
<div className="comments_container">
<div className="comments_part">
{commentData && commentData.map((ele,index) =>
{ return <CommentItem key={index} cmt={ele} />
})}
</div></div>
</>
)}

7.2 Image and Text Classification

7.2.1 Text Classification


from flask import Flask, request, jsonify
from flask_cors import CORS
import pandas as pd
import re
import string

Department of Computer Science and Engineering, Page 64


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

import bz2file as bz2


import joblib as jb
with bz2.BZ2File('wv.joblib.bz2', 'rb') as f:
td = jb.load(f)
with bz2.BZ2File('md.joblib.bz2', 'rb') as f:
mp = jb.load(f)
def clean_text(text):
text = text.lower()
text = re.sub(r"i'm", "i am", text)
text = re.sub(r"\r", "", text)
text = re.sub(r"he's", "he is", text)
text = re.sub(r"she's", "she is", text)
text = re.sub(r"it's", "it is", text)
text = re.sub(r"that's", "that is", text)
text = re.sub(r"what's", "that is", text)
text = re.sub(r"where's", "where is",
text) text = re.sub(r"how's", "how is",
text) text = re.sub(r"\'ll", " will", text)
text = re.sub(r"\'ve", " have", text)
text = re.sub(r"\'re", " are", text)
text = re.sub(r"\'d", " would", text)
text = re.sub(r"\'re", " are", text)
text = re.sub(r"won't", "will not", text)
text = re.sub(r"can't", "cannot", text)
text = re.sub(r"n't", " not", text)
text = re.sub(r"n'", "ng", text)
text = re.sub(r"'bout", "about", text)
text = re.sub(r"'til", "until", text)
text = re.sub(r"[-()\"#/@;:<>{}`+=~|.!?,]", "", text)
text = text.translate(str.maketrans('', '', string.punctuation))
text = re.sub("(\\W)"," ",text)
text = re.sub('\S*\d\S*\s*','', text)
return text

Department of Computer Science and Engineering, Page 65


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

def make_test_predictions(df):
df.comment_text = df.comment_text.apply(clean_text)
X_test = df.comment_text
X_test_transformed = td.transform(X_test)
y_test_pred =
mp.predict_proba(X_test_transformed) result =
sum(y_test_pred[0])
if result >=1 :
return 1
else :
return 0
app = Flask( name )
CORS(app)
@app.route("/media/text", methods=['POST'])
def sanitize():
val = request.get_json()
val = val['comment']
comment_text = val
comment ={'comment_text':[comment_text]}
comment = pd.DataFrame(comment)
result = make_test_predictions(comment)
if(result==0):
return(jsonify({"msg": 1}))
else:
return(jsonify({"msg":
0})) if name == ' main
':
app.run()

7.2.2. Image Classification


from flask import Flask, request, jsonify
from werkzeug.utils import secure_filename
import tensorflow as tf
import numpy as np

Department of Computer Science and Engineering, Page 66


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023
from flask_cors import CORS
import imageio

Department of Computer Science and Engineering, Page 67


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

model = tf.keras.models.load_model('imageclassifier.h5')
ALLOWED_EXTENSION = set(['jpeg','jpg','png'])
def allowed_file(filename):
filext = filename.split(".")
if filext[1] not in ALLOWED_EXTENSION:
return 0
return '.' in filename and filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSION
app = Flask( name )
CORS(app)
@app.route('/media/image', methods=['POST'])
def upload_media():
if 'file' not in request.files:
return jsonify({'error':'media not provided'}),400
file = request.files['file']
if file.filename == '':
return jsonify({'error':'no file selected'}),400
if allowed_file(file.filename)==0:
return jsonify({'msg':2})
if file and allowed_file(file.filename):
filename = secure_filename(file.filename)
img_content = file.read()
img = imageio.imread(img_content)
resize = tf.image.resize(img, (256,256))
pred = model.predict(np.expand_dims(resize/255, 0))
if pred > 0.6:
x=1
else:
x=0
if x==0:
return jsonify({'msg':1})
else:
return jsonify({'msg':0})
if name == ' main ':
app.run(debug=True, port=5000)

Department of Computer Science and Engineering, Page 68


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

7.3 Blockchain and Smart Contract


// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.8.2 <0.9.0;
contract SocialMedia {
uint256 public post_count;
uint256 public comment_count;
uint256 public user_count;
struct userAccount {
string name;
string username;
string phonenum;
string email;
string bio;
string gender;
address userId; //metamask wallet
uint256 userNum;
uint8 flag;
uint256 follow_count;
}
struct userPost
{ string postText;
string imgUrl;
address userId;
uint256 postNum;
uint256 cmtcount;
}
struct Comment
{ string content;
uint256 postId;
address owner;}
//for chatting
struct friend
{ address
pubkey;
Department of Computer Science and Engineering, Page 69
ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

string name;
string username;
}
struct message
{ address sender;
uint256 timestamp;
string message;
}
struct userPicture {
string pictureCid;
}
address [] users;
Comment[] comments;
userPost[] public post;
mapping(address => friend[]) public _followers;
mapping(address => userAccount) public _account;
mapping(address => userPicture) public _picture;
mapping(bytes32 => message[]) allMessages;
function getChatcode(address pubkey1,address pubkey2) internal pure returns(bytes32){
if(pubkey1<pubkey2){
return keccak256(abi.encodePacked(pubkey1,pubkey2));
}
else return keccak256(abi.encodePacked(pubkey2,pubkey1));
}
function sendMessage(address friendkey, string calldata _msg) external
{ bytes32 chatcode = getChatcode(msg.sender,friendkey);
message memory newMsg = message(msg.sender,block.timestamp,_msg);
allMessages[chatcode].push(newMsg);
}
function readMessage(address friendkey) external view returns (message[] memory)
{ bytes32 chatcode = getChatcode(msg.sender,friendkey);
return allMessages[chatcode];
}
function updateProfile(string memory user_name,string memory uname,string memory

Department of Computer Science and Engineering, Page 70


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

phone,string memory user_email,string memory user_bio,string memory user_gender,address


wallet) public {
require(wallet==msg.sender,"Access denied");
if(_account[wallet].flag==1){
//updation
uint256 userNumber = _account[msg.sender].userNum;
uint256 fcount = _account[msg.sender].follow_count;
_account[wallet] = userAccount({
name:user_name,
username:uname,
phonenum:phone,
email:user_email,
bio:user_bio,
gender:user_gender,
userId:wallet,
userNum:userNumber,
flag:1,
follow_count:fcount
});
}
else
{
//creation
users.push(wallet);
user_count++;
_account[wallet] = userAccount({
name:user_name,
username:uname,
phonenum:phone,
email:user_email,
bio:user_bio,
gender:user_gender,
userId:wallet,
userNum:user_count,

Department of Computer Science and Engineering, Page 71


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

flag:1,
follow_count:0
});
}}
function getProfile(address wallet) public view returns(userAccount memory)
{ return _account[wallet];
}
function getAllProfiles() public view returns(userAccount[] memory)
{ userAccount [] memory accs=new userAccount[](user_count);
for(uint i=0; i<user_count; i++){
accs[i] = _account[users[i]];
}
return accs;
}
function follow(address wallet,address follower) public
{ require(wallet!=follower,"Cannot follow yourself");
require(_account[msg.sender].flag==1,"Update profile first");
for(uint i=0; i<_account[msg.sender].follow_count; i++){
if(_followers[wallet][i].pubkey==follower){
revert("Already followed");
}}
string memory fname = _account[follower].name;
string memory uname = _account[follower].username;
friend memory newFriend = friend(follower,fname,uname);
_followers[wallet].push(newFriend);
}
function getFollowers(address wallet) public view returns(friend[] memory)
{ return _followers[wallet];
}
function updatePicture(string memory newPCid,address wallet) public
{ require(wallet==msg.sender,"Access denied");
_picture[wallet] = userPicture({
pictureCid:newPCid
}); }

Department of Computer Science and Engineering, Page 72


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

function addPost(address wallet,string memory p_hash, string memory img_hash) public


{ require(wallet==msg.sender,"Access denied");
post_count++;
post.push(userPost({ p
ostText : p_hash,
imgUrl : img_hash,
userId : wallet,
postNum : post_count,
cmtcount:0
}));
}
function addComment(uint postId,string memory content) public {
comment_count++;
post[postId].cmtcount++;
comments.push(Comment({
content: content,
owner:msg.sender,
postId:postId
}));
}
function viewPost() public view returns(userPost[] memory)
{ return post;
}
function viewPostComment(uint postId) public view returns(string[] memory) {
string [] memory cmts=new string[](post[postId].cmtcount);
uint ind;
for(uint i=0; i<comment_count; i++){
if(comments[i].postId==postId){ cmts[ind+
+]=comments[i].content;
}}
return cmts;
}
function viewUserPost(address wallet) public view returns(userPost[] memory)
{ require(wallet==msg.sender,"Access denied");

Department of Computer Science and Engineering, Page 73


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

uint256 matchingPostCount = 0;
for (uint256 i = 0; i < post_count; i++)
{ if (post[i].userId == wallet) {
matchingPostCount++;
}}
userPost [] memory psts=new userPost[](matchingPostCount);
uint256 currentIndex = 0;
for(uint i=0; i<post_count; i++){
if(post[i].userId==wallet)
{ psts[currentIndex]=post[i];
currentIndex++;
} }
return psts;
}}

7.4 Unit Testing of Smart Contract


const { expect } = require("chai");
describe("SocialMedia Contract",function()
{
it("should allow users to create a post",async function(){
const [owner] = await ethers.getSigners()
// console.log("Signers Object\n",owner);
const socialmedia = await ethers.getContractFactory("SocialMedia")
const hardhatSocialmedia = await socialmedia.deploy()
const postContent = "This is my first post";
console.log("\npost to be created : ",postContent);
// Create a post from user
await hardhatSocialmedia.addPost(owner.address,postContent,"img hash");
const post = await hardhatSocialmedia.viewPost();
console.log("post saved to blockchain : ",post[0],"\n");
// Verify the post details
expect(post[0].postText).to.equal(postContent);
expect(post[0].userId).to.equal(owner.address);
})

Department of Computer Science and Engineering, Page 74


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023
it("should allow users to add comment to a post",async function(){

Department of Computer Science and Engineering, Page 75


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

const [owner] = await ethers.getSigners()


const socialmedia = await ethers.getContractFactory("SocialMedia")
const hardhatSocialmedia = await socialmedia.deploy()
const postContent = "This is my sample post";
await hardhatSocialmedia.addPost(owner.address,postContent,"img hash");
const post1 = await hardhatSocialmedia.viewPost();
const cmtContent = "Hello this is a good post kepp it up!";
console.log("\nComment to be added : ",cmtContent);
await hardhatSocialmedia.addComment(0,cmtContent);
const cmt = await hardhatSocialmedia.viewPostComment(0);
console.log("comment saved to blockchain",cmt,"\n");
// Verify the post details
expect(cmt[0]).to.equal(cmtContent);
})
it("should allow users to follow other users",async function()
{ const [owner1,owner2] = await ethers.getSigners()
const socialmedia = await ethers.getContractFactory("SocialMedia")
const hardhatSocialmedia = await socialmedia.deploy()
constprof=awaithardhatSocialmedia.updateProfile("ajay","techy","1234","[email protected]",
"good day","M",owner1.address);
await hardhatSocialmedia.follow(owner1.address,owner2.address);
const followers = await hardhatSocialmedia.getFollowers(owner1.address); console.log("\
nfollowers of : ",owner1.address,"-->",followers[0].pubkey,"\n");
// Verify the post details
expect(followers[0].pubkey).to.equal(owner2.address);
})
it("User cannot follow himself/herself",async function()
{ const [owner1,owner2] = await ethers.getSigners()
const socialmedia = await ethers.getContractFactory("SocialMedia")
const hardhatSocialmedia = await socialmedia.deploy()
await
expect(hardhatSocialmedia.follow(owner1.address,owner1.address)).to.be.revertedWith("Cann
ot follow yourself");
})

Department of Computer Science and Engineering, Page 76


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

it("User cannot follow if profile not updated",async function()


{ const [owner1,owner2] = await ethers.getSigners()
const socialmedia = await ethers.getContractFactory("SocialMedia")
const hardhatSocialmedia = await socialmedia.deploy()
await
expect(hardhatSocialmedia.follow(owner1.address,owner2.address)).to.be.revertedWith("Upda
te profile first");
})
it("Allow user to chat with other user",async function(){
const [owner1,owner2] = await ethers.getSigners()
const socialmedia = await ethers.getContractFactory("SocialMedia")
const hardhatSocialmedia = await socialmedia.deploy()
constprof=awaithardhatSocialmedia.updateProfile("ajay","techy","1234",
"[email protected]","good day","M",owner1.address);
await hardhatSocialmedia.follow(owner1.address,owner2.address);
const msg = "Hello how are you";
console.log("\nMessage to be sent : ",msg);
await hardhatSocialmedia.sendMessage(owner2.address,msg);
const msgs = await hardhatSocialmedia.readMessage(owner2.address);
console.log('Message stored in blockchain : ',msgs[0]);
expect(msgs[0].message).to.equal(msg);
})
it("Allow users to create and update profile",async function()
{ const [owner] = await ethers.getSigners()
const socialmedia = await ethers.getContractFactory("SocialMedia")
const hardhatSocialmedia = await socialmedia.deploy()

const prof = await hardhatSocialmedia.getProfile(owner.address);


console.log("\nProfile before updation : ",prof);
expect(prof.flag).to.equal(0);
awaithardhatSocialmedia.updateProfile("ajay","techy","1234","[email protected]","good
day","M",owner.address);
const prof2 = await hardhatSocialmedia.getProfile(owner.address);
console.log("\nProfile After updation : ",prof2);

Department of Computer Science and Engineering, Page 77


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

expect(prof2.flag).to.equal(1);
})
it("Allow users to view their posts",async function()
{ const [owner] = await ethers.getSigners()
const socialmedia = await ethers.getContractFactory("SocialMedia")
const hardhatSocialmedia = await socialmedia.deploy()
const postContent = "Hello how are you"
await hardhatSocialmedia.addPost(owner.address,postContent,"img hash");
const post = await hardhatSocialmedia.viewPost();
console.log("\npost saved to blockchain : ",post[0],"\n");
const userpost = await hardhatSocialmedia.viewUserPost(owner.address);
// Verify the post details
expect(userpost[0].postText).to.equal(post[0].postText);
}) })

7.5 IPFS Storage


const [ipfsFile,setIpfsFile] = useState(null)
function getAccessToken () {
return process.env.REACT_APP_IPFS
}
function makeStorageClient () {
return new Web3Storage({ token: getAccessToken() })
}
function getFiles (e) {
const fileInput = e.target.files
setIpfsFile(fileInput)
}
async function storeFiles (files)
{ const client = makeStorageClient()
const cid = await client.put(files)
console.log('stored files with cid:',
cid) return cid
}

Department of Computer Science and Engineering, Page 78


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 8
RESULT AND ANALYSIS

8.1 Screen Shots

Fig 8.1 – Metamask Login

Fig 8.2 – Home Page

Department of Computer Science and Engineering, Page 79


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Fig 8.3 – Profile

Fig 8.4 – View User Post

Department of Computer Science and Engineering, Page 80


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Fig 8.5 – View User

Fig 8.6 – Text Filtering

Department of Computer Science and Engineering, Page 81


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Fig 8.7 – Image Classification-Negative image

Fig 8.8 – Image classification-Normal Image

8.2 Analysis

Four distinct models, including a profanity-check, profanity-filter, profanity, and an


author-developed logistic regression model, were used to analyse the results of the comment
filtration technique. The Toxic Comment Detection dataset and a test set made up of 20% of
the dataset were used for the evaluation. As we can see, in terms of accuracy, precision, recall,
and F1 score, the logistic regression model performs better than the other models. It
outperforms the other models with an accuracy of 0.97, which is a significant improvement.
The model's precision is likewise high, meaning that it accurately recognises harmful
comments with a low number of false positives. The performance of each model was evaluated

Department of Computer Science and Engineering, Page 82


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

using accuracy, precision, recall, and F1 score.

The outstanding accuracy of 98.7% attained by the image classification model in


identifying violent content in social media photographs was created utilising the architecture
described in the methodology section. The model was trained on a large dataset made up of
photos of violence from Open photos V6, as well as additional images from ImageNet and the
Iris dataset. Insights into the model's performance are given in the following analysis, which
also compares it to a model that has already been trained to filter out illegal and improper
information. The proposed deep learning model's ability to effectively categorise violent and
non-violent images is demonstrated by the accuracy of 98.7% attained in the classification
process. The model's capacity to distinguish between photos with violent content and those
without is demonstrated by the high accuracy rate. The performance of the model can be due to
the well-planned architecture, which combines convolutional layers, pooling layers, and dense
layers, allowing the model to learn complex visual cues and provide precise predictions. We
compared the effectiveness of our model to a pre trained model for detecting illegal or
unsuitable content. We chose a cutting-edge pre-trained model that has been successfully
applied to image classification tasks, such as ResNet50 or VGG16. These pre-trained models
achieve high accuracy rates in a variety of visual recognition tasks by utilising big datasets,
thorough training, and sophisticated architectures. The below table shows image classification
model created using the architecture detailed in the methodology section is referred to as the
"Proposed Deep Learning Model". This programme identified violent content in social media
photographs with a remarkable accuracy of 98.7%.

Blockchain technology has the potential to transform the way social media platforms
operate, by providing new levels of transparency, security, and decentralization. By leveraging
blockchain, this platform provides a decentralized and secure environment that allow users to
control their data, interact with each other in a secure and transparent way. The use of IPFS
along with blockchain solves the limited storage of the blockchain and helps to reduce cost and
improve scalability. The use of Polygon allowed to scale the blockchain application. The
Polygon is a multichain solution which offer better scalability. It operates as a sidechain to the
Ethereum blockchain, which means that it is a separate blockchain that is still connected to the
main Ethereum network. One of the key advantages of using Polygon is that it can
significantly reduce transaction fees and increase transaction speed. This is achieved by
offloading many of the processing tasks from the Ethereum mainnet to the Polygon network,

Department of Computer Science and Engineering, Page 83


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

which operates on a separate infrastructure. This reduces the burden on the Ethereum network
and allows transactions to be processed faster and more efficiently. The Ethereum blockchain
has high transaction cost and slow transaction processing. It could only process 13-15
Transactions Per Second (TPS). Polygon can process all the way up to 65000 TPS. The
average transaction fee on Ethereum is about $6.33 and Polygon can reduce it to less than $0.

Table 8.3 Comparison between Ethereum & Polygon

Criteria Ethereum Polygon

Native Token ETH MATIC


Programming Language Solidity Golang Solidity Vyper

Concensus Mechanism Proof of Stake Proof of Stake Plasma Based


Sidechain
Transaction Speed 13 -15 Per Second 6500 Per Second

Scalability Limited Scalability Multichain solution offer


better scalability

Department of Computer Science and Engineering, Page 84


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 9
CONCLUSION

The project focuses on the development of a social media platform that harnesses the
power of blockchain technology.

The blockchain that we choose for our platform is Ethereum. The smart contracts for
the Ethereum blockchain was developed on solidity which is a programming language for the
Blockchain. The smart contract allows you to write various functionalities to store and retrieve
user data while ensuring transparency, immutability, and security of user data. The smart
contract was tested first on a local blockchain using 'ganache'. For compiling and testing the
contracts a tool called 'hardhat' was used. Once fully tested the smart contract was deployed on
Ethereum blockchain. The integration of blockchain technology provided secure storage and
access to user data while facilitating transparent and auditable transactions.

Recognizing the importance of scalability, we dedicated efforts to ensure our platform


could handle increased user demand. By utilizing Polygon, a Layer 2 solution built on top of
Ethereum, we achieved significantly higher transaction throughput and reduced costs, making
the platform more accessible and efficient. This scalability enhancement enables the seamless
growth of the user base and ensures a smooth user experience.

Finally the Blockchain and ML functionalities were integrated to the frontend to unlock
the full potential of the platform which filtered harmful and violence content posted in the
platform.

Department of Computer Science and Engineering, Page 85


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 10
FUTURE ENHANCEMENT
The blockchain-based social media platform provides users with a secure, reliable,
transparent, and traceable environment. Unlike traditional social media platforms, this platform
is designed to be user-centric, where users have ownership and control over their data.

One such rollup solution is zk-rollup, also known as zero-knowledge rollups. These
rollups utilize zero-knowledge proofs to bundle multiple transactions off-chain and present a
concise proof to the main blockchain. These cryptographic proofs guarantee the validity of all
transactions within the rollup, ensuring security and trust without disclosing specific
transaction details.

Another rollup approach is optimistic rollups, which employ optimistic state execution.
In this method, transactions are processed off-chain with minimal validation. It assumes that
transactions are valid unless proven otherwise through fraud proofs. This approach enables
faster transaction processing and reduces the computational load on the main blockchain.

Looking ahead, the platform has the potential to introduce a token economy that
incentivizes users for sharing content and making contributions. This token-based incentive
system can foster user engagement and participation within the platform. Revenue generation
strategies such as advertising, premium subscriptions, sponsored content, or in-app purchases
can be included in this platform.

Currently, the platform incorporates filtering mechanisms to identify and filter


inappropriate text and images. However, to further enhance the accuracy of these filtering
models, it is advisable to incorporate more extensive datasets. Additionally, in the future, there
is potential to expand the filtering capabilities to include inappropriate video content, thereby
providing a comprehensive content filtering solution.

By integrating these advancements and improvements, the blockchain-based social


media platform can offer a robust and user-friendly environment where privacy, security,
scalability, and incentivization are key features. This continuous development and expansion
pave the way for a promising future in the realm of blockchain-enabled social media
applications.

Department of Computer Science and Engineering, Page 86


ASIET
BLOCKCHAIN ENABLED SOCIAL NETWORKING APPLICATION WITH AUTOMATED CONTENT FILTERING May 2023

Chapter 11
REFERENCES
[1] L. Jiang and X. Zhang, "BCOSN: A Blockchain Based Decentralized Online Social
Network," in IEEE Transactions on Computational Social Systems, vol. 6, no. 6, pp. 1454-
1466, Dec. 2019, doi: 10.1109/TCSS.2019.2941650.
[2] F. Yang, Y. Wang, C. Fu, C. Hu, and A. Alrawais, "An Efficient Blockchain-Based
Bidirectional Friends Matching Scheme in Social Networks," in IEEE Access, vol. 8, pp.
150902 - 150913,2020,doi:10.1109/ACCESS.2020.3016986.
[3] J. Kim and A. Yun, &quot; Secure Fully Homomorphic Authenticated Encryption, &quot; in
IEEE Access, vol.9, pp. 107279-107297, 2021, doi: 10.1109/ACCESS.2021.310084.
[4] S.-C. Cha, T.-Y. Hsu, Y. Xiang, and K.-H. Yeh, ‘‘Privacy enhancing technologies in the
Internet of Things: Perspectives and challenges,’’ IEEE Internet Things J., vol. 6, no. 2, pp.
2159–2187, April 2019.
[5] B. Jeon, S. M. Ferdous, M. R. Rahman, and A. Walid, "Privacy Preserving decentralised
aggregation for federated learning," in Machine Learning (cs.LG); Distributed, Parallel, and
Cluster Computing (cs.DC),Dec. 2020,doi: arXiv:2012.071836.

[6] M. U. Hassan, M. H. Rehmani, and J. Chen, ‘‘Differential privacy in blockchain technology:


A futuristic approach,’’ Cryptography and Security (cs.CR); Networking and Internet
Architecture (cs.NI). vol. 145,April 2020,doi: arXiv:1910.04316
[7] K. Yousaf and T. Nawaz, "A Deep Learning-Based Approach for Inappropriate Content
Detection and Classification of YouTube Videos," in IEEE Access, vol. 10, pp. 16283-
16298, 2022, doi: 10.1109/ACCESS.2022.31475198.
[8] K. Yousaf, R. -H. Park and H. -M. Park, "Efficient Spatio-Temporal Modelling Methods for
Real-Time Violence Recognition," in IEEE Access, vol.9, pp.76270 - 76285, 2021, doi:
10.1109/ ACCESS.2021.3083273.
[9] P. Sharmila, K. S. M. Anbananthen, D. Chelliah, S. Parthasarathy and S. Kannan, "PDHS:
Pattern-Based Deep Hate Speech Detection with Improved Tweet Representation," in IEEE
Access, vol. 10, pp. 105366-105376, 2022, doi: 10.1109/ACCESS.2022.3210177.
[10] J. Sun, X. Yao, S. Wang, and Y. Wu, "Blockchain-Based Secure Storage and Access
Scheme For Electronic Medical Records in IPFS," in IEEE Access, vol. 8, pp. 59389-59401,
2020,doi:10.1109/ACCESS.2020.298296

Department of Computer Science and Engineering, Page 87


ASIET

You might also like