Method and system for constructing block chain virtual computing storage body based on cloud edge-end collaboration

By adopting resource scheduling technology and improved Actor-Critic algorithm on the blockchain, combined with encryption technology, a virtual blockchain computing storage with cloud edge and end collaboration is solved, and the system's computing power and throughput are improved.

CN119829277APending Publication Date: 2025-04-15ZHONGYUAN ENGINEERING COLLEGE +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411874345.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-19
Publication Date
2025-04-15

AI Technical Summary

Technical Problem

Blockchain faces the problem of insufficient computing and storage resources in the Internet of Things scenario, especially in the case of increasing demand for high-frequency data interaction and complex computing, resulting in a decline in system throughput and an approaching bottleneck on-chain resources.

Method used

Through resource scheduling technology, the three sides of the cloud edge are connected, and blockchain is integrated as trust and balanced on-chain computing needs. The improved Actor-Critic algorithm and encryption technology are used to build a cloud edge-end collaboration blockchain virtual computing storage, and a cloud edge-end collaboration is formed to form a cloud edge-end collaboration blockchain virtual computing storage.

Benefits of technology

It effectively solves the problem of unbalanced distribution of computing and storage resources in the actual scenarios of the Internet of Things cloud edge, fully integrates on-chain requirements and off-chain heterogeneous resources, improves the system's computing power and throughput, and avoids on-chain resource bottlenecks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119829277A_ABST
    Figure CN119829277A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of block chains, and particularly relates to a cloud side end collaborative block chain virtual computing storage body construction method and system, and the method comprises the following steps: firstly, maintaining the available resource information of a cloud side end through the on-chain registration of an off-chain device; secondly, dynamically and optimally distributing the on-chain smart contract to the off-chain equipment based on a Markov decision process and an Actor-Critic algorithm; and finally, in order to meet the safety and closure of the calculation and storage body, selecting to construct encryption channels among all parts in the calculation and storage body so as to ensure the safety of parameter transmission in the virtual calculation body and efficiently support the execution of intelligent contract tasks on a chain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of blockchain technology, and specifically relates to a cloud-edge-end collaborative blockchain virtual computing storage and system. Background Art

[0002] With the rapid growth of the IoT market, the IoT service model has gradually evolved into cloud-edge-end resources collaborating to provide ubiquitous IoT services. In the process of providing IoT services, the unevenly distributed cloud-edge-end heterogeneous resources of the IoT are difficult to guarantee the quality of IoT services due to the lack of trust among multiple parties, which brings challenges such as large computing scale, strong data privacy requirements, and verifiable computing results. Blockchain technology can provide secure and reliable service support for IoT with its distributed ledger and data immutability. However, the design of blockchain itself has led to an increasing burden on on-chain computing and storage. With the explosive growth of the number of IoT devices and the continuous increase of data nodes, high-frequency data interaction and complex computing requirements have gradually exceeded the processing capacity of blockchain nodes, which not only leads to a decrease in system throughput, but also puts higher requirements on on-chain storage and computing power, making on-chain resources gradually approach bottlenecks.

[0003] In order to make up for the resource constraints on the chain, the existing research on on-chain and off-chain collaborative technology mainly focuses on using off-chain resources to make up for the lack of on-chain computing and storage. Although off-chain storage has alleviated the pressure on on-chain storage to a certain extent, the collaborative reduction of on-chain computing resources is still not considered enough; secondly, the distribution of computing and storage resources in the actual scenarios of the IoT cloud-edge is extremely uneven, and how to fully integrate on-chain requirements and off-chain heterogeneous resources in the collaborative process has not been fully considered. Summary of the invention

[0004] This application uses resource scheduling technology to connect the three sides of cloud, edge and end, integrates blockchain as a trust and balances the computing needs on the chain, and synergizes to form a cloud-edge-end collaborative blockchain virtual computing storage. Its technical solution is:

[0005] A method for constructing a blockchain virtual computing storage body in cloud-edge-end collaboration includes the following steps:

[0006] S1. Choose to allow off-chain devices to register as on-chain nodes by interacting with the blockchain system to learn about available off-chain resources; provide computing services through registered off-chain device nodes, and formalize off-chain resources and smart contracts that need to be coordinated;

[0007] S2. Choose to transform the formalized parameters into a Markov decision process, determine the state space, action space and reward function in the construction process; and use the improved Actor-Critic algorithm to solve the computational contract resource allocation model;

[0008] S3. Establish a transmission encryption channel through encryption technology to securely transmit the on-chain smart contract to the off-chain device node; the off-chain device decrypts it, processes the on-chain computing requirements and returns the results to the chain.

[0009] Preferably, in step S1, the formal processing steps of the smart contract are as follows:

[0010] S11. Off-chain devices generate asymmetric encryption key pairs locally After the key is generated, the generated public key Pk i Registered on the chain with device information, private key Sk i Will be saved locally off-chain;

[0011] S12. Formalize the off-chain resources and the smart contracts that need to be coordinated, where the registration node e i (i=1.2…n) takes the edge devices in the unit as the main body, and its resources represent the overall resources after the edge and end devices in the unit are combined. express;

[0012] in ID represents the unique identifier of the registered node i; Represents the computing resources of registered node i; represents the current maximum energy consumption of registered node i; T i load Represents the current contract load of registered node i; Represents some special resources owned by registered node i; the computation contract to be allocated on the chain uses T j (j=1.2…n) means, specifically: Where T id is the unique identifier of this contract; Indicates the size of smart contract j; An identifier representing whether smart contract j is executed on-chain or off-chain, i.e., a complex contract representation; Represents the resource requirement, i.e., the minimum resource requirement needed to process this complex contract; represents the maximum tolerated completion time of smart contract j; The current execution status; It is a special resource required by smart contracts.

[0013] Preferably, step S1 also includes calculating the communication delay D of the smart contract transmitted to the off-chain node i,j , including transmission delay Queuing Delay and processing delays

[0014] The transmission delay of the smart contract from the on-chain to the off-chain is calculated as:

[0015]

[0016] in, Indicates the size of smart contract j transferred to the off-chain, v i,j represents the transmission rate from contract j to node i;

[0017] After the smart contract is transmitted to the node, the node will process other contracts. The queue delay of the smart contract waiting to be processed is calculated as:

[0018]

[0019] in, Indicates the number of contracts that node i has allocated at this time, represents the average size of the contract allocated to node i, represents the average processing speed of node i;

[0020] When smart contract j is assigned to node i for processing, the local processing delay of this contract is:

[0021]

[0022] in, Indicates the computational load of contract j, the number of available instructions In j Take measurement.

[0023] Preferably, step S1 also includes calculating the transmission energy consumption and calculate energy consumption

[0024] The transmission energy consumption of contract j to node i is calculated as:

[0025]

[0026] in, A represents the energy consumption per bit processed by contract j during transmission. i,j =1 means that contract j is assigned to node i for execution;

[0027] After the smart contract is assigned to the registration node, the energy consumed by the registration node to execute it is;

[0028]

[0029] in, Indicates the energy consumption of each instruction executed in the node device processing contract.

[0030] Preferably, in step S2, considering that during the on-chain contract issuance process, the overall environment of the off-chain Internet of Things is dynamic and complex, in order to ensure that the contract is assigned to the best device for execution, further conditional constraints are selected, which are specifically expressed as follows:

[0031] For a single contract, the transmission, queuing and processing delays during the contract processing must be less than the pre-defined delay range. The constraint can be expressed as:

[0032]

[0033] For a single node, the sum of resources required for contracts allocated to the off-chain must be less than the computing resources of this node to prevent node overload. The constraint can be expressed as:

[0034]

[0035] in, Indicates that the required resources of the contract have been allocated on a specific node i, and the contract is guaranteed to be allocated to this node A i,j =1;

[0036] For the contract energy consumption of a single node, in order to ensure the operation efficiency of the node and minimize the overall energy consumption of the virtual computing body, the constraints can be expressed as:

[0037]

[0038] Preferably, in step S2, the Markov decision process includes a state space, an action space and a reward function, specifically:

[0039] In the state space determination, the contract part and the registered node part are used to jointly represent the system state, which is expressed as:

[0040] s(t)={(S T (t)),(S N (t))};

[0041] Among them, S T (t) represents the set of relevant state description information of the contract, S N (t) represents the node's resource, load and other information set;

[0042] In action space determination, it represents the decision made according to the state of the environment, expressed as:

[0043] a(t)={(o(t)),(R(t))};

[0044] The specific allocation decision can be expressed as The resource allocation is

[0045] To ensure the correctness of the decision, rewards are given for each decision step. The constructor is:

[0046] Preferably, in step S2, the improved Actor-Critic algorithm is used to solve the computational contract resource allocation model, and the steps are as follows:

[0047] In each agent, the Actor network policy function is defined as: π(a|s; θ), which determines the action taken by the agent in this state, with the parameter θ;

[0048] First, the value function is defined as: Where γ is the discount factor; r(t) is the immediate reward obtained by the agent after performing an action within time t; E πs is the conditional expected value under the strategy;

[0049] The generalized advantage estimation GAE is selected to construct the advantage function. The benefits of the action are evaluated by weighted accumulation and recursive calculation of the time difference error. The advantage function is constructed as follows:

[0050]

[0051] δ t+l The time difference error measures the gap between the current value function estimate and the actual observed reward. If the difference is large, it means that there is a large error between the prediction and the actual result at this moment, and the strategy needs to be adjusted. λ is the adjustment factor. l is used to represent the offset of the time step. The reward information of different time steps is weighted and accumulated to generate a more stable advantage estimate.

[0052] Formula δ t The calculation of the state value can be expressed as:

[0053] δ t =r t +γ·V(s t+1 )-V(s t );

[0054] The loss function is:

[0055]

[0056] Based on the logarithmic probability and advantage function construction of strategy π, the probability of selecting high-quality actions is increased by maximizing the advantage function;

[0057]

[0058] The prediction error is reduced by minimizing the square of the advantage function. The smaller the square value of the advantage function is, the more accurate the Critic's prediction is.

[0059] Preferably, in step S2, in order to enable the model to dynamically adapt to the environment and continuously improve the decision-making strategy, it is necessary to update the Actor and Critic network parameters to help the model effectively evaluate the selected action, and construct the update function as follows:

[0060]

[0061]

[0062] θ is the parameter of the Actor network in the Actor-Critic algorithm; θ c is the parameter of the Critic network; is the estimate of the advantage function;

[0063] Actor Network Utilization The feedback of the advantage function updates the policy parameters θ, making the obtained "good" actions more likely to be selected;

[0064] Critic network estimates advantage function Evaluate the quality of the current action.

[0065] Preferably, in step S3, the blockchain will establish secure communication after the off-chain registration node is registered and the optimal device is allocated to the high computing demand contract, specifically:

[0066] Generate a unique symmetric key k for the registered node i , and then encrypt it with the public key of this registered node and transmit it to the off-chain E(Pk i ,k i );

[0067] After receiving the encrypted symmetric key, the registered node uses its own private key to decrypt it, obtains the symmetric key for data encryption and decryption, and feeds back confirmation information to the chain. The smart contract records the status of this process to ensure that the encrypted channel is successfully established;

[0068] In collaborative contract T j After the allocation model is passed, the optimal allocation strategy is obtained, and the smart contract requirements are sent using an encrypted channel. Encryption And transmit to the off-chain distribution node;

[0069] After the encrypted smart contract is transmitted to the off-chain node, the node uses a symmetric key to decrypt it. During this process, the node analyzes the decrypted smart contract requirements, executes them, and finally uploads the execution results to the chain, completing the processing of complex computing contracts that require collaboration on the chain.

[0070] A cloud-edge-end collaborative blockchain virtual computing and storage system is used to implement the method of the present application.

[0071] Compared with the prior art, the present invention has the following beneficial effects:

[0072] 1. Through resource scheduling technology, the three sides of cloud, edge and end are connected, blockchain is integrated as a trust and balanced expansion of on-chain computing needs, jointly forming a cloud-edge-end collaborative blockchain virtual computing storage.

[0073] 2. Through the synergy between on-chain and off-chain, the problem of extremely uneven distribution of computing and storage resources in the actual scenarios of IoT cloud-edge can be solved, and the on-chain demands and off-chain heterogeneous resources can be fully integrated in the collaborative process. BRIEF DESCRIPTION OF THE DRAWINGS

[0074] Figure 1 Schematic diagram of the virtual collaborative computing storage constructed by the present invention.

[0075] Figure 2 The figure is a schematic diagram of the construction process of the virtual collaborative computing storage constructed in the present invention.

[0076] Figure 3 The figure is a schematic diagram of the flow of constructing the virtual collaborative computing storage body constructed in the present invention.

[0077] Figure 4 This is a schematic diagram of the off-chain resource scheduling process in the present invention.

[0078] Figure 5 A schematic diagram of establishing an encrypted channel in the present invention. DETAILED DESCRIPTION

[0079] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0080] It should be noted that if the embodiments of the present invention involve directional indications (such as up, down, left, right, front, back, etc.), the directional indications are only used to explain the relative position relationship, movement status, etc. between the components in a certain specific posture. If the specific posture changes, the directional indication will also change accordingly.

[0081] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of technical features indicated. Therefore, the features limited to "first" and "second" may explicitly or implicitly include at least one of the features. In addition, if "and / or" or "and / or" appears in the full text, its meaning includes three parallel solutions. Taking "A and / or B" as an example, it includes solution A, solution B, or solutions that satisfy both A and B. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the ability of ordinary technicians in this field to implement. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.

[0082] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.

[0083] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention. In addition, the technical features involved in each embodiment of the present invention described below can be combined with each other as long as they do not conflict with each other.

[0084] As attached Figure 1 As shown, a method for constructing a blockchain virtual computing storage body with cloud-edge-end collaboration includes the following steps:

[0085] S1. Choose to allow off-chain devices to register as on-chain nodes by interacting with the blockchain system to learn about available off-chain resources; provide computing services through registered off-chain device nodes, and formalize off-chain resources and smart contracts that need to be coordinated;

[0086] S2. Choose to transform the formalized parameters into a Markov decision process, determine the state space, action space and reward function in the construction process; and use the improved Actor-Critic algorithm to solve the computational contract resource allocation model;

[0087] S3. Establish a transmission encryption channel through encryption technology to securely transmit the on-chain smart contract to the off-chain device node; the off-chain device decrypts it, processes the on-chain computing requirements and returns the results to the chain.

[0088] As attached Figure 2As shown, the present invention focuses more on contracts that require a large amount of computing resources and have complex processing logic, long execution time, or do not involve state changes, collectively referred to as off-chain computing requirements involved in complex contracts. The scheduling module calls the cloud-edge resources off-chain to meet the needs of complex smart contracts on the chain, and jointly optimizes the allocation strategy based on the smart contract information and off-chain resource information.

[0089] Attached Figure 3 This is a schematic diagram of the main steps of the present invention, which is mainly divided into three steps: the off-chain device registers as an on-chain node by interacting with the blockchain system to obtain the available off-chain resources; based on the registered available resources, the Markov decision process and the Actor-Critic algorithm are used to reasonably allocate the on-chain smart contracts; based on cryptographic technology, an on-chain and off-chain encrypted channel is constructed to securely transmit smart contracts and execution results.

[0090] In order to ensure that the on-chain smart contract allocation process can fully and clearly understand the off-chain resources, it is chosen to register them on the blockchain to maintain the available resources of the off-chain devices and ensure their identity, legality and traceability. The off-chain device generates an asymmetric encryption key pair locally. After the key is generated, the generated public key Pk i Registered on the chain with device information, private key Sk i It will be saved locally off-chain to ensure that it is invisible and cannot be leaked.

[0091] Subsequently, the off-chain resources and the smart contracts that need to be coordinated are formalized, where the registration node e i (i=1.2…n) takes the edge devices in the unit as the main body, and its resources represent the overall resources after the edge and end devices in the unit are combined. express.

[0092] Specifically, ID represents the unique identifier of the registered node i; Represents the computing resources of registered node i; represents the current maximum energy consumption of registered node i; T i load Represents the current contract load of registered node i; Represents some special resources owned by registered node i.

[0093] For complex computation contracts to be distributed on the chain, use T j (j=1.2…n) means, specifically: Where T id is the unique identifier of this contract; Indicates the size of contract j; The identifier representing whether contract j is executed on-chain or off-chain, i.e., the complexity of contract calculation logic; Represents the resource requirement, i.e., the minimum resource requirement needed to process this complex contract; represents the maximum tolerated completion time of contract j; The current execution status; It is a special resource required by the contract.

[0094] After the overall architecture is built and defined, it is necessary to model the factors that need to be considered in the on-chain and off-chain interaction process. That is, the communication delay D of the parameters of the complex calculation contract on the chain to the off-chain node i,j , which can be defined as the transmission delay Queuing Delay In addition, we need to consider the processing delay when the node processes the contract

[0095] When a complex computing contract is assigned to a node, the transmission delay of the contract parameters from the chain to the chain is calculated as:

[0096]

[0097] in, Indicates the size of the parameters transmitted from contract j to the off-chain, v i,j Represents the transmission rate from contract j to node i.

[0098] After the contract parameters are transmitted to the node, when the node processes other contracts, the queuing delay of the contract waiting to be processed is calculated as:

[0099]

[0100] in, Indicates the number of contracts that node i has allocated at this time, represents the average size of the contract allocated to node i, Represents the average processing speed of node i.

[0101] When contract j is processed by the assigned node i, the local computation latency of this contract is:

[0102]

[0103] in, Indicates the computational load of contract j, the number of available instructions In j Take measurement.

[0104] In the process of allocating on-chain contracts to off-chain, the energy consumption of a single contract during processing is defined to include transmission energy consumption. and calculate energy consumption Two parts.

[0105] The transmission energy consumption of contract j to node i is calculated as:

[0106]

[0107] in, A represents the energy consumption per bit processed by contract j during transmission. i,j =1 indicates that contract j is indeed assigned to node i for execution.

[0108] After the contract is assigned to the node, the energy consumption of the node during the execution of this contract is calculated as:

[0109]

[0110] in, It indicates the energy consumption of each instruction executed in the processing contract by the node device, and the relevant parameters in the processing process are: hardware correlation coefficient α, number of CPU cycles when running the instruction C i And calculate the frequency f i wait.

[0111] As attached Figure 4 As shown in the resource scheduling process diagram, during the process of issuing on-chain contracts, the overall environment of the Internet of Things off-chain is dynamic and complex. In order to ensure that the contract can be assigned to the best device for execution, the constraint problem of the conditions is expressed as:

[0112] For a single contract, the transmission, queuing and processing delays during the contract processing must be less than the pre-defined delay range. The constraint can be expressed as:

[0113]

[0114] For a single node, the sum of resources required for contracts allocated to the off-chain must be less than the computing resources of this node to prevent node overload and affect performance and stability. The constraint can be expressed as:

[0115]

[0116] in, Indicates that the required resources of the contract have been allocated on a specific node i, and guarantees that the contract is indeed allocated to this node A i,j =1.

[0117] For the contract energy consumption of a single node, in order to ensure the operation efficiency of the node and minimize the overall energy consumption of the virtual computing body, the constraints can be expressed as:

[0118]

[0119] In order to better solve the constraint problem, we choose to optimize this problem into a Markov decision process and determine the process of the described model, including: state space, action space and reward function, specifically:

[0120] In the state space determination, the environment of this problem is mainly described, which is mainly divided into two parts: the contract part and the registered node part jointly represent the system state, which can be expressed as:

[0121] s(t)={(S T (t)),(S N (t))}

[0122] Among them, S T (t) represents the set of relevant state description information of the contract, S N (t) represents the node’s resource, load and other information collection.

[0123] In action space determination, it represents the decision made according to the state of the environment, expressed as:

[0124] a(t)={(o(t)),(R(t))}

[0125] The specific allocation decision can be expressed as The resource allocation is To ensure the correctness of the decision, rewards are given for each decision step. The constructor is:

[0126] We choose to build an off-chain collaborative algorithm for complex computing contracts based on the Actor-Critic algorithm, combine asynchronous update strategies and generalized advantage estimation, and use algorithm multi-threading to interact with on-chain contracts in different environments to meet the reasonable allocation of contracts with different resource requirements.

[0127] The selected complex computing contract off-chain collaborative algorithm involves deep reinforcement learning and requires a lot of resources. It requires a global intelligent agent to coordinate and manage the allocation strategy of the overall environment, as shown in the attached Figure 1 As shown, this module in the constructed virtual computing body selects rich cloud resources to undertake.

[0128] In each agent constructed by the scheduling algorithm, the Actor network policy function is defined as: π(a|s; θ), which determines the action taken by the agent in this state, and the parameter is θ. First, the value function is defined as:

[0129] Where γ is a discount factor between 0 and 1, which is used to discount future rewards (importance); r(t) is the immediate reward obtained by the agent after performing an action within time t; E πs is the conditional expected value under the strategy.

[0130] In the off-chain IoT environment, there are many devices and contracts with limited resources and high real-time requirements. In order to avoid excessive computational complexity, it is chosen not to evaluate each individual action, making it more efficient when processing the continuous action space of the IoT.

[0131] Furthermore, when coordinating contracts on the chain, considering that the contracts that need to be coordinated are generally complex and resource-intensive, the generalized advantage estimation (GAE) is selected to construct the advantage function, which can effectively utilize long-term reward information and reduce strategy sensitivity. By weighted accumulation and recursive calculation of time difference errors, the benefits of actions can be evaluated, and the advantage function can be constructed as follows:

[0132]

[0133] The adjustment factor λ is introduced to balance the weight of the deviation and variance. l is used to represent the offset of the time step, and the return information of different time steps is weighted and accumulated to generate a more stable advantage estimate. Formula δ t The calculation of the state value can be expressed as:

[0134] δ t =r t +γ·V(s t+1 )-V(s t )

[0135] In the process of model training, there is often a difference between the output prediction results and the actual results. In order to enable the optimization algorithm to continuously improve its own strategy, adjust the model parameters, and make the model output more accurate, it is necessary to construct a loss function as follows:

[0136]

[0137] The first formula is the Actor network loss function, which is constructed based on the logarithmic probability and advantage function of the strategy π, and increases the probability of selecting high-quality actions by maximizing the advantage function. The second formula is the Critic network loss function, which reduces the prediction error by minimizing the square of the advantage function. The smaller the square value of the advantage function, the more accurate the Critic's prediction.

[0138] Furthermore, in order to enable the model to dynamically adapt to the environment and continuously improve the decision-making strategy, it is necessary to update the Actor and Critic network parameters to help the model effectively evaluate the selected actions. The update function is constructed as:

[0139]

[0140] The third formula uses the gradient ascent method to update the Actor network parameters. The fourth formula determines the update direction and amplitude of the Critic parameters by multiplying the cumulative advantage function with its gradient to the Critic parameters, smoothing the update process and reducing fluctuations.

[0141] After the algorithm is built, the off-chain IoT cloud-edge resource information and on-chain contract information are used as the environment input, parameter updates are executed, and the iterative training process continues to continuously optimize the parameters of the Actor and Critic until the strategy performance reaches the expected standard.

[0142] In order to meet the security and overhead issues of frequent on-chain and off-chain parameter interactions in actual dynamic environments, the blockchain will generate a unique symmetric key k for the registered node after the off-chain registration node is registered. i , and then encrypt it with the public key of this registered node and transmit it to the off-chain E(Pk i ,k i ).

[0143] As attached Figure 5 As shown in the diagram of establishing an encrypted channel, after receiving the symmetric key encrypted with the public key, the registered node uses its own private key to decrypt and obtain the symmetric key for data encryption and decryption, and then feeds back confirmation information to the chain. The smart contract records the status of this process to ensure that the encrypted channel is successfully established. Finally, in the collaborative contract T j After the allocation model is passed, the optimal allocation strategy is obtained to execute this contract on a certain device, and the established encrypted channel is used to Encryption And transmit it to the off-chain distribution node. After the encrypted smart contract is transmitted to the off-chain registration node, the node uses the symmetric key to decrypt it. During this process, the node analyzes the decrypted smart contract requirements and executes them. Finally, the execution results are uploaded to the chain to complete the processing of complex computing contracts that require collaboration on the chain. A cloud-edge-end collaborative blockchain virtual computing storage body is built.

[0144] The method embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative work.

[0145] The system is constructed to run the method of the present application. Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0146] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A cloud-edge-end collaborative blockchain virtual computing storage method, characterized in that: The following steps are involved: S1. Choose to allow off-chain devices to register as on-chain nodes by interacting with the blockchain system to learn about available off-chain resources; provide computing services through registered off-chain device nodes, and formalize off-chain resources and smart contracts that need to be coordinated; S2. Select to transform the formalized parameters into a Markov decision process, determine the state space, action space and reward function in the construction process; and use the improved Actor-Critic algorithm to solve the computational contract resource allocation model; S3. Establish a transmission encryption channel through encryption technology to securely transmit the on-chain smart contract to the off-chain device node; the off-chain device decrypts it, processes the on-chain computing requirements and returns the results to the chain.

2. The cloud-edge-end collaborative blockchain virtual computing storage method according to claim 1 is characterized in that: In step S1, the formal processing steps of the smart contract are as follows: S11. Off-chain devices generate asymmetric encryption key pairs locally After the key is generated, the generated public key Pk i Registered on the chain with device information, private key Sk i Will be saved locally off-chain; S12. Formalize the off-chain resources and the smart contracts that need to be coordinated, where the registration node e i (i=1.2…n) takes the edge devices in the unit as the main body, and its resources represent the overall resources after the edge and end devices in the unit are combined. express; in ID represents the unique identifier of the registered node i; Represents the computing resources of registered node i; Represents the current maximum energy consumption of registered node i; T i load Represents the current contract load of registered node i; Represents some special resources owned by registered node i; the computation contract to be allocated on the chain uses T j (j=1.2…n) means, specifically: Where T id is the unique identifier of this contract; Indicates the size of smart contract j; An identifier representing whether smart contract j is executed on-chain or off-chain, i.e., a complex contract representation; Represents the resource requirement, i.e., the minimum resource requirement needed to process this complex contract; represents the maximum tolerated completion time of smart contract j; The current execution status; It is a special resource required by smart contracts.

3. The cloud-edge-end collaborative blockchain virtual computing storage construction method according to claim 1 is characterized in that: Step S1 also includes calculating the communication delay D of the smart contract transmission to the off-chain node i,j , including transmission delay Queuing Delay and processing delays The transmission delay of the smart contract from the on-chain to the off-chain is calculated as: in, Indicates the size of smart contract j transferred to the off-chain, v i,j represents the transmission rate from contract j to node i; After the smart contract is transmitted to the node, the node will process other contracts. The queue delay of the smart contract waiting to be processed is calculated as: in, Indicates the number of contracts that node i has allocated at this time, represents the average size of the contract allocated to node i, represents the average processing speed of node i; When smart contract j is assigned to node i for processing, the local processing delay of this contract is: in, Indicates the computational load of contract j, the number of available instructions In j Take measurement.

4. The cloud-edge-end collaborative blockchain virtual computing storage construction method according to claim 1 is characterized in that: Step S1 also includes calculating the transmission energy consumption and calculate energy consumption The transmission energy consumption of contract j to node i is calculated as: A i,j =1; in, A represents the energy consumption per bit processed by contract j during transmission. i,j =1 means that contract j is assigned to node i for execution; After the smart contract is assigned to the registration node, the energy consumed by the registration node to execute it is; A i,j =1 in, Indicates the energy consumption of each instruction executed in the node device processing contract.

5. The cloud-edge-end collaborative blockchain virtual computing storage construction method according to claim 1 is characterized in that: In step S2, considering the dynamic and complex overall environment of the off-chain IoT during the on-chain contract issuance process, in order to ensure that the contract is assigned to the best device for execution, further conditional constraints are selected, which are specifically expressed as follows: For a single contract, the transmission, queuing and processing delays during the contract processing must be less than the pre-defined delay range. The constraint can be expressed as: A i,j =1 For a single node, the sum of resources required for contracts allocated to the off-chain must be less than the computing resources of this node to prevent node overload. The constraint can be expressed as: A i,j =1 in, Indicates that the required resources of the contract have been allocated on a specific node i, and the contract is guaranteed to be allocated to this node A i,j =1; For the contract energy consumption of a single node, in order to ensure the operation efficiency of the node and minimize the overall energy consumption of the virtual computing body, the constraints can be expressed as: A i,j =1。 6. The cloud-edge-end collaborative blockchain virtual computing storage construction method according to claim 1 is characterized in that: In step S2, the Markov decision process includes state space, action space and reward function, specifically: In the state space determination, the contract part and the registered node part are used to jointly represent the system state, which is expressed as: s(t)={(S T (t)),(S N (t))}; Among them, S T (t) represents the set of relevant state description information of the contract, S N (t) represents the node's resource, load and other information set; In action space determination, it represents the decision made according to the state of the environment, expressed as: a(t)={(o(t)),(R(t))}; The specific allocation decision can be expressed as The resource allocation is To ensure the correctness of the decision, rewards are given for each decision step. The constructor is:

7. The cloud-edge-end collaborative blockchain virtual computing storage construction method according to claim 1 is characterized in that: In step S2, the improved Actor-Critic algorithm is used to solve the computational contract resource allocation model. The steps are as follows: In each agent, the Actor network strategy function is defined as: π(a|s; θ), which determines the action taken by the agent in this state, and the parameter is θ; First, the value function is defined as: Where γ is the discount factor; r(t) is the immediate reward obtained by the agent after performing an action within time t; E πs is the conditional expected value under the strategy; The generalized advantage estimation GAE is selected to construct the advantage function. The benefits of the action are evaluated by weighted accumulation and recursive calculation of the time difference error. The advantage function is constructed as follows: δ t+l Time difference error; λ is the adjustment factor. l is used to represent the offset of the time step. The reward information of different time steps is weighted and accumulated to generate a more stable advantage estimate. Formula δ t The calculation of the state value can be expressed as: δ t =r t +γ·V(s t+1 )-V(s t ); The loss function is: Based on the logarithmic probability and advantage function construction of strategy π, the probability of selecting high-quality actions is increased by maximizing the advantage function; The prediction error is reduced by minimizing the square of the advantage function. The smaller the square value of the advantage function is, the more accurate the Critic's prediction is.

8. The cloud-edge-end collaborative blockchain virtual computing storage construction method according to claim 1 is characterized in that: In step S2, in order to enable the model to dynamically adapt to the environment and continuously improve the decision-making strategy, it is necessary to update the Actor and Critic network parameters to help the model effectively evaluate the selected action. The update function is constructed as: θ is the parameter of the Actor network in the Actor-Critic algorithm; θ c is the parameter of the Critic network; is the estimate of the advantage function; Actor Network Utilization The feedback of the advantage function updates the policy parameters θ, making the obtained "good" actions easier to be selected; Critic network estimates advantage function Evaluate the quality of the current action.

9. The cloud-edge-end collaborative blockchain virtual computing storage construction method according to claim 1 is characterized in that: In step S3, the blockchain will establish secure communication after the off-chain registration node is registered and the optimal device is allocated to the high computing demand contract, specifically: Generate a unique symmetric key k for the registered node i , and then encrypt it with the public key of this registered node and transmit it to the off-chain E(Pk i ,k i ); After receiving the encrypted symmetric key, the registered node uses its own private key to decrypt it, obtains the symmetric key for data encryption and decryption, and feeds back confirmation information to the chain. The smart contract records the status of this process to ensure that the encrypted channel is successfully established; In collaborative contract T j After the allocation model is passed, the optimal allocation strategy is obtained, and the smart contract requirements are sent using an encrypted channel. Encryption And transmit to the off-chain distribution node; After the encrypted smart contract is transmitted to the off-chain node, the node uses a symmetric key to decrypt it. During this process, the node analyzes the decrypted smart contract requirements, executes them, and finally uploads the execution results to the chain, completing the processing of complex computing contracts that require collaboration on the chain.

10. A cloud-edge-end collaborative blockchain virtual computing and storage system, characterized in that: A method for constructing a blockchain virtual computing and storage body for realizing cloud-edge-end collaboration as described in any one of claims 1 to 9.