A smart contract timing execution method for blockchain network data processing
By acquiring and processing multi-sensor data in industrial scenarios, a smart contract decision-making model based on deep neural networks is constructed and executed on a timed basis using blockchain time reference. This solves the problems of insufficient data authenticity and model credibility, and realizes reliable automated closed-loop decision execution.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHENGDU RES INST OF UESTC
- Filing Date
- 2026-03-17
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies lack reliable data storage, intelligent decision-making and execution, and automated closed-loop systems in industrial scenarios, making it difficult to guarantee data authenticity, insufficient model credibility, and untraceable execution processes, thus hindering the achievement of highly intelligent state diagnosis and decision-making execution.
By acquiring multi-sensor monitoring data from industrial equipment, robust normalization and sparse feature cross-transformation are performed to construct a smart contract decision model based on deep neural networks. The model is then triggered periodically using a blockchain time base to achieve data storage, automatic execution of the decision model, and recording of hierarchical response strategies.
This has created a fully automated, trustworthy, and auditable closed loop that ensures data authenticity, model credibility, and transparency in the execution process, enabling reliable automated execution from data to decision-making.
Smart Images

Figure CN121859378B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of artificial intelligence and blockchain technology, specifically to a method for timed execution of smart contracts for blockchain network data processing. Background Technology
[0002] In today's wave of industrial digital transformation, predictive maintenance and health management of industrial equipment have become core components for improving production efficiency, ensuring production safety, and reducing operation and maintenance costs. However, traditional industrial operation and maintenance models not only rely on regular manual inspections but also face a fundamental contradiction: data-driven intelligent decision-making requires high-quality data and automated execution, but in the complex industrial environment, the authenticity of data, the credibility of models, and the reliability of the execution process all face severe challenges. Behind this contradiction lies a deep-seated deficiency in the existing technological system in the two dimensions of "trust" and "automation."
[0003] The challenges facing existing technological systems are multi-layered. At the data level, while the volume of multimodal data collected from industrial sites is enormous, its authenticity cannot be guaranteed. Throughout the entire process, from sensor acquisition, transmission, and storage to expert annotation, data can be accidentally contaminated or even maliciously tampered with due to hardware failures, communication interference, or human error. Once this "unclean" data is used to train critical diagnostic models, the reliability of its output is fundamentally compromised. More importantly, the entire data preparation process lacks immutable records, making it impossible to trace back and verify the true state of the original data when disputes arise in model diagnosis, leading to difficulties in defining the responsibilities of each party. At the model level, despite the continuous development of deep learning technology, existing algorithms often handle feature engineering and model training in isolation, failing to fully consider the complex characteristics of industrial data. The mixture of continuous and discrete features in industrial data, the systematic modulation of equipment performance by changes in operating conditions, and the temporal continuity of equipment state evolution all require models to have stronger adaptability and interpretability. However, most existing models adopt general architectures and loss functions, lacking specific designs for industrial scenarios, resulting in inaccurate identification of critical states and insufficient generalization ability for rare fault modes. When these "black box" models make decisions, their underlying logic and basis are difficult to verify and trust.
[0004] At the more critical execution level, the existing technology system suffers from severe "automation silos." Even if the model can make accurate diagnoses, subsequent response actions such as early warnings, work order generation, and resource allocation still heavily rely on manual intervention and centralized system scheduling. This model is not only slow to respond but also introduces risks of human error and single points of failure in the centralized system. More importantly, the entire decision-making and execution process lacks transparent, auditable, and tamper-proof records, making it difficult to trace the results of equipment status determination and easily leading to disputes among the responsible parties. Existing timed task systems based on centralized servers can have their execution times and triggering logic tampered with by system administrators, making it impossible to provide convincing time verification.
[0005] It is against this backdrop that blockchain and smart contract technologies offer a new paradigm for solving the aforementioned dilemmas. Blockchain, with its distributed ledger, immutability, and traceability, makes it possible to establish a trusted industrial data foundation. However, existing blockchain applications are mostly limited to simple data storage, failing to form a deep closed loop with intelligent data processing and decision execution. Smart contracts, as automatically executed digital protocols, can theoretically achieve "condition-triggered automatic execution," but in industrial scenarios, most existing smart contracts execute simple business logic, lacking the ability to support complex artificial intelligence models and thus failing to handle highly intelligent state diagnostic tasks. How to deeply integrate blockchain's trusted storage capabilities, smart contracts' automatic execution capabilities, and advanced artificial intelligence diagnostic capabilities to build a complete closed loop from trusted data to trusted decision-making and then to trusted execution has become a key bottleneck that urgently needs to be overcome in the intelligent upgrading of industry. Summary of the Invention
[0006] To address the aforementioned shortcomings in existing technologies, this invention provides a method for timed execution of smart contracts for blockchain network data processing.
[0007] To achieve the above-mentioned objectives, the technical solution adopted by this invention is as follows:
[0008] A method for timed execution of smart contracts for blockchain network data processing includes the following steps:
[0009] Acquire multi-sensor monitoring data from industrial equipment and record equipment identification, acquisition time, and discrete operating condition information for each data point; store the data and its expert annotation tags in a blockchain network through transaction records.
[0010] Robust normalization is performed on continuous features in the data, and initial embedding vectors are generated based on mutual information weighting of discrete features in the data. High-dimensional dense feature vectors are obtained through sparse feature cross-transformation.
[0011] Construct a smart contract decision model based on deep neural networks, and use high-dimensional dense feature vectors as training datasets to iteratively train the model;
[0012] The trained model is deployed as a smart contract, which is triggered periodically based on the blockchain time benchmark. The input real-time data is encoded by features and then inferred by the model. The hierarchical response strategy is automatically executed according to the output probability distribution and recorded on the blockchain.
[0013] The present invention has the following beneficial effects:
[0014] This invention employs a strongly coupled timed execution mechanism of smart contracts and blockchain time benchmarks, encoding the trained complete decision model into automatically triggered contract terms, and automatically executing a hierarchical strategy from state archiving to emergency intervention based on the inference results, forming a fully reliable and auditable automated closed loop. Attached Figure Description
[0015] Figure 1 This is a schematic diagram of a smart contract timed execution method for blockchain network data processing according to the present invention;
[0016] Figure 2 This is a schematic diagram of a smart contract timed execution method for blockchain network data processing according to the present invention;
[0017] Figure 3 This is a schematic diagram of the feature enhancement and structured coding process of the present invention;
[0018] Figure 4 This is a schematic diagram illustrating the process of constructing a smart contract decision model based on a deep neural network according to the present invention.
[0019] Figure 5 This diagram illustrates a comparison between the present invention and five conventional methods in the task of device status classification. Detailed Implementation
[0020] The specific embodiments of the present invention are described below to enable those skilled in the art to understand the present invention. However, it should be understood that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, various changes are obvious as long as they are within the spirit and scope of the present invention as defined and determined by the appended claims. All inventions utilizing the concept of the present invention are protected.
[0021] Reference Figures 1 to 5 The present invention provides a schematic flowchart of a smart contract timed execution method for blockchain network data processing, comprising the following steps S1 to S4:
[0022] S1. Acquire multi-sensor monitoring data from industrial equipment and record equipment identification, acquisition time, and discrete operating condition information for each data point; store the data and its expert annotation tags in a blockchain network through transaction records.
[0023] In an optional embodiment of the present invention, the multi-sensor monitoring data obtained in step S1 includes voltage, current, active power, and power factor collected by electrical sensors, equipment temperature and ambient temperature collected by temperature sensors, and vibration amplitude, vibration frequency, and noise level collected by vibration sensors and acoustic sensors.
[0024] Step S1 involves data collection at fixed time intervals and generating a blockchain transaction record containing the data hash value, source, timestamp, operation type, and subject.
[0025] This embodiment collects raw monitoring data from the target industrial equipment and its operating environment. This data comes from various sensors installed on the equipment, including but not limited to electrical sensors for collecting electrical parameters (such as voltage, current, active power, and power factor), temperature sensors for collecting the temperature of the equipment body and the ambient temperature, and vibration and acoustic sensors for collecting mechanical conditions (such as vibration amplitude, vibration frequency, and noise level). Data acquisition is performed continuously at fixed time intervals (e.g., once per second), forming a continuous data stream ordered by timestamps.
[0026] Simultaneously, for each piece of collected data, it is necessary to record its corresponding device identifier, collection time, and discrete information on the device's operating condition at the time of data collection. This includes the cumulative runtime level based on the cumulative operating hours, the continuous runtime level based on the current continuous uptime, and the current device status code provided by the device control system (such as standby, running, maintenance, etc.). This raw multimodal mixed-type data constitutes the basic dataset for subsequent model training and inference.
[0027] To build a supervised deep learning model, the collected raw data must be labeled, that is, assigned appropriate equipment operating status category labels. Labeling is done manually, combining historical equipment maintenance records, concurrent equipment performance test reports, and a comprehensive analysis of the equipment's operating conditions at specific moments. In one embodiment, the label categories are divided based on equipment health and fault severity, mainly including four categories: "normal," "performance degradation," "minor fault," and "serious fault." Based on the data characteristics and actual equipment performance within a time window before and after a certain point in time, a specific status label is assigned to the data sample at that point in time. All collected raw data and their corresponding expert-labeled data together constitute the training dataset.
[0028] To ensure the authenticity of the data acquisition process, the authority of the annotation results, and the traceability and immutability of the entire data preparation process, all the aforementioned key operations and their results must be recorded on the blockchain. Specifically, whenever a new batch of raw data is collected or a set of data is annotated, the system generates a corresponding data transaction record. This record includes the data's unique fingerprint (such as a hash value), data source (device ID, sensor ID), timestamp, operation type (acquisition or annotation), and operation subject (sensor node or expert identity identifier).
[0029] For the labeled records, the data fingerprint used and the final confirmed state category label must also be included. These transaction records are packaged into blocks through a consensus mechanism and appended to a pre-defined blockchain network (such as a consortium blockchain) to form an immutable record, thereby ensuring that every piece of data used in subsequent model training is verifiable and that its quality and source are trustworthy.
[0030] S2. Robustly normalize the continuous features in the data, generate an initial embedding vector based on mutual information weighting of the discrete features in the data, and obtain a high-dimensional dense feature vector through sparse feature cross-transformation.
[0031] In an optional embodiment of the present invention, the industrial equipment operation monitoring data contains continuous and discrete attributes, and there are complex nonlinear coupling relationships between the features. Conventional one-hot encoding or simple normalization will destroy the distribution characteristics of continuous features or fail to characterize the interaction between features, making it difficult for the model to discover deep decision patterns.
[0032] Step S2 addresses the problem that conventional feature processing methods (such as one-hot encoding and Z-score normalization) are poorly adapted to mixed industrial data, unable to effectively preserve the robustness of continuous features and model complex dependencies between features, resulting in low input representation quality and limiting the upper limit of model performance. To address this, a sparse feature cross-transformation guided by mutual information is used to structure and enhance the original features, generating a high-dimensional dense feature vector. The specific steps are as follows:
[0033] S201, Robust Normalization of Continuous Features
[0034] This embodiment uses a robust normalization method based on the median and interquartile range to process continuous features in the original data, in order to reduce the impact of outliers, as shown below:
[0035]
[0036] in, This represents a normalized continuous feature vector with a dimension of 9. Each component corresponds to a value of a continuous feature after robust normalization, representing the relative state of the original continuous physical quantity after removing the dimension. This indicates the original voltage, and the unit is volt (V). This represents the original current, measured in amperes (A). This represents the original active power, measured in kilowatts (kW). This represents the original power factor, which is a dimensionless quantity. This indicates the original equipment temperature, in degrees Celsius (°C). This indicates the original ambient temperature, expressed in degrees Celsius (°C). This indicates the original vibration amplitude, in millimeters (mm). This indicates the original vibration frequency, measured in Hertz (Hz). This indicates the original noise level, measured in decibels (dB). Indicates voltage The median of Represents current The median of Indicates active power The median of Indicates power factor The median of Indicates equipment temperature The median of Indicates ambient temperature The median of Indicates the amplitude of vibration The median of Represents the vibration frequency The median of Indicates noise level the median; Indicates voltage interquartile range, Represents current interquartile range, Indicates active power interquartile range, Indicates power factor interquartile range, Indicates equipment temperature interquartile range, Indicates ambient temperature interquartile range, Indicates the amplitude of vibration interquartile range, Represents the vibration frequency interquartile range, Indicates noise level Interquartile range; This represents a very small constant used to prevent the denominator from being zero. Examples of its values are shown below. .
[0037] It's important to note that, unlike conventional Z-score normalization which uses the mean and standard deviation for calculation, both of which are highly sensitive to outliers—a single large outlier can significantly inflate the mean and standard deviation, causing the normalized values of most normal data to be compressed into a very small range, resulting in a loss of discriminative power—the median and interquartile range are robust statistics. The median represents the value at the middle of the data set and is not easily affected by extreme values. The interquartile range is the difference between the upper and lower quartiles, describing the dispersion of the middle 50% of the data set, and is also not sensitive to outliers. Therefore, robust normalization of continuous features can ensure that even with outliers, the distribution characteristics of normal data can be better preserved.
[0038] S202, Initialization of Mutual Information Weighted Embedding of Discrete Features
[0039] This embodiment calculates the mutual information between discrete features and all continuous features to measure the strength of statistical association, and generates an initial embedding vector for each discrete feature based on the mutual information, as follows:
[0040]
[0041] in, Indicates the first The initial embedding vectors corresponding to each discrete feature have a dimension of . Its initialization is derived from a linear mapping of the mutual information weights between the discrete feature and all continuous features, and the statistical correlation strength between the discrete feature and each continuous feature is encoded from the initialization. This represents the projection weight matrix, with dimension 1. , used to map association weights to the embedding space, are trainable parameters; This represents the Softmax normalization function, which transforms the input vector into a probability distribution; Indicates the transpose operation; This represents the row vector after Softmax normalization. Transpose; Representing the mutual information matrix The middle corresponds to the first Row vectors of discrete features; Represents the mutual information matrix, with dimension . Its elements Storage number The discrete feature and the first The mutual information value between continuous features defines discrete features. With continuous features The mutual information value between them is This is used to quantify the statistical dependency between the two, and the calculation method is expressed as follows: ; This represents a discrete feature variable, specifically referring to the cumulative runtime level. The level of continuous operation this time or device status code one of the, express A specific value that can be taken; This represents a continuous characteristic variable, specifically referring to voltage. Current Active power Power factor Equipment temperature Ambient temperature Vibration amplitude Vibration frequency or noise level one of the, express A specific bin index after adaptive binning; express Values Marginal probability estimation, express The value falls within the box. Marginal probability estimation within, express Values and The value falls within the box. Joint probability estimation within; This represents the temperature coefficient, used to adjust the smoothness of the weight distribution. Smaller values result in a sharper distribution. Examples of suitable values are shown below. .
[0042] S203, Sparse Feature Cross Transformation and Enhancement
[0043] This embodiment concatenates the normalized continuous feature vector with the initial embedding vector to obtain the initial structured feature vector. Then, a sparse feature cross-transformation is introduced to adaptively select important feature pairs for interaction and mapping to a high-dimensional space. Combined with the initial structured feature vector, an enhanced feature vector is obtained, represented as:
[0044]
[0045] in, This represents the initial structured feature vector, which is the fused representation of the original mixed-type features after preliminary cleaning, normalization, and encoding of association information. It serves as the basis vector for deep feature interactions and has a dimension of [dimensionality missing]. , represented as ; The enhanced feature vector is a high-dimensional dense feature vector generated after feature cross enhancement, with a dimension of 1. , express The number of features, i.e. ; The preset dimension of the discrete feature embedding vector is a hyperparameter. The mapping dimension of the feature interaction term is a hyperparameter. This represents a vector concatenation operation; Represents the cumulative runtime level of discrete features The initial embedding vector; Indicates the discrete feature's duration level during this continuous run. The initial embedding vector; Represents discrete characteristic device status coding The initial embedding vector; Indicates the first feature index. Indicates the second feature index, and ; express The first in scalar eigenvalues express The first in scalar eigenvalues; Indicates the corresponding to the first The sparse weight coefficients of feature pairs are scalars used to control the activation and contribution strength of the feature to the interaction term. Specifically, they are generated through a lightweight gating mechanism (e.g., a pre-defined single-layer neural network). This mechanism uses feature pairs... As input, the output scalar activation value is... ; Indicates the corresponding to the first The parameter vector of the feature pair has dimension . This is used to map scalar cross-products to a higher-dimensional space.
[0046] To address the problem that conventional feature processing methods (such as one-hot encoding and Z-score normalization) are poorly adaptable to mixed industrial data, cannot effectively preserve the robustness of continuous features and model complex dependencies between features, resulting in low input representation quality and limiting the upper limit of model performance, this embodiment adopts a discrete feature embedding initialization and sparse feature cross-transformation method based on mutual information weighting. This method integrates nonlinear correlations between features into mixed industrial data during the encoding stage, solving the problem that conventional encoding techniques destroy the distribution of continuous features or fail to represent complex interactions.
[0047] S3. Construct a smart contract decision model based on deep neural networks, and use high-dimensional dense feature vectors as training datasets to iteratively train the model;
[0048] In an optional embodiment of the present invention, the smart contract decision model based on deep neural networks constructed in step S3 includes an embedded initialization layer, a memory-enhanced state feature extraction module, an environment-adaptive attention aggregation module, and a state category probability calculation module.
[0049] The process of constructing a smart contract decision model based on a deep neural network in step S3 is as follows:
[0050] S301. Constructing the embedding initialization layer of a deep neural network.
[0051] Conventional deep neural networks typically initialize all network parameters randomly. For models that handle mixed-type features and are strongly correlated with subsequent tasks, this randomness may lead to instability and slow convergence in the early stages of training.
[0052] This invention constructs an embedded initialization layer as the first learnable transformation of the network, dynamically constructs a basis matrix based on the global statistical properties of the enhanced features, and then fine-tunes it using learnable scaling factors and residual terms to map the enhanced features to the input space of the deep neural network backbone. The specific steps are as follows:
[0053] 1) Construction of the basis matrix
[0054] Based on the enhanced feature vectors of all training samples, their covariance matrix is calculated and eigenvalue decomposition is performed. The principal component directions are selected to construct the basis matrix, aligning its direction with the main directions of data variation, as shown below:
[0055]
[0056] In the formula, Represents a basis matrix with dimension . Its row vector direction is aligned with the direction of the principal component with the largest data variance, indicating that the transformation direction of the embedded initialization layer is already aligned with the principal component space of the input data during initialization, which is beneficial to the rapid and stable training of the model. Indicates from the previous A matrix consisting of the eigenvectors corresponding to the largest eigenvalues, with dimension 1. It is from the eigenvector matrix Before the election A submatrix consisting of the eigenvector columns corresponding to the largest eigenvalues; This represents the eigenvector matrix, where each column is... A unit eigenvector; The enhanced feature covariance matrix is the covariance matrix of the enhanced feature vectors over all training samples, with dimensions of . The method used to characterize the linear relationship between features, and to calculate the covariance matrix and perform eigenvalue decomposition, is expressed as follows: ; The eigenvalue matrix is a diagonal matrix with diagonal elements of 1. The eigenvalues are arranged in descending order; express Transpose of; This indicates the number of principal components to be retained, preferably set to the same as the preset input dimension of the deep neural network. Consistency, that is ; It is the preset input dimension of a deep neural network; Indicates from the previous A diagonal matrix consisting of the largest eigenvalues, with dimensions of . , Indicates to Take the square root of each eigenvalue on the diagonal; Operators that construct diagonal matrices.
[0057] 2) Initialization layer forward computation
[0058] The constructed basis matrix, the learnable scaling vector, and the randomly initialized residual matrix are combined to perform a linear transformation on the input feature vector. Then, a layer normalization operation is performed to obtain the output vector embedded in the initialization layer, as shown below:
[0059]
[0060] In the formula, The output vector of the embedding initialization layer represents the initial representation of the enhanced features after being mapped to the standard input space expected by the backbone of the deep learning model, with a dimension of . ; The representation layer normalization operation standardizes the input to stabilize training. This represents a scaled vector with dimensions of . , used to independently scale and adjust each column of the basis matrix, is a trainable parameter; This represents a randomly initialized residual matrix with dimension . This allows the model to learn subtle patterns that are not captured by the basis matrix.
[0061] In practice, the first layer (embedding initialization layer) of a deep neural network adopts a data-driven specific initialization method, while the weights and bias parameters of all subsequent layers can still adopt conventional initialization methods. For example, Xavier uniform initialization is used for linear layers, and the weights can be initialized to 1 and the biases to 0 for layer normalization layers.
[0062] S302, Prediction of Industrial Equipment Operating Status
[0063] In predicting the operating status of industrial equipment, conventional classification methods typically map the final output of a deep neural network directly to the category space through a fully connected layer. However, this method ignores the temporal progression of states, the inherent correlation between different state patterns, and the modulating effect of environmental conditions on state representation. This may lead to inaccurate identification of critical states or insufficient ability to distinguish complex faults.
[0064] This invention constructs a memory-enhanced state feature extraction module and an environment-adaptive attention aggregation module, and integrates saliency features of operating modes constructed from the original data to ultimately output accurate device operating state category probabilities. The specific steps are as follows:
[0065] 1) Extraction of state features for memory enhancement
[0066] The output vector of the embedding initialization layer is used as the query input and interacts with the learnable running pattern memory matrix. The running pattern memory matrix stores typical state pattern prototypes learned from historical data. Through an attention mechanism, the historical pattern features most relevant to the current state are retrieved to obtain the memory-enhanced state feature vector, thereby enhancing the discriminative ability of the current state feature representation, as shown below:
[0067]
[0068] In the formula, The feature vector representing the memory-enhanced state has a dimension of . It not only contains the instantaneous information of the current sample, but also incorporates relevant state pattern information retrieved from historical experience, which helps to improve the model's ability to identify rare or complex failure modes. represents the memory fusion gating coefficient, which is a trainable scalar parameter with an initial value of 0. It allows the model to adaptively adjust the fusion strength of information retrieved from historical memory patterns with the current input information during the learning process. This represents the scaled dot product attention function, used to calculate the similarity between a query and a series of keys, and then weights and sums the values to retrieve the most relevant information to the current query. Specifically, it uses the standard attention calculation method, defined as... ; This indicates a query for the projection matrix, with dimensions of . , is used to project the output vector of the embedded initialization layer onto the attention query space, and is a trainable parameter; This represents the query matrix, which in the attention mechanism represents the information content to be retrieved, with dimensions of [missing information]. ; The key matrix represents the "index" or "title" of information available for retrieval in the attention mechanism, with dimensions of [missing information]. ; express Transpose of; The value matrix, in the attention mechanism, represents the actual information content stored in the memory, with dimensions of 1. ; The memory matrix represents the operating mode, with dimension 1. Each row represents a feature prototype of a typical device operating state pattern learned from the data, and is a trainable parameter. This represents the number of pattern prototypes stored in the memory matrix; it is a hyperparameter with an example value of 50. This represents the dimension of the key and query vectors in the attention mechanism; it is a hyperparameter and should be set to the optimal value. , This indicates that the square root of the key / query dimension of the attention mechanism is taken to scale the dot product result for stable training.
[0069] It should be noted that, by... Initialized to random values and set as trainable parameters, the gradient of the loss function will drive the model during training. Each row (a pattern prototype) is updated in the direction of the state feature vector that appears frequently or is representative in the training data, thereby gradually converging to the embedding that can represent the typical pattern of historical data, ensuring that the running pattern memory matrix stores the typical state pattern prototypes learned from historical data.
[0070] It should also be noted that the number of pattern prototypes stored in the memory matrix is preferably 50, which aims to balance memory capacity with model complexity and computational cost. Too few may not be able to cover all typical operating modes, while too many may increase the risk of overfitting and computational burden.
[0071] 2) Environment-adaptive attention convergence
[0072] Considering that operating conditions such as ambient temperature and equipment load levels significantly modulate the performance benchmark of equipment monitoring parameters, this paper introduces the importance of dynamically adjusting feature channels using an environmental condition adaptation factor. Multi-scale temporal saliency features are constructed and adaptively weighted and aggregated using a gated attention module to generate a state-determining feature vector robust to environmental changes, represented as follows:
[0073]
[0074] In the formula, The state decision feature vector is the final state decision feature vector after environmental adaptive attention aggregation, with dimensions of [dimensionality missing]. It is robust to the variation in characteristic performance under different working conditions; This represents the total number of aggregation paths and is used to extract state-related saliency from different scales or perspectives. It is a hyperparameter with an example value of 3. This represents the path index, with values ranging from 1 to... ; Indicates the first The adaptive weight coefficients for each path are generated from the global features output by all paths through a competitive gating mechanism. This allows the model to automatically determine which features extracted from different scales or perspectives (corresponding to different paths) are more important for the final state decision based on the current input features, achieving multi-path adaptive fusion of information. The calculation method is expressed as follows: ; Indicates the first The scalar features obtained by global average pooling of the feature vectors output by each path are i.e. ; Indicates the first The linear transformation weight matrix of the path, with dimension . , is a trainable parameter vector; This represents the Gaussian error linear unit activation function, which introduces nonlinearity into the model, enabling the network to learn more complex feature maps; This represents the element-wise multiplication operation; Indicates the first The environmental condition adaptation factor vector corresponding to each path has a dimension of . It is a vector generated based on environmental and load information, used for channel-by-channel modulation of memory-enhanced features. It constructs a system that integrates environmental and load information from the original continuous features. For example, for the first path, its... Each component can be designed as ; This represents the Sigmoid activation function, which maps the input to the (0,1) interval; Indicates the first The path used to calculate the first The scalar parameters of the ambient temperature modulation weights for each feature channel are trainable parameters. Indicates the first The path used to calculate the first The scalar parameters of the active power modulation weights of each feature channel are trainable parameters. Indicates the first The path used to calculate the first The biasable scalar parameters of the environmental condition adaptation factors for each feature channel are trainable parameters. This represents the ambient temperature value after robust normalization, i.e. ; This represents the active power value after robust normalization, i.e. ; This represents the global average pooling operation, which compresses a vector into a scalar, representing the global strength or significance of the output features of that path, and is used for weight competition between different paths. This represents the linear transformation weight matrix used to calculate path weights, and it is a trainable parameter. This represents the bias vector used to calculate path weights, and it is a trainable parameter.
[0075] 3) Calculation of state category probability
[0076] The state determination feature vector is mapped to the equipment state category space. Considering that industrial equipment states may have hierarchical or subordinate relationships, a tree-structured probability mapping mechanism is adopted to project the features into multiple subspaces corresponding to state determinations of different granularities. The probability distribution of each category is output through dynamic weight fusion, as follows:
[0077]
[0078] In the formula, The probability distribution vector representing the device's operating state category, with dimension 1. , The c-th element The representative model determines that the device is in the first position. The probability of each state category; This represents the total number of preset device operating status categories. It is a hyperparameter. In one embodiment, there are four categories, including "normal", "performance degradation", "minor fault" and "serious fault". This represents the total number of branches in the tree-like probability mapping structure, i.e., the number of different judgment perspectives or state granularities. It is a hyperparameter with an example value of 2. Indicates a branch or viewpoint index, with a value range of 1 to... ; Indicates the first The fusion weights of the branch outputs are used to weight and sum the class scores of each branch, based on the state determination feature vector. Dynamically generated through a pre-defined small network; in one embodiment, the pre-defined small network is a single-layer perceptron structure, represented as follows: ; Indicates the first The category projection weight matrix of each branch has dimensions of . , are trainable parameters whose initialization can guide different branches to focus on different groups of state categories; Indicates the first The class projection bias vectors of each branch have dimensions of . , are trainable parameters; This represents the weight matrix used to calculate the branch fusion weights, and consists of trainable parameters; This represents the bias vector used to calculate the branch fusion weights, and is a trainable parameter.
[0079] It should be noted that by setting multiple parallel classification branches, each branch can be understood as judging the state from different granularities (such as "normal / abnormal", "fault type") or different decision-making perspectives. Then, dynamically generated fusion weights are used. By combining the "opinions" from these branches, a mechanism can be implemented to simulate the process of making decisions from coarse to fine or from multiple paths and then summarizing them.
[0080] To address the issues of conventional deep learning models lacking specific design considerations for the temporal progression of industrial equipment states, the reuse of historical patterns, and the influence of operating condition modulation, as well as their limited ability to identify critical states, complex faults, and rare patterns, and their insufficient generalization and robustness, this embodiment employs a deep neural network that incorporates memory-enhanced state extraction and environment-adaptive attention aggregation. It retrieves historical experience through a learnable pattern memory matrix and dynamically adapts to changes in operating conditions using a multi-path gating mechanism, thereby achieving accurate identification of complex states and critical situations.
[0081] S303, Calculate the loss function
[0082] To address common issues in industrial equipment state prediction tasks, such as class imbalance, ambiguous state boundaries, and neglect of the temporal evolution of states, conventional cross-entropy loss functions are insufficient to guide models to learn the optimal decision boundary.
[0083] This invention, while supervising the accuracy of the final prediction, guides the model to learn feature representations and discrimination logic that better conform to the physical operation of the equipment by introducing state transition smoothness constraints and feature distribution consistency regularization. The specific steps are as follows:
[0084] 1) Calculation of monitoring losses
[0085] The focused cross-entropy loss, which combines cost sensitivity and hard example mining, with the state transition smoothness loss based on prior knowledge of gradual changes in the encoding device state, together constitute the supervised loss term. This term addresses class imbalance and constrains the temporal reasonableness of prediction results, and is expressed as:
[0086]
[0087] In the formula, This represents the supervised loss term, which measures the difference between the model's predicted probabilities and the true labels, and constrains the smooth transition of predicted probabilities between adjacent time steps. This represents the total number of samples in a training batch; Indicates the sample index; This represents the state category index, with values ranging from 1 to... ; Indicates the first The cost-sensitive weights for each category are used to mitigate bias caused by imbalance in the number of samples across categories, and are calculated as follows: ; Indicates the first in the training dataset The frequency of occurrence of each state category, i.e., the proportion of samples of that category to the total number of samples; The model represents the first element in the batch. The predicted value for the nth sample is... The probability of each state category, i.e. The One element; This represents the focusing parameter, used to reduce the contribution of easily classified samples to the loss function, so that training focuses more on difficult-to-classify samples. It is a hyperparameter, and the example value is 2. Indicates the first The true state label of the sample is in one-hot encoded form. If the true category is the nth sample... If there is a category, the value is 1; otherwise, it is 0. The weighting coefficient represents the loss for smoothness of state transitions. It is used to balance the two supervision losses and is a hyperparameter. An example value is 0.1. Indicates the length of a segment of a continuous sequence organized in chronological order; This represents the time step index, with a value range of 1 to... ; Indicates at time step The state predicted by the model The probability of; Indicates at time step The state predicted by the model The probability of; This represents the state transition penalty matrix, with dimension 1. Its elements Define the state Jump to state The severity of the punishment corresponding to the degree of unreasonableness is set according to the difference in the severity level of the situation; Indicates difference from The state category index, here referring to , Indicates at time step The predicted class of the model is obtained by taking the maximum index, i.e. .
[0088] In practical implementation, the continuous monitoring data stream from industrial equipment is divided into multiple fixed-length segments according to time sequence. Sequence segments (time windows), within each segment Each sample is used as an input unit of the model to calculate the time-related loss term.
[0089] 2) Regularization constraint calculation
[0090] Feature distribution consistency regularization is introduced to make the representations of similar samples as close as possible in the feature space, while making the representations of dissimilar samples as far apart as possible, thereby improving the discriminative power of the features. Specifically, it can be expressed as:
[0091]
[0092] In the formula, The regularization loss term represents the feature distribution consistency regularization, which aims to make the representations of similar samples in the feature space as close as possible, while the representations of dissimilar samples are as far apart as possible, thereby improving the discriminative power of the features. The weight coefficient representing the feature distribution consistency regularization controls the proportion of this loss in the total loss, thereby enhancing the intra-class compactness of the features; The weighting coefficient for negative sample margin regularization controls the proportion of this loss in the total loss, thereby increasing inter-class diversity. Indicates belonging to a category The set of all sample indexes; Indicates category The number of samples; Indicates the first The state determination feature vector of each sample; Indicates category The feature prototypes are initialized as zero vectors and updated during training using a moving average, denoted as... ; This indicates an assignment operation; The update rate of the moving average controls the prototype of the categorical feature. During training, how quickly the feature mean of this type of sample in the current batch is updated; an example value is 0.1. Indicates the first The true category label of each sample; Indicates the first The true category label of each sample; Indicates difference from The sample index; This represents the function that takes the maximum value. This represents the margin boundary, used to define the minimum Euclidean distance between the expected prototypes of different categories of features in the feature space. An example value is 2.0. Indicates category The feature prototype vector, Indicates category In one implementation, the feature prototype vectors of each category are defined as trainable parameters.
[0093] 3) Calculation of total loss function
[0094] The total loss function optimized during model training is a weighted sum of the supervised loss and the regularization constraint, expressed as:
[0095]
[0096] In the formula, This represents the loss weighting coefficient, used to balance the contributions of the two losses; an example value is 0.5. The total loss function is the overall objective function that needs to be minimized during model training.
[0097] S304, Iterative Training and Parameter Update of Deep Neural Networks
[0098] After constructing and initializing the deep neural network decision model, the model is iteratively trained using the training dataset collected and labeled in step S1 to optimize its parameters. The training process is performed in batches, with each training batch randomly sampling a certain number of samples from the dataset. These samples are then passed sequentially through the feature enhancement and structured encoding module in step S2, and the deep neural network constructed in step S3 (including the embedding initialization layer, the memory-enhanced state feature extraction module, the environment-adaptive attention aggregation module, and the tree-structured perception state category probability calculation module). The forward propagation yields the device state probability distribution predicted by the model.
[0099] Then, based on the total loss function defined in step S303, the sum of the supervised loss and the regularization constraint loss predicted by the model in the current batch is calculated. Based on this total loss, the gradient of the loss function with respect to all trainable parameters of the model is calculated using the backpropagation algorithm. Using a preset optimizer (such as the Adam optimizer) and its configured learning rate, the model parameters are iteratively updated according to the calculated gradients to minimize the total loss function.
[0100] The process of "forward propagation - loss calculation - backpropagation - parameter update" is repeated cyclically, traversing the training dataset multiple times.
[0101] The training process is stopped based on preset stopping iteration criteria. There are two main criteria:
[0102] One method is early stopping, which involves continuously evaluating the model performance (such as observing the loss value or classification accuracy) on an independent validation dataset during the training process. When the performance metrics on the validation set no longer improve or even begin to decline in multiple consecutive training rounds, it is determined that the model may have overfitted, and training is stopped and rolled back to the model parameter state with the best validation performance.
[0103] Second, the training will be forcibly stopped after reaching the maximum number of training iterations, i.e., after the training has executed the preset maximum number of iterations. Regardless of the stopping condition, the optimal set of model parameters obtained after training will be fixed and saved as the core knowledge of the trained smart contract decision model, and used for subsequent deployment and scheduled execution in the blockchain network.
[0104] To address the challenges posed by common cross-entropy loss functions in industrial scenarios, such as class imbalance, ambiguous state boundaries, and the continuity of state evolution, and the lack of mechanisms to guide the model to learn decision boundaries that conform to the physical laws of equipment, this embodiment adopts a loss function that integrates state transition smoothness constraints and feature distribution consistency regularization. While supervising prediction accuracy, it explicitly introduces temporal priors of equipment state evolution and intra-class aggregation and inter-class separation constraints in the feature space, making the model more consistent with physical laws.
[0105] In one embodiment, the performance differences of the smart contract timed execution method for blockchain network data processing proposed in this invention and five conventional techniques in equipment status classification tasks are compared. The experiment sets up four typical equipment operating status categories: normal, performance degradation, minor fault, and severe fault. Grouped bar charts visually display the classification accuracy of each method in different status categories. The conventional techniques compared include convolutional neural network (LSL) models, random forest algorithms, support vector machines, conventional neural network models, and logistic regression models—all widely used techniques in the field of industrial equipment condition monitoring. In terms of experimental configuration, all methods are trained and tested using the same dataset, which contains multi-sensor monitoring data collected from industrial equipment and labeled with status tags by experts to ensure fairness in the comparison. In the experimental data volume, the horizontal axis represents the four equipment status categories, and the vertical axis represents the classification accuracy, displayed as a percentage in decimal form. The figure shows six groups of bar charts of different colors, corresponding to the six technical methods. Experimental results show that the classification accuracy of the method of the present invention is significantly higher than that of the other five conventional techniques in all four state categories. This proves that the method of the present invention can more accurately identify various operating states of the device through innovative mechanisms such as feature enhancement and structured coding, memory-enhanced state feature extraction, and environment-adaptive attention aggregation.
[0106] S4. Deploy the trained model as a smart contract, which is triggered periodically based on the blockchain time base. The input real-time data is encoded by features and then inferred by the model. The hierarchical response strategy is automatically executed according to the output probability distribution and recorded on the blockchain.
[0107] In an optional embodiment of the present invention, step S4 deploys the trained and validated deep neural network decision model to a blockchain network, and its computational logic and parameters are encoded into a set of automatically executable smart contract terms. In practical applications, the smart contract is set to be automatically triggered at regular intervals, such as every fixed time interval (e.g., every 10 minutes) or based on a block generation event. When the execution conditions are met, the contract automatically obtains input from the latest industrial equipment monitoring data recorded on the blockchain, the data of which has also been verified for authenticity through on-chain notarization.
[0108] The acquired raw data is first processed through the feature enhancement and structured encoding process described in step S2, which is exactly the same as the training phase, to generate standardized high-dimensional dense feature vectors. These feature vectors are then input into the deployed deep neural network decision model (i.e., the model constructed in step S3) for forward inference computation. The model ultimately outputs the probability distribution of the device's state in each preset category ("normal", "performance degradation", "minor failure", "serious failure").
[0109] The smart contract makes decisions based on this output probability distribution and automatically executes the corresponding preset strategies. The specific execution strategies closely correspond to the model's output results:
[0110] If the model determines that the device status is "normal" with the highest probability, the contract will store the monitoring and reasoning results (including the original data fingerprint, feature vector, predicted status and probability) as a new record in the blockchain to complete the status archiving.
[0111] If the model determines that the performance is "degraded", the contract will automatically generate an early warning message in addition to completing the archiving, and send it to the preset equipment maintenance personnel through the on-chain messaging mechanism or oracle service to remind them to pay attention to the equipment performance trend.
[0112] If the model determines that it is a "minor fault", the contract will upgrade its response, automatically generate a repair work order request, and trigger the on-chain resource allocation process, such as reserving spare parts and assigning repair personnel.
[0113] If the model determines that there is a "serious fault", the contract will immediately execute the highest priority strategy. In addition to generating an emergency repair work order, it can also automatically send instructions to the equipment control system (through a secure channel) to slow down or safely shut down (pre-authorization required). At the same time, it will send emergency alarms to multiple responsible parties (such as maintenance departments, production scheduling departments, and safety supervision departments). All decisions and actions are recorded as transactions on the blockchain to ensure that the whole process is transparent, auditable, and non-repudiable.
[0114] It's important to note that the core of the timed execution mechanism lies in the strong coupling between the smart contract and the underlying blockchain time. The contract's trigger timer does not rely on an unreliable external system clock, but is built into the contract logic and strictly bound to the blockchain's block timestamp or preset block height growth. For example, the contract can be encoded as "automatically executing a state assessment every 100 new blocks (approximately 10 minutes of actual time)," or directly determining whether the set period has been reached based on the block timestamp. The blockchain network's consensus mechanism ensures the decentralized consistency, tamper resistance, and verifiability of this time benchmark. Therefore, the initiation time and execution cycle of each "timed" trigger, data acquisition, model inference, and strategy execution are permanently recorded and confirmed as part of the contract code, eliminating the possibility of manual intervention in the execution rhythm or falsification of execution time. This achieves a truly unattended, reliable, and fully automated intelligent operation and maintenance closed loop for industrial equipment.
[0115] To address the issues that existing timed monitoring and response solutions often rely on centralized systems, which suffer from problems such as tampering with execution rhythm, unreliable data sources, opaque decision-making processes, and reliance on manual intervention for response actions, and lack of reliable, automated, and non-repudiable end-to-end execution guarantees, this embodiment adopts a strongly coupled timed execution mechanism of smart contracts and blockchain time benchmarks. The trained complete decision model is encoded into automatically triggered contract terms, and a hierarchical strategy from state archiving to emergency intervention is automatically executed based on the inference results, forming a reliable and auditable automated closed loop throughout the entire process.
[0116] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0117] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0118] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0119] Specific embodiments have been used to illustrate the principles and implementation methods of this invention. The descriptions of the embodiments above are only for the purpose of helping to understand the method and core ideas of this invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this invention. Therefore, the content of this specification should not be construed as a limitation of this invention.
[0120] Those skilled in the art will recognize that the embodiments described herein are intended to help the reader understand the principles of the invention, and should be understood that the scope of protection of the invention is not limited to such specific statements and embodiments. Those skilled in the art can make various other specific modifications and combinations based on the technical teachings disclosed in this invention without departing from the spirit of the invention, and these modifications and combinations are still within the scope of protection of this invention.
Claims
1. A method for timed execution of smart contracts for blockchain network data processing, characterized in that, Includes the following steps: Acquire multi-sensor monitoring data from industrial equipment and record equipment identification, acquisition time, and discrete operating condition information for each data point; store the data and its expert annotation tags in a blockchain network through transaction records. Robust normalization is performed on continuous features in the data, and initial embedding vectors are generated based on mutual information weighting of discrete features in the data. High-dimensional dense feature vectors are obtained through sparse feature cross-transformation. Construct a smart contract decision model based on deep neural networks, and use high-dimensional dense feature vectors as training datasets to iteratively train the model; The trained model is deployed as a smart contract, which is triggered at regular intervals based on the blockchain time base. The input real-time data is encoded by features and then inferred by the model. The hierarchical response strategy is automatically executed according to the output probability distribution and recorded on the blockchain. The smart contract decision model based on deep neural networks includes an embedded initialization layer, a memory-enhanced state feature extraction module, an environment-adaptive attention aggregation module, and a state category probability calculation module. The memory-enhanced state feature extraction module retrieves the runtime mode memory matrix through an attention mechanism to obtain the memory-enhanced state feature vector, specifically: in, Represents the feature vector of the memory-enhanced state. Indicates the memory fusion gating coefficient. This represents the scaled dot product attention function. Represents the query matrix. Indicates querying the projection matrix. Represents the key matrix, The memory matrix represents the operating mode. Represents a value matrix; This represents the output vector of the embedded initialization layer; The environment-adaptive attention aggregation module generates a state determination feature vector by using a multi-path gating mechanism and combining weighted aggregation features based on environmental condition adaptation factors. Specifically: in, This represents the feature vector for state determination. Indicates the first Adaptive weight coefficients for each path Represents the activation function of the Gaussian error linear unit. Indicates the first The linear transformation weight matrix of the path, Indicates the first The environmental condition adaptation factor vector corresponding to each path. This indicates an element-wise multiplication operation. This indicates the total number of aggregation paths.
2. The method for timed execution of smart contracts for blockchain network data processing according to claim 1, characterized in that, Multi-sensor monitoring data includes voltage, current, active power, and power factor collected by electrical sensors; equipment temperature and ambient temperature collected by temperature sensors; and vibration amplitude, vibration frequency, and noise level collected by vibration and acoustic sensors.
3. The method for timed execution of smart contracts for blockchain network data processing according to claim 1, characterized in that, Data collection is performed at fixed time intervals, generating blockchain transaction records that include data hash values, sources, timestamps, operation types, and subjects.
4. The method for timed execution of smart contracts for blockchain network data processing according to claim 1, characterized in that, Continuous features are processed using a robust normalization method based on the median and interquartile range, specifically: in, Represents a normalized continuous eigenvector. Indicates voltage. Represents current. Indicates active power. Indicates the power factor. Indicates the equipment temperature. Indicates ambient temperature. Indicates the amplitude of vibration. Indicates the vibration frequency. Indicates noise level, Indicates voltage the median of Represents current the median of Indicates active power the median of Indicates power factor the median of Indicates equipment temperature the median of Indicates ambient temperature the median of Indicates the amplitude of vibration the median of Represents the vibration frequency the median of Indicates noise level the median of Indicates voltage interquartile range, Represents current interquartile range, Indicates active power interquartile range, Indicates power factor interquartile range, Indicates equipment temperature interquartile range, Indicates ambient temperature interquartile range, Indicates the amplitude of vibration interquartile range, Represents the vibration frequency interquartile range, Indicates noise level interquartile range, This represents a very small constant.
5. The method for timed execution of smart contracts for blockchain network data processing according to claim 1, characterized in that, The mutual information weighted embedding initialization of discrete features is achieved by calculating the mutual information matrix M between discrete and continuous features, and generating initial embedding vectors using softmax normalization and linear mapping, specifically as follows: in, Indicates the first The initial embedding vector corresponding to each discrete feature. Represents the projection weight matrix. This represents the Softmax normalization function. This indicates the transpose operation. Representing the mutual information matrix The middle corresponds to the first Row vectors of discrete features Indicates the temperature coefficient. This represents the projection bias vector.
6. The method for timed execution of smart contracts for blockchain network data processing according to claim 1, characterized in that, The sparse feature cross-transformation generates sparse weight coefficients through a gating mechanism, maps the feature pair cross terms to a high-dimensional space, and concatenates them with the initial feature vector to obtain the enhanced feature vector. Specifically: in, Represents the enhanced feature vector. This represents a vector concatenation operation. This represents the initial structured feature vector. Represents the initial structured feature vector The first in scalar eigenvalues Represents the initial structured feature vector The first in scalar eigenvalues Indicates the corresponding to the first The parameter vector of the feature pair Indicates the corresponding to the first Sparse weight coefficients of feature pairs Represents the initial structured feature vector The number of features.
7. The method for timed execution of smart contracts for blockchain network data processing according to claim 1, characterized in that, The total loss function used in the training process includes supervised loss and regularization loss, specifically: , , in, Represents the total loss function. This represents the loss weighting coefficient. Indicates monitoring losses, Indicates the regularization loss. This represents the total number of samples in a training batch. Indicates the first Cost-sensitive weights for each category, The model represents the first element in the batch. The predicted value for the nth sample is... The probability of each state category Indicates the focus parameter, Indicates the first The true state label of each sample The weighting coefficients represent the loss for smoothness of state transitions. This indicates the length of a segment of a continuous sequence organized in chronological order. Indicates at time step The state predicted by the model The probability, Indicates at time step The state predicted by the model The probability, Indicates from state Jump to state The severity of punishment corresponding to the degree of unreasonableness. Indicates the total number of states. The weight coefficients represent the regularization of feature distribution consistency. Indicates belonging to a category The set of all sample indexes, Indicates category The number of samples, Indicates the first The state determination feature vector of each sample Indicates category The characteristic prototype, The weight coefficients represent the negative sample margin regularization. Indicates the first The true class label of each sample Indicates the first The true class label of each sample This represents the function that takes the maximum value. Indicates the interval boundary. Indicates category The feature prototype vector, Indicates category The feature prototype vector.
8. A method for timed execution of smart contracts for blockchain network data processing according to claim 1, characterized in that, The scheduled execution of smart contracts is triggered based on the blockchain block height or timestamp.
9. A method for timed execution of smart contracts for blockchain network data processing according to claim 1, characterized in that, Tiered response strategies include: If the status is "normal", save the data; if it is "performance degradation", send an alert; if it is "minor fault", generate a repair work order; if it is "serious fault", send a shutdown command and multiple alarms.