Abstract
Recommender Systems are mainly used in various e-commerce applications, especially online stores threatening users’ privacy. The privacy issues can be overcome by using security solutions, which include blockchain technology for privacy applications. The fusion of the Internet of Things and blockchain technology has fully improved modern distributed systems. The combination guarantees the safety and scalability of the recommender system. We aim to create an authorized secure exchange device using blockchain-enabled multiparty computation by adding smart contracts to the core blockchain protocol. The recommendation structure and Blockchain technology make online shopping more convenient and private. We propose a blockchain-related recommender system using the “movielens” data. The case study includes a smart contract model that recommends movies to buyers. Initially, we tested the model on a small “movielens dataset” and extended it to a 3M movielens dataset. We developed a classifier model for movielens and proposed a Dual light graph convolutional network for movielens data classification. Our results, including ablation analysis, show that blockchain strategies and Dual light graph convolutional networks can effectively improve recommender systems’ privacy. Furthermore, the suggested blockchain technique can be stretched by similar procedures.
Introduction
Due to changing Internet and social media structures, web services such as Netflix, Amazon, Facebook, Instagram, YouTube, etc., exploded in recent years. These web offerings use online recommendation structure (RS) advertising to persuade customers to purchase related items [2,40]. Recommender systems have become very popular in many areas, including online shopping, news media, and streaming products. RS is essential to provide personalized services to users. Users can enjoy various centralized recommendations, including movies, books, restaurants, etc. [42].
Today, RS is unavoidable in our everyday lives because of the upward push in virtual advertising and transactions of digital coinage such as Blockchain on the net [42]. The RS is predicated on understanding several elements about the users, together with, however, no longer limited to, they are beyond searches, explicitly provided choices and demographics. The higher level of accuracy in RS calls for entry to extra users’ non-public facts and, therefore, a greater threat to users’ privacy. A series of attributes from customers inherently threatens their privateness and poses (privacy) risks, which include: i) the information supplied undesirably discloses the customers’ pastimes to the RS; ii) the records supplied may be abused using the RS, and iii) the information furnished can be stolen through attackers. Additionally, privacy issues prevent users from sharing records generously with fascinated groups, although the great of the recommendations might be enhanced. Users fear scams, mismanagement of their data, and lack of management. For this reason, it is crucial to analyze techniques for protecting customers’ privacy without compromising RS’s current and future capability for quality and accuracy.
RS performs an active online role through data mining and artificial intelligence advances. Their role is crucial in the online commercial enterprise, connecting customers with capability purchases, content material, and other offerings [35]. RS collects information based on its customers’ options for numerous objects, including electronic items, books, gadgets, films, songs, etc. The statistics can be gathered in two methods: i) explicitly, by collecting users’ ratings, and ii) implicitly, by tracking customers’ behaviour.
RS may be incredibly famous in E-commerce and IoT programs. Unluckily, privacy worries such as shared devices/services and strangers gaining access to non-public records save users from sharing documents generously with involved groups, even though the first-class of the recommendations might be advanced [5,8,34]. Users mainly worry about fraud, mismanagement of their personal information, and lack of control. Furthermore, due to improved policies and client needs, there is a need for sophisticated devices to deal with privacy issues. Blockchain-based answers are a promising possibility for remedying the abovementioned issues [54,56].
The adopted version for prediction, entry statistics, and context can substantially affect the RS’s quality. Security and trustworthiness should be nicely addressed for several online retailers to ensure customer privacy and records safety. The decentralization architecture in the blockchain era is generally beneficial due to its capability to beautify security problems, which has been an extended-time problem with new transactions [9,44]. Security and reliability issues are resolved based on proof of work and a public ledger between parties, as evidenced by Bitcoin or Ethereum. Transactions are initiated using role nodes called “miners” that sell non-public records held for proof of work. Instead, sales can be made using personal or public keys issued to many members. Public ledgers include an immutable chain of transactions that ensures that no participant’s records or instructions can be tampered with and that the entire transaction cannot be invalid [1,45].
Previously, blockchains were used to build recommendation structures [25,45]. However, these systems use simple mathematical models and features in smart contracts (weighted generic and simple generic strategies to obtain the object’s incentive ratings), resulting in erroneous endorsements. One of the main areas of improvement in the work above is that high-level models can frequently represent the same elements. The scores may also be artificial due to the significant negative opinion available and income from competing groups. In this article, we have an advanced collaborative filter recommendation algorithm that overcomes shortcomings using blockchain expertise. A similarity matrix is used to compute device boost ratings. The match represents the relationship between each person so that a better match will have a more considerable impact on recommendation scores.
This study uses publicly available blockchain strategies, including Ethereum (smart contracts). Anyone can check and authenticate transactions and contribute to the consensus system. In this research, we capitalize on this opportunity by using a Blockchain-based movie recommender system that can be easily extended to other recommender systems. We can quickly develop the proposed blockchain technique for other related applications.
The main contribution of this research is we present innovative Blockchain and Recommender systems techniques. The combination of blockchain and recommendation systems has created a modern decentralized web. This integration ensures the protection and scalability of the recommender system. By adding smart contracts to the underlying blockchain procedure, we aim to create a secure, trust-based system to take advantage of blockchain enabled multiparty computing. Combining the recommendation system and the blockchain era makes online activities more convenient and personalized. The suggested rating device provides the most suitable recommendation to the buyer, mainly using the person’s features associated with the gadget. Our approach considers each consumer’s choices and offers quality recommendations. We also propose Dual light graph convolutional network for Movielens data classification and use the ablation method to validate the results with similar methods.
The remaining part of the article consists of Section 2, which discusses tasks related to the proposed method; Section 3 describes a recommendation system using Blockchain – Section 4 details the implementation of the “movie” recommendation system proposed. Section 5 evaluates the proposed method by classifying the film lens dataset. Finally, Section 6 summarizes the proposed method and indicates future research directions.
Related work
Recommender systems are widely used in many applications, including social media, energy saving, e-commerce, healthcare, etc. [15]. Recommender systems provide precise and consistent data to particular users [33,37]. Recommender systems have significantly contributed to knowledge management and information filtering systems. RS systems deliver accurate and reliable recommendations to users and keep them informed about all e-commerce products. In the era of big data and complex information delivery systems, getting precise information online is impossible [21,37]. Recommender systems bring together the relevant knowledge and capabilities of users or customers. For example, suppose a new person registers with Amazon.com to make purchases etc. In this case, the recommendation engine examines user behaviour and patterns. When a recommender system fails to make appropriate recommendations, this problem is called a “cold start” [32,46].
Internet services like Yelp, Amazon, etc. are leading for their information tracking and predictive algorithms. RS helps you make decisions faster by tracking user behaviour and preferences [10]. This reduces the cognitive load on users and provides proper valued services. However, these personalized recommendations can seriously infringe on the privacy of users. These facilities gather demographic data about users and other information, including email details and mobile phone numbers. It also contains product details, web address, and “person’s (user)” shopping habits and interests. RS collects user data based on i) Transparency – product price and ii) transparency – product purchase history.
Direct data entry requires conscious effort on the user’s part to complete the procedures. Instead, Implicit access is inevitably processed without the user’s knowledge. Such information discovered and obtained by unreliable third parties may have dangerous consequences. Differences in user data privacy make it difficult to implement the best protection mechanism to protect user privacy. Therefore, many techniques have been proposed to address privacy issues in recommender systems, such as granting users control over information postings [36,51] or providing reasons for disclosure [36,51]. Rules help users manage data flow and decide on data sharing to reduce privacy concerns. A recent study by Zhang et al. [53] uses the value of disclosure as a possible explanation for privacy issues for different types of information in the context of two dimensions i) trust and ii) advice. Surveillance may have privacy implications due to general hospital costs, they show.
Recommender systems are susceptible to outside cyber attacks, including inserting or deploying data to train models. With privacy and security concerns, ensuring data is stored securely becomes more challenging – a task in cloud (and, therefore, decentralized) computing [31]. Conventional RS for private applications has the following disadvantages: a) The quality of interference and differential neighbour selection is poor due to the introduction of significant noise. b) Disturbances and differentials are not firmly guaranteed to ensure strict safety. It is also affected by the trade-off between confidentiality and accuracy of recommendations. c) The homomorphic approximation has a high computational cost [7,20]. Additionally, most recommender systems focus on model accuracy while ignoring matters related to user privacy and security [31].
To fill this gap, blockchain technology is considered a promising strategy for recommender system privacy and security due to its key properties of security and privacy, resilience, adaptability, fault tolerance, and reliability [15]. Therefore, a traditional privacy-preserving RS and a blockchain-based approach are proposed. Cryptographic solutions mitigate the privacy risks associated with privacy-based RS. Secure multiparty computing protocols for cryptographic resolutions precisely calculate recommendations while protecting the privacy of user input.
Blockchain has a decentralized structure with a peer-to-peer system. Satoshi Nakamoto introduced the blockchain system in 2008 to avoid Bitcoin’s double-spending problem and support transactions [4,43]. RS is a collaborative filtering technique used in blockchain architecture that largely derives suggestions from user data [16,29]. Better data and greater volumes are necessary for accurate and exact RS [12,19]. Businesses are currently gathering enormous amounts of user data to make product and service recommendations based on client needs, preferences, and similarities utilizing RS and related algorithms. This data type is sensitive and confidential because customer privacy is ignored [13,22]. As companies attempt to address these concerns through risk mitigation strategies, they need help keeping encryption secure [58].
To fill this gap, RS relies primarily on secure blockchain-based multiparty computing [36,51]. Outlook allows companies to apply recommendation algorithms without disclosing personal information [51]. The expected benefits of such a system are to reduce fraud and misuse of customers’ personal data and to make customers more willing to share information with businesses. More recently, Sharmila et al. proposed a layered hybrid chain with intelligent border agents for a continuous surveillance and health advisory system [39]. Yadhav et al., presented a security analysis of a smart contract-based rating and review system for the risk status of a blockchain-based best practice [50].
Several studies have used Blockchain for movie recommendation systems. Ye and Kashef used trust-based collaborative filtering for a movie recommendation system [52]. In another study, Zhang et al. proposed a personalized real-time movie recommendation system that solves the system scalability problem [53]. Recently, Vinay et al. recommended a machine learning-based recommender system for movie reviews using a KNN classifier [47]. Although the above studies are noteworthy when using blockchain methods for movie recommendation systems, scalability, usability, and security issues still exist. Therefore, this study uses a public blockchain method, such as a smart contract (Ethereum), that allows anyone to verify transactions and participate in the consensus process [3,30,41].
The research uses blockchain-based techniques to give users ownership of their private data, e.g., their likes and dislikes, browsing history, personal information, and demographic data. The proprietary right of multiple individual organizations over users’ private data makes it difficult for the users to know how their data is being used and with whom their data is being shared. The research aims to give users ownership of their data, inform them how it is used, and decide the parties they wish to share it with.
Recommender system using blockchain
Blockchain based collaborative filtering RS implementation
All transactions on the decentralized network known as Blockchain take place between peers. By integrating blockchain technology with RS, consumers can accept recommendations without a central authority’s approval. The collaborative filtering method based on blockchains is a practical approach to actualize the RS. Assume that the rank-utility matrix R provided by users U and T serves as the algorithm’s fundamental information. To create user portraits, decompose the R matrix.
________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Collaborative system using blockchain network.
Blockchain-based collaborative filtering methods first use a collaborative filtering system to collect data and encrypt individual users’ ratings or factors (see Fig. 1). The encrypted user categories are then sent to the recommendation system, which generates a random mask for each data category. The random mask data is encrypted and returned to the collaborative network. During the next phase (matrix factorization), the collaborative network decodes the masked evaluation information and creates dimension vectors for the data. This information is again encrypted and sent back to the recommendation system. The RS encrypts the amplitude vector data and eliminates the corresponding mask vectors to get a final data estimation. Repeat the sorting process until the stopping criterion is reached.
To address the drawbacks of current recommendation systems, we develop a collaborative filter recommendation algorithm in this article that uses blockchain technology. Using collaborative filtering, recommendations are made based on matches between similar interests. The similarity matrix method is used to determine an item’s recommendation score. The closer a user’s relationship with another user, as determined by the similarity approach, the larger the impact on the recommendation score. A straightforward method of collaborative filtering is shown in Fig. 2. User P1 and User P2 rate movies according to their interests, as evidenced. A matrix of user movies is created based on this, and a comparative model is used to detect commonalities between movies and suggest them to other users [1].
Blockchain technology and a collaborative filtering technique create a movie recommendation system. The overall scheme of the projected technique is shown in Fig. 3. In this scheme, the Blockchain keeps records of transactions unrelated to governments or institutions. A blockchain’s peer-to-peer architecture acts as a distributed ledger for all transactions. Members can utilize this knowledge to support dealings or proposals without a chief certification authority (CA). In a collaborative recommender system, Blockchain is used to perform computations in the recommender system without exposing any inputs.

Collaborative filtering method example.
We use the Flask microframework to create termination points for several blockchain technology functions and analyze data on multiple computers to produce a decentralized system. A simple blockchain-connected user interface stores data and recommends movies based on user rating information. Here, the main goal is to develop a plan which authorizes users to share and post data. Because data is stored in the Blockchain, it is unassailable and everlasting. It permits users to use an APP via a simple website interface and obtain movie recommendations.
A simulated RS video is created in the planned research using a machine learning technique. After that, RS – related privacy issues are solved by a simple Ethereum-based blockchain. A decentralized network is created using Flask microframework, which interacts with Blockchain to store information and give proper endorsements based on user assessments for an agreed movie title.
The main aim is to form a system where users can share data through publishing. Data is kept on the Blockchain, so it is permanent and unassailable. Users use the app via a simple interface (web) and obtain recommended movies. Initially, we decided to store our data structures on the Blockchain. Herein, three main essentials identify messages sent by all users of the application:
Author,
Content, and
Timestamp.
In the next section, we describe a proof-of-concept of our proposed method.
A complete process of collecting relevant information and an algorithmic approach for the recommendation system is shown in Fig. 4.

Blockchain for movie recommendation system. Here, the users recommend the movies, node servers perform dual communication (input/output) and communicate with Blockchain network. Blockchain is used to perform computations in the recommender system using decentralized system without exposing any inputs.

Demonstration of proof-of-work algorithm method used in movie recommendation system. The whole process is computed in 5 steps (explained detail in the paper) which include: i) User movie input, ii) user inputs connect to the node server, iii) movielens database interaction, iv) new blocks addition to blockchain and v) movie recommendation.
The adjacency matrix of the user similarity index
M-Movie – represents number of movies that users watch
In this process, we collect movie information. We collect the movie data, including movie title, genre, production year, users’ average rating, and watch times.
In the process, the host server secures recommended movie information. As seen in thread 1, the proof-of-work blockchain agreement mechanism mathematically describes guessing the movie from the user attribute.
We create an experiment and test movie data using the Movielens database. The similarity between movies is computed using experimental data. Movie similarity is calculated using a “cosine similarity measurement algorithm.” A user-friendly contiguity matrix is generated after this procedure (Refer to Table 1).
The consensus mechanism works. Also, when movie recommendation results are received, they are sent to other nodes. Hence, for each Blockchain, a new block is added.
In this process, the best movies are recommended by collaborative filtering. The best movies are recommended by computing adjacency matrix correlations between movies. The scheme utilises data about past relationships between users and movies in a collaborative filtering scheme. So, the input to the collaborative filtering system depends on historical data of the movies they watched. For example (Fig. 5), if User 2 explores M2, M3, and M4 and User 1 explores M1, M2, M3, and M4, we recommend M2 and M3 for the same User 2. Both movies cost money. They have similar characteristics. Otherwise, the properties are not considered identical to each other. The movies are classified using the adjacency matrix according to the proof-of-work method. When this process is complete, multiple groups of videos can be displayed. After locating the group of movies, we need to find the movie that most closely resembles a new movie.
In this process, the personalized movie input data and the movie information of each data set are compared, and the similarity index between them is computed using the “cosine similarity method.” Here, we count the number of slices after comparison and close the process. The group chooses the total number of movies in a group, with the most 1 being the most shared group for each movie. Finally, the top 10 movies from the list are recommended to the user. Users can also select a movie to watch from their recommended movies.
We describe the proposed movielens algorithm (pseudo code) here:
Input: movie_training.csv
Output: Movie recommendation
Generate block of movie data
For each block (hash 256), add fingerprint
Link each block
Include information collection block
Initialize movie array, consensus
For i=1 for movie array do
For movie array j=1 do {
start movie node
For m=2 to 800
as movie matrix[i,m] == moviematrix[j,m]
movie_node_a[m] =1
else
movie_node_a[m] = 0
end
end
end
Form Interfaces for every movie
Check Result

The planned movie recommendation scheme using collaborative filtering (example).
The proposed approach describes a mathematically relevant algorithmic roadmap for movie recommendation. We experimented with this technique to find a good fit with the film. As part of this work, a set of the most suitable films was developed, and recommendations for these tests were calculated. First, we test using a list of at least 20 movies compared to a dataset containing randomly selected movies from different movie attributes. In this case, when m = 0, 800 films are recommended to the user. The number of movies rated 3.5 is used to create a path that divides the movies in the original dataset into groups of 7, 8.7, and 10 in random order. We also designed another test on the same dataset, where movies were randomly assigned with different characteristics and rated at least 10, 20, and 50 movies consecutively. It then recommends movies to the user by sequentially noting the number of movies as 3, 5, 7, 8, 7, and 10. Calculate the accuracy rate, run 150 times, and take the average as the accuracy rate value.
The proposed movie recommender system is rated using the accuracy of the forecasting technique. The Mean Absolute Error Percentage (MAPE) is used to evaluate the proposed approach [2,40,42].
Equation (1) represents the forecast and actual values as

Flowchart of the Blockchain-based movielens recommender system.
The flowchart of the planned technique is shown in Fig. 6 and explained in the following sections. The proposed movielens recommender system was developed using Python 3.8.10, Flask 1.1.4 and Werkzeug 1.0.1 on windows 10 operating system. Werkzeug is a collection of libraries that you can use to build Web Server Gateway Interface (WSGI) compliant web applications in Python.
Store connections into blocks
We stored information on the Blockchain in the popular JSON format. Messages stored on the Blockchain include:
“{
“writer”: “writer name/information”,
“data”: “Data the writer wishes to share”,
“timestamp”: “Time of creation of the content
}”
The common phrase “data” is often replaced on the Internet by the term “transaction.” Therefore, to avoid confusion and for consistency, “transactions” refer to the data placed in the sample application. Transactions are reduced hooked on blocks. A block can comprise more than one transaction. Blocks containing contracts are usually created and added to the Blockchain. Each block must have a unique ID since there can be multiple blocks, as shown below:
Class block implementation
Class block:
Initialization, index, transaction, and timestamp. Assembly constructor for ‘Block’ class. Determine the unique identifier of the block. Add transaction list Roadblock creation time Check indexes, transactions, and timestamps
Blockchain includes digital information
We used the power of cryptographic hashing to detect forged data in blocks. “A hash function is a job that receipts information of any length and harvests a fixed-size data (called a hash) used to identify the input.” Features of a perfect hash function include:
Easy to calculate.
Deterministic, meaning the hash will represent the same data always.
Data should be random and uniformly distributed, meaning that even a
Single bits change in data should significantly change the hash.
Consequently, it is impossible to presume the contributed data specified to the hash.
If the input and the hash are known, the input can be passed through a hash function to authenticate the delivered hash. This irregularity between the amount of work required to compute the hash of the input (easy) and the effort needed to compute the hash of the input is what blockchains use to achieve the chosen properties
From the hash library, import sha256 and json Set the computed block (hash informaton) Proceeds the hash block, initially converted to a JSON string. Encode block chain sha 256.
Block hash initialisation
We have stored the block hash in an area of the block object, which acts as a digital fingerprint (or signature) of the data it contains. In most cryptocurrencies, individual transactions are stored in a block and hashed in an arrangement of Merkle trees (we can also call them hash trees). The block hash is also called the root of the tree. Blockchain is unnecessary for the job, so I didn’t mention it to keep it short and simple.
Chain the blocks
The next step is to install the blocks. A blockchain is a set of blocks. You can store all chunks in Python (like an array). However, this process alone is not enough. What happens if someone deliberately changes an old block in a group with a new one? In the current implementation, it is not a problem to create a new block containing the modified transactions, calculate the hash, and replace it with the old block.
We require a technique that ensures modifications to earlier blocks will invalidate the entire chain. By fusing subsequent blocks’ hashes with the prior block’s, Bitcoin establishes dependencies. Chaining entails writing the previous hash from the block into the current block’s new previous hash field. What happens to the first block if each block includes a hash prior field connecting it to the previous block? The genesis block is the first and can be made manually or using some logic. Building our initial blockchain composition is as simple as adding the previous_hash to our new block (see Listing 1).
When the previous block’s content changes, the last block’s hash also changes. This causes a disparity with the former hash in the following block. When the input to calculate the hash function for a particular block includes the previous_hash field, the hash value for the next block is also changed. Eventually, the entire string following the replacement block becomes invalid, and the only way to fix this is to recompute the whole string.
Proof of work algorithm
Any changes to the previous block can quickly recalculate the next block’s hash and create another valid blockchain. To avoid this, we use the asymmetry of hash functions discussed earlier to compute complex random hashes. That’s it. It adds
Add the previous block (hash) to chain to which this block belongs. Check the index, transaction, timestamp, and information about the previous hash. Calculate_hash(self) definition – First converts block instance hash to JSON string and returns it. Define Block_string. # Equivalent strings now respect the previous_hash field as well. Return Define the blockchain class. Define and create a genesis block. Ability to create genesis blocks and add them to the chain. Block’s index is zero, previous hash is zero, a valid block. Determine and calculate hash and add Genesis_block. Define last_block. This is a fast pythonic way to obtain the last block of a chain. A chain always contains at least one block of data (i.e. the genesis block). Get sha256, json and time parameters from hashlib. Block definition and class initialization ‘Block’ class constructor, unique block identifier Add transaction list and remember block creation time.
Block hash implementation
some restrictions as an alternative to accepting (block) hashes. Let’s include a constraint that the hash must start with a leading zero. “The value of n here can be any positive value, and n can be any integer (positive number).”
We know that the hash value only changes when the data in
Define proof_of_work(self, block): A function that attempts diverse principles of the nonce to have has informaiton that meets the different criterion. Set block.nonce = 0 Calculate blockchain difficulty Calculate block.nonce and return computed_hash function
Block nonce calculation
the block changes. We do not intend to alter the current information. That is why we add dummy data that can be edited. So, we introduced new data in the block named “nonce.” The nonce is the number to modify until a hash satisfying the constraint is obtained. A random number that meets the constraints proves that a particular calculation was performed. A zero limit specifies the “complexity” and consistency of the verification algorithm. Proof of work is also problematic to compute due to asymmetry but is easy to verify once the nonce has been identified (requiring a restart of the hash function).
We can confirm that there is no reason to determine the nonce swiftly. However, it is just automatic strength. The only improvement we could provide is hardware changes projected to calculate hash functions with fewer CPU instructions.
Include Blockchain
Adding a block to the chain requires ensuring that the information has not been altered, i.e., the proof-of-concept given is accurate and the transaction order is preserved, i.e., the added block’s preceding_hash arena checks to its hash. This is the final block in the chain. Now, we can investigate the code below:
“Blockchain class:
Continuation of the previous code.
1) Add_block(self, block, proof) definition:
A function to add a block to the chain after authentication.
Validation consists of:
* Validation of credentials.
* The preceding_hash assigned to the block is the same as the last block hash assigned to the chain.
return False
if not Blockchain.is_valid_proof (block, proof):
return False”
“2) preceding-hash = self.final-block.hash
Definition if preceding-hash!=
block. preceding-hash:
returns Incorrect
if not a blockchain.
is_legal-proof(block, proof):
return Incorrect”
“3) set block.hash = proof
self.chain.add(block)
return Correct
definition is_valid_proof
(self, block, block_hash)
4) check if block_hash is valid it is a block hash that meets the
complexity criterion.
""" returns
(block_hash.
startwith(‘0’ * Blockchain.difficulty) è
block_hash == block.compute_hash())” Block hash – Blockchain connection
Data mining
Initially, operations are deposited as a pool of uncommitted contracts. Block mining is placing unconfirmed transactions into blocks and computing proof of work. If the nonce satisfies the constraints, we can confirm that the block was mined and uploaded to the chain. In most cryptocurrencies (including Bitcoin), miners can be paid in certain cryptocurrencies in exchange for using their computing power for proof-of-work payments.
Generate interfaces
We establish interfaces for the blockchain nodes to intermingle with the applications we intend to build. We used a famous Flask, a Python network, to set up a “REST API” to run and interact with numerous procedures on blockchain nodes. Applications require endpoints to send new transactions and are used by applications to include novel information (messages) to the Blockchain. Here is the endpoint for returning a replica of the chain nodes. Our method uses this endpoint to request all information to be displayed. A termination point that asks the node to mine unsubstantiated operations (if any): Use this to run mining commands from the application itself. These REST endpoints could be utilized with the Blockchain by creating and retrieving some transactions.
Establish consensus and decentralization
Our blockchain implementation is designed to use minimum computer hardware space and hence can run on a single computer. Even if you associate a block with a hash and apply sanity check restrictions, you still cannot trust a single entity (a single system in this case). Deployments require data. Multiple nodes are required to maintain a blockchain. In this way, other peers in the network are notified of the transition from one node to the new one.
In a peer-to-peer network, first, we produce a device that allows new nodes to register with present nodes by calling the register_with_existing_node method. This helps to:
Ask the isolated node to augment the innovative peer to its list of acknowledged peers
Initialize the new node’s Blockchain with the remote node’s Blockchain
If a node leaves the network, resynchronize the Blockchain with the network
If a node goes off–the grid, it is essential to resync the Blockchain with the network.
However, multiple nodes can experience issues due to intentional actions or unintended details such as network latency. In this case, the nodes must agree on a specific string form to maintain the whole schema’s authenticity. This means that we must reach a “consensus.” When the strings of participating nodes in the network seem to differ, a simple agreement procedure can agree on the longest valid string. The logic behind this technique is that the longest chain reasonably estimates most of the work done.
Now, we need to find a way for all nodes to tell the network that Block A exists. Anyone can then update the blockchain and mine other transactions. Other nodes can verify proof of work and add mined blocks to the chain. The announce_new_block method should be called after a node has fetched each block so that peers can add the block to the chain.
Integrate the recommendation code in the Blockchain
Now that the blockchain server is configured. The next step is to begin operating on the API. We use Jinja2 templates to execute our web pages and some CSS to make everything appear suitable. We need to connect our application nodes in the blockchain network to receive and transmit new information. There can be several nodes of this type.
“import date and time, import json and import request from jar import render_template, redirect, request, from application import application # Blockchain network the application will contact to retrieve and append data Node of #. LINKED_NODE_ADDRESS = "http://127.0.0.1:8000" Message = []”
Integrate recommendation code – Blockchain
Build the application
After running all the previous functions, run the final script in the views.py file to run the final application.
“Determine the operating system and initialize the project application. q=mp.Queue() p=mp.Process(target=foo) p.start() os.system("python3 Project.py")” “Define timestamp_to_string(epoch_time): return datetime.datetime.fromtimestamp(epoch_time).strft ime(‘%H:%M’)” “Define application route: @app.route(‘/recommend’, methods=[‘POST’]) def Recommended Movie(): return render_template(‘MR. HTML’)”
Build Blockchain connection
Implementation and case study
Evaluation of the proposed method
The Blockchain allows users to update existing models hosted by user groups or individuals by sharing information such as model parameters and new movie titles. When adding movie rating data, the reward mechanism requires confirmation. Our technique allows users to verify the system’s accurateness by submitting data. The proposed method captures the movement of each calibrated film. The model absorbs to commend suitable movies to users by computing the “similarity matrix between users.” Also, the same user cannot re-rate previously viewed movies. First, users rate movies in various genres, such as melodrama, action, drama, and comedy. The system then automatically provides user rating predictions for specific movies that have not yet been rated.
Next, we explain and evaluate the proposed method briefly. We store the Metadata for all movie recommendations in a specific file, “python_blockchain_app-master/app/metdata.csv” After running the code, we get the following HTML version (Refer to Fig. 7).

Enter the movie name in the text box: click on request to block recommended movies button.
After entering a sample movie title, the user node will be blocked by using a new tab. Then return to the first tab that displays the Recommendations page (see Fig. 8).

First tab with recommendation page.
User details can be found here by clicking the “Time Stamped User Details tab.” It is nothing more or less than a resynchronization of the Blockchain of updated information.
Run the movie recommendation code based on user preferences and recommend movies button (see Fig. 9). Here, we recommend that users use the collaborative filtering model. The complete output of the Python script is available (saved) in the file “python_blockchain_app-master/app/Output.html.”

Movie recommendation based on user preferences.
The user can get the results (Fig. 10) by clicking the “Movie Recommendations based on the user Preferences button.”

Complete result of the proposed blockchain application.
Using an actual dataset, we evaluated the performance of the proposed recommendation system. Acceptable recommendation models are based on filtering together users, items, and random data. For analysis purposes, we used the Movielens 100,000 Dataset, which contains 100,000 movie reviews from 943 users for 1,682 movies released in April 1998. Here, users have evaluated, in any case, 20 movies. The data source can be found at the following website link:
Movie RS rating example (users)
An example of the movie RS rating of the users is shown in Table 2. Similarly, an example of movie Recommendation scores is given in Table 3. Using Table 2 and Table 3, we compute the overall movie recommendations.
For example, for User 3, the overall movie recommendation is calculated based on the two table elements (Table 4).
Movie RS rating example (movies)
Movie RS rating example
Recommendation for movie watchers
Different collaborative filtering models were selected to govern the best algorithm. Here we report the outcomes of “Movielens”, collected as a blockchain launch prioritizing movies all users recommend. We included a user ID from 1 to 10, a movie ID from 1 to 200 and a rating matrix from 1 to 5. Table 5 shows the derived Blockchain showing users (highest priority) and recommended movies.
Dataset
We analyzed the widely used MovieLens dataset, which contains 1 million ratings of 3,900 movies by 6,041 users who joined MovieLens, a noncommercial movie recommendation service run by the University of Minnesota [14]. A summary of the preprocessed dataset is presented in Table 6.
Movielens 1M dataset charecteristics
Movielens 1M dataset charecteristics
We used the following measures: Hit Ratio (HR), Recall, and normalized Discount Cumulative Gain (NDCG). The HR determines whether a test item appears on the K list, whereas the NDGC assesses “hit’s position by assigning higher ratings to hist at the top. The Recall proposal is widely used in the Top K proposals. Recalls are based on the percentage of genuinely interactive items rated as K’s best [23].
We calculated the above metrics for each pair of user-tested items and reported an average score (Table 7). All the models were trained via adaptive gradient descent optimization (Adam) with learning rate = 0.001 using pyTorch in Windows operating system [18]. Some in house coding were also used using Python 3.8.10.
Comparison of the proposed method (dual-LightGCN) with other methods MovieLens-1 M dataset
Comparison of the proposed method (dual-LightGCN) with other methods MovieLens-1 M dataset
We ran tests and analyze the data to examine the individual effects of LightGCN and Dual-LightGCN. Recall@20 and Recall@10 experimental results are presented in (Fig. 11 and Fig. 12), where “w/o LG” and “w/o DLG” designate the variants that are made without LightGCN and Dual-LightGCN, respectively. Due to the removal of the Dual-LightGCN or the Dual-LightGCN, respectively, the performances of “w/o LG” and “w/o DLG” are lower than those of Dual-LightGCN. With Dual-LightGCN introduced modules, performance gains over LightGCN are noticeable. The experimental findings reveal the importance of LightGCN and Dual-LightGCN in classifying Movilens data.

Ablation study on MovieLens-1M in terms of Recall@20.

Ablation study on MovieLens-1M in terms of Recall@10.
We used the following popular classification methods for testing the accuracy of movielens data set, which include:
We randomly select 80% of users who have associated rating sequences for training, 10% for validation, and 10% for testing for classification data so that the item dependencies within each session can be learned (ratio of 8:1:1). Using AUC (Area Under Curve) and Group AUC (GAUC), a metric that can gauge the performance of the classification algorithm, we assessed the classification performance of the results. However, since AUC does not treat different users differently, this may lower the overall group output. As a result, we adopted the GAUC (average of AUC of all users) method suggested by Gai et al. of Alibaba [57] to evaluate the model. The results presented in Table 8 show that MiFiNN method is superior to the classification of the MovieLens 1-M dataset compared to the other methods.
Comparison of the classification of MovieLens-1 M dataset
Comparison of the classification of MovieLens-1 M dataset
An accurate and precise recommender system has higher requirements for data, quality, and quantity. Therefore, these companies collect a large amount of user data to use recommendation systems and related algorithms to recommend products and services based on users’ needs, preferences, and preferences. Unfortunately, privacy concerns prevent users from distributing large amounts of data to companies they care about, even as their praise value increases. The Abovementioned issues have been addressed through security solutions, such as using blockchain technology for privacy-related statements.
Blockchain is part of distributed networks. The fusion of IoT and blockchain technology has created a contemporary distributed system. The integration guarantees the security and scalability of the recommender system. Combining the recommendation system and blockchain technology makes online activities safer and more private. Blockchain can consider RS’s characteristics, including transparency of transactions or recommendation models, the immutability of associated blocks, and traceability of non-repudiation. It can also provide smart contracts capable of automatically executing business logic via node consensus.
In this study, we proposed a simple blockchain movie recommendation system. Our research provides a detailed understanding of RS’s Blockchain-related privacy resolutions and insight into present applications in various fields. The proposed technique is being assessed and tested by some users, and the results show that the proposed system protects MS privacy effectively. We conducted experiments on Movielens datasets and compared them with other algorithms. The case study included a smart contract model that recommends movies to buyers. Initially, we tested the model on a small “movielens dataset” and extended it to a 3M movielens dataset. We developed a classifier model for movielens and proposed a Dual light graph convolutional network for movielens data classification. According to our experimental findings, Dual-LightGCN achieves the best recommendation performance. The ablation study demonstrates the innovation of the Dual-LightGCN method in the multimodal fusion field. We also classified movielens dataset using five standard classification methods and found that MiFinn method outperformed both AUC and GAUC methods compared to similar methods.
We intend to explore the application of different recommendation algorithms with other innovative contract platforms. Future work includes improving the proposed project-based collaboration scheme and integrating procedure-related explainable recommender systems with blockchain analytics.
