CN112488831A - Block chain network transaction method and device, storage medium and electronic equipment - Google Patents

Block chain network transaction method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112488831A
CN112488831A CN202011314898.1A CN202011314898A CN112488831A CN 112488831 A CN112488831 A CN 112488831A CN 202011314898 A CN202011314898 A CN 202011314898A CN 112488831 A CN112488831 A CN 112488831A
Authority
CN
China
Prior art keywords
transaction
target
state data
state
success rate
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011314898.1A
Other languages
Chinese (zh)
Inventor
牟童
王诗鈞
徐石成
何光宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Neusoft Corp
Original Assignee
Neusoft Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Neusoft Corp filed Critical Neusoft Corp
Priority to CN202011314898.1A priority Critical patent/CN112488831A/en
Publication of CN112488831A publication Critical patent/CN112488831A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/23Clustering techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction

Abstract

The present disclosure relates to a block chain network transaction method, apparatus, storage medium, and electronic device, the method comprising: responding to a transaction request acquired by a target node, and acquiring state data corresponding to target historical transaction of the target node; inputting the state data into an environment prediction model to obtain a target type label of the state data output by the environment prediction model; determining the target trading success rate of the trading request according to the proportion of the training samples marked with the target type labels and the trading state of the training samples marked with the target type labels to the successful state; and determining whether to execute the transaction operation corresponding to the transaction request according to the size relation between the target transaction success rate and the success rate threshold.

Description

Block chain network transaction method and device, storage medium and electronic equipment
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method and an apparatus for blockchain network transaction, a storage medium, and an electronic device.
Background
Blockchains are a technique that can collectively maintain a reliable database through decentralization and distrust. The method can store transactions occurring in a period of time by taking the blocks as units, and connect the blocks according to time sequence by using a cryptographic algorithm to form a data structure similar to a chain. The block chain technology has the characteristics of distributed accounts, decentralization, non-falsification and the like, and has a relatively high application prospect in many aspects.
In a related scene, when a blockchain node performs cross-chain transaction, a transaction failure phenomenon may occur, so that the transaction rolls back, and the performance of the whole cross-chain system is reduced.
Disclosure of Invention
An object of the present disclosure is to provide a method, an apparatus, a storage medium, and an electronic device for block chain network transaction, so as to solve the above related technical problems.
In order to achieve the above object, according to a first aspect of embodiments of the present disclosure, there is provided a block chain network transaction method, including:
responding to a transaction request acquired by a target node, acquiring state data corresponding to target historical transactions of the target node, wherein the target historical transactions are historical transactions generated by the target node within a preset time before the current time, or the target historical transactions are historical transactions of a preset number which are generated by the target node most recently before the transaction request is acquired;
inputting the state data into an environment prediction model to obtain a target type label of the state data output by the environment prediction model, wherein training samples of the environment prediction model are obtained based on state data of historical transactions generated in a block chain network, and each training sample is marked with a type label;
determining the target trading success rate of the trading request according to the proportion of the training samples marked with the target type labels and the trading state of the training samples marked with the target type labels to the successful state;
and determining whether to execute the transaction operation corresponding to the transaction request according to the size relation between the target transaction success rate and the success rate threshold.
Optionally, the state data comprises transaction state data of the target historical transactions, the environmental prediction model comprises a transaction state prediction model, and accordingly:
the inputting the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
taking the transaction state data of all the target historical transactions as an input quantity of the transaction state prediction model, inputting the transaction state prediction model to obtain a first target type label which is output by the transaction state prediction model and represents the transaction state type, wherein training samples of the transaction state prediction model correspond to historical transaction time periods of the block chain network one by one, and transaction state data corresponding to all the historical transactions of the same block chain node in one historical time period serve as a training sample;
the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and determining a first transaction success rate of the transaction request according to the proportion of the training samples marked with the first target type labels and the transaction state of the training samples marked with the first target type labels to the successful state, wherein the target transaction success rate comprises the first transaction success rate.
Optionally, the state data comprises system state data for characterizing a system state at the occurrence of the target historical transaction, the environmental prediction model comprises a system state clustering model, and accordingly:
the inputting the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
inputting system state data of all the target historical transactions into the system state clustering model in a mode that the system state data of one target historical transaction serves as an input quantity to obtain a second target type label which is output by the system state clustering model and is used for representing the system state type of each target historical transaction, wherein a training sample of the system state clustering model is system state data corresponding to each historical transaction of the block chain network, the system state clustering model is clustered into a plurality of clusters aiming at all the training samples in a training process, and the second target type label is a target cluster to which the system state data representing the target historical transactions belong;
the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and determining a second transaction success rate of the transaction request according to the proportion of the training samples marked with the second target type labels and the transaction state of the training samples marked with the second target type labels to the training samples marked with the second target type labels, wherein the target transaction success rate comprises the second transaction success rate.
Optionally, the determining a second transaction success rate of the transaction request according to a proportion of the training samples marked with the second target type tag and having a transaction state as a success state to all training samples marked with the second target type tag includes:
for each second target type label, determining a first proportion of the training samples marked with the second target type label in all the training samples;
for each second target type label, determining a second proportion of system state data belonging to the second target type label in state data corresponding to all target historical transactions;
determining the weight of a second target type label corresponding to the system state data of each target historical transaction according to the first proportion and the second proportion of each second target type label;
weighting and summing the weight of the second target type label corresponding to the weight corresponding to the system state data of each target historical transaction and the target proportion corresponding to the second target type label marked with the system state data to obtain the second transaction success rate;
the target proportion is the proportion of the training samples marked with the second target type label and in which the transaction state is the success state in all the training samples marked with the second target type label.
Optionally, the state data comprises system state data of the target historical transactions, the environment prediction model comprises a system state prediction model, and accordingly:
the inputting the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
taking system state data of all the target historical transactions as an input quantity of the system state prediction model, inputting the system state prediction model to obtain a third target type label which is output by the system state prediction model and represents a system state type, wherein training samples of the system state prediction model correspond to historical transaction time periods of the block chain network one by one, and system state data corresponding to all historical transactions of the same block chain node in one historical time period serve as a training sample;
the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and determining a third transaction success rate of the transaction request according to the proportion of the training samples marked with the third target type labels and the transaction state of the training samples marked with the third target type labels to the training samples marked with the successful state, wherein the target transaction success rate comprises the third transaction success rate.
Optionally, the state data includes transaction state data of the target historical transaction, and the environment prediction model includes a transaction state clustering model, which corresponds to:
the inputting the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
inputting the transaction state data of all the target historical transactions into the transaction state clustering model in a mode that the transaction state data of one target historical transaction is used as an input quantity to obtain a fourth target type label which is output by the transaction state clustering model and is used for representing the transaction state type of each target historical transaction, wherein a training sample of the transaction state clustering model is the transaction state data corresponding to each historical transaction of the blockchain network, the transaction state clustering model is clustered into a plurality of clusters aiming at all the training samples in a training process, and the fourth target type label is a target cluster to which the transaction state data representing the target historical transactions belong;
the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and determining a fourth transaction success rate of the transaction request according to the proportion of the training samples marked with the fourth target type labels and the transaction state of the training samples marked with the fourth target type labels to the training samples marked with the fourth target type labels, wherein the target transaction success rate comprises the fourth transaction success rate.
Optionally, the state data includes transaction state data of the target historical transaction and system state data, the system state data is used for representing a system state at an occurrence time of the target historical transaction, and the environment prediction model includes a transaction state prediction model, a system state clustering model, a transaction state clustering model and a system state prediction model; accordingly:
the target transaction success rate includes:
a first transaction success rate based on the transaction state data and the transaction state prediction model;
obtaining a second transaction success rate based on the system state data and the system state clustering model;
a third transaction success rate based on the system state data and the system state prediction model;
a fourth transaction success rate is obtained based on the transaction state data and the transaction state clustering model;
the determining whether to execute the transaction operation corresponding to the transaction request according to the magnitude relation between the target transaction success rate and the success rate threshold value includes:
weighting and summing the first transaction success rate, the second transaction success rate, the third transaction success rate and the third transaction success rate to obtain a sum value;
executing the transaction operation corresponding to the transaction request under the condition that the sum is greater than the success rate threshold value;
revoking the transaction request if the sum is less than or equal to the success rate threshold.
Optionally, the transaction status data includes one or more of transaction concurrency number, transaction response time, transaction throughput, transaction timeout set time, block-out time set information, block size set information, last transaction result identifier, and current transaction result identifier.
Optionally, the system status data includes one or more of CPU occupancy, network occupancy bandwidth, memory occupancy, disk usage rate, CPU occupancy change rate, network occupancy bandwidth change rate, memory occupancy change rate, and disk usage change rate.
Optionally, the target cluster number of the system state cluster model or the transaction state cluster model is obtained by:
setting a plurality of candidate cluster numbers;
for each candidate cluster number, clustering the data to be clustered according to the candidate cluster number until the clustering center is converged;
calculating inter-class spacing values of a plurality of cluster categories corresponding to each candidate cluster number and intra-class spacing values of data in each of the cluster categories;
and taking the candidate cluster number corresponding to the maximum value in the difference value between the inter-class distance value and the intra-class distance value as the target cluster number.
Optionally, the transaction request is a cross-chain transaction request, correspondingly, the target historical transactions are historical cross-chain transactions generated by the target node within a preset time before the current time, or the target historical transactions are a preset number of historical cross-chain transactions newly generated by the target node before the transaction request is acquired, and the training sample of the environment prediction model is obtained based on state data of the historical cross-chain transactions generated in the block chain network.
According to a second aspect of the embodiments of the present disclosure, there is provided a blockchain network transaction apparatus including:
the first obtaining module is used for responding to a transaction request obtained by a target node, and obtaining state data corresponding to target historical transactions of the target node, wherein the target historical transactions are historical transactions generated by the target node within a preset time length before the current moment, or the target historical transactions are the latest historical transactions of a preset number generated by the target node before the transaction request is obtained;
the first input module is used for inputting the state data into an environment prediction model to obtain a target type label of the state data output by the environment prediction model, training samples of the environment prediction model are obtained based on state data of historical transactions generated in a block chain network, and each training sample is marked with a type label;
the first determining module is used for determining the target trading success rate of the trading request according to the proportion of the training samples marked with the target type labels and the trading state of the training samples marked with the target type labels in the successful state;
and the second determining module is used for determining whether to execute the transaction operation corresponding to the transaction request according to the size relation between the target transaction success rate and the success rate threshold.
According to a third aspect of embodiments of the present disclosure, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method of any one of the above-mentioned first aspects.
According to a fourth aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any of the first aspects above.
In the above technical solution, when a target node in a blockchain network obtains a transaction request, state data corresponding to a target historical transaction of the target node may be obtained. In this way, the state data can be input into an environment prediction model to obtain a target type label corresponding to the state data, and the target transaction success rate of the transaction request is determined according to the proportion of the training samples marked with the target type label and the transaction state of the training samples marked with the target type label in the successful state. That is to say, the technical scheme can predict the success rate of the transaction before the transaction is carried out, and further can cancel the transaction with lower success rate. Therefore, by adopting the technical scheme, the transaction success probability can be improved, and the influence of transaction failure on the network performance can be reduced.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the disclosure and are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description serve to explain the disclosure without limiting the disclosure. In the drawings:
fig. 1 is a flowchart illustrating a method for block-chain network transaction according to an exemplary embodiment of the disclosure.
Fig. 2 is a flowchart illustrating a method for blockchain network transaction according to an exemplary embodiment of the disclosure.
Fig. 3 is a flowchart illustrating a method for blockchain network transaction according to an exemplary embodiment of the disclosure.
Fig. 4 is a flowchart illustrating a method of blockchain network transaction according to an exemplary embodiment of the present disclosure.
Fig. 5 is a flowchart illustrating a method for blockchain network transaction according to an exemplary embodiment of the disclosure.
Fig. 6 is a flow chart illustrating a determination of cluster numbers of a cluster model according to an exemplary embodiment of the disclosure.
Fig. 7 is a block diagram of a blockchain network transaction device according to an exemplary embodiment of the present disclosure.
Fig. 8 is a block diagram of an electronic device shown in an exemplary embodiment of the present disclosure.
Detailed Description
The following detailed description of specific embodiments of the present disclosure is provided in connection with the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating the present disclosure, are given by way of illustration and explanation only, not limitation.
Before introducing the blockchain network transaction method, apparatus, storage medium, and electronic device of the present disclosure, an application scenario of each embodiment provided by the present disclosure is first introduced, and each embodiment provided by the present disclosure may be applied to a transaction scenario of blockchain nodes, for example, the transactions may be transactions in the same blockchain network or cross-chain transactions performed between nodes belonging to different blockchain networks.
In a related scene, when a blockchain node performs cross-chain transaction, a transaction failure phenomenon may occur, so that the transaction rolls back, and the performance of the whole cross-chain system is reduced.
To this end, the present disclosure provides a method for block chain network transaction, and fig. 1 is a flowchart of a method for block chain network transaction shown in an exemplary embodiment of the present disclosure, where the method includes:
in step S11, in response to the target node acquiring the transaction request, state data corresponding to the target historical transaction of the target node is acquired.
In particular, the blockchain network transaction method may be applied to a transaction recipient, i.e. the target node may act as a transaction recipient. After receiving the transaction request, the target node may obtain state data corresponding to a target historical transaction of the target node.
With respect to the target historical transactions, the target historical transactions may be historical transactions generated by the target node within a preset time period before the current time, and the preset time period may be, for example, one hour, one day, and the like. In some embodiments, the target historical transaction may also be a preset number of historical transactions that are newly generated by the target node before the transaction request is obtained, for example, 10 transactions, 15 transactions, and so on that are newly generated.
In S12, the state data is input to an environment prediction model, and a target type tag of the state data output by the environment prediction model is obtained.
The training samples of the environmental prediction model may be derived, for example, based on state data of historical transactions generated in the blockchain network, and it should be understood that the composition structure of the training samples may be consistent with the state data input to the environmental prediction model. For example, if the state data input to the environment prediction model is the state data corresponding to the 10 latest historical transactions generated in the history, the historical transactions in the block chain network may be arranged according to a time sequence when the environment state model is trained, and the state data corresponding to the 10 adjacent historical transactions may be used as a training sample.
In addition, each of the training samples may be labeled with a type label. Therefore, by comparing the type label with the prediction label output by the environment prediction model, the loss value of the environment prediction model can be determined, so that the model parameters can be adjusted according to the loss value, and the effect of training the model is achieved.
In this way, the state data may be input to an environment prediction model, and a target type tag of the state data output by the environment prediction model may be obtained.
In step S13, the target transaction success rate of the transaction request is determined according to the proportion of the training samples marked with the target type labels and the transaction status is a successful status in all the training samples marked with the target type labels.
It should be appreciated that because the training samples are derived based on the status data corresponding to historical trades, each training sample may correspond to a true trade outcome, such as a trade success or a trade failure. Therefore, after the target type label corresponding to the target historical trading place is obtained through the environment prediction model, the trading success rate corresponding to the trading request can be determined based on the historical data. For example, the ratio of the training samples marked with the target type labels and having a transaction state as a success state to all the training samples marked with the target type labels is used as the target transaction success rate of the transaction request.
In step S14, it is determined whether to execute the transaction operation corresponding to the transaction request according to the magnitude relationship between the target transaction success rate and the success rate threshold.
For example, in some implementations, the target transaction success rate is greater than a success rate threshold, in which case the transaction may be performed. In other implementations, the target transaction success rate may also be less than the success rate threshold, in which case the transaction request may be revoked/denied. In addition, the success rate threshold may be set according to application requirements, for example, 60%, 80%, and so on.
In the above technical solution, when a target node in a blockchain network obtains a transaction request, state data corresponding to a target historical transaction of the target node may be obtained. In this way, the state data can be input into an environment prediction model to obtain a target type label corresponding to the state data, and the target transaction success rate of the transaction request is determined according to the proportion of the training samples marked with the target type label and the transaction state of the training samples marked with the target type label in the successful state. That is to say, the technical scheme can predict the success rate of the transaction before the transaction is carried out, and further can cancel the transaction with lower success rate. Therefore, by adopting the technical scheme, the transaction success probability can be improved, and the influence of transaction failure on the network performance can be reduced.
It should be noted that, in the above embodiments, the method is described by taking the method as an example of being applied to a transaction receiving party, but in some implementation scenarios, the method may also be applied to an initiator, a relay, and the like of a transaction. Meanwhile, the initiator and the receiver of the transaction can belong to the same blockchain network or different blockchain networks.
For example, in a possible implementation, the transaction request is a cross-chain transaction request, accordingly, the target historical transaction is a historical cross-chain transaction generated by the target node within a preset time period before the current time, or the target historical transaction is a preset number of historical cross-chain transactions newly generated by the target node before the transaction request is acquired, and the training sample of the environment prediction model is obtained based on state data of the historical cross-chain transaction generated in the blockchain network. That is to say, the technical scheme can predict the success rate of the cross-chain transaction, so that the influence of the phenomenon of cross-chain transaction failure on the system performance is reduced.
In addition, in some implementation scenarios, the status data may also include status data of target historical transactions for each transaction party. For example, when the method is executed on a transaction receiver, the transaction receiver may determine the target transaction success rate according to state data corresponding to a target historical transaction of its own node, may also obtain state data corresponding to a target historical transaction of a transaction initiator, and determine another target transaction success rate by the block chain network transaction method provided by the present disclosure. Therefore, the final success rate of the transaction can be determined by synthesizing the respective target transaction success rates of the transaction parties, and the execution strategy of the transaction is further determined. Of course, in some implementation scenarios, the transaction party may also include a relay party of the transaction, which is not limited by this disclosure.
In one possible embodiment, the state data includes transaction state data of the targeted historical transactions, and the environmental predictive model includes a transaction state predictive model. Referring to fig. 2, a flowchart of a method for performing a blockchain network transaction, where the method inputs the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model based on fig. 1, includes:
and S121, inputting the transaction state data of all the target historical transactions as an input quantity of the transaction state prediction model into the transaction state prediction model to obtain a first target type label which is output by the transaction state prediction model and represents the transaction state type.
The transaction state data may represent a transaction state corresponding to each of the target historical transactions, and may include one or more of transaction concurrency number, transaction response time, transaction throughput, transaction timeout setting time, block-out time setting information, block size setting information, last transaction result identifier (e.g., success identifier or failure identifier), and current transaction result identifier (e.g., success identifier or failure identifier).
The training samples of the transaction state prediction model correspond to historical transaction time periods of the block chain network one by one, and transaction state data corresponding to all historical transactions of the same block chain node in one historical time period serve as one training sample.
For example, the transaction state prediction model may be constructed based on the LSTM (Long Short-Term Memory network). Wherein the time step of the LSTM may be determined based on a transaction state of a blockchain network, for example. For example, a time t seconds may be selected and the average number of transactions generated within t seconds may be calculated as the time step NT of the LSTM. In this way, training samples may be determined based on the time step NT and transaction state data corresponding to historical transactions of the blockchain node.
For example, the training samples may be determined based on transaction state data corresponding to multiple historical transactions for the same node. The transaction state data comprises transaction concurrency number TcTransaction response time TrTransaction throughput TtpsTransaction timeout setting time ToAnd block-out time setting information BtBlock size setting information BsFor example, if the node includes 100 transaction state data corresponding to 100 historical transactions and the time step TN is 20, a training sample [5, 20, 8 ] can be obtained]. Where 20 is the time step, 5 is the number of samples, and 8 is the sample feature number ({ T }c,Tr,Ttps,To,Bt,BsNext, current }) corresponding to the transaction state data.
Of course, in some implementations, the same data set may generate different training samples based on the difference in the selection of the starting time points. For example, for the transaction state data 1-11 arranged in time sequence, in the case of a time step of 10, the transaction state data 1-10 may be used as a training sample, and the transaction state data 2-11 may also be used as a training sample.
In some embodiments, the LSTM may include NT 32 x 64 x 128 x 256 neurons, for example. Aiming at the LSTM unit of the hidden layer, a corresponding weight value can be set for the LSTM unit.
For example, the hidden state scores may be calculated for the tth time point and all previous time points,
et=WTht
wherein the time point corresponds to a transaction, WT=(h1,h2...,ht,...,hNT)TT ∈ {1,2, …, NT }, NT being the total number of time points, WTIs the state of all time points, htThe state at time t.
Further, the hidden state score at each time point may be normalized based on the softmax function, and the attention value assigned to the hidden state at the t-th time point relative to the hidden state at the s-th time point is obtained as:
Figure BDA0002791048010000101
wherein e istsIs etThe tth element in (1), (2), (…), (NT). Thus, the hidden layer output at the t-th time point under the Self-Attention mechanism (Self-Attention) can be determined as
Figure BDA0002791048010000111
After the LSTM is constructed, the determined training sample data may be input to the LSTM to obtain a prediction result of the LSTM. Following the above example, if the training samples input to the transaction state prediction model are the transaction state data 1 to 10, the type label of the transaction state data 11 may be used as the type label of the training sample. Therefore, the correctness of the prediction result of the transaction state prediction model can be judged by comparing the prediction label output by the transaction state model with the type label of the training sample, and the relevant network parameters of the LSTM are updated until the model converges, so that the training is completed.
Still referring to fig. 1 and 2, in this case, the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state being a success state to all the training samples marked with the target type labels includes:
s131, determining a first transaction success rate of the transaction request according to the proportion of the training samples marked with the first target type labels and the transaction state of the training samples marked with the first target type labels to the training samples marked with the first target type labels, wherein the target transaction success rate comprises the first transaction success rate.
For example, if the first target type tag output by the transaction state prediction model is a, 10000 samples of tags a are obtained in the training samples of the transaction state prediction model, where 7000 samples are obtained after the transaction is successful, it may be determined that the transaction success rate corresponding to the first target type tag a is 70%, that is, the first transaction success rate corresponding to the transaction request is 70%.
In this case, whether to execute the transaction operation corresponding to the transaction request may be determined based on a size relationship between the first transaction success rate and the success rate threshold, and for a specific policy, reference is made to the description of the embodiment of step S14, which is not repeated herein.
In the technical scheme, the success rate of the transaction corresponding to the transaction request can be predicted by the transaction state data based on the target historical transaction, so that the occurrence frequency of the transaction failure phenomenon can be reduced.
Regarding the type labels of the training samples, in some embodiments, the type labels may be determined in a clustering-based manner. For example, all training samples may be clustered by a clustering model, thereby obtaining a plurality of cluster clusters, and accordingly, the type label of the training sample may correspond to any one of the plurality of cluster clusters.
In further embodiments, the state data includes system state data characterizing a system state at a time of occurrence of the target historical transaction, and the environmental predictive model includes a system state clustering model. In this case, the success rate of the transaction may also be determined based on a clustering model. For example, referring to a flowchart of a method for block chain network transaction shown in fig. 3, the method, based on fig. 1, of inputting the state data into an environment prediction model and obtaining a target type tag of the state data output by the environment prediction model includes:
and S122, inputting the system state data of all the target historical transactions into the system state clustering model in a mode of taking the system state data of one target historical transaction as an input quantity to obtain a second target type label which is output by the system state clustering model and is used for representing the system state type of each target historical transaction.
The system state data includes, for example, one or more of CPU occupancy, network occupancy bandwidth, memory occupancy, disk usage rate, CPU occupancy change rate, network occupancy bandwidth change rate, memory occupancy change rate, and disk usage change rate. The CPU occupancy change rate, the network occupancy bandwidth change rate, the memory occupancy change rate, and the disk usage change rate may be determined according to, for example, the CPU occupancy, the network occupancy bandwidth, the memory occupancy, and the disk usage rate at a time corresponding to the adjacent transaction. In some scenarios, the average CPU occupancy change rate, the average network occupancy bandwidth change rate, the average memory occupancy change rate, and the average disk usage change rate within the threshold time may also be selected.
The training samples of the system state clustering model are system state data corresponding to each historical transaction of the block chain network, the system state clustering model is clustered into a plurality of clusters aiming at all the training samples in the training process, and the second target type label is a target cluster to which the system state data representing the target historical transactions belong.
For example, the clustering number K may be set for all training samples, and K clustering clusters are finally obtained by selecting and updating the clustering centers. In this way, each cluster of clusters can be identified as a second target type label.
In this way, the system state data of all the target historical transactions can be input into the system state clustering model in a manner that the system state data of one target historical transaction is used as an input quantity, and a second target type label which is output by the system state clustering model and is used for representing the system state type of each target historical transaction is obtained.
For example, the target historical transaction may be 10 (i.e. system state data 1-10), and the above step may be to input the system state clustering model by using system state data 1 and system state data 2 … … as an input quantity, respectively, to obtain a second target type label corresponding to each system state data in system state data 1-10, respectively.
In this case, the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type tags and having the transaction status as the success status to all the training samples marked with the target type tags includes:
and S132, determining a second transaction success rate of the transaction request according to the proportion of the training samples marked with the second target type labels and the transaction state of the training samples marked with the second target type labels to the training samples marked with the second target type labels, wherein the target transaction success rate comprises the second transaction success rate.
For example, if the second target type label output by the transaction state prediction model is B, 10000 samples of labels B in the training samples of the system state prediction model, where 1500 samples of successful transactions are obtained, it may be determined that the transaction success rate corresponding to the first target type label B is 15%, that is, the second transaction success rate corresponding to the transaction request is 15%.
In this case, whether to execute the transaction operation corresponding to the transaction request may be determined based on a size relationship between the second transaction success rate and the success rate threshold, and for a specific policy, reference is made to the description of the embodiment of step S14, which is not repeated herein.
In the technical scheme, the success rate of the transaction corresponding to the transaction request can be predicted by the system state data based on the target historical transaction, so that the occurrence frequency of the transaction failure phenomenon can be reduced.
In a possible implementation manner, the determining a second transaction success rate (S132) of the transaction request according to a proportion of the training samples marked with the second target type tag and having a transaction status of a successful status to all the training samples marked with the second target type tag includes:
for each of the second target type labels, determining a first proportion of training samples marked with the second target type label in all training samples.
For example, the number of the target historical transactions is 10, where the number of the target historical transactions of which the second target type tag of the system status data is a is 3, the number of the target historical transactions of which the second target type tag of the system status data is B is 4, and the number of the target historical transactions of which the second target type tag of the system status data is C is 3.
Then, when determining the second transaction success rate, for a second target type label a, a ratio of a sample with the second target type label a in all training samples to the number of all training samples may be used as the first proportion. Similarly, a first percentage corresponding to second object type tags B, C may also be determined.
In addition, for each second target type label, a second proportion of the system state data belonging to the second target type label is determined in the state data corresponding to all target historical transactions.
Following the above example, for a second target type tag a, a ratio of the number of state data of the system state data in the target historical transaction, the second type tag being a, to the total number of system state data in the target historical transaction may also be used as a second proportion of the second target type tag a. As can be seen from the above example, the second occupancy rate of the second object type label a is 30%. Similarly, it can be determined that the second percentage of the second object type label B is 40% and the second percentage of the second object type label C is 30%.
Of course, in some embodiments, the second ratio F may also be determined by the following formula2
Figure BDA0002791048010000141
Wherein, F2AIs the second proportion of the second target type label A, x is the total number of the state data corresponding to the target historical transaction, xAThe amount of system state data for the second target type tag a.
In this way, the weight corresponding to the system state data of each target historical transaction can be determined according to the first proportion and the second proportion of each second target type label. For example, the weight corresponding to each system status data can be calculated by the following formula:
Figure BDA0002791048010000142
wherein, Ft=Ft1×Ft2,Ft1Is the first ratio, F, of the second target type label corresponding to the system state data tt2And the second ratio is the second ratio of the second target type label corresponding to the system state data t. a istAnd NT is a time step which is the weight corresponding to the system state data t, and in this case, is the number of the system state data input to the system state clustering model.
After determining the weight of the system state data for each target historical transaction, refer to the following equation:
Figure BDA0002791048010000143
the weight corresponding to the system status data of each target historical transaction and the target proportion corresponding to the second target type label of the system status data can be weightedAnd summing to obtain the second transaction success rate. The target proportion is the proportion of the training samples marked with the second target type label and in which the transaction state is the success state in all the training samples marked with the second target type label. PtFor the second transaction success rate, Pw1For a target proportion, P for different state dataw1May be different.
By adopting the technical scheme, the success rate of the transaction corresponding to the transaction request can be predicted based on the system state data of the target historical transaction, so that the occurrence frequency of transaction failure can be reduced.
In addition, in some implementation scenarios, a system state prediction model may also be established according to system state data of historical transactions, so that the success rate of the transaction may be predicted according to the system state data corresponding to the target historical transaction and the system state prediction model.
Fig. 4 is a flowchart of a method for performing a blockchain network transaction according to an exemplary embodiment of the present disclosure, where the method is based on fig. 1, where the state data includes system state data of the target historical transaction, and the environment prediction model includes a system state prediction model, and the inputting the state data into the environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
and S123, inputting the system state data of all the target historical transactions into the system state prediction model by taking the system state data of all the target historical transactions as an input quantity of the system state prediction model to obtain a third target type label which is output by the system state prediction model and represents the system state type.
For the sake of brevity of description, the present disclosure does not limit the construction of the system state data and the LSTM, please refer to fig. 2 and fig. 3 for an embodiment of related contents.
Regarding the training samples, the training samples of the system state prediction model correspond to historical transaction time periods of the blockchain network one by one, and system state data corresponding to all historical transactions of the same blockchain node in one historical time period is used as one training sample.
After the system state prediction model based on the LSTM is constructed, the determined training sample data can be input into the LSTM to obtain the prediction result of the LSTM. For example, for the system state data 1-11, if the training samples input to the system state prediction model are the system state data 1-10, the type label of the system state data 11 may be used as the type label of the training samples. Therefore, the correctness of the prediction result of the system state prediction model can be judged by comparing the prediction label output by the system state model with the type label of the training sample, and the relevant network parameters of the LSTM are updated until the model converges, so that the training is completed.
The determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and S133, determining a third transaction success rate of the transaction request according to the proportion of the training samples marked with the third target type labels and the transaction state of the training samples marked with the third target type labels to the training samples marked with the third target type labels. Wherein the target transaction success rate comprises the third transaction success rate.
In this case, whether to execute the transaction operation corresponding to the transaction request may be determined based on a size relationship between the third transaction success rate and the success rate threshold, and for a specific policy, reference is made to the description of the embodiment of step S14, which is not repeated herein.
According to the technical scheme, the transaction result can be predicted based on the system state data and the system state prediction model constructed based on the system state data, so that the occurrence rate of transaction failure can be reduced.
Fig. 5 is a flowchart of a method for performing a blockchain network transaction according to an exemplary embodiment of the present disclosure, where the method is based on fig. 1, where the state data includes transaction state data of the target historical transaction, and the environment prediction model includes a transaction state clustering model, and the inputting the state data into the environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
and S124, inputting the transaction state data of all the target historical transactions into the transaction state clustering model in a mode of taking the transaction state data of one target historical transaction as an input quantity, and obtaining a fourth target type label which is output by the transaction state clustering model and is used for representing the transaction state type of each target historical transaction.
The training samples of the transaction state clustering model are transaction state data corresponding to each historical transaction of the blockchain network, the transaction state clustering model is clustered into a plurality of clusters aiming at all the training samples in the training process, and the fourth target type label is a target cluster to which the transaction state data representing the target historical transactions belong.
For the transaction status data and the clustering method, please refer to the embodiment of fig. 2 and fig. 3, which is not described herein again.
The determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and S134, determining a fourth transaction success rate of the transaction request according to the proportion of the training samples marked with the fourth target type labels and the transaction state of the training samples marked with the fourth target type labels to the training samples marked with the fourth target type labels, wherein the target transaction success rate comprises the fourth transaction success rate.
In this case, whether to execute the transaction operation corresponding to the transaction request may be determined based on a size relationship between the fourth transaction success rate and the success rate threshold, and for a specific policy, reference is made to the description of the embodiment of step S14, which is not repeated herein.
According to the technical scheme, the transaction result can be predicted based on the transaction state data and the transaction state prediction model constructed based on the transaction state data, so that the occurrence rate of transaction failure can be reduced.
It should be noted that, in the above embodiments, the success rate of the transaction is predicted by the transaction status data and the system status data, respectively, but those skilled in the art should understand that, in the specific implementation, the methods shown in fig. 2 and 3 may also be used in combination. For example, the first transaction success rate P may be obtained by the transaction state data and the transaction state prediction modelw2And obtaining a second transaction success rate P through the system state data and the system state clustering modelw1. In this way, weights can be set for the first transaction success rate and the second transaction success rate respectively, so that a final transaction success rate is obtained as the target transaction success rate. For example, the target transaction success rate P may be:
P=αPw2+(1-α)Pw1
wherein α can be set according to application requirements, which is not limited in this disclosure. Similarly, the method shown in fig. 4 and 5 may also be combined to predict the success rate of the transaction to be performed by combining the third transaction success rate and the fourth transaction success rate.
In addition, with respect to the training samples in the above embodiments, in some possible scenarios, the models of the above embodiments may also be continuously trained based on the input data. For example, for the state data input to the model this time, when the state data is input next time and the transaction success rate is calculated, the state data input this time may also be regarded as the training sample in the above embodiment, which is not limited in this disclosure.
In a possible implementation, the success rate of the transaction may be comprehensively predicted by combining the methods shown in fig. 2 to fig. 5, in this case, the state data includes transaction state data of the target historical transaction and system state data, the system state data is used for characterizing a system state at the occurrence time of the target historical transaction, and the environment prediction model includes a transaction state prediction model, a system state clustering model, a transaction state clustering model and a system state prediction model; accordingly:
the target transaction success rate includes:
a first transaction success rate based on the transaction state data and the transaction state prediction model; obtaining a second transaction success rate based on the system state data and the system state clustering model; a third transaction success rate based on the system state data and the system state prediction model; a fourth transaction success rate is obtained based on the transaction state data and the transaction state clustering model; the determining whether to execute the transaction operation corresponding to the transaction request according to the magnitude relation between the target transaction success rate and the success rate threshold value includes:
weighting and summing the first transaction success rate, the second transaction success rate, the third transaction success rate and the third transaction success rate to obtain a sum value;
executing the transaction operation corresponding to the transaction request under the condition that the sum is greater than the success rate threshold value;
revoking the transaction request if the sum is less than or equal to the success rate threshold.
For the calculation of the models and the transaction success rates in this embodiment, please refer to the embodiment of fig. 2 to 5, and for the brevity of the description, the disclosure will not be repeated herein.
In addition, in some implementation scenarios, corresponding threshold data may be set for the first transaction success rate to the fourth transaction success rate, and the transaction policy may be determined by comparing each transaction success rate with the corresponding threshold data. Such as making a transaction, revoking a transaction, etc.
The embodiment predicts the transaction success rate through the transaction state data, the system state data and the four models respectively, and is favorable for improving the accuracy of the prediction result.
It should be noted that, regarding the method for calculating the first transaction success rate, the third transaction success rate and the fourth transaction success rate in the foregoing embodiments, referring to the above description of the embodiment regarding step S132, in some embodiments, the first transaction success rate, the third transaction success rate and the fourth transaction success rate may also be calculated based on the same inventive concept, and details of the disclosure are not repeated herein.
Fig. 6 is a flowchart of a method for determining a cluster number of a cluster model according to an exemplary embodiment of the disclosure, and as shown in fig. 6, a target cluster number of the system state cluster model or the transaction state cluster model is obtained as follows, where the method includes:
in S61, a plurality of candidate cluster numbers are set.
For example, a range of candidate cluster numbers [ K, K ] may be determined, resulting in a cycle number K-K.
In S62, for each candidate cluster number, clustering is performed on the data to be clustered according to the candidate cluster number until the clustering center converges.
For example, for a cluster sample set D ═ x1, x2, x3,.., xi,. · and xn } including n transaction system state data, the number of cluster centers may be defined as k, so that k samples may be randomly selected as cluster centers, and the selected cluster center may be (μ:, for example)123,...,μk)。
After the cluster centers are selected, the distance from each cluster sample to each cluster center can be calculated, for example: dij=||xij||2. Wherein d isijIs a sample xiRelative cluster center μjThe distance of (c). Thus, for the cluster center μjJ 1,2, 3.., k, the cluster center may be recalculated:
Figure BDA0002791048010000181
thus, by iterating the update process of the cluster center, the converged cluster center can be obtainedA center, and outputting a clustering division result C ═ C according to the converged clustering center1,C2,...,Ck}。
In S63, inter-class spacing values of a plurality of cluster categories corresponding to each candidate cluster number and intra-class spacing values of data in each of the cluster categories are calculated.
Following the above example, the intra-class spacing may be, for the number of clusters k:
Figure BDA0002791048010000182
wherein d is the inter-class spacing value corresponding to the number k of the clusters, and is equal to the maximum value of the sum of the average distance from the ith sample of the jth class to all samples in the class and the distance from the ith sample to the cluster center of the jth class cluster.
Figure BDA0002791048010000183
For the mth sample of the jth class,
Figure BDA0002791048010000184
for the ith sample of class j,. mu.jAs the cluster center of the jth cluster, njThe number of samples of the jth cluster is 1,2, 3.
In addition, the inter-class spacing may be, corresponding to the number of clusters k:
Figure BDA0002791048010000191
and D is an inter-class distance value corresponding to the clustering number k, and is equal to the minimum value of the sum of the average distance from the ith sample of the jth class to the samples in other classes and the clustering center distance.
Figure BDA0002791048010000192
For the mth sample of the kth class,
Figure BDA0002791048010000193
for the ith sample of class j,. mu.kAs the cluster center of the kth cluster, nkJ is the number of samples of the kth-class cluster, 1,2, 3.
In S64, the target cluster number is determined as the candidate cluster number corresponding to the maximum value of the difference between the inter-class distance value and the intra-class distance value.
For example, for the candidate cluster number k, the difference d between the inter-class spacing value corresponding to the candidate cluster number of this class and the intra-class spacing value corresponding to the candidate cluster number of this class may be calculatedk
dk=D-d
Thus, for the candidate cluster number K, K +1, …, K, a difference list d ═ d can be obtainedk,dk+1,...,dK]Thereby, the candidate cluster number corresponding to the maximum value of the difference between the inter-class distance value and the intra-class distance value may be set as the target cluster number. Of course, in some embodiments, the number of candidate clusters corresponding to the minimum value of the difference between the inter-class distance value and the intra-class distance value may also be used as the target cluster number, which is not limited in this disclosure. After the target cluster number is determined, local data (such as system state data and transaction state data) can be clustered according to the target cluster number, so that a type label corresponding to each data to be clustered is obtained.
According to the technical scheme, the target cluster number with a better clustering effect can be determined from the candidate cluster numbers in a mode of setting the candidate cluster numbers and respectively calculating the inter-class distance and the intra-class distance corresponding to each cluster number. Therefore, clustering is carried out on the clusters to be clustered by adopting the target clustering number, and the accuracy of clustering results can be improved.
Based on the same inventive concept, the present disclosure further provides a blockchain network transaction apparatus, referring to a block diagram of a blockchain network transaction apparatus shown in fig. 7, where the apparatus 700 includes:
a first obtaining module 701, configured to, in response to a transaction request obtained by a target node, obtain state data corresponding to a target historical transaction of the target node, where the target historical transaction is a historical transaction generated by the target node within a preset time before a current time, or the target historical transaction is a preset number of latest historical transactions generated by the target node before the transaction request is obtained;
a first input module 702, configured to input the state data into an environment prediction model, to obtain a target type tag of the state data output by the environment prediction model, where training samples of the environment prediction model are obtained based on state data of historical transactions generated in a block chain network, and each training sample is labeled with a type tag;
a first determining module 703, configured to determine a target transaction success rate of the transaction request according to a proportion of the training samples marked with the target type labels and having a transaction state as a success state to all training samples marked with the target type labels;
a second determining module 704, configured to determine whether to execute the transaction operation corresponding to the transaction request according to a size relationship between the target transaction success rate and a success rate threshold.
In the above technical solution, when a target node in a blockchain network obtains a transaction request, state data corresponding to a target historical transaction of the target node may be obtained. In this way, the state data can be input into an environment prediction model to obtain a target type label corresponding to the state data, and the target transaction success rate of the transaction request is determined according to the proportion of the training samples marked with the target type label and the transaction state of the training samples marked with the target type label in the successful state. That is to say, the technical scheme can predict the success rate of the transaction before the transaction is carried out, and further can cancel the transaction with lower success rate. Therefore, by adopting the technical scheme, the transaction success probability can be improved, and the influence of transaction failure on the network performance can be reduced.
Optionally, the state data comprises transaction state data of the target historical transactions, the environmental prediction model comprises a transaction state prediction model, and accordingly:
the first input module 702 includes:
the first input sub-module is used for inputting the transaction state data of all the target historical transactions as an input quantity of the transaction state prediction model to obtain a first target type label which is output by the transaction state prediction model and represents the transaction state type, training samples of the transaction state prediction model correspond to historical transaction time periods of the block chain network one by one, and the transaction state data corresponding to all the historical transactions of the same block chain node in one historical time period serve as a training sample;
the first determining module 703 includes:
the first determining submodule is used for determining a first transaction success rate of the transaction request according to the proportion of the training samples marked with the first target type labels and the transaction state of the training samples marked with the first target type labels to the successful state, wherein the target transaction success rate comprises the first transaction success rate.
Optionally, the state data comprises system state data for characterizing a system state at the occurrence of the target historical transaction, the environmental prediction model comprises a system state clustering model, and accordingly:
the first input module 702 includes:
a second input submodule, configured to input system state data of all the target historical transactions into the system state clustering model in a manner that the system state data of one target historical transaction is used as an input quantity, to obtain a second target type label, which is output by the system state clustering model and represents a system state type of each target historical transaction, where a training sample of the system state clustering model is system state data corresponding to each historical transaction of the blockchain network, the system state clustering model clusters all the training samples into a plurality of clusters in a training process, and the second target type label is a target cluster to which the system state data representing the target historical transactions belongs;
the first determining module 703 includes:
and the second determining submodule is used for determining a second transaction success rate of the transaction request according to the proportion of the training samples marked with the second target type labels and the transaction state of the training samples marked with the second target type labels in the successful state, wherein the target transaction success rate comprises the second transaction success rate.
Optionally, the second determining sub-module includes:
the first determining subunit is used for determining, for each second target type label, a first proportion of the training samples marked with the second target type label in all the training samples;
the second determining subunit is configured to determine, for each second target type tag, a second percentage of system state data belonging to the second target type tag in state data corresponding to all target historical transactions;
the third determining subunit is configured to determine, according to the first percentage and the second percentage of each second target type tag, a weight corresponding to system state data of each target historical transaction;
the calculating subunit is configured to perform weighted summation on the weight corresponding to the system state data of each target historical transaction and the target proportion corresponding to a second target type tag of the system state data to obtain a second transaction success rate;
the target proportion is the proportion of the training samples marked with the second target type label and in which the transaction state is the success state in all the training samples marked with the second target type label.
Optionally, the state data comprises system state data of the target historical transactions, the environment prediction model comprises a system state prediction model, and accordingly:
the first input module 702 includes:
the third input submodule is used for inputting system state data of all the target historical transactions into the system state prediction model as an input quantity of the system state prediction model to obtain a third target type label which is output by the system state prediction model and represents the system state type, training samples of the system state prediction model correspond to historical transaction time periods of the block chain network one by one, and system state data corresponding to all the historical transactions of the same block chain node in one historical time period serve as one training sample;
the first determining module 703 includes:
and a third determining submodule, configured to determine a third transaction success rate of the transaction request according to a proportion of the training samples marked with the third target type tag and having a transaction state being a success state to all the training samples marked with the third target type tag, where the target transaction success rate includes the third transaction success rate.
Optionally, the state data includes transaction state data of the target historical transaction, and the environment prediction model includes a transaction state clustering model, which corresponds to:
the first input module 702 includes:
a fourth input sub-module, configured to input the transaction state data of all the target historical transactions into the transaction state clustering model in a manner that the transaction state data of one target historical transaction is used as an input quantity, to obtain a fourth target type tag, which is output by the transaction state clustering model and represents a transaction state type of each target historical transaction, where a training sample of the transaction state clustering model is transaction state data corresponding to each historical transaction of the blockchain network, the transaction state clustering model clusters all the training samples into a plurality of clusters in a training process, and the fourth target type tag is a target cluster to which the transaction state data representing the target historical transactions belong;
the first determining module 703 includes:
and the fourth determining submodule is used for determining a fourth transaction success rate of the transaction request according to the proportion of the training samples marked with the fourth target type labels and the transaction state of the training samples marked with the fourth target type labels to the training samples marked with the fourth target type labels, wherein the target transaction success rate comprises the fourth transaction success rate.
Optionally, the state data includes transaction state data of the target historical transaction and system state data, the system state data is used for representing a system state at an occurrence time of the target historical transaction, and the environment prediction model includes a transaction state prediction model, a system state clustering model, a transaction state clustering model and a system state prediction model; accordingly:
the target transaction success rate includes:
a first transaction success rate based on the transaction state data and the transaction state prediction model;
obtaining a second transaction success rate based on the system state data and the system state clustering model;
a third transaction success rate based on the system state data and the system state prediction model;
a fourth transaction success rate is obtained based on the transaction state data and the transaction state clustering model;
the second determining module includes:
the first calculation submodule is used for carrying out weighted summation on the first transaction success rate, the second transaction success rate, the third transaction success rate and the third transaction success rate to obtain a sum value;
the first execution sub-module is used for executing the transaction operation corresponding to the transaction request under the condition that the sum is greater than the success rate threshold;
a second execution submodule to revoke the transaction request if the sum is less than or equal to the success rate threshold.
Optionally, the transaction status data includes one or more of transaction concurrency number, transaction response time, transaction throughput, transaction timeout set time, block-out time set information, block size set information, last transaction result identifier, and current transaction result identifier.
Optionally, the system status data includes one or more of CPU occupancy, network occupancy bandwidth, memory occupancy, disk usage rate, CPU occupancy change rate, network occupancy bandwidth change rate, memory occupancy change rate, and disk usage change rate.
Optionally, the apparatus further comprises: an execution module for determining a target cluster number of the system state clustering model or the transaction state clustering model, the execution module comprising:
a setting submodule for setting a plurality of candidate cluster numbers;
the clustering submodule is used for clustering the data to be clustered according to the candidate clustering number aiming at each candidate clustering number until the clustering center is converged;
a second calculation sub-module for calculating inter-class spacing values of a plurality of cluster categories corresponding to each candidate cluster number and intra-class spacing values of each data in each of the cluster categories;
and the third execution submodule is used for taking the candidate cluster number corresponding to the maximum value in the difference value between the inter-class distance value and the intra-class distance value as the target cluster number.
Optionally, the transaction request is a cross-chain transaction request, correspondingly, the target historical transactions are historical cross-chain transactions generated by the target node within a preset time before the current time, or the target historical transactions are a preset number of historical cross-chain transactions newly generated by the target node before the transaction request is acquired, and the training sample of the environment prediction model is obtained based on state data of the historical cross-chain transactions generated in the block chain network.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
The present disclosure also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the block chain network transaction method provided by the present disclosure.
The present disclosure also provides an electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the blockchain network transaction method provided by the present disclosure.
Fig. 8 is a block diagram illustrating an electronic device 800, according to an example embodiment, the electronic device 800 may be, for example, a blockchain node. As shown in fig. 8, the electronic device 800 may include: a processor 801, a memory 802. The electronic device 800 may also include one or more of a multimedia component 803, an input/output (I/O) interface 804, and a communications component 805.
The processor 801 is configured to control the overall operation of the electronic device 800 to complete all or part of the steps in the above-described blockchain network transaction method. The memory 802 is used to store various types of data to support operation at the electronic device 800, such as instructions for any application or method operating on the electronic device 800, as well as application-related data, such as tile data, certificates, pictures, videos, and so forth. The Memory 802 may be implemented by any type of volatile or non-volatile Memory device or combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (ROM), magnetic Memory, flash Memory, magnetic disk or optical disk. The multimedia components 803 may include screen and audio components. Wherein the screen may be, for example, a touch screen and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may further be stored in the memory 802 or transmitted through the communication component 805. The audio component may be at least one speaker for outputting audio signals. The I/O interface 804 provides an interface between the processor 801 and other interface modules, such as a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 805 is used for wired or wireless communication between the electronic device 800 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, Near Field Communication (NFC), 2G, 3G, 4G, NB-IOT, eMTC, or other 5G, etc., or a combination of one or more of them, which is not limited herein. The corresponding communication component 805 may therefore include: Wi-Fi module, Bluetooth module, NFC module, etc.
In an exemplary embodiment, the electronic Device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components for performing the above-described block chain network transaction method.
In another exemplary embodiment, there is also provided a computer readable storage medium including program instructions which, when executed by a processor, implement the steps of the above-described blockchain network transaction method. For example, the computer readable storage medium may be the memory 802 described above that includes program instructions that are executable by the processor 801 of the electronic device 800 to perform the blockchain network transaction method described above.
In another exemplary embodiment, a computer program product is also provided, which comprises a computer program executable by a programmable apparatus, the computer program having code portions for performing the above-mentioned block chain network transaction method when executed by the programmable apparatus.
The preferred embodiments of the present disclosure are described in detail with reference to the accompanying drawings, however, the present disclosure is not limited to the specific details of the above embodiments, and various simple modifications may be made to the technical solution of the present disclosure within the technical idea of the present disclosure, and these simple modifications all belong to the protection scope of the present disclosure.
It should be noted that, in the foregoing embodiments, various features described in the above embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, various combinations that are possible in the present disclosure are not described again.
In addition, any combination of various embodiments of the present disclosure may be made, and the same should be considered as the disclosure of the present disclosure, as long as it does not depart from the spirit of the present disclosure.

Claims (10)

1. A method for block chain network transaction, comprising:
responding to a transaction request acquired by a target node, acquiring state data corresponding to target historical transactions of the target node, wherein the target historical transactions are historical transactions generated by the target node within a preset time before the current time, or the target historical transactions are historical transactions of a preset number which are generated by the target node most recently before the transaction request is acquired;
inputting the state data into an environment prediction model to obtain a target type label of the state data output by the environment prediction model, wherein training samples of the environment prediction model are obtained based on state data of historical transactions generated in a block chain network, and each training sample is marked with a type label;
determining the target trading success rate of the trading request according to the proportion of the training samples marked with the target type labels and the trading state of the training samples marked with the target type labels to the successful state;
and determining whether to execute the transaction operation corresponding to the transaction request according to the size relation between the target transaction success rate and the success rate threshold.
2. The method of claim 1, wherein the state data comprises transaction state data for the targeted historical transactions, and wherein the environmental predictive model comprises a transaction state predictive model, and wherein, in response:
the inputting the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
taking the transaction state data of all the target historical transactions as an input quantity of the transaction state prediction model, inputting the transaction state prediction model to obtain a first target type label which is output by the transaction state prediction model and represents the transaction state type, wherein training samples of the transaction state prediction model correspond to historical transaction time periods of the block chain network one by one, and transaction state data corresponding to all the historical transactions of the same block chain node in one historical time period serve as a training sample;
the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and determining a first transaction success rate of the transaction request according to the proportion of the training samples marked with the first target type labels and the transaction state of the training samples marked with the first target type labels to the successful state, wherein the target transaction success rate comprises the first transaction success rate.
3. The method of claim 1, wherein the state data comprises system state data characterizing a system state at a time of occurrence of the target historical transaction, and wherein the environmental prediction model comprises a system state clustering model, respectively:
the inputting the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
inputting system state data of all the target historical transactions into the system state clustering model in a mode that the system state data of one target historical transaction serves as an input quantity to obtain a second target type label which is output by the system state clustering model and is used for representing the system state type of each target historical transaction, wherein a training sample of the system state clustering model is system state data corresponding to each historical transaction of the block chain network, the system state clustering model is clustered into a plurality of clusters aiming at all the training samples in a training process, and the second target type label is a target cluster to which the system state data representing the target historical transactions belong;
the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and determining a second transaction success rate of the transaction request according to the proportion of the training samples marked with the second target type labels and the transaction state of the training samples marked with the second target type labels to the training samples marked with the second target type labels, wherein the target transaction success rate comprises the second transaction success rate.
4. The method according to claim 3, wherein the determining the second transaction success rate of the transaction request according to the proportion of the training samples marked with the second target type label and the transaction status being a success status to all the training samples marked with the second target type label comprises:
for each second target type label, determining a first proportion of the training samples marked with the second target type label in all the training samples;
for each second target type label, determining a second proportion of system state data belonging to the second target type label in state data corresponding to all target historical transactions;
determining the weight corresponding to the system state data of each target historical transaction according to the first proportion and the second proportion of each second target type label;
weighting and summing the weight corresponding to the system state data of each target historical transaction and the target proportion corresponding to a second target type label of the system state data to obtain a second transaction success rate;
the target proportion is the proportion of the training samples marked with the second target type label and in which the transaction state is the success state in all the training samples marked with the second target type label.
5. The method of claim 1, wherein the state data comprises system state data for the target historical transactions, and wherein the environmental prediction model comprises a system state prediction model, and wherein, in response:
the inputting the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
taking system state data of all the target historical transactions as an input quantity of the system state prediction model, inputting the system state prediction model to obtain a third target type label which is output by the system state prediction model and represents a system state type, wherein training samples of the system state prediction model correspond to historical transaction time periods of the block chain network one by one, and system state data corresponding to all historical transactions of the same block chain node in one historical time period serve as a training sample;
the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and determining a third transaction success rate of the transaction request according to the proportion of the training samples marked with the third target type labels and the transaction state of the training samples marked with the third target type labels to the training samples marked with the successful state, wherein the target transaction success rate comprises the third transaction success rate.
6. The method of claim 1, wherein the state data comprises transaction state data for the target historical transactions, and wherein the environmental prediction model comprises a transaction state clustering model, corresponding to:
the inputting the state data into an environment prediction model to obtain a target type tag of the state data output by the environment prediction model includes:
inputting the transaction state data of all the target historical transactions into the transaction state clustering model in a mode that the transaction state data of one target historical transaction is used as an input quantity to obtain a fourth target type label which is output by the transaction state clustering model and is used for representing the transaction state type of each target historical transaction, wherein a training sample of the transaction state clustering model is the transaction state data corresponding to each historical transaction of the blockchain network, the transaction state clustering model is clustered into a plurality of clusters aiming at all the training samples in a training process, and the fourth target type label is a target cluster to which the transaction state data representing the target historical transactions belong;
the determining the target transaction success rate of the transaction request according to the proportion of the training samples marked with the target type labels and the transaction state of the training samples marked with the target type labels to the successful state comprises the following steps:
and determining a fourth transaction success rate of the transaction request according to the proportion of the training samples marked with the fourth target type labels and the transaction state of the training samples marked with the fourth target type labels to the training samples marked with the fourth target type labels, wherein the target transaction success rate comprises the fourth transaction success rate.
7. The method of claim 1, wherein the state data comprises transaction state data of the target historical transaction and system state data characterizing a system state at a time of occurrence of the target historical transaction, and the environmental prediction model comprises a transaction state prediction model, a system state clustering model, a transaction state clustering model, and a system state prediction model; accordingly:
the target transaction success rate includes:
a first transaction success rate based on the transaction state data and the transaction state prediction model;
obtaining a second transaction success rate based on the system state data and the system state clustering model;
a third transaction success rate based on the system state data and the system state prediction model;
a fourth transaction success rate is obtained based on the transaction state data and the transaction state clustering model;
the determining whether to execute the transaction operation corresponding to the transaction request according to the magnitude relation between the target transaction success rate and the success rate threshold value includes:
weighting and summing the first transaction success rate, the second transaction success rate, the third transaction success rate and the third transaction success rate to obtain a sum value;
executing the transaction operation corresponding to the transaction request under the condition that the sum is greater than the success rate threshold value;
revoking the transaction request if the sum is less than or equal to the success rate threshold.
8. A blockchain network transaction apparatus, comprising:
the first obtaining module is used for responding to a transaction request obtained by a target node, and obtaining state data corresponding to target historical transactions of the target node, wherein the target historical transactions are historical transactions generated by the target node within a preset time length before the current moment, or the target historical transactions are the latest historical transactions of a preset number generated by the target node before the transaction request is obtained;
the first input module is used for inputting the state data into an environment prediction model to obtain a target type label of the state data output by the environment prediction model, training samples of the environment prediction model are obtained based on state data of historical transactions generated in a block chain network, and each training sample is marked with a type label;
the first determining module is used for determining the target trading success rate of the trading request according to the proportion of the training samples marked with the target type labels and the trading state of the training samples marked with the target type labels in the successful state;
and the second determining module is used for determining whether to execute the transaction operation corresponding to the transaction request according to the size relation between the target transaction success rate and the success rate threshold.
9. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
10. An electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to carry out the steps of the method of any one of claims 1 to 7.
CN202011314898.1A 2020-11-20 2020-11-20 Block chain network transaction method and device, storage medium and electronic equipment Pending CN112488831A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011314898.1A CN112488831A (en) 2020-11-20 2020-11-20 Block chain network transaction method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011314898.1A CN112488831A (en) 2020-11-20 2020-11-20 Block chain network transaction method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN112488831A true CN112488831A (en) 2021-03-12

Family

ID=74933057

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011314898.1A Pending CN112488831A (en) 2020-11-20 2020-11-20 Block chain network transaction method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112488831A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113393061A (en) * 2021-08-17 2021-09-14 腾讯科技(深圳)有限公司 Transaction packing method based on block chain and related device

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018090331A1 (en) * 2016-11-18 2018-05-24 深圳前海达闼云端智能科技有限公司 Blockchain network, article transaction method and apparatus, and node device
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
CN109345050A (en) * 2018-08-01 2019-02-15 平安科技(深圳)有限公司 A kind of quantization transaction prediction technique, device and equipment
CN109447791A (en) * 2018-11-09 2019-03-08 北京邮电大学 A kind of funds transaction method and device based on block chain
CN109543988A (en) * 2018-11-16 2019-03-29 中国银行股份有限公司 The method, apparatus and storage medium of optimization transaction overtime threshold
KR101979161B1 (en) * 2018-12-03 2019-05-15 엄성민 Artificial Intelligence Learning Data Productivity Improvement System based on Label Type Data Management Using Block Chain, and Method thereof
WO2019144353A1 (en) * 2018-01-25 2019-08-01 深圳前海达闼云端智能科技有限公司 Blockchain-based data training method and device, storage medium and blockchain node
CN110310153A (en) * 2019-06-18 2019-10-08 平安普惠企业管理有限公司 A kind of transaction prediction technique and device
CN110335067A (en) * 2019-06-18 2019-10-15 平安普惠企业管理有限公司 A kind of transaction prediction model construction method and device
CN111127084A (en) * 2019-12-11 2020-05-08 广州优策科技有限公司 Transaction amount prediction method and device, readable storage medium and electronic equipment
CN111198945A (en) * 2019-12-03 2020-05-26 泰康保险集团股份有限公司 Data processing method, device, medium and electronic equipment
CN111340494A (en) * 2020-05-15 2020-06-26 支付宝(杭州)信息技术有限公司 Asset type consistency evidence generation, transaction and transaction verification method and system
CN111461223A (en) * 2020-04-01 2020-07-28 支付宝(杭州)信息技术有限公司 Training method of abnormal transaction identification model and abnormal transaction identification method
CN111563820A (en) * 2020-05-08 2020-08-21 中国工商银行股份有限公司 Intelligent contract parallel execution method and device
JP2020187441A (en) * 2019-05-10 2020-11-19 富士通株式会社 Model providing program, model providing method and model providing device

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018090331A1 (en) * 2016-11-18 2018-05-24 深圳前海达闼云端智能科技有限公司 Blockchain network, article transaction method and apparatus, and node device
CN108269190A (en) * 2018-01-17 2018-07-10 深圳四方精创资讯股份有限公司 Across chain method and its system based on across chain relaying platform
WO2019144353A1 (en) * 2018-01-25 2019-08-01 深圳前海达闼云端智能科技有限公司 Blockchain-based data training method and device, storage medium and blockchain node
CN109345050A (en) * 2018-08-01 2019-02-15 平安科技(深圳)有限公司 A kind of quantization transaction prediction technique, device and equipment
CN109447791A (en) * 2018-11-09 2019-03-08 北京邮电大学 A kind of funds transaction method and device based on block chain
CN109543988A (en) * 2018-11-16 2019-03-29 中国银行股份有限公司 The method, apparatus and storage medium of optimization transaction overtime threshold
KR101979161B1 (en) * 2018-12-03 2019-05-15 엄성민 Artificial Intelligence Learning Data Productivity Improvement System based on Label Type Data Management Using Block Chain, and Method thereof
JP2020187441A (en) * 2019-05-10 2020-11-19 富士通株式会社 Model providing program, model providing method and model providing device
CN110310153A (en) * 2019-06-18 2019-10-08 平安普惠企业管理有限公司 A kind of transaction prediction technique and device
CN110335067A (en) * 2019-06-18 2019-10-15 平安普惠企业管理有限公司 A kind of transaction prediction model construction method and device
CN111198945A (en) * 2019-12-03 2020-05-26 泰康保险集团股份有限公司 Data processing method, device, medium and electronic equipment
CN111127084A (en) * 2019-12-11 2020-05-08 广州优策科技有限公司 Transaction amount prediction method and device, readable storage medium and electronic equipment
CN111461223A (en) * 2020-04-01 2020-07-28 支付宝(杭州)信息技术有限公司 Training method of abnormal transaction identification model and abnormal transaction identification method
CN111563820A (en) * 2020-05-08 2020-08-21 中国工商银行股份有限公司 Intelligent contract parallel execution method and device
CN111340494A (en) * 2020-05-15 2020-06-26 支付宝(杭州)信息技术有限公司 Asset type consistency evidence generation, transaction and transaction verification method and system

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
HYOCHANG BAEK等: "A Model for Detecting Cryptocurrency Transactions with Discernible Purpose", 《IEEE》, 31 December 2019 (2019-12-31), pages 713 - 717 *
刘海等: "基于区块链的分布式K 匿名位置隐私保护方案", 《计算机学报》, vol. 42, no. 5, 31 May 2019 (2019-05-31), pages 942 - 960 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113393061A (en) * 2021-08-17 2021-09-14 腾讯科技(深圳)有限公司 Transaction packing method based on block chain and related device

Similar Documents

Publication Publication Date Title
WO2019090954A1 (en) Prediction method, and terminal and server
JP4846772B2 (en) Method and apparatus for community-based trust
CN108431832A (en) Neural network is expanded using external memory
CN112087329B (en) Network service function chain deployment method
CN111340221A (en) Method and device for sampling neural network structure
CN114186256B (en) Training method, device, equipment and storage medium of neural network model
CN110569870A (en) deep acoustic scene classification method and system based on multi-granularity label fusion
CN116684330A (en) Traffic prediction method, device, equipment and storage medium based on artificial intelligence
WO2009142011A1 (en) Decision device with minimum power transmission loss system, method, and program
CN112488831A (en) Block chain network transaction method and device, storage medium and electronic equipment
CN113138848A (en) Method, device, equipment and storage medium for acquiring resource allocation strategy
CN114298326A (en) Model training method and device and model training system
KR102499517B1 (en) Method and system for determining optimal parameter
CN114581966A (en) Method, electronic device and computer program product for information processing
CN112989203B (en) Material throwing method, device, equipment and medium
CN112489644A (en) Voice recognition method and device for electronic equipment
CN116187473B (en) Federal learning method, apparatus, electronic device, and computer-readable storage medium
CN112087521A (en) Block chain link point authority control method based on big data and block chain system
US20200065715A1 (en) System and methods to determine carrier based on tracking number
CN117076131B (en) Task allocation method and device, electronic equipment and storage medium
CN116545877B (en) Cross-domain SFC dynamic deployment method, device, computer equipment and storage medium
US8081581B2 (en) Sampling rules for information dissemination
CN114615144B (en) Network optimization method and system
CN109905340B (en) Feature optimization function selection method and device and electronic equipment
US11763006B1 (en) Comparative real-time end-to-end security vulnerabilities determination and visualization

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination