Design method and application of smart contract for government chain supervision driven by AI

By using AI-driven smart contract design method on the government chain, the problem of data normalization processing difficulties and the difficulty of automatic supervision implementation of blockchain technology during model training and inference is solved, and the smart contract on the government chain is realized Autonomous perception and efficient supervision.

CN118917945BActive Publication Date: 2025-02-07上海市大数据中心
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410959856.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2025-02-07
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

Blockchain technology encounters data normalization processing difficulties during model training and inference, and the distributed characteristics of the government chain lead to difficulty in implementing automated supervision.

Method used

Using AI-driven government chain supervision smart contract design method, the off-chain pre-training isoCNN algorithm is integrated into a model to generate contract codes to realize the automated supervision of on-chain smart contracts.

Benefits of technology

It solves the bottleneck of on-chain model training and the difficulty of automated supervision, realizes the independent perception, intelligent deduction and abnormal detection capabilities of smart contracts on the government chain, and improves supervision efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118917945B_ABST
    Figure CN118917945B_ABST
Patent Text Reader

Abstract

The present invention provides a design method and application of an AI-driven government chain supervision smart contract, which relates to the field of smart contract technology. The processing method includes sequentially executing a data acquisition step, an off-chain pre-training step, an on-chain contract conversion step, and an on-chain contract embedding step to ensure that the smart contract on the government chain is triggered to automatically execute subsequent interactive operations while realizing intelligent supervision of the smart contract on the government chain. While solving the problems of normalizing various types of data required for algorithm training and reasoning and improving data quality, the present invention integrates the algorithm that has completed off-chain training into a model, and generates a smart contract suitable for the government chain by means of contract code conversion, thereby realizing automated supervision based on on-chain smart contracts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart contract technology, and in particular to a design method and application of an AI-driven government chain supervision smart contract. Background Art

[0002] At present, blockchain is widely used in digital finance, Internet of Things, intelligent manufacturing, supply chain management, item traceability, digital asset trading and other fields. However, blockchain technology is still in the development stage, and it has problems such as low degree of contract intelligence, inability to support parallel complex calculations such as deep learning, and insufficient supervision of chain-related businesses.

[0003] With the development trend of blockchain technology, it can be determined that the integration of blockchain and AI technology is an inevitable trend for large-scale AI applications and chain architecture. Because the combination of blockchain and AI technology can, on the one hand, realize decentralized AI model training, configure training resources, ensure the credibility of results, and record the contributions of all participants; on the other hand, AI can feed back the monitoring capabilities of the entire process of pre-detection, execution and training, execution, and optimization of smart contracts. In particular, AI can effectively solve the problem of insufficient execution performance of complex programs in chain contract technology in promoting the evolution of smart contracts, and promote the development of smart contracts towards deep intelligence. System supervision has always been an important direction for the improvement of engineering intelligence, and improving the intelligence of distributed systems through AI methods, that is, allowing the chain to have self-operation and self-regulation capabilities, is an innovative direction for this fusion technology to shift from centralization to distribution, and from theoretical research to practical applications.

[0004] Specifically, in this operation, the combination of blockchain and AI technology is applied to the government chain, and the main technical problems are as follows:

[0005] First, the input content of traditional AI model methods is often relatively simple, and the series of processes required for model training and reasoning, such as normalization processing, training, and reasoning of various types of data, cannot be directly implemented on the chain due to constraints such as diverse sources, complex rules, collection time, parameter transfer, and training set capacity. This undoubtedly adds new difficulties and challenges to the on-chain model training bottleneck originally caused by performance.

[0006] Secondly, the distributed nature of the chain restricts it from automatically troubleshooting abnormal problems on the chain like general ERP and MIS systems; and the government chain is a blockchain architecture applied to the government field. Compared with general blockchains, it has the characteristics of high complexity of multi-party interactions, high requirements for supervision, and high requirements for real-time operation and maintenance. This further makes it difficult to implement automated supervision on the government chain.

[0007] Based on this, this application provides an AI-driven government chain supervision smart contract design method and application to solve the difficulty in handling chain faults caused by the inability to directly implement the normalization processing of various types of data required for model training and reasoning due to diverse sources, complex rules, and collection time limits. This is a technical problem that needs to be solved urgently. Summary of the invention

[0008] The purpose of the present invention is to overcome the shortcomings of the prior art and provide an AI-driven government chain supervision smart contract design method and application. While solving the problems of normalization processing of various types of data required for model training and reasoning and improving data quality, the present invention integrates the algorithm for off-chain training into a model, and generates a smart contract suitable for the government chain through contract code conversion, thereby realizing automated supervision based on on-chain smart contracts.

[0009] In order to solve the existing technical problems, the present invention provides the following technical solutions:

[0010] An AI-driven government chain supervision smart contract design method, which sequentially executes data acquisition steps, off-chain pre-training steps, on-chain contract conversion steps, and on-chain contract update steps;

[0011] The data acquisition step includes: acquiring the on-chain log automatic collection data obtained by the log automatic collection method and the real-time interaction collection data obtained by the real-time interaction data collection method to construct a time series data set; the time series data set provides data support for the training and prediction of the isoCNN algorithm in the off-chain pre-training step;

[0012] The off-chain pre-training step includes: configuring the isoCNN algorithm off-chain, filtering out abnormal data from the massive data of the aforementioned time series data set through the configured isoCNN algorithm, and performing abnormal classification processing on the aforementioned abnormal data, thereby realizing the training and prediction of the aforementioned isoCNN algorithm;

[0013] The on-chain contract conversion step includes: integrating the isoCNN algorithm used off-chain into an initialization model and then converting the contract code to generate an initialization contract isoCNN-SCv1 suitable for the government chain;

[0014] The on-chain contract update step includes: after embedding the aforementioned initialization contract isoCNN-SCv1 into the main contract mainSC on the government chain, executing the aforementioned main contract mainSC deployed in the SmartDocker execution environment, so as to trigger the smart contract on the government chain to automatically execute subsequent interactive operations, while realizing intelligent supervision of the smart contract on the government chain.

[0015] Furthermore, the trigger includes triggering by users through transactions, triggering through automatic value collection of IoT connected to the government chain, triggering in Timer Circular scheduled tasks, triggering based on changes in on-chain environmental variables, and triggering based on external chains directly changing worldstate values ​​through cross-chain contracts.

[0016] Further, the construction comprises the steps of:

[0017] Through the preset log recording contract log-SC, the on-chain logs identified as abnormal data are automatically collected and the corresponding trigger and status values ​​on the chain are pushed forward, and recorded in the on-chain log book On-Rlog in a preset readable format; the on-chain log automatically collected data includes core operation records, system error codes and processing recovery records;

[0018] Through the main contract MainSC on the chain, the real-time interaction collection data of the sampling record is recorded in the real-time collection log On-Tlog in a preset readable format; the real-time interaction collection data includes the real-time on-chain interaction operations, error throwing and worldstate change data;

[0019] Run the timed trigger contract TT-C to aggregate the aforementioned on-chain log book On-RLog and the real-time collection log On-Tlog into the off-chain log export file Off-Lfile in different time periods.

[0020] Furthermore, when performing the collection operation, the aforementioned log automatic collection data and the aforementioned real-time interaction collection data are combined and processed into a time series vector set V corresponding to the data set Vdata;

[0021] The time series vector set V is expressed as The Limit (TIM) represents a total of K FAC-dimensional time series input factors decomposed from the off-chain log export file Off-Lfile in a time gradient TIM; the time series vector set V is represented by V FAC,K , is a three-dimensional vector based on a time series, that is: {υ fac,κ |υ fac,κ ∈V FAC,K}(1≤fac≤FAC,1≤κ≤K), where fac is the characteristic factor dimension of the time series variable and κ is the number of variables in the collected period;

[0022] The time series vector set V corresponds to a total of different processing method classification sets Ω, then z op =[z1,z2,…,z op ]∈Ω(1≤op≤OP), z opis a one-dimensional vector of OP dimension, where OP is the predicted exception handling method classification; wherein there is a conversion function f() to implement f():V→Ω.

[0023] Furthermore, the isoCNN algorithm is a combination of an isolation forest algorithm and a CNN neural network classification algorithm. The isolation forest algorithm can distinguish abnormal data from massive data, and the CNN neural network classification algorithm is used to perform abnormal classification on the abnormal data obtained by the aforementioned isolation forest algorithm.

[0024] The execution step S120 of the isoCNN algorithm includes:

[0025] S121, normalizing to generate a time series vector set V; converting a time series data set Vdata containing K FAC eigenvalues ​​to obtain a time series vector set V;

[0026] S122, setting and executing an isolation forest algorithm, wherein the isolation forest algorithm is composed of a plurality of lonely tree algorithms; wherein the lonely tree is configured as follows: setting two constants of the lonely tree: the number itr and the downsampling size By randomly downsampling Sampling(), ik eigenvalues ​​are selected to form the feature space X, that is, The lonely tree is recursively constructed by using the Itree() function with X and the preset maximum depth dl until the data values ​​in each time series vector set V are individually segmented or the predetermined depth of the tree is reached. The abnormal score Score(x,ik) of each x∈X is comprehensively calculated to obtain:

[0027]

[0028] Among them, AVG(PL(x,ik)) represents the average of the path length function PL(x,ik) of each downsampled eigenvalue x on tr lonely trees, and ω(ik) is the average path length that cannot be successfully searched when constructing a binary search tree for the lonely tree. Its value is only related to the vector space number ik, and the corresponding value is:

[0029]

[0030] Among them, δ = 0.577 is the Euler constant; the closer the abnormal score Score(x,ik) of each sampling feature x is to 1, that is, the faster it falls on the leaf node of the lonely tree, the more abnormal it will tend to be; the closer it is to 0.5, the more difficult it is to distinguish between abnormal values ​​and normal values;

[0031] S123, set the abnormality judgment cutoff point to 0.55, determine the abnormal vector set; when the abnormality score Score() value is in the interval [0.55,1], at this time, the sample x corresponds to V FAC,KThe original vector v in the center fac,s Classified into the exception vector set {x fac,s |x fac,s ∈A}, that is Where S is the number of vectors included in set A, s is the vector number and 0≤s≤S;

[0032] S124, generate a set of mixed vectors of class anomalies; when the value of the anomaly score Score() is in the interval [0.45, 0.55), the sample x is corresponding to V FAC,K The original vector v in the center fac,m Classify into abnormal mixed vector set {x fac,m |x fac,s ∈B}, that is Where M is the number of vectors included in set B, m is the vector number and 0≤m≤M;

[0033] S125, normalizing the abnormal classification input set; the abnormal classification input set integrates the aforementioned abnormal vector set and the class abnormal mixed vector set into:

[0034] {x fac,cn |x fac,cn ∈(C CN ←A S ∩B M )}, where CN is the total number of vectors in set C, cn is the vector number, and 0≤cn≤CN;

[0035] S126, using the above-mentioned abnormal classification input set as input data, executing the CNN algorithm; the CNN algorithm is provided with an input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer network structure, and executing the forward propagation of the CNN algorithm can obtain the corresponding abnormal classification disposal method;

[0036] S127, output the corresponding abnormal classification and disposal method; output the one-dimensional vector z op ∈Ω, OP is the predicted anomaly classification method.

[0037] Furthermore, the contract code conversion includes the steps of:

[0038] The isoCNN algorithm is pre-trained off-chain to generate an initialization model V1Model(f());

[0039] Use the Bcode() method to generate the initialization contract isoCNN-SCv1 for the aforementioned initialization model V1Model(f()), that is The Bcode() method can compile the aforementioned initialization model V1Model(f()) into low-level bytecode, thereby generating the initialization contract isoCNN-SCv1.

[0040] Furthermore, the aforementioned main contract mainSC deployed in the SmartDocker execution environment specifically executes step S130 including:

[0041] S131, prepare off-chain time series dataset;

[0042] S132, after completing the off-chain isoCNN algorithm training, pre-load the initialization contract isoCNN-SCv1 obtained by converting the corresponding contract code into SmartDocker;

[0043] S133, embed the aforementioned initialization contract isoCNN-SCv1 into the main contract mainSC;

[0044] S134, execute the main contract mainSC on the chain;

[0045] S135, collecting the execution results on the chain; the collection is intended to collect the factors affecting the worldstate on the chain as a result of the aforementioned execution;

[0046] S136, using the aforementioned time series data set to run the parameters of the initialization contract isoCNN-SCv1 in the SmartDocker environment;

[0047] S137, judging whether the preset on-chain contract upgrade condition is triggered; when the difference between the prediction capability in SmartDocker and the existing model reaches the preset critical value, the corresponding on-chain contract upgrade condition is met;

[0048] S138, if yes, upgrade the isoCNN algorithm after off-chain verification, perform contract code conversion on the corresponding model V2Model(f()) after the upgrade of the isoCNN algorithm to generate the updated contract isoCNN-SCv2, and complete the version audit before the contract upgrade;

[0049] S139, use the above-mentioned updated contract isoCNN-SCv2 to replace the initialization contract isoCNN-SCv1 in the SmartDocker execution environment.

[0050] Further, in step S136, when the parameters of the initialization contract isoCNN-SCv1 are run using the aforementioned time series data set in the SmartDocker environment, the running includes the steps of:

[0051] Run the aforementioned initialization contract isoCNN-SCv1 on the chain to record the changes in the parameters in the aforementioned initialization contract isoCNN-SCv1; the changes in the parameters are not directly used to adjust the parameters in the initialization contract isoCNN-SCv1 on the chain, but only to adjust the corresponding parameters of the isoCNN algorithm in the off-chain pre-training;

[0052] When the preset on-chain contract upgrade conditions triggered in step S137 are met, the aforementioned steps S137 to S139 are executed.

[0053] An AI-driven government chain supervision smart contract design system, including:

[0054] Network nodes, used to send and receive data;

[0055] Contract supervision module, used to supervise smart contracts;

[0056] A system server, wherein the system server is connected to the network node and the contract supervision module;

[0057] The system server is configured to: sequentially execute a data acquisition step, an off-chain pre-training step, an on-chain contract conversion step, and an on-chain contract update step; wherein the data acquisition step includes: acquiring on-chain log automatic collection data obtained by an automatic log collection method and real-time interaction collection data obtained by a real-time interaction data collection method to construct a time series data set; the time series data set provides data support for the training and prediction of the isoCNN algorithm in the off-chain pre-training step; the off-chain pre-training step includes: configuring the isoCNN algorithm off-chain, filtering out abnormal data from the massive data of the aforementioned time series data set through the configured isoCNN algorithm, and performing The on-chain contract conversion step includes: integrating the isoCNN algorithm used off-chain into an initialization model and then converting the contract code to generate an initialization contract isoCNN-SCv1 suitable for the government chain; the on-chain contract update step includes: embedding the aforementioned initialization contract isoCNN-SCv1 into the main contract mainSC on the government chain, and executing the aforementioned main contract mainSC deployed in the SmartDocker execution environment, so as to trigger the smart contract on the government chain to automatically execute subsequent interactive operations, while realizing intelligent supervision of the smart contract on the government chain.

[0058] A computer-readable storage medium having a computer program stored therein, wherein the computer program, when executed by a processor, implements the implementation steps of any of the above-mentioned AI-driven government chain supervision smart contract design methods.

[0059] Based on the above advantages and positive effects, the advantages of the present invention are:

[0060] One of the advantages is that it solves the problem of the difficulty in intercommunication between the original smart contracts and AI algorithms, and the lack of autonomous perception, intelligent reasoning, anomaly detection, and conflict prediction capabilities in terms of intelligence. It promotes the deep integration of government chain and AI technology, and gives the government chain a broader development prospect.

[0061] The second advantage is that after obtaining the output results of abnormal classification and disposal by training the isoCNN algorithm, it is preferred to obtain the method category of each execution disposal as the output, and continuously enrich the time series data set after the results are collected so that the execution disposal methods are continuously enriched; it can automatically execute the abnormal disposal smart contract for known abnormalities, synchronously collect the disposal results, and re-invest in isoCNN to determine whether the fault is repaired. For operations that cannot be repaired after one disposal, the alarm is recorded and re-thrown, recorded in the real-time collection log On-Tlog and connected to the manual disposal process first, and regularly added to the on-chain fault disposal contract library to improve regulatory efficiency.

[0062] The third advantage is that by demonstrating the separation of on-chain and off-chain regulatory processes, the core isoCNN algorithm is constructed, and designs and improvements are made in terms of data set magnitude control, effective abnormal and normal input configuration, output method and interactive conversion of disposal contracts, etc., which greatly reduces the data load for on-chain training and makes real-time on-chain disposal possible.

[0063] The fourth advantage is to set up SmartDocker to arrange the execution environment of the on-chain main contract mainSC embedded with isoCNN-SCv1. On the basis of training the off-chain model, follow up the generation of the corresponding on-chain contract after the off-chain algorithm is integrated into the model, so as to trigger the upgrade of the on-chain smart contract under a certain accumulation, so as to realize self-executing transaction processing covering all businesses. BRIEF DESCRIPTION OF THE DRAWINGS

[0064] Figure 1 A method flow chart is provided for the prior art.

[0065] Figure 2 A schematic diagram of multiple interaction modes based on smart contracts provided in an embodiment of the present invention.

[0066] Figure 3 A flow chart of an execution method of the isoCNN algorithm provided in an embodiment of the present invention.

[0067] Figure 4 A flow chart of a method for using SmartDocker to deploy a smart contract execution environment provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0068] The following is a further detailed description of the AI-driven government chain supervision smart contract design method and application disclosed in the present invention in combination with the accompanying drawings and specific embodiments. It should be noted that the technical features or combinations of technical features described in the following embodiments should not be considered isolated, and they can be combined with each other to achieve better technical effects. In the drawings of the following embodiments, the same reference numerals appearing in each drawing represent the same features or components, which can be applied to different embodiments. Therefore, once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.

[0069] It should be noted that the structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification for people familiar with this technology to understand and read, and are not used to limit the limiting conditions for the implementation of the invention. Any modification of the structure, change of the proportion relationship or adjustment of the size should fall within the scope of the technical content disclosed by the invention without affecting the effects and purposes that can be achieved by the invention. The scope of the preferred embodiments of the present invention includes other implementations, in which the functions can be performed in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by those skilled in the art of the technical field to which the embodiments of the present invention belong.

[0070] Techniques, methods, and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, the techniques, methods, and devices should be considered part of the authorization specification. In all examples shown and discussed herein, any specific values ​​should be interpreted as merely exemplary and not as limiting. Therefore, other examples of the exemplary embodiments may have different values.

[0071] Example

[0072] See also Figure 1 As shown, it is a method flow chart provided by this embodiment, which specifically shows that step S100 sequentially executes data acquisition step S101, off-chain pre-training step S102, on-chain contract conversion step S103 and on-chain contract update step S104, so as to trigger the smart contract on the government chain to automatically execute subsequent interactive operations while realizing intelligent supervision of the smart contract on the government chain.

[0073] In this embodiment, the interaction mode of the smart contract (SC) includes but is not limited to triggering, calling, creating, updating, reading and deleting operations, etc. Among them, when triggering a smart contract, the trigger includes triggering by the user through a transaction, triggering through the automatic collection of values ​​by IoT connected to the government chain, triggering in the Timer Circular scheduled task, triggering based on changes in various environmental variables on the chain, and triggering based on external chains directly changing the worldstate value through cross-chain contracts.

[0074] Since the aforementioned interactions can be set through rules of unlimited complexity, the interaction mode can be enriched by specifying behaviors under various specific conditions, which can ensure the execution of complex business processes and monitor environmental variables in real time to promptly detect abnormal situations and take corresponding emergency measures; it can also achieve safe and reliable interactions under the premise of flexibility through smart contract scheduling features and rules such as "separation of operation levels, communication rules first inside and then outside, avoidance of memory read and write confusion, narrowing of modification permissions, and sequentiality of operations".

[0075] Among them, the operation level separation is because the inter-contract calls are separated from the chain calls. The former is in the operation and maintenance layer of the six-layer architecture of infrastructure layer, contract layer, operation and maintenance layer, intelligent layer, presentation layer, and application layer, while the latter is in the contract layer. This reduces the complexity of calls and improves call performance; the inter-contract communication rule is internal first and external later because the inter-contract communication rule cannot perform intermediate calls and jumps like general languages. To protect the logic of the contract, it can only transfer (assets), call other smart contracts, and deploy new smart contracts after the contract return operation is completed; smart contracts are different from object-oriented languages. They will not directly read and write the status of other smart contracts. They communicate through messages rather than shared memory, avoiding memory read and write confusion; modification permissions are narrowed. For example, only applications can trigger smart contracts by sending event transactions (i.e., Transaction, which includes self-executing transactions automatically triggered by time and conditions within the chain); only smart contracts can send (Massage call) calls and execute other smart contracts; only smart contracts can read and modify the state value (worldstate) on the chain to prevent malicious tampering by other third parties or super permissions; the operation sequence is reflected in the fact that each state starts from the end state of the previous step to perform execution evaluation and trace recording on the smart contract SC, which also forms the basis for traceability.

[0076] Specifically, this embodiment is based on Figure 2As an example, a method of interaction of smart contracts in the government chain is demonstrated. The dotted arrows represent cross-chain interactions, and the circle represents the transfer between internal smart contracts in the government chain environment. Taking this chain as an example, after triggering the contract interaction, SC1 is responsible for triggering the collection to pass it to SC2, SC2 is responsible for classification, and gives it to a SC3 that performs a specific business. SC3 is a specific business execution contract, which can directly change the worldstate on the chain after execution.

[0077] Preferably, the data acquisition step S101 includes: acquiring the on-chain log automatic collection data obtained by the log automatic collection method and the real-time interaction collection data obtained by the real-time interaction data collection method to construct a time series data set. The time series data set provides data support for the training and prediction of the isoCNN algorithm in the off-chain pre-training step.

[0078] Specifically, as one of the preferred implementations of this embodiment, the construction includes step S110:

[0079] S111, through the preset log recording contract log-SC, automatically collects the on-chain logs identified as abnormal data, pushes forward the corresponding trigger and status values ​​on the chain, and records them in the on-chain log book On-Rlog in the preset readable format.

[0080] The on-chain log automatically collects data including core operation records, system error codes and processing recovery records.

[0081] Considering that in actual operation, the on-chain log automatically collects data from the on-chain operation log information, and most of the on-chain operation log information is recorded in the semi-structured on-chain operation log in the form of on-chain language, which also leads to the on-chain operation log information often having poor readability and cannot be used directly.

[0082] Therefore, in order to ensure the accessibility and readability of the aforementioned on-chain operation log information, this embodiment preferably designs a log recording contract log-SC, which automatically collects data for logs identified as abnormal data, pushes forward the corresponding trigger and status values ​​on the chain, and re-records them in the on-chain log book On-RLog in a readable format, so that the log recording contract log-SC can realize relevant interactions with various contracts through a period of on-chain operation, and realize timely collection of initial business data, chain operation failures, and abnormal code throwing.

[0083] S112, through the main contract mainSC on the chain, the real-time interactive collection data of the sampling record is recorded in the real-time collection log On-Tlog in a preset readable format.

[0084] The real-time interactive collection data includes but is not limited to real-time data such as a large number of trigger operations on the chain, interactive operations after triggering, error throwing and worldstate change data.

[0085] Considering that some real-time interaction collection data are ignored because they do not meet the scope of log core operation records, but are often of great reference significance for the generation of white samples and cause collection in time series data sets. To this end, this embodiment preferably adds some code to the main contract mainSC on the chain, and records the sampled normal process and the triggers and interactions captured on the chain in real time for each exception, as well as the related real-time worldstate status changes on the chain in a readable format, and records them in the real-time collection log On-Tlog.

[0086] In addition, it is worth mentioning that the worldstate represents a global view of the current state of the government chain, which includes the latest status of all accounts, smart contracts and related data.

[0087] The worldstate can be used for account management to store the balance of each account, nonce (used to prevent replay attacks) and other information. It can also be used for smart contract storage to save the code of the smart contract and the data generated during the execution process. It can also provide fast access to data on the government chain for easy query and verification. As new transactions occur, the worldstate will be continuously updated to reflect the latest status of the on-chain data.

[0088] S113, run the timer-transaction contract (TT-C) TT-C to collect the on-chain log book On-RLog and the real-time collection log On-Tlog into the off-chain log export file Off-Lfile in different time periods.

[0089] As one of the preferred implementations of this embodiment, when performing the collection operation, the aforementioned log automatic collection data and the aforementioned real-time interaction collection data are processed into a time series vector set V corresponding to the data set Vdata.

[0090] The time series vector set V is expressed as The Limit (TIM) represents a total of K FAC-dimensional time series input factors decomposed from the off-chain log export file Off-Lfile in a time gradient TIM. The time series input factor specifically refers to the cause of the trigger.

[0091] When the time series vector set V is expressed as V FAC,K , is a three-dimensional vector based on a time series, that is: {υ fac,κ |υ fac,κ∈V FAC,K}(1≤fac≤FAC,1≤κ≤K), where fac is the characteristic factor dimension of the time series variable and κ is the number of variables in the collected time period.

[0092] The time series vector set V corresponds to a total of different processing method classification sets Ω, then z op =[z1,z2,…,z op ]∈Ω(1≤op≤OP), z op is a one-dimensional vector of OP dimension, where OP is the predicted exception handling method classification; wherein there is a conversion function f() to implement f():V→Ω.

[0093] In addition, in the subsequent off-chain pre-training process, it is preferred to add a pre-detection step for the samples, that is, remove some insignificant logs and retain some logs with a large number of errors, so as to minimize noise interference and improve the accuracy of the initial training of the model.

[0094] At the same time, when processing data merging, the problem of merging some dimensional features of the same abnormal data in the real-time collection log On-Tlog and the on-chain log book On-Rlog is considered. Among them, the real-time data stored in the real-time collection log On-Tlog is often available faster than the data in the on-chain log book On-Rlog. Therefore, the relevant abnormal data is often written to the on-chain log book On-Rlog later.

[0095] Preferably, the off-chain pre-training step S102 includes: configuring the isoCNN algorithm off-chain, filtering out abnormal data from the massive data of the aforementioned time series data set through the configured isoCNN algorithm, and performing abnormal classification processing on the aforementioned abnormal data, thereby realizing the training and prediction of the aforementioned isoCNN algorithm.

[0096] Specifically, the isoCNN algorithm is a combination of an isolation forest algorithm and a CNN neural network classification algorithm. The isolation forest algorithm can distinguish abnormal data from massive data, and the CNN neural network classification algorithm is used to perform abnormal classification on the abnormal data obtained by the aforementioned isolation forest algorithm.

[0097] See Figure 3 As shown, the execution step S120 of the isoCNN algorithm includes:

[0098] S121, normalize and generate a time series vector set V.

[0099] Based on the time series data set Vdata containing K FAC eigenvalues, a time series vector set V is obtained.

[0100] S122, setting and executing an isolation forest algorithm, wherein the isolation forest algorithm is composed of a plurality of isolation tree algorithms. The isolation forest algorithm is represented by {Itree()}.

[0101] Wherein, the lonely tree is configured as:

[0102] Set two constants for lonely trees: number itr and downsampling size By randomly downsampling Sampling(), ik eigenvalues ​​are selected to form the feature space X, that is,

[0103] X and the preset maximum depth dl are recursively constructed into a lonely tree through the Itree() function until the data values ​​in each time series vector set V (the data values ​​are the values ​​of the data downsampled in the time series vector set V) are individually segmented, or the predetermined depth of the tree is reached, and the abnormal score Score(x,ik) of each x∈X is comprehensively calculated to obtain:

[0104] Among them, AVG(PL(x,ik)) represents the average of the path length function PL(x,ik) of each downsampled feature value x on tr lonely trees, and ω(ik) is the average path length that cannot be successfully searched when the lonely tree is constructed as a binary search tree (BST). Its value is only related to the vector space number ik, and the corresponding value is:

[0105] Among them, δ=0.577 is the Euler constant.

[0106] It is worth noting that the closer the anomaly score Score(x,ik) of each sampling feature x is to 1, that is, the faster it falls on the leaf node of the lonely tree, the more abnormal it will tend to be; the closer it is to 0.5, the more difficult it is to distinguish between outliers and normal values.

[0107] At the same time, since the algorithm hopes to absorb adjacent values ​​as much as possible and reduce judgment errors, for this reason, this embodiment preferably sets the abnormal judgment cutoff point to 0.55.

[0108] S123, setting the abnormality determination cutoff point to 0.55, and determining the abnormal vector set.

[0109] When the abnormal score Score() value is in the interval [0.55,1], the sample x corresponds to V FAC,K The original vector v in the center fac,s Classified into the exception vector set {x fac,s |x fac,s ∈A}, that is Where S is the number of vectors included in set A, s is the vector number and 0≤s≤S.

[0110] S124, generate a set of mixed vectors of class anomalies. When the value of the anomaly score Score() is in the interval [0.45, 0.55), the sample x is mapped to V FAC,K The original vector v in the center fac,m Classify into abnormal mixed vector set {x fac,m |x fac,s ∈B}, that is Where M is the number of vectors included in set B, m is the vector number and 0≤m≤M.

[0111] S125, normalizing the abnormal classification input set. The abnormal classification input set integrates the aforementioned abnormal vector set and the class abnormal mixed vector set into:

[0112] {x fac,cn |x fac,cn ∈(C CN ←A S ∩B M )}.

[0113] Where CN is the total number of vectors included in set C, cn is the vector number, and 0≤cn≤CN.

[0114] S126, using the aforementioned abnormal classification input set as input data, and executing the CNN algorithm.

[0115] The CNN algorithm is provided with an input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer network structure, and executing the forward propagation of the CNN algorithm can obtain the corresponding abnormal classification and disposal method.

[0116] In this embodiment, the convolutional layer and the pooling layer can appear in a CNN algorithm in groups. That is, the CNN algorithm can be sequentially configured as an input layer, a convolutional layer, a pooling layer, a fully connected layer, and an output layer network structure according to actual conditions, or can be sequentially configured as an input layer, N groups [convolutional layers and pooling layers], a fully connected layer, and an output layer network structure, where N is a positive integer greater than or equal to 2.

[0117] S127, output the corresponding abnormal classification and disposal method; output the one-dimensional vector z op ∈Ω, OP is the predicted anomaly classification method.

[0118] Based on this, the isoCNN algorithm completes off-chain pre-training.

[0119] As another preferred implementation of this embodiment, since the actual on-chain supervision will touch upon the "if-then" or "what-if" operations, the supervision and disposal methods with different variability may be caused based on which tasks are triggered, which changes in the values ​​of environmental variables are captured, which front-end IoT captures the problems of off-chain or edge computing triggers, and even the results generated by the pre-order off-chain pre-training. For this reason, in actual operation, it is preferred to select the smart contract for supervision according to actual needs.

[0120] In addition, it is also worth explaining that, considering that the ultimate goal of this embodiment is to realize the on-chain automated operation and supervision of smart contracts, therefore, after completing the off-chain pre-training, in order to realize the automated operation of the on-chain smart contracts, it is necessary to transplant the ability of the isoCNN algorithm obtained by the off-chain pre-training to identify abnormal data into the on-chain smart contracts. Specifically, the trained isoCNN algorithm can be modeled and then converted into an executable smart contract on the government chain.

[0121] Preferably, the on-chain contract conversion step S103 includes: integrating the isoCNN algorithm used off-chain into an initialization model and then performing contract code conversion to generate an initialization contract isoCNN-SCv1 suitable for the government chain.

[0122] It is worth noting that in order to ensure the executability of smart contracts in the initial execution of tasks, there is a situation where unconverged initial training cannot be performed in the chain production environment. Therefore, this embodiment preferably uses the isoCNN algorithm to implement off-chain pre-training, so that the isoCNN algorithm generates the initialization model V1Model(f()) after completing the off-chain pre-training.

[0123] Specifically, the contract code conversion includes the steps of: pre-training the isoCNN algorithm off-chain to generate an initialization model V1Model(f()); using the Bcode() method to generate the initialization contract isoCNN-SCv1 for the aforementioned initialization model V1Model(f()), that is,

[0124] In this embodiment, the golang language is preferably used to compile the aforementioned initialization model V1Model(f()) using the Bcode() method to generate the initialization contract isoCNN-SCv1.

[0125] The Bcode() method can compile the aforementioned initialization model V1Model(f()) into low-level bytecode, thereby generating the initialization contract isoCNN-SCv1.

[0126] Among them, when performing contract code conversion, taking the convolution layer of CNN in the isoCNN algorithm as an example, the Python version program code of conv() is converted into "0x1234561,96,11,11,0" which can be directly executed by the contract, that is, the convolution layer of CNN in the isoCNN algorithm completes the contract code conversion.

[0127] In addition, it is worth noting that the Bcode() method preferably refers to the control flow intermediate language, which is divided into a series of processes such as code writing, compilation, building an image in Docker, and sequential stacking and running, and compiles different backends into low-level bytecodes, thereby converting the mainstream program statements of the algorithm involved in the off-chain pre-training into small-capacity, low-level executable contract code that is conducive to fast execution.

[0128] Preferably, the on-chain contract embedding step S104 includes: after embedding the aforementioned initialization contract isoCNN-SCv1 into the main contract mainSC on the government chain, executing the aforementioned main contract mainSC deployed in the SmartDocker execution environment, so as to trigger the smart contract on the government chain to automatically execute subsequent interactive operations while realizing intelligent supervision of the smart contract on the government chain.

[0129] In this embodiment, before the aforementioned initialization contract isoCNN-SCv1 is embedded into the main contract mainSC on the government affairs chain, the execution environment of the main contract mainSC of the government affairs chain is Docker. The Docker itself provides a way to dynamically manage resources, which is used to control the memory and CPU resources required by each processing unit, and dynamically allocate and adjust these resources at runtime.

[0130] However, after solving the low-level bytecode conversion method of the isoCNN algorithm in pre-training off the previous chain, massive data calls will be encountered when solving the problem of the on-chain contract execution environment.

[0131] For example, when training the isoCNN algorithm, a large amount of data needs to be read in at one time for training, which involves the generation, recording and multi-layer transmission of a large number of parameters. At this time, it is necessary to realize fast dynamic occupation and release of RAM. The original Docker's resource calling ability obviously cannot meet the above requirements.

[0132] To this end, this embodiment configures a SmartDocker, which adds the following functions based on Docker:

[0133] One of the functions is to quickly exchange large quantities of data with memory.

[0134] To improve data processing speed, SmartDocker provides a mechanism that allows processing units to quickly and in large quantities access and exchange memory data. This can be achieved by combining the use of efficient memory data structures such as ConcurrentHashMap concurrent hash tables and ArrayList dynamic array data organization methods, thereby utilizing the shared memory mechanism of the Docker container to optimize performance.

[0135] Function 2: Dynamically apply for memory resources. SmartDocker further enhances Docker's resource management capabilities, allowing processing units to dynamically apply for and release memory resources. This can be achieved by extending Docker's resource management interface, allowing processing units to dynamically adjust the required memory resources according to data processing needs.

[0136] The third function is that SmartDocker introduces a new parallel computing model, which enables SmartDocker containers to execute parallel computing tasks more efficiently. Specifically, through the existing data sharding reading technology and contract parallel execution method, SmartDocker concurrently executes independent input and output tasks for different threads. Reasonable scheduling and execution of independent tasks that may be executed simultaneously increase and task concurrency.

[0137] For example, when designing code for building isoCNN, the loss function loss:=MSE(yTrue,yPred) can be calculated in parallel with the synchronously read currentOutput:=input to improve performance.

[0138] To this end, an efficient parallel computing framework is used, and the lightweight and portability of SmartDocker are utilized to optimize performance and scalability. It is able to quickly exchange large quantities of memory data, dynamically apply for memory resources, and implement parallel computing within SmartDocker, thereby completing the layout of the execution environment on the smart contract chain.

[0139] By way of example and not limitation, see Figure 4 The aforementioned main contract mainSC deployed in the SmartDocker execution environment specifically executes step S130 including:

[0140] S131, prepare off-chain time series dataset.

[0141] S132, after completing the off-chain isoCNN algorithm training, the initialization contract isoCNN-SCv1 converted from the corresponding contract code is pre-loaded into SmartDocker.

[0142] In this embodiment, preprocessing work is given priority; the preprocessing work includes pre-training the isoCNN algorithm under the previous chain, converting the corresponding generated initialization model V1Model(f()) into an initialization contract isoCNN-SCv1 that can be executed on the government chain through the golang language, and pre-loading the initialization contract isoCNN-SCv1 into SmartDocker.

[0143] At the same time, it also includes importing data from some time series data sets into memory for initial operation.

[0144] S133, embed the aforementioned initialization contract isoCNN-SCv1 into the aforementioned main contract mainSC.

[0145] S134, execute the main contract mainSC on the chain.

[0146] After completing the preprocessing work, the aforementioned initialization contract isoCNN-SCv1 is embedded in the main contract mainSC, and various situations are handled according to the established strategy; at the same time, the trigger conditions are recorded to generate rule data that can be added to the input set.

[0147] S135, collect the execution results on the chain.

[0148] The purpose of the collection is to collect the factors that affect the on-chain worldstate caused by the above-mentioned on-chain execution results. The influencing factors include changes in important environmental variables, whether the error problem is fixed, and whether a new error is triggered later.

[0149] S136, using the aforementioned time series data set to run the parameters of the initialization contract isoCNN-SCv1 in the SmartDocker environment.

[0150] Preferably, for the aforementioned step S136, the operation includes the steps of:

[0151] S1361, execute the aforementioned initialization contract isoCNN-SCv1 on the chain to record the changes in the parameters in the aforementioned initialization contract isoCNN-SCv1.

[0152] It is worth noting that, in this embodiment, the initialization contract isoCNN-SCv1 embedded in the main contract mainSC can achieve normal execution in the SmartDocker environment on the one hand, so as to realize the automatic disposal and intelligent supervision of abnormal data on the chain.

[0153] On the other hand, after collecting the execution results, the initialization contract isoCNN-SCv1 can continuously train the parameters of the initialization contract isoCNN-SCv1 on the chain and record the changes in the parameters. The changes in the parameters are not directly used to adjust the parameters in the initialization contract isoCNN-SCv1 on the chain, but only to adjust the corresponding parameters of the isoCNN algorithm in the off-chain pre-training, that is, it does not trigger direct changes in the execution program but only records the changes in the parameters. This design takes into account the particularity that the government chain needs to be modified more carefully, so no direct adjustments are made to production applications.

[0154] Specifically, the execution of the initialization contract isoCNN-SCv1 involves the discovery and disposal of abnormal data, which is specifically through the analysis of the initial on-chain log book On-RLog, the real-time collection log On-Tlog and the simulation of the various status values ​​and abnormal codes thrown out by the on-chain trigger-operation, so as to discover abnormal data in massive data and filter out the data required for abnormal disposal.

[0155] The exception classification and disposal classifies the output results of the initialization contract isoCNN-SCv1 into automated exception disposal or throwing an exception alarm; wherein, for the aforementioned automated exception disposal, the corresponding on-chain result status is collected, and for the aforementioned throwing an exception alarm, the corresponding manual disposal method is recorded.

[0156] Then, the aforementioned on-chain result status and the results of the manual handling method are added to the aforementioned time series data set and the subsequent off-chain pre-trained isoCNN algorithm to complete the verification. While continuously updating the aforementioned time series data set, the off-chain pre-trained isoCNN algorithm is used to verify the changes in the parameters in the on-chain initialization contract isoCNN-SCv1, so that the predicted exception handling methods are continuously enriched, and then the aforementioned manual handling method is iteratively trained to achieve automated exception handling.

[0157] In this process, we also consider the automated execution of exception handling smart contracts for known exceptions (some of which may be combined with the chain's own self-recovery contract execution), and synchronously collect the handling results before re-investing the isoCNN algorithm to verify whether the fault has been repaired. For operations that cannot be repaired after one handling, the alarm is recorded and re-thrown, and recorded in the real-time collection log On-Tlog and prioritized to access the manual handling process. By regularly adding to the on-chain fault handling contract library, the regulatory efficiency can be improved.

[0158] At this point, through on-chain execution, the parameter changes of the initialization contract isoCNN-SCv1 are fed back to the off-chain pre-trained isoCNN algorithm to complete the parameter verification.

[0159] S1362: When the preset on-chain contract upgrade conditions triggered in step S137 are met, execute the aforementioned steps S137 to S139.

[0160] S137, determine whether the preset on-chain contract upgrade conditions are triggered; when the difference between the prediction ability in SmartDocker and the existing model reaches the preset critical value (for example, setting the loss to be greater than a constant variable), the corresponding on-chain contract upgrade conditions are met.

[0161] The existence of this operation provides a basis for the subsequent upgrading of existing smart contracts, so that the upgraded smart contracts can adapt to higher versions of regulatory controls, handle more complex system problems or improve regulatory performance.

[0162] S138, when it is yes, upgrade the isoCNN algorithm after off-chain verification, convert the contract code of the corresponding model V2Model(f()) after the upgrade of the isoCNN algorithm to generate the updated contract isoCNN-SCv2, and complete the version audit before the contract upgrade.

[0163] After upgrading the smart contract, the isoCNN algorithm is upgraded off-chain and its validity is confirmed. Specifically, the off-chain isoCNN algorithm is verified again through the aforementioned time series data set, and the model V2Model(f()) corresponding to the verified isoCNN algorithm is converted into the updated contract isoCNN-SCv2 based on the golang language. The ability of the updated contract isoCNN-SCv2 to be embedded in the main contract mainSC on the chain is verified, thereby completing the version audit before the contract upgrade.

[0164] S139, use the above-mentioned updated contract isoCNN-SCv2 to replace the initialization contract isoCNN-SCv1 in the SmartDocker execution environment.

[0165] Once the updated contract isoCNN-SCv2 is confirmed to be valid, it will be loaded into SmartDocker and used for subsequent training and workflows.

[0166] This technical solution implements a highly automated workflow, which can greatly improve work efficiency and accuracy, especially when it comes to large-scale asset management and transactions.

[0167] For other technical features, please refer to the previous embodiments and will not be described in detail here.

[0168] In addition, the present invention also provides an embodiment, which provides an AI-driven government chain supervision smart contract design system 200, including:

[0169] The network node 201 is used to send and receive data.

[0170] The contract supervision module 202 is used to supervise the smart contract.

[0171] The system server 203 is connected to the network node 201 and the contract supervision module 202 .

[0172] The system server 203 is configured to: sequentially execute a data acquisition step, an off-chain pre-training step, an on-chain contract conversion step, and an on-chain contract update step; wherein the data acquisition step includes: acquiring on-chain log automatic collection data obtained by an automatic log collection method and real-time interaction collection data obtained by a real-time interaction data collection method to construct a time series data set; the time series data set provides data support for the training and prediction of the isoCNN algorithm in the off-chain pre-training step; the off-chain pre-training step includes: configuring the isoCNN algorithm off-chain, filtering out abnormal data from the massive data of the aforementioned time series data set through the configured isoCNN algorithm, and The normal data is classified and handled abnormally, thereby realizing the training and prediction of the aforementioned isoCNN algorithm; the on-chain contract conversion step includes: integrating the isoCNN algorithm used off-chain into an initialization model and then converting the contract code to generate an initialization contract isoCNN-SCv1 suitable for the government chain; the on-chain contract update step includes: after embedding the aforementioned initialization contract isoCNN-SCv1 into the main contract mainSC on the government chain, executing the aforementioned main contract mainSC deployed in the SmartDocker execution environment, so that the smart contract on the government chain is triggered to automatically execute subsequent interactive operations, while realizing intelligent supervision of the smart contract on the government chain.

[0173] For other technical features, please refer to the previous embodiments and will not be repeated here.

[0174] In addition, an embodiment of the present invention also provides a computer-readable storage medium on which a program is stored, which is used in the aforementioned AI-driven government chain supervision smart contract design system. When the program is executed by the processor, it can implement the steps of any of the above-mentioned AI-driven government chain supervision smart contract design methods.

[0175] For other technical features, please refer to the previous embodiments and will not be repeated here.

[0176] In the above description, within the scope of the target protection of the present disclosure, the components can be selectively and operatively combined in any number. In addition, terms such as "including", "comprising" and "having" should be interpreted as inclusive or open by default, rather than exclusive or closed, unless they are explicitly defined to the contrary. All technical, scientific or other terms have the meaning understood by those skilled in the art unless they are defined to the contrary. Common terms found in dictionaries should not be interpreted too idealistically or too impractically in the context of relevant technical documents, unless the present disclosure explicitly defines them as such.

[0177] Although the exemplary aspects of the present disclosure have been described for illustrative purposes, those skilled in the art should appreciate that the above description is only a description of the preferred embodiments of the present invention and is not intended to limit the scope of the present invention. The scope of the preferred embodiments of the present invention includes other implementations in which functions may not be performed in the order in which they appear or are discussed. Any changes or modifications made by those skilled in the art based on the above disclosure are within the scope of the claims.

Claims

1. A method for designing an AI-driven government chain supervision smart contract, characterized in that: Sequentially execute the data acquisition step, off-chain pre-training step, on-chain contract conversion step, and on-chain contract update step; The data acquisition step includes: acquiring the on-chain log automatic collection data obtained by the log automatic collection method and the real-time interaction collection data obtained by the real-time interaction data collection method to construct a time series data set; the time series data set provides data support for the training and prediction of the isoCNN algorithm in the off-chain pre-training step; The off-chain pre-training step includes: configuring the isoCNN algorithm off-chain, filtering out abnormal data from the massive data of the aforementioned time series data set through the configured isoCNN algorithm, and performing abnormal classification processing on the aforementioned abnormal data, thereby realizing the training and prediction of the aforementioned isoCNN algorithm; wherein the isoCNN algorithm is a combination of an isolation forest algorithm and a CNN neural network classification algorithm, the isolation forest algorithm can distinguish abnormal data from massive data, and the CNN neural network classification algorithm is used to perform abnormal classification processing on the abnormal data obtained by the aforementioned isolation forest algorithm; the execution step S120 of the isoCNN algorithm includes: S121, normalizing to generate a time series vector set V; converting a time series data set Vdata containing K FAC eigenvalues ​​to obtain a time series vector set V; S122, setting and executing an isolation forest algorithm, wherein the isolation forest algorithm is composed of a plurality of lonely tree algorithms; wherein the lonely tree is configured as follows: setting two constants of the lonely tree: the number itr and the downsampling size By randomly downsampling Sampling(), ik eigenvalues ​​are selected to form the feature space X, that is, The lonely tree is recursively constructed by using the Itree() function with X and the preset maximum depth dl until the data values ​​in each time series vector set V are individually segmented or the predetermined depth of the tree is reached. The abnormal score Score(x,ik) of each x∈X is comprehensively calculated to obtain: Among them, AVG(PL(x,ik)) represents the average of the path length function PL(x,ik) of each downsampled eigenvalue x on tr lonely trees, and ω(ik) is the average path length that cannot be successfully searched when the lonely tree is constructed into a binary search tree. Its value is only related to the vector space number ik, and the corresponding value is: Among them, δ = 0.577 is the Euler constant; the closer the abnormal score Score(x,ik) of each sampling feature x is to 1, that is, the faster it falls on the leaf node of the lonely tree, the more abnormal it will tend to be; the closer it is to 0.5, the more difficult it is to distinguish between abnormal values ​​and normal values; S123, set the abnormality judgment cutoff point to 0.55, determine the abnormal vector set; when the abnormality score Score() value is in the interval [0.55,1], at this time, the sample x corresponds to V FAC,K The original vector v in the center fac,s Classified into the exception vector set {x fac,s |x fac,s ∈A}, that is Where S is the number of vectors included in set A, s is the vector number and 0≤s≤S; S124, generate a set of mixed vectors of class anomalies; when the value of the anomaly score Score() is in the interval [0.45, 0.55), the sample x is corresponding to V FAC,K The original vector v in the center fac,m Classify into abnormal mixed vector set {x fac,m |x fac,s ∈B}, that is Where M is the number of vectors included in set B, m is the vector number and 0≤m≤M; S125, normalizing the abnormal classification input set; the abnormal classification input set integrates the aforementioned abnormal vector set and the class abnormal mixed vector set into: {x fac,cn |x fac,cn ∈(C CN ←A S IB M )}, where CN is the total number of vectors in set C, cn is the vector number, and 0≤cn≤CN; S126, using the above-mentioned abnormal classification input set as input data, executing the CNN algorithm; the CNN algorithm is provided with an input layer, a convolution layer, a pooling layer, a fully connected layer and an output layer network structure, and executing the forward propagation of the CNN algorithm can obtain the corresponding abnormal classification disposal method; S127, output the corresponding abnormal classification and disposal method; output the one-dimensional vector z op ∈Ω, OP is the predicted anomaly classification method; The on-chain contract conversion step includes: integrating the isoCNN algorithm used off-chain into an initialization model and then converting the contract code to generate an initialization contract isoCNN-SCv1 suitable for the government chain; the contract code conversion includes the steps of: pre-training the isoCNN algorithm off-chain to generate an initialization model V1Model(f()); using the Bcode() method on the aforementioned initialization model V1Model(f()) to generate the initialization contract isoCNN-SCv1, that is, The Bcode() method can compile the aforementioned initialization model V1Model(f()) into low-level bytecode, thereby generating the initialization contract isoCNN-SCv1; The on-chain contract update step includes: after embedding the aforementioned initialization contract isoCNN-SCv1 into the main contract mainSC on the government chain, executing the aforementioned main contract mainSC deployed in the SmartDocker execution environment, so as to trigger the smart contract on the government chain to automatically execute subsequent interactive operations, while realizing intelligent supervision of the smart contract on the government chain.

2. The method according to claim 1, characterized in that The triggers include user triggering through transactions, triggering through automatic value collection of IoT connected to the government chain, triggering in Timer Circular scheduled tasks, triggering based on changes in on-chain environmental variables, and triggering based on external chains directly changing worldstate values ​​through cross-chain contracts.

3. The method according to claim 1, characterized in that The construction includes the following steps: automatically collecting data from the on-chain log identified as abnormal data through a preset log recording contract log-SC, pushing forward the corresponding trigger and status values ​​on the chain, and recording them in the on-chain log book On-Rlog in a preset readable format; the on-chain log automatically collects data including core operation records, system error codes, and processing recovery records; Through the main contract mainSC on the chain, the real-time interaction collection data of the sampling record is recorded in the real-time collection log On-Tlog in a preset readable format; the real-time interaction collection data includes the real-time on-chain interaction operations, error throwing and worldstate change data; Run the timed trigger contract TT-C to collect the aforementioned on-chain log book On-RLog and real-time collection log On-Tlog into the off-chain log export file Off-Lfile in different time periods.

4. The method according to claim 3, characterized in that When performing the collection operation, the aforementioned log automatic collection data and the aforementioned real-time interaction collection data are combined and processed into a time series vector set V corresponding to the data set Vdata; The time series vector set V is expressed as The Limit (TIM) represents a total of K FAC-dimensional time series input factors decomposed from the off-chain log export file Off-Lfile in a time gradient TIM; the time series vector set V is represented by V FAC,K , is a three-dimensional vector based on a time series, that is: {υ fac,κ |υ fac,κ ∈V FAC,K }(1≤fac≤FAC,1≤κ≤K), where fac is the characteristic factor dimension of the time series variable and κ is the number of variables in the collected period; The time series vector set V corresponds to a total of different processing method classification sets Ω, then z op =[z1,z2,…,z op ]∈Ω(1≤op≤OP), z op is a one-dimensional vector of OP dimension, where OP is the predicted abnormal handling method classification; Among them, there is a conversion function f() to realize f():V→Ω.

5. The method according to claim 1, characterized in that: The aforementioned main contract mainSC deployed in the SmartDocker execution environment specifically executes step S130 including: S131, prepare off-chain time series dataset; S132, after completing the off-chain isoCNN algorithm training, pre-load the initialization contract isoCNN-SCv1 obtained by converting the corresponding contract code into SmartDocker; S133, embed the aforementioned initialization contract isoCNN-SCv1 into the main contract mainSC; S134, execute the main contract mainSC on the chain; S135, collecting the execution results on the chain; the collection is intended to collect the factors affecting the worldstate on the chain as a result of the aforementioned execution; S136, using the aforementioned time series data set to run the parameters of the initialization contract isoCNN-SCv1 in the SmartDocker environment; S137, judging whether the preset on-chain contract upgrade condition is triggered; when the difference between the prediction capability in SmartDocker and the existing model reaches the preset critical value, the corresponding on-chain contract upgrade condition is met; S138, if yes, upgrade the isoCNN algorithm after off-chain verification, perform contract code conversion on the corresponding model V2Model(f()) after the upgrade of the isoCNN algorithm to generate the updated contract isoCNN-SCv2, and complete the version audit before the contract upgrade; S139, use the above-mentioned updated contract isoCNN-SCv2 to replace the initialization contract isoCNN-SCv1 in the SmartDocker execution environment.

6. The method according to claim 5, characterized in that In step S136, when the parameters of the initialization contract isoCNN-SCv1 are run using the aforementioned time series data set in the SmartDocker environment, the running includes the steps of: Run the aforementioned initialization contract isoCNN-SCv1 on the chain to record the changes in the parameters in the aforementioned initialization contract isoCNN-SCv1; the changes in the parameters are not directly used to adjust the parameters in the initialization contract isoCNN-SCv1 on the chain, but only to adjust the corresponding parameters of the isoCNN algorithm in the off-chain pre-training; When the preset on-chain contract upgrade conditions triggered in step S137 are met, the aforementioned steps S137 to S139 are executed.

7. An AI-driven government chain supervision smart contract design system according to any one of claims 1-6, characterized in that include: Network nodes, used to send and receive data; Contract supervision module, used to supervise smart contracts; A system server, wherein the system server is connected to the network node and the contract supervision module; The system server is configured to: sequentially execute a data acquisition step, an off-chain pre-training step, an on-chain contract conversion step, and an on-chain contract update step; wherein the data acquisition step includes: acquiring on-chain log automatic collection data obtained by an automatic log collection method and real-time interaction collection data obtained by a real-time interaction data collection method to construct a time series data set; the time series data set provides data support for the training and prediction of the isoCNN algorithm in the off-chain pre-training step; the off-chain pre-training step includes: configuring the isoCNN algorithm off-chain, filtering out abnormal data from the massive data of the aforementioned time series data set through the configured isoCNN algorithm, and performing The on-chain contract conversion step includes: integrating the isoCNN algorithm used off-chain into an initialization model and then converting the contract code to generate an initialization contract isoCNN-SCv1 suitable for the government chain; the on-chain contract update step includes: embedding the aforementioned initialization contract isoCNN-SCv1 into the main contract mainSC on the government chain, and executing the aforementioned main contract mainSC deployed in the SmartDocker execution environment, so as to trigger the smart contract on the government chain to automatically execute subsequent interactive operations, while realizing intelligent supervision of the smart contract on the government chain.

8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Block chain intelligent contract multi-vulnerability detection method and system based on improved graph convolutional network

    CN116150003A

  • Systems and methods for facilitating use of artificial intelligence platforms trained on blockchain action lineages to conduct blockchain actions

    US11991299B1