Blockchain Consensus Method and Apparatus, Electronic Device, and Storage Medium

By establishing an alliance chain system between IoT devices and edge servers and conducting blockchain consensus based on credibility, the problem of IoT devices prolonging transaction authentication in computing-intensive applications is solved, and rapid verification and high-security transaction processing is achieved.

CN115604704BActive Publication Date: 2025-07-11DONGGUAN UNIV OF TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211027980.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-25
Publication Date
2025-07-11
Estimated Expiration
2042-08-25

AI Technical Summary

Technical Problem

In the prior art, IoT devices have problems such as delayed transaction authentication and insufficient consensus security in computing-intensive applications. Especially in the IoT scenario based on DAG blockchain technology, transaction authentication is prolonged and vulnerable to malicious node attacks, and cannot meet the needs of limited equipment resources, high concurrency, high throughput and low latency.

Method used

Establish a blockchain-based alliance chain system, including multiple pairs of alliance nodes, each pair of nodes includes a target Internet of Things device and a target edge server. The credibility of alliance nodes is determined by calculating edge computing results and task arrival rate, and blockchain consensus is carried out based on the credibility, and nodes with high credibility are selected for rapid verification to avoid malicious node attacks.

Benefits of technology

It improves transaction verification speed, reduces transaction authentication delay, enhances consensus security, and meets the service quality needs of low energy consumption, low latency and high reliability of IoT devices.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115604704B_ABST
    Figure CN115604704B_ABST
Patent Text Reader

Abstract

The present application provides a blockchain consensus method and apparatus, an electronic device, and a storage medium. The method includes: establishing a consortium blockchain system based on a blockchain, where the consortium blockchain system includes multiple pairs of consortium nodes, and each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate task offloading information and perform blockchain consensus; obtaining an edge computing result based on the target edge server, and determining a corresponding task arrival rate based on the target Internet of Things device; determining the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate; and performing blockchain consensus according to the credibility. Through the present application, the problems of extended transaction authentication time and insufficient consensus security in the related art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technologies, and in particular, to a blockchain consensus method and apparatus, an electronic device, and a storage medium. Background Art

[0002] Computationally intensive applications such as face recognition, virtual / augmented reality, and video surveillance have increasing requirements for the computing capabilities of Internet of Things (IoT) devices. However, IoT devices have limited computing resources and cannot meet the demands of such applications. IoT devices can use mobile edge computing technology to offload computing tasks to edge servers for execution, thereby meeting the demands of computationally intensive applications. However, due to the heterogeneous and open nature of the wireless network edge side, edge servers do not trust each other and are vulnerable to interference attacks from malicious nodes, making it difficult to ensure the data security of IoT devices during task offloading.

[0003] Related technologies use blockchain technology to ensure the data security of IoT devices during task offloading. Blockchain is essentially a distributed ledger technology based on a distributed peer-to-peer network, and can ensure the security and reliability of user data through a consensus mechanism. However, existing blockchain technologies based on a chain structure, although able to ensure the consistency of the blockchain network, consume a large amount of resources and have a low transaction throughput, and their security and scalability have both encountered bottlenecks, and are not suitable for IoT scenarios with characteristics such as limited device resources, high concurrency, high throughput, and low latency. Existing blockchain technologies based on a directed acyclic graph (DAG) transform the distributed ledger from a single-chain form to a directed acyclic graph form. Due to the superiority of the verification mechanism, DAG blockchains have a high consensus efficiency, but the transaction authentication time is extended, they are vulnerable to attacks from malicious nodes, and the consensus security is insufficient, and cannot meet the requirements of IoT devices for data security during task offloading.

[0004] Therefore, the existing technologies have problems of extended transaction authentication time and insufficient consensus security. Summary of the Invention

[0005] The present application provides a blockchain consensus method and apparatus, an electronic device, and a storage medium to at least solve the problems of extended transaction authentication time and insufficient consensus security in related technologies.

[0006] According to one aspect of an embodiment of the present application, a blockchain consensus method is provided, and the method includes:

[0007] Build a consortium blockchain system based on blockchain. Among them, the consortium blockchain system includes multiple pairs of consortium nodes. Each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate the task offloading information and conduct blockchain consensus;

[0008] Obtain the edge computing result according to the target edge server, and determine the corresponding task arrival rate according to the target Internet of Things device;

[0009] Determine the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate;

[0010] Conduct blockchain consensus according to the credibility.

[0011] According to another aspect of the embodiments of the present application, a blockchain consensus device is further provided. The device includes:

[0012] A building module, used to build a consortium blockchain system based on blockchain. Among them, the consortium blockchain system includes multiple pairs of consortium nodes. Each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate the offloading information and conduct blockchain consensus;

[0013] An obtaining module, used to obtain the edge computing result according to the target edge server, and determine the corresponding task arrival rate according to the target Internet of Things device;

[0014] A determining module, used to determine the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate;

[0015] A consensus module, used to conduct blockchain consensus according to the credibility.

[0016] Optionally, the consensus module includes:

[0017] A creating unit, used to create an initial unit by using the target edge server, where the initial unit is used to store the edge computing result and the credibility of the consortium node;

[0018] A selecting unit, used to select a first preset number of target edge blocks by using the target edge server through a preset method, and store the hash values of the first preset number of target edge blocks into the initial unit to obtain a first unit;

[0019] A computing unit, configured to store a random number into the first unit by using the target edge server, calculate the hash value of the first unit at this time, and store the hash value into the first unit to obtain a second unit;

[0020] A broadcasting unit, configured to broadcast the second unit to other edge servers by using the target edge server;

[0021] A verification unit, configured to use the other edge servers to verify whether the second unit is legal. If it is legal, the second unit becomes a new edge block;

[0022] A judgment unit, configured to use the edge blocks generated by the other edge servers to verify the new edge block, and use the other edge servers to judge whether the verification times reach the authentication threshold. If the authentication threshold is reached, the data of the second unit is successfully consensus by the consortium blockchain system.

[0023] Optionally, the selection unit includes:

[0024] A generation sub-module, configured to generate a second preset number of wandering particles by using the target edge server, where the wandering particles are used to select the edge block;

[0025] A wandering sub-module, configured to use the target edge server to make the wandering particles wander towards the edge block with a preset probability, and select the first preset number of target edge blocks;

[0026] A judgment sub-module, configured to use the target edge server to judge whether there is a conflict among the first preset number of target edge blocks. If there is no conflict, store the hash values of the first preset number of target edge blocks into the initial unit.

[0027] Optionally, the wandering sub-module includes:

[0028] A wandering sub-unit, configured to use the target edge server to make the wandering particles wander towards the edge block with the preset probability, where the wandering particles wander independently, and the wandering particles stop wandering after reaching the edge block;

[0029] A determination sub-unit, configured to use the target edge server to determine the first preset number of wandering particles that first reach the edge block;

[0030] An as sub-unit, configured to use the target edge server to use the edge block where the first preset number of wandering particles stay as the target edge block.

[0031] Optionally, the determination module includes:

[0032] A first obtaining unit, configured to obtain the comprehensive reputation of the target edge server by using the target edge server based on the reputation evaluations of the target edge server by a third preset number of the target Internet of Things devices;

[0033] A second obtaining unit, configured to obtain the reputation of the target Internet of Things device by using the target edge server based on the task arrival rate of the target Internet of Things device;

[0034] A determining unit, configured to determine the reputation of each pair of the alliance nodes according to the comprehensive reputation of the target edge server and the reputation of the target Internet of Things device.

[0035] Optionally, the determining module includes:

[0036] A third obtaining unit, configured to obtain the task arrival rate of the target Internet of Things device by using the target edge server to obtain the task offloading information;

[0037] A fourth obtaining unit, configured to obtain the edge computing result by using the target edge server to calculate the task offloading information according to a task offloading policy, where the task offloading policy is used to determine whether the current edge server can provide resources for the current Internet of Things device, and the resources are used to calculate the task offloading information and perform blockchain consensus.

[0038] Optionally, the third obtaining unit includes:

[0039] An obtaining sub-module, configured to use the target edge server to obtain the task offloading request of the target Internet of Things device;

[0040] A obtaining sub-module, configured to use the target edge server to obtain the task offloading policy based on the task offloading request;

[0041] A first sending sub-module, configured to use the target edge server to send the task offloading policy to the target Internet of Things device;

[0042] A second sending sub-module, configured to use the target Internet of Things device to send the task offloading information to the target edge server according to the task offloading policy.

[0043] According to another aspect of the embodiments of the present application, an electronic device is further provided, including a processor, a communication interface, a memory, and a communication bus, where the processor, the communication interface, and the memory complete communication with each other through the communication bus; where the memory is used to store a computer program; the processor is configured to execute the method steps in any of the above embodiments by running the computer program stored on the memory.

[0044] According to another aspect of the embodiments of the present application, there is also provided a computer-readable storage medium, in which a computer program is stored, and the computer program is configured to execute the method steps in any of the above embodiments when running.

[0045] In the embodiments of the present application, by establishing a consortium blockchain system based on blockchain, where the consortium blockchain system includes multiple pairs of consortium nodes, each pair of consortium nodes includes a target Internet of Things device and a target edge server, the target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate task offloading information and perform blockchain consensus; obtain an edge computing result according to the target edge server, and determine the corresponding task arrival rate according to the target Internet of Things device; determine the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate; perform blockchain consensus according to the credibility. Since the embodiments of the present application establish a consortium blockchain system, obtain multiple consortium nodes including target Internet of Things devices and target edge servers, calculate the credibility of the consortium nodes, and finally perform blockchain consensus according to the credibility of the consortium nodes, the transaction verification speed of the consortium nodes with high credibility is fast and the transaction authentication delay is short during blockchain consensus, and the probability of the transactions released by the consortium nodes with low credibility being verified is low. In this way, based on the flexible transaction authentication duration, the lack of consensus security caused by malicious node attacks is effectively avoided, and the problems of long transaction authentication time and insufficient consensus security existing in the related technologies are solved. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings here are incorporated into the specification and form a part of this specification, showing embodiments consistent with the present invention and used together with the specification to explain the principles of the present invention.

[0047] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without creative efforts.

[0048] Figure 1 is a schematic flowchart of an optional blockchain consensus method according to the embodiments of the present application;

[0049] Figure 2 is a model diagram of an optional blockchain-enabled Internet of Things edge computing system according to the embodiments of the present application;

[0050] Figure 3 is a structural block diagram of an optional blockchain consensus device according to the embodiments of the present application;

[0051] Figure 4It is a structural block diagram of an optional electronic device according to an embodiment of the present application. Detailed implementation manners

[0052] In order to enable those skilled in the art of the present technology to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present application.

[0053] It should be noted that the terms "first", "second", etc. in the specification, claims and above-mentioned drawings of the present application are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0054] As a technology for multi-party co-construction, sharing and co-management, blockchain can ensure the security and credibility of data through a consensus mechanism. However, due to reasons such as high resource consumption and low transaction throughput, the consensus mechanism of traditional chain-structured blockchain is not applicable to the Internet of Things scenarios with characteristics such as limited device resources, latency sensitivity, and large transaction data volume. The blockchain based on a Directed Acyclic Graph (DAG) has a high transaction throughput and consensus efficiency and can meet the needs of the Internet of Things. However, the existing DAG blockchain consensus methods have insufficient security, long transaction authentication time, and are vulnerable to attacks by malicious nodes. To solve the above problems, according to one aspect of the embodiments of the present application, a blockchain consensus method is provided, as Figure 1 shown, the process of this method may include the following steps:

[0055] Step S101, establish a consortium chain system based on blockchain, wherein the consortium chain system includes multiple pairs of consortium nodes, and each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate task offloading information and perform blockchain consensus.

[0056] Optionally, a consortium blockchain jointly maintained by two types of interest groups, namely IoT devices and edge servers, is constructed, as Figure 2 shown, Figure 2 FIG. Figure 2 is an optional model diagram of an IoT edge computing system empowered by blockchain according to an embodiment of the present application. There are multiple IoT devices and multiple edge servers in the system. Multiple consortium nodes are generated by multiple IoT devices and multiple edge servers. Optionally, an IoT device and an edge server selected by it can also be used as a pair of consortium nodes. Since IoT devices are limited in energy, computing, and storage resources and cannot meet the resource requirements of compute-intensive applications. However, the servers deployed in the edge cloud have huge computing and storage resources. Therefore, IoT devices offload computing tasks to edge servers for execution. As blockchain users, IoT devices send computing offloading task information. In addition to executing computing offloading tasks, edge servers, as blockchain consensus nodes, package relevant information such as edge computing results into blocks and execute a consensus algorithm to maintain the blockchain ledger, ensuring the service quality requirements of low energy consumption, low latency, and high reliability for IoT devices.

[0057] Step S102: Obtain the edge computing result according to the target edge server, and determine the corresponding task arrival rate according to the target IoT device.

[0058] Optionally, for a DAG-based blockchain system, when the transaction arrival rate is low or unstable, the performance of the blockchain system will be reduced. The higher the task arrival rate, the more computing offloading tasks the edge server needs to execute, the more user data information needs to be protected, and the higher the transaction arrival rate of the blockchain.

[0059] Step S103: Determine the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate.

[0060] Optionally, the IoT device evaluates the satisfaction of the edge server according to the edge computing result of the edge server. The higher the satisfaction of the IoT device, the better the edge server completes the computing task, the higher the reliability of the edge server, and the higher the credibility score of the IoT device for the edge server. The longer the online time and the higher the activity of the IoT device, the higher the credibility score of the edge server for the IoT device.

[0061] Step S104: Conduct blockchain consensus according to the credibility.

[0062] Optionally, for consortium nodes with high credibility, the transactions they publish have a higher probability of being selected for verification, the transaction verification speed is faster, and the transaction authentication latency is shorter. For consortium nodes with low credibility, the transactions they publish have a low probability of being verified, and their cumulative weight increases slowly or no longer increases, and finally they become "orphan blocks" and are discarded.

[0063] In an embodiment of the present application, a consortium blockchain system based on blockchain is established. The consortium blockchain system includes multiple pairs of consortium nodes, and each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate task offloading information and perform blockchain consensus; the edge computing result is obtained according to the target edge server, and the corresponding task arrival rate is determined according to the target Internet of Things device; according to the edge computing result and the task arrival rate, the credibility of each pair of consortium nodes is determined; blockchain consensus is performed according to the credibility. Since the embodiment of the present application first establishes a consortium blockchain system to obtain multiple consortium nodes including target Internet of Things devices and target edge servers, calculates the credibility of the consortium nodes, and finally performs blockchain consensus according to the credibility of the consortium nodes, the transaction verification speed of the consortium nodes with high credibility is fast and the transaction authentication delay is short during blockchain consensus, and the probability of the transactions released by the consortium nodes with low credibility being verified is low, which solves the problems of long transaction authentication time and insufficient consensus security in the related technologies.

[0064] As an alternative embodiment, performing blockchain consensus according to the credibility includes:

[0065] Using the target edge server to create an initial unit, where the initial unit is used to store the edge computing result and the credibility of the consortium node;

[0066] Using the target edge server to select a first preset number of target edge blocks by a preset method, and storing the hash values of the first preset number of target edge blocks in the initial unit to obtain a first unit;

[0067] Using the target edge server to store a random number in the first unit, calculating the hash value of the first unit at this time and storing the hash value in the first unit to obtain a second unit;

[0068] Using the target edge server to broadcast the second unit to other edge servers;

[0069] Using other edge servers to verify whether the second unit is legal. If it is legal, the second unit becomes a new edge block;

[0070] Using the edge blocks generated by other edge servers to verify the new edge block, and using other edge servers to determine whether the verification times reach the authentication threshold. If the authentication threshold is reached, the data of the second unit is successfully consensus by the consortium blockchain system.

[0071] Optionally, the edge server m executes the computing offloading task of the Internet of Things device i, and takes the result of this computing task as a transaction on the blockchain. At this time, the transaction arrival rate of the Internet of Things device i is λ i, the transaction arrival rate recorded by the edge server m is For calculating the task offloading strategy, N is a positive integer. The edge server m creates a unit for each transaction to store the transaction information and the reputation of the consortium nodes, and digitally signs the transaction using the private key.

[0072] Tangle is the most representative consensus method based on the DAG blockchain. In the Tangle consensus process, before each Unit joins the DAG blockchain ledger, it needs to first verify two existing edge blocks (Tips). The first preset quantity can be two or other values, and this application does not limit the specific value. When there are multiple edge blocks (more than two), Tangle adopts a reputation-based Markov Chain Monte Carlo (MCMC) edge block selection algorithm to select two edge blocks. The higher the reputation of the consortium node, the higher the probability that the edge block it publishes is selected for verification, the faster the transaction verification speed, and the shorter the transaction authentication delay. After the newly arrived Unit selects two edge blocks, it needs to check whether these two edge blocks conflict. If there is no conflict, the hash values of these two edge blocks are stored in the Unit.

[0073] To prevent DDoS attacks and avoid waste of computing power, before publishing the above transaction, the edge server also needs to do a lightweight Proof of Work (PoW), that is, pack the content of the transaction and the hash values of the two selected edge blocks, add a random number Nonce, and calculate the hash value. And store this hash value in the Unit, and broadcast the Unit to other edge servers in the network.

[0074] When other edge servers receive the Unit, they verify its legality based on the digital signature and the Nonce value. If it is legal, this Unit is added to its local DAG ledger, and at this time this legal Unit becomes an edge block.

[0075] The steps for other edge servers to generate edge blocks are the same as the above steps. The edge blocks generated by other edge servers have a probability of directly or indirectly verifying the above Unit edge block. In the DAG blockchain, each block has an accumulated weight value (the initial value is 1). Whenever this block is directly or indirectly verified once, its accumulated weight value is incremented by 1. When the accumulated weight value of the block reaches the authentication threshold, the transaction in the block is confirmed as a successful transaction by the whole network.

[0076] In the embodiment of the present application, by introducing the attribute of credibility for each edge block and performing DAG blockchain consensus based on credibility, the problems of extension and insufficient consensus security during transaction authentication in the traditional DAG algorithm are overcome, the security of blockchain consensus is improved, and the quality of service requirements of low energy consumption, low latency, and high reliability of Internet of Things devices are met.

[0077] As an alternative embodiment, using the target edge server to select the first preset number of target edge blocks through a preset method and storing the hash values of the first preset number of target edge blocks in the initial unit includes:

[0078] Using the target edge server to generate the second preset number of wandering particles, where the wandering particles are used to select edge blocks;

[0079] Using the target edge server to make the wandering particles wander towards the edge blocks with a preset probability and select the first preset number of target edge blocks;

[0080] Using the target edge server to determine whether the first preset number of target edge blocks conflict. If there is no conflict, store the hash values of the first preset number of target edge blocks in the initial unit.

[0081] Optionally, during the tangle consensus process, generate the second preset number of particles. The second preset number represents a plurality, and the present application does not limit the specific value. Place the above particles on the old blocks in a certain specific interval. These particles independently wander towards the edge blocks with a certain probability, select two edge blocks. The first preset number can be two or other values, and the present application does not limit the specific value. The edge server checks whether these two edge blocks conflict. If there is no conflict, store the hash values of these two edge blocks in the Unit.

[0082] In the embodiment of the present application, by introducing the attribute of credibility for each edge block and performing the Monte Carlo Markov Chain (MCMC) edge block selection algorithm based on credibility, select two existing edge blocks for verification. The higher the credibility of the consortium node, the higher the probability that the edge block it publishes is selected for verification, the faster the transaction verification speed, and the shorter the transaction authentication delay, solving the problem of extended transaction authentication time in the related art.

[0083] As an alternative embodiment, determining the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate includes:

[0084] Using the target edge server to obtain the comprehensive credibility of the target edge server according to the credibility evaluation of the target edge server by the third preset number of target Internet of Things devices;

[0085] The target edge server obtains the credibility of the target Internet of Things device according to the task arrival rate of the target Internet of Things device;

[0086] According to the comprehensive credibility of the target edge server and the credibility of the target Internet of Things device, the credibility of each pair of alliance nodes is determined.

[0087] Optionally, since the edge server m can serve multiple Internet of Things devices simultaneously, its credibility should be generated by the comprehensive credibility scores of multiple Internet of Things devices for itself. The comprehensive credibility is

[0088] where ρ i,m is the computing task offloading strategy, r i→m is the score given by the Internet of Things device i to the credibility of the edge server m according to its satisfaction with the edge computing result after receiving the computing result of the edge server m. N is a positive integer, that is, the third preset quantity. The comprehensive credibility S i→m is obtained. After that, the edge server stores the comprehensive credibility.

[0089] Since the task arrival rate of the Internet of Things device indirectly reflects the transaction arrival rate of the blockchain, the edge server m scores the credibility of the Internet of Things device according to the task arrival rate λ i of the Internet of Things device as S m→i = g(λ i ), and stores S m→i .

[0090] Taking each Internet of Things device and the edge server it selects as a pair of alliance nodes, calculate the credibility S i,m = αS i→m + βS m→i (2)

[0091] where α and β are credibility weight factors respectively, and the Internet of Things device can adjust the weights of credibility according to service quality requirements.

[0092] In the embodiments of the present application, by taking each Internet of Things device and the edge server it selects as a pair of alliance nodes, considering the impact of their respective credibility on the performance of the blockchain, calculating the credibility of each pair of alliance nodes, the security of block consensus is improved, and the service quality requirements for data security of the Internet of Things device are met.

[0093] As an alternative embodiment, obtaining the edge computing result according to the target edge server and determining the corresponding task arrival rate according to the target Internet of Things device includes:

[0094] Using the target edge server to obtain task offloading information to obtain the task arrival rate of the target Internet of Things device;

[0095] The target edge server calculates task offloading information according to the task offloading policy to obtain an edge computing result, where the task offloading policy is used to determine whether the current edge server can provide resources for the current Internet of Things device, and the resources are used to calculate the task offloading information and perform blockchain consensus.

[0096] Optionally, the edge server executes the computing offloading tasks of multiple received Internet of Things devices according to the computing task offloading policy ρ i,m to obtain an edge computing result, and obtains the task arrival rate of the Internet of Things device according to the task offloading information of the Internet of Things device.

[0097] In the embodiment of the present application, the edge server executes the computing offloading task according to the computing task offloading policy to obtain the computing result and the task arrival rate, which is convenient for subsequent calculation of the reputation of the consortium nodes, and meets the computing real-time and data security requirements of the Internet of Things devices.

[0098] As an optional embodiment, before using the target edge server to calculate the task offloading information according to the task offloading policy to obtain the edge computing result, the method further includes:

[0099] The target edge server obtains a task offloading request of the target Internet of Things device;

[0100] The target edge server obtains a task offloading policy based on the task offloading request;

[0101] The target edge server sends the task offloading policy to the target Internet of Things device;

[0102] The target Internet of Things device sends task offloading information to the target edge server according to the task offloading policy.

[0103] Optionally, specifically, when the Internet of Things device i executes a computationally intensive application, due to limited computing and storage resources of its own, it sends a computing task offloading request to the Internet of Things system manager. After receiving the computing task offloading request information of the Internet of Things device i, the Internet of Things system manager broadcasts the request information to all edge servers in the edge cloud network. The edge server formulates a computing task offloading policy ρ according to the computing task offloading request of the Internet of Things device i, considering factors such as the number of its own idle resources, with the goal of meeting the computing real-time and data security of the Internet of Things device i. i,m where ρ i,m is a binary decision variable. When the edge server m can provide resources for the Internet of Things device i to execute the computing offloading task and the blockchain consensus service, ρ i,m = 1. Conversely, ρ i,m= 0. Usually, the edge server has sufficient computing resources and energy consumption and can provide resources for multiple Internet of Things devices. Each Internet of Things device only needs to select one edge server for computing task offloading. The edge server m sends the computing task offloading policy ρ i,m to the Internet of Things device i through the Internet of Things system manager. The Internet of Things device i transmits the computing task D i,m to the edge server m wirelessly according to the computing task offloading policy ρ i .

[0104] In the embodiment of the present application, the edge server generates a task offloading policy according to the computing task offloading request of the Internet of Things device, and the Internet of Things device then transmits the computing task to the edge server according to the task offloading policy, meeting the computing real-time and data security requirements of the Internet of Things device.

[0105] As an alternative embodiment, using the target edge server to move the wandering particles to the edge block with a preset probability, and selecting the first preset number of target edge blocks includes:[[]]

[0106] Using the target edge server to move the wandering particles to the edge block with a preset probability, where the wandering particles move independently, and the wandering particles stop moving after reaching the edge block;

[0107] Using the target edge server to determine the first preset number of wandering particles that reach the edge block first;

[0108] Using the target edge server to take the edge blocks where the first preset number of wandering particles stay as the target edge blocks.

[0109] Optionally, the edge server moves the wandering particles with a probability

[0110] P xy = exp(-α(H x - H y ) - β(S x - S y ))(∑ z:z→x exp(-α(H x - H z ) - β(S x - S y ))) -1 (3)

[0111] Move independently in the direction of the edge block, where H x , H y and H z represent the cumulative weight values of x, y, and z respectively. S x , S y and S zrespectively represent the reputation values of the nodes that publish x, y, and z. z→x means that z directly references x, and α and β are non - negative adjustable parameters. The edge block where the two particles that first reach the edge block stay is the selected block. The first preset quantity can be two or other values, and this application does not limit the specific value.

[0112] In the embodiment of the present application, by introducing the attribute of reputation value for each edge block, a reputation - based MCMC edge block selection algorithm is proposed, which solves the problems of extended transaction authentication time and insufficient security existing in the traditional random - walk MCMC method.

[0113] According to another aspect of the embodiment of the present application, a blockchain consensus device for implementing the above - mentioned blockchain consensus method is also provided. Figure 3 is a structural block diagram of an optional blockchain consensus device according to the embodiment of the present application, as Figure 3 shown. The device may include:

[0114] A building module 301, configured to build a consortium chain system based on a blockchain, where the consortium chain system includes multiple pairs of consortium nodes, and each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate offloading information and perform blockchain consensus;

[0115] An obtaining module 302, configured to obtain an edge computing result according to the target edge server and determine the corresponding task arrival rate according to the target Internet of Things device;

[0116] A determining module 303, configured to determine the reputation degree of each pair of consortium nodes according to the edge computing result and the task arrival rate;

[0117] A consensus module 304, configured to perform blockchain consensus according to the reputation degree.

[0118] As an optional embodiment, the consensus module includes:

[0119] A creating unit, configured to create an initial unit by using the target edge server, where the initial unit is used to store the edge computing result and the reputation degree of the consortium node;

[0120] A selecting unit, configured to select a first preset number of target edge blocks by using the target edge server through a preset method, store the hash values of the first preset number of target edge blocks into the initial unit, and obtain a first unit;

[0121] A calculating unit, configured to deposit a random number into the first unit by using the target edge server, calculate the hash value at this time and store the hash value into the first unit to obtain a second unit;

[0122] A broadcast unit, configured to broadcast a second unit to other edge servers by using a target edge server;

[0123] A verification unit, configured to verify whether the second unit is legal by using other edge servers. If it is legal, the second unit becomes a new edge block;

[0124] A judgment unit, configured to verify the new edge block by using the edge blocks generated by other edge servers, and judge whether the number of verification times reaches an authentication threshold by using other edge servers. If the authentication threshold is reached, the data of the second unit is successfully consensus by the consortium chain system.

[0125] As an alternative embodiment, the selection unit includes:

[0126] A generation sub-module, configured to generate a second preset number of wandering particles by using a target edge server, where the wandering particles are used to select edge blocks;

[0127] A wandering sub-module, configured to make the wandering particles wander towards edge blocks with a preset probability by using a target edge server, and select a first preset number of target edge blocks;

[0128] A judgment sub-module, configured to judge whether the first preset number of target edge blocks conflict by using a target edge server. If there is no conflict, store the hash values of the first preset number of target edge blocks into an initial unit.

[0129] As an alternative embodiment, the wandering sub-module includes:

[0130] A wandering sub-unit, configured to make the wandering particles wander towards edge blocks with a preset probability by using a target edge server, where the wandering particles wander independently and stop wandering after reaching the edge blocks;

[0131] A determination sub-unit, configured to determine the first preset number of wandering particles that reach the edge blocks first by using a target edge server;

[0132] A selection sub-unit, configured to use a target edge server to use the edge blocks where the first preset number of wandering particles stay as target edge blocks.

[0133] As an alternative embodiment, the determination module includes:

[0134] A first obtaining unit, configured to obtain the comprehensive credibility of a target edge server according to the credibility evaluations of a third preset number of target Internet of Things devices on the target edge server by using the target edge server;

[0135] A second obtaining unit, configured to obtain the credibility of the target Internet of Things device by using the target edge server according to the task arrival rate of the target Internet of Things device;

[0136] A determining unit, configured to determine the credibility of each pair of alliance nodes according to the comprehensive credibility of the target edge server and the credibility of the target Internet of Things device.

[0137] As an alternative embodiment, the obtaining module includes:

[0138] A third obtaining unit, configured to obtain the task arrival rate of the target Internet of Things device by using the target edge server to obtain task offloading information;

[0139] A fourth obtaining unit, configured to use the target edge server to calculate task offloading information according to a task offloading policy to obtain an edge computing result, where the task offloading policy is used to determine whether the current edge server can provide resources for the current Internet of Things device, and the resources are used to calculate task offloading information and perform blockchain consensus.

[0140] As an alternative embodiment, the third obtaining unit includes:

[0141] An obtaining sub-module, configured to use the target edge server to obtain a task offloading request of the target Internet of Things device;

[0142] A obtaining sub-module, configured to use the target edge server to obtain a task offloading policy based on the task offloading request;

[0143] A first sending sub-module, configured to use the target edge server to send the task offloading policy to the target Internet of Things device;

[0144] A second sending sub-module, configured to use the target Internet of Things device to send task offloading information to the target edge server according to the task offloading policy.

[0145] It should be noted here that the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the content disclosed in the above embodiments.

[0146] Figure 4 is a structural block diagram of an alternative electronic device according to an embodiment of the present application. As Figure 4 shown, it includes a processor 401, a communication interface 402, a memory 403, and a communication bus 404. Among them, the processor 401, the communication interface 402, and the memory 403 complete mutual communication through the communication bus 404. Among them,

[0147] The memory 403 is used to store a computer program;

[0148] The processor 401, when executing the computer program stored on the memory 403, implements the following steps:

[0149] Establish a consortium blockchain system based on blockchain, where the consortium blockchain system includes multiple pairs of consortium nodes. Each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate task offloading information and conduct blockchain consensus;

[0150] Obtain the edge computing result according to the target edge server, and determine the corresponding task arrival rate according to the target Internet of Things device;

[0151] Determine the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate;

[0152] Conduct blockchain consensus according to the credibility.

[0153] Optionally, in this embodiment, the above communication bus may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of convenience of representation, Figure 4 only a thick line is used to represent it in the figure, but it does not mean that there is only one bus or one type of bus.

[0154] The communication interface is used for communication between the above electronic device and other devices.

[0155] The memory may include RAM, and may also include non-volatile memory, for example, at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.

[0156] As an example, as Figure 4 shown, the above memory 403 may but is not limited to include the establishment module 301, the obtaining module 302, the determination module 303, and the consensus module 304 in the above blockchain consensus device. In addition, it may also include but is not limited to other module units in the above blockchain consensus device, which will not be elaborated in this example.

[0157] The above-mentioned processor may be a general-purpose processor, which may include but is not limited to: CPU (Central Processing Unit, central processing unit), NP (Network Processor, network processor), etc.; it may also be a DSP (Digital Signal Processing, digital signal processor), ASIC (Application Specific Integrated Circuit, application-specific integrated circuit), FPGA (Field-Programmable Gate Array, field-programmable gate array), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0158] Optionally, the specific examples in this embodiment may refer to the examples described in the above-mentioned embodiment, and will not be elaborated herein.

[0159] Those of ordinary skill in the art can understand that Figure 4 The structure shown is only schematic. Figure 4 It does not limit the structure of the electronic device. For example, the terminal device may further include but is not limited to more or fewer components (such as a network interface, a display device, etc.) than those shown in Figure 4 or have a different configuration from that shown in Figure 4 Those shown.

[0160] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above-mentioned embodiments can be completed by instructing the relevant hardware of the terminal device through a program, and the program can be stored in a computer-readable storage medium. The storage medium may include but is not limited to: a flash drive, a ROM, a RAM, a magnetic disk, or an optical disc, etc.

[0161] According to another aspect of the embodiments of the present application, a storage medium is further provided. Optionally, in this embodiment, the above-mentioned storage medium may be used to store program codes for executing the blockchain consensus method.

[0162] Optionally, in this embodiment, the above-mentioned storage medium may be located on at least one of the multiple network devices in the network shown in the above-mentioned embodiment.

[0163] Optionally, in this embodiment, the storage medium is set to store program codes for executing the following steps:

[0164] Build a consortium blockchain system based on blockchain. Among them, the consortium blockchain system includes multiple pairs of consortium nodes. Each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate task offloading information and conduct blockchain consensus;

[0165] Obtain the edge computing result according to the target edge server, and determine the corresponding task arrival rate according to the target Internet of Things device;

[0166] Determine the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate;

[0167] Conduct blockchain consensus according to the credibility.

[0168] Optionally, the specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be elaborated herein.

[0169] Optionally, in this embodiment, the above storage medium may include, but is not limited to: various media such as USB flash drives, ROMs, RAMs, mobile hard disks, magnetic disks, or optical discs that can store program codes.

[0170] In the description of this specification, the descriptions referring to terms such as "this embodiment", "one embodiment", "some embodiments", "examples", "specific examples", or "some examples" mean that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in a suitable manner in any one or more embodiments or examples. In addition, without contradiction, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples. In the description of the present disclosure, "a plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.

[0171] Obviously, the above embodiments are only examples given for clear illustration and not limitations on the implementation manners. For those of ordinary skill in the art, other different forms of changes or modifications can be made based on the above description. It is not necessary and impossible to list all the implementation manners here. And the obvious changes or modifications derived therefrom are still within the protection scope of the present invention.

Claims

1. A blockchain consensus method, characterized in that, The method includes: Establishing a consortium blockchain system based on blockchain, where the consortium blockchain system includes multiple pairs of consortium nodes, and each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate the task offloading information and perform blockchain consensus; Obtaining an edge computing result according to the target edge server, and determining a corresponding task arrival rate according to the target Internet of Things device; Determining the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate; Performing blockchain consensus according to the credibility; The determining the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate includes: Using the target edge server to obtain the comprehensive credibility of the target edge server according to the credibility evaluations of the target edge server by a third preset number of the target Internet of Things devices; Using the target edge server to obtain the credibility of the target Internet of Things device according to the task arrival rate of the target Internet of Things device; Determining the credibility of each pair of consortium nodes according to the comprehensive credibility of the target edge server and the credibility of the target Internet of Things device; Comprehensive Reputation of the Target Edge Server Among them, ρ i,m is the computing task offloading strategy, and r i→m is the score of the reputation of the target edge server m by the target IoT device i according to its satisfaction with the edge computing result after receiving the computing result of the target edge server m. N is a positive integer, that is, the third preset quantity; The credibility S of each pair of the alliance nodes i,m = αS i→m + βS m→i Among them, α and β are respectively the credibility weight factors, and the target Internet of Things device can adjust the weight of the credibility according to the service quality requirements, S m→i = g(λ i ), where λ i is the task arrival rate of the target Internet of Things device, and S m→i is the score of the credibility of the target Internet of Things device by the target edge server m according to the task arrival rate λ i of the target Internet of Things device.

2. The method according to claim 1, wherein The performing blockchain consensus according to the credibility includes: Using the target edge server to create an initial unit, where the initial unit is used to store the edge computing result and the credibility of the consortium node; Using the target edge server to select a first preset number of target edge blocks by a preset method, and storing the hash values of the first preset number of target edge blocks into the initial unit to obtain a first unit; Using the target edge server to store a random number into the first unit, calculating the hash value of the first unit at this time and storing the hash value into the first unit to obtain a second unit; Using the target edge server to broadcast the second unit to other edge servers; Using the other edge servers to verify whether the second unit is legal. If it is legal, the second unit becomes a new edge block; Using the edge blocks generated by the other edge servers to verify the new edge block, and using the other edge servers to determine whether the verification times reach an authentication threshold. If the authentication threshold is reached, the data of the second unit is successfully consensus by the consortium blockchain system.

3. The method according to claim 2, characterized in that, The using the target edge server to select a first preset number of target edge blocks by a preset method and storing the hash values of the first preset number of target edge blocks into the initial unit includes: Using the target edge server to generate a second preset number of wandering particles, where the wandering particles are used to select the edge blocks; Using the target edge server to make the wandering particles wander towards the edge blocks with a preset probability to select the first preset number of target edge blocks; Use the target edge server to determine whether the first preset number of target edge blocks conflict. If there is no conflict, store the hash values of the first preset number of target edge blocks in the initial unit.

4. The method according to claim 1, characterized in that The obtaining the edge computing result according to the target edge server and determining the corresponding task arrival rate according to the target Internet of Things device includes: Use the target edge server to obtain the task offloading information and obtain the task arrival rate of the target Internet of Things device; Use the target edge server to calculate the task offloading information according to the task offloading policy to obtain the edge computing result, where the task offloading policy is used to determine whether the current edge server can provide resources for the current Internet of Things device, and the resources are used to calculate the task offloading information and perform blockchain consensus.

5. The method according to claim 4, characterized in that, Before using the target edge server to calculate the task offloading information according to the task offloading policy to obtain the edge computing result, the method further includes: Use the target edge server to obtain the task offloading request of the target Internet of Things device; Use the target edge server to obtain the task offloading policy based on the task offloading request; Use the target edge server to send the task offloading policy to the target Internet of Things device; Use the target Internet of Things device to send the task offloading information to the target edge server according to the task offloading policy.

6. The method according to claim 3, characterized in that, The using the target edge server to make the wandering particles wander to the edge blocks with a preset probability and selecting the first preset number of target edge blocks includes: Use the target edge server to make the wandering particles wander to the edge blocks with the preset probability, where the wandering particles wander independently and stop wandering after reaching the edge blocks; Use the target edge server to determine the first preset number of wandering particles that first reach the edge blocks; Use the target edge server to use the edge blocks where the first preset number of wandering particles stay as the target edge blocks.

7. A blockchain consensus device, characterized in that, Includes: A building module, used to build a consortium chain system based on the blockchain, where the consortium chain system includes multiple pairs of consortium nodes, and each pair of consortium nodes includes a target Internet of Things device and a target edge server. The target Internet of Things device is used as a blockchain user to send task offloading information, and the target edge server is used as a blockchain consensus node to calculate the offloading information and perform blockchain consensus; A obtaining module, used to obtain the edge computing result according to the target edge server and determine the corresponding task arrival rate according to the target Internet of Things device; A determining module, used to determine the credibility of each pair of consortium nodes according to the edge computing result and the task arrival rate; A consensus module, used to perform blockchain consensus according to the credibility; The determining module includes: A first obtaining unit, used to use the target edge server to obtain the comprehensive credibility of the target edge server according to the credibility evaluations of the third preset number of target Internet of Things devices on the target edge server. A second obtaining unit, configured to obtain the credibility of the target Internet of Things device by using a target edge server according to the task arrival rate of the target Internet of Things device; A determining unit, configured to determine the credibility of each pair of alliance nodes according to the comprehensive credibility of the target edge server and the credibility of the target Internet of Things device; Comprehensive Reputation of the Target Edge Server Among them, ρ i,m is the computing task offloading strategy, and r i→m is the score of the reputation of the target edge server m by the target Internet of Things device i according to its satisfaction with the edge computing result after receiving the computing result of the target edge server m. N is a positive integer, that is, the third preset quantity; The credibility of each pair of the alliance nodes is S i,m = αS i→m + βS m→i Among them, α and β are respectively the credibility weight factors, and the target Internet of Things device can adjust the weights of credibility according to the service quality requirements, S m→i = g(λ i ), where λ i is the task arrival rate of the target Internet of Things device, and S m→i is the score of the credibility of the target Internet of Things device by the target edge server m according to the task arrival rate λ i of the target Internet of Things device.

8. An electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein, The processor, the communication interface, and the memory complete communication with each other through the communication bus, characterized in that The memory is configured to store a computer program; The processor is configured to execute the steps of the blockchain consensus method described in any one of claims 1 to 6 by running the computer program stored on the memory.

9. A computer-readable storage medium, characterized in that, A computer program is stored in the storage medium, wherein the computer program, when executed by a processor, implements the steps of the blockchain consensus method described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Safe and efficient data sharing method for Internet of Vehicles based on DAG block chain

    CN114173301A

  • Trust-based orchestration of edge nodes

    CN114285738A