Method, apparatus and readable storage medium for determining out-of-block time of block chain

文档序号:105348 发布日期:2021-10-15 浏览:13次 中文

阅读说明:本技术 用于确定区块链的出块时间的方法、装置及可读存储介质 (Method, apparatus and readable storage medium for determining out-of-block time of block chain ) 是由 史锋锋 于 2021-07-14 设计创作,主要内容包括:本公开内容提供了一种用于确定区块链中的出块时间的方法,所述方法包括:由区块链中的共识节点接收交易请求,其中,所述交易请求为需要所述共识节点进行共识的交易;由区块链中的共识节点接收区块链系统的内部信息;基于所述内部信息预测接下来预定时间段内的交易数量和下一个交易的预测时间;以及基于所述交易数量和所述预测时间确定实际出块时间。由于所述方法考虑了区块链的内部信息,从而使得依据本公开内容所提出的技术方案能够基于不同的交易数量以及交易密集程度满足不同业务场景的需求,提高区块链相应速度,提升用户体验满意度。(The present disclosure provides a method for determining an out-of-block time in a blockchain, the method comprising: receiving a transaction request by a consensus node in a block chain, wherein the transaction request is a transaction requiring the consensus node to perform consensus; receiving internal information of a blockchain system by a consensus node in the blockchain; predicting a transaction amount in a next predetermined period of time and a predicted time of a next transaction based on the internal information; and determining an actual block out time based on the transaction amount and the predicted time. The method considers the internal information of the block chain, so that the technical scheme provided by the disclosure can meet the requirements of different service scenes based on different transaction quantities and transaction intensity, improve the corresponding speed of the block chain and improve the user experience satisfaction.)

1. A method for determining an out-of-block time in a block chain, the method comprising:

receiving a transaction request by a consensus node in a block chain, wherein the transaction request is a transaction requiring the consensus node to perform consensus;

receiving internal information of a blockchain system by a consensus node in the blockchain;

predicting a transaction amount in a next predetermined period of time and a predicted time of a next transaction based on the internal information; and

an actual block out time is determined based on the transaction amount and the predicted time.

2. The method of claim 1, wherein the internal information of the blockchain system comprises at least one of the following information:

a transaction amount to be submitted to the consensus node;

an average time of submission to the consensus node;

the number of transactions being performed on the transaction node;

an average time to perform a transaction on the transaction node;

having received a number of transactions waiting to be performed on the transaction node; and/or

Has received and awaited the average wait time for execution at the trading node.

3. The method of claim 2, wherein the transaction request includes a maximum transaction amount and a maximum block out time, and wherein determining an actual block out time based on the transaction amount and the predicted time further comprises:

predicting a first block-out time based on the maximum transaction amount and the maximum block-out time;

predicting a second block out time based on the transaction amount and the predicted time; and

and determining the actual block output time based on the comparison result of the first block output time and the second block output time.

4. The method of claim 3, wherein predicting a second out-of-block time based on the transaction amount and the predicted time further comprises:

calculating a first waiting time based on the average time submitted to the consensus node when the number of transactions to be submitted to the consensus node is greater than zero;

calculating a second wait time based on an average time to perform transactions on a transaction node and the first wait time if a number of transactions being performed on the transaction node is greater than zero;

calculating a third waiting time based on the average waiting time that has been received and is waiting to be executed on the trading node and the second waiting time, in case the number of received trades waiting to be executed on the trading node is greater than zero; and

calculating the second out-of-block time based on the third latency.

5. The method of claim 4, wherein the first wait time is calculated based on an average time submitted to the consensus node and a first random perturbation associated with a historical average time if the number of transactions to be submitted to the consensus node is greater than zero.

6. The method of claim 4, wherein in the event that the number of transactions being performed at a transaction node is greater than zero, calculating a second latency based on an average time to perform transactions at the transaction node, the first latency, and a second random perturbation associated with a historical average time.

7. The method of claim 4, wherein in the event that the number of received transactions waiting to be performed at the trading node is greater than zero, calculating a third wait time based on the average wait time that has been received and waiting to be performed at the trading node, the second wait time, and a third random perturbation associated with a historical average time.

8. An apparatus for determining an out-of-block time in a block chain, the apparatus comprising:

a processor; and

a memory for storing instructions that, when executed, cause the processor to:

receiving a transaction request by a consensus node in a block chain, wherein the transaction request is a transaction requiring the consensus node to perform consensus;

receiving internal information of a blockchain system by a consensus node in the blockchain;

predicting a transaction amount in a next predetermined period of time and a predicted time of a next transaction based on the internal information; and

an actual block out time is determined based on the transaction amount and the predicted time.

9. The apparatus of claim 8, wherein the internal information of the blockchain system comprises at least one of the following information:

a transaction amount to be submitted to the consensus node;

an average time of submission to the consensus node;

the number of transactions being performed on the transaction node;

an average time to perform a transaction on the transaction node;

having received a number of transactions waiting to be performed on the transaction node; and/or

Has received and awaited the average wait time for execution at the trading node.

10. The apparatus of claim 8, wherein the transaction request includes a maximum transaction amount and a maximum block out time, and wherein determining an actual block out time based on the transaction amount and the predicted time further comprises:

predicting a first block-out time based on the maximum transaction amount and the maximum block-out time;

predicting a second block out time based on the transaction amount and the predicted time; and

and determining the actual block output time based on the comparison result of the first block output time and the second block output time.

11. The apparatus of claim 10, wherein predicting a second out-of-block time based on the transaction amount and the predicted time further comprises:

calculating a first waiting time based on the average time submitted to the consensus node when the number of transactions to be submitted to the consensus node is greater than zero;

calculating a second wait time based on an average time to perform transactions on a transaction node and the first wait time if a number of transactions being performed on the transaction node is greater than zero;

calculating a third waiting time based on the average waiting time that has been received and is waiting to be executed on the trading node and the second waiting time, in case the number of received trades waiting to be executed on the trading node is greater than zero; and

calculating the second out-of-block time based on the third latency.

12. The method of claim 11, wherein the first wait time is calculated based on an average time submitted to the consensus node and a first random perturbation associated with a historical average time if the number of transactions to be submitted to the consensus node is greater than zero.

13. The method of claim 11, wherein in the event that the number of transactions being performed at a transaction node is greater than zero, calculating a second latency based on an average time to perform transactions at the transaction node, the first latency, and a second random perturbation associated with a historical average time.

14. The method of claim 11, wherein in the event that the number of received transactions waiting to be performed at the trading node is greater than zero, calculating a third wait time based on the average wait time that has been received and waiting to be performed at the trading node, the second wait time, and a third random perturbation associated with a historical average time.

15. A computer readable storage medium having computer readable program instructions stored thereon for performing the method for determining a block out time in a blockchain according to any one of claims 1 to 7.

Technical Field

The present disclosure relates to a block chain technology, and more particularly, to a method for determining an out-of-block time in a block chain, an apparatus for determining an out-of-block time in a block chain, and a readable storage medium.

Background

In a federation chain network, a blockchain algorithm usually does not consider malicious nodes, and all nodes participate in the consensus process of the blockchain algorithm. The block-out process of the consensus algorithm is to pack the transaction into blocks, calculate the hash of the blocks and form a block chain account book which cannot be tampered. The block packing algorithm in the prior art has two constraint variables, one is the maximum transaction number in a block, the other is the block packing maximum waiting time, and if the condition is reached first, a block is obtained. For example, the maximum transaction amount in a block is 10, the block packing longest waiting time is 2 seconds, and if the transaction amount received by the consensus node exceeds 10 or the waiting time exceeds 2 seconds, the consensus node packs a block. After the transaction is packed into the block, the transaction can be considered to be finally successful only by obtaining the verification and confirmation of the transaction node. Therefore, a transaction proposal is submitted to the transaction node, then the transaction is sent to the common identification node to go out of the block until the transaction node receives the block and successfully verifies the block, and the whole process is a complete execution process of the transaction. The service system generally calls the blockchain transaction node and the consensus node through the blockchain application gateway, or the service system can directly call the blockchain transaction node and the consensus node.

In the real world, some blockchain transactions usually have higher priority, and it is necessary to minimize the delay time during their writing into the blockchain. For example, when a blockchain network provides service to the outside, according to the service level or priority of a user, for the user with high service level and high priority, the transaction provides higher response level when the user gets out of a block, but in the blockchain network, due to the implementation mechanism of a block policy by a consensus algorithm, all transactions can be treated fairly, and according to the block-out policy with the maximum transaction quantity and the longest waiting time, the transaction with high priority cannot be packaged into a block in time, so that the response level is influenced. In addition, the frequency of blockchain transactions is strongly correlated to the frequency of traffic. The block-out strategy of the maximum transaction amount and the longest waiting time in the block can lead the final time of transaction execution to reach 2 seconds when the condition of the maximum transaction amount cannot be reached under the condition of relatively low transaction frequency, and can lead a large amount of block-out pressure of the system when the condition of the maximum transaction amount is quickly reached under the condition of relatively high transaction frequency. Even if the transaction frequency changes dynamically, the optimal block-out strategy can not be achieved all the time.

Disclosure of Invention

In order to solve the requirement of different users or services on the response time of a block chain, an embodiment of the present invention provides a method for determining an out-of-block time in a block chain, where the method includes:

receiving a transaction request by a consensus node in a block chain, wherein the transaction request is a transaction requiring the consensus node to perform consensus;

receiving internal information of a blockchain system by a consensus node in the blockchain;

predicting a transaction amount in a next predetermined period of time and a predicted time of a next transaction based on the internal information; and

an actual block out time is determined based on the transaction amount and the predicted time.

In an embodiment according to the present disclosure, the internal information of the block chain system includes at least one of the following information:

a transaction amount to be submitted to the consensus node;

an average time of submission to the consensus node;

the number of transactions being performed on the transaction node;

an average time to perform a transaction on the transaction node;

having received a number of transactions waiting to be performed on the transaction node; and/or

Has received and awaited the average wait time for execution at the trading node.

In one embodiment according to the present disclosure, the transaction request includes a maximum transaction amount and a maximum block-out time, and determining an actual block-out time based on the transaction amount and the predicted time further includes:

predicting a first block-out time based on the maximum transaction amount and the maximum block-out time;

predicting a second block out time based on the transaction amount and the predicted time; and

and determining the actual block output time based on the comparison result of the first block output time and the second block output time.

In one embodiment according to the present disclosure, predicting a second out-of-block time based on the transaction amount and the predicted time further comprises:

calculating a first waiting time based on the average time submitted to the consensus node when the number of transactions to be submitted to the consensus node is greater than zero;

calculating a second wait time based on an average time to perform transactions on a transaction node and the first wait time if a number of transactions being performed on the transaction node is greater than zero;

calculating a third waiting time based on the average waiting time that has been received and is waiting to be executed on the trading node and the second waiting time, in case the number of received trades waiting to be executed on the trading node is greater than zero; and

calculating the second out-of-block time based on the third latency.

In one embodiment according to the present disclosure, a first wait time is calculated based on an average time submitted to the consensus node and a first random perturbation associated with a historical average time, in the event that the number of transactions to be submitted to the consensus node is greater than zero.

In one embodiment according to the present disclosure, a second latency is calculated based on an average time to perform transactions on a transaction node, the first latency, and a second random perturbation associated with a historical average time, where a number of transactions being performed on the transaction node is greater than zero.

In one embodiment according to the present disclosure, in the event that the number of received transactions waiting to be executed on the trading node is greater than zero, a third wait time is calculated based on the average wait time that has been received and waiting to be executed on the trading node, the second wait time, and a third random perturbation associated with the historical average time.

Furthermore, a second aspect of the present disclosure also proposes an apparatus for determining a block out time in a block chain, wherein the apparatus comprises:

a processor; and

a memory for storing instructions that, when executed, cause the processor to:

receiving a transaction request by a consensus node in a block chain, wherein the transaction request is a transaction requiring the consensus node to perform consensus;

receiving internal information of a blockchain system by a consensus node in the blockchain;

predicting a transaction amount in a next predetermined period of time and a predicted time of a next transaction based on the internal information; and

an actual block out time is determined based on the transaction amount and the predicted time.

In an embodiment according to the present disclosure, the internal information of the block chain system includes at least one of the following information:

a transaction amount to be submitted to the consensus node;

an average time of submission to the consensus node;

the number of transactions being performed on the transaction node;

an average time to perform a transaction on the transaction node;

having received a number of transactions waiting to be performed on the transaction node; and/or

Has received and awaited the average wait time for execution at the trading node.

In one embodiment according to the present disclosure, the transaction request includes a maximum transaction amount and a maximum block-out time, and determining an actual block-out time based on the transaction amount and the predicted time further includes:

predicting a first block-out time based on the maximum transaction amount and the maximum block-out time;

predicting a second block out time based on the transaction amount and the predicted time; and

and determining the actual block output time based on the comparison result of the first block output time and the second block output time.

In one embodiment according to the present disclosure, predicting a second out-of-block time based on the transaction amount and the predicted time further comprises:

calculating a first waiting time based on the average time submitted to the consensus node when the number of transactions to be submitted to the consensus node is greater than zero;

calculating a second wait time based on an average time to perform transactions on a transaction node and the first wait time if a number of transactions being performed on the transaction node is greater than zero;

calculating a third waiting time based on the average waiting time that has been received and is waiting to be executed on the trading node and the second waiting time, in case the number of received trades waiting to be executed on the trading node is greater than zero; and

calculating the second out-of-block time based on the third latency.

In one embodiment according to the present disclosure, a first wait time is calculated based on an average time submitted to the consensus node and a first random perturbation associated with a historical average time, in the event that the number of transactions to be submitted to the consensus node is greater than zero.

In one embodiment according to the present disclosure, a second latency is calculated based on an average time to perform transactions on a transaction node, the first latency, and a second random perturbation associated with a historical average time, where a number of transactions being performed on the transaction node is greater than zero.

In one embodiment according to the present disclosure, in the event that the number of received transactions waiting to be executed on the trading node is greater than zero, a third wait time is calculated based on the average wait time that has been received and waiting to be executed on the trading node, the second wait time, and a third random perturbation associated with the historical average time.

Furthermore, a third aspect of the present disclosure also proposes a computer-readable storage medium having stored thereon computer-readable program instructions for executing the method for determining an out-of-block time in a blockchain proposed according to the first aspect of the present disclosure.

In summary, the method considers the internal information of the blockchain, so that the technical scheme provided by the disclosure can meet the requirements of different service scenes based on different transaction quantities and transaction intensity, improve the corresponding speed of the blockchain, and improve the user experience satisfaction. Other advantages of the present invention will be further described below.

Drawings

The features, advantages and other aspects of various embodiments of the present invention will become more apparent by referring to the following detailed description in conjunction with the accompanying drawings, in which several embodiments of the invention are shown by way of illustration and not limitation, wherein:

fig. 1 shows a flow chart of a method 100 for determining an out-of-block time in a blockchain proposed in accordance with the present disclosure;

fig. 2 shows a schematic diagram of an embodiment 200 of a network architecture in which the method 100 for determining an out-of-block time in a blockchain according to fig. 1 can be implemented;

fig. 3 shows a schematic diagram of an apparatus 300 for determining a block out time in a block chain according to an embodiment of the invention; and

fig. 4 shows a schematic diagram of an apparatus 400 for determining a block out time in a block chain according to another embodiment of the invention.

Detailed Description

Various exemplary embodiments of the present invention are described in detail below with reference to the accompanying drawings. Although the exemplary methods, apparatus, and devices described below include software and/or firmware executed on hardware among other components, it should be noted that these examples are merely illustrative and should not be considered as limiting. For example, it is contemplated that any or all of the hardware, software, and firmware components could be embodied exclusively in hardware, exclusively in software, or in any combination of hardware and software. Thus, while the following describes example methods and apparatus, persons of ordinary skill in the art will readily appreciate that the examples provided are not intended to limit the manner in which the methods and apparatus may be implemented.

Furthermore, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of methods and systems according to various embodiments of the present invention. It should be noted that the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

In order to solve the requirement of different users or services on the response time of the blockchain, an embodiment of the present invention provides a method for determining an out-of-block time in the blockchain, fig. 1 shows a flowchart of a method 100 for determining an out-of-block time in a blockchain according to the present disclosure, and as can be seen from fig. 1, the method 100 at least includes the following four steps:

first, in method step 110, a transaction request is received by a consensus node in a block chain, where the transaction request is a transaction requiring the consensus node to perform consensus;

next, in method step 120, the internal information of the blockchain system is received by the common node in the blockchain;

then, in method step 130, the number of transactions in the next predetermined period of time and the predicted time for the next transaction are predicted based on the internal information; and

finally, in method step 140, an actual block out time is determined based on the transaction amount and the predicted time.

The method considers the internal information of the block chain, so that the technical scheme provided by the disclosure can meet the requirements of different service scenes based on different transaction quantities and transaction intensity, improve the corresponding speed of the block chain and improve the user experience satisfaction.

In an embodiment according to the present disclosure, the internal information of the block chain system includes at least one of the following information:

a transaction amount to be submitted to the consensus node;

an average time of submission to the consensus node;

the number of transactions being performed on the transaction node;

an average time to perform a transaction on the transaction node;

having received a number of transactions waiting to be performed on the transaction node; and/or

Has received and awaited the average wait time for execution at the trading node.

In one embodiment according to the present disclosure, the transaction request includes a maximum transaction amount and a maximum block-out time, and determining an actual block-out time based on the transaction amount and the predicted time further includes:

predicting a first block-out time based on the maximum transaction amount and the maximum block-out time;

predicting a second block out time based on the transaction amount and the predicted time; and

and determining the actual block output time based on the comparison result of the first block output time and the second block output time.

In one embodiment according to the present disclosure, predicting a second out-of-block time based on the transaction amount and the predicted time further comprises:

calculating a first waiting time based on the average time submitted to the consensus node when the number of transactions to be submitted to the consensus node is greater than zero;

calculating a second wait time based on an average time to perform transactions on a transaction node and the first wait time if a number of transactions being performed on the transaction node is greater than zero;

calculating a third waiting time based on the average waiting time that has been received and is waiting to be executed on the trading node and the second waiting time, in case the number of received trades waiting to be executed on the trading node is greater than zero; and

calculating the second out-of-block time based on the third latency.

In one embodiment according to the present disclosure, a first wait time is calculated based on an average time submitted to the consensus node and a first random perturbation associated with a historical average time, in the event that the number of transactions to be submitted to the consensus node is greater than zero.

In one embodiment according to the present disclosure, a second latency is calculated based on an average time to perform transactions on a transaction node, the first latency, and a second random perturbation associated with a historical average time, where a number of transactions being performed on the transaction node is greater than zero.

In one embodiment according to the present disclosure, in the event that the number of received transactions waiting to be executed on the trading node is greater than zero, a third wait time is calculated based on the average wait time that has been received and waiting to be executed on the trading node, the second wait time, and a third random perturbation associated with the historical average time.

For example, when the service system or the blockchain application gateway submits the transaction to the consensus node, the internal information in the system may be notified to the consensus node, so as to provide prediction data for the consensus node to accurately predict the number of the next transaction. A blockchain transaction submitter submitting a transaction to a consensus node may append the following information (in part or in whole) each time a transaction is submitted to the consensus node:

n1 transaction amount to be submitted to consensus node (submit transaction)

T1 average time of submission to consensus node (submit transaction)

N2 number of transactions being performed on a trading node (executing a trade)

T2 average time to execute transaction on transaction node (execute transaction)

N3 transaction amount waiting to be executed on the transaction node has been received (waiting to execute transaction)

T3 average wait time for having received and waiting to execute on a trading node (waiting to execute a trade)

The consensus node, upon receiving the transaction and the above information, determines a block policy. The block output strategy of the consensus node in a block output time period is as follows:

and as long as the maximum transaction quantity and the maximum block output waiting time are met, the consensus node immediately packages the existing transactions and outputs the blocks.

When the maximum transaction quantity and the maximum block-out waiting time are not met, the consensus node calculates the waiting time of other transactions according to the information carried in the transactions, and automatically calculates new waiting time when new transactions are received, wherein the calculation method comprises the following steps:

if N1>0, then the calculated latency is: W1-T1 + r1, where r1 is the random perturbation (which may be set to 0) calculated from the historical average time, otherwise W1-0.

If N2>0, then the calculated latency is: W2-T2 + W1+ r2, where r2 is a random perturbation (which may be set to 0) calculated from the historical average time, otherwise W2-0.

If N3>0, then the calculated latency is: W3-T3 + W2+ r3, where r3 is a random perturbation (which may be set to 0) calculated from the historical average time, otherwise W3-0.

The final wait time is: t ═ a × W1) + (b × W2) + (c × W3), where a, b, and c are built-in weighting factors.

Fig. 2 shows a schematic diagram of an embodiment 200 of a network architecture in which the method 100 for determining an out-of-block time in a block chain according to fig. 1 can be implemented, and it can be seen from fig. 2 that a consensus node packs a block. After the transaction is packed into the block, the transaction can be considered to be finally successful only by obtaining the verification and confirmation of the transaction node. Therefore, a transaction proposal is submitted to the transaction node, then the transaction is sent to the common identification node to go out of the block until the transaction node receives the block and successfully verifies the block, and the whole process is a complete execution process of the transaction. The service system generally calls the blockchain transaction node and the consensus node through the blockchain application gateway, or the service system can directly call the blockchain transaction node and the consensus node.

Further, alternatively, the above-described method can be implemented by a computer program product, i.e., a computer-readable storage medium. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for carrying out various aspects of the present disclosure. The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be construed as transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or electrical signals transmitted through electrical wires.

Fig. 3 shows a schematic diagram of an apparatus 300 for determining a block out time in a block chain according to an embodiment of the invention. As can be seen in FIG. 3, the blockchain based secure multi-party computing device 300 includes a processor 310 and a memory 320 coupled to the processor 310.

The memory 320 stores instructions. The instructions, when executed by the processor 310, cause the processor 310 to perform the following acts:

receiving a transaction request by a consensus node in a block chain, wherein the transaction request is a transaction requiring the consensus node to perform consensus;

receiving internal information of a blockchain system by a consensus node in the blockchain;

predicting a transaction amount in a next predetermined period of time and a predicted time of a next transaction based on the internal information; and

an actual block out time is determined based on the transaction amount and the predicted time.

In an embodiment according to the present disclosure, the internal information of the block chain system includes at least one of the following information:

a transaction amount to be submitted to the consensus node;

an average time of submission to the consensus node;

the number of transactions being performed on the transaction node;

an average time to perform a transaction on the transaction node;

having received a number of transactions waiting to be performed on the transaction node; and/or

Has received and awaited the average wait time for execution at the trading node.

In one embodiment according to the present disclosure, the transaction request includes a maximum transaction amount and a maximum block-out time, and determining an actual block-out time based on the transaction amount and the predicted time further includes:

predicting a first block-out time based on the maximum transaction amount and the maximum block-out time;

predicting a second block out time based on the transaction amount and the predicted time; and

and determining the actual block output time based on the comparison result of the first block output time and the second block output time.

In one embodiment according to the present disclosure, predicting a second out-of-block time based on the transaction amount and the predicted time further comprises:

calculating a first waiting time based on the average time submitted to the consensus node when the number of transactions to be submitted to the consensus node is greater than zero;

calculating a second wait time based on an average time to perform transactions on a transaction node and the first wait time if a number of transactions being performed on the transaction node is greater than zero;

calculating a third waiting time based on the average waiting time that has been received and is waiting to be executed on the trading node and the second waiting time, in case the number of received trades waiting to be executed on the trading node is greater than zero; and

calculating the second out-of-block time based on the third latency.

In one embodiment according to the present disclosure, a first wait time is calculated based on an average time submitted to the consensus node and a first random perturbation associated with a historical average time, in the event that the number of transactions to be submitted to the consensus node is greater than zero.

In one embodiment according to the present disclosure, a second latency is calculated based on an average time to perform transactions on a transaction node, the first latency, and a second random perturbation associated with a historical average time, where a number of transactions being performed on the transaction node is greater than zero.

In one embodiment according to the present disclosure, in the event that the number of received transactions waiting to be executed on the trading node is greater than zero, a third wait time is calculated based on the average wait time that has been received and waiting to be executed on the trading node, the second wait time, and a third random perturbation associated with the historical average time.

Fig. 4 shows a schematic diagram of an apparatus 400 for determining a block out time in a block chain according to another embodiment of the invention. It should be appreciated that the apparatus 400 may be implemented to implement the functionality of the method 100 of fig. 1 for determining an out-of-block time in a blockchain. It can be seen from fig. 4 that the blockchain based secure multi-party computing device 400 includes a Central Processing Unit (CPU)401, e.g., a processor, which may perform various appropriate actions and processes according to computer program instructions stored in a Read Only Memory (ROM)402 or loaded from a storage unit 408 into a Random Access Memory (RAM) 403. In the RAM 403, various programs and data necessary for the operation of the apparatus 400 can also be stored. The CPU 401, ROM 402, and RAM 403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.

A number of components in the apparatus 400 are connected to the I/O interface 405, including: an input unit 406 such as a keyboard, a mouse, or the like; an output unit 407 such as various types of displays, speakers, and the like; a storage unit 408 such as a magnetic disk, optical disk, or the like; and a communication unit 409 such as a network card, modem, wireless communication transceiver, etc. The communication unit 409 allows the apparatus 400 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.

Various methods described above, such as a block chain based secure multi-party computing method, can be performed by processing unit 401. For example, in some embodiments, the method 100 for determining a block out time in a blockchain may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 408. In some embodiments, part or all of the computer program may be loaded and/or installed onto the apparatus 400 via the ROM 402 and/or the communication unit 409. When loaded into RAM 403 and executed by CPU 401, may perform one or more of the acts or steps described above in method 100 of determining out-of-block times in a blockchain.

In general, the various exemplary embodiments of this invention may be implemented in hardware or special purpose circuits, software, firmware, logic or any combination thereof. Certain aspects may be implemented in hardware, while other aspects may be implemented in firmware or software which may be executed by a controller, microprocessor or other computing device. While various aspects of the embodiments of the invention may be illustrated and described as block diagrams, flow charts, or using some other pictorial representation, it is well understood that the blocks, apparatus, systems, techniques or methods described herein may be implemented in, as non-limiting examples, hardware, software, firmware, special purpose circuits or logic, general purpose hardware or controller or other computing devices, or some combination thereof.

Although the various exemplary embodiments of the present invention are described above as being implemented in hardware or in dedicated circuitry, the data processing apparatus for blockchains described above may be implemented in either hardware or software, because: in the 90's of the 20 th century, a technological improvement could easily be either a hardware improvement (e.g., an improvement in the structure of a circuit such as a diode, a transistor, a switch, etc.) or a software improvement (e.g., an improvement in the process flow). However, as the technology continues to develop, many of the current method flow improvements can be almost realized by programming the improved method flow into the hardware circuit, in other words, by programming different programs for the hardware circuit to obtain the corresponding hardware circuit structure, i.e. realizing the change of the hardware circuit structure, so that such method flow improvements can also be regarded as direct improvements of the hardware circuit structure. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by a user programming the Device. A digital system is "integrated" on a piece of programmable logic device by the designer's own programming without requiring the chip manufacturer to design and fabricate application specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler 1 er" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one kind, but many kinds, such as abel (advanced Boolean Expression Language), ahdl (advanced Hardware Description Language), communication, pl (core unity Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, HDL, pamm, hard Language (Hardware Description Language), and vhigh Language (Hardware Description Language), which are currently used in the most popular fields. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.

Computer readable program instructions or computer program products for performing aspects of the present disclosure can also be stored in the cloud, and when a call is needed, a user can access the computer readable program instructions stored in the cloud for performing aspects of the present disclosure through a mobile internet, a fixed network, or other networks, so as to implement the technical solutions disclosed according to aspects of the present disclosure.

Furthermore, a third aspect of the present disclosure also proposes a computer-readable storage medium having stored thereon computer-readable program instructions for executing the method for determining an out-of-block time in a blockchain proposed according to the first aspect of the present disclosure.

In summary, the method considers the internal information of the blockchain, so that the technical scheme provided by the disclosure can meet the requirements of different service scenes based on different transaction quantities and transaction intensity, improve the corresponding speed of the blockchain, and improve the user experience satisfaction.

The above description is only an alternative embodiment of the present disclosure, and is not intended to limit the embodiments of the present disclosure, and various modifications and changes may be made to the embodiments of the present disclosure by those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present invention should be included in the protection scope of the embodiments of the present invention.

While embodiments of the invention have been described with reference to several particular embodiments, it is to be understood that embodiments of the invention are not limited to the specific embodiments disclosed. The embodiments of the invention are intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims. The scope of the claims is to be accorded the broadest interpretation so as to encompass all such modifications and equivalent structures and functions.

15页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:机台插槽的异常侦测方法、修复方法和异常侦测系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!