On-chain parallel inference task execution method and system based on embedded smart contract

By employing an on-chain parallel inference task execution method based on embedded smart contracts, this approach addresses the issues of long-term resource consumption and lack of unified constraints in the execution process of blockchain smart contracts during multi-node parallel computing. It achieves efficient and reliable task execution and result recording, thereby optimizing resource utilization.

CN122334518APending Publication Date: 2026-07-03CHENGDU UNIV OF INFORMATION TECH
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
CHENGDU UNIV OF INFORMATION TECH
Filing Date
2026-06-05
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Existing blockchain smart contracts suffer from problems in multi-node parallel computing scenarios, such as long-term on-chain resource occupation, lack of unified constraints in the execution process, inability of contract lifecycle to match task lifecycle, and scattered execution results that are difficult to statistically analyze, resulting in resource waste and low execution efficiency.

Method used

An on-chain parallel inference task execution method based on embedded smart contracts is adopted. Task metadata is published through a task management contract, and execution nodes autonomously select tasks and dynamically deploy embedded inference contracts. The contracts self-destruct upon completion. Combined with resource constraints and hash verification mechanisms, the integrity of model parameters and the credibility of execution results are ensured.

Benefits of technology

It enables efficient and reliable multi-node parallel computing in a decentralized environment, reduces on-chain storage overhead, ensures the fairness of task allocation and the transparency of execution results, and improves computing throughput and resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122334518A_ABST
    Figure CN122334518A_ABST
Patent Text Reader

Abstract

This invention provides a method and system for on-chain parallel inference task execution based on embedded smart contracts, belonging to the field of blockchain and distributed computing. The method includes: a publisher deploying a task management contract and publishing task metadata containing input data, model parameter summaries, and resource requirements; multiple execution nodes autonomously and randomly selecting tasks to be executed based on their own resource matching; each execution node submits complete model parameters, which are verified for completeness by the task management contract based on the model parameter summary, and then the corresponding embedded inference contract instance is dynamically deployed; the contract instance is injected with model parameters upon creation, performs forward propagation inference through fixed-point arithmetic operations, and immediately self-destructs after returning the result to the task management contract; this invention significantly reduces on-chain resource consumption through one-time embedded contracts, decentralized random task distribution, and fixed-point quantitative inference, achieving efficient and verifiable on-chain inference execution across multiple nodes.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the fields of blockchain and distributed computing, and in particular to an on-chain parallel inference task execution method and system based on embedded smart contracts. Background Technology

[0002] Blockchain technology, as a decentralized distributed ledger technology, enables trusted computing and data storage without the need for a trusted third party through consensus mechanisms and smart contracts. Smart contracts, as executable programs deployed on the blockchain, are subject to various constraints, including the blockchain virtual machine computing model, transaction-driven execution mechanisms, and block resource limitations.

[0003] As blockchain applications continue to expand, they are gradually extending from simple asset transfers to complex computational task execution scenarios. In particular, in scenarios involving computationally intensive tasks such as machine learning inference and data analysis, how to efficiently and controllably organize multiple nodes to complete tasks in parallel while ensuring decentralization and verifiability has become a significant technical challenge for blockchain systems.

[0004] Under current technological conditions, smart contracts typically employ a persistent execution model, which involves continuously maintaining task state, computational parameters, and execution results through long-term deployed contract instances. This model has significant shortcomings when dealing with computational tasks exhibiting the following characteristics: 1. The task can be broken down into multiple independent subtasks, suitable for parallel execution by multiple computing nodes; 2. Task execution has a distinctly short lifespan, and once completed, there is no need to retain execution logic and intermediate states for an extended period; 3. The participating nodes exhibit heterogeneity in terms of computing power, execution speed, and availability, and node participation has a degree of randomness.

[0005] For the above scenarios, existing technologies mainly adopt the following types of implementation solutions: (1) Multiple call execution scheme based on persistent smart contracts This type of solution deploys the complete computational logic and task parameters permanently in an on-chain smart contract, with different nodes executing the task by calling the same contract function multiple times through transactions. The contract records and constrains the node execution behavior by maintaining execution state variables. While this solution has a relatively simple structure, the computational logic and state continuously consume on-chain storage resources due to the long-term existence of the contract. Furthermore, in scenarios with multiple nodes executing in parallel, it is prone to state contention and duplicate execution issues. Additionally, the contract state needs to remain on-chain for an extended period after task execution, creating unnecessary state maintenance burdens and making it difficult to adapt to the execution needs of short-lifecycle computational tasks.

[0006] (2) Hybrid scheme based on off-chain parallel computing and on-chain result submission To alleviate the problem of limited on-chain computing resources, some existing technologies completely or partially transfer complex computational logic to off-chain execution, only performing result submission or status registration on-chain. This type of solution has certain advantages in computational efficiency, but its correctness verification mechanism is relatively complex, and in scenarios with multiple nodes executing in parallel, it is difficult to achieve fine-grained control and unified constraints on node execution behavior. It typically requires the introduction of additional trust assumptions or arbitration mechanisms, making it difficult to uniformly audit the execution process involving multiple nodes without a trusted intermediary. Therefore, it is not suitable for task execution scenarios where execution nodes participate autonomously and there is no central scheduling.

[0007] (3) Task execution scheme based on centralized scheduling or fixed allocation Some existing solutions centrally allocate computational tasks by setting up unified scheduling logic on-chain or off-chain. The scheduler assigns tasks to specific nodes for execution based on node registration information or preset rules. After the nodes complete the computation, they send the results back to the blockchain for verification and recording. This type of solution is feasible for small-scale tasks or a limited number of nodes, but its execution efficiency and robustness are highly dependent on the stability and trustworthiness of the scheduling nodes, which weakens the autonomy of decentralized systems to some extent. Task allocation and scheduling often rely on off-chain scripts or centralized control logic, lacking a mechanism that allows execution nodes to autonomously select tasks and form verifiable execution paths on the blockchain without centralized scheduling.

[0008] (4) Traditional "two-step" deployment-invocation mode and fixed task set / image execution strategy In traditional smart contract execution models, after a user completes contract deployment, they still need to initiate an additional transaction to trigger the specific execution logic. Since deployment confirmation and transaction execution rely on block packaging and on-chain consensus processes respectively, this "two-step" execution mode introduces additional waiting time, thus reducing overall response efficiency in multi-tasking or high-frequency execution scenarios. Furthermore, in multi-node collaborative execution scenarios, existing methods typically employ fixed task sets or mirrored execution strategies, where multiple worker nodes execute the same computational tasks in the same order. While this mechanism ensures result consistency, it leads to a large amount of redundant computation, wasting on-chain resources and reducing overall execution efficiency.

[0009] In summary, existing technologies still have the following technical problems in application scenarios involving multi-node parallelism, heterogeneous computing power, and one-off computing tasks: (1) Under the premise of ensuring the verifiability of the on-chain execution process, it is difficult to effectively reduce the long-term occupation of on-chain storage and execution resources by one-time computing tasks. The execution mode based on persistent smart contracts requires the contract to reside on the chain for a long time. After the task is executed, its state and storage structure still need to be maintained, resulting in long on-chain resource occupation time and high execution cost, which limits the ability of smart contracts to support computationally intensive tasks.

[0010] (2) In multi-node task execution scenarios that do not require centralized scheduling, there is a lack of a unified mechanism that can clearly constrain the node execution behavior, execution count, and task selection process on the chain. The lack of unified on-chain constraints on task selection, execution count, and execution order can easily lead to problems such as uneven node execution, repeated execution of the same task by the same node, or scattered execution results that are difficult to count, making it difficult to ensure the controllability and consistency of the execution process.

[0011] (3) Existing smart contract execution models are unable to effectively manage state changes during multi-node parallel and multi-round task execution. The execution process lacks clear state boundaries and consistent execution semantics, resulting in scattered execution result records and statistical difficulties, which is not conducive to unified verification and performance analysis of the task execution process. Due to the blockchain operation mechanism with transactions as the basic execution unit, existing models are unable to uniformly manage state changes during multi-node parallel execution.

[0012] (4) The scheme that combines off-chain computation with on-chain submission reduces the on-chain computation pressure, but it is difficult to uniformly constrain and verify the execution process of multiple nodes without introducing an additional trust mechanism. Its correctness verification mechanism is relatively complex and usually requires reliance on a trusted third party.

[0013] (5) Existing technologies do not provide an effective contract lifecycle management mechanism for application scenarios where the execution logic is no longer needed after the task is completed, which leads to the execution logic not being released in a timely manner after the task is completed, further exacerbating the problem of waste of on-chain resources.

[0014] (6) The traditional “two-step” deployment-call mode introduces additional waiting time due to the separation of deployment and execution, which reduces the response efficiency in high-frequency task scenarios; while fixed task sets or mirror execution strategies force multiple nodes to repeatedly execute the same tasks, resulting in a waste of on-chain computing and storage resources, and making it impossible to achieve task-level parallelism and load balancing among heterogeneous nodes.

[0015] Therefore, there is an urgent need for a task execution mechanism for the blockchain environment to solve the technical problems of existing smart contracts in one-time computing tasks and multi-node execution scenarios, such as large on-chain resource overhead, lack of unified constraints in the execution process, difficulty in unified management of multi-node execution behavior, and inability to match the contract lifecycle with the task lifecycle. Summary of the Invention

[0016] The purpose of this invention is to overcome the shortcomings of existing technologies and provide an on-chain parallel inference task execution method and system based on embedded smart contracts. It aims to provide a decentralized execution framework designed specifically for blockchain environments to handle short-lifecycle, parallel computing tasks. Its technical advantages can be summarized in the following three aspects: 1. Short-lifecycle decoupling management mechanism for tasks and executors; 2. Decentralized task allocation mechanism based on resource constraints and randomization; 3. Embedded inference execution and verification method for on-chain virtual machines.

[0017] To achieve the above objectives, this application proposes an on-chain parallel inference task execution method based on embedded smart contracts, applicable to a system including a blockchain network and multiple execution nodes. The method includes: Task publishing steps: The publisher deploys a task management contract on the blockchain and publishes the task metadata of multiple inference tasks to the task management contract. Each task metadata includes input data, model parameter summary information, and resource requirement information. The model parameter summary information is used to verify the completeness of the complete model parameters required for the corresponding inference task. Task selection steps: Multiple execution nodes obtain the metadata of tasks in the pending state from the task management contract, and independently select tasks to be executed from the tasks in the pending state based on the matching of their own available resources and the resource demand information. Embedded contract instantiation and execution steps: For any selected task to be executed, the corresponding execution node submits the complete model parameters corresponding to the task to the task management contract. After the task management contract verifies the completeness of the complete model parameters based on the model parameter summary information, a corresponding embedded inference contract instance is dynamically deployed on the blockchain for the task. The embedded inference contract instance is injected with the complete model parameters when it is created, and calls the inference logic contained therein. It uses the injected complete model parameters to process the input data in the task metadata to obtain the inference result. Result recording and contract destruction steps: The embedded inference contract instance returns the inference result to the task management contract and triggers a self-destruct operation to remove itself from the blockchain state; the task management contract records the inference result and the corresponding execution node information.

[0018] As a further solution, the task publishing step further includes: The weight matrices of each layer of a neural network model with a preset structure are linearly expanded, and the expanded weight sequence is quantized to generate the complete model parameters; the complete model parameters or the expanded weight sequence are hashed to generate the model parameter summary information.

[0019] As a further solution, the complete model parameters or the expanded weight sequence are hashed using the Keccak256 hash algorithm to generate the model parameter summary information; the model parameter summary information in the task metadata includes the scaling factor, the bias vector of each layer, the hash value of each layer weight, and the length of each layer weight data.

[0020] As a further solution, in the task selection step, each of the multiple execution nodes independently and randomly selects a task to be executed from the tasks in the pending state based on the matching of their available resources with the resource demand information, including: The execution node selects tasks from the candidate tasks based on locally maintained records of executed tasks, or by querying the list of executed nodes for each task recorded in the task management contract, and in combination with the task's deadline block height constraint. The selected tasks meet the following conditions: the node's available resources are not less than the task's resource requirements, the current block height is not higher than the task's deadline block height, and the node has not executed the task before. The execution node determines one or more tasks to be executed from the candidate set using a random sampling algorithm.

[0021] As a further solution, in the embedded contract instantiation and execution steps, the task management contract verifies the completeness of the full model parameters, including: The task management contract performs the same hash calculation on the received complete model parameters as it does when generating the model parameter summary information, to obtain a real-time summary; The real-time summary is compared with the model parameter summary information in the task metadata. If they are consistent, the verification is successful.

[0022] As a further solution, the complete model parameters injected into the embedded inference contract instance are fixed-point quantized parameters; the embedded inference contract instance calls its own inference logic to process the input data using the injected complete model parameters, including: The embedded inference contract instance performs forward propagation computation of the neural network model by executing fixed-point arithmetic operations; the fixed-point arithmetic operations include weighted summation according to the neural network level, division operation with scaling factor applied, and ReLU activation function applied to obtain the inference result.

[0023] As a further solution, the result recording and contract destruction steps also include: After recording the reasoning result, the task management contract updates the status of the corresponding task to "completed" and adds the execution node address of the task to the list of executed nodes to prevent the same node from being executed repeatedly.

[0024] As a further solution, the result recording and contract destruction steps also include: During execution, the task management contract records the gas consumption and execution time of executing the embedded inference contract instance, and records them together with the inference result and the corresponding execution node information in the on-chain event log.

[0025] As a further solution, the task management contract allows different execution nodes to execute the same inference task separately and record the inference results generated by each execution node, forming a multi-node execution result set that can be used for consistency analysis.

[0026] On the other hand, the present invention also provides an on-chain parallel inference task execution system based on embedded smart contracts, deployed on a blockchain network, and used to execute an on-chain parallel inference task execution method based on embedded smart contracts as described in any of the preceding claims, the system comprising: The task management contract module, as a persistent smart contract on the blockchain, is configured as follows: Receive and store task metadata for multiple inference tasks submitted by the publisher. Each task metadata includes input data, model parameter summary information, and resource requirement information. Receive the complete model parameters submitted by the execution node, and verify their integrity using the model parameter summary information; Once the verification is successful, the deployment of the embedded inference contract instance for the corresponding task is triggered; Receive and record the inference results returned by the embedded inference contract instance; Furthermore, it allows different execution nodes to execute the same inference task separately and records the inference results generated by each execution node, forming a multi-node execution result set that can be used for consistency analysis; Multiple embedded inference contract instances, each of which is a one-time smart contract dynamically deployed for a specific inference task, configured as follows: During creation, complete model parameters verified by the task management contract module are injected; It calls its own inference logic and uses the injected complete model parameters to process the input data in the corresponding task metadata to obtain the inference result; After the reasoning result is returned to the task management contract module, a self-destruct operation is triggered.

[0027] Compared with related technologies, the on-chain parallel inference task execution method and system based on embedded smart contracts provided by this invention have the following advantages: 1. This invention introduces a one-time embedded smart contract execution mode of "deployment-execution-destruction." For each inference task, an independent embedded inference contract instance is dynamically deployed. The contract self-destructs immediately after completing a single inference iteration, releasing its occupied storage space and state data. Compared to traditional persistent smart contracts that require long-term residency on the blockchain, this invention avoids the computational logic and intermediate states continuing to occupy on-chain resources after the task is completed. This effectively reduces blockchain state bloat and storage overhead, making it possible to support large-scale, short-lifecycle one-time computational tasks in resource-constrained blockchain environments.

[0028] 2. This invention employs a mechanism where execution nodes autonomously select tasks. Each node filters locally based on its available resources and task resource requirements, and independently selects tasks from the candidate set using a randomization strategy, completely eliminating reliance on a centralized scheduler or fixed allocation strategy. This mechanism not only achieves natural distribution and load balancing of tasks across multiple heterogeneous nodes, avoiding single points of failure and performance bottlenecks, but also effectively prevents duplicate execution on the same node by recording the list of executed nodes on the blockchain, ensuring fairness in task allocation and overall system scalability.

[0029] 3. This invention quantizes the weights of the neural network model using signed integers and stores only the hash values ​​of the weights on the blockchain as integrity credentials. Execution nodes must submit the complete weights and pass hash comparison verification before triggering inference. This design significantly reduces the on-chain storage burden while ensuring the immutability of model parameters. The embedded inference contract utilizes fixed-point arithmetic operations (including weighted summation, scaling factor division, and ReLU activation) to efficiently complete forward propagation calculations under the constraints of the blockchain virtual machine instruction set, achieving reliable and reproducible execution of complex inference tasks in a decentralized environment.

[0030] 4. This invention records the execution status, execution nodes, inference results, gas consumption, and execution time of each task on-chain through a task management contract, and stores this information in the form of an event log, ensuring the transparency and immutability of the execution process. Multiple nodes are allowed to independently execute the same task and record the results separately, providing a data foundation for subsequent consistency comparisons, redundancy verification, and credibility assessments. Based on the on-chain event log, any third party can reconstruct statistical indicators such as the number of tasks completed, the degree of node participation, and the distribution of execution time, achieving reproducibility of performance evaluation and verifiability of experimental results.

[0031] 5. This invention introduces resource requirement descriptions (such as minimum available computing resources) during the task deployment phase. Execution nodes autonomously determine whether they meet the execution conditions based on their own computing power, enabling computing nodes with different performance characteristics to participate in task execution as needed. This design avoids the mandatory consistency assumption of node capabilities, effectively aggregates the dispersed heterogeneous computing resources in the network, and improves the overall system's computing throughput and resource utilization efficiency. Attached Figure Description

[0032] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0033] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.

[0034] Figure 1 A schematic diagram illustrating the steps of an on-chain parallel inference task execution method based on embedded smart contracts provided by the present invention; The purpose, features, and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0035] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0036] Example 1 Please see Figure 1 This embodiment provides an on-chain parallel inference task execution method based on embedded smart contracts, applicable to a system including a blockchain network and multiple execution nodes. The method includes: Task publishing steps: The publisher deploys a task management contract on the blockchain and publishes the task metadata of multiple inference tasks to the task management contract. Each task metadata includes input data, model parameter summary information, and resource requirement information. The model parameter summary information is used to verify the completeness of the complete model parameters required for the corresponding inference task. Task selection steps: Multiple execution nodes obtain the metadata of tasks in the pending state from the task management contract, and independently select tasks to be executed from the tasks in the pending state based on the matching of their own available resources and the resource demand information. Embedded contract instantiation and execution steps: For any selected task to be executed, the corresponding execution node submits the complete model parameters corresponding to the task to the task management contract. After the task management contract verifies the completeness of the complete model parameters based on the model parameter summary information, a corresponding embedded inference contract instance is dynamically deployed on the blockchain for the task. The embedded inference contract instance is injected with the complete model parameters when it is created, and calls the inference logic contained therein. It uses the injected complete model parameters to process the input data in the task metadata to obtain the inference result. Result recording and contract destruction steps: The embedded inference contract instance returns the inference result to the task management contract and triggers a self-destruct operation to remove itself from the blockchain state; the task management contract records the inference result and the corresponding execution node information.

[0037] It should be noted that this embodiment constructs a complete decentralized parallel inference task execution framework for blockchain environments. The method first uses a persistent on-chain task management contract to record multiple inference tasks from the task publisher and their metadata (including input data, model summaries for verification, and resource requirements). Subsequently, multiple independent execution nodes in the network, without central scheduling, autonomously and randomly select tasks from the task pool based on their own computing resources and task requirements.

[0038] Once a node selects a task, it must submit complete model parameters for hash verification by the task management contract. Upon successful verification, the system dynamically deploys a new, independent embedded inference contract instance for that task. This contract is injected with model parameters upon creation and immediately begins inference computation.

[0039] After the reasoning is complete, the contract returns the result to the task management contract and immediately triggers a self-destruct operation, achieving short lifecycle management of "creating on demand and destroying after use". Ultimately, all execution results, node information, and performance data are immutably recorded on the blockchain, thereby greatly reducing the long-term occupation of blockchain storage resources by traditional persistent contract models while ensuring the verifiability of the process and the reliability of the results.

[0040] The core concept of this invention lies in a decentralized execution framework specifically designed for blockchain environments, used to handle short-lifecycle, parallel computational tasks. Its technical advantages can be summarized in the following three aspects: Technical Advantage 1: Short lifecycle decoupling management mechanism for tasks and executors ("deployment-execution-destruction" model) This embodiment separates task management logic from specific task execution logic. A relatively persistent task management contract is set up (responsible for task publishing, scheduling, and status recording), while a brand-new, independent, one-time embedded inference contract is dynamically deployed for each specific computing task (such as inference). This contract is injected with task parameters during deployment, and self-destructs immediately after execution, with its lifecycle completely overlapping with the lifecycle of a single task.

[0041] This embodiment realizes the "on-demand creation and destruction" of computing logic, which greatly reduces the long-term occupation of on-chain state and optimizes storage resources; it solves the technical problem that traditional smart contracts reside on the chain for a long time, resulting in resource waste and making them unsuitable for one-time computing tasks.

[0042] Technical Advantage Two: Decentralized Task Allocation Mechanism Based on Resource Constraints and Randomization In this embodiment, the execution node independently and periodically pulls the pool of tasks to be processed from the task management contract off-chain. The node performs local filtering based on its available resources and the resource requirements declared in the task, and then autonomously selects and executes a task from the candidate set using a randomization strategy (such as probability selection or random maximum value). Simultaneously, contract-level records prevent the same node from repeatedly executing the same task.

[0043] This embodiment achieves load-balanced and manipulation-resistant task distribution without centralized coordination, making full use of the computing power of heterogeneous nodes; it solves the technical problem that existing technologies rely on centralized scheduling or fixed allocation, which cannot achieve efficient and balanced utilization of computing power in a decentralized environment.

[0044] Technical Advantage 3: Embedded Inference Execution and Verification Methods for On-Chain Virtual Machines This embodiment performs fixed-point quantization and linearized packaging of the weights in a neural network model (such as the MNIST classifier). When a task is published, only the hash value of the weights is stored on-chain as a verification credential. When an execution node triggers a task, it must submit complete weight data, which is then verified by the task management contract through hash comparison. Only after successful verification is the embedded inference contract allowed to use these weights to perform fixed-point arithmetic operations to complete the inference. The inference results and performance data (Gas consumption, time consumption) are recorded in on-chain events.

[0045] This embodiment balances the needs of storage costs and data integrity verification through an "off-chain storage, on-chain verification" model; it enables complex computations to run efficiently in environments such as EVMs through fixed-point quantization; the entire execution process and results can be reproduced and verified by third parties; and it solves the technical problem of how to efficiently and verifiably execute complex machine learning inference tasks on resource-constrained blockchain virtual machines (EVMs).

[0046] Furthermore, the task publishing step further includes: The weight matrices of each layer of a neural network model with a preset structure are linearly expanded, and the expanded weight sequence is quantized to generate the complete model parameters; the complete model parameters or the expanded weight sequence are hashed to generate the model parameter summary information.

[0047] Specifically, the core of this embodiment lies in clarifying the preprocessing method of model parameters and the specific composition of task metadata. The method first performs a deterministic linear expansion of the weight matrices of each layer of the neural network model, converting the multidimensional weights into a one-dimensional sequence. Then, it performs signed integer fixed-point quantization on the expanded weight sequence to generate complete model parameters that can be efficiently computed in the blockchain virtual machine. Subsequently, the Keccak256 hash algorithm is used to calculate the processed weight sequence, generating a hash digest for integrity verification.

[0048] Furthermore, in the task selection step, each of the multiple execution nodes independently and randomly selects a task to be executed from the tasks in the pending state based on the matching of its available resources with the resource demand information, including: The execution node selects tasks from the candidate tasks based on locally maintained records of executed tasks, or by querying the list of executed nodes for each task recorded in the task management contract, and in combination with the task's deadline block height constraint. The selected tasks meet the following conditions: the node's available resources are not less than the task's resource requirements, the current block height is not higher than the task's deadline block height, and the node has not executed the task before. The execution node determines one or more tasks to be executed from the candidate set using a random sampling algorithm.

[0049] Specifically, the core of this embodiment lies in clarifying the implementation logic of how execution nodes autonomously screen and randomly select tasks in a decentralized environment. This method first requires execution nodes to rigorously screen executable tasks based on multiple constraints: nodes must, based on local records or queries of the "list of executed nodes" maintained in the on-chain task management contract, and in conjunction with the task's deadline block height constraint, select tasks from all pending tasks that simultaneously meet three conditions: their available resources are not less than the task's resource requirements, their current block height is not higher than the task's deadline block height, and they have not executed the task themselves, thus forming a local candidate set.

[0050] Based on this, this embodiment further defines a randomization mechanism for task selection: the execution node determines one or more tasks to be actually executed in this instance from the candidate set formed above through a random sampling algorithm.

[0051] The technical significance of this design lies in the following: by using resource matching and time constraints, it ensures that only nodes with execution capabilities participate in specific tasks, avoiding execution failures due to insufficient resources; by using a node deduplication mechanism, it prevents the same node from repeatedly occupying the same task, ensuring the fairness of task allocation; and by using a randomized selection strategy, it achieves natural distribution and load balancing of tasks among multiple nodes, avoiding coordination conflicts between nodes and the phenomenon of task "buying up"; thus, in a completely decentralized and non-centralized scheduling environment, it maximizes the overall execution efficiency of the system and achieves spontaneous optimization of computing resources.

[0052] Furthermore, in the embedded contract instantiation and execution step, the task management contract verifies the completeness of the full model parameters, including: The task management contract performs the same hash calculation on the received complete model parameters as it does when generating the model parameter summary information, to obtain a real-time summary; The real-time summary is compared with the model parameter summary information in the task metadata. If they are consistent, the verification is successful.

[0053] Specifically, the core of this embodiment lies in clarifying the specific implementation method of the task management contract to verify the integrity of the complete model parameters submitted by the execution node. The method stipulates that when the execution node submits complete model parameters for a selected task to be executed, the task management contract first performs the same hash calculation as in the task publishing stage on the received complete model parameters, that is, it uses the hash algorithm (such as Keccak256) and processing rules that are completely consistent with those used to generate the original model parameter digest information to generate a real-time digest value.

[0054] Subsequently, the task management contract rigorously compares this real-time summary with the model parameter summary information pre-stored in the task metadata: only when the two are completely consistent will the system determine that the verification is successful and allow the subsequent deployment and execution of the embedded inference contract; if they are inconsistent, the execution request will be rejected.

[0055] The technical significance of this design lies in the fact that by performing lightweight hash comparisons on-chain instead of storing and comparing complete model parameters, the storage and computational overhead on-chain is greatly reduced while ensuring the integrity and immutability of model parameters. At the same time, this verification mechanism effectively prevents malicious nodes from tampering with model weights, replacing them with incorrect models, or submitting incomplete parameters, providing a fundamental guarantee for the correctness and reliability of subsequent inference results.

[0056] Furthermore, the complete model parameters injected into the embedded inference contract instance are fixed-point quantized parameters; the embedded inference contract instance calls its own inference logic to process the input data using the injected complete model parameters, including: The embedded inference contract instance performs forward propagation computation of the neural network model by executing fixed-point arithmetic operations; the fixed-point arithmetic operations include weighted summation according to the neural network level, division operation with scaling factor applied, and ReLU activation function applied to obtain the inference result.

[0057] Specifically, the core of this embodiment lies in clarifying the specific computational mechanism of the embedded inference contract when performing neural network calculations on the blockchain. This method first stipulates that the complete model parameters injected into the embedded inference contract are fixed-point quantized parameters, that is, weights and biases represented by signed integers, rather than floating-point numbers, to adapt to the instruction set constraints of the blockchain virtual machine, which either does not support floating-point operations or where floating-point operations are too costly.

[0058] Based on this, this embodiment further defines the specific method of forward propagation computation performed by the inference contract: the contract realizes the hierarchical computation of the neural network by performing fixed-point arithmetic operations. This process includes weighted summation according to the neural network level, division operation by applying scaling factor (i.e., division by global scaling factor α), and application of ReLU activation function (maximum value operation) to finally obtain the inference result.

[0059] The technical significance of this design lies in the fact that, through unified fixed-point quantization representation and fixed-point arithmetic operation rules, neural network inference, which originally required complex floating-point operations, can be executed efficiently and deterministically in a resource-constrained blockchain virtual machine environment. At the same time, since all operation rules are deterministic and reproducible, different execution nodes will inevitably obtain the same result when performing inference on the same input and the same model parameters, thereby ensuring the verifiability of the inference process and the consistency of the results.

[0060] Furthermore, the result recording and contract destruction steps also include: After recording the reasoning result, the task management contract updates the status of the corresponding task to "completed" and adds the execution node address of the task to the list of executed nodes to prevent the same node from being executed repeatedly.

[0061] Specifically, the core of this embodiment lies in clarifying the status update and duplicate execution protection mechanism of the task management contract after recording the inference result. The method stipulates that when the embedded inference contract instance successfully returns the inference result, the task management contract first updates the status of the corresponding task to "completed", marking that the task will no longer accept new execution requests; at the same time, it adds the execution node address that executes the task to the "executed node list" maintained by the task.

[0062] The technical significance of this design lies in its ability to construct a node-level anti-duplicate execution constraint mechanism by explicitly recording the execution status and execution node information of each task on the blockchain. For any subsequent execution requests from the same node for the same task, the task management contract can directly reject them by querying the list of executed nodes, effectively preventing the same node from repeatedly executing the same task. This not only avoids invalid duplicate calculations and waste of on-chain resources but also ensures the uniqueness of task execution and the simplicity of result recording, providing a fundamental guarantee for the overall execution order and statistical accuracy of the system.

[0063] Furthermore, the result recording and contract destruction steps also include: During execution, the task management contract records the gas consumption and execution time of executing the embedded inference contract instance, and records them together with the inference result and the corresponding execution node information in the on-chain event log.

[0064] Specifically, the core of this embodiment lies in the introduction of a performance data collection and on-chain evidence storage mechanism for the execution process. This method stipulates that during the execution of the embedded inference contract instance, the task management contract not only records the inference results and execution node information, but also needs to synchronously collect and record two key performance indicators: the gas consumption of executing the embedded inference contract instance and the time taken for the entire execution process.

[0065] Based on this, this embodiment further defines the method of storing these performance data: the above-mentioned gas usage and execution time, along with the inference results and execution node information, are recorded together in the on-chain event log.

[0066] The technical significance of this design lies in the fact that by recording execution costs and time consumption at the consensus level, it provides a traceable and tamper-proof basis for performance evaluation of the system. Gas usage reflects the computational resource cost required to execute a specific inference task, which can be used for subsequent resource pricing and node incentives; execution time reflects the node response speed and execution efficiency, which helps to identify high-performance nodes and optimize task allocation strategies.

[0067] Meanwhile, all data is publicly stored as event logs, allowing any third party to reconstruct the system's performance profile based on this data, enabling objective evaluation of task execution efficiency and cross-node comparisons, thus providing data support for the system's continuous optimization and governance.

[0068] Furthermore, the task management contract allows different execution nodes to execute the same inference task separately and record the inference results generated by each execution node, forming a multi-node execution result set that can be used for consistency analysis.

[0069] Specifically, the core of this embodiment lies in the introduction of a multi-node redundant execution mechanism. This method stipulates that the task management contract does not mandate that each task be executed only once, but rather allows different execution nodes to independently execute the same inference task and record the inference results generated by each node separately.

[0070] The technical significance of this design lies in the fact that by retaining records of multiple executions of the same task at the system level, a data foundation for consistency analysis is built. When multiple nodes perform inference on the same input and the same model, their outputs should theoretically be consistent. Any deviation may indicate abnormal node behavior, tampering of model parameters, or problems with the execution environment.

[0071] Therefore, this mechanism supports subsequent off-chain or on-chain redundant verification, result comparison, and credibility assessment, providing important guarantees for detecting malicious nodes, improving system fault tolerance, and enhancing the reliability of inference results. At the same time, the retention of multiple execution records also lays the foundation for more complex statistical analyses (such as majority voting consensus).

[0072] Example 2 This embodiment provides an on-chain parallel inference task execution system based on embedded smart contracts, deployed on a blockchain network, and used to execute the on-chain parallel inference task execution method based on embedded smart contracts as described in any of the embodiments above. The system includes: The task management contract module, as a persistent smart contract on the blockchain, is configured as follows: Receive and store task metadata for multiple inference tasks submitted by the publisher. Each task metadata includes input data, model parameter summary information, and resource requirement information. Receive the complete model parameters submitted by the execution node, and verify their integrity using the model parameter summary information; Once the verification is successful, the deployment of the embedded inference contract instance for the corresponding task is triggered; Receive and record the inference results returned by the embedded inference contract instance; Furthermore, it allows different execution nodes to execute the same inference task separately and records the inference results generated by each execution node, forming a multi-node execution result set that can be used for consistency analysis; Multiple embedded inference contract instances, each of which is a one-time smart contract dynamically deployed for a specific inference task, configured as follows: During creation, complete model parameters verified by the task management contract module are injected; It calls its own inference logic and uses the injected complete model parameters to process the input data in the corresponding task metadata to obtain the inference result; After the reasoning result is returned to the task management contract module, a self-destruct operation is triggered.

[0073] In a specific embodiment, the system initialization and on-chain embedded runtime environment construction are performed through the following steps: 1.1 Initialization of the runtime environment on the chain This invention first initializes a runtime context for embedded inference tasks in a blockchain execution environment; assuming the current blockchain network is Net, it satisfies the following conditions: supports dynamic deployment and destruction of smart contracts; supports external accounts triggering contract calls; and supports completing contract deployment, function calls, and state reclamation within a single transaction.

[0074] In this environment, the system is configured with the following set of basic parameters: in, Represents the set of basic parameters. This represents the remote call interface for blockchain nodes; Deploy an account for the system to initialize the on-chain task management contract; A set of worker node accounts that can participate in inference execution; The resource constraint parameters (including gas cap and pricing strategy) required for on-chain execution.

[0075] 1.2 Definition of the lifecycle boundary of the embedded task management contract To avoid the state bloat and resource consumption problems caused by the model residing on the chain for a long time, this invention adopts a round-level embedded contract model; in this model, each execution round r corresponds to an independent task management contract instance, whose lifecycle... Strictly limited to: in, The block time at which the contract deployment is completed; This is the time point at which all reasoning tasks in this round are completed.

[0076] The contract is no longer reused after its lifecycle ends, and its on-chain state is logically considered invalid, thus achieving state isolation between rounds.

[0077] 1.3 Initialization of Embedded Execution Parameters and Task Size Constraints During the system initialization phase, the global constraint parameters required for the embedded inference process are further determined, including: the maximum number of execution rounds R per round; and the maximum number of tasks that a single node is allowed to execute within a single round. Minimum available resource threshold for a single inference task The cutoff block height offset for the inference task. .

[0078] Formal representation as a set of parameters : The above parameters remain unchanged after system initialization and apply to all subsequent embedded inference tasks.

[0079] 1.4 Constraint declaration for embedded model execution mode.

[0080] In this step, the system explicitly defines the model's execution mode as an embedded one-time execution mode, that is: the neural network model does not exist as a resident contract; the model weights are not in the initialization phase.

[0081] In a specific embodiment, the system's model parameter packaging and task input preparation are performed through the following steps: 2.1 Parameter Normalization of Quantization Neural Network Models After system initialization, this invention performs parameter normalization on the neural network inference model to be executed; the model is a feedforward neural network with a fixed structure and its topology... This can be formally represented as: The number of neurons in the input layer, the first hidden layer, the second hidden layer, and the output layer are 400, 32, 16, and 10, respectively.

[0082] To adapt to on-chain execution environments, this invention adopts a fixed-point quantization model representation, and the model parameters consist of the following set: in, This represents the set of model parameters, with all weights and biases represented by signed 8-bit integers.

[0083] 2.2 Linear expansion of model parameters and load encapsulation To facilitate on-chain verification and transmission, this invention performs a deterministic linear expansion of the weight matrices for each layer; let the weight matrix be... The i-th and j-th elements are Then its linear expansion rule Defined as: After expansion, the weights of each layer form three one-dimensional integer sequences: , , and global scaling factor The bias parameters are encapsulated together into a unified model load object. : in, , , Weight matrices , , The weight sequence after linear expansion; This payload serves as the sole source of model parameters for subsequent task deployment and execution phases.

[0084] 2.3 Weight Consistency Verification Digest Generation To prevent execution nodes from replacing or tampering with model parameters during inference, this invention generates weight consistency verification data during the model parameter packaging stage. For each set of expanded weight sequences After encoding it as a byte sequence, calculate the hash value. : in, This represents the hash calculation function, and Bytes(·) represents the function that converts an integer sequence into a byte sequence in big-endian order.

[0085] Finally, a weighted verification tuple is formed. : in, Indicates the length of the weight sequence. for The corresponding hash value.

[0086] This verification tuple will be written into the on-chain task metadata during the task publication phase for weight integrity verification during the execution phase.

[0087] 2.4 Standardization of Inference Input Samples This invention performs a uniform, standardized preprocessing procedure on each input sample to be inferred. Let the original input be a grayscale image. After size normalization and pixel expansion, it is represented as: The input vector As the activation values ​​of the input layer of the model, they directly participate in the weighted accumulation operation during on-chain inference. Additionally, optional label hints can be added to the input samples. : The special value 255 indicates that the label is unknown and is only used for statistical analysis and not for inference calculations.

[0088] 2.5 Task-level binding of model and input After completing the model parameter encapsulation and input sample standardization, this invention binds the two into an independently executable inference task unit. Its formal representation is: in, Points to the complete model payload stored off-chain, used by the execution node to download the corresponding weight data before inference.

[0089] Based on the above embodiments, this system achieves: a standardized representation of quantized neural network parameters for on-chain execution; unified encapsulation and binding of model weights and inference inputs; a weight consistency summary generation mechanism that can be efficiently verified on-chain; and provides a deterministic and verifiable input basis for embedded inference execution.

[0090] In a more specific embodiment, the embedded task management contract and the one-time on-chain inference execution mechanism of this system are implemented in the following manner: 3.1 Deployment of the Embedded Task Management Unit After preparing the model parameters and inference inputs, this invention deploys an embedded task management contract on the blockchain to coordinate the allocation, execution, and retrieval of inference tasks.

[0091] The embedded task management unit exists as an independent instance in each running cycle, and its lifecycle is limited to the execution period of the current batch of tasks; this management unit is responsible for maintaining the task set. : Each of them Each is composed of a corresponding reasoning task unit.

[0092] By introducing a round-based deployment strategy, this invention avoids the state bloat problem caused by long-term resident contracts and ensures the recyclability of on-chain storage resources at the system level.

[0093] 3.2 Decentralized Task Selection Mechanism for Execution Nodes After the embedded task management unit is deployed, multiple execution nodes participate in task execution in parallel.

[0094] Each execution node, within a given time window, selects from the task set. The middle can choose a subset of tasks to be executed. : Where K represents the maximum number of tasks that a single execution node can process in one round.

[0095] This selection process has the following characteristics: Centralized scheduling: There is no single controller assigning tasks; Concurrent execution: Multiple nodes can trigger the execution of different tasks simultaneously; Execution count constraint: Each task is only allowed to be executed successfully once.

[0096] This mechanism ensures that the system can complete large-scale reasoning tasks within a limited time while maintaining its decentralized nature.

[0097] 3.3 Dynamic Instantiation of One-Time Embedded Inference Contracts When the execution node selects a task Then, the on-chain instantiation process of the embedded inference contract is triggered.

[0098] For each task, this invention dynamically deploys a one-time embedded inference contract instance, whose parameters are directly injected by the generated model payload.

[0099] The mathematical abstraction of this contract instance It can be represented as: in, This indicates that an embedded inference contract instance is dynamically deployed through blockchain smart contract creation instructions (such as the CREATE opcode), and the listed parameters are injected into the instance's storage space as constructor parameters; This is the address of the currently executing node, which is the sole controller of this inference contract.

[0100] By writing all model parameters during the construction phase, this invention avoids external state dependencies during the inference phase, thereby ensuring the determinism and reproducibility of the inference logic.

[0101] 3.4 Fixed-point arithmetic-driven on-chain forward inference computation The embedded inference contract instance receives the input vector Then, perform the complete forward propagation computation.

[0102] Activation values ​​of neurons in the first hidden layer The calculation is as follows: Activation values ​​of neurons in the second hidden layer for: Output vector of the output layer for: in, That is, if the input z is greater than 0 when applying the ReLU activation function, the output is Z itself; otherwise, the output is 0.

[0103] By uniformly employing integer multiplication and fixed-point scaling division operations, this invention enables neural network inference to be executed efficiently under the instruction set constraints of on-chain virtual machines.

[0104] 3.5 Determining the Reasoning Result and Marking the Task Completion Obtaining the output vector Subsequently, the embedded inference contract determines the final prediction result based on the maximum response principle. : That is: from Find the index of the neuron with the largest value in the model. This index is the predicted class of the input sample by the model. j is the iteration variable.

[0105] The prediction result serves as the task. The only valid output is recorded and a task completion signal is returned to the task management unit.

[0106] To prevent duplicate execution, each embedded inference contract instance immediately enters the "executed" state after completing inference and no longer accepts any subsequent calls.

[0107] 3.6 One-time contract self-destruction and on-chain resource recovery After the inference result is submitted, this invention triggers the self-destruct process of the embedded inference contract, removing it from the blockchain state; the storage space and remaining assets occupied in the contract are returned to the execution node address, thereby achieving: instantaneous existence of the inference execution logic; controllable growth of the on-chain state scale; and one-to-one correspondence between inference tasks and execution resources.

[0108] Based on the above embodiments, this system achieves: one-time embedded on-chain inference execution at the task level; static injection of neural network model parameters during the contract construction phase; automatic state cleanup and resource reclamation after inference execution; and a decentralized, multi-node parallel secure inference scheduling mechanism.

[0109] In a more specific embodiment, the task publishing and execution set determination mechanism of this system is configured as follows: 4.1 On-chain publication and registration of reasoning tasks After the embedded task management contract is deployed, the task issuer submits the model parameter summary and inference input sample constructed to the on-chain task management unit to form an inference task entity that can be recognized by the execution node.

[0110] For each inference task to be released The publisher registers the following set of information on the blockchain. : in, For cryptographic hash functions; Indicates the length in bytes of the corresponding weight matrix; This is the input sample for this task.

[0111] By storing only the weight hash on the chain instead of the complete weight content, this invention significantly reduces the on-chain storage burden while ensuring the integrity can be verified.

[0112] 4.2 Task Activation Conditions with Resource and Time Constraints To ensure that on-chain inference tasks are executed in a controlled environment, this invention sets resource requirement constraints and time constraints for each task.

[0113] Each task Associate the following constraint parameters : in, This indicates the minimum available computing resources required to perform the task; This indicates the upper limit of the block height at which the task can be executed.

[0114] Only if the execution node satisfies: At that time, the reasoning task unit Only then is it considered to be in an executable state. This indicates the amount of computing resources currently available to node s. This indicates the current block height of the blockchain network.

[0115] This mechanism isolates different computing power nodes at the logical level, preventing nodes with insufficient resources from triggering failed execution.

[0116] 4.3 Determining the task set on the execution node side After the task is published, the execution node retrieves the set of tasks that are currently executable by querying the task management contract. : Each execution node, based on a preset strategy, selects from the task set locally. Select a subset of tasks to be executed in this round. : Where K is the maximum number of tasks that can be executed in a single node in a single round.

[0117] This selection process does not rely on on-chain sorting or centralized scheduling. Execution nodes can independently complete the selection based on random, sequential, or probabilistic strategies, thereby improving the overall throughput of the system.

[0118] 4.4 Weighted Data Submission and Consistency Verification Determining the execution set Then, the execution node performs tasks accordingly. Submit the corresponding model weight data to the task management contract: The task management contract performs a consistency check process on-chain: in, For consistency verification judgment; And simultaneously verify: That is, the task management contract compares the length of the weight data submitted by the execution node with the length pre-registered by the publisher. Only when the two are completely equal is the submitted weight data considered to be structurally consistent with the original model. The task is allowed to enter the actual execution phase only when all of the above conditions are met.

[0119] This verification mechanism ensures that the execution node cannot tamper with the model structure or replace the weight content.

[0120] 4.5 Execution Set Locking and Repetitive Execution Protection To prevent the same execution node from processing the same task repeatedly, this invention maintains a set of execution markers in the task management contract. : When a certain execution node s successfully triggers the task After execution, its address is recorded in the corresponding set, so that subsequent duplicate requests from the same node are automatically rejected.

[0121] Through this mechanism, the present invention achieves node-level anti-duplicate execution, avoiding invalid duplicate calculations and waste of on-chain resources.

[0122] Based on the above embodiments, this system achieves: batch and structured on-chain deployment of inference tasks; secure binding of model weights and input samples; task activation mechanism based on resource and time constraints; autonomous determination of task execution sets by decentralized execution nodes; weight integrity verification and protection against duplicate execution.

[0123] In a more specific embodiment, the multi-node execution control and task selection strategy of this system is executed through the following steps: 5.1 Set of Execution Nodes and Parallel Execution Model After the task is published, there is a set of off-chain nodes in the system that have the ability to execute the task. (Execution node, worker node): Each execution node interacts independently with the on-chain embedded task management contract without relying on a centralized scheduler, thus forming a parallel and asynchronous task execution model.

[0124] This invention does not require strict synchronization between nodes, nor does it require the task completion order to be consistent with the release order, thereby avoiding global locks and serial bottlenecks.

[0125] 5.2 Maximum number of executions per node constraint mechanism To prevent a single node from occupying task resources without limit or continuously triggering idle execution, this invention sets a constraint on the maximum number of tasks that can be executed in a single round for each execution node.

[0126] For any execution node s, define the upper limit of the number of tasks that can be executed in this round. for: The execution node maintains a local counter during this round of execution. Execution will cease if one of the following termination conditions is met: in This represents the set of currently executable tasks.

[0127] This mechanism ensures load balancing and controllable execution of the system in multi-node parallel scenarios.

[0128] 5.3 Node-side task candidate set filtering and executability determination Before each task selection, the execution node constructs a local candidate task set based on publicly available on-chain information. : in, Indicates the currently available resources of the node; This represents the set of nodes that have already executed the task; a task is included in the candidate set only if it meets the resource, time, and node deduplication criteria.

[0129] 5.4 Randomized Task Selection Strategy Constructing the candidate set Then, the execution node selects a subset of tasks to be executed from this subset.

[0130] This invention allows for the use of a randomized selection mechanism, which is expressed in the following form: in: Sample represents the random sampling function, which can be uniform random, probability-weighted, or interval random.

[0131] By introducing randomized selection, this invention achieves the following at the overall system level: nondeterminism in task completion order; concurrent competition among multiple nodes for the same task; and natural distribution of execution load among nodes.

[0132] 5.5 Multi-node Redundant Execution and Result Independence This invention allows different execution nodes to perform the same task. To be executed independently: Since each execution triggers an independent embedded inference contract instance and records the results on the chain, the execution processes of different nodes are logically isolated from each other, and there is no problem of shared state pollution.

[0133] This mechanism provides a foundation for subsequent result comparison, redundancy verification, and robustness analysis.

[0134] Based on the above embodiments, through the multi-node execution control and task selection strategy, this system achieves: a task allocation mechanism without a centralized scheduler; node-level execution upper limit control to avoid resource monopoly; randomization and dedeterminism of task execution order; multi-node parallel and redundant execution capabilities; and natural adaptation to heterogeneous computing power nodes.

[0135] In a more specific embodiment, the system execution result recording, status verification, and statistical indicator calculation include the following steps: 6.1 Embedded Inference Execution and Result Generation When execution node s is targeting a specific task to be executed After submitting the execution request and passing the weight consistency check, the task management contract dynamically deploys the corresponding embedded inference subcontract instance in the same transaction.

[0136] This subcontract loads the complete model parameters during the construction phase and completes the inference calculation in a single call: in, This represents the final predicted category obtained by execution node s after performing inference for task i. This represents the forward propagation output of an embedded fixed-point neural network. These are all the weight parameters of the neural network. This is the bias for all hidden layers.

[0137] Once the reasoning is complete, the subcontract immediately returns the prediction result and triggers a self-destruct operation within the same transaction, thereby releasing on-chain storage and state resources.

[0138] 6.2 On-chain event-driven result recording mechanism Each successful task execution is recorded by the task management contract in the form of an event.

[0139] For the task And for execution node s, the system generates the following immutable on-chain event records: in, For on-chain event log entries, For the task Unique identifier, This indicates the block height at which the executed transaction was packaged.

[0140] Since the event log is part of the blockchain consensus data, the above execution results have inherent tamper-proof and traceability.

[0141] 6.3 Execution Status Verification and Node-Level Deduplication Confirmation After the task is completed, the task management contract synchronously updates the node execution flag, so that: This status update is used to verify subsequent execution requests and prevent the same node from executing the same task repeatedly.

[0142] Any subsequent execution request from node s must satisfy: Otherwise, the request will be rejected.

[0143] Through this mechanism, the present invention completes automatic verification of execution status and node-level anti-duplicate control on the chain.

[0144] 6.4 Fundamentals of Aggregation and Consistency Analysis of Multi-Node Execution Results Because this invention allows multiple nodes to execute the same task independently, therefore for the task... A set of execution results can be obtained. : This set of results provides a foundation for subsequent consistency analysis, redundancy verification, or credibility assessment.

[0145] Although on-chain aggregation is not mandatory in this embodiment, it can be completed off-chain through event logs. Statistical analysis.

[0146] 6.5 Statistical Methods for Execution Time and Performance Indicators This invention constructs a reproducible performance statistics system by combining on-chain event timestamps with off-chain wall clock times; the following time metrics are defined: single execution time For a certain execution record ,definition: in, and These are the wall clock times at the moments when the transaction was sent and confirmed, respectively. Execute tasks for node s The execution time of a single inference operation.

[0147] Release – Total execution time for a round of task sets ,definition: in, This represents the "total release-execution time" of a task set, that is, the duration from the release of the first task to the completion of the last task. This indicates the moment (wall clock time or block timestamp) when the first task in this round is published onto the chain. This indicates the moment when the last task in this round of tasks was completed (the wall clock time or block timestamp for confirming the transaction packaging).

[0148] Average execution load per node: the number of tasks completed by execution node s. for: This metric is used to measure node participation and load distribution.

[0149] 6.6 Statistical Reproducibility Based on Event Logs Since all execution results, execution node addresses, and block heights are recorded on the blockchain as events, any third party can reconstruct the following statistical results based on the public blockchain data: the number of tasks completed in each round; the number of tasks completed per node; the execution status of the same task across multiple nodes; the execution time distribution and overall throughput. This ensures the verifiability and reproducibility of the experimental results.

[0150] Based on the above embodiments, this system achieves: one-time embedded inference execution and immediate resource release; on-chain immutable recording of execution results; automatic verification of execution status and node-level deduplication; independent retention of execution results from multiple nodes; and reproducible statistical analysis capabilities based on event logs.

[0151] The above are only some embodiments of this application and do not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. An on-chain parallel inference task execution method based on embedded smart contract, applied to a system comprising a blockchain network and a plurality of execution nodes, characterized in that, The method includes: Task publishing steps: The publisher deploys a task management contract on the blockchain and publishes the task metadata of multiple inference tasks to the task management contract. Each task metadata includes input data, model parameter summary information, and resource requirement information. The model parameter summary information is used to verify the completeness of the complete model parameters required for the corresponding inference task. Task selection steps: Multiple execution nodes obtain the metadata of tasks in the pending state from the task management contract, and independently select tasks to be executed from the tasks in the pending state based on the matching of their own available resources and the resource demand information. Embedded contract instantiation and execution steps: For any selected task to be executed, the corresponding execution node submits the complete model parameters corresponding to the task to the task management contract. After the task management contract verifies the completeness of the complete model parameters based on the model parameter summary information, a corresponding embedded inference contract instance is dynamically deployed on the blockchain for the task. The embedded inference contract instance is injected with the complete model parameters when it is created, and calls the inference logic contained therein. It uses the injected complete model parameters to process the input data in the task metadata to obtain the inference result. Result recording and contract destruction steps: The embedded inference contract instance returns the inference result to the task management contract and triggers a self-destruct operation to remove itself from the blockchain state; the task management contract records the inference result and the corresponding execution node information.

2. The on-chain parallel inference task execution method based on embedded smart contracts according to claim 1, characterized in that, The task publishing step further includes: The weight matrices of each layer of a neural network model with a preset structure are linearly expanded, and the expanded weight sequence is quantized to generate the complete model parameters; the complete model parameters or the expanded weight sequence are hashed to generate the model parameter summary information.

3. The method for executing on-chain parallel inference tasks based on embedded smart contracts according to claim 1, characterized in that, The complete model parameters or the expanded weight sequence are hashed using the Keccak256 hash algorithm to generate the model parameter summary information; the model parameter summary information in the task metadata includes the scaling factor, the bias vector of each layer, the hash value of each layer weight, and the length of each layer weight data.

4. The method for executing on-chain parallel inference tasks based on embedded smart contracts according to claim 2, characterized in that, In the task selection step, each of the multiple execution nodes independently and randomly selects a task to be executed from the tasks in the pending state based on the matching of its available resources with the resource demand information, including: The execution node selects tasks from the candidate tasks based on locally maintained records of executed tasks, or by querying the list of executed nodes for each task recorded in the task management contract, and in combination with the task's deadline block height constraint. The selected tasks meet the following conditions: the node's available resources are not less than the task's resource requirements, the current block height is not higher than the task's deadline block height, and the node has not executed the task before. The execution node determines one or more tasks to be executed from the candidate set using a random sampling algorithm.

5. The on-chain parallel inference task execution method based on embedded smart contracts according to claim 1, characterized in that, In the embedded contract instantiation and execution steps, the task management contract verifies the completeness of the full model parameters, including: The task management contract performs the same hash calculation on the received complete model parameters as it does when generating the model parameter summary information, to obtain a real-time summary; The real-time summary is compared with the model parameter summary information in the task metadata. If they are consistent, the verification is successful.

6. The method for executing on-chain parallel inference tasks based on embedded smart contracts according to claim 1, characterized in that, The complete model parameters injected into the embedded inference contract instance are the parameters after fixed-point quantization. The embedded inference contract instance invokes its own inference logic to process the input data using the injected complete model parameters, including: The embedded inference contract instance performs forward propagation computation of the neural network model by executing fixed-point arithmetic operations; the fixed-point arithmetic operations include weighted summation according to the neural network level, division operation with scaling factor applied, and ReLU activation function applied to obtain the inference result.

7. The on-chain parallel inference task execution method based on embedded smart contracts according to claim 1, characterized in that, The result recording and contract destruction steps also include: After recording the reasoning result, the task management contract updates the status of the corresponding task to "completed" and adds the execution node address of the task to the list of executed nodes to prevent the same node from being executed repeatedly.

8. The method for executing on-chain parallel inference tasks based on embedded smart contracts according to claim 1, characterized in that, The result recording and contract destruction steps also include: During execution, the task management contract records the gas consumption and execution time of executing the embedded inference contract instance, and records them together with the inference result and the corresponding execution node information in the on-chain event log.

9. The method for executing on-chain parallel inference tasks based on embedded smart contracts according to claim 1, characterized in that, The task management contract allows different execution nodes to execute the same inference task separately and record the inference results generated by each execution node, forming a multi-node execution result set that can be used for consistency analysis.

10. An on-chain parallel inference task execution system based on embedded smart contracts, deployed on a blockchain network, and used to execute the on-chain parallel inference task execution method based on embedded smart contracts as described in any one of claims 1 to 9, characterized in that, The system includes: The task management contract module, as a persistent smart contract on the blockchain, is configured as follows: Receive and store task metadata for multiple inference tasks submitted by the publisher. Each task metadata includes input data, model parameter summary information, and resource requirement information. Receive the complete model parameters submitted by the execution node, and verify their integrity using the model parameter summary information; Once the verification is successful, the deployment of the embedded inference contract instance for the corresponding task is triggered; Receive and record the inference results returned by the embedded inference contract instance; Furthermore, it allows different execution nodes to execute the same inference task separately and records the inference results generated by each execution node, forming a multi-node execution result set that can be used for consistency analysis; Multiple embedded inference contract instances, each of which is a one-time smart contract dynamically deployed for a specific inference task, configured as follows: During creation, complete model parameters verified by the task management contract module are injected; It calls its own inference logic and uses the injected complete model parameters to process the input data in the corresponding task metadata to obtain the inference result; After the reasoning result is returned to the task management contract module, a self-destruct operation is triggered.