A trusted distributed computing offloading method based on blockchain

By adopting the on-chain off-chain data collaboration method of consortium chain and distributed database in the edge computing network, and combining the clustering algorithm to optimize the task offload sequence, the problem of low resource integration and task offload efficiency in the edge computing network is solved, and efficient and secure computing offloading is achieved.

CN115981807BActive Publication Date: 2025-08-08HUNAN UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211556120.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-06
Publication Date
2025-08-08
Estimated Expiration
2042-12-06

AI Technical Summary

Technical Problem

In the existing edge computing network, blockchain technology has problems such as low efficiency, high cost and time delay in resource integration and computing task offloading, especially in complex computing tasks, data correlation and resource integration between sub-tasks are difficult to effectively solve.

Method used

The on-chain off-chain data collaboration method based on alliance chain is adopted, and the registration, authentication and resource release of users and edge computing service providers are managed through smart contracts. The distributed database Mongodb stores task data, saves important data summary on the chain, and stores fully copied data off-chain. Combined with the clustering algorithm, optimizes the task off-load sequence to reduce the transaction costs and delays of the blockchain.

Benefits of technology

It realizes the secure sharing and traceability of resources in the edge computing network, reduces the impact of blockchain overhead on the delay of computing offloading, optimizes the efficiency and performance of task offloading, and improves the success rate of computing offloading.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115981807B_ABST
    Figure CN115981807B_ABST
Patent Text Reader

Abstract

The present invention discloses a trusted distributed computing offloading method based on blockchain, which relates to the field of edge computing technology in a distributed environment and includes the following steps: (1) establishing a decentralized distributed alliance chain architecture for edge computing task offloading, (2) proposing a clustered computing task offloading method with internal correlation between subtasks of complex computing tasks; (3) reducing the impact of blockchain on task offloading latency requirements by collaborating on-chain and off-chain data. The present invention proposes for the first time a trusted distributed computing offloading method based on blockchain, which safely and reliably offloads computing tasks in an open, untrusted edge network environment. While introducing the "trusted" feature of blockchain, it reduces the impact of blockchain on computing offloading latency, with the goal of balancing the benefits of task offloading demand issuers and edge service providers, thereby minimizing computing offloading latency and maximizing computing offloading success rate.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of edge computing technology in a distributed environment and relates to a trusted distributed computing offloading method based on blockchain. Background Art

[0002] With the development of various mission-critical applications in the Industrial Internet of Things (IIoT), such as image recognition and video streaming, data collection and analysis, IoT devices often lack the computing power required by existing technologies. This requires supporting computing power and ultra-low latency connectivity. Traditional cloud computing is no longer able to meet the "low latency" requirement, and computing centers are gradually shifting from cloud computing to edge computing. Edge computing refers to computing close to the source of things, data, and actions. Compared with traditional centralized cloud computing systems, it offers lower latency, faster response times, and a better user experience. Current edge computing networks are filled with a large number of distributed and heterogeneous resources. There is a lack of effective resource integration between networks, and trust issues between resources remain unresolved. Security and privacy issues associated with computing task offloading have always been major challenges in edge computing offloading. Because edge computing naturally aligns with the decentralized model of blockchain, and blockchain's traceability and tamper-proof features, many studies have attempted to incorporate blockchain technology to address the security and privacy issues faced in edge computing offloading.

[0003] Blockchain can ensure transaction security and high data consistency in trustless distributed networks. However, one of the costs of blockchain's "trust" is performance, which conflicts with the ultra-low latency requirements of edge computing in Industrial IoT scenarios. Blockchain can process an average of 5 to 7 transactions per second, but it takes 10 minutes to produce a block, and 6 blocks to complete a transaction, resulting in up to an hour for each transaction record to be established. On the one hand, blockchain indiscriminately stores massive amounts of data, resulting in significant overhead. On the other hand, complex computational tasks, such as Gaussian elimination, which can be represented by directed acyclic graphs, typically have varying degrees of data and time correlation between subtasks, leading to numerous limitations in task offloading in distributed environments. Therefore, the combination of blockchain and edge computing faces the following limitations: 1. How to effectively integrate heterogeneous resources within the edge computing network using blockchain; 2. Blockchain transaction costs are high and efficiency is low, necessitating cost reduction and efficiency improvement efforts. Summary of the Invention

[0004] In response to the defects of task offloading in existing distributed edge computing, the present invention provides a blockchain-based trusted computing task offloading system and method in edge computing.

[0005] The present invention provides the following technical solutions: Based on a distributed system model composed of users or task offloading demanders, edge computing service providers or resource providers, and alliance chains, a method for on-chain and off-chain data collaboration based on alliance chains is provided;

[0006] The user or task offloading demander is the agent who needs to make a task offloading request at the current moment. At the current moment, there are multiple users issuing task offloading requests, or a user provides multiple offloading tasks, and there may be data correlation between the tasks, that is, the calculation result of task one is the input data of task two.

[0007] Edge computing service providers or resource providers are agents of edge computing servers with idle resources at the current moment. There are multiple edge computing service providers at the current moment, or an edge computing service provider provides multiple edge computing servers, each of which is distributed in different regions.

[0008] The consortium chain is responsible for processing and recording users' offloading requests and the resource distribution of edge computing service providers. It provides distributed services including registration, authentication, offloading requests, and resource release through deployed smart contracts.

[0009] Distributed non-relational database Mongodb, a database based on distributed file storage, is responsible for storing data generated throughout the task offloading process, including intermediate document records. Mongodb has strong data consistency and provides data support for task offloading and consortium chain traceability.

[0010] The on-chain data storage only saves summaries of important data, including: user index, online node index, transaction list or task offloading record, digital fingerprint MD5 of the calculated file (MD5 checksum consists of a 128-bit value, which is usually expressed in hexadecimal format and consists of 32 characters. MD5 is usually used to generate a summary of information for a piece of information to prevent information tampering.), user signature and resource node signature; the above data is stored in the blockchain ledger of the consortium chain, referred to as Ledger; Ledger refers to the blockchain ledger, which consists of the world state and the blockchain. The world state saves the current value of the ledger data and can be changed frequently, which is convenient for direct access by applications. The blockchain records all change logs that lead to the current world state. Once written, it cannot be modified, which facilitates historical tracking.

[0011] The off-chain data storage saves fully replicated data, including: task lists uploaded by users, user information, user behavior records, resource node information, resource node behavior records, algorithm information, and storage information of some intermediate data files generated during task calculations; the above data is stored in the collection of Mongodb's non-relational database, which is a table in the Mongodb database.

[0012] Smart contracts deployed on consortium chains are used to constrain the registration and initialization of users or edge computing service providers. A smart contract is an automatically executable program that describes a business model and interaction rules. It defines the rules between different organizations. Applications call smart contracts to generate transactions that are recorded in the ledger, including:

[0013] Users or edge computing service providers register and log in to the alliance chain based on their own identity ID;

[0014] The user or edge computing service provider signs the hash value, timestamp, and encrypted identity information using their own private key, and stores the signed hash value, timestamp, and encrypted identity information index in the on-duty node of the alliance chain;

[0015] Edge computing service providers update resource information based on actual conditions;

[0016] The edge computing service provider downloads the latest algorithm code from the specified URL to ensure the normal operation of task offloading;

[0017] The smart contract uploads submission records and summary indexes to the chain, and the complete user information and resource node information are stored in the off-chain database.

[0018] When a smart contract unloading request occurs, the user uploads the task data to the consortium chain, including:

[0019] The user initiates a task offloading request to the consortium chain;

[0020] The consortium chain determines whether the user's request is reasonable based on its own smart contract and current resource conditions, and stores the task index contained in the request on the chain;

[0021] If the result is yes, the smart contract in the alliance chain authorizes the user to upload the task data. The blockchain node confirms the transaction based on the authorization submitted by the user and calls the authorization interface defined in the smart contract in the alliance chain to authorize the task data user. The authorized task data is then stored off-chain. The off-load request is then sent to the scheduler to wait for task off-loading. Other key information such as user behavior is stored off-chain.

[0022] If the result of the judgment is negative, the task offloading request is rejected;

[0023] The uninstall algorithm is called in the scheduler to obtain the pre-uninstall result and perform the actual uninstall scheduling.

[0024] When a smart contract offload request occurs, the edge computing service provider accesses the task data through the consortium chain, including:

[0025] Receive the unloading request broadcast by the alliance chain, update the remaining resources after accepting the unloading, index the resource status on the chain, and store other key information off-chain;

[0026] Request the decrypted task index from the consortium chain, obtain the specified task URL and algorithm from the off-chain database based on the index, download the task file from the specified URL, and pre-load the algorithm;

[0027] After obtaining the task file, calculate the MD5 of the file, compare it with the corresponding information on the chain, verify the digital signature, and determine whether the correct and complete file has been received;

[0028] If the judgment result is yes, the task calculation work is carried out and the calculation result is returned to the requesting user, waiting for the user's confirmation; after the user confirms, the index information of the uninstallation result is uploaded to the chain, and the complete information of the uninstallation result is stored in the off-chain database;

[0029] When the judgment result is no, an error report is submitted to the alliance chain, and the decrypted transaction data is requested again.

[0030] The task offloading decision-making method on the consortium chain is deployed in the form of a smart contract and includes the following steps:

[0031] Step 1: Data collection: Users collect task data through IoT devices and upload the offload task information to the smart contract of the alliance chain. At the same time, the smart contract actively updates the resource status of all edge computing service providers;

[0032] Step 2: Sorting: The smart contract uses a clustering method (Kmeans) to classify and sort the batch tasks to be offloaded, maximizing the inherent relevance between tasks and determining the order in which the batch tasks should be offloaded.

[0033] Step 3: Filter: Traverse the tasks in the order of uninstallation, add the ready tasks to the ready queue, and add other unready tasks to the waiting queue;

[0034] Step 4: Pre-binding: Traverse the running queue and, for each task in the queue, find the edge server node that meets the computing resources required by the task and minimizes its latency, and perform pre-binding for unloading.

[0035] Step 5, Binding: Unload tasks based on the pre-unloading results obtained in step 4. Tasks that fail to be unloaded are added to the retry queue. When the ready queue is empty, the ready tasks in the waiting queue are added to the ready queue. Tasks in the retry queue will be retried when both the ready queue and the waiting queue are empty.

[0036] Step 6. Repeat steps 4 and 5 until all queues are empty. The task offloading is completed and the smart contract will record the result of this offloading.

[0037] In step 1, the offloading task request only uploads the task summary information, and a small amount of data is written to the on-chain ledger between the user and the consortium chain. The transmission time is so short that it can be ignored. The resource table maintained in the system is updated at the same time as the task offloading request summary information is uploaded;

[0038] Distributed computing offloading research generally uses Directed Acyclic Graph (DAG), which refers to a directed graph without loops to represent the dependency relationship between tasks, expressed as G = (V, E).

[0039] Where V represents the set of nodes in the DAG, and each node i∈V represents a subtask in the running complex computing task; E represents the set of edges in the DAG, and each edge e(i,j)∈E represents the dependency relationship between tasks i and j, that is, task j requires the output data of task i as its own input, and calls task i the predecessor of j, and task j is the successor of i. A task can only start executing after all its predecessor tasks are completed; in a DAG, a task without a predecessor task is called an entry task, and a task without a successor task is called an exit task. An application allows multiple entry tasks and exit tasks at the same time. Assume that the user set is represented by U = {u1, u2, ..., u n}, each user u i The uploaded task set is represented as T = {t1, t2, ..., t m}, the task set can represent a set of different types of computing tasks, each t i are composed of a set of vectors {S i , C i , D i , T i , F i , VM i}, used to describe the uninstallation task t i Attributes; among them, S i Represents task t i The size of the uploaded data, C i Indicates completion of task t i The number of CPU cycles required, D i Represents task ti The maximum delay that can be tolerated, T i Represents task t i Whether there is dependency, Fi represents task t i The predecessor tasks are represented by a set of vectors {t i1 ,t i2 ,...,t im} constitute, t ij =0or1, to represent the computation offloading task t j Is it t i The predecessor task, VM i Used to record tasks i Pre-uninstall results.

[0040] In step 2, it is assumed that the tasks submitted by the same user are likely to be related. The smart contract determines the initial category K of the task classification based on the elbow method, and then determines whether to classify the resource node based on the K value. The task attribute T i As an important attribute participating in clustering, the smart contract is specifically introduced as follows:

[0041] The elbow method evaluates the K value by calculating SSE. When K reaches the optimal number of clusters, the decrease in SSE obtained by increasing K will drop sharply, thereby determining the optimal number of clusters K. The calculation method of SSE is expressed as: Among them, C i is the i-th cluster, p is C i The sample points in m i It is C i The center of mass;

[0042] Assume that the total number of tasks that need to be offloaded is α, and the smart contract checks the number of online resource nodes β. The classification of resource nodes has the following constraints:

[0043] When β≤α, the number of resource nodes participating in this offloading β=β;

[0044] when When , the number of resource nodes participating in this offloading β = min{α, β};

[0045] When β>α, the number of resource nodes participating in this offloading is β=max{α, β×A}, where A∈[0,1], which represents the percentage of sampling from online resource nodes. The default setting is 0.5 and can be customized through configuration.

[0046] The inter-class quantity adjustment has the following constraints: ActualSkew = count[allocated] - min(count[allocated]), and ActualSkew < MaxSkew. MaxSkew is determined by configuration, with the default for task classification being 5 and the default for resource node classification being 2.

[0047] In step 3 as described above, by determining whether the predecessor tasks of task t i have been completed, it is determined whether task ti is ready. If there are still unfinished predecessor tasks, ti must wait for the task data of the predecessor tasks to be able to execute its own computing tasks.

[0048] In step 4 as described above, pre-binding for offloading is performed through a smart contract. The specific introduction of this smart contract is as follows: for task t i predecessor task t j 's task result data μ ij must be transmitted to the edge server where t i is located. Only then can t i execute. Assuming that all the predecessor tasks of task t i have been completed and the task result data has been transmitted to the computing resource node where the current task t i is located, then the communication time from the predecessor task F i to t i is calculated as R ij represents the transmission rate from resource node i to resource node j, and it is assumed that there is no data transmission delay when the predecessor task and the current task are on the same resource node; the pre-binding sorting is performed by priority, and the priority where represents the execution delay of the task on resource node i, and f i represents the computing power of resource node i. level is usually not calculated as an integer but as a floating point number. Then, the pre-binding offloading order is obtained by sorting in ascending order of level.

[0049] In step 5 as described above, calculate the fragmentation rate of the current resource node, and actually perform scheduling according to the fragmentation rate and the node situation allocated in the pre-binding stage. MemFragmentationRatio = MemAllocatable / MemRequest. When 1 ≤ MemFragmentationRatio < 1.6, it means that the current node is schedulable, and there are the following constraints during the actual offloading process:

[0050] (1) All tasks submitted by users should be offloaded to the edge for execution;

[0051] (2) Each uploaded task is atomic after being split and cannot be further split;

[0052] (3) A task is assumed to be offloaded to only one online resource node;

[0053] (4) Queue insertion operations must also retain priority constraints.

[0054] In steps 5 and 6, the time delay for completing the batch tasks and the energy consumption of the edge server will be accumulated. After all tasks are completed, the task completion rate will be calculated:

[0055] The calculation method for the total latency of batch task completion is defined as:

[0056] T total =Tfinal, T total It represents the total delay of completing batch tasks, and the completion time of the last completed task in the batch is the final completion time of the batch of tasks;

[0057] The edge computing server processes the computing tasks t submitted by users. i , the computational energy consumption of ti is defined as:

[0058] Indicates that the edge computing server is executing task t i Energy consumption during the process, Indicates that the edge computing server is waiting for task t i Idle energy consumption during the process;

[0059] The total energy consumption of the edge computing server after batch task offloading is defined as:

[0060] E ij represents the uninstallation task j uploaded by user i;

[0061] The task completion rate is defined as:

[0062] F ij Indicates whether the uninstallation task j uploaded by user i is in D i Completed within, F ij =0or1, α represents the total number of tasks that need to be offloaded this time.

[0063] The advantages and beneficial effects of the present invention are:

[0064] (1) The present invention provides a trusted distributed computing offloading method based on blockchain, which integrates blockchain technology with edge computing offloading technology, and uses the trusted access control mechanism of blockchain to solve the problems of secure resource sharing and traceability of computing offloading process, thereby realizing a distributed interactive mode of data collaboration on and off the chain, and to a certain extent solving the problem of the huge overhead of blockchain affecting the delay of edge computing, which is of great significance for computing offloading performance assurance;

[0065] (2) The present invention provides a trusted distributed computing offloading method based on blockchain, which takes the task dependency problem as the core issue and obtains the optimal offloading sequence and offloading strategy for computing tasks through a clustering algorithm, thereby reducing the overall offloading delay of complex computing tasks and the computing operation energy consumption of edge servers. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be described in detail below with reference to the accompanying drawings, in which:

[0067] Figure 1 This is a system model diagram for distributed computing task offloading based on blockchain.

[0068] Figure 2 This is a diagram of a computing task offloading framework based on on-chain and off-chain data collaboration.

[0069] Figure 3 Design diagram for a priority queue based on clustering method,

[0070] Figure 4 A flowchart of distributed computing task offloading based on consortium chain. DETAILED DESCRIPTION

[0071] The following describes the embodiments of the present invention through specific examples. Those skilled in the art can easily understand other advantages and effects of the present invention from the contents disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the following embodiments and features in the embodiments can be combined with each other in the absence of conflict. Figures 1 to 4 The present invention is described in more detail:

[0072] Based on a distributed system model consisting of users or task offloading demanders, edge computing service providers or resource providers, and alliance chains, a method for on-chain and off-chain data collaboration based on alliance chains is provided;

[0073] The user or task offloading demander is the agent who needs to make a task offloading request at the current moment. At the current moment, there are multiple users issuing task offloading requests, or a user provides multiple offloading tasks, and there may be data correlation between the tasks, that is, the calculation result of task one is the input data of task two.

[0074] Edge computing service providers or resource providers are agents of edge computing servers with idle resources at the current moment. There are multiple edge computing service providers at the current moment, or an edge computing service provider provides multiple edge computing servers, each of which is distributed in different regions.

[0075] The consortium chain is responsible for processing and recording users' offloading requests and the resource distribution of edge computing service providers. It provides distributed services including registration, authentication, offloading requests, and resource release through deployed smart contracts.

[0076] Distributed non-relational database Mongodb, a database based on distributed file storage, is responsible for storing data generated throughout the task offloading process, including intermediate document records. Mongodb has strong data consistency and provides data support for task offloading and consortium chain traceability.

[0077] The on-chain data storage only saves summaries of important data, including: user index, online node index, transaction list or task offloading record, digital fingerprint MD5 of the calculated file (MD5 checksum consists of a 128-bit value, which is usually expressed in hexadecimal format and consists of 32 characters. MD5 is usually used to generate a summary of information for a piece of information to prevent information tampering.), user signature and resource node signature; the above data is stored in the blockchain ledger of the consortium chain, referred to as Ledger; Ledger refers to the blockchain ledger, which consists of the world state and the blockchain. The world state saves the current value of the ledger data and can be changed frequently, which is convenient for direct access by applications. The blockchain records all change logs that lead to the current world state. Once written, it cannot be modified, which facilitates historical tracking.

[0078] The off-chain data storage saves fully replicated data, including: task lists uploaded by users, user information, user behavior records, resource node information, resource node behavior records, algorithm information, and storage information of some intermediate data files generated during task calculations; the above data is stored in the collection of Mongodb's non-relational database, which is a table in the Mongodb database.

[0079] Smart contracts deployed on consortium chains are used to constrain the registration and initialization of users or edge computing service providers. A smart contract is an automatically executable program that describes a business model and interaction rules. It defines the rules between different organizations. Applications call smart contracts to generate transactions that are recorded in the ledger, including:

[0080] Users or edge computing service providers register and log in to the alliance chain based on their own identity ID;

[0081] The user or edge computing service provider signs the hash value, timestamp, and encrypted identity information using their own private key, and stores the signed hash value, timestamp, and encrypted identity information index in the on-duty node of the alliance chain;

[0082] Edge computing service providers update resource information based on actual conditions;

[0083] The edge computing service provider downloads the latest algorithm code from the specified URL to ensure the normal operation of task offloading;

[0084] The smart contract uploads submission records and summary indexes to the chain, and the complete user information and resource node information are stored in the off-chain database.

[0085] When a smart contract unloading request occurs, the user uploads the task data to the consortium chain, including:

[0086] The user initiates a task offloading request to the consortium chain;

[0087] The consortium chain determines whether the user's request is reasonable based on its own smart contract and current resource conditions, and stores the task index contained in the request on the chain;

[0088] If the result is yes, the smart contract in the alliance chain authorizes the user to upload the task data. The blockchain node confirms the transaction based on the authorization submitted by the user and calls the authorization interface defined in the smart contract in the alliance chain to authorize the task data user. The authorized task data is then stored off-chain. The off-load request is then sent to the scheduler to wait for task off-loading. Other key information such as user behavior is stored off-chain.

[0089] If the result of the judgment is negative, the task offloading request is rejected;

[0090] The uninstall algorithm is called in the scheduler to obtain the pre-uninstall result and perform the actual uninstall scheduling.

[0091] When a smart contract offload request occurs, the edge computing service provider accesses the task data through the consortium chain, including:

[0092] Receive the offload request broadcast by the alliance chain, update the remaining resources after accepting the offload, index the resource status on the chain, and store other key information off-chain;

[0093] Request the decrypted task index from the consortium chain, obtain the specified task URL and algorithm from the off-chain database based on the index, download the task file from the specified URL, and pre-load the algorithm;

[0094] After obtaining the task file, calculate the MD5 of the file, compare it with the corresponding information on the chain, verify the digital signature, and determine whether the correct and complete file has been received;

[0095] If the judgment result is yes, the task calculation work is carried out and the calculation result is returned to the requesting user, waiting for the user's confirmation; after the user confirms, the index information of the uninstallation result is uploaded to the chain, and the complete information of the uninstallation result is stored in the off-chain database;

[0096] When the judgment result is no, an error report is submitted to the alliance chain, and the decrypted transaction data is requested again.

[0097] Smart contracts ensure that both parties coordinate tasks on-chain during offloading, with the task text transmitted off-chain. This on-chain and off-chain collaboration isolates task data from the blockchain's P2P network, while the task calculation files and offloading process can be cross-verified with on-chain transaction information. This prevents task data leakage, reduces blockchain costs, and improves blockchain operational efficiency, achieving a balance between cost, efficiency, and privacy.

[0098] The task offloading decision-making method on the consortium chain is deployed in the form of a smart contract and includes the following steps:

[0099] Step 1: Data collection: Users collect task data through IoT devices and upload the offload task information to the smart contract of the alliance chain. At the same time, the smart contract actively updates the resource status of all edge computing service providers;

[0100] Step 2: Sorting: The smart contract uses a clustering method (Kmeans) to classify and sort the batch tasks to be offloaded, maximizing the inherent relevance between tasks and determining the order in which the batch tasks should be offloaded.

[0101] Step 3: Pre-binding: Traverse the running queue and, for each task in the queue, find the edge server node that meets the computing resources required by the task and minimizes its latency, and perform pre-binding for unloading.

[0102] Step 4: Pre-binding: Traverse the running queue and, for each task in the queue, find the edge server node that meets the computing resources required by the task and minimizes its latency, and perform pre-binding for unloading.

[0103] Step 5, Binding: Unload tasks based on the pre-unloading results obtained in step 4. Tasks that fail to be unloaded are added to the retry queue. When the ready queue is empty, the ready tasks in the waiting queue are added to the ready queue. Tasks in the retry queue will be retried when both the ready queue and the waiting queue are empty.

[0104] Step 6: Repeat steps 4 and 5 until all queues are empty. The task offloading is completed and the smart contract will record the result of this offloading.

[0105] In step 1, the offloading task request only uploads the task summary information, and a small amount of data is written to the on-chain ledger between the user and the consortium chain. The transmission time is so short that it can be ignored. The resource table maintained in the system is updated at the same time as the task offloading request summary information is uploaded;

[0106] Distributed computing offloading research generally uses Directed Acyclic Graph (DAG), which refers to a directed graph without loops to represent the dependency relationship between tasks, expressed as G = (V, E).

[0107] Where V represents the set of nodes in the DAG, and each node i∈V represents a subtask in the running complex computing task; E represents the set of edges in the DAG, and each edge e(i,j)∈E represents the dependency relationship between tasks i and j. That is, task j requires the output data of task i as its input, and calls task i its predecessor, and task j its successor. A task can only start executing after all its predecessor tasks are completed. In a DAG, a task without a predecessor task is called an entry task, and a task without a successor task is called an exit task. An application can have multiple entry tasks and exit tasks at the same time.

[0108] Assume that the user set is represented as U = {u1, u2, ..., u n}, each user u i The uploaded task set is represented as T = {t1, t2, ..., t m}, the task set can represent a set of different types of computing tasks, each t i are composed of a set of vectors {S i , C i , D i , T i , F i , VM i}, used to describe the uninstallation task t i Attributes; among them, S i Represents task t i The size of the uploaded data, C i Indicates completion of task ti The number of CPU cycles required, D i Represents task t i The maximum delay that can be tolerated, T i Represents task t i Whether there is dependency, Fi represents task t i The predecessor tasks are represented by a set of vectors {t i1 ,t i2 ,...,t im} constitute, t ij =0or1, to represent the computation offloading task t j Is it t i The predecessor task, VM i Used to record tasks i Pre-uninstall results.

[0109] In step 2, it is assumed that the tasks submitted by the same user are likely to be related. The smart contract determines the initial category K of the task classification based on the elbow method, and then determines whether to classify the resource node based on the K value. The task attribute T i As an important attribute participating in clustering, the smart contract is specifically introduced as follows:

[0110] The elbow method evaluates the K value by calculating SSE. When K reaches the optimal number of clusters, the decrease in SSE obtained by increasing K will drop sharply, thereby determining the optimal number of clusters K. The calculation method of SSE is expressed as: Among them, C i is the i-th cluster, p is C i The sample points in m i It is C i The center of mass;

[0111] Assume that the total number of tasks that need to be offloaded is α, and the smart contract checks the number of online resource nodes β. The classification of resource nodes has the following constraints:

[0112] When β≤α, the number of resource nodes participating in this offloading β=β;

[0113] when When , the number of resource nodes participating in this offloading β = min{α, β};

[0114] When β>α, the number of resource nodes participating in this offloading is β=max{α, β×A}, where A∈[0,1], which represents the percentage of sampling from online resource nodes. The default setting is 0.5 and can be customized through configuration.

[0115] The inter-class quantity adjustment has the following constraints: ActualSkew = count[allocated] - min(count[allocated]), and ActualSkew < MaxSkew. MaxSkew is determined by configuration. The default value for task classification is 5, and the default value for resource node classification is 2.

[0116] In step 3 described above, by determining whether the predecessor tasks of task t i have been completed, it is determined whether task ti is ready. If there are still unfinished predecessor tasks, ti must wait for the task data of the predecessor tasks to be able to execute its own computing tasks.

[0117] In step 4 described above, pre-binding for offloading is performed through a smart contract. The specific introduction of this smart contract is as follows: For task t i predecessor task t j task result data μ ij must be transmitted to the edge server where t i is located. Only then can t i execute. Assume that all predecessor tasks of task t i have been completed and the task result data has been transmitted to the computing resource node where the current task t i is located. Then the communication time from predecessor task F i to t i is calculated as R ij represents the transmission rate from resource node i to resource node j, and it is assumed that there is no data transmission delay when the predecessor task and the current task are on the same resource node;

[0118] The pre-binding sorting is performed by priority. The priority where, represents the execution delay of the task on resource node i, and f i represents the computing power of resource node i.

[0119] In step 5 described above, the fragmentation rate of the current resource node is calculated, and actual scheduling is performed according to the fragmentation rate and the node situation allocated in the pre-binding stage. MemFragmentationRatio = MemAllocatable / MemRequest. When 1 ≤ MemFragmentationRatio < 1.6, it means that the current node is schedulable, and there are the following constraints in the actual offloading process:

[0120] (1) All tasks submitted by users should be offloaded to the edge for execution;

[0121] (2) Each uploaded task is atomic after being split and cannot be further split;

[0122] (3) A task is assumed to be offloaded to only one online resource node;

[0123] (4) Queue insertion operations must also retain priority constraints.

[0124] In steps 5 and 6, the time delay for completing the batch tasks and the energy consumption of the edge server will be accumulated. After all tasks are completed, the task completion rate will be calculated:

[0125] The calculation method for the total latency of batch task completion is defined as:

[0126] T total =Tfinal, T total It represents the total delay of completing batch tasks, and the completion time of the last completed task in the batch is the final completion time of the batch of tasks;

[0127] The edge computing server processes the computing tasks t submitted by users. i , the computational energy consumption of ti is defined as:

[0128] Indicates that the edge computing server is executing task t i Energy consumption during the process, Indicates that the edge computing server is waiting for task t i Idle energy consumption during the process;

[0129] The total energy consumption of the edge computing server after batch task offloading is defined as:

[0130] E ij represents the uninstallation task j uploaded by user i;

[0131] The task completion rate is defined as:

[0132] F ij Indicates whether the uninstallation task j uploaded by user i is in D i Completed within, F ij =0or1, α represents the total number of tasks that need to be offloaded this time.

[0133] The beneficial effects of the present invention are as follows: (1) A data collaboration method for on-chain evidence storage and off-chain data transmission is proposed, which reduces the storage overhead of the blockchain. (2) A clustering method is used to classify tasks and resources, so that similar tasks can be better offloaded to appropriate resource nodes. Then, an offload scheduling strategy is implemented to reduce the transmission waiting time between tasks and improve the overall task completion delay. (3) Both data evidence storage and offload strategies are automatically executed through smart contracts, ensuring the immutability, visibility, and traceability of the entire offload process.

[0134] The detailed embodiment provides a trusted distributed computing task offloading method based on blockchain, comprising the following steps:

[0135] 1) Establish a decentralized distributed alliance chain architecture for edge computing task offloading;

[0136] 2) A clustering task offloading method is proposed to solve the problem of internal correlation between subtasks of complex computing tasks;

[0137] 3) Reduce the impact of blockchain on task offloading latency requirements by coordinating on-chain and off-chain data.

[0138] like Figure 1 The following figure shows a system model consisting of users (task offloading demanders), edge computing service providers (resource providers), and alliance chains. Data is transmitted between the edge and user ends via the Internet.

[0139] A user is an agent requesting a task offload at the current moment. A user may consist of multiple IoT devices, providing multiple offload tasks, and these tasks may be temporally correlated. The user collects task data using various sensors, including sensors, cameras, and acquisition hardware. These IoT devices often have limited computing power and are unable to process the collected data. Therefore, tasks need to be offloaded to devices with sufficient computing power and storage space.

[0140] Edge computing service providers are agents for edge computing servers with currently available resources. A single provider may offer multiple edge computing servers, each hosting a variety of services. Servers from the same provider may also be located in different regions. Consortium blockchains and distributed MongoDB databases are also deployed on the server nodes provided by the edge computing service provider.

[0141] The consortium chain is responsible for processing and recording user offload requests and the resource distribution of edge computing service providers. Through deployed smart contracts, it provides distributed services including registration, authentication, offload requests, and resource release. Because the consortium chain is only installed on resource nodes, the blockchain's operational performance is greatly guaranteed. Users access the system through a front-end interactive interface; their devices are not equipped with the consortium chain, thus ensuring a highly reliable user experience.

[0142] like Figure 2 As shown in the figure, the task offloading decision framework based on the alliance chain is composed of multiple modules such as interactive interface, user management, resource node management, task management, timer, offloading policy management, scheduler and database. The following is a detailed description of each module:

[0143] 1.Interactive interface

[0144] It is convenient for users to publish task offloading requests, upload task information and query task offloading results intuitively and conveniently. Users upload complete task information on the interactive interface;

[0145] The existence of the interactive interface allows users to avoid the effort of setting up a blockchain on the device side when the device capabilities are limited. By making task offloading requests through the interface, the device can focus solely on its own data collection process. As long as there is a network, users can enjoy the blockchain offloading service;

[0146] 2. User Management

[0147] This invention only provides basic user management functions, including user registration, login verification, and logout. After the user is registered and authenticated, the system stores the user's unique identifier UserId, username UserName, password UserPwd, private key UserSK, and public key UserPK off-chain, and the user's unique identifier is stored on-chain;

[0148] The user management module can be easily expanded according to the actual usage scenario, such as adding the corresponding relationship between roles and permissions; 3. Timer

[0149] It is a callback function that is called at intervals. Its function is to automatically call the smart contract and storage API program at intervals. It includes program modules such as resource update, task update, task collection, and uninstall result update. The interval between each call is in milliseconds. The default setting is 1000ms, which can be customized. When the task traffic in the system is too high, you can set an ultra-low interval, such as 10ms.

[0150] 4. Resource node management

[0151] The present invention only performs basic resource node management functions, including registration, login verification and deregistration of edge computing service providers, and registration, online verification and deregistration of resource nodes. After the edge computing service provider is registered and authenticated, the system stores the user's unique identifier, user name, user password, user private key and user public key off-chain, and stores the user's unique identifier on-chain. After the resource node of the edge computing service provider is registered and authenticated, the system stores the edge computing service provider's unique identifier, resource node unique identifier NodeId, resource node public and private keys NodeSK / NodePK, resource node longitude NodeLon, resource node latitude NodeLat, resource node CPU cycle NodeResource, resource node transmission rate NodeDTR, resource node computing and processing capacity NodeMIPS, resource node energy consumption NodeEnergy off-chain, and the resource node unique identifier is stored on-chain;

[0152] In the consortium chain, an online resource node table is maintained, which stores the unique identifiers of online resource nodes, and the resource information is obtained from MongoDB. In addition, a network graph is also maintained, and the concept of edge is introduced to store the edge network structure. The edge set {EdgeId, SrcId, DstId, Length, Delay, Bandwidth} is used to describe the attributes of the edge. EdgeId represents the unique identifier of the edge, SrcId represents the source of the edge, and DstId represents the end point of the edge. SrcId and DstId are both resource node IDs. An edge indicates that two resource nodes can communicate directly with each other. Length represents the actual physical distance of the edge, and Delay represents the transmission delay between SrcId and DstId. Delay is not present at the beginning, but is the average value retained through continuous testing and updating. The approximate transmission delay can be inferred through Delay, which is very helpful for calculations in the pre-binding process. Bandwidth represents the transmission bandwidth of this edge. Similarly, Bandwidth is not present at the beginning, but is the average value retained through continuous testing and updating.

[0153] 5. Task Management

[0154] It supports the creation and management of computing tasks, as well as the start and stop of computing tasks. Task information includes: the task unique identifier TaskId, the number of computing CPU cycles requested by the task TaskResource, the task size TaskSize, the maximum tolerable time TaskDeadline, the task type TaskType (whether the task is a dependent task), the task's predecessor TaskFathers, and the link to the task file TaskURL. The task unique identifier and user unique identifier will be stored on the chain (stored in the consortium chain ledger), while other information will be stored off-chain (stored in the distributed MongoDB database); before creating a task, the algorithm information must have been created, which is explained in the uninstallation policy management. After the task is created, the task status switch defaults to off, and running tasks cannot be edited or deleted. Tasks include the following three states:

[0155] ①Task ready: The predecessor tasks of the task have been completed, but the task has not yet been run and is waiting to be run;

[0156] ②Task running: the task is being executed;

[0157] ③Task retry: If the task fails to execute, it will be added to the retry queue;

[0158] It should be noted that task dependencies are represented a priori through a DAG graph. Task dependencies must be obtained in advance by the user using other task segmentation tools. This invention does not perform task segmentation.

[0159] 6. Strategy Management

[0160] Supports the acquisition of algorithms and the selection of clustering methods. The workflow of policy management is as follows:

[0161] ① Obtain a clustering algorithm based on user preferences, determine the number of clusters for task clustering, and perform task classification;

[0162] ②Determine whether to classify resource nodes based on the task classification. If classification is required, sample and adjust according to the classification constraints. If the number of tasks in a task cluster is much greater than the number of resource nodes after resource node classification, the task offloading effect will be extremely poor. Therefore, it is necessary to adjust the number of clusters to ensure that each resource node cluster serves the appropriate task cluster, which can minimize the overall completion delay of batch tasks. An example of the method for adjusting the number of clusters is as follows:

[0163] Assume that 10 tasks are classified into 3 clusters, MaxSkew = 1, and the current classification is <2,3,5>, that is, the first cluster has 2 tasks, the second cluster has 3 tasks, and the third cluster has 5 tasks. The calculated value of ActualSkew is (0, 1, 3), which does not meet the inter-cluster quantity constraint. Therefore, the excess tasks in the third cluster are adjusted to the first cluster. At this time, the value of ActualSkew is (0, 0, 1), which meets the constraint. The inter-cluster quantity adjustment is completed, and the resource node adjustment is similar.

[0164] 7. Scheduler

[0165] Perform actual scheduling, including sorting, filtering, pre-binding, binding and other workflows:

[0166] ① Sorting

[0167] The smart contract uses the Kmeans clustering method to classify and sort the batch tasks to be unloaded, ensuring the intrinsic correlation between tasks to the greatest extent and determining the order of unloading the batch tasks. When Kmeans clusters, it performs multi-dimensional clustering and must take into account the task attributes {S i , C i , D i , T i , F i , VM i S in} i 、C i 、D i 、T i The spatial system is constructed with UserId as a vector and the distance is calculated. Because the representation methods of each attribute column are different, each attribute needs to be normalized before clustering. The weight of each indicator needs to be considered during normalization. In fact, the parameter used for normalization is W1×S i 、W2×C i Similarly, all attributes participating in clustering are unified into a unit. In addition, outliers or noise data will have a greater impact on the mean, resulting in center shift, so we also need to detect outliers in the data. In this invention, the data of the point closest to the detected outlier is selected to replace it. This method can be improved in other ways. After the data preprocessing is completed, the elbow method is used to obtain the number of clusters K, and K samples are randomly selected as the initial cluster centers a = a1, a2, ... a k For each sample X in the dataset i Calculate its distance to the K cluster centers and divide it into the class corresponding to the cluster center with the smallest distance. j , recalculate its cluster center, the calculation method is C iis the i-th cluster. Repeat the cluster center calculation operation until the minimum error is less than 0.1, that is, clustering stops.

[0168] After clustering is completed, the results are as follows Figure 3 As shown in the task cluster, green represents ready tasks and orange represents waiting tasks;

[0169] ② Filter

[0170] Traverse the tasks in the order of uninstallation, add the ready tasks to the ready queue, and add other unready tasks to the waiting queue. The filtering process is as follows: Figure 3 The three queues shown in the figure are used to insert new tasks from the end of the queue and remove ready tasks from the head of the queue. The red ones indicate failed tasks waiting to be retried.

[0171] A task must meet two conditions to be ready: the task data has been obtained, the task's predecessor tasks have been completed, and the task result data of the predecessor tasks have been confirmed. Once the scheduler determines that the task is ready, it changes the task status to open;

[0172] ③Pre-binding

[0173] Traverse the run queue, for task t in the queue i , find the edge server node that meets the computing resources required by the task and minimizes its latency, and perform pre-binding for unloading. The priority level is calculated through the smart contract, and the pre-binding unloading order is obtained according to the ascending order of the level. The level is essentially the task t i The complete offloading time to the pre-bound resource node k includes the acquisition of task data, task execution, and the return of task results. This is a pre-inference based on the existing resource conditions (data matrix D and communication cost matrix B).

[0174] The data matrix D is a matrix of α×α, D ij Used to represent task t i and task t j The amount of data that needs to be transferred. Task t i and task t j When the nodes are on the same online resource, the amount of data that needs to be transmitted is 0. The communication cost matrix B is a β×β matrix, B ij It is used to represent the communication cost from online resource node i to online resource node j. In the pre-binding phase, the communication cost between tasks is marked with the average communication cost;

[0175] It should be noted that all task data acquisition is carried out in parallel, and the calculation result document is often much smaller than the original calculation data, so the return time of the calculation result data can be relatively negligible when modeling. iThe calculation method of the task data communication cost required for readiness is:

[0176] ④ Binding

[0177] Unload tasks according to the pre-unload order. Tasks that fail to be unloaded are added to the retry queue. When the ready queue is empty, the ready tasks in the waiting queue are added to the ready queue. Tasks in the retry queue will be retried when both the ready queue and the waiting queue are empty.

[0178] The binding phase must follow the fragmentation rate constraint: For example, when MemFragmentationRatio<1, assuming that the available CPU resources of the pre-bound resource node are 1000, task t i The actual CPU resource requested is 1200, which means that the current node is running at overload, which reduces the actual speed of task execution. When MemFragmentationRatio>1.6, assuming that the available CPU resource of the pre-bound resource node is 1000, task t i The actual CPU resource requested is 600. Because the current node is running exclusively, the CPU resource utilization is low, which reduces the operating efficiency of the entire system.

[0179] When the smart contract determines that the unloading schedule meets the fragmentation rate constraint, it starts the unloading task and records the system time of the current task start and the system time of the task end. The completion time of the task is recorded as the system time of the task end. The task execution time is recorded as the difference between the system time of the task end and the system time of the task start. f . t f Used to calculate the energy consumption of the entire system. Because the energy consumption of the server during operation is difficult to measure, there are considerable studies on the measurement of operating energy consumption. This paper only provides a rough assessment of the server energy consumption to provide a reference for edge computing service providers.

[0180] Indicates that the edge computing server is executing task t i In the process of running energy consumption, Indicates the average energy consumption of the CPU in operation, provided by the edge computing service provider when uploading resource node information; Indicates that the edge computing server is executing task t i Idle energy consumption during the process, Indicates the average energy consumption of the CPU in idle state, also provided by the edge computing service provider when uploading resource node information;

[0181] The execution cost of the system after completing α tasks can be expressed as:

[0182] Here, λ0 and λ1 represent scalar weights, representing the preference for this offloading event. Specifically, the system's preference for reducing the user's task execution latency or reducing the edge computing service provider's energy consumption is relative. Cost0 represents the unit price of renting an edge server, and Cost1 represents the unit price of energy purchased by the edge computing service provider.

[0183] 8. Database

[0184] This system implements on-chain and off-chain data storage, creating tables for all data structures and storing them in MongoDB. Maintaining on-chain and off-chain collaboration in this system requires at least seven MongoDB tables: Users, Tasks, Nodes, Edges, Algorithms, Offloading-Orders, and Task-List. In the consortium chain ledger, only five corresponding tables—Users, Tasks, Nodes, Algorithms, and Offloading-Orders—are required, each storing unique identifiers as key-value pairs. The MongoDB database and ledger can be expanded based on the system's specific needs.

[0185] The present invention provides a trusted distributed computing offloading method based on blockchain, which includes two parts: offloading decision-making and resource allocation, collectively referred to as task offloading decision-making. The offloading decision includes three methods: local execution, complete offloading and partial offloading. The offloading in the present invention refers to complete offloading; resource allocation mainly involves selecting which edge resource node to offload, and more specifically, it can also specify which processor to execute, which is included in task offloading in the present invention.

[0186] like Figure 4 As shown, the process of task offloading release and offloading decision using the method of the present invention is as follows:

[0187] Task offloading request release: including Figure 4 1-6 in the preceding example. A user issues a specific task offload request to the consortium chain, which verifies whether the offload request can be responded to (corresponding to 1-3). If so, the user uploads the task information, and the database updates the task list (corresponding to 5-6). Any user can become the task offload requester.

[0188] Task offloading decisions: including Figure 4 7-9 in the consortium chain. For each task, the consortium chain requires online resource nodes to pre-return the remaining resources after executing the task before executing it, so as to make decisions about the next task offloading, corresponding to 7-8. The online resource nodes then execute the task offloading smart contract, and the online resource node that obtains the pre-return result the fastest sends the result to the consortium chain, and then actually executes the task offloading, corresponding to 8-9.

[0189] Task deployment: including Figure 4 10. After the pre-offloading result is determined, the task offloading request user sends the data required for task calculation to the designated task offloading calculation execution node. Task deployment is directly executed by the user and the designated task offloading calculation execution node off-chain, without going through the consortium chain.

[0190] Task offloading execution: including Figure 4 After the task is deployed, the task is completed by the task offloading calculation execution node. Based on the current performance parameters of the node, the actual execution delay and execution energy consumption can be calculated and the results are returned to the alliance chain and the task offloading request user.

[0191] Task offloading results are uploaded to the chain: including Figure 4 13-14. When the user checks that the task is successful, the consortium chain will record the unloading order ID, task ID, user ID, online resource node ID and other information on the chain.

[0192] Task offloading results are fully stored: including Figure 4 15-16. When the task offloading results are uploaded to the chain, the database will record the offloading order ID, task ID, user ID, online resource node ID, task start time, task end time, task algorithm used, task execution cost and other information in the off-chain distributed database for easy later retrieval.

[0193] In summary: The present invention discloses a trusted distributed computing offloading method based on blockchain. First, a decentralized distributed alliance chain architecture for edge computing task offloading is established. Second, a clustering task offloading method with internal correlation between subtasks of complex computing tasks is proposed. Finally, the on-chain and off-chain data collaboration method is flexibly used to reduce the impact of blockchain on the task offloading latency requirements.

[0194] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art can still modify the technical solutions described in the aforementioned embodiments or replace some of the technical features therein with equivalents. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A trusted distributed computing offloading method based on blockchain, characterized by: A distributed system model consisting of users or task offloading demanders, edge computing service providers or resource providers, and alliance chains. Among them, the user or task offloading demander is the agent who needs to make a task offloading request at the current moment; there are multiple users issuing task offloading requests at the current moment, or a user provides multiple offloading tasks, and there may be data correlation between the tasks, that is, the calculation result of task one is the input data of task two; the edge computing service provider or resource provider is the agent of the edge computing server with idle resources at the current moment; there are multiple edge computing service providers at the current moment, or an edge computing service provider provides multiple edge computing servers, and each server is distributed in different regions; The consortium chain is responsible for processing and recording users' offloading requests and the resource distribution of edge computing service providers. It provides distributed services including registration, authentication, offloading requests, and resource release through deployed smart contracts. The task offloading decision-making method on the consortium chain includes the following steps: Step 1: Data collection: Users collect task data through IoT devices and upload the offload task information to the smart contract of the alliance chain. At the same time, the smart contract actively updates the resource status of all edge computing service providers; Step 2: Sorting: The smart contract uses clustering methods to classify and sort the batch tasks to determine the order in which they should be unloaded. Step 3: Filter: Traverse the tasks in the order of uninstallation, add the ready tasks to the ready queue, and add other unready tasks to the waiting queue; Step 4: Pre-binding: Traverse the running queue and, for each task in the queue, find the edge server node that meets the computing resources required by the task and minimizes its latency, and perform pre-binding for unloading. Step 5, Binding: Unload tasks according to the pre-unloading result obtained in step 4. Tasks that fail to be unloaded are added to the retry queue. When the ready queue is empty, the ready tasks in the waiting queue are added to the ready queue. Tasks in the retry queue will start retrying when both the ready queue and the waiting queue are empty. Step 6: Repeat steps 4 and 5 until all queues are empty. The task offloading is completed and the smart contract will record the result of this offloading. The distributed non-relational database MongoDB is responsible for storing the data generated during the entire task offloading process, including intermediate document records; The on-chain data storage only saves summaries of important data, including: user index, online node index, transaction list or task offloading record, digital fingerprint MD5 of calculation file, user signature and resource node signature. The above data is stored in the blockchain ledger of the consortium chain, referred to as Ledger. The off-chain data storage saves fully replicated data, including: task lists uploaded by users, user information, user behavior records, resource node information, resource node behavior records, algorithm information, and storage information of some intermediate data files generated during task calculations; the above data is stored in the collection of Mongodb's non-relational database, which is a table in the Mongodb database.

2. A blockchain-based trusted distributed computing offloading method according to claim 1, characterized in that: The smart contract deployed by the consortium chain is used to constrain the registration and initialization of users or edge computing service providers, including: Users or edge computing service providers register and log in to the alliance chain based on their own identity ID; The user or edge computing service provider signs the hash value, timestamp, and encrypted identity information using their own private key, and stores the signed hash value, timestamp, and encrypted identity information index in the on-duty node of the alliance chain; Edge computing service providers update resource information based on actual conditions; The edge computing service provider downloads the latest algorithm code from the designated URL to ensure the normal progress of task offloading; the smart contract uploads submission records and summary indexes to the chain, and stores complete user information and resource node information in the off-chain database.

3. A blockchain-based trusted distributed computing offloading method according to claim 2, characterized in that: When a smart contract unloading request occurs, the user uploads the task data to the consortium chain, including: The user initiates a task offloading request to the consortium chain; The consortium chain determines whether the user's request is reasonable based on its own smart contract and current resource conditions, and stores the task index contained in the request on the chain; If the judgment result is yes, the smart contract in the alliance chain authorizes the user to upload the task data. The blockchain node confirms the transaction based on the authorization submitted by the user and calls the authorization interface defined in the smart contract in the alliance chain to authorize the task data user. The authorized task data is stored off-chain. The off-load request is then sent to the scheduler to wait for task offloading, and the user behavior information is stored off-chain. If the result of the judgment is negative, the task offloading request is rejected; Call the uninstall algorithm in the scheduler to obtain the pre-uninstall result and perform the actual uninstall scheduling; When a smart contract offload request occurs, the edge computing service provider accesses the task data through the consortium chain, including: Receive the unloading request broadcast by the alliance chain, update the remaining resources after accepting the unloading, index the resource status on the chain, and store other information off-chain; Request the decrypted task index from the consortium chain, obtain the specified task URL and algorithm from the off-chain database based on the index, download the task file from the specified URL, and pre-load the algorithm; After obtaining the task file, calculate the MD5 of the file, compare it with the corresponding information on the chain, verify the digital signature, and determine whether the correct and complete file has been received; If the judgment result is yes, the task calculation work is carried out and the calculation result is returned to the requesting user, waiting for the user's confirmation; after the user confirms, the index information of the uninstallation result is uploaded to the chain, and the complete information of the uninstallation result is stored in the off-chain database; When the judgment result is no, an error report is submitted to the alliance chain, and the decrypted transaction data is requested again.

4. A trusted distributed computing offloading method based on blockchain according to claim 1, characterized in that: In step 1, the offloading task request only uploads the task summary information, and a small amount of data is written to the on-chain ledger between the user and the consortium chain. The resource table maintained in the system is updated simultaneously with the upload of the task offloading request summary information; Distributed computing offloading uses a directed acyclic graph (DAG), which is a directed graph without loops, to represent the dependencies between tasks, expressed as G = (V, E). Where V represents the set of nodes in the DAG, and each node i∈V represents a subtask in the running complex computing task; E represents the set of edges in the DAG, and each edge e(i,j)∈E represents the dependency relationship between tasks i and j. That is, task j requires the output data of task i as its input, and calls task i its predecessor, and task j is its successor. A task can only be executed after all its predecessor tasks are completed. Assume that the user set is represented by U = {u1, u2, ..., u n }, each user u i The uploaded task set is represented as T = {t1, t2, ..., t m }, the task set can represent a set of different types of computing tasks, each t i are composed of a set of vectors {S i , C i , D i , T i , F i , VM i }, used to describe the uninstallation task t i Attributes; among them, S i Represents task t i The size of the uploaded data, C i Indicates completion of task t i The number of CPU cycles required, D i Represents task t i The maximum delay that can be tolerated, T i Represents task t i Whether there is dependency, Fi represents task t i The predecessor tasks are represented by a set of vectors {t i1 ,t i2 ,...,t im } constitute, t ij =0or1, to represent the computation offloading task t j Is it t i The predecessor task, VM i Used to record tasks i Pre-uninstall results.

5. The blockchain-based trusted distributed computing offloading method according to claim 1, characterized in that: In step 2, it is assumed that the tasks submitted by the same user are likely to be related. The smart contract determines the initial category K of the task classification based on the elbow method, and then determines whether to classify the resource node based on the K value. The task attribute T i As an important attribute participating in clustering, the smart contract is specifically introduced as follows: The elbow method evaluates the K value by calculating SSE. When K reaches the optimal number of clusters, the decrease in SSE obtained by increasing K will drop sharply, thereby determining the optimal number of clusters K. The calculation method of SSE is expressed as: Among them, C i is the i-th cluster, p is C i The sample points in m i It is C i The center of mass; Assume that the total number of tasks that need to be offloaded is α, and the smart contract checks the number of online resource nodes β. The classification of resource nodes has the following constraints: When β≤α, the number of resource nodes participating in this offloading β=β; when When , the number of resource nodes participating in this offloading β = min{α, β}; When β>α, the number of resource nodes participating in this offloading is β=max{α, β×A}, A∈[0,1], which represents the percentage of samples taken from online resource nodes.

6. A trusted distributed computing offloading method based on blockchain according to claim 1, characterized in that: In step 3, by judging the task t i Whether task ti is ready is determined by whether its predecessor task is completed. If there is still an unfinished predecessor task, ti must wait for the task data of the predecessor task before it can execute its own computing task.

7. The blockchain-based trusted distributed computing offloading method according to claim 1, characterized in that: In step 4, the pre-binding of the uninstallation is performed through the smart contract, and the smart contract is specifically described as follows: Task t i Precursor task t j Task result data μ ij Must be transferred to t i The edge server where t i To execute, assume that task t i All predecessor tasks are completed and the task result data is transferred to the current task t i The computing resource node where the predecessor task F is located i to t i The communication time is calculated as R ij represents the transmission rate from resource node i to resource node j, assuming there is no data transmission delay when the predecessor task and the current task are on the same resource node; Pre-binding sorting is done by priority, priority in, represents the execution delay of the task on resource node i, f i Indicates the computing capacity of resource node i.

8. The blockchain-based trusted distributed computing offloading method according to claim 1, characterized in that: In step 5, the fragmentation rate of the current resource node is calculated, and scheduling is actually performed based on the fragmentation rate and the node situation allocated in the pre-binding stage. MemFragmentationRatio=MemAllocatable / MemRequest, When 1≤MemFragmentationRatio<1.6, it means that the current node is schedulable, and the actual offloading process has the following constraints: (1) All tasks submitted by users should be offloaded to the edge for execution; (2) Each uploaded task is atomic after being split and cannot be further split; (3) A task is assumed to be offloaded to only one online resource node; (4) Queue insertion operations must also retain priority constraints.

9. The blockchain-based trusted distributed computing offloading method according to claim 1, characterized in that: In steps 5 and 6, the time delay for completing the batch tasks and the energy consumption of the edge server will be accumulated. After all tasks are completed, the task completion rate will be calculated: The calculation method for the total latency of batch task completion is defined as: T total =Tfinal, T total It represents the total delay of completing batch tasks, and the completion time of the last completed task in the batch is the final completion time of the batch of tasks; The edge computing server processes the computing tasks t submitted by the user. i , the computational energy consumption of ti is defined as: Indicates that the edge computing server is executing task t i Energy consumption during the process, Indicates that the edge computing server is waiting for task t i Idle energy consumption during the process; The total energy consumption of the edge computing server after batch task offloading is defined as: E ij represents the offloading task j uploaded by user i; The task completion rate is defined as: F ij Indicates whether the uninstallation task j uploaded by user i is in D i Completed within, F ij =0or1, α represents the total number of tasks that need to be offloaded this time.