A blockchain cross-chain communication method and device
By generating matching indexes and demand indexes, a blockchain selection model is built, which solves the problems of inefficiency and high cost in blockchain cross-chain communications, and achieves efficient and low-cost cross-chain communications.
Patent Information
- Application Number
- CN202410453310.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-16
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2044-04-16
AI Technical Summary
The existing blockchain cross-chain communication technology is inefficient, expensive and poor scalability, especially during large-scale transactions, which cannot effectively evaluate and optimize the cost-performance ratio in the cross-chain communication process, resulting in unoptimized resource allocation.
By collecting transaction fees, speed, load data and failure rates of each blockchain, generating matching index and demand index, building a blockchain selection model, and filtering out the blockchain with the best cost and performance ratio for cross-chain communication.
Efficient and low-cost cross-chain communication is realized, and the relationship between communication cost and performance is accurately described by detailed analysis of transaction data, and resource allocation and transaction execution are optimized.
Smart Images

Figure CN118283048B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain cross-chain communication method and device. Background Art
[0002] With the rapid development of blockchain technology, various blockchain platforms have emerged, each designed with its own unique functions and application scenarios. However, these blockchain platforms usually exist as isolated systems, lacking effective communication and data exchange capabilities between each other. This situation limits the potential of blockchain technology in a wider range of application scenarios, such as supply chain management, financial services, etc., which require collaboration and data exchange across multiple blockchain platforms;
[0003] In the prior art, the publication number CN113556234A discloses a blockchain cross-chain communication method and system, the method comprising: obtaining the communication requirements of each node in multiple blockchains; establishing a cross-chain alliance according to the communication requirements, and configuring a digital certificate for each node; the relay chain receives a cross-chain communication request sent by a source node in a blockchain; the relay chain performs endorsement policy verification according to the data certificate, records the communication request to the cross-chain smart contract after the verification, and sends the cross-chain communication request verified by the endorsement policy to the cross-chain alliance; the cross-chain alliance parses the communication data message to obtain transaction data, calls the query interface of the alliance chain to query whether the transaction corresponding to the transaction data exists, and verifies the validity of the transaction data. When the transaction data validity verification passes, the cross-chain communication request is executed to realize communication between nodes, which can realize cross-chain communication of the alliance chain and solve the cross-chain communication of complex services and complex rules of multiple parties;
[0004] Existing cross-chain communication technologies mainly rely on structures such as relay chains or side chains to achieve interoperability between different blockchains. However, these technologies often have problems such as low efficiency, high cost, and poor scalability. Especially when dealing with large-scale transactions, these methods are usually unable to effectively evaluate and optimize the cost-performance ratio in the cross-chain communication process, resulting in the inability to achieve optimal resource allocation and efficient transaction execution. How to construct a matching index that can describe the proportional relationship between communication cost and performance, and refine the expected ratio of communication cost and performance, and screen out the blockchain with the best cost-performance ratio for efficient and low-cost cross-chain communication, is a technical problem that needs to be solved at present.
[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0006] The purpose of the present invention is to provide a blockchain cross-chain communication method and device to solve the problems raised in the above background technology.
[0007] To achieve the above object, the present invention provides the following technical solutions:
[0008] A blockchain cross-chain communication method, characterized in that the specific steps include:
[0009] Step S1, mark several blockchains capable of cross-chain communication as {1,2,...,i,...,n}, where i represents the ith blockchain, i∈{1,2,...,n}, and n is the total number of blockchains; and mark the number of historical transactions in the ith blockchain as {1,2,...,j,...,m}, j∈{1,2,...,m}, where j represents the jth transaction of the current blockchain, and m is the total number of transactions; collect transaction fees, transaction speed, and load data of the jth transaction in the ith blockchain, and obtain the transaction failure rate under the current number of transactions, and finally form a historical data set;
[0010] Step S2: In the historical data set, the transaction fee, transaction speed, load data and transaction failure rate of the jth transaction in the i-th blockchain are obtained and analyzed to generate a matching index, which describes the composition ratio between the communication cost and performance under the current data;
[0011] Step S3: Obtain demand data on transaction fees, transaction speed, load data, and transaction failure rate in the cross-chain communication data required; and after analyzing and processing the demand data, generate a demand index, which describes the expected composition ratio between communication cost and performance;
[0012] Step S4: Obtain the matching index and demand index, analyze and process them, and build a blockchain selection model based on these indices. The blockchain selection model can select a blockchain that meets both cost requirements and performance requirements from the matching index according to the expected composition ratio represented by the demand index to conduct cross-chain communication transactions.
[0013] Furthermore, the transaction fee includes resource consumption fees corresponding to the amount of cross-chain communication data transmission and handling fees required for transaction confirmation speed;
[0014] The transaction fee is marked as JYf, the resource consumption fee is marked as Fy1, and the handling fee is marked as Fy2. The calculation formula is as follows:
[0015] JYfij=Fy1ij+Fy2ij
[0016] Among them, JYfij represents the transaction fee of the jth transaction in the i-th blockchain, Fy1ij and Fy2ij represent the resource consumption cost and handling fee of the jth transaction in the i-th blockchain respectively;
[0017] The transaction speed includes block confirmation time, network delay and processing speed. The transaction speed is marked as JYSd, the block confirmation time is marked as QRt, the network delay is marked as Wy, and the processing speed is marked as Cv. The calculation formula is as follows:
[0018]
[0019] Among them, JYSdij represents the transaction speed of the jth transaction in the i-th blockchain, QRtij, Wyij, and Cvij represent the confirmation time, network delay, and processing speed of the jth transaction in the i-th blockchain, respectively;
[0020] The load data includes the capacity parameter and processing algorithm efficiency parameter of the current blockchain, and the load data is marked as FZs, the capacity parameter is marked as Lr, and the processing algorithm efficiency parameter is marked as SFXl. The calculation formula is as follows;
[0021] FZsij=w1×Lrij×w2×SFXlij
[0022] FZsij represents the j-th load data in the i-th blockchain, Lrij and SFXlij represent the capacity parameter and processing algorithm efficiency parameter of the j-th transaction in the i-th blockchain, w1 and w2 are non-negative weight coefficients, w1+w2=1;
[0023] The transaction failure rate represents the predicted probability that a transaction cannot be successfully completed, and is obtained by dividing the number of transaction failures before the jth transaction by the jth number, and the transaction failure rate is marked as SBl, and the number of failures is marked as u. The calculation formula is as follows:
[0024]
[0025] Among them, SBlij represents the predicted value of the j-th transaction failure rate in the i-th blockchain, and uij represents the j-th failure number in the i-th blockchain.
[0026] Furthermore, the matching index is defined as MIij, and the calculation formula is as follows:
[0027]
[0028] in, are normalization functions, which are used to normalize the transaction fee, transaction speed, and load data of the jth transaction in the i-th blockchain to the range of [0,1]; MIij is the matching index of the jth transaction in the i-th blockchain, max(JYfij), max(JYSdij), max(FZs ij ) represent the maximum values of transaction fee, transaction speed and load data in all historical data respectively;
[0029] Where λ is a positive constant, JYf ij JYSd is the transaction fee of the jth transaction in the i-th blockchain; ij is the transaction speed of the jth transaction in the i-th blockchain; FZs ij is the load data of the jth transaction in the i-th blockchain; SBlij is the predicted value of the transaction failure rate of the jth transaction in the i-th blockchain;
[0030] The MIij value range is set in the range of [0,1], where values close to 1 indicate that the performance represented by the cost and transaction efficiency is relatively optimized, while values close to 0 indicate a high failure rate or an unbalanced cost-performance ratio;
[0031] The MIij value range [0,1] is divided into several level intervals, and different intervals indicate that transaction fees, transaction speeds, load data, and transaction failure rates are in different composition proportions.
[0032] Furthermore, the demand index is defined as ND, and the calculation formula is as follows:
[0033]
[0034] Among them, ND is the demand index; Fy1′ and Fy2′ are the expected values of resource consumption costs and handling fees respectively; Lr′ is the expected value of capacity parameters; QRt′, Wy′, Cv′ are the expected values of block confirmation time, network delay and processing speed respectively; SFXl′ and FZs′ are the expected values of processing algorithm efficiency parameters and load data respectively; SBl′ is the expected value of transaction failure rate; the above data are all normalized and quantified;
[0035] a1, a2, a3 are weight coefficients of corresponding parameters, and a1, a2, a3 are all non-negative numbers, a1+a2+a3=1, e1 is the weight adjustment coefficient, 0.02≤e1≤0.87;
[0036] The value range of ND is set to [0,1]. The closer it is to 0, the greater the demand for either cost minimization or performance maximization. The closer it is to 1, the greater the demand for blockchain that minimizes cost and maximizes performance.
[0037] Furthermore, the blockchain selection model is defined as BCi, and the calculation formula is as follows:
[0038]
[0039] Among them, BCi represents the selection model coefficient when selecting the i-th blockchain; c1, c2, c3 are weight parameters, and c1, c2, c3 are non-negative numbers, c1+c2+c3=1, which are used to adjust the relative importance of fee, speed and load data; r is an exponential decay parameter, which is used to adjust the impact of transaction fees, 0.12≤r≤0.77; c4 and c5 are weight parameters, which are used to adjust the weight of demand index and matching index in the total score, and c4, c5 are non-negative numbers, c4+c5=1; t1, t2 are weighted powers of demand index and matching index, which are used to adjust their impact intensity;
[0040] The value range of BCi is set to [0,1], which means that the comprehensive score of the blockchain ranges from the least suitable 0 to the most suitable 1 for cross-chain communication selection strategy;
[0041] When the selection model coefficient is in the range of [0.85, 1.0], it is an ideal choice, indicating that the currently selected blockchain fully meets the current needs, and the transaction fee, speed, and load data are all within the optimal range, while having a low failure rate;
[0042] When the model coefficient is in the range of [0.7, 0.85), it is an excellent choice. At this time, the transaction performance and fee performance are good, slightly lower than the ideal choice, but still far above the average level, suitable for most application scenarios;
[0043] When the model coefficient is in the range of [0.55, 0.7), it is an acceptable choice. At this time, the performance and cost efficiency are balanced. There is a disadvantage of being lower than the average in some parameters, but it is generally acceptable.
[0044] When the model coefficient is selected in the range of [0.4, 0.55), it is an edge selection, which has certain performance or cost issues and needs to be considered carefully. It is only applicable to scenarios with low performance requirements.
[0045] When the model coefficient is selected in the range of [0,0.4), it is not recommended. The performance and cost are poor and there are significant disadvantages. It is recommended to avoid using it.
[0046] A blockchain cross-chain communication device, the device is used to execute the blockchain cross-chain communication method, comprising:
[0047] Data collection module: used to mark several blockchains that can perform cross-chain communication as {1,2,...,i,...,n}, where i represents the ith blockchain, i∈{1,2,...,n}, and n is the total number of blockchains; and mark the number of historical transactions in the ith blockchain as {1,2,...,j,...,m}, j∈{1,2,...,m}, where j represents the jth transaction of the current blockchain, and m is the total number of transactions; collect the transaction fee, transaction speed, and load data of the jth transaction in the ith blockchain, and obtain the transaction failure rate under the current number of transactions, and finally form a historical data set;
[0048] The first index generation module is used to obtain the transaction fee, transaction speed, load data and transaction failure rate of the jth transaction in the i-th blockchain in the historical data set, and then analyze and process them to generate a matching index, which describes the ratio between communication cost and performance under the current data;
[0049] The second index generation module is used to obtain the demand data on transaction fees, transaction speed, load data, and transaction failure rate in the cross-chain communication data required; and after analyzing and processing the demand data, generate a demand index, which describes the expected ratio of communication cost and performance;
[0050] Model building module: used to obtain the matching index and demand index, and perform analysis and processing, and build a blockchain selection model based on these indices. The blockchain selection model can select blockchains that meet both cost requirements and performance requirements from the matching index according to the expected composition ratio represented by the demand index, so as to conduct cross-chain communication transactions.
[0051] Compared with the prior art, the beneficial effects of the present invention are: by recording the transaction fee, speed, load and failure rate of each transaction in detail, the collected data is deeply analyzed to generate a matching index, which can accurately describe the proportional relationship between communication cost and performance. According to the demand data of cross-chain communication, a demand index is generated to further refine the expected ratio of communication cost to performance. Finally, by comparing the matching index and the demand index, a highly accurate blockchain selection model is constructed. This model can screen out the blockchain with the best cost and performance ratio to carry out efficient and low-cost cross-chain communication. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1 It is a schematic diagram of the overall method flow of the present invention;
[0053] Figure 2 It is a schematic diagram of the module flow of the device of the present invention. DETAILED DESCRIPTION
[0054] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with specific embodiments.
[0055] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the present invention should be understood by people with ordinary skills in the field to which the present invention belongs. The words "first", "second" and similar words used in the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0056] Embodiment 1:
[0057] See also Figure 1 , the present invention provides a technical solution:
[0058] The present invention describes a blockchain cross-chain communication method, the specific steps of which include:
[0059] Step S1, mark several blockchains capable of cross-chain communication as {1,2,...,i,...,n}, where i represents the ith blockchain, i∈{1,2,...,n}, and n is the total number of blockchains; and mark the number of historical transactions in the ith blockchain as {1,2,...,j,...,m}, j∈{1,2,...,m}, where j represents the jth transaction of the current blockchain, and m is the total number of transactions; collect transaction fees, transaction speed, and load data of the jth transaction in the ith blockchain, and obtain the transaction failure rate under the current number of transactions, and finally form a historical data set;
[0060] Step S2: In the historical data set, the transaction fee, transaction speed, load data and transaction failure rate of the jth transaction in the i-th blockchain are obtained and analyzed to generate a matching index, which describes the composition ratio between the communication cost and performance under the current data;
[0061] Step S3: Obtain demand data on transaction fees, transaction speed, load data, and transaction failure rate in the cross-chain communication data required; and after analyzing and processing the demand data, generate a demand index, which describes the expected composition ratio between communication cost and performance;
[0062] Step S4: Obtain the matching index and demand index, analyze and process them, and build a blockchain selection model based on these indices. The blockchain selection model can select a blockchain that meets both cost requirements and performance requirements from the matching index according to the expected composition ratio represented by the demand index to conduct cross-chain communication transactions.
[0063] Embodiment 2:
[0064] Further explanation based on Example 1, the transaction fee includes resource consumption fees corresponding to the cross-chain communication data transmission volume and the handling fee required for the transaction confirmation speed;
[0065] Data transfer volume: The amount of data involved in cross-chain operations directly affects transaction fees. Larger amounts of data mean more resource consumption, and therefore higher fees, which are usually measured in bytes or other appropriate units of measurement.
[0066] Transaction confirmation speed requirements: If users have requirements for transaction confirmation speed, they need to be willing to pay higher fees to obtain faster confirmation, so they will pay higher handling fees;
[0067] The transaction fee is marked as JYf, the resource consumption fee is marked as Fy1, and the handling fee is marked as Fy2. The calculation formula is as follows:
[0068] Resource consumption fee = basic fee + data volume × rate;
[0069] The basic fee is a fixed value, while the rate is the fee to be paid per byte or per unit of data volume;
[0070] Handling fee = basic handling fee + acceleration rate × confirmation speed requirement;
[0071] Among them, the basic fee is a fixed value, and the acceleration rate is the fee for each confirmation; the confirmation speed requirement is usually expressed in the number of blocks or time intervals;
[0072] JYfij=Fy1ij+Fy2ij
[0073] Among them, JYfij represents the transaction fee of the jth transaction in the i-th blockchain, Fy1ij and Fy2ij represent the resource consumption cost and handling fee of the jth transaction in the i-th blockchain respectively;
[0074] The transaction speed includes block confirmation time, network delay and processing speed. The transaction speed is marked as JYSd, the block confirmation time is marked as QRt, the network delay is marked as Wy, and the processing speed is marked as Cv. The calculation formula is as follows:
[0075] Block confirmation time: Different blockchains have different block generation times, which indicates how long it takes for a transaction to be confirmed on the blockchain in question, which directly affects the transaction confirmation speed;
[0076] Network latency: The latency of the physical network can significantly affect the speed of cross-chain operations, indicating the delay time for the physical network to transmit data;
[0077] Processing speed of cross-chain bridges or relay nodes: The processing capacity of relay nodes or cross-chain bridges will directly affect the transaction speed;
[0078]
[0079] Among them, JYSdij represents the transaction speed of the jth transaction in the i-th blockchain, QRtij, Wyij, and Cvij represent the confirmation time, network delay, and processing speed of the jth transaction in the i-th blockchain, respectively;
[0080] The load data includes the capacity parameter and processing algorithm efficiency parameter of the current blockchain, and the load data is marked as FZs, the capacity parameter is marked as Lr, and the processing algorithm efficiency parameter is marked as SFXl. The calculation formula is as follows;
[0081] Capacity parameters: The capacity value of the current blockchain will affect its ability to process cross-chain transactions, thereby affecting the overall load;
[0082] Processing algorithm efficiency parameters: Different blockchains use different transaction processing algorithms, and the efficiency of these algorithms directly affects the system's load management;
[0083] FZsij=w1×Lrij×w2×SFXlij
[0084] FZsij represents the j-th load data in the i-th blockchain, Lrij and SFXlij represent the capacity parameter and processing algorithm efficiency parameter of the j-th transaction in the i-th blockchain, w1 and w2 are non-negative weight coefficients, w1+w2=1;
[0085] The value range of FZsij is a non-negative real number range. When FZsij is smaller, it means that the system load is lower, the processing capacity is stronger, the chain capacity parameter is larger and the processing algorithm efficiency parameter is higher. The system has strong scalability and efficient transaction processing capabilities and can quickly process a large number of transactions.
[0086] When FZsij is larger, it means that the system load is high, the processing capacity is limited, the capacity of the chain is close to the upper limit, or the processing algorithm is inefficient and the system load is high, which will lead to a decrease in transaction processing speed and even congestion and delays;
[0087] By adjusting the weight parameters w1 and w2, the calculation of load data can be optimized according to actual needs, making it more in line with the actual situation and performance requirements of the system.
[0088] The transaction failure rate represents the predicted probability that a transaction cannot be successfully completed, and is obtained by dividing the number of transaction failures before the jth transaction by the jth number, and the transaction failure rate is marked as SBl, and the number of failures is marked as u. The calculation formula is as follows:
[0089]
[0090] Among them, SBlij represents the predicted value of the j-th transaction failure rate in the i-th blockchain, and uij represents the j-th failure number in the i-th blockchain.
[0091] Embodiment three:
[0092] Further explanation based on the second embodiment, the matching index is defined as MIij, and the calculation formula is as follows:
[0093]
[0094] in, are normalization functions, which are used to normalize the transaction fee, transaction speed, and load data of the jth transaction in the i-th blockchain to the range of [0,1]; MIij is the matching index of the jth transaction in the i-th blockchain, max(JYfij), max(JYSdij), max(FZs ij ) represent the maximum values of transaction fee, transaction speed and load data in all historical data respectively;
[0095] is an exponential decay function, where λ is a positive constant used to adjust the impact of transaction failure rate on matching index; this function decreases as the failure rate increases, thus reflecting the negative impact of the failure rate on transaction efficiency;
[0096] If you want the failure rate to have a greater impact on the matching index, even if the transaction failure rate is small, then SBl ij ≤38%, which also significantly reduces the matching index. In this case, a larger λ value should be selected, 0.42≤λ≤0.98;
[0097] If you want the failure rate to have a smaller impact on the matching index, the matching index will only decrease significantly when the failure rate is higher, SBlij>68%, then you should choose a smaller λ value, 0.12≤λ<0.42;
[0098] The specific value of λ is determined through statistical analysis of historical data and optimized by minimizing the mean square error of the prediction error. In addition, the cross-validation method can be used to test the effects of different λ values to select the best value;
[0099] JYfij is the transaction fee for the jth transaction in the ith blockchain; JYSdij is the transaction speed for the jth transaction in the ith blockchain; FZs ij is the load data for the jth time in the ith blockchain; SBlij is the predicted value of the transaction failure rate for the jth transaction in the ith blockchain;
[0100] It is set that the value range of MIij is within [0, 1]. Among them, a value close to 1 indicates that the performance represented by cost and transaction efficiency is relatively optimized, while a value close to 0 indicates a high failure rate or an unbalanced cost-performance ratio; this design can help system administrators or algorithms automatically adjust resource allocation and optimize the efficiency and cost of cross-chain communication; the value range [0, 1] of MIij is divided into several grade intervals, and different intervals represent different composition ratio states of transaction fees, transaction speeds, load data, and transaction failure rates;
[0101] Based on the historical data set, the average values of transaction fees, transaction speeds, and load data within each blockchain are determined, and it is set that SBlij ≤ 38% is a low failure rate, SBlij > 68% is a high failure rate, and 38% < SBlij ≤ 68% is a medium failure rate;
[0102] When the matching index value is in [0.8, 1], it is a high level, indicating that the transaction fee is 30% lower than the average value, the transaction speed is 20% higher than the average value, the load data is 10% lower than the average value, and the transaction failure rate is a low failure rate; this is the most ideal interval, and the ratio between communication cost and performance is very optimized;
[0103] When the matching index value is in [0.62, 0.8), it is a medium level, indicating that the transaction fee is lower than the average value, the transaction speed is 5% higher than the average value, the load data is 3% lower than the average value, and the transaction failure rate is a low failure rate; this interval is suitable for most normal operations, but there is still room for optimization;
[0104] When the matching index value is in [0.38, 0.62), it is a warning level, indicating that there are cost-efficiency problems. At this time, the transaction fee is above the average value, the transaction speed is below 5% higher than the average value, the load data is above 3% lower than the average value, and the transaction failure rate is medium, and attention needs to be paid to adjusting the strategy;
[0105] When the matching index takes a value of [0,0.38), it is a dangerous level, indicating that the transaction fee is 30% higher than the average, the transaction speed is lower than the average, the load data is 2% higher than the average, and the transaction failure rate is high. This is a warning range, indicating that the system performance is seriously insufficient and needs to be adjusted urgently.
[0106] Embodiment 4:
[0107] Further explanation is given on the basis of Example 3, where the demand index is defined as ND, and the calculation formula is as follows:
[0108]
[0109] Among them, ND is the demand index; Fy1′ and Fy2′ are the expected values of resource consumption costs and handling fees respectively; Lr′ is the expected value of capacity parameters; QRt′, Wy′, Cv′ are the expected values of block confirmation time, network delay and processing speed respectively; SFXl′ and FZs′ are the expected values of processing algorithm efficiency parameters and load data respectively; SBl′ is the expected value of transaction failure rate; the above data are all normalized and quantified;
[0110] a1, a2, a3 are weight coefficients of corresponding parameters, and a1, a2, a3 are all non-negative numbers, a1+a2+a3=1, e1 is the weight adjustment coefficient, 0.02≤e1≤0.87; e1 is obtained through expert group evaluation or related experiments, which will not be elaborated;
[0111] The exponential function is used to emphasize the relationship between resource consumption costs and blockchain capacity parameters, while the logarithmic function is used to smooth the relationship between transaction speed and processing speed. The impact of transaction failure rate is considered in the form of e1·SBl′ to enhance the adaptability and sensitivity of the model.
[0112] The value range of ND is set to [0,1]. The closer to 0, the greater the demand for either cost minimization or performance maximization. The closer to 1, the greater the demand for blockchains that minimize costs or maximize performance.
[0113] The demand index is divided into the following intervals, each of which corresponds to a different demand level:
[0114] When ND is between [0.0, 0.25), cost efficiency is highly valued and performance requirements are relatively low. In this case, transaction fees are required to be 40% lower than the average, transaction speed is required to be 5% lower than the average, load data is required to be 15% higher than the average, and the transaction failure rate is required to be below the high failure rate.
[0115] When ND is in the range of [0.25, 0.46), in order to emphasize cost efficiency but also maintain certain performance, the transaction fee is required to be 25% lower than the average, the transaction speed is required to fluctuate 2% above or below the average, the load data is required to be 8% higher than the average, and the transaction failure rate is required to be below the medium failure rate;
[0116] When ND is in the range of [0.46, 0.63), the requirements of cost and performance are balanced, the transaction fee is required to be 5% lower than the average, the transaction speed is required to be 2% higher than the average and 8% lower than the average, the load data is required to be 2% lower than the average, and the transaction failure rate is required to be a medium failure rate;
[0117] When ND is between [0.63, 0.75), performance is emphasized, but cost is also considered. The transaction fee is required to be 8% higher than the average, the transaction speed is required to be above the average by 15%, the load data is required to be 16% lower than the average, and the transaction failure rate is required to be low.
[0118] When ND is between [0.75, 1.0], it places great emphasis on performance, is less sensitive to cost, requires transaction fees to be 35% higher than the average, requires transaction speed to be above 40% of the average, requires load data to be 23% lower than the average, and requires a low transaction failure rate.
[0119] Embodiment five:
[0120] Further explanation based on Example 4, the blockchain selection model is defined as BCi, and the calculation formula is as follows:
[0121]
[0122] Among them, BCi represents the selection model coefficient when selecting the i-th blockchain; c1, c2, c3 are weight parameters, and c1, c2, c3 are non-negative numbers, c1+c2+c3=1, which are used to adjust the relative importance of fee, speed and load data; r is an exponential decay parameter, which is used to adjust the impact of transaction fees, 0.12≤r≤0.77; c4 and c5 are weight parameters, which are used to adjust the weight of demand index and matching index in the total score, and c4, c5 are non-negative numbers, c4+c5=1; t1, t2 are weighted powers of demand index and matching index, which are used to adjust their impact intensity;
[0123] Each parameter in the formula has the following interaction rules:
[0124] Increasing transaction fees JYfij will decay through an exponential function Decrease in BCi, reflecting the negative impact of high transaction fees on blockchain selection;
[0125] Increasing the transaction speed JYSdij will increase BCi through the logarithmic function log(JYSdij+1), reflecting the positive impact of high transaction speed;
[0126] Reducing the load data FZsij increases the value of 1-FZsij, thereby increasing BCi, reflecting the positive contribution of low load to blockchain selection;
[0127] Adjusting the values of ND and MIij will be done through a complex weighted sum of the form Impact BCi, showing the importance of the demand index and matching index on the final selected blockchain;
[0128] The value range of BCi is set to [0,1], which means that the comprehensive score of the blockchain ranges from the least suitable 0 to the most suitable 1 for cross-chain communication selection strategy;
[0129] When the selection model coefficient is in the range of [0.85, 1.0], it is an ideal choice, indicating that the currently selected blockchain fully meets the current needs, and the transaction fee, speed, and load data are all within the optimal range, while having a low failure rate;
[0130] Transaction fees are 30% or more lower than the average level; transaction speed is 20% or more higher than the average level; load data is 10% or more lower than the average level; transaction failure rate is low failure rate;
[0131] When the model coefficient is in the range of [0.7, 0.85), it is an excellent choice. At this time, the transaction performance and fee performance are good, slightly lower than the ideal choice, but still far above the average level, suitable for most application scenarios;
[0132] Transaction fees are 20% below average; transaction speed is 10% above average; load data is 5% below average; transaction failure rate is low to medium failure rate;
[0133] When the model coefficient is in the range of [0.55, 0.7), it is an acceptable choice. At this time, the performance and cost efficiency are balanced. There is a disadvantage of being lower than the average in some parameters, but it is generally acceptable.
[0134] Transaction fees are 10% below average; transaction speed is 5% above average; load data is approximately equal to average; transaction failure rate is medium failure rate;
[0135] When the model coefficient is selected in the range of [0.4, 0.55), it is an edge selection, which has certain performance or cost issues and needs to be considered carefully. It is only applicable to scenarios with low performance requirements.
[0136] Transaction fees are slightly above or equal to the average level; transaction speed is below or equal to the average level; load data is 5% above the average level; transaction failure rate is medium to high failure rate;
[0137] When the model coefficient is in the range of [0,0.4), it is not recommended. The performance and cost are poor and there are significant drawbacks. It is recommended to avoid using it.
[0138] Transaction fees are more than 30% higher than the average level; transaction speed is more than 10% lower than the average level; load data is more than 10% higher than the average level; transaction failure rate is high.
[0139] Embodiment six:
[0140] See also Figure 2 , a blockchain cross-chain communication device, the device is used to execute the blockchain cross-chain communication method, comprising:
[0141] Data collection module: used to mark several blockchains that can perform cross-chain communication as {1,2,...,i,...,n}, where i represents the ith blockchain, i∈{1,2,...,n}, and n is the total number of blockchains; and mark the number of historical transactions in the ith blockchain as {1,2,...,j,...,m}, j∈{1,2,...,m}, where j represents the jth transaction of the current blockchain, and m is the total number of transactions; collect the transaction fee, transaction speed, and load data of the jth transaction in the ith blockchain, and obtain the transaction failure rate under the current number of transactions, and finally form a historical data set;
[0142] The first index generation module is used to obtain the transaction fee, transaction speed, load data and transaction failure rate of the jth transaction in the i-th blockchain in the historical data set, and then analyze and process them to generate a matching index, which describes the composition ratio between the communication cost and performance under the current data;
[0143] The second index generation module is used to obtain the demand data on transaction fees, transaction speed, load data, and transaction failure rate in the cross-chain communication data required; and after analyzing and processing the demand data, generate a demand index, which describes the expected composition ratio between communication cost and performance;
[0144] Model building module: used to obtain the matching index and demand index, and perform analysis and processing, and build a blockchain selection model based on these indices. The blockchain selection model can select blockchains that meet both cost requirements and performance requirements from the matching index according to the expected composition ratio represented by the demand index, so as to conduct cross-chain communication transactions.
[0145] The above formulas are all dimensionless and numerical calculations. The formula is a formula for the most recent real situation obtained by collecting a large amount of data and performing software simulation. The preset parameters in the formula are set by technicians in this field according to actual conditions.
[0146] The above embodiments may be implemented in whole or in part by software, hardware, firmware or any other combination thereof. When implemented by software, the above embodiments may be implemented in whole or in part in the form of a computer program product. Those skilled in the art may appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein may be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed by hardware or software methods depends on the specific application and design constraints of the technical solution.
[0147] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0148] The above description is only a specific implementation manner of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application.
Claims
1. A blockchain cross-chain communication method, It is characterized in that The specific steps include: Step S1, mark several blockchains capable of cross-chain communication as {1,2,...,i,...,n}, where i represents the ith blockchain, i∈{1,2,...,n}, and n is the total number of blockchains; and mark the number of historical transactions in the ith blockchain as {1,2,...,j,...,m}, j∈{1,2,...,m}, where j represents the jth transaction of the current blockchain, and m is the total number of transactions; collect transaction fees, transaction speed, and load data of the jth transaction in the ith blockchain, and obtain the transaction failure rate under the current number of transactions, and finally form a historical data set; The transaction fee includes the resource consumption fee corresponding to the cross-chain communication data transmission volume and the handling fee required for the transaction confirmation speed; The transaction fee is marked as JYf, the resource consumption fee is marked as Fy1, and the handling fee is marked as Fy2. The calculation formula is as follows: in, represents the transaction fee of the jth transaction in the i-th blockchain, They represent the resource consumption cost and handling fee of the jth transaction in the i-th blockchain respectively; The transaction speed includes block confirmation time, network delay and processing speed. The transaction speed is marked as JYSd, the block confirmation time is marked as QRt, the network delay is marked as Wy, and the processing speed is marked as Cv. The calculation formula is as follows: in, represents the speed of the jth transaction in the i-th blockchain, They represent the confirmation time, network delay, and processing speed of the jth transaction in the i-th blockchain respectively; The load data includes the capacity parameter and processing algorithm efficiency parameter of the current blockchain, and the load data is marked as FZs, the capacity parameter is marked as Lr, and the processing algorithm efficiency parameter is marked as SFXl. The calculation formula is as follows; represents the jth load data in the i-th blockchain, They represent the capacity parameter and processing algorithm efficiency parameter of the jth transaction in the i-th blockchain, respectively. and is a non-negative weight coefficient, ; The transaction failure rate represents the predicted probability that a transaction cannot be successfully completed, and is obtained by dividing the number of transaction failures before the jth transaction by the jth number, and the transaction failure rate is marked as SBl, and the number of failures is marked as u. The calculation formula is as follows: in, represents the predicted value of the failure rate of the jth transaction in the i-th blockchain, represents the number of j-th failures in the i-th blockchain; Step S2: In the historical data set, the transaction fee, transaction speed, load data and transaction failure rate of the jth transaction in the i-th blockchain are obtained and analyzed to generate a matching index, which describes the composition ratio between the communication cost and performance under the current data; Define the matching index as , the calculation formula is as follows: in, Both are normalization functions, which are used to normalize the transaction fee, transaction speed, and load data of the jth transaction in the i-th blockchain to the range of [0,1]; is the matching index of the jth transaction in the i-th blockchain, Respectively represent the maximum values of transaction fee, transaction speed and load data in all historical data; in is a normal number, is the transaction fee of the jth transaction in the i-th blockchain; is the transaction speed of the jth transaction in the i-th blockchain; is the j-th load data in the i-th blockchain; is the predicted value of the transaction failure rate of the jth transaction in the i-th blockchain; set up The value range is in the range of [0,1], where values close to 1 indicate that the performance represented by cost and transaction efficiency is relatively optimized, while values close to 0 indicate a high failure rate or an unbalanced cost and performance ratio; Will The value range [0,1] is divided into several level intervals. Different intervals indicate that transaction fees, transaction speed, load data, and transaction failure rate are in different composition proportions. Step S3: Obtain demand data on transaction fees, transaction speed, load data, and transaction failure rate in the cross-chain communication data required; and after analyzing and processing the demand data, generate a demand index, which describes the expected composition ratio between communication cost and performance; The demand index is defined as ND, and the calculation formula is as follows: Among them, ND is the demand index; and are the expected values of resource consumption cost and handling fee respectively; is the expected value of demand for the capacity parameter; They are the expected values of block confirmation time, network latency, and processing speed. They are the expected values of the processing algorithm efficiency parameters and load data requirements; is the expected value of transaction failure rate; the above data have been normalized and quantified; a1, a2, a3 are the weight coefficients of the corresponding parameters, and a1, a2, a3 are all non-negative numbers, a1+a2+a3=1, e1 is the weight adjustment coefficient, ; The value range of ND is set to [0,1]. The closer to 0, the greater the demand for either cost minimization or performance maximization. The closer to 1, the greater the demand for blockchains that minimize costs or maximize performance. Step S4: Obtain the matching index and demand index, analyze and process them, and build a blockchain selection model based on these indices. The blockchain selection model can select a blockchain that meets both cost requirements and performance requirements from the matching index according to the expected composition ratio represented by the demand index to conduct cross-chain communication transactions.
2. A blockchain cross-chain communication method according to claim 1, Features: Define the blockchain selection model as , the calculation formula is as follows: in, Represents the selection model coefficient when selecting the i-th blockchain; c1, c2, c3 are weight parameters, and c1, c2, c3 are non-negative numbers, c1+c2+c3=1, which are used to adjust the relative importance of fee, speed and load data; r is an exponential decay parameter, which is used to adjust the impact of transaction fees, 0.12≤r≤0.77; c4 and c5 are weight parameters, which are used to adjust the weight of demand index and matching index in the total score, and c4, c5 are non-negative numbers, c4+c5=1; t1, t2 are weighted powers of demand index and matching index, which are used to adjust their impact intensity; set up The value range of is [0,1], which means that the comprehensive score of the blockchain ranges from the least suitable 0 to the most suitable 1 for cross-chain communication selection strategy; When the selection model coefficient is in the range of [0.85, 1.0], it is an ideal choice, indicating that the currently selected blockchain fully meets the current needs, and the transaction fee, speed, and load data are all within the optimal range, while having a low failure rate; When the model coefficient is in the range of [0.7, 0.85), it is an excellent choice. At this time, the transaction performance and fee performance are good, slightly lower than the ideal choice, but still far above the average level, which is suitable for most application scenarios; When the model coefficient is in the range of [0.55, 0.7), it is an acceptable choice. At this time, the performance and cost efficiency are balanced. Some parameters are lower than the average value, but it is generally acceptable. When the model coefficient is selected in the range of [0.4, 0.55), it is an edge selection, which has certain performance or cost issues and needs to be considered carefully. It is only applicable to scenarios with low performance requirements. When the model coefficient is selected in the range of [0,0.4), it is not recommended. The performance and cost are poor and there are significant disadvantages. It is recommended to avoid using it.
3. A blockchain cross-chain communication device, Features: The device is used to execute the blockchain cross-chain communication method according to any one of claims 1-2, including: Data collection module: used to mark several blockchains that can perform cross-chain communication as {1,2,...,i,...,n}, where i represents the ith blockchain, i∈{1,2,...,n}, and n is the total number of blockchains; and mark the number of historical transactions in the ith blockchain as {1,2,...,j,...,m}, j∈{1,2,...,m}, where j represents the jth transaction of the current blockchain, and m is the total number of transactions; collect the transaction fee, transaction speed, and load data of the jth transaction in the ith blockchain, and obtain the transaction failure rate under the current number of transactions, and finally form a historical data set; The first index generation module is used to obtain the transaction fee, transaction speed, load data and transaction failure rate of the jth transaction in the i-th blockchain in the historical data set, and then analyze and process them to generate a matching index, which describes the composition ratio between the communication cost and performance under the current data; The second index generation module is used to obtain the demand data on transaction fees, transaction speed, load data, and transaction failure rate in the cross-chain communication data required; and after analyzing and processing the demand data, generate a demand index, which describes the expected composition ratio between communication cost and performance; Model building module: used to obtain the matching index and demand index, and perform analysis and processing, and build a blockchain selection model based on these indices. The blockchain selection model can select blockchains that meet both cost requirements and performance requirements from the matching index according to the expected proportion represented by the demand index, so as to conduct cross-chain communication transactions.
