Specific embodiment
First business scenario applied by the present invention (i.e. programming levels test) is described in more detail herein.With letter
For ceasing technology company A, if company A wants to know about the programming levels of some user (such as employee, interviewee), then, company A
Any programming topic can be extracted from the programming exam pool of oneself is supplied to the user.The user makees according to the programming topic
It answers, provides the answer code for answering the programming topic, and answer code is uploaded to the online of company A and sentences topic system.Company A's
Topic system is sentenced online is stored with (the specifically standard input of the corresponding answer inspection data of each programming topic in above-mentioned programming exam pool
Data and standard output data), for verifying the correctness of answer code.Specifically, company A sentence topic system online can should
The corresponding standard input data of programming topic is input to answer code and runs answer code, then, judges whether answer code
The corresponding standard output data of the programming topic can be exported, if so, assert that the user by test, otherwise, assert the use
Family does not pass through test.
In practice, there are the demand for sharing mutual programming exam pool in many IT mechanisms.For this purpose, in the prior art, for any
IT mechanism, which generally can crawl programming topic from the programming exam pool of other IT mechanisms using crawlers, by what is crawled
Programming topic is supplied to tested user and answers.Then, which also needs the answer generation for providing tested user
Code is sent to the sentencing topic system online and test of the IT mechanism for founding the programming topic.
However, this mode exists as following drawbacks:
1, after IT mechanism crawls the programming topics of other IT mechanisms by crawlers, sometimes without authorization to programming topic into
The some inappropriate modifications of row, this aspect not can be well protected the equity for founding the IT mechanism of programming topic, on the other hand,
The answer code that tested user provides for modified programming topic often with the programming topic before modification and mismatch, and
Online sentence topic system be using adapt to modification before programming topic answer inspection data it is whether correct to test code, such as
This, leads to test result not and can accurately reflect the programming levels of tested user.
Once 2, the database of other IT mechanisms is inaccessible, which can not just crawl other knots by crawlers
The programming topic of structure.That is, the mode of this shared programming topic is not always effective.
For this purpose, any IT mechanism can be by means of block chain agreement, the volume that oneself is founded in this specification embodiment
Journey topic is published in block chain, is equivalent to the programming topic for not only founding oneself and is shared to other IT mechanisms, but also without having to worry about
Other IT mechanisms can modify to the programming topic.
In order to make those skilled in the art more fully understand the technical solution in this specification embodiment, below in conjunction with this
Attached drawing in specification embodiment is described in detail the technical solution in this specification embodiment, it is clear that described
Embodiment is only a part of the embodiment of this specification, instead of all the embodiments.The embodiment of base in this manual,
Those of ordinary skill in the art's every other embodiment obtained, all should belong to the range of protection.
Below in conjunction with attached drawing, the technical solution that each embodiment of this specification provides is described in detail.
Fig. 1 is a kind of process signal for programming topic dissemination method based on block chain that this specification embodiment provides
Figure, comprising the following steps:
S100: destination node founds programming topic to be released.
In this specification embodiment, the equipment of each IT mechanism can access block chain network, become in block chain network
Node.That is, each node and the desired each IT mechanism for sharing programming topic each other in block chain network correspond.
In the step s 100, the destination node can be any node in block chain network.That is, any IT
The equipment of mechanism can be founded programming topic and be issued by method shown in FIG. 1.
It should be noted that destination node founds programming topic, it specifically can be destination node and receive the control target
The programming topic that the IT mechanism of node uploads, is also possible to destination node according to preset programming topic and founds model, automatic to create
If programming topic.
S102: the destination node is based on topic related data, building topic publication transaction.
It should be noted that transaction (transaction) described herein, refers to specified data in block chain agreement
Structure.In block chain agreement, transaction refers to block chain client creation of the node by installation, and needs final write-in block
One data of chain.That is, according to block chain agreement, all data for needing to be written block chain and carrying out publicity are required
It is packaged into this data structure of transaction.
In step s 102, the topic related data includes at least the programming topic that destination node is founded in the step s 100
Mesh.The destination node is based on topic related data building topic publication transaction, actually by the topic dependency number
According to be encapsulated into trade this block chain agreement specified data structure.
S104: the destination node broadcasts the topic publication transaction to the block chain network.
In step S104, destination node broadcasts the topic publication transaction to block chain network, actually will be described
Topic publication transaction is broadcast to other nodes, is equivalent to the programming topic, is shared with other nodes.
S106: for each node for obtaining the topic publication transaction, the node is based on the common recognition machine between each node
The topic is issued transaction write-in block chain by system.
For each node for obtaining the topic publication transaction, which is issuing transaction write-in block for the topic
Before chain, legitimate verification can be carried out for topic publication transaction.
It can be needed according to business for the item that the topic issues transaction progress legitimate verification specified.For example, false
If being not the permission that each node has publication programming topic, it is possible to the node identification in topic publication transaction,
Judge whether the corresponding node of the node identification (i.e. destination node) has the permission of publication programming topic, if do not weighed
Limit, just the topic is issued transaction write-in block chain by refusal.
In step s 106, the common recognition mechanism between each node ensures the data that each node is written to block chain every time
Consistency.Therefore, even some node without authorization modifies to the programming topic encapsulated in topic publication transaction, to change institute
The content of topic publication transaction is stated, block chain will not be written by most of nodes in modified topic publication transaction.
In this way, the programming topic that destination node is founded always can unmodifiedly be written into block chain, to complete to compile
Journey is inscribed purpose and is shared.Also, the distributed storage characteristic of block chain, be written block chain after topic publication transaction be also be difficult to
It is tampered.
It should be noted that for answer publication transaction, the result publication transaction that will hereinafter occur, based on same
The content of reason, these transaction is also difficult to be tampered.
By method shown in FIG. 1, the equipment of any IT mechanism can access block chain network and be known as node.In block chain
In network, any node can be based on block chain agreement, issue the programming topic itself founded, that is to say, that any node can
With the programming topic building topic publication transaction founded based on itself, topic publication transaction is then broadcast to other nodes.It obtains
Transaction can be issued for topic and block chain is written based on the common recognition mechanism between each node by obtaining each node of topic publication transaction.In this way,
On the one hand, the programming topic that itself is founded can be shared to other IT mechanisms by any IT mechanism;On the other hand, any node
Restriction of the process of publication programming topic by block chain agreement, programs topic from being founded to the entire mistake for being written into block chain
Cheng Zhong, it is difficult to it is tampered, programming topic is written into after block chain, and be difficult to be tampered.
In addition, the topic related data can also include the node identification of destination node in this specification embodiment.
It means that the node identification of itself can be also encapsulated into topic publication transaction by destination node, and then is written in block chain and carries out
Publicity.In this way, the person of founding of each programming topic of each IT mechanism can clearly be shared to, the IT machine of programming topic is founded in protection
The equity of structure.
In addition, in practical applications, since this data storage method of block chain is complex, node is when desired from write-in
When transferring some programming topic in the programming topic of block chain, complicated operation.
For this purpose, in this specification embodiment, for each node for obtaining the topic publication transaction, which can be with
The topic storage address is stored in creation topic storage address, and by the topic related data.This is equivalent to will also programming
Topic is stored with simple storage mode.It should be noted that for the publication transaction of any topic, it can be according to write area
The topic of block chain issues transaction, and whether the programming topic of verifying deposit topic storage address is tampered.By the above-mentioned means, section
Point, can be more convenient when wanting to transfer some programming topic.
Further, the topic intelligence contract for being packaged with the topic related data specifically can be stored in the topic by node
Mesh storage address.In this case, the topic storage address is actually the Contract ID of the topic intelligence contract.
Intelligent contract is the data structure that many block chain agreements (such as ether mill) are naturally supported, also, many block chains
Agreement also naturally supports the quick calling of intelligent contract.Therefore, can with this data structure of intelligent contract, to programming topic into
Row storage, it is convenient subsequently through the form for calling intelligent contract, it quickly transfers programming topic and is programmed horizontal checkout.
Programming topic dissemination method according to figure 1, this specification embodiment further provide a kind of based on block
The answer code dissemination method of chain, as shown in Figure 2, comprising the following steps:
S200: destination node obtains programming topic.
The destination node is any node in block chain network.In practical applications, any IT mechanism wants to quilt
When the programming levels of test user are tested, the destination node that can trigger itself control obtains programming topic.Destination node
The programming topic of acquisition is issued based on programming topic dissemination method shown in FIG. 1.
Specifically, destination node can be issued in transaction from any topic in block chain and read programming topic.
Alternatively, if topic related data packaged by topic publication transaction has also been stored into some topic storage ground
Location, then, destination node can also obtain the programming topic from the topic storage address.It is programmed when obtaining in this way
When topic, more fast.
Further, if the topic related data is that (i.e. topic intelligence contract) deposit should in the form of intelligent contract
Topic storage address, the destination node can call the topic intelligence contract, to get the programming topic.
S202: the programming topic is supplied to tested user and answered by the destination node, and receives the quilt
Test the answer code that user uploads.
S204: the destination node is based on answer related data, building answer publication transaction.
In this specification embodiment, the answer related data includes at least the topic mark of the programming topic, institute
State the user identifier of answer code and the tested user.
Wherein, described if the destination node reads programming topic from any topic publication transaction in block chain
The topic of programming topic is identified as the transaction Hash of the topic publication transaction;If the destination node stores ground from any topic
Location obtains programming topic, then the topic of the programming topic is identified as the storage address.
Further, the destination node can examine the answer code with the presence or absence of compiling or operation problem
It looks into, passes through if checked, can just construct answer publication transaction, If the check does not pass, then refusing building answer publication transaction.
S206: the destination node broadcasts the answer publication transaction to the block chain network.
S208: for each node for obtaining the answer publication transaction, the node is based on the common recognition machine between each node
The answer is issued transaction write-in block chain by system.
For each node for obtaining the answer publication transaction, which is issuing transaction write-in block for the answer
Before chain, legitimate verification can be carried out for answer publication transaction.
It can be needed according to business for the item that the answer publication transaction carries out legitimate verification specified.For example, false
If being pre-provisioned with the format of answer code, it is possible to be carried out to the format of the answer code in the answer publication transaction
Verifying, if format is undesirable, just the answer is issued transaction write-in block chain by refusal.
In step S208, it is equivalent to the programming topic for being answered the identity information of tested user, tested user
Identification information, the answer code publicity that provides of tested user is to each node.
In addition, testing in order to facilitate the answer code that node can quickly transfer tested user, in this specification
In embodiment, each node can also create answer storage address, and the answer related data is stored in the answer and is stored
Address.
Further, the answer intelligence contract for being packaged with the answer related data can be stored in the solution by each node
Answer storage address.
Programming topic dissemination method according to figure 1 and answer code dissemination method shown in Fig. 2, this specification are implemented
Example further provides a kind of answer code check method based on block chain, as shown in Figure 3, comprising the following steps:
S300: it examines node to obtain the corresponding answer code of programming topic and uploads the tested user of the answer code
User identifier.
It is described that node is examined to be stored with the corresponding answer inspection data of the programming topic in this specification embodiment
Node.The answer inspection data is for testing to the correctness for answering answer code given by the programming topic
Data.As it was noted above, the answer inspection data generally comprises standard input data and standard output data.
The inspection node is usually to found the programming topic destination node.Certainly, the programming topic destination node is founded
The corresponding answer inspection data of the programming topic can also be distributed at least one other node.In this way, the inspection section
Point is also possible to be stored with other nodes of the answer inspection data in addition to founding the programming topic destination node.
In this specification embodiment, examine node that can determine the answer according to any answer inspection data of storage
The corresponding topic mark of inspection data.Then, the answer publication transaction identified comprising the topic is inquired from block chain,
And answer code and user identifier are read from answer publication transaction.
Further, the answer storage address for being stored with topic mark can also be inquired by examining node, and from described
It answers storage address and obtains answer code and user identifier.
Further, it examines node that can inquire the topic intelligence contract for being packaged with the topic mark, and calls institute
Topic intelligence contract is stated, to get corresponding answer code and user identifier.
S302: the answer inspection data for corresponding to the programming topic for examining node using storage, described in inspection
Answer code.
S304: if upchecking, the inspection node is based on result related data, building result publication transaction.
In this specification embodiment, if node is examined to pass through the answer code check, it can will examine logical
The message publicity crossed is in block chain.In this case, the result related data actually includes the topic of the programming topic
Mark and the user identifier, the meaning that the result publication is traded are, for example, " user Zhang San has answered questions topic 1 ".
It further, can also be by the test fails if node is examined not pass through the answer code check
Message publicity is in block chain.In this case, the result issues the meaning of transaction either upchecking, and is also possible to examine
It tests and does not pass through.In order to distinguish, the result related data also needs to include upcheck result or the test fails result.
S306: the result publication transaction is broadcasted to the block chain network.
S308: for each node for obtaining the result publication transaction, the node is based on the common recognition machine between each node
The result is issued transaction write-in block chain by system.
For each node for obtaining the result publication transaction, which is issuing transaction write-in block for the topic
Before chain, legitimate verification can be carried out for result publication transaction.
It can be needed according to business for the item that the result issues transaction progress legitimate verification specified.For example, false
The corresponding answer code of the programming topic is examined if only founding the programming topic destination node and just having permission, it is possible to
Judge whether the inspection node for broadcasting the result publication transaction has checking authority, if just refused without permission by the knot
Fruit publication transaction write-in block chain.
In step S308, it is equivalent to the programming topic for being answered the identity information of tested user, tested user
Identification information, tested user whether pass through the result publicity of test to each node.
In addition, being consulted in order to facilitate the test result that node can quickly transfer tested user, in this specification
In embodiment, each node can also create result storage address, and the result related data is stored in the result and is stored
Address.
Further, the result intelligent contract for being packaged with the result related data can be stored in the knot by each node
Fruit storage address.
In addition, in practice, the tested user may answer more than one programming topic, more than one solution is uploaded
Answer code.In this case, for each node, which can answer the tested user knot of multiple programming topics
Fruit is all stored in the same result storage address, facilitates statistics and consults.
Specifically, in this specification embodiment, for each node for obtaining the result publication transaction, if the node
Other results publication associated with result publication transaction is obtained to trade, then it, will based on the common recognition mechanism between each node
Described other results publication transaction write-in block chain, wherein other results publication transaction be based on the user identifier with
The mark building of other topics.Then, which, will other topics mark deposit according to other results publication transaction
The result storage address.
That is, the result publication transaction can be considered as first programming topic institute of tested user's answer
It generates, and the publication transaction of other results can be considered as produced by other programming topics of the subsequent answer of tested user
's.For the tested subsequent answer of user other programming topics as a result, without re-create result storage address into
Row storage, but the result storage address created before being directly deposited into.
In this way, each tested user has the result storage address for being uniquely corresponding to oneself, for recording answering for oneself
Inscribe situation.
It is further to note that in method shown in Fig. 1, it is understood that there may be more than one examines node to examine the solution
The case where inscribing code.In this case, for each inspection node, which obtains the corresponding answer code of programming topic
With the user identifier for the tested user for uploading the answer code;Then using the solution for corresponding to the programming topic of storage
Inspection data is answered, the answer code is examined;If passing through to the answer code check, it is based on result related data, building
As a result publication transaction, and the result publication transaction is broadcasted to the block chain network.
Based on this, for each node, which can be specified number when the quantity for determining the result publication transaction obtained
It, just can be based on the common recognition mechanism between each node, by any result publication transaction write-in block chain of acquisition when amount.Wherein, institute
Specified quantity is stated no more than the quantity for examining node.
In addition, there are the transaction of three types, i.e. topic publication transaction, answer publication is handed in this specification embodiment
Easily and result publication is traded.Wherein, it for any transaction, creates storage address and is stored in the packaged correlation of this kind transaction
Data can be considered as and execute operation to this kind transaction.
Obviously, whether for which kind of above-mentioned transaction, the implementing result that this kind transaction generates is executed, one can only be stored
Address has an impact.Therefore, the transaction of the three types in this specification embodiment is suitable for using parallelization described below
Transaction executive mode executed.To hereafter explanation be introduced to the transaction executive mode of this parallelization.
For common block chain application scenarios, when needing to carry out the common recognition between each node, each node can be based on
Common recognition algorithm elects the node for having permission and several pending transaction being packaged into block, i.e. accounting nodes.After common recognition,
Accounting nodes fish for several pending transaction from caching and are packaged into block, and the block is broadcast to other nodes.With
Afterwards, for each node, the node on the one hand can according to the sequencing being initiated of respectively trading in the block, by after arriving first according to
It is secondary to execute each transaction, on the other hand block chain can be written in the block.
It is executed in general, node is known as the transaction serialized by the mode for executing each transaction in block after arriving first one by one
Mode.The transaction executive mode why use this serialization, is one because under common block chain application scenarios
The execution of transaction is sometimes updated the information stored in more than one storage address, if not using the transaction of serialization
The case where executive mode, the then transaction being easy to appear executes failure.
But under the block chain application scenarios having, there is no can to the information stored in more than one storage address into
The transaction that row updates.Under these block chain application scenarios, using the transaction executive mode of above-mentioned serialization, transaction will lead to
Execution efficiency is lower.
In the following, being carried out by taking this block chain agreement in ether mill as an example to using the reason of transaction executive mode serialized
It is described in detail.It is emphasized that in other block chain agreements in addition to ether mill, using the transaction side of execution of serialization
The reason of formula is also similar.
In ether mill, there are points of external account and contract account.External account is for storing the ether that user possesses
Coin remaining sum, external account are substantially the storage address for being stored with balance information.Contract account is for storing the intelligence that user founds
Energy contract, contract account is substantially to be stored with the storage address of intelligent contract code.
In ether mill, general there are two types of the transaction of type, i.e. external account (can be external account to other accounts
Can be contract account) money transfer transactions and external account creation contract account contract creation transaction.
The execution of money transfer transactions can generally be updated the information stored in more than one storage address.Specifically,
The execution of one money transfer transactions, it will usually change the remaining sum (i.e. the balance information stored on two account addresses) of two accounts,
Transfer amounts are deducted from the remaining sum of transfer account, increase transfer amounts into the remaining sum of receipt on account account.One money transfer transactions
Executable premise is the remaining sum of transfer account not less than transfer amounts.
Transfer account in practical application, in a certain money transfer transactions (being denoted as money transfer transactions A), it may be possible to before another
Receipt on account user in one money transfer transactions (being denoted as money transfer transactions B).If the sequence not being initiated according to transaction after arriving first by holding
Row transaction, it would be possible that there is following situation, i.e. money transfer transactions B is not carried out, and the transfer account in money transfer transactions A is caused not fill
The remaining sum of foot is transferred accounts.Exactly because in this way, all block chain application scenarios for being related to money transfer transactions, all have to using string
The transaction executive mode of rowization, to guarantee that transaction can be executed smoothly.
And the execution of contract creation transaction is actually to create a contract account, that is, founds a storage address, and will
Intelligent contract code is stored in the storage address founded.Obviously, the execution of contract creation transaction only will affect a storage address.
In addition, block chain application scenarios be it is diversified, under the block chain application scenarios having, ether mill can be based on
It is extended, develops the transaction of new type, the execution of this transaction may also only will affect a storage address.For example, sharp
With block chain carry out in store card.One is deposited the execution of card transaction, is substantially to found a storage address, will be deposited the interior of card
It stores into the storage address founded.
Based on the above, this paper presents a kind of method that parallelization executes the transaction of block chain, specifically for certain a kind of block
Chain application scenarios, under this kind of block chain scene, the implementing result of every transaction only will affect a storage address.
Fig. 4 is the flow diagram for the method that a kind of parallelization that this specification embodiment provides executes the transaction of block chain,
The following steps are included:
S400: for each node in block chain network, which obtains block to be written.
In this specification embodiment, after actually each node common recognition of the block to be written, it is packaged by accounting nodes
At block.The block to be written can be broadcast to other nodes by accounting nodes.It is well known that in block chain agreement, often
On the one hand a node needs to be implemented each transaction in block to be written, on the other hand need to be written into block and be written to block
Publicity is carried out in chain.The block to be written once be written block chain in, be equivalent to be written into each of block trade into
Publicity is gone.Whether publicity can correct for verifying corresponding transaction implementing result in the transaction on block chain, to have prevented
Node is done evil.
In step S400, for each node, if the node is accounting nodes, which obtains described to be written
The mode for entering block specifically can be fished for from the caching of itself it is several transaction be packaged into the block to be written;If the section
Point is not accounting nodes, then the mode that the node obtains the block to be written, which specifically can be, receives accounting nodes broadcast
The block to be written.
It is emphasized that the implementing result of the transaction is to found one for each transaction in the block to be written
A storage address is simultaneously stored in information, or update stored in a storage address information (to storage address deposit information or
Modify the information stored in a storage address).That is, the implementing result of each transaction in the block to be written,
A storage address can only be had an impact.
For example, creation contract account contract create transaction, be exactly implementing result be found a storage address and be stored in
The transaction of information.The topic publication transaction being mentioned above is to found a storage ground with answer publication transaction and implementing result
Location and the transaction for being stored in information.
For another example, under some block chain application scenarios, the record of the shopping to each user is needed to carry out depositing card.So,
Need to found the corresponding record storage address of each user in the database.When target user does shopping, one will be generated
Item shopping records, and any node in block chain network can deposit to demonstrate,prove and trade and broadcast based on shopping record building record.Then,
For each node, the node can (i.e. the record deposits card transaction and is packed into module to be written and is broadcast on suitable opportunity
When each node) execute the record deposit card transaction, i.e., the shopping story is recorded into the corresponding record storage address of target user.It is aobvious
So, target user carries out a plurality of shopping record caused by repeatedly shopping with being stored into the corresponding record storage of target user
Location.Therefore, above-mentioned record deposits card transaction, be exactly implementing result be the information trading that stores in one storage address of update.
The result publication transaction being mentioned above and implementing result are to update the information stored in a storage address to hand over
Easily.
S402: each transaction is read from the block to be written, and by each action organisation at N number of transaction queue.
In the prior art, each node generallys use the transaction executive mode of serialization to execute the block to be written
In each transaction.As shown in figure 5, the transaction executive mode of so-called serialization, refer to each node according to certain sequence on the offensive,
Each transaction in the block to be written is executed one by one.
And in this specification embodiment, each transaction in the block to be written can be split as N group, wherein N is big
In 1 natural number.Then, for each group, the transaction in this group is arranged in a transaction queue.This specification is to each
Putting in order for trading in transaction queue is not specifically limited.
S404: while it being directed to each transaction queue, by successively executing each transaction in the transaction queue after arriving first.
In step s 404, actually start simultaneously at parallelization carries out transaction execution for each transaction queue.And
Specific to each transaction queue, actually serialization executes each transaction in the transaction queue.As shown in Figure 6.
So-called " simultaneously " refers to that node started to execute the transaction in each transaction queue in the same time.It is equivalent to node
N number of transaction executive process is founded in the same time, each transaction process is responsible for executing the transaction in a transaction queue.
Two kinds of transaction executive modes of comparison diagram 5 and Fig. 6, it is clear that use transaction executive mode shown in fig. 6, Ke Yi
More transaction are executed in unit time.
S406: block chain is written into the block to be written.
In this specification embodiment, for each node, step S406 can be executed after executing step S404;
Step S406 can not also be just executed after executing step S404.
The method for executing the transaction of block chain by parallelization shown in Fig. 4, if each transaction in block to be written is all
It is not the transaction being updated to the information stored in more than one storage address, then, each node in block chain network
Each action organisation in block can be written into at least two transaction queues, then, start simultaneously at and execute each transaction team
Transaction in column.In this way, each node can execute greater number of transaction within the unit time, improves transaction and execute effect
Rate.
In addition, in this specification embodiment, the corresponding number of transaction of each transaction queue is (in i.e. each transaction queue
The quantity of transaction) it can be relatively.In this way, when carrying out transaction execution for each transaction queue while parallelization, each
The quantity of transaction performed by executive process is not in that the process having is left unused relatively, the feelings of some process overloads
Condition.This also means that node can execute transaction as much as possible within the unit time.
Specifically, the variance being calculated based on the corresponding number of transaction of each transaction queue can be set no more than specified
Threshold value.The variance being calculated based on the corresponding number of transaction of each transaction queue is smaller, the corresponding number of deals of each transaction queue
Amount is just closer.
In addition, can specifically use ether mill protocol construction block chain network in this specification embodiment.In ether mill
In, virtual machine program is installed on each node, for providing running environment for the realization of ether mill agreement.
In general, a virtual machine program is for executing a block chain process.And in this specification embodiment, due to needing
It to be directed to more than one transaction queue simultaneously, the execution more than one block chain process of parallelization, therefore, it is necessary in each node
Upper deployment more than one virtual machine program in advance.
Specifically, it is written into the action organisation in block if necessary into N number of transaction queue, then, it is necessary in advance
N number of virtual machine program is disposed on each node.
In this way, in step s 404, can establish between the N number of virtual machine program and N number of transaction queue disposed in advance
One-to-one relationship;Be directed to each transaction queue simultaneously, by the corresponding virtual machine program of the transaction queue, by after arriving first successively
Execute each transaction in the transaction queue.
In addition, in this specification embodiment, in general, the existing first kind transaction of transaction in block to be written, also there is the
The transaction of two classes.Wherein, first kind transaction refers to that implementing result is to update the transaction of the information stored in a storage address;The
The transaction of two classes refers to that implementing result is the transaction founded a storage address and be stored in information.
Obviously, there may be the trade fairs of the more than one first kind to storing in the same storage address in block to be written
Information is updated.And node generally requires first to access currently performed first kind friendship when executing the transaction of each first kind
Easily targeted storage address.In this case, node is when executing the transaction in block to be written, if can be to same storage
The corresponding all first kind transaction in address, which concentrate, to be executed in batches, then only needing to carry out for the same storage address primary
Access, this can be obviously improved the speed that node executes transaction.
Specifically, in step S402, implementing result can be selected from each transaction to update in a storage address
The transaction of the information of storage is traded as the first kind, and, by other transaction conducts in each transaction in addition to first kind transaction
The transaction of second class;By in the transaction of each first kind, the identical first kind action organisation of corresponding storage address is at a sub- team of transaction
Column;With each transaction subqueue for a processing unit, also, a processing unit is considered as with the transaction of each second class;It will be each
Unit organization is handled into N number of transaction queue.
In this way, whole first kind transaction corresponding to any storage address can all be integrated one in the block to be written
A transaction subqueue, the transaction subqueue can be integrally put into some transaction queue.Node for the transaction queue into
When row transaction executes, once accessing the storage address, the corresponding whole first kind transaction of the storage address will be continuously performed.
Further, each processing unit organization can be such that at N number of transaction queue
It is descending that each processing unit is ranked up according to the corresponding number of transaction of each processing unit;Also, it is initial
Changing the corresponding number of transaction of each transaction queue is 0;According to ranking results, first processing unit is selected;By what is currently selected
Processing unit is added to the tail of the queue of minimum transaction queue, and updates the corresponding number of transaction of the minimum transaction queue;Minimum is handed over
Easy queue is the current corresponding the smallest transaction queue of number of transaction;Continue to select next processing unit, until all processing
Unit is added to transaction queue.
In this way, the corresponding number of transaction of each transaction queue can be made about the same.In this way, being based on
When the transaction that each transaction queue carries out parallelization executes, the workload on each executive process is also about the same, does not have some
The idle situation of executive process occurs, and can execute most transaction within the unit time in this way, be obviously improved the transaction of node
Execution efficiency.
Based on method shown in FIG. 1, this specification embodiment also correspondence provides a kind of programming topic based on block chain
Distributing device, as shown in fig. 7, described device is any node in block chain network, described device includes:
Module 701 is founded, programming topic to be released is founded;
Broadcast module 702 is constructed, is based on topic related data, building topic publication transaction, and to the block chain network
Broadcast the topic publication transaction;The topic related data includes the programming topic, is handed over so as to obtain the topic publication
Easy each node issues transaction write-in block chain based on the common recognition mechanism between each node, by the topic.
Based on method shown in Fig. 2, this specification embodiment also correspondence provides a kind of answer code based on block chain
Distributing device, as shown in figure 8, described device is any node in block chain network, described device includes:
Module 801 is obtained, programming topic is obtained;The programming topic is by the described in any item sides of Claims 1 to 4
Method publication;
Module 802 is answered, the programming topic is supplied to tested user and is answered, and is received described tested on probation
The answer code that family uploads;
Broadcast module 803 is constructed, based on answer related data, building answer publication transaction, and to the block chain network
The answer publication transaction is broadcasted, so as to obtain each node of the answer publication transaction based on the common recognition machine between each node
The answer is issued transaction write-in block chain by system;
Wherein, the answer related data includes topic mark, the answer code and the quilt of the programming topic
Test the user identifier of user.
Based on method shown in Fig. 2, this specification embodiment also correspondence provides a kind of answer code based on block chain
Verifying attachment, as shown in figure 9, described device is to be stored with the corresponding answer inspection data of programming topic in block chain network
Node, described device include:
Module 901 is obtained, the corresponding answer code of the programming topic is obtained and uploads the tested of the answer code
The user identifier of user;The programming topic is issued by method shown in FIG. 1, and the answer code is by Fig. 2 institute
The method publication shown;
Inspection module 902 examines the answer generation using the answer inspection data for corresponding to the programming topic of storage
Code;
Broadcast module 903 is constructed, if upchecking, is based on result related data, building result publication transaction, and to institute
It states block chain network and broadcasts the result publication transaction, so that each node for obtaining the result publication transaction is based on each node
Between common recognition mechanism, by the result issue transaction write-in block chain;
Wherein, the result related data includes the topic mark and the user identifier of the programming topic.
Based on method shown in FIG. 1, this specification embodiment also correspondence provides a kind of programming topic based on block chain
Delivery system, including the block chain network being made of multiple nodes;
Any node founds programming topic to be released;Based on topic related data, constructs topic publication and trade, and to
The block chain network broadcasts the topic publication transaction, and the topic related data includes the programming topic;
The each node for obtaining the topic publication transaction is sent out the topic based on the common recognition mechanism between each node
Cloth transaction write-in block chain.
Based on method shown in Fig. 2, this specification embodiment also correspondence provides a kind of answer code based on block chain
Delivery system, including the block chain network being made of multiple nodes;
Any node obtains programming topic;The destination node is any node in block chain network, the programming topic
Mesh is method publication according to figure 1;The programming topic is supplied to tested user to answer, and described in reception
The answer code that tested user uploads;Based on answer related data, building answer publication transaction, and to the block chain network
Broadcast the answer publication transaction;Wherein, the answer related data includes topic mark, the answer of the programming topic
The user identifier of code and the tested user;
The each node for obtaining the answer publication transaction is sent out the answer based on the common recognition mechanism between each node
Cloth transaction write-in block chain.
Based on method shown in Fig. 3, this specification embodiment also correspondence provides a kind of answer code based on block chain
Checking system, including the block chain network being made of multiple nodes;
Node is examined, the corresponding answer code of programming topic is obtained and uploads the use of the tested user of the answer code
Family mark, the programming topic are method publications according to figure 1, and the answer code is method according to Fig.2,
Publication, the inspection node is to be stored with the node of the corresponding answer inspection data of the programming topic in block chain network;
Using the answer inspection data for corresponding to the programming topic of storage, the answer code is examined;If upchecking, it is based on
As a result related data, building result publication transaction, and the result publication transaction is broadcasted to the block chain network;Wherein, institute
State the topic mark and the user identifier that result related data includes the programming topic;
The each node for obtaining the result publication transaction is sent out the result based on the common recognition mechanism between each node
Cloth transaction write-in block chain.
Figure 10 is a kind of structural representation for programming levels test macro based on block chain that this specification embodiment provides
Figure.System shown in Fig. 10 specifically can be used to implement the programming topic delivery system based on block chain, answer code publication is
System, answer code check system.
This specification embodiment also provides a kind of computer equipment, includes at least memory, processor and is stored in
On reservoir and the computer program that can run on a processor, wherein processor realized when executing described program Fig. 1 or Fig. 2 or
The function of method shown in Fig. 3.
Figure 11 shows one kind provided by this specification embodiment and more specifically calculates device hardware structural schematic diagram,
The equipment may include: processor 1010, memory 1020, input/output interface 1030, communication interface 1040 and bus
1050.Wherein processor 1010, memory 1020, input/output interface 1030 and communication interface 1040 are real by bus 1050
The now communication connection inside equipment each other.
Processor 1010 can use general CPU (Central Processing Unit, central processing unit), micro- place
Reason device, application specific integrated circuit (Application Specific Integrated Circuit, ASIC) or one
Or the modes such as multiple integrated circuits are realized, for executing relative program, to realize technical side provided by this specification embodiment
Case.
Memory 1020 can use ROM (Read Only Memory, read-only memory), RAM (Random Access
Memory, random access memory), static storage device, the forms such as dynamic memory realize.Memory 1020 can store
Operating system and other applications are realizing technical solution provided by this specification embodiment by software or firmware
When, relevant program code is stored in memory 1020, and execution is called by processor 1010.
Input/output interface 1030 is for connecting input/output module, to realize information input and output.Input and output/
Module can be used as component Configuration (not shown) in a device, can also be external in equipment to provide corresponding function.Wherein
Input equipment may include keyboard, mouse, touch screen, microphone, various kinds of sensors etc., output equipment may include display,
Loudspeaker, vibrator, indicator light etc..
Communication interface 1040 is used for connection communication module (not shown), to realize the communication of this equipment and other equipment
Interaction.Wherein communication module can be realized by wired mode (such as USB, cable etc.) and be communicated, can also be wirelessly
(such as mobile network, WIFI, bluetooth etc.) realizes communication.
Bus 1050 include an access, equipment various components (such as processor 1010, memory 1020, input/it is defeated
Outgoing interface 1030 and communication interface 1040) between transmit information.
It should be noted that although above equipment illustrates only processor 1010, memory 1020, input/output interface
1030, communication interface 1040 and bus 1050, but in the specific implementation process, which can also include realizing normal fortune
Other assemblies necessary to row.In addition, it will be appreciated by those skilled in the art that, it can also be only comprising real in above equipment
Component necessary to existing this specification example scheme, without including all components shown in figure.
This specification embodiment also provides a kind of computer readable storage medium, is stored thereon with computer program, the journey
The function of method shown in Fig. 1 and/or Fig. 4 is realized when sequence is executed by processor.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology come realize information store.Information can be computer readable instructions, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase change memory (PRAM), static random access memory (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), flash memory or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storage, magnetic cassettes, tape magnetic disk storage or other magnetic storage devices
Or any other non-transmission medium, can be used for storage can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as the data-signal and carrier wave of modulation.
As seen through the above description of the embodiments, those skilled in the art can be understood that this specification
Embodiment can be realized by means of software and necessary general hardware platform.Based on this understanding, this specification is implemented
Substantially the part that contributes to existing technology can be embodied in the form of software products the technical solution of example in other words,
The computer software product can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are to make
It is each to obtain computer equipment (can be personal computer, server or the network equipment etc.) execution this specification embodiment
Method described in certain parts of a embodiment or embodiment.
System, method, module or the unit that above-described embodiment illustrates can specifically realize by computer chip or entity,
Or it is realized by the product with certain function.A kind of typically to realize that equipment is computer, the concrete form of computer can
To be personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media play
In device, navigation equipment, E-mail receiver/send equipment, game console, tablet computer, wearable device or these equipment
The combination of any several equipment.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device and
For apparatus embodiments, since it is substantially similar to the method embodiment, so describing fairly simple, related place is referring to method
The part of embodiment illustrates.Embodiment of the method described above is only schematical, wherein described be used as separation unit
The module that part illustrates may or may not be physically separated, can be when implementing this specification example scheme
The function of each module is realized in the same or multiple software and or hardware.It can also select according to the actual needs therein
Some or all of the modules achieves the purpose of the solution of this embodiment.Those of ordinary skill in the art are not making the creative labor
In the case where, it can it understands and implements.
The above is only the specific embodiment of this specification embodiment, it is noted that for the general of the art
For logical technical staff, under the premise of not departing from this specification embodiment principle, several improvements and modifications can also be made, this
A little improvements and modifications also should be regarded as the protection scope of this specification embodiment.