Transaction method based on block chain
By building an abnormal transaction detection model in blockchain transactions, using GRU-SVM neural network to learn historical transaction data, and detect abnormalities in transaction data in real time, solving the problem of low transaction security in the existing technology, and achieving a safer and more efficient blockchain transaction process.
Patent Information
- Application Number
- CN202411576549.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-06
AI Technical Summary
In the prior art, transaction security is low and the security of transactions cannot be effectively guaranteed.
Through blockchain, transactions between the transaction initiator and the transaction recipient are realized, and real-time blockchain transaction data is monitored during the transaction process. Build an abnormal transaction detection model, use the GRU-SVM neural network to learn historical blockchain transaction data, detect abnormal transactions in real-time transaction data, and generate warning information or terminate transactions.
It improves the security of blockchain transactions. Through real-time monitoring and abnormal transaction detection, it can effectively prevent potential security threats and ensure the security, efficiency and credibility of transactions.
Smart Images

Figure CN119539804A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of blockchain, and in particular relates to a transaction method based on blockchain. Background Art
[0002] With the development of Internet technology, online transactions are becoming more and more popular. However, existing transaction systems have problems such as centralized storage, low data security, and low transaction efficiency. Blockchain technology, as a decentralized distributed ledger technology, has the characteristics of data immutability and strong transparency, which provides a possibility to solve the problems of existing transaction systems. Blockchain is a distributed database technology that allows multiple participants in the network to exchange and transmit data securely, transparently, and immutably without the need for a central authority. In the existing technology, data is often stored only by blockchain. Although it can effectively improve data security and achieve decentralization, transaction security cannot be guaranteed. Summary of the invention
[0003] The present invention provides a transaction method based on blockchain, which is used to solve the problem of low transaction security in the prior art.
[0004] A transaction method based on blockchain, comprising:
[0005] The transaction between the transaction initiator and the transaction recipient is realized through the blockchain, and the real-time blockchain transaction data is monitored during the transaction process;
[0006] Obtain a historical blockchain transaction data set and build an abnormal transaction detection model, and use the abnormal transaction detection model to learn the historical blockchain transaction data set to obtain the learned abnormal transaction detection model;
[0007] The learned abnormal transaction detection model is used to analyze the real-time blockchain transaction data to determine the abnormal transaction detection result; wherein the abnormal transaction detection result includes whether the transaction is abnormal or not;
[0008] When the abnormal transaction detection result is that the transaction is abnormal, abnormal transaction warning information is generated, and the abnormal transaction warning information is transmitted to the regulatory agency, and the transaction is terminated at the same time;
[0009] When the abnormal transaction detection result shows that there is no abnormality in the transaction, the transaction is marked as a normal transaction and the blockchain-based transaction process is completed.
[0010] Furthermore, the transaction between the transaction initiator and the transaction recipient is realized through the blockchain, including:
[0011] The transaction initiator sends a transaction request to the blockchain network through the blockchain client, where the transaction request includes the transaction amount, information of both parties to the transaction, and transaction conditions;
[0012] The nodes in the blockchain network verify the transaction request, and after the verification is passed, the transaction request enters the waiting queue; the verification includes verifying whether the identity of the transaction initiator, the transaction amount, and the transaction conditions meet the regulations;
[0013] The nodes in the blockchain network record the verified transaction requests on the blockchain to form a new transaction block; the transaction block contains the information of both parties to the transaction, the transaction amount, and the transaction time;
[0014] The transaction parties and other nodes in the blockchain network confirm the newly generated transaction block. When a certain number of nodes confirm that it is correct, the transaction block is added to the main chain of the blockchain and the transaction officially takes effect.
[0015] Furthermore, after the transaction block is added to the main chain of the blockchain, it also includes: the transaction parties and regulatory agencies query the transaction records through the blockchain to ensure the traceability and transparency of the transaction.
[0016] Furthermore, an abnormal transaction detection model is constructed, including: constructing a GRU-SVM neural network to obtain an abnormal transaction detection model.
[0017] Furthermore, by learning the historical blockchain transaction data set through the abnormal transaction detection model, the learned abnormal transaction detection model is obtained, including:
[0018] The parameter weights and biases of the abnormal transaction detection model are initialized using a random initialization method to determine the initial hyperparameters;
[0019] Initialize parameter weights and biases multiple times to determine multiple sets of initial hyperparameters, and group the multiple sets of initial hyperparameters into a population to complete parameter initialization;
[0020] Constructing a loss function of the abnormal transaction detection model, and obtaining the loss function corresponding to each set of hyperparameters in the population based on the loss function and the historical blockchain transaction data set;
[0021] According to the loss function corresponding to each set of hyperparameters, a set of optimal hyperparameters is determined to obtain the optimal hyperparameter group;
[0022] At the same time, the population is divided into the first learning group, the second learning group and the third learning group according to the loss function corresponding to each set of hyperparameters;
[0023] For each set of hyperparameters in the first learning group, according to the loss function corresponding to each set of hyperparameters, a variable speed global search method based on the control of the number of learning times is adopted to update each set of hyperparameters to obtain the updated first learning group;
[0024] For each set of hyperparameters in the second learning group, according to the loss function corresponding to each set of hyperparameters, each set of hyperparameters is updated by adopting a multi-information interaction method based on position advantages and disadvantages to obtain an updated second learning group;
[0025] For each set of hyperparameters in the third learning group, each set of hyperparameters is updated by a one-to-one pairing-based follow-up learning method to obtain an updated third learning group;
[0026] Determine whether the learning end condition is met. If so, re-determine the optimal hyperparameter group according to the updated first learning group, the updated second learning group and the updated third learning group, and apply the optimal hyperparameter group to the abnormal transaction detection model to obtain the learned abnormal transaction detection model; otherwise, reintegrate the updated first learning group, the updated second learning group and the updated third learning group into a population, and obtain the loss function corresponding to each group of hyperparameters in the population according to the loss function and the historical blockchain transaction data set, and return to the step of dividing the population.
[0027] Furthermore, the loss function for constructing the abnormal transaction detection model adopts the SVM loss function.
[0028] Further, for each set of hyperparameters in the first learning group, according to the optimal hyperparameter group and the loss function corresponding to each set of hyperparameters, a variable speed global search method based on learning number control is adopted to update each set of hyperparameters to obtain the updated first learning group, including:
[0029] For each set of hyperparameters in the first learning group, determine the position importance factor of each set of hyperparameters according to the loss function corresponding to each set of hyperparameters;
[0030] According to the position importance factor of each group of hyperparameters, the adaptive search step control factor of each group of hyperparameters is determined;
[0031] Based on the current number of learning times, an adaptive guidance weight is determined, and the optimal hyperparameter group is weighted by the adaptive guidance weight to obtain the weighted optimal hyperparameter group;
[0032] For any set of hyperparameters in the first learning group, after exchanging information with the weighted optimal hyperparameter group, a corresponding adaptive search step length control factor is used for control to determine the first learning parameter item;
[0033] For each set of hyperparameters in the first learning group, add the hyperparameter to its corresponding first learning parameter item to obtain the updated first learning group.
[0034] Furthermore, for each set of hyperparameters in the second learning group, according to the loss function corresponding to each set of hyperparameters, each set of hyperparameters is updated by adopting a multi-information interaction method based on position advantages and disadvantages, and the updated second learning group is obtained, including:
[0035] For each set of hyperparameters in the second learning group, determine the position importance factor of each set of hyperparameters according to the loss function corresponding to each set of hyperparameters;
[0036] For each set of hyperparameters in the second learning group, three different sets of hyperparameters are randomly matched to obtain a first target hyperparameter group, a second target hyperparameter group, and a third target hyperparameter group;
[0037] For any set of hyperparameters in the second learning group, determine a first information interaction factor according to its position importance factor and the position importance factor of the first target hyperparameter group;
[0038] For any set of hyperparameters in the second learning group, determine a second information interaction factor according to its position importance factor and the position importance factor of the second target hyperparameter group;
[0039] For any set of hyperparameters in the second learning group, determine a third information interaction factor according to its position importance factor and the position importance factor of the third target hyperparameter group;
[0040] For any set of hyperparameters in the second learning group, the first information interaction factor is used to perform information interaction between the hyperparameters and the first target hyperparameter group to obtain a first information interaction item;
[0041] For any set of hyperparameters in the second learning group, a second information interaction factor is used to perform information interaction between the hyperparameters and the second target hyperparameter group to obtain a second information interaction item;
[0042] For any set of hyperparameters in the second learning group, a third information interaction factor is used to perform information interaction between the hyperparameters and the third target hyperparameter group to obtain a third information interaction item;
[0043] For each set of hyperparameters in the second learning group, add the first information interaction item, the second information interaction item and the third information interaction item corresponding to the set of hyperparameters to obtain an updated second learning group.
[0044] Furthermore, for each set of hyperparameters in the third learning group, each set of hyperparameters is updated by a one-to-one pairing-based follow-up learning method to obtain an updated third learning group, including:
[0045] For each set of hyperparameters in the third learning group, a set of hyperparameters is randomly matched for it in the second learning group to obtain a follow-up hyperparameter group; and each set of hyperparameters in the third learning group matches a different follow-up hyperparameter group;
[0046] For any set of hyperparameters in the third learning group, a guided update is performed according to its corresponding follow-up hyperparameter group to obtain the updated third learning group.
[0047] Furthermore, the learned abnormal transaction detection model is used to analyze the real-time blockchain transaction data to determine the abnormal transaction detection results, including:
[0048] Using the real-time blockchain transaction data as input to the learned abnormal transaction detection model, and obtaining an abnormal probability and a non-abnormal probability output by the learned abnormal transaction detection model;
[0049] When the abnormal probability is greater than the non-abnormal probability, the abnormal transaction detection result is determined to be that the transaction is abnormal;
[0050] When the abnormal probability is less than the non-abnormal probability, the abnormal transaction detection result is determined to be that there is no abnormality in the transaction.
[0051] The present invention provides a blockchain-based transaction method, which realizes a safe, efficient and reliable transaction process by utilizing the decentralization, non-tamperability and transparency characteristics of blockchain technology. In the transaction process, real-time blockchain transaction data is monitored, and the real-time blockchain transaction data is analyzed using a learned abnormal transaction detection model, so as to determine whether the transaction process is abnormal, thereby effectively improving the security of blockchain transactions. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0053] Figure 1 A flowchart of a blockchain-based transaction method provided in an embodiment of the present invention.
[0054] The above drawings have shown clear embodiments of the present invention, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present invention in any way, but to illustrate the concept of the present invention for those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0055] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0056] The embodiments of the present invention are described in detail below with reference to the accompanying drawings.
[0057] like Figure 1 As shown, an embodiment of the present invention provides a transaction method based on blockchain, including:
[0058] S1. Implement transactions between the transaction initiator and the transaction recipient through blockchain, and monitor real-time blockchain transaction data during the transaction process;
[0059] S2, obtaining a historical blockchain transaction data set and building an abnormal transaction detection model, and learning the historical blockchain transaction data set through the abnormal transaction detection model to obtain the learned abnormal transaction detection model;
[0060] The historical blockchain transaction data set can use the Elliptic data set. An important application of the Elliptic data set is to train machine learning models to automatically detect transactions related to illegal activities. Therefore, the embodiments of the present invention use these existing data for learning, thereby realizing abnormal transaction detection of blockchain. It is worth noting that the staff can also customize some indicators related to abnormal transactions, and then determine the data features input by the staff and the labels corresponding to each data feature, so as to obtain the historical blockchain transaction data set, which can realize the customized transaction anomaly detection task.
[0061] Optionally, the random forest method or principal component analysis method can be used to reduce the dimension of the data features in the historical blockchain transaction data set, thereby effectively reducing the complexity of data processing and improving data processing efficiency.
[0062] S3. Analyze the real-time blockchain transaction data using the learned abnormal transaction detection model to determine an abnormal transaction detection result; wherein the abnormal transaction detection result includes whether the transaction is abnormal or not;
[0063] S4. When the abnormal transaction detection result indicates that the transaction is abnormal, abnormal transaction warning information is generated, and the abnormal transaction warning information is transmitted to the regulatory agency, and the transaction is terminated at the same time;
[0064] Abnormal transaction warning information is not limited to text information, but can also be sound information or sound and light information to facilitate regulatory agencies to manage transactions.
[0065] S5. When the abnormal transaction detection result shows that there is no abnormality in the transaction, the transaction is marked as a normal transaction, and the blockchain-based transaction process is completed.
[0066] The present invention provides a blockchain-based transaction method, which realizes a safe, efficient and reliable transaction process by utilizing the decentralization, non-tamperability and transparency characteristics of blockchain technology. In the transaction process, real-time blockchain transaction data is monitored, and the real-time blockchain transaction data is analyzed using a learned abnormal transaction detection model, so as to determine whether the transaction process is abnormal, thereby effectively improving the security of blockchain transactions.
[0067] In an embodiment of the present invention, a transaction between a transaction initiator and a transaction recipient is implemented through a blockchain, including:
[0068] The transaction initiator sends a transaction request to the blockchain network through the blockchain client, where the transaction request includes the transaction amount, information of both parties to the transaction, and transaction conditions;
[0069] The nodes in the blockchain network verify the transaction request, and after the verification is passed, the transaction request enters the waiting queue; the verification includes verifying whether the identity of the transaction initiator, the transaction amount, and the transaction conditions meet the regulations;
[0070] The nodes in the blockchain network record the verified transaction requests on the blockchain to form a new transaction block; the transaction block contains the information of both parties to the transaction, the transaction amount, and the transaction time;
[0071] The transaction parties and other nodes in the blockchain network confirm the newly generated transaction block. When a certain number of nodes confirm that it is correct, the transaction block is added to the main chain of the blockchain and the transaction officially takes effect.
[0072] In the embodiment of the present invention, after the transaction block is added to the main chain of the blockchain, it also includes: the transaction parties and the regulatory agency query the transaction records through the blockchain to ensure the traceability and transparency of the transaction.
[0073] In an embodiment of the present invention, constructing an abnormal transaction detection model includes: constructing a GRU-SVM (Gated Recurrent Unit-Support Vector Machine) neural network to obtain an abnormal transaction detection model.
[0074] Optionally, in addition to using the GRU-SVM neural network to build an abnormal transaction detection model, other neural networks can also be used to build an abnormal transaction detection model, such as: BP (Back Propagation) neural network, convolutional neural network, LSTM (Long Short-Term Memory), etc. However, it is worth noting that when other neural networks are used to build an abnormal transaction detection model, the loss function corresponding to the other neural networks should be replaced to obtain the loss function value.
[0075] After building the abnormal transaction detection model, it can be trained as follows:
[0076] (1) Input the dataset features into the GRU model.
[0077] (2) Initialize the learning parameter weights and biases with arbitrary values and adjust the learning parameters through training.
[0078] (3) Calculate the cell state of GRU based on the input feature ix and its learning parameter value.
[0079] (4) In the final output layer, the decision function of SVM is used to calculate the prediction results of the model.
[0080] (5) Calculate the loss of the neural network.
[0081] (6) Optimize to minimize the loss function. The loss calculated during the optimization is used to adjust the weight and bias. The optimization algorithm uses the Adam optimizer.
[0082] (7) This process is repeated until the neural network reaches the desired accuracy or the highest accuracy. The trained model can then perform binary classification on the given data.
[0083] Although the above existing learning process can effectively optimize the hyperparameters of the abnormal transaction detection model, it has technical problems such as poor optimization accuracy, poor optimization effect, and easy to fall into local optimality. Therefore, an algorithm that can avoid these problems is needed to optimize the abnormal transaction detection model, thereby improving the detection ability of abnormal transactions.
[0084] In an embodiment of the present invention, the abnormal transaction detection model is used to learn the historical blockchain transaction data set, and the learned abnormal transaction detection model is obtained, including:
[0085] The parameter weights and biases of the abnormal transaction detection model are initialized using a random initialization method to determine the initial hyperparameters;
[0086] For example, the parameter weights and biases of the abnormal transaction detection model can be randomly initialized within the upper and lower limits of its hyperparameters to obtain a hyperparameter group. At this time, the hyperparameter group can be regarded as a vector, and multiple hyperparameter groups can be obtained. Based on this, the optimal hyperparameter group can be determined, thereby optimizing the abnormal transaction detection model.
[0087] Initialize parameter weights and biases multiple times to determine multiple sets of initial hyperparameters, and group the multiple sets of initial hyperparameters into a population to complete parameter initialization;
[0088] Constructing a loss function of the abnormal transaction detection model, and obtaining the loss function corresponding to each set of hyperparameters in the population based on the loss function and the historical blockchain transaction data set;
[0089] For example, the training data in the historical blockchain transaction data set can be used as input, the labels corresponding to the training data in the historical blockchain transaction data set can be used as the expected output, and the loss function value can be obtained through the loss function.
[0090] According to the loss function corresponding to each set of hyperparameters, a set of optimal hyperparameters is determined to obtain the optimal hyperparameter group;
[0091] At the same time, the population is divided into the first learning group, the second learning group and the third learning group according to the loss function corresponding to each set of hyperparameters;
[0092] For each set of hyperparameters in the first learning group, according to the loss function corresponding to each set of hyperparameters, a variable speed global search method based on the control of the number of learning times is adopted to update each set of hyperparameters to obtain the updated first learning group;
[0093] For each set of hyperparameters in the second learning group, according to the loss function corresponding to each set of hyperparameters, each set of hyperparameters is updated by adopting a multi-information interaction method based on position advantages and disadvantages to obtain an updated second learning group;
[0094] For each set of hyperparameters in the third learning group, each set of hyperparameters is updated by a one-to-one pairing-based follow-up learning method to obtain an updated third learning group;
[0095] Determine whether the learning end condition is met (such as the current learning times reaches the maximum learning times). If so, re-determine the optimal hyperparameter group based on the updated first learning group, the updated second learning group, and the updated third learning group, and apply the optimal hyperparameter group to the abnormal transaction detection model to obtain the learned abnormal transaction detection model. Otherwise, reintegrate the updated first learning group, the updated second learning group, and the updated third learning group into a population, and obtain the loss function corresponding to each group of hyperparameters in the population based on the loss function and the historical blockchain transaction data set, and return to the step of dividing the population.
[0096] In the embodiment of the present invention, the loss function for constructing the abnormal transaction detection model adopts the SVM loss function.
[0097] It is worth noting that the use of the SVM loss function is only a preferred implementation of the embodiment of the present invention, and other loss functions can also be used to obtain the loss function value.
[0098] In the embodiment of the present invention, for each group of hyperparameters in the first learning group, according to the optimal hyperparameter group and the loss function corresponding to each group of hyperparameters, a variable speed global search method based on learning number control is adopted to update each group of hyperparameters to obtain the updated first learning group, including:
[0099] A1. For each set of hyperparameters in the first learning group, determine the position importance factor of each set of hyperparameters according to the loss function corresponding to each set of hyperparameters;
[0100] For each set of hyperparameters in the first learning group, the position importance factor is:
[0101]
[0102] Among them, f i represents the position importance factor corresponding to the i-th group of hyperparameters in the first learning group, l i represents the loss function value corresponding to the i-th group of hyperparameters in the first learning group, ε represents a very small constant term, such as ε is 0.00001, i = 1, 2, …, Q, Q represents the number of hyperparameter groups in the first learning group;
[0103] A2. Determine the adaptive search step length control factor for each group of hyperparameters according to the position importance factor of each group of hyperparameters; the adaptive search step length control factor is:
[0104] ξ i =Randn(0,σ i 2 )
[0105]
[0106] Among them, ξ i represents the adaptive search step size control factor corresponding to the i-th group of hyperparameters in the first learning group, Randn(0,σ i 2 ) means that the mean is 0 and the variance is σ i 2 A random value obtained from a Gaussian distribution, f best It represents the position importance factor corresponding to the best hyperparameter group, and exp represents the exponential function with the natural constant e as the base;
[0107] A3. Based on the current number of learning times, determine the adaptive guidance weight, and use the adaptive guidance weight to weight the optimal hyperparameter group to obtain the weighted optimal hyperparameter group;
[0108] The adaptive guidance weight is:
[0109]
[0110] Among them, t represents the current learning number, ω represents the adaptive guidance weight, cos represents the pre-function, π represents pi, and T represents the preset maximum learning number.
[0111] A4. For any set of hyperparameters in the first learning group, after information interaction between it and the weighted optimal hyperparameter group, a corresponding adaptive search step size control factor is used for control to determine the first learning parameter item;
[0112] The first learning parameter item is: in, represents the i-th group of hyperparameters in the first learning group, represents the best hyperparameter group;
[0113] A5. For each set of hyperparameters in the first learning group, add the hyperparameter to its corresponding first learning parameter item to obtain the updated first learning group.
[0114] Get any set of hyperparameters in the first learning group after update:
[0115]
[0116] in, Indicates that after the update
[0117] The embodiment of the present invention adopts a variable speed global search method based on the control of the number of learning times to update each group of hyperparameters. The best hyperparameter group can be used for guidance and can avoid falling into the local optimum. In the early stage of the algorithm, each group of hyperparameters in the first learning group can explore the area around itself and realize the exploration of multiple better areas; in the middle stage of the algorithm, the best hyperparameter group is gradually learned, which can maintain the diversity of the population while improving the learning speed; and in the later stage of the algorithm, a large amount of information on the best position can be learned, which can effectively improve the learning accuracy of the algorithm and effectively balance the learning efficiency and learning quality.
[0118] In the embodiment of the present invention, for each set of hyperparameters in the second learning group, according to the loss function corresponding to each set of hyperparameters, each set of hyperparameters is updated by adopting a multi-information interaction method based on position advantages and disadvantages to obtain the updated second learning group, including:
[0119] B1. For each set of hyperparameters in the second learning group, determine the position importance factor of each set of hyperparameters according to the loss function corresponding to each set of hyperparameters;
[0120] For each set of hyperparameters in the second learning group, the position importance factor is:
[0121]
[0122] Among them, f n represents the position importance factor corresponding to the nth group of hyperparameters in the second learning group, l n represents the loss function value corresponding to the nth group of hyperparameters in the first learning group, ε represents a very small constant term, n = 1, 2, …, P, and P represents the number of hyperparameter groups in the second learning group;
[0123] B2. For each set of hyperparameters in the second learning group, three different sets of hyperparameters are randomly matched to obtain a first target hyperparameter group, a second target hyperparameter group, and a third target hyperparameter group;
[0124] Optionally, in order to improve the learning speed and effect of the algorithm, the first target hyperparameter group, the second target hyperparameter group and the third target hyperparameter group in the embodiment of the present invention are obtained from the first learning group.
[0125] B3. For any set of hyperparameters in the second learning group, determine the first information interaction factor according to its position importance factor and the position importance factor of the first target hyperparameter group;
[0126] The first information interaction factor is:
[0127]
[0128] Among them, φ1 represents the first information interaction factor, f r1 represents the position importance factor of the first target hyperparameter group;
[0129] B4. For any set of hyperparameters in the second learning group, determine a second information interaction factor according to its position importance factor and the position importance factor of the second target hyperparameter group;
[0130] The second information interaction factor is:
[0131] φ2=exp(-|f r2 -f n |)
[0132] Among them, φ2 represents the second information interaction factor, f r2 represents the position importance factor of the second target hyperparameter group;
[0133] B5. For any set of hyperparameters in the second learning group, determine a third information interaction factor according to its position importance factor and the position importance factor of the third target hyperparameter group;
[0134] The third information interaction factor is:
[0135] φ3=exp(-|f r3 -f n |)
[0136] Among them, φ3 represents the third information interaction factor, f r3 represents the position importance factor of the third target hyperparameter group;
[0137] B6. For any set of hyperparameters in the second learning group, use the first information interaction factor to perform information interaction between the hyperparameters and the first target hyperparameter group to obtain a first information interaction item;
[0138] The first information interaction item is: in, represents the nth group of hyperparameters in the second learning group, represents the first target hyperparameter group, rand1 represents a random number between (0,1);
[0139] B7. For any set of hyperparameters in the second learning group, use a second information interaction factor to perform information interaction between the hyperparameters and the second target hyperparameter group to obtain a second information interaction item;
[0140] The second information interaction item is: in, represents the second target hyperparameter group, rand2 represents a random number between (0,1);
[0141] B8. For any set of hyperparameters in the second learning group, use a third information interaction factor to perform information interaction between the hyperparameters and the third target hyperparameter group to obtain a third information interaction item;
[0142] The third information interaction item is: in, represents the third target hyperparameter group, and rand3 represents a random number between (0,1);
[0143] B9. For each set of hyperparameters in the second learning group, add the first information interaction item, the second information interaction item and the third information interaction item corresponding to the hyperparameter to obtain an updated second learning group.
[0144] Get any set of hyperparameters in the second learning group after update:
[0145]
[0146] in, Indicates that after the update
[0147] The embodiment of the present invention adopts a multi-information interaction method based on the advantages and disadvantages of the position to update each group of hyperparameters. It can adaptively perform learning according to the relative position between the target hyperparameter group and the hyperparameter group in the second learning group, and through information interaction of multiple hyperparameter groups, it can effectively realize the search of unfamiliar areas, thereby achieving higher learning efficiency and improving the possibility of finding the optimal position.
[0148] In the embodiment of the present invention, for each set of hyperparameters in the third learning group, a one-to-one pairing-based follow-up learning method is used to update each set of hyperparameters to obtain the updated third learning group, including:
[0149] C1. For each set of hyperparameters in the third learning group, a set of hyperparameters is randomly matched for it in the second learning group to obtain a follow-up hyperparameter group; and each set of hyperparameters in the third learning group matches a different follow-up hyperparameter group;
[0150] C2. For any set of hyperparameters in the third learning group, a guided update is performed according to its corresponding follow-up hyperparameter group to obtain the updated third learning group.
[0151] Get any set of hyperparameters in the third learning group after update:
[0152]
[0153] in, represents the position importance factor corresponding to the nth group of hyperparameters in the third learning group, Indicates that after the update rand4 represents a random number between (0,2). Expressed as Matched follower hyperparameter groups.
[0154] The embodiment of the present invention adopts a one-to-one pairing-based follow-up learning method to update each group of hyperparameters, which can not only enable a quick search for a hyperparameter group with a poor position, but also enable information exchange at a poor position, thereby effectively ensuring the diversity of the population.
[0155] Optionally, out-of-bounds processing may be performed on each set of hyperparameters in the updated first learning group, the second learning group, and the third learning group.
[0156] In an embodiment of the present invention, the learned abnormal transaction detection model is used to analyze the real-time blockchain transaction data to determine the abnormal transaction detection result, including:
[0157] Using the real-time blockchain transaction data as input to the learned abnormal transaction detection model, and obtaining an abnormal probability and a non-abnormal probability output by the learned abnormal transaction detection model;
[0158] When the abnormal probability is greater than the non-abnormal probability, the abnormal transaction detection result is determined to be that the transaction is abnormal;
[0159] When the abnormal probability is less than the non-abnormal probability, the abnormal transaction detection result is determined to be that there is no abnormality in the transaction.
[0160] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0161] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1A device that provides the functions specified in a block or multiple blocks.
[0162] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0163] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0164] A person of ordinary skill in the art can understand that all or part of the steps in realizing the above-mentioned facts and methods can be completed by instructing the relevant hardware through a program, and the program involved or the program described can be stored in a computer-readable storage medium. When the program is executed, it includes the following steps: At this time, the corresponding method steps are derived, and the storage medium can be ROM / RAM, a disk, an optical disk, etc.
[0165] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A transaction method based on blockchain, characterized in that: include: The transaction between the transaction initiator and the transaction recipient is realized through the blockchain, and the real-time blockchain transaction data is monitored during the transaction process; Obtain a historical blockchain transaction data set and build an abnormal transaction detection model, and use the abnormal transaction detection model to learn the historical blockchain transaction data set to obtain the learned abnormal transaction detection model; The learned abnormal transaction detection model is used to analyze the real-time blockchain transaction data to determine the abnormal transaction detection result; wherein the abnormal transaction detection result includes whether the transaction is abnormal or not; When the abnormal transaction detection result is that the transaction is abnormal, abnormal transaction warning information is generated, and the abnormal transaction warning information is transmitted to the regulatory agency, and the transaction is terminated at the same time; When the abnormal transaction detection result shows that there is no abnormality in the transaction, the transaction is marked as a normal transaction and the blockchain-based transaction process is completed.
2. The blockchain-based transaction method according to claim 1, characterized in that: Transactions between the transaction initiator and the transaction recipient are realized through blockchain, including: The transaction initiator sends a transaction request to the blockchain network through the blockchain client, where the transaction request includes the transaction amount, information of both parties to the transaction, and transaction conditions; The nodes in the blockchain network verify the transaction request, and after the verification is passed, the transaction request enters the waiting queue; the verification includes verifying whether the identity of the transaction initiator, the transaction amount, and the transaction conditions meet the regulations; The nodes in the blockchain network record the verified transaction requests on the blockchain to form a new transaction block; the transaction block contains the information of both parties to the transaction, the transaction amount, and the transaction time; The transaction parties and other nodes in the blockchain network confirm the newly generated transaction block. When a certain number of nodes confirm that it is correct, the transaction block is added to the main chain of the blockchain and the transaction officially takes effect.
3. The blockchain-based transaction method according to claim 2, characterized in that: After the transaction block is added to the main chain of the blockchain, it also includes: the transaction parties and regulators query the transaction records through the blockchain to ensure the traceability and transparency of the transaction.
4. The blockchain-based transaction method according to claim 1, characterized in that: Constructing an abnormal transaction detection model, including: constructing a GRU-SVM neural network to obtain an abnormal transaction detection model.
5. The blockchain-based transaction method according to any one of claims 1 to 4, characterized in that: Through the learning of the historical blockchain transaction data set by the abnormal transaction detection model, the learned abnormal transaction detection model is obtained, including: The parameter weights and biases of the abnormal transaction detection model are initialized using a random initialization method to determine the initial hyperparameters; Initialize parameter weights and biases multiple times to determine multiple sets of initial hyperparameters, and group the multiple sets of initial hyperparameters into a population to complete parameter initialization; Constructing a loss function of the abnormal transaction detection model, and obtaining the loss function corresponding to each set of hyperparameters in the population based on the loss function and the historical blockchain transaction data set; According to the loss function corresponding to each set of hyperparameters, a set of optimal hyperparameters is determined to obtain the optimal hyperparameter group; At the same time, the population is divided into the first learning group, the second learning group and the third learning group according to the loss function corresponding to each set of hyperparameters; For each set of hyperparameters in the first learning group, according to the loss function corresponding to each set of hyperparameters, a variable speed global search method based on the control of the number of learning times is adopted to update each set of hyperparameters to obtain the updated first learning group; For each set of hyperparameters in the second learning group, according to the loss function corresponding to each set of hyperparameters, each set of hyperparameters is updated by adopting a multi-information interaction method based on position advantages and disadvantages to obtain an updated second learning group; For each set of hyperparameters in the third learning group, each set of hyperparameters is updated by adopting a one-to-one pairing-based follow-up learning method to obtain an updated third learning group; Determine whether the learning end condition is met. If so, re-determine the optimal hyperparameter group according to the updated first learning group, the updated second learning group and the updated third learning group, and apply the optimal hyperparameter group to the abnormal transaction detection model to obtain the learned abnormal transaction detection model; otherwise, reintegrate the updated first learning group, the updated second learning group and the updated third learning group into a population, and obtain the loss function corresponding to each group of hyperparameters in the population according to the loss function and the historical blockchain transaction data set, and return to the step of dividing the population.
6. The blockchain-based transaction method according to claim 5, characterized in that: The loss function for constructing the abnormal transaction detection model adopts the SVM loss function.
7. The blockchain-based transaction method according to claim 5, characterized in that: For each set of hyperparameters in the first learning group, according to the optimal hyperparameter group and the loss function corresponding to each set of hyperparameters, each set of hyperparameters is updated by adopting a variable speed global search method based on the number of learning times control to obtain the updated first learning group, including: For each set of hyperparameters in the first learning group, determine the position importance factor of each set of hyperparameters according to the loss function corresponding to each set of hyperparameters; According to the position importance factor of each group of hyperparameters, the adaptive search step control factor of each group of hyperparameters is determined; Based on the current number of learning times, an adaptive guidance weight is determined, and the optimal hyperparameter group is weighted by the adaptive guidance weight to obtain the weighted optimal hyperparameter group; For any set of hyperparameters in the first learning group, after exchanging information with the weighted optimal hyperparameter group, a corresponding adaptive search step length control factor is used for control to determine the first learning parameter item; For each set of hyperparameters in the first learning group, add the hyperparameter to its corresponding first learning parameter item to obtain the updated first learning group.
8. The blockchain-based transaction method according to claim 7, characterized in that: For each set of hyperparameters in the second learning group, according to the loss function corresponding to each set of hyperparameters, each set of hyperparameters is updated by adopting a multi-information interaction method based on position advantages and disadvantages, and the updated second learning group is obtained, including: For each set of hyperparameters in the second learning group, determine the position importance factor of each set of hyperparameters according to the loss function corresponding to each set of hyperparameters; For each set of hyperparameters in the second learning group, three different sets of hyperparameters are randomly matched to obtain a first target hyperparameter group, a second target hyperparameter group, and a third target hyperparameter group; For any set of hyperparameters in the second learning group, determine a first information interaction factor according to its position importance factor and the position importance factor of the first target hyperparameter group; For any set of hyperparameters in the second learning group, determine a second information interaction factor according to its position importance factor and the position importance factor of the second target hyperparameter group; For any set of hyperparameters in the second learning group, determine a third information interaction factor according to its position importance factor and the position importance factor of the third target hyperparameter group; For any set of hyperparameters in the second learning group, the first information interaction factor is used to perform information interaction between the hyperparameters and the first target hyperparameter group to obtain a first information interaction item; For any set of hyperparameters in the second learning group, a second information interaction factor is used to perform information interaction between the hyperparameters and the second target hyperparameter group to obtain a second information interaction item; For any set of hyperparameters in the second learning group, a third information interaction factor is used to perform information interaction between the hyperparameters and the third target hyperparameter group to obtain a third information interaction item; For each set of hyperparameters in the second learning group, add the first information interaction item, the second information interaction item and the third information interaction item corresponding to the set of hyperparameters to obtain an updated second learning group.
9. The blockchain-based transaction method according to claim 8, characterized in that: For each set of hyperparameters in the third learning group, each set of hyperparameters is updated by a one-to-one pairing-based follow-up learning method to obtain the updated third learning group, including: For each set of hyperparameters in the third learning group, a set of hyperparameters is randomly matched for it in the second learning group to obtain a follow-up hyperparameter group; and each set of hyperparameters in the third learning group matches a different follow-up hyperparameter group; For any set of hyperparameters in the third learning group, a guided update is performed according to its corresponding follow-up hyperparameter group to obtain the updated third learning group.
10. The blockchain-based transaction method according to claim 9, characterized in that: The learned abnormal transaction detection model is used to analyze the real-time blockchain transaction data to determine the abnormal transaction detection results, including: Using the real-time blockchain transaction data as input to the learned abnormal transaction detection model, and obtaining an abnormal probability and a non-abnormal probability output by the learned abnormal transaction detection model; When the abnormal probability is greater than the non-abnormal probability, the abnormal transaction detection result is determined to be that the transaction is abnormal; When the abnormal probability is less than the non-abnormal probability, the abnormal transaction detection result is determined to be that there is no abnormality in the transaction.
Citation Information
Patent Citations
Hyper-parameter asynchronous parallel search method based on population evolution
CN111178486A
Block chain abnormal transaction identification method and device, storage medium and electronic equipment
CN114186646A
Block chain abnormal transaction detection method, system and device and storage medium
CN116628613A
Cross-chain abnormal transaction detection method and system based on graph random neural network
CN117078259A
Abnormal transaction detection method based on block chain
CN118229421A