Lightweight and trusted chain-up method for videos and related information based on optimized consensus algorithm

By combining distributed blockchain storage and IPFS technology with the optimized consensus algorithm PBFT+, the problems of insufficient storage capacity and low consensus efficiency in the process of uploading videos and related information to the chain are solved, and fast, secure video data storage and efficient consensus are achieved.

CN116614519BActive Publication Date: 2025-10-14JINAN UNIVERSITY
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310583642.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-23
Publication Date
2025-10-14
Estimated Expiration
2043-05-23

AI Technical Summary

Technical Problem

Existing blockchain technology has problems such as insufficient storage capacity, high redundancy, low efficiency, high consensus latency, and low throughput when uploading videos and related information to the chain. Especially in scenarios with multiple nodes involved, the traditional PBFT consensus protocol is susceptible to interference from malicious nodes, affecting the system's operating efficiency.

Method used

A distributed blockchain storage mechanism combined with IPFS technology is used to upload video files and their related attribute information to the decentralized distributed file system IPFS. Only the hash summary and addressing CID of the video file are uploaded to the chain. Through the optimized consensus algorithm PBFT+, the node role type and confidence evaluation mechanism are designed to optimize the consensus process, elect high-confidence nodes as master nodes, reduce the number of consensus broadcasts, and improve consensus efficiency.

Benefits of technology

It achieves fast downloading, safe and reliable storage of videos and related information, defends against DDOS attacks, optimizes storage space, reduces consensus latency, and improves consensus efficiency and data integrity verification.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116614519B_ABST
    Figure CN116614519B_ABST
Patent Text Reader

Abstract

The application discloses a video and related information lightweight credible on-chain method based on an optimized consensus algorithm, and the method comprises the following steps: serializing a video and related attribute information into a JSON document, calculating the Hash of the video and related information by using a Hash algorithm to obtain a content digest, uploading the JSON document to an IPFS to generate a content address, taking the content digest and the content address as a blockchain transaction, verifying the blockchain transaction by each node in the blockchain, performing consensus, and on-chaining by using a smart contract, determining a node role type, constructing a confidence evaluation mechanism, periodically updating the confidence according to the reward and punishment mechanism of the consensus behavior of the node, constructing a node election algorithm, storing the transaction after the consensus by each node in the blockchain into the account book of the node, and completing the lightweight information credible on-chain process. The application optimizes the storage space, reduces the broadcast times in the consensus protocol, and improves the consensus efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data trusted on-chain, and particularly relates to a video and related information lightweight trusted on-chain method based on an optimized consensus algorithm. BACKGROUND

[0002] In the case that most nodes are honest, the blockchain can establish reliable contact between non-trusted individuals in a complex distributed network, support global joint decision-making, and at the same time protect individual rights. The blockchain technology has the following core features: 1) Decentralization: the operation of the blockchain system does not rely on third-party institutions, and nodes achieve safe verification, transmission and management of data through a consensus algorithm. 2) Non-tamperable: the chain-like data structure of the blockchain ensures that the on-chain data is non-tamperable and non-forgery through cryptography. Once the block is verified, it will be permanently stored. 3) Open and transparent: the data of the blockchain is completely open, anyone can query information, send transactions and participate in consensus through the blockchain, and the entire system is highly transparent. 4) Traceability: the blockchain is a distributed ledger that records the input and output of each transaction in chronological order, so that the transaction activity can be traced.

[0003] Video data has become a widely used data type in modern society due to its large amount of information, intuitive visualization, multi-dimensional and real-time interactivity, etc. Important video data includes public security monitoring, traffic monitoring, industrial monitoring, important online meetings, remote education, medical consultation data, etc. These videos often need to be stored in a trusted manner to prevent loss and tampering. The blockchain technology is very suitable for storing data that needs to be tamper-proof and loss-proof due to its non-tamperable and traceable characteristics, but it will encounter problems of high redundancy, low efficiency and insufficient storage capacity. At present, the trusted on-chain process of video and related information involves many links, and the scale of data to be on-chained is very large. Due to the storage capacity limitation of the blockchain itself, it is difficult to meet the needs of actual scenarios, and complex and fast queries are not supported.

[0004] The traditional PBFT (Practical Byzantine Fault Tolerance) consensus protocol, at its core, consists of three main protocols: the Consistency Protocol, the ViewChange Protocol, and the Checkpoint Protocol. Cryptographically, these protocols ensure that message transmission is tamper-proof and forge-proof. PBFT addresses the Byzantine Generals' Problem and can tolerate a maximum of one-third of abnormal nodes. Consequently, PBFT is widely used in consortium blockchains, particularly in government and enterprise settings. However, when it comes to uploading large amounts of video and related information to the blockchain, PBFT suffers from high communication overhead, high consensus latency, and low throughput. In particular, PBFT's masternode election algorithm, which simply selects nodes in order of node number, is arbitrary and predictable, making it possible for malicious masternodes to disrupt consensus and impact system efficiency. Summary of the Invention

[0005] In order to overcome the defects and shortcomings of the existing technology, the present invention provides a lightweight and trusted chain-up method for videos and related information based on an optimized consensus algorithm. The present invention uploads the summary attributes, related data materials, sources and other information of video files to the chain through a distributed blockchain storage mechanism, and uses IPFS technology to solve the storage bottleneck. The video file and the text, pictures, audio and video attributes related to the file are uploaded to the decentralized distributed file system IPFS. Only the Hash summary of the video file and related attributes and the addressing address CID of the file stored in the IPFS are uploaded to the chain. Because it no longer relies on the main network and centralized server, the storage space is optimized, the download speed is fast, the data can be stored continuously and safely and reliably, and it is naturally defensive against DDOS (distributed denial of service attack) attacks. In addition, due to the decentralization and non-tamperability of blockchain and IPFS, the blockchain stores the file data corresponding to the IPFS address, and the integrity is automatically verified.

[0006] The second object of the present invention is to provide a lightweight and trusted on-chain system for videos and related information based on an optimized consensus algorithm;

[0007] A third object of the present invention is to provide a computer-readable storage medium;

[0008] A fourth object of the present invention is to provide a computer device.

[0009] In order to achieve the above object, the present invention adopts the following technical solutions:

[0010] A lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm includes the following steps:

[0011] The video and related attribute information are serialized into a JSON document, the JSON document is calculated by a Hash algorithm to obtain a content summary Hash, and the JSON document is uploaded to the IPFS to generate a content addressing CID;

[0012] The content summary Hash and the content addressing CID are stored in the blockchain through a smart contract, and the content summary Hash and the content addressing CID are used as a block chain transaction, verified by each node in the block chain, consensus is reached, and the chain is completed;

[0013] Determine the node role type, which includes normal nodes, priority nodes, candidate nodes and master nodes, the normal nodes are server nodes required to install the software and hardware of the block chain system, the priority nodes are alliance chain nodes, used to implement the consensus step, the candidate nodes are used to confirm the consensus result, the candidate nodes are also priority nodes and participate in the consensus step, the master node is used to host the consensus process, and the master node is also a candidate node and a priority node, participating in the consensus and confirming the consensus step;

[0014] Build a confidence evaluation mechanism, whenever a content summary Hash and a content addressing CID are successfully chained as a transaction, the reward and punishment mechanism is executed according to the consensus behavior of the node to update the confidence periodically;

[0015] Build a node election algorithm, multiple consensus rounds are used as an election cycle, and a master node performs a video and related information lightweight block in each cycle, the master node broadcasts an evaluation message at the end of the current cycle to generate an evaluation block, and the confidence of each node is updated through the evaluation block, if the master node fails to perform a block, the current cycle is ended, the subsequent consensus blocks are discarded, and the evaluation block is generated by the node with the highest credibility in the candidate node set;

[0016] The priority node broadcasts a submission message to the candidate node after verifying that the preparation message is valid, and discards the message if the verification is invalid, and broadcasts the submission message to all nodes;

[0017] After reaching a consensus, each node in the block chain stores the consensus transaction in its own ledger, completing the lightweight information trusted chain process.

[0018] As a preferred technical solution, the confidence is updated periodically according to the reward and punishment mechanism of the node consensus behavior, and the specific steps include:

[0019] In the consensus phase, the priority node gives up the consensus confidence, the correct consensus confidence is +1, and the error consensus confidence is -1;

[0020] In the consensus result confirmation phase, the candidate node gives up the confirmation and the confidence level remains unchanged. The confidence level of a correct confirmation is +1, and the confidence level of an incorrect confirmation is -1.

[0021] During the block generation phase, the master node’s confidence level for successful block generation is +1. If it is doubted and successfully overturned by other nodes, the master node’s confidence level is -α, where the penalty score α is greater than 1.

[0022] As a preferred technical solution, a node election algorithm is constructed, including: a priority node election algorithm, a candidate node election algorithm, and a master node election algorithm;

[0023] The priority node election algorithm is used for the common node set U n Sort by confidence, specifically expressed as: priority node set Among them, β is the balance coefficient;

[0024] The candidate node election algorithm is: select the candidate node from the sorted priority node set U p Before reselection| c | nodes with high confidence enter the candidate node set U c ;

[0025] The master node election algorithm is: use a random algorithm to select the candidate nodes from the set U c Elect the master node.

[0026] As a preferred technical solution, the evaluation block includes an evaluation block header and a block body. The evaluation block header records the version number, the previous block hash and the timestamp, and the block body records the public keys and reputation changes of the priority node, candidate node and master node.

[0027] As the preferred technical solution, the specific steps of consensus include:

[0028] The master node is successfully elected, consensus is initiated, and a lightweight on-chain request message for the video and related information is received. If the verification is valid, a pre-prepared message is broadcast to all priority nodes. If the verification is invalid, the on-chain request message is discarded.

[0029] The priority node receives the pre-prepare message from the master node within the preset time. If the verification is valid and the node agrees, it broadcasts the pre-prepare message to the other priority nodes. If the verification is invalid, the pre-prepare message is discarded.

[0030] The priority node receives a prepare message from a node whose confidence level exceeds a first threshold within a preset time. If the verification is valid and the candidate node agrees, the priority node broadcasts a confirmation message to the candidate node. If the verification is invalid, the priority node discards the prepare message.

[0031] If the priority node detects that the master node has failed, it discards the message, starts the view switching protocol, and re-elects the master node;

[0032] The candidate node receives a confirmation message from a node whose confidence level exceeds a set first threshold within a preset time, verifies the message is valid, and agrees to execute the lightweight upload request message for the video and related information, and responds to the client after successful execution;

[0033] When the client receives the same reply message from different candidate nodes whose sum of confidence exceeds the set second threshold, the consensus is successful, the master node generates a normal block, and at the same time determines whether it has reached the next cycle. If it has reached the next cycle, it generates an evaluation block and updates the node confidence based on the evaluation block; otherwise, it continues to the next round of consensus in the current cycle.

[0034] As a preferred technical solution, the consensus nodes are limited to the priority nodes within the set confidence range, the consensus conditions are changed based on the confidence, and the cumulative confidence of the nodes is recorded as V s , the nodes whose confidence sum exceeds the first threshold are set as the nodes whose confidence sum exceeds The sum of the confidences of the different candidate nodes exceeds the second threshold, which is set as the sum of the confidences exceeding different candidate nodes.

[0035] As a preferred technical solution, a data verification step is also included, specifically including:

[0036] Use the content summary Hash of the query result to compare with the content summary Hash of the on-chain result. If the content is inconsistent, it is determined that the local database has been tampered with. Use the content addressing CID to query IPFS, retrieve the original information from the distributed storage content, and achieve trusted on-chain through data trust recognition.

[0037] In order to achieve the above second purpose, the present invention adopts the following technical solutions:

[0038] A lightweight and trusted on-chain system for videos and related information based on an optimized consensus algorithm, including: a serialization module, a content summary construction module, a content addressing construction module, an on-chain module, a node role type determination module, a confidence evaluation mechanism construction module, a node election algorithm construction module, an evaluation block generation module, a message verification module, and a storage module;

[0039] The serialization module is used to serialize the video and related attribute information into a JSON document;

[0040] The content summary building module is used to calculate the Hash of the video and related information using the Hash algorithm of the JSON document to obtain the content summary Hash;

[0041] The content addressing construction module is used to upload the JSON document to IPFS to generate a content addressing CID;

[0042] The on-chain module is used to store the content summary Hash and content address CID on the chain through a smart contract. The content summary Hash and content address CID are treated as blockchain transactions and verified by each node in the blockchain to reach consensus and complete the on-chain.

[0043] The node role type determination module is used to determine the node role type, which includes ordinary nodes, priority nodes, candidate nodes and master nodes. The ordinary nodes are server nodes that install the software and hardware required for the blockchain system. The priority nodes are alliance chain nodes used to implement the consensus step. The candidate nodes are used to confirm the consensus results. The candidate nodes are also priority nodes and participate in the consensus step. The master node is used to preside over the consensus process. The master node is both a candidate node and a priority node and participates in the consensus and confirmation steps.

[0044] The confidence evaluation mechanism construction module is used to build a confidence evaluation mechanism. Whenever a content summary hash and content addressing CID are successfully uploaded to the chain as a transaction, the confidence is regularly updated by executing a reward and punishment mechanism based on the consensus behavior of the node.

[0045] The node election algorithm construction module is used to construct a node election algorithm;

[0046] The evaluation block generation module is used to treat multiple consensus rounds as an election cycle. In each cycle, the same master node executes the block generation of lightweight blocks of video and related information. At the end of the current cycle, the master node broadcasts the evaluation message to the entire network, generates an evaluation block, and updates the confidence of each node through the evaluation block. If the master node fails to generate a block, the current cycle ends, the subsequent consensus blocks are discarded, and the node with the highest reputation in the candidate node set generates the evaluation block;

[0047] The message verification module is used to verify the message. After the priority node verifies that the preparation message is valid, the submission message is broadcast to the candidate node. If the verification is invalid, the message is discarded and the submission message is broadcast to all nodes.

[0048] The storage module is used to store consensus transactions. Each node in the blockchain stores the consensus transactions in its own account book, completing the lightweight information trusted chain process.

[0049] In order to achieve the third purpose above, the present invention adopts the following technical solutions:

[0050] A computer-readable storage medium stores a program that, when executed by a processor, implements the above-mentioned lightweight and trusted method for uploading videos and related information to a chain based on an optimized consensus algorithm.

[0051] In order to achieve the fourth purpose above, the present invention adopts the following technical solutions:

[0052] A computer device includes a processor and a memory for storing a program executable by the processor. When the processor executes the program stored in the memory, the method for lightweight and trusted on-chaining of videos and related information based on the optimized consensus algorithm is implemented.

[0053] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0054] (1) The present invention uploads the summary attributes, related data materials, sources and other information of the video file to the chain through a distributed blockchain storage mechanism, and uses IPFS technology to solve the storage bottleneck. The video file and the text, picture, audio and video attributes related to the file are uploaded to the decentralized distributed file system IPFS. Only the Hash summary of the video file and related attributes and the addressing address CID of the file stored in IPFS are uploaded to the chain. Because it no longer relies on the main network and centralized server, the storage space is optimized, the download speed is fast, the data can be stored continuously and safely and reliably, and it is naturally defensive against DDOS (distributed denial of service attack). In addition, due to the decentralization and non-tamperability of blockchain and IPFS, the integrity of the file data corresponding to the IPFS address stored in the blockchain is automatically verified.

[0055] (2) The present invention proposes an optimization scheme for the PBFT consensus algorithm, called the confidence-based optimized consensus algorithm PBFT+, which is used to improve the node consensus speed in the process of lightweight trusted on-chaining of videos and related information; the optimized consensus algorithm PBFT+ designs node role types, a confidence evaluation mechanism for node behavior, and an election algorithm for node switching roles, sets the entry threshold for nodes to participate in the consensus, and uses a random method to elect the master node from the candidate node set. The optimized consensus algorithm PBFT+ tends to select nodes with high confidence as master nodes, and the election of master nodes is unpredictable, which reduces the probability of abnormal nodes participating in the consensus and improves the consensus efficiency;

[0056] Specifically, the optimized consensus algorithm PBFT+ optimizes the consensus process, using multiple consensus rounds as an election cycle to avoid frequent switching of master nodes. It also changes the consensus condition in PBFT - the number of nodes reaching consensus must exceed 2 / 3 - to the sum of the confidence levels of the nodes reaching consensus exceeding 2 / 3 of the total number, reducing the number of broadcasts in the consensus protocol and lowering the consensus latency. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] Figure 1 This is a flow chart of the lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm.

[0058] Figure 2 This is a schematic diagram of the PBFT+ node role state machine of the present invention;

[0059] Figure 3 Schematic diagram of the PBFT+ consensus cycle of the present invention;

[0060] Figure 4 This is a schematic diagram of the PBFT+ evaluation block data structure of the present invention;

[0061] Figure 5 Schematic diagram of node broadcast communication (including consensus conditions and broadcast times) in the PBFT+ algorithm of the present invention;

[0062] Figure 6 This is a schematic diagram of the PBFT+ algorithm process of the present invention;

[0063] Figure 7 Flowchart of the trusted verification steps of the present invention. DETAILED DESCRIPTION

[0064] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.

[0065] Example 1

[0066] like Figure 1 As shown, this embodiment provides a lightweight trusted chain-up method for video and related information based on an optimized consensus algorithm, which mainly includes lightweight trusted chain-up of video and related information, an optimized consensus algorithm PBFT+ based on confidence, and data trusted authentication. The blockchain adopted is a consortium chain. This method can effectively make up for the shortcomings of blockchain in storage by combining blockchain with IPFS. The optimized consensus algorithm based on confidence is used to improve the consensus efficiency and speed when data is on the chain. The blockchain technology and the InterPlanetary File System (IPFS) technology are combined to complete the lightweight trusted chain-up of video and related information, and realize the trusted storage and authentication of video data. Among them, the InterPlanetary File System (IPFS) is based on content addressing compared to the HTTP protocol based on location addressing. IPFS is a distributed storage technology. The bottom layer will shard the file, calculate the hash value, and construct a directed acyclic graph. The root node is the storage address of the file in IPFS, that is, CID, content addressing ID.

[0067] The specific steps include:

[0068] First, the video and related attribute information are serialized into a JSON document. The JSON document uses a hash algorithm (such as the national secret summary algorithm SM3) to calculate the hash (i.e., content summary) of the video and related information. The JSON document is uploaded to IPFS to generate a content-addressable CID (Content-ID), and the hash and CID are stored on the chain through a smart contract.

[0069] This embodiment uses a lightweight and trusted on-chain method for uploading videos and related information, achieving lightweight on-chain upload of only the content summary of the video and related information and the IPFS addressing ID. Data on-chain refers to the process of encrypting and uploading user data to an IPFS-based public network sidechain and forming a data index on the public trust chain. Once the data is on-chain, no individual or organization can access the user data except for the user's own Data_key authorized decryption, thus ensuring absolute data security.

[0070] Next, the lightweight information (the hash of the video and related information, along with its CID on IPFS) is treated as a blockchain transaction, verified by each blockchain node, and finally uploaded to the blockchain. All nodes in the blockchain reach consensus through a consensus algorithm, preventing disagreements and double-spending within the network, and then add new transactions that have passed consensus to the blockchain.

[0071] In this embodiment, the confidence-based optimized consensus algorithm PBFT+ optimizes the consensus process in the on-chain step. The main modifications of PBFT+ to PBFT include the following:

[0072] 1) Design node role types. Different roles have different responsibilities in the alliance chain, such as Figure 2 As shown, the status of the role is changed, and the nodes in the entire network are divided into:

[0073] a. Ordinary node: A server node that has the software and hardware required by the blockchain system installed. Ordinary nodes require administrator approval before joining the consortium chain.

[0074] b. Priority nodes: Alliance chain nodes, participating in elections and responsible for consensus;

[0075] c. Candidate nodes: Candidate nodes have a higher confidence level and are responsible for confirming the consensus results. Candidate nodes are also priority nodes and are also responsible for consensus.

[0076] d. Master Node: presides over the consensus process, coordinates and manages communication and interaction between nodes, and collects voting information from each node. The master node is also a candidate node and a priority node, participating in and confirming consensus;

[0077] 2) Build a confidence evaluation mechanism. Whenever a video and related lightweight information (i.e., content summary hash and content addressing CID) are successfully uploaded to the chain as a transaction, a reward and punishment mechanism is implemented based on the consensus behavior of the node, and the confidence is updated regularly.

[0078] In the consensus phase, the priority node abandons the consensus confidence and the confidence level remains unchanged. The confidence level of the correct consensus is +1, and the confidence level of the incorrect consensus is -1.

[0079] In the consensus result confirmation stage, the candidate node gives up the confirmation and the confidence level remains unchanged, the confidence level of correct confirmation is +1, and the confidence level of incorrect confirmation is -1.

[0080] During the block generation phase, the masternode is responsible for generating lightweight blocks containing videos and related information. To effectively combat malicious nodes, the penalty score should be greater than the reward score, giving malicious nodes a lower confidence score. If a masternode successfully generates a block, its confidence score increases by +1. If it is doubted by other nodes and successfully overturned, its confidence score decreases to -α, where α is significantly greater than 1.

[0081] 3) Construct node election algorithms, including priority node election algorithm, candidate node election algorithm and master node election algorithm.

[0082] The election algorithm of the priority node election algorithm is: first, the ordinary node set U n Sort by confidence, select 2 / 3 of the nodes with higher confidence, and among the remaining nodes, select a certain number (multiplied by the balance coefficient β) as the balance number, and prioritize the node set

[0083] The candidate node election algorithm is: select the candidate node from the sorted priority node set U p Before reselection| c | nodes with high confidence enter the candidate node set U c .

[0084] The master node election algorithm is: use a random algorithm (such as the Follow-The-Satoshi (FTS) algorithm) to select the master node from the candidate node set U c The master node is elected in the network, and the master node is unpredictable, ensuring the security of the blockchain.

[0085] 4) Optimize the consensus process, such as Figure 3As shown, PBFT+ generates one block per round of consensus, and the δ-round consensus is a cycle. In each cycle, the same master node is responsible for the generation of lightweight blocks of video and related information, avoiding frequent elections of master nodes. At the end of the current cycle, the master node broadcasts the evaluation message to the entire network, generates an evaluation block, and updates the confidence of each node through the evaluation block. In particular, the evaluation block that the first consensus cycle depends on is the genesis block. If the master node fails to generate a block, the current cycle ends, the subsequent consensus blocks are discarded, and the node with the highest credibility in the candidate node set generates the evaluation block. As shown Figure 4 As shown in the figure, it is the data structure of PBFT+ evaluation block. The evaluation block header records the version number, the hash of the previous block and the timestamp. The block body records the public keys p of the priority node, candidate node and master node. i and reputation changes i .

[0086] In this embodiment, the consensus nodes are limited to priority nodes (including candidate nodes and master nodes) with a certain degree of confidence, and then the consensus conditions are changed based on the confidence. The original solution is that the number of consensus nodes exceeds a certain threshold. For example, in the PBFT solution, the number of consensus nodes must exceed 2f+1 (f is the maximum number of malicious nodes that the system can tolerate. In the PBFT algorithm, f = (n-1) / 3, where n is the number of nodes participating in the consensus), and the number of reply nodes must exceed f+1. The "number of nodes" is changed to "node cumulative confidence", recorded as V s The sum of the consensus node confidences must exceed 2 / 3 of the total number (>2 / 3V s , corresponding to 2f+1) and 1 / 3(>1 / 3V s , corresponding to f+1). Finally, to reduce the number of messages in the commit step in PBFT+, the priority node verifies that the prepare message is valid and broadcasts the commit message to the candidate nodes (including the master node). Otherwise, the message is discarded. In PBFT, the commit message needs to be broadcast to all nodes, which reduces the number of broadcasts in the consensus protocol. Figure 5 As shown in the figure, it shows the process of node broadcast communication in the algorithm. The figure gives the consensus conditions and the number of broadcasts.

[0087] like Figure 6 As shown, the consensus process is divided into 6 steps:

[0088] Step 1: The master node is successfully elected, consensus is initiated, and the client's request message (i.e., a lightweight request to upload videos and related information) is received. After verification, the "preparation message" is broadcast to all priority nodes (including candidate nodes), otherwise the message is discarded.

[0089] Step 2: The priority node receives the "pre-prepare message" from the master node within the specified time, verifies its validity and agrees, and then broadcasts the "prepare message" to the remaining priority nodes, otherwise the message is discarded.

[0090] Step 3: The priority node receives more than the sum of the confidences within the specified time. After verifying the validity and agreement of the "prepare message" of the node, the "confirmation message" is broadcast to the candidate nodes (including the master node), otherwise the message is discarded.

[0091] Step 4: If the priority node detects that the master node has failed, it discards the message, starts the view switching protocol, re-elects the master node, and goes to step 1;

[0092] Step 5: The candidate node receives more than the sum of the confidences within the specified time. The node receives the "confirmation message" from the client, verifies that it is valid and agrees to execute the message (that is, the on-chain request), and replies to the client after successful execution.

[0093] Step 6: The client receives a sum of confidences exceeding When different candidate nodes send the same reply message, the consensus is successful, the master node generates a normal block, and determines whether it has reached the next cycle. If it has reached the next cycle, it generates an evaluation block and updates the node confidence based on the evaluation block; otherwise, it continues the next round of consensus in the current cycle and goes to step 1.

[0094] After reaching a consensus, each node stores the consensus transaction in its own ledger. After the data is uploaded to the chain, each node in the blockchain stores lightweight information. The process of data trust authentication is as follows: Figure 7 As shown, existing data query models generally access local databases, which are at risk of loss and tampering, so data verification is required. The hash of the query result is compared with the hash of the on-chain result. If the content is inconsistent, it means that the local database has been tampered with. The lightweight trusted on-chain result CID (IPFS content addressing) can be used to query IPFS and retrieve the original information from the distributed storage content. Through data trust recognition, trusted on-chain is achieved.

[0095] Example 2

[0096] This embodiment provides a lightweight trusted on-chain system for video and related information based on an optimized consensus algorithm, including: a serialization module, a content summary construction module, a content addressing construction module, an on-chain module, a node role type determination module, a confidence evaluation mechanism construction module, a node election algorithm construction module, an evaluation block generation module, a message verification module, and a storage module;

[0097] In this embodiment, the serialization module is used to serialize the video and related attribute information into a JSON document;

[0098] In this embodiment, the content summary construction module is used to calculate the hash of the video and related information using a hash algorithm on the JSON document to obtain a content summary hash;

[0099] In this embodiment, the content addressing construction module is used to upload the JSON document to IPFS to generate a content addressing CID;

[0100] In this embodiment, the on-chain module is used to store the content summary hash and content address CID on the chain through a smart contract. The content summary hash and content address CID are treated as blockchain transactions and are verified by each node in the blockchain, reaching consensus and completing the on-chain.

[0101] In this embodiment, the node role type determination module is used to determine the node role type, which includes ordinary nodes, priority nodes, candidate nodes and master nodes. The ordinary nodes are server nodes that install the software and hardware required for the blockchain system. The priority nodes are alliance chain nodes used to implement the consensus step. The candidate nodes are used to confirm the consensus results. The candidate nodes are also priority nodes and participate in the consensus step. The master node is used to preside over the consensus process. The master node is both a candidate node and a priority node and participates in the consensus and confirmation steps.

[0102] In this embodiment, the confidence evaluation mechanism construction module is used to build a confidence evaluation mechanism. Whenever a content summary hash and content addressable CID are successfully uploaded to the chain as a transaction, the confidence is regularly updated based on the node's consensus behavior through a reward and punishment mechanism.

[0103] In this embodiment, the node election algorithm construction module is used to construct a node election algorithm;

[0104] In this embodiment, the evaluation block generation module is used to treat multiple consensus rounds as an election cycle. In each cycle, the same master node generates lightweight blocks of video and related information. At the end of the current cycle, the master node broadcasts the evaluation message to the entire network and generates an evaluation block. The evaluation block is used to update the confidence of each node. If the master node fails to generate a block, the current cycle ends, the subsequent consensus blocks are discarded, and the node with the highest reputation in the candidate node set generates an evaluation block.

[0105] In this embodiment, the message verification module is used to verify the message. After the priority node verifies that the preparation message is valid, the submission message is broadcast to the candidate nodes. If the verification is invalid, the message is discarded and the submission message is broadcast to all nodes.

[0106] In this embodiment, the storage module is used to store consensus transactions. Each node in the blockchain stores the consensus transactions in its own ledger, completing the lightweight information trusted chain process.

[0107] Example 3

[0108] This embodiment provides a storage medium, which can be a ROM, RAM, disk, optical disk or other storage medium. The storage medium stores one or more programs. When the program is executed by the processor, the lightweight trusted chain-up method of video and related information based on the optimized consensus algorithm of embodiment 1 is implemented.

[0109] Example 4

[0110] This embodiment provides a computing device, which can be a desktop computer, a laptop computer, a smart phone, a PDA handheld terminal, a tablet computer or other terminal device with a display function. The computing device includes a processor and a memory, and the memory stores one or more programs. When the processor executes the program stored in the memory, the lightweight trusted chain-up method of video and related information based on the optimized consensus algorithm of Example 1 is implemented.

[0111] The above embodiments are preferred implementations of the present invention, but the implementations of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be considered equivalent replacement methods and are included in the scope of protection of the present invention.

Claims

1. A lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm, characterized in that: The steps include: Serialize the video and related attribute information into a JSON document, calculate the hash of the video and related information through the hash algorithm, obtain the content summary hash, and upload the JSON document to IPFS to generate a content-addressable CID; The content summary hash and content address CID are stored on the chain through smart contracts. The content summary hash and content address CID are treated as blockchain transactions and verified by each node in the blockchain, reaching consensus and completing the chain. Determine the node role type, which includes ordinary nodes, priority nodes, candidate nodes, and master nodes. The ordinary node is a server node that installs the software and hardware required for the blockchain system. The priority node is a consortium chain node used to implement the consensus step. The candidate node is used to confirm the consensus result. The candidate node is also a priority node and participates in the consensus step. The master node is used to preside over the consensus process. The master node is both a candidate node and a priority node and participates in the consensus and confirmation steps. Build a confidence evaluation mechanism. Whenever a content summary hash and content addressing CID are successfully uploaded to the chain as a transaction, the confidence level is regularly updated based on the node's consensus behavior through a reward and punishment mechanism. Construct a node election algorithm, treating multiple consensus rounds as an election cycle. In each cycle, the same master node generates lightweight blocks of video and related information. At the end of the current cycle, the master node broadcasts the evaluation message to the entire network and generates an evaluation block. The evaluation block is used to update the confidence of each node. If the master node fails to generate a block, the current cycle ends, the subsequent consensus blocks are discarded, and the node with the highest reputation in the candidate node set generates the evaluation block. Construct node election algorithms, including priority node election algorithm, candidate node election algorithm, and master node election algorithm; The priority node election algorithm is used for the common node set U n Sort by confidence, specifically expressed as: priority node set Among them, β is the balance coefficient; The candidate node election algorithm is: select the candidate node from the sorted priority node set U p Reselect the first c nodes with high confidence to enter the candidate node set U c , c is an integer greater than 1; The master node election algorithm is: use a random algorithm to select the candidate nodes from the set U c Elect the master node; After the priority node verifies that the prepare message is valid, it broadcasts the submit message to the candidate nodes. If the verification is invalid, the message is discarded and the submit message is broadcast to all nodes. After reaching a consensus, each node in the blockchain will store the consensus transactions in its own ledger, completing the lightweight information trusted chain process.

2. The lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm according to claim 1 is characterized in that: The reward and punishment mechanism based on the consensus behavior of the node is executed to regularly update the confidence level. The specific steps include: In the consensus phase, the priority node abandons the consensus confidence level, the correct consensus confidence level is +1, and the incorrect consensus confidence level is -1; In the consensus result confirmation phase, the candidate node gives up the confirmation and the confidence level remains unchanged. The confidence level of a correct confirmation is +1, and the confidence level of an incorrect confirmation is -1. During the block generation phase, the master node’s confidence level for successful block generation is +1. If it is doubted and successfully overturned by other nodes, the master node’s confidence level is -α, where the penalty score α is greater than 1.

3. The lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm according to claim 1 is characterized in that: The evaluation block includes an evaluation block header and a block body. The evaluation block header records the version number, the hash of the previous block and the timestamp, and the block body records the public keys and reputation changes of the priority node, candidate node and master node.

4. The lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm according to claim 1 is characterized in that: The specific steps of consensus include: The master node is successfully elected, consensus is initiated, and a lightweight on-chain request message for the video and related information is received. If the verification is valid, a pre-prepared message is broadcast to all priority nodes. If the verification is invalid, the on-chain request message is discarded. The priority node receives the pre-prepare message from the master node within the preset time. If the verification is valid and the node agrees, it broadcasts the pre-prepare message to the other priority nodes. If the verification is invalid, the pre-prepare message is discarded. The priority node receives a prepare message from a node whose confidence level exceeds a first threshold within a preset time. If the verification is valid and the candidate node agrees, the priority node broadcasts a confirmation message to the candidate node. If the verification is invalid, the priority node discards the prepare message. If the priority node detects that the master node has failed, it discards the message, starts the view switching protocol, and re-elects the master node; The candidate node receives a confirmation message from a node whose confidence level exceeds a set first threshold within a preset time, verifies the message is valid, and agrees to execute the lightweight upload request message for the video and related information, and responds to the client after successful execution; When the client receives the same reply message from different candidate nodes whose sum of confidence exceeds the set second threshold, the consensus is successful, the master node generates a normal block, and at the same time determines whether it has reached the next cycle. If it has reached the next cycle, it generates an evaluation block and updates the node confidence based on the evaluation block; otherwise, it continues to the next round of consensus in the current cycle.

5. The lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm according to claim 4 is characterized in that: Limit the consensus nodes to priority nodes within the set confidence range, change the consensus conditions based on the confidence, and record the cumulative confidence of the nodes as V s , the nodes whose confidence sum exceeds the first threshold are set as the nodes whose confidence sum exceeds The sum of the confidences of the different candidate nodes exceeds the second threshold, which is set as the sum of the confidences exceeding different candidate nodes.

6. The lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm according to claim 1 is characterized in that: It also includes data validation steps, including: Use the content summary Hash of the query result to compare with the content summary Hash of the on-chain result. If the content is inconsistent, it is determined that the local database has been tampered with. Use the content addressing CID to query IPFS, retrieve the original information from the distributed storage content, and achieve trusted on-chain through data trust recognition.

7. A lightweight and trusted on-chain system for videos and related information based on an optimized consensus algorithm, characterized by: A lightweight, trusted chain-up method for videos and related information based on an optimized consensus algorithm for implementing any one of claims 1 to 6, comprising: a serialization module, a content summary construction module, a content addressing construction module, a chain-up module, a node role type determination module, a confidence evaluation mechanism construction module, a node election algorithm construction module, an evaluation block generation module, a message verification module, and a storage module; The serialization module is used to serialize the video and related attribute information into a JSON document; The content summary building module is used to calculate the Hash of the video and related information using the Hash algorithm of the JSON document to obtain the content summary Hash; The content addressing construction module is used to upload the JSON document to IPFS to generate a content addressing CID; The on-chain module is used to store the content summary Hash and content address CID on the chain through a smart contract. The content summary Hash and content address CID are treated as blockchain transactions and verified by each node in the blockchain to reach consensus and complete the on-chain. The node role type determination module is used to determine the node role type, which includes ordinary nodes, priority nodes, candidate nodes and master nodes. The ordinary nodes are server nodes that install the software and hardware required for the blockchain system. The priority nodes are alliance chain nodes used to implement the consensus step. The candidate nodes are used to confirm the consensus results. The candidate nodes are also priority nodes and participate in the consensus step. The master node is used to preside over the consensus process. The master node is both a candidate node and a priority node and participates in the consensus and confirmation steps. The confidence evaluation mechanism construction module is used to build a confidence evaluation mechanism. Whenever a content summary hash and content addressing CID are successfully uploaded to the chain as a transaction, the confidence is regularly updated by executing a reward and punishment mechanism based on the consensus behavior of the node. The node election algorithm construction module is used to construct a node election algorithm; The evaluation block generation module is used to treat multiple consensus rounds as an election cycle. In each cycle, the same master node executes the block generation of lightweight blocks of video and related information. At the end of the current cycle, the master node broadcasts the evaluation message to the entire network, generates an evaluation block, and updates the confidence of each node through the evaluation block. If the master node fails to generate a block, the current cycle ends, the subsequent consensus blocks are discarded, and the node with the highest reputation in the candidate node set generates the evaluation block; The message verification module is used to verify the message. After the priority node verifies that the preparation message is valid, the submission message is broadcast to the candidate node. If the verification is invalid, the message is discarded and the submission message is broadcast to all nodes. The storage module is used to store consensus transactions. Each node in the blockchain stores the consensus transactions in its own account book, completing the lightweight information trusted chain process.

8. A computer-readable storage medium storing a program, characterized in that: When the program is executed by the processor, a lightweight and trusted method for uploading videos and related information to a blockchain based on an optimized consensus algorithm as described in any one of claims 1 to 6 is implemented.

9. A computer device comprising a processor and a memory for storing a program executable by the processor, characterized in that When the processor executes the program stored in the memory, the lightweight trusted chain-up method for video and related information based on the optimized consensus algorithm as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Consensus method for medical data sharing based on alliance chain master-slave multiple chains

    CN115664682A