The present application claims priority of chinese patent application entitled "block chain based high concurrency fast transaction and verification method" filed by chinese patent office on 26/2/2019 with application number 201910141898.7, the entire contents of which are incorporated herein by reference.
Disclosure of Invention
The application provides a block chain-based transaction system, which is used for solving the technical problem that the safety, expandability and decentralization of a block chain system cannot be considered in the prior art.
The embodiment of the application provides a transaction system based on a block chain, wherein nodes in the system are mutually connected in a network; selecting part of nodes from the system at intervals of a preset time period to be configured as core nodes, and selecting part of nodes from nodes except the core nodes to be configured as supervision nodes;
the core node is further configured to: when a transaction occurs, receiving a transaction request, verifying the transaction request, generating first block chain data corresponding to the transaction request after the verification is passed, and storing and broadcasting the first block chain data;
the supervisory node is further configured to: and checking the first block chain data.
In one possible embodiment, the first supervisory node is further configured to: if the check result of the first block chain data is wrong, marking the first block chain data as illegal data, and broadcasting a message that the first block chain data is illegal data in the system; the first supervision node is any one of the supervision nodes;
the second supervisory node is further configured to: after receiving a message that the first blockchain data is illegal data, checking the first blockchain data, and if the checking result of the first blockchain data is wrong, configuring a core node storing the first blockchain data as a participating node; the second supervision node is any one of the supervision nodes except the first supervision node.
In one possible embodiment, nodes in the system other than the core node and the supervisory node are configured as participating nodes;
the supervisory node is further configured to: if the check result of the first block chain data stored in the core node is error-free, broadcasting a message that the check result of the first block chain data is error-free to the system;
the participating node is further configured to: after receiving the message that the checking result of the first block chain data is correct, generating summary information corresponding to the first block chain data, generating second block chain data according to the summary information, and storing the second block chain data.
In one possible embodiment, the supervisory node is further configured to: and if the check result of the first block chain data stored in the core node is correct, generating abstract information corresponding to the first block chain data, generating third block chain data according to the abstract information, and storing the third block chain data.
In a possible implementation mode, every preset time period, selecting part of nodes from the system in a public link intelligent contract random election mode, and configuring the selected part of nodes as core nodes; selecting part of nodes from the nodes except the core nodes in a public link intelligent contract random election mode, and configuring the selected part of nodes as supervision nodes; and configuring nodes in the system except the core node and the supervisory node as participating nodes.
In a possible implementation manner, every preset time period, according to the distance between the node's own resources and the nodes, a part of nodes are selected from the system and configured as core nodes, and a part of nodes are selected from nodes except the core nodes and configured as supervision nodes, and nodes except the core nodes and the supervision nodes in the system are configured as participating nodes.
In a possible implementation manner, according to the distance between the resource of the node and the node in the current time period, selecting a part of nodes from the core nodes in the previous time period, and configuring the selected part of nodes as supervision nodes or participation nodes in the current time period; according to the distance between the resources of the nodes in the current time period and the nodes, selecting part of nodes from the supervision nodes in the previous time period, and configuring the selected part of nodes as core nodes or participating nodes in the current time period; and selecting part of nodes from the participating nodes in the previous time period according to the self resources of the nodes in the current time period and the distance between the nodes, and configuring the selected part of nodes as core nodes or supervision nodes in the current time period.
In a possible implementation mode, selecting part of nodes from the system in a competition and election mode at intervals of a preset time period, and configuring the selected part of nodes as core nodes; selecting part of nodes from the nodes except the core nodes in a competition and election mode, and configuring the selected part of nodes as supervision nodes; and configuring nodes in the system except the core node and the supervision node as participating nodes.
In one possible embodiment, the supervisory node is further configured to: and checking the configuration of the core node, and if the core node with the wrong configuration exists, configuring the core node with the wrong configuration as a participating node.
In one possible embodiment, the core node is further configured to: and receiving a transaction request sent by a transaction initiating node or a neighboring node of the core node.
In this way, in the above block-based transaction system, when a transaction is sent, the core node may receive the transaction request, and after the transaction request is verified and the verification is passed, may generate the first blockchain data corresponding to the transaction request, and store the first blockchain data. The supervisory node may check the first blockchain data stored by the core node. By adopting the transaction system, the nodes in the block chain network can be changed from absolute decentralization to effective decentralization, so that the network operation efficiency is greatly improved, the resource utilization rate is prompted, and the decentralization can be completely maintained; furthermore, the core node and the supervision node can be reconfigured at every preset end, that is, the nodes in the transaction system can periodically switch their roles, so that the requirements of the safety and reliability of the block chain network can be met; further, the transaction system is generated based on the block chain, so that the expandability of the block chain network can be inherited.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
In the technical solution provided in the present application, the blockchain refers to accounting data generated by a transaction in a network system on one hand, and refers to a network running a blockchain technology, that is, a blockchain network on the other hand. The blockchain network refers to a point-to-point (P2P) network with decentralized application architecture, and the blockchain network can perform distributed storage, public consensus, digital encryption, transaction accounting and verification. I.e., a transaction platform that encompasses distributed technology, cryptography, P2P network architecture, and various consensus algorithms that may be applied.
The blockchain or blockchain information is accounting information generated according to transaction data when transactions occur in the blockchain network, namely a plurality of specific transactions form a blockchain, and the plurality of blocks form a blockchain. The block chain network comprises nodes which mutually establish point-to-point network connection, and each node is provided with a corresponding consensus mechanism, such as an intelligent contract, and has enough computing power to perform transaction verification and accounting procedures. The nodes also have interface specifications that conform to some uniform standard to enable access to more nodes or other types of blockchain networks through the interface specifications.
A possible system architecture to which the embodiments of the present application are applicable will be first described with reference to fig. 1.
Referring to fig. 1, a schematic structural diagram of a block chain-based transaction system provided in an embodiment of the present application is exemplarily shown. As can be seen from fig. 1, the nodes in the transaction system provided by the present application establish network connections with each other. And, every preset time period, a part of nodes may be selected from the trading system and configured as core nodes, and a part of nodes may be selected from nodes other than the core nodes and configured as supervision nodes, and nodes other than the core nodes and supervision nodes may be configured as participating nodes.
Taking the schematic shown in fig. 1 as an example, during the current time period, the node 1, the node 2, the node 3, and the node 4 may be configured as core nodes, the node 5, the node 6, and the node 7 may be configured as supervisory nodes, and the node 8 and the node 9 may be configured as participating nodes.
It should be noted that fig. 1 is only an exemplary illustration, and the number of the core node, the supervising node, and the participating node is not limited in this application. In addition, fig. 1 shows only the configuration of each node in the trading system in one time period, and in another time period, the configuration of each node in the trading system may be changed or not changed, which is not limited specifically.
In the embodiment of the present application, there are various ways to configure a node as a core node (or a supervisory node, or a participating node), and in one example, the node may be configured by randomly electing every preset time period. Through a random election mechanism, different nodes are guaranteed to share the same opportunity to be configured in the configuration process of the nodes, so that the enthusiasm and the activity of each node in the trading system can be guaranteed to the maximum extent, and the capacity of the trading system can be improved.
Specifically, every other preset time period, part of nodes can be selected from the system in a public link intelligent contract random election mode, and the selected part of nodes are configured as core nodes; selecting part of nodes from the nodes except the core nodes in a public link intelligent contract random election mode, and configuring the selected part of nodes as supervision nodes; and configuring nodes in the system except the core node and the supervision node as participating nodes.
In order to more clearly describe that the configuration of each node in the trading system can be changed periodically, assuming that fig. 1 shows the configuration of each node in the trading system in the current time period, the nodes are configured in a random election manner, and then in the next time period, the configuration of each node can be as shown in fig. 2.
As can be seen from fig. 2, during the next time period, the node 5, the node 7, and the node 9 may be configured as core nodes, the node 1, the node 2, and the node 8 may be configured as supervisory nodes, and the node 3, the node 4, and the node 6 may be configured as participating nodes. It can be seen that the number of core nodes, the number of supervision nodes and the number of participating nodes may change between different time periods; also, the core node itself, the supervising node itself and the participating nodes themselves may also change, i.e. the node 1 shown in fig. 1 is configured as a core node during the current time period and may be configured as a supervising node as shown in fig. 2 during the next time period.
In another example, the nodes may be configured according to their own resources and the distance between the nodes at intervals of a preset time period. By adopting the mode for configuration, the reasonability of node configuration can be improved, the difference between nodes configured to be in the same role is reduced, and the working efficiency of the trading system is improved.
Specifically, every preset time period, part of nodes may be selected from the system according to the distance between the node's own resources and the nodes, and the selected part of nodes is configured as core nodes, and part of nodes is selected from nodes other than the core nodes, and the selected part of nodes is configured as supervision nodes, and nodes other than the core nodes and supervision nodes in the system are configured as participating nodes.
For example, the nodes in the trading system may be divided into three groups according to the distance between the nodes, wherein one group corresponds to the core node, another group corresponds to the monitor node, and another group corresponds to the participating node. Then, the average value of the resources corresponding to each group of nodes can be determined according to the resources of the nodes. Finally, the configuration may be performed according to the resource average value corresponding to each group of nodes, for example, a core node may completely possess all functions of the network, and thus, a group of nodes with the highest resource average value may be configured as the core node; the supervision node needs to supervise and manage the result generated by the core node and also needs to provide corresponding network service, so a group of nodes with medium resource average values can be configured as the supervision node; the participating nodes do not participate in the maintenance and supervision of the network, and appear more as users of the network, so that a group of nodes with the lowest average resource value can be configured as the participating nodes.
Further, the configuration of the core node, the supervising node and the participating nodes may be periodically changed, that is, the configuration of the core node (or the supervising node or the participating nodes) in the current time period may be different from the configuration of the core node (or the supervising node or the participating nodes) in the previous time period.
Specifically, for the configuration situation of each node in the system in the current time period, a part of nodes can be selected from the core nodes in the previous time period according to the distance between the resource of the node in the current time period and the node, and the selected part of nodes are configured as supervision nodes or participating nodes in the current time period; according to the distance between the resources of the nodes in the current time period and the nodes, selecting part of nodes from the supervision nodes in the previous time period, and configuring the selected part of nodes as core nodes or participating nodes in the current time period; and selecting part of nodes from the participating nodes in the previous time period according to the self resources of the nodes in the current time period and the distance between the nodes, and configuring the selected part of nodes as core nodes or supervision nodes in the current time period.
In yet another example, nodes may be configured by way of contention and election every preset period of time.
Specifically, every other preset time period, part of nodes can be selected from the system in a competition and election mode, and the selected part of nodes are configured as core nodes; selecting part of nodes from the nodes except the core nodes in a competition and election mode, and configuring the selected part of nodes as supervision nodes; and configuring nodes in the system except the core node and the supervision node as participating nodes.
It should be noted that the above three examples are merely exemplary illustrations of node configurations, and those skilled in the art may adjust the configuration of the nodes according to experience and actual conditions, and are not limited in particular.
Based on the system architecture shown in fig. 1, fig. 3 is a schematic diagram illustrating a flow of a transaction performed by a blockchain-based transaction system according to an embodiment of the present application.
As shown in fig. 3, the core node (e.g., node 1 shown in fig. 3) may be further configured to: when a transaction occurs, a transaction request is received, the transaction request is verified, first block chain data corresponding to the transaction request is generated after the verification is passed, and the first block chain data is stored and broadcasted.
The core node may be further configured to: if the core node verifies the transaction request and determines that the verification is not successful, the transaction request may be ignored (not shown in fig. 3).
The supervising node (e.g., node 5 shown in fig. 3) may be further configured to: the first blockchain data is checked.
In this way, in the above block-based transaction system, when a transaction is sent, the core node may receive the transaction request, and after the transaction request is verified and the verification is passed, may generate the first blockchain data corresponding to the transaction request, and store the first blockchain data. The supervisory node may check the first blockchain data stored by the core node. By adopting the transaction system, the nodes in the block chain network can be changed from absolute decentralization to effective decentralization, so that the network operation efficiency is greatly improved, the resource utilization rate is prompted, and the decentralization can be completely maintained; furthermore, the core node and the supervision node can be reconfigured at every preset end, that is, the nodes in the transaction system can periodically switch their roles, so that the requirements of the safety and reliability of the block chain network can be met; further, the transaction system is generated based on the block chain, so that the expandability of the block chain network can be inherited.
As can be seen from the illustration of fig. 3, the transaction request received by the core node (i.e., node 1) originates from node 0. Node 0 may be a transaction initiating node or a neighboring node to the core node (i.e., node 1). That is, the core node (e.g., node 1 shown in fig. 3) may be further configured to: and receiving a transaction request sent by a transaction initiating node or a neighboring node of the core node.
According to different practical application environments, the transaction form between the transaction initiation point and the core node is different. The following two scenarios are possible in which the core node receives the transaction request sent by the transaction initiating node.
One scenario is that if the transaction initiating node can transact or interact with the direct core node, a transaction request can be sent directly through the transaction initiating node to the core node. This approach is best suited for transactions where the transaction initiating node and the core node are in the same blockchain network, i.e., the transaction initiating node is also a node in the transaction system.
Alternatively, if the transaction initiating node is unable to directly transact or interact with the core node, the transaction request may be broadcast by the transaction initiating node. Specifically, the transaction request may be broadcast to the neighboring node, and the neighboring node determines whether to complete the transaction or continue the broadcast in combination with its own role until the core node receives the transaction request.
The core node receives the transaction data sent by the neighboring node of the core node, and the corresponding situation may be that the transaction initiating node does not know the location information of the core node, and sends the transaction request in the block chain in a broadcast form, so that along with the diffusion of the information, the core node may receive the transaction request through the neighboring node.
It should be noted that the above two cases are only exemplary, and in other possible examples, if the transaction initiation node is a neighboring node of the core node, the core node may also be regarded as directly receiving the transaction request sent by the transaction initiation node.
In the embodiment of the application, when the monitoring node verifies the first blockchain data stored in the core node, two situations that the first blockchain data stored in the core node is verified to be incorrect or the first blockchain data stored in the core node is verified to be incorrect may occur, and the subsequent execution flows corresponding to the two situations are different respectively.
Fig. 4 is a schematic flow chart of a transaction performed by another transaction system based on a blockchain according to an embodiment of the present disclosure.
Wherein the core node (e.g., node 1 shown in fig. 4) may be further configured to: when a transaction occurs, a transaction request initiated by the node 0 is received, the transaction request is verified, and after the verification is passed, first blockchain data corresponding to the transaction request is generated and stored.
The supervising node (e.g., node 5 shown in fig. 4) may be further configured to: the first blockchain data stored by the core node (i.e., node 1) is checked.
Further, according to the difference of the verification results, the corresponding execution flows are also different.
One possible implementation is that the first supervising node (e.g. node 5 shown in fig. 4) may be further configured to: checking first block chain data, if the checking result of the first block chain data is wrong, marking the first block chain data as illegal data, and broadcasting a message that the first block chain data is illegal data in the system; the first supervision node is any one of the supervision nodes.
As such, the second supervising node (e.g., node 6 shown in fig. 4) may be further configured to: after receiving a message that the first blockchain data is illegal data, checking the first blockchain data, and if the checking result of the first blockchain data is wrong, configuring a core node storing the first blockchain data as a participating node; the second supervision node is any one of the supervision nodes except the first supervision node.
Further, if the second supervising node checks the first blockchain data, and it is determined that the check result of the first blockchain data is incorrect, the core node storing the first blockchain data may be removed from the core node group, and a corresponding penalty and reward mechanism is triggered: that is, the deposit of the core node storing the first blockchain data will be penalized and a reward will be issued to the first supervisory node.
Another possible implementation is that the supervising node (e.g. node 5 shown in fig. 4) may be further configured to: and checking the first block chain data stored in the core node, and broadcasting a message that the checking result of the first block chain data is error-free to the system if the checking result of the first block chain data stored in the core node is error-free.
As such, the participating node (e.g., node 8 shown in fig. 4) may be further configured to: after receiving the message that the check result of the first blockchain data is correct, whether to store the summary information corresponding to the first blockchain data can be determined autonomously, if so, the summary information corresponding to the first blockchain data is generated, and the second blockchain data is generated according to the summary information and stored.
Further, as shown in fig. 5, a schematic workflow diagram of a supervisory node according to an embodiment of the present application is provided. The supervising node (e.g., node 5 shown in fig. 5) may be further configured to: and if the check result of the first block chain data stored in the core node is correct, generating abstract information corresponding to the first block chain data, generating third block chain data according to the abstract information, and storing the third block chain data.
In the embodiment of the present application, the supervising node may supervise configuration of the core node in addition to checking the first blockchain data generated by the core node as described above.
In particular, the supervising node may be further configured to: and checking the configuration of the core nodes, and if the core nodes with wrong configuration exist, configuring the core nodes with wrong configuration as participating nodes.
As can be seen from the above description, in the embodiment of the present application, the core node may completely possess all functions of the network, that is, may receive the transaction request, and may generate corresponding blockchain data after the transaction request is verified and passed; the supervision node can supervise and manage the result generated by the core role and provide corresponding network service at the same time; the participating nodes do not participate in the maintenance and supervision of the network and appear more as users of the network.
It should be noted that the core node, the monitoring node, and the participating node respectively assume different roles and have different functions. The core node, the supervision node and the participating nodes respectively complete corresponding work and jointly maintain the operation and stability of the transaction system. However, the nodes included in the core node do not all have the same function at the same time point, and have the same competition and supervision relationship with each other.
For example, taking the core node shown in fig. 1 including four nodes, node 1, node 2, node 3 and node 4 as an example, when a transaction occurs, each node may receive a transaction request, but not every node has the accounting right. If node 1 obtains the accounting right, the blockchain data corresponding to the transaction request is generated and stored by node 1, and node 1 can obtain the corresponding benefit. That is, node 1 competes for a win in the transaction, while node 2, node 3, and node 4 fail to compete.
Similarly, there may be a contention relationship among the supervisory nodes, which is not described herein.
In an exemplary embodiment, a computer readable storage medium is further provided, in which a computer program or an intelligent contract is stored, and the computer program or the intelligent contract is loaded and executed by a node to implement the transaction processing method provided by the above-mentioned embodiment. Alternatively, the computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
Those skilled in the art will clearly understand that the techniques of the embodiments of the present application may be implemented in software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present application may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method described in the embodiments or some parts of the embodiments of the present application.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.