Specific implementation mode
It should be appreciated that described herein, specific examples are only used to explain the present invention, is not intended to limit the present invention.
As shown in Figure 1, being 1 preferred embodiment of electronic device that the present invention realizes high performance block chain transaction processing method
Schematic diagram.
In the present embodiment, electronic device 1 can be server, smart mobile phone, tablet computer, PC, portable meter
Calculation machine and other electronic equipments with calculation function.
The electronic device 1 includes:Memory 11, processor 13, network interface 15 and communication bus 17.Wherein, network connects
Mouth 15 may include optionally standard wireline interface and wireless interface (such as WI-FI interface).Communication bus 17 is for realizing these
Connection communication between component.
Memory 11 includes at least a type of readable storage medium storing program for executing.The readable storage medium storing program for executing of at least one type
It can be the non-volatile memory medium of such as flash memory, hard disk, multimedia card, card-type memory.In some embodiments, described to deposit
Reservoir 11 can be the internal storage unit of the electronic device 1, such as the hard disk of the electronic device 1.In other embodiments
In, the memory 11 can also be to be equipped on the external memory unit of the electronic device 1, such as the electronic device 1
Plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card dodge
Deposit card (Flash Card) etc..
In the present embodiment, the memory 11 can be used for store be installed on the electronic device 1 application software and
The related data generated in Various types of data, such as the program code and its operational process of block chain transaction processing program 10.
Processor 13 can be in some embodiments a central processing unit (Central Processing Unit,
CPU), microprocessor or other data processing chips, the program code for being stored in run memory 11 or processing data.
Fig. 1 illustrates only the electronic device 1 with component 11-17 and block chain transaction processing program 10, but should manage
Solution, Fig. 1 do not show that all components of electronic device 1, can substitute and implement more or less component.The electronics fills
It can also includes radio frequency (Radio Frequency, RF) circuit, sensor and voicefrequency circuit etc. to set 1, and details are not described herein.
In 1 embodiment of electronic device shown in Fig. 1, as memory block in a kind of memory 11 of computer storage media
The program code of block chain transaction processing program 10, processor 13 execute the program code of the block chain transaction processing program 10
When, Client-initiated transaction request is routed in the identical block chain subregion of several frameworks parallel processing (such as Fig. 2, Fig. 3 institute
Show).The block chain transaction processing method realized when illustrating that block chain transaction processing program 10 is run below in conjunction with Fig. 3~Fig. 6.
As shown in figure 4, being the flow chart of first preferred embodiment of block chain transaction processing method of the present invention.In the present embodiment
In, in the present embodiment, when processor 13 executes the program code of the block chain transaction processing program 10 stored in memory 11
The block chain transaction processing method of realization includes:
Step S10 receives the transaction request that client user initiates.
Transaction request is distributed to parallel processing in the identical subregion chain of several structures by step S20.
As shown in Fig. 2, being N (N is the positive integer more than 1) with mutually isostructural subregion chain sum, when access layer receives
When the transaction request sent to user, according to the address of each transaction requestor (string number for being similar to Bank Account Number) to point
Transaction request is distributed to corresponding subregion chain by the value of area's number N modulus.For example, when the address of some transaction requestor is to subregion
The value of number N modulus is 1, and the transaction request of the transaction requestor is distributed to the processing of subregion chain 1;When the ground of another transaction requestor
Location is 3 to the value of number of partitions N modulus, then the transaction request of the transaction requestor is distributed to subregion chain 3 and handled.In the present embodiment
In, it is to be distributed to transaction with address and the Modulus of access of subregion chain sum N.In other embodiments, can also be according to it
He is distributed transaction mapping relations.
About the specific introduction of step S20, correlation step in Fig. 5 and Fig. 6 please be join.For example, step S20 is referred to Fig. 5
Step S303 is realized in middle step S103, Fig. 6, relate in Fig. 5, Fig. 6 it is more other the step of.
As shown in figure 5, being the flow chart of second preferred embodiment of block chain transaction processing method of the present invention.
Step S101 receives the transaction request that user sends.
Step S103 asks the transaction according to the address of transaction requestor and the Modulus of access M1 of total number of partitions N of subregion chain
It asks and is sent to the first subregion chain.For example, as M1=1, which is sent to the first subregion chain 1 as shown in Figure 2.
The node of step S105, the first subregion chain parse the transaction request and the relevant information of the transaction, to verify the friendship
The validity of the legitimacy and transaction easily asked.As shown in figure 3, each subregion chain includes multiple nodes, it is including but not limited to, non-
Accounting nodes (peer nodes), accounting nodes (validator nodes) and monitoring node (listener nodes).Receive transaction
After request, the legitimacy of non-accounting nodes verification transaction request judges whether the transaction request belongs to the processing of this subregion chain
Task, verification mode are to calculate the address of transaction requestor to be somebody's turn to do with whether the Modulus of access M1 of total number of partitions N of subregion chain corresponds to
Whether subregion chain, such as value M1 are equal to the identification code of the subregion chain.The validity of accounting nodes verification transaction, such as the transaction are asked
Ask the amount of money being related to whether within allowable range.
The node of step S107, the first subregion chain judge whether the transaction request is legal, the transaction is according to analysis result
It is no effective.When judging the illegal transaction request or the transaction invalid, step S109, refusal transaction are executed, flow can be tied
Beam can also feed back the transaction related information being rejected to the user and associated mechanisms for initiating transaction request.When judging the transaction
When asking the legal and transaction effective, step S111 is executed.
Transaction is packaged into block, reached common understanding between accounting nodes by step S111, the accounting nodes of the first block chain.Note
It can, when reaching the preset time cycle, be incited somebody to action according to the time cycle that account node, which will merchandise and be packaged into the principle that block follows,
The transaction that cut-off current time receives is packaged into block, can also be according to number of transaction, when the number of transaction received reaches pre-
If when threshold value, transaction is packaged into block.
The monitoring node of step S113, the first block chain parse area's Transaction Information in the block.
Whether the monitoring node of step S115, the first block chain are related to across chain friendship according to the transaction in the block of analysis judgment area
Easily.In the present embodiment, judge whether a transaction is related to being across the mode that chain is merchandised:The recipient's that the transaction is related to
Address obtains value M2 with number of partitions N modulus, and whether judgment value M2 corresponds to this subregion chain, if corresponding is other subregion chains,
Then it is related to across chain transaction.When judgment value M2 corresponds to this subregion chain, which is transaction in local area, executes step S117,
Transaction is completed in the first block chain, flow terminates.When judgment value M2 corresponds to other subregion chains, step S119 is executed.
Step S119, the first block chain monitor Modulus of access of the node according to the address and total number of partitions N of transaction acceptance side
Across chain transaction request is sent to the second subregion chain by M2.For example, as value M2=2, by across the chain transaction request be sent to Fig. 2,
Subregion chain 2 in Fig. 3.
Step S121, the node verification of the second subregion chain is across the legitimacy of chain transaction request and the validity of transaction.Step
The principle of S121,123,125 is similar to above-mentioned steps S105, S107, S109, and details are not described herein again.When the section of the second subregion chain
Point judge should across chain transaction request it is legal and should across chain transaction it is effective when, execution step S127, the accounting nodes of the second block chain
Transaction is packaged into block, is reached common understanding between accounting nodes, is believed by the monitoring node feeding back of the second subregion chain after completing transaction
It ceases to the monitoring node of the first subregion chain.
As shown in fig. 6, being the flow chart of block chain transaction processing method third preferred embodiment of the present invention.
Step S301 receives the transaction request that user sends.
Step S303 asks the transaction according to the address of transaction requestor and the Modulus of access M1 of total number of partitions N of subregion chain
It asks and is sent to the first subregion chain.Such as M1=1, the transaction request are sent to subregion chain 1 as shown in Figure 3.
Step S305, the first node computation requests side address of the first subregion chain and the Modulus of access M1 ' of number of partitions N.At this
In embodiment, first node is non-accounting nodes.It is asked as shown in figure 3, the non-accounting nodes 1 of subregion chain 1 receive a transaction
After asking, the Modulus of access M1 ' of the Supplicant Address and number of partitions N is calculated.
The first node of step S307, the first subregion chain verify whether the transaction request belongs to this according to Modulus of access M1 '
The transaction of first subregion chain.If verification is not belonging to the transaction of the first subregion chain, judges that the transaction request is illegal, execute step
Rapid S309, refusal transaction.Flow can terminate, and can also feed back the transaction related information being rejected to the use for initiating transaction request
Family and associated mechanisms.
If step S307 judges that transaction request is legal, S311 is thened follow the steps.For example, the non-accounting nodes 1 as Fig. 3 judge
Modulus of access M1 ' is corresponding when not being subregion chain 1, and refusal transaction if Modulus of access M1 '=1, judges that the transaction request is legal.
The first node of step S311, the first subregion chain broadcast the transaction request to all second sections of the first subregion chain
Point.In the present embodiment, second node is accounting nodes.As shown in figure 3, the transaction request is broadcast to note by non-accounting nodes 1
Account node 1~4.
The second node of step S313, the first subregion chain parse Transaction Information to verify the validity of transaction, such as the friendship
Easily ask the amount of money being related to whether within allowable range.
The second node of step S315, the first subregion chain judge whether transaction is effective.If transaction invalid thens follow the steps
S317, refusal transaction.Flow can terminate, and can also feed back the transaction related information being rejected to the user for initiating transaction request
And associated mechanisms.
If step S315 judges that transaction is effective, S319 is thened follow the steps, transaction will be packaged into block by second node, the
Reach common understanding between two nodes.As shown in figure 3, transaction block is reached common understanding between accounting nodes 1~4.Accounting nodes will merchandise
It can, when reaching the preset time cycle, will end current time according to the time cycle to be packaged into the principle that block follows
The transaction received is packaged into block, can also be that will be handed over according to number of transaction when the number of transaction received reaches predetermined threshold value
Easily it is packaged into block.
The third node of step S321, the first subregion chain monitor transaction block, area's transaction in the block are parsed, by transaction acceptance
The address of side obtains the second Modulus of access M2 with total number of partitions N modulus.In the present embodiment, third node is monitoring node, such as
Monitoring node 1,2 in Fig. 3.
The third node of step S323, the first subregion chain judge whether the transaction is related to across chain friendship according to the second Modulus of access M2
Easily.When the second Modulus of access M2 correspond to the first subregion chain when, such as M2=1, correspond to subregion chain 1, judge the transaction be
Subregion chain insider transaction executes step S325, and transaction is completed in the first subregion chain.Flow can terminate, and can also feed back
The relevant information that transaction is completed is to the user and associated mechanisms for initiating transaction request.
When step S323 judges that the transaction is related to across chain transaction, execution step S327, third node is signed after across chain transaction,
It is sent to the second node of the second subregion chain according to value M2, and caches across chain transaction to local memory.For example, M2=2, corresponding to
The monitoring node 2 of subregion chain 2 in Fig. 3, subregion chain 1 reads digital signature to this across chain from local memory (not shown)
After transaction is signed, which is sent to the accounting nodes 4 of subregion chain 2, and by the relevant information merchandised across chain
It caches to local memory.
Step S329, after the second node of the second subregion chain receives across chain transaction, with calculating the recipient to merchandise across chain
The Modulus of access M2 of location and number of partitions N.
The second node of step S331, the second subregion chain judge whether be somebody's turn to do across chain transaction according to the Modulus of access M2 being calculated
It is legal, i.e., whether the transaction in relation to the second subregion chain.If judgement is illegal, S333, refusal request are thened follow the steps.Flow can
To terminate, the transaction related information being rejected can also be fed back to the user and associated mechanisms for initiating transaction request.
Step S335, after the second node of the second subregion chain verifies the signature validity of the third node of the first block chain,
Other second nodes that across the chain transaction is sent in the second subregion chain are reached common understanding, transaction is completed.For example, dividing in Fig. 3
The accounting nodes 4 of area's chain 2 verify the monitoring node 2 of subregion chain 1 signature it is effective after, by across chain transaction generation to subregion chain 2
Accounting nodes 1,2,3 reach common understanding after, complete transaction.
The third node of step S337, the second block chain listen to after the completion of across the chain transaction, notify in the first block chain
The transaction of third node complete, across the chain transaction cached in the third knot removal memory of the first block chain.For example, dividing in Fig. 3
The monitoring node 1 of area's chain 2 listens to after the completion of across the chain transaction, and the transaction of monitoring node 2 of notice subregion chain 1 is completed.Subregion chain 1
Monitoring node 2 receive transaction completion notice after, delete cached in memory should the related data that merchandise across chain.
In other embodiments, after executing step S327, the third node in the first block chain waits for across chain transaction to relate to
And the second block chain feedback trading complete information, if time-out do not receive feedback information, the third node in the first block chain
The data that should be merchandised across chain that caching is read from memory, are sent to corresponding second block chain again.
Include not necessarily all steps shown in figure it should be pointed out that in Fig. 5, flow chart shown in fig. 6,
It is not limited to step as shown in the figure.In addition, the Conventional processing steps in relation to block catenary system, can receive according to practical application scene
Enter the present invention.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical scheme of the present invention substantially in other words does the prior art
Going out the part of contribution can be expressed in the form of software products, which is stored in one as described above
In storage medium (such as ROM/RAM, magnetic disc, CD), including some instructions use so that a station terminal equipment (can be mobile phone,
Computer, server or network equipment etc.) execute method described in each embodiment of the present invention.
It these are only the preferred embodiment of the present invention, be not intended to limit the scope of the invention, it is every to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.