CN110321219A - A kind of parallel execution method, apparatus, equipment and the medium of transactions requests - Google Patents

A kind of parallel execution method, apparatus, equipment and the medium of transactions requests Download PDF

Info

Publication number
CN110321219A
CN110321219A CN201910372104.8A CN201910372104A CN110321219A CN 110321219 A CN110321219 A CN 110321219A CN 201910372104 A CN201910372104 A CN 201910372104A CN 110321219 A CN110321219 A CN 110321219A
Authority
CN
China
Prior art keywords
transactions requests
data
execution
block chain
transactions
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910372104.8A
Other languages
Chinese (zh)
Inventor
郑旗
肖伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910372104.8A priority Critical patent/CN110321219A/en
Publication of CN110321219A publication Critical patent/CN110321219A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/466Transaction processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses parallel execution method, apparatus, equipment and the media of a kind of transactions requests.Wherein, this method is applied to block chain node, this method comprises: obtaining at least two transactions requests initiated based on intelligent contract;Memory space is executed for each transactions requests distribution;The corresponding transactions requests are executed parallel in at least two execution memory spaces, and record the influence data set in the transactions requests implementation procedure respectively;The validity of the transactions requests implementing result is determined according to the influence data set of the transactions requests.The technical solution provided through the embodiment of the present invention can take into account the conflict for concurrently executing demand and dependence of transactions requests.

Description

A kind of parallel execution method, apparatus, equipment and the medium of transactions requests
Technical field
The present embodiments relate to the parallel sides of execution of the data processing technique of block chain more particularly to a kind of transactions requests Method, device, equipment and medium.
Background technique
In block catenary system, block chain node can generate transactions requests based on intelligent contract, and to other block chains Node sends the transactions requests, and the transactions requests are executed and verified in the whole network as a result, and cochain is carried out into block chain Storage.Intelligent contract refers to code collection affixing one's name in the middle part of block chain node, realizing certain functions.
In current block catenary system, the transactions requests generated based on intelligent contract are needed at block chain data Reason.Since there may be dependences between transactions requests, so being usually serially to execute.But this can not efficiently use conduct The computer multicore characteristic of block chain node, handling capacity is low, cannot meet the big practical application scene of handling capacity very well, lead to area Block catenary system cannot be used widely by landing.
Summary of the invention
The embodiment of the present invention provides parallel execution method, apparatus, equipment and the medium of a kind of transactions requests, to take into account affairs The conflict for concurrently executing demand and dependence of request.
In a first aspect, being applied to block chain link the embodiment of the invention provides a kind of parallel execution method of transactions requests Point, this method comprises:
Obtain at least two transactions requests initiated based on intelligent contract;
Memory space is executed for each transactions requests distribution;
The corresponding transactions requests are executed parallel in at least two execution memory spaces, and respectively described in record Influence data set in transactions requests implementation procedure;
The validity of the transactions requests implementing result is determined according to the influence data set of the transactions requests.
Second aspect, the embodiment of the invention also provides a kind of parallel executive devices of transactions requests, are configured at block chain In node, which includes:
Transactions requests obtain module, for obtaining at least two transactions requests initiated based on intelligent contract;
Memory allocation module, for executing memory space for each transactions requests distribution;
Transactions requests execution module, for executing the corresponding thing parallel in at least two execution memory spaces Business request, and the influence data set in the transactions requests implementation procedure is recorded respectively;
Validity determining module determines that the transactions requests execute knot for the influence data set according to the transactions requests The validity of fruit.
The third aspect, the embodiment of the invention also provides a kind of equipment, which includes:
One or more processors;
Memory, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processing Device realizes the parallel execution method of transactions requests described in first aspect.
Fourth aspect, the embodiment of the invention provides a kind of computer readable storage mediums, are stored thereon with computer journey Sequence realizes the parallel execution method of transactions requests described in first aspect when the program is executed by processor.
Parallel execution method, apparatus, equipment and the medium of a kind of transactions requests provided in an embodiment of the present invention, by obtain At least two transactions requests distribution initiated based on intelligent contract taken respectively executes memory space, and executes and deposit at least two Storage executes corresponding transactions requests in space parallel, while recording the influence data of each transactions requests in the process of implementation respectively Collection, then according to the validity for influencing data set and determining corresponding transactions requests implementing result recorded.Solves existing block The problem of serial executive mode of transactions requests and practical application scene need contradiction between larger handling capacity in chain network, meets The demand that transactions requests concurrently execute has combined the dependence between transactions requests, for the affairs based on intelligent contract Parallel execute of request provides a kind of new approaches.
Detailed description of the invention
Fig. 1 is a kind of flow chart of the parallel execution method of the transactions requests provided in the embodiment of the present invention one;
Fig. 2 is a kind of flow chart of the parallel execution method of the transactions requests provided in the embodiment of the present invention two;
Fig. 3 is a kind of flow chart of the parallel execution method of the transactions requests provided in the embodiment of the present invention three;
Fig. 4 is a kind of structural schematic diagram of the parallel executive device of the transactions requests provided in the embodiment of the present invention four;
Fig. 5 is a kind of structural schematic diagram of the equipment provided in the embodiment of the present invention five.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Embodiment one
Fig. 1 is a kind of flow chart of the parallel execution method of the transactions requests provided in the embodiment of the present invention one, this implementation Example is applicable to the case where carrying out parallel processing to transactions requests, is particularly suitable for for the transactions requests based on intelligent contract, How it is handled, to solve the serial executive mode of transactions requests and practical application scene needs in existing block chain network Between larger handling capacity the problem of contradiction.The scheme of the embodiment of the present invention is executed by the block chain node in block chain network, It can specifically be executed by the initiation node of transactions requests in block chain network, it can also be by getting thing from block chain network Other nodes requested be engaged in execute.
The scheme of the embodiment of the present invention can be executed by the parallel executive device of transactions requests, which can be used hardware And/or the mode of software is realized, and can be integrated in the calculating equipment of carrying block chain link point.Referring to Fig. 1, this method specifically may be used To include:
S110 obtains at least two transactions requests initiated based on intelligent contract.
In the present embodiment, the transactions requests initiated based on intelligent contract are the transactions requests based on intelligent contract.
Optionally, two or more affairs that the available local of localized nodes is initiated based on intelligent contract are asked It asks, such as the locally generated issued transaction demand of localized nodes, or receives a certain trigger mechanism such as third party device (such as client End, terminal device or server etc.) send issued transaction demand when, generates and is initiated based on intelligent according to issued transaction demand The transactions requests of contract.
Localized nodes can also obtain what other block chain nodes transmitted in block chain network were initiated based on intelligent contract Two or more transactions requests.That is, localized nodes can be the initiation node of transactions requests, thing can also be The receiving node of business request.
S120 executes memory space for the distribution of each transactions requests.
In the present embodiment, memory space is a kind of storage medium, and memory space preferably caches in the present embodiment (Cache), i.e. temporary memory space.Implementation procedure in the execution memory space is for the data in block catenary system Read-only, that is, it is merely able to read data from block catenary system, but can not modify by being written in block catenary system There are data.
In order to meet the needs of practical application scene larger handling capacity, the present embodiment makes full use of computer multicore feature, Concurrently execute acquired multiple transactions requests.Memory space is executed for the distribution of each transactions requests first, to ensure each affairs Request does not influence each other in the process of implementation.Wherein, executing memory space is space needed for executing a certain transactions requests.
Optionally, localized nodes can will can use part average according to the quantity of acquired transactions requests in memory space It is divided into and the comparable execution memory space of its quantity.Localized nodes can also be according to the quantity, each of acquired transactions requests The various dimensions factor such as the amount of bytes of transactions requests and the size of free memory executes storage for the distribution of each transactions requests Space.
S130 executes corresponding transactions requests at least two execution memory spaces parallel, and record affairs are asked respectively Seek the influence data set in implementation procedure.
In the present embodiment, transactions requests need to rely in the process of implementation some data with existing in local data, and may Some data are changed, delete or increase newly, that is, corresponding to influences data set.Further, influencing data set may include reading data With write data.It reads data and refers to the data that transactions requests need to read from local data in the process of implementation;Writing data is thing The business request data to be updated after executing and (such as increase, change or delete).
Specifically, localized nodes are respectively held for at least two transactions requests distribution of acquisition initiated based on intelligent contract After row memory space, corresponding transactions requests can be concurrently executed in each execution memory space, while record affairs are asked respectively The influence data set in implementation procedure is sought, such as respectively by the influence data set record in each transactions requests implementation procedure in corresponding It executes in memory space.
It should be noted that the implementation procedure of transactions requests is the machine if localized nodes are the initiation nodes of transactions requests The pre-execution process of node;Wherein, pre-execution is localized nodes after determining transactions requests of the generation based on intelligent contract, The transactions requests are performed locally in advance to generate pre-execution as a result, sending after and to block chain network includes pre-execution result Transactions requests.
If localized nodes are the receiving nodes of transactions requests, the implementation procedure of transactions requests is that localized nodes routinely execute The process of transactions requests.The implementation procedure of regular transaction request is localized nodes to the transactions requests obtained from block chain network It is handled, to generate Transaction Information, Transaction Information is stored in block, and the block is sent to block chain network to ask It asks other nodes to be verified and stores.
S140 determines the validity of transactions requests implementing result according to the influence data set of transactions requests.
It is recorded in the implementing result executed in memory space, temporarily goes back simultaneously Pending The Entry Into Force.Pending The Entry Into Force refers in particular to implementing result In write-in data, do not actual write in block and received or the treatment process of the transactions requests and other transactions requests Treatment process clash and fail.Need further judge whether the implementing result of transactions requests is effective.
Specifically, localized nodes can be according to the transactions requests implementation procedure of record for each transactions requests In influence data set, determine the validity of the transactions requests.For example, can will be in the transactions requests implementation procedure of record The reading data association message in data set is influenced, is compared with the relevant information of the corresponding data stored in block chain, in turn The validity of the transactions requests is determined according to comparison result.It influences to include reading data and writing data in data set, if two things Between business request, the content that data set includes overlapping is write, i.e. two transactions requests may simultaneously will be written some data Operation, then just illustrating that the implementation procedure of two transactions requests has conflict, cannot execute, it should at least one thing parallel The implementing result of business request is invalid, or both invalid.
Illustratively, determine that the validity of transactions requests implementing result can wrap according to the influence data set of transactions requests Include: whether the version that identification influences to read to have come into force corresponding data in data set in versions of data and block chain matches;According to matching As a result the validity of transactions requests implementing result is determined.
In the present embodiment, the version that versions of data refers to the data of required reading in transactions requests implementation procedure is read.Example Such as, the first transactions requests and the second transactions requests, if the second transactions requests are initiated again after the execution of the first transactions requests, And be directed to identical data object, then versions of data is read in the influence data set of the second transactions requests, is asked for the first affairs The version for the data that needs recorded in asking are read.
Optionally, read versions of data can further be characterized with the identifier that can play unique identification, such as can be used with Machine number indicates, can also be indicated with version identifier.Wherein, version identifier can be used for identifying which version is the data be corresponding to Transactions requests or onblock executing during modified, that is to say, that version identifier becomes with the execution dynamic of transactions requests Change.For example, the transactions requests in a block are the currency that A account shifts setting number to B account, then A account and B account are deposited Store up account balance version, all can because of the transactions requests execution and change.
It should be noted that if transactions requests is effective, the then version of its data stored in block chain It will come into force.
Specifically, localized nodes, which can will affect, reads versions of data and area for each transactions requests in data set The corresponding data version that come into force in block chain is matched, if the two matches, it is determined that the implementing result of the transactions requests is effective;If The two mismatches, it is determined that the implementing result of the transactions requests is invalid.
For example, then the two is being held when the first transactions requests and the second transactions requests are required to rewrite certain data The version of the targeted data is identical during row, it is assumed that is version X.If Mr. implementing result of the first transactions requests Imitate, then the version X of the data can due to the first transactions requests execution and be changed to version Y.Second transactions requests because It is executed parallel with the first transactions requests, so it reads the data that data are still version X.At this point, being asked in the second affairs of confirmation It when whether the implementing result asked is effective, can recognize, the version X data in the reading data of the second transactions requests, in block chain Come into force corresponding data version Y it is inconsistent, then illustrate that the implementing result of the second transactions requests is number that is invalid, being based on It is incorrect according to version.
It optionally, may include initiating section in each transactions requests if localized nodes are the receiving nodes of transactions requests Point carry out the pre-execution of local pre-execution as a result, and pre-execution result may include writing data, can also include reading data etc..Then Determine that the validity of transactions requests implementing result can also include: that each affairs are asked according to the influence data set of transactions requests For asking, localized nodes can will record the influence data set in the transactions requests implementation procedure, and be wrapped in the transactions requests The pre-execution result included carries out uniformity comparison, if consistency, it is determined that the implementing result of the transactions requests is validity, no It is then invalid.
Illustratively, after the influence data set according to transactions requests determines the validity of transactions requests implementing result, It can also include: the execution memory space for discharging transactions requests.Specifically, the present embodiment, in the influence number according to transactions requests After collecting the validity for determining transactions requests implementing result, no matter whether the implementing result of transactions requests is effective, timely It is purged to memory space is executed, and then can make full use of memory space, to improve the efficiency of parallel processing.
Technical solution provided in an embodiment of the present invention passes through at least two affairs initiated based on intelligent contract to obtain Request distribution respectively executes memory space, and executes corresponding transactions requests parallel at least two execution memory spaces, together When record the influence data set of each transactions requests in the process of implementation respectively, then determined pair according to the influence data set that is recorded Answer the validity of transactions requests implementing result.It solves the serial executive mode of transactions requests in existing block chain network to answer with reality The problem of needing contradiction between larger handling capacity with scene, meets the demand that transactions requests concurrently execute, combines and get over Dependence between business request, executes parallel for the transactions requests based on intelligent contract and provides a kind of new approaches.
Embodiment two
Fig. 2 is a kind of flow chart of the parallel execution method of the transactions requests provided in the embodiment of the present invention two, this implementation Example on the basis of the above embodiments, further determines transactions requests implementing result to according to the influence data set of transactions requests Validity is explained.Referring to fig. 2, this method can specifically include:
S210 obtains at least two transactions requests initiated based on intelligent contract.
S220 executes memory space for the distribution of each transactions requests.
S230 executes corresponding transactions requests at least two execution memory spaces parallel, and record affairs are asked respectively Seek the influence data set in implementation procedure.
S240 determines the Data Identification and version identifier for influencing that data are read in data set, wherein version identifier corresponds to The mark of transactions requests or the mark of block.
In the present embodiment, Data Identification is used for the identifier of a certain data of unique identification.Optionally, if reading data includes account Family remaining sum, then Data Identification can be account ID;If data store organisation is key-value pair data structure, data mark in block chain Knowing can identify for key.
Optionally, reading the further available edition mark of versions of data indicates that version identifier is at which for identifying the data It is modified in transactions requests implementation procedure corresponding to a version.Corresponding, each transactions requests record the transactions requests and hold It may include being updated (such as to increase, change or delete after record transactions requests execute that data are write in influence data during row Except etc.) data, and record the marks of the transactions requests as version identifier, or block where recording the transactions requests Mark is used as version identifier.It is permissible to record reading data in the influence data in the transactions requests implementation procedure for each transactions requests The version identifier for the data being based on when including initiating according to the transactions requests is inquired whether there is or not the data of corresponding version identifier, If so, then reading in;If nothing waits, and can periodic queries whether there is the data of corresponding version identifier.For example, account A is first Third transactions requests and the 4th transactions requests are initiated afterwards, and wherein third transactions requests are based on a certain thing stored in current block What the version identifier for the data requested of being engaged in was initiated, and the 4th transactions requests are the version marks based on the data in third transactions requests What knowledge was initiated, therefore, if third transactions requests and the 4th transactions requests execute parallel, the 4th transactions requests wait until needs After the data of third transactions requests come into force, data can be just read.
Optionally, a Data Identification can correspond to one or more version identifiers.If version identifier is the mark of block, The mark of the block can be the mark of current block, can also be the mark of any block of history;Optionally, the mark of the block When knowledge is defaulted as data the last time and is modified, the mark of the affiliated block of corresponding transactions requests.
S250 inquires the data of corresponding mark according to the Data Identification for reading data in block chain data, and inquires number According to version identifier.
In the present embodiment, block chain data may include the data being stored in block, and rely on block chain but solely Stand on the data that block chain is stored in block chain node local.
Specifically, localized nodes can inquire corresponding mark according to the Data Identification for reading data in block chain data Data, and inquire the version identifier of the data.
S260, whether the version identifier of identification reading data and the version identifier for inquiring data are consistent, if unanimously, it is determined that For matching, otherwise it is determined as mismatching.
Specifically, the version identifier of the version identifier and the data inquired of reading data is subjected to comparison of coherence, if one It causes, it is determined that the version match for the corresponding data that influences to read to have come into force in versions of data and block chain in data set;If inconsistent, Determine that the version for influencing to read to have come into force corresponding data in data set in versions of data and block chain mismatches, that is to say, that parallel The data read when execution, the transactions requests executed parallel by other are changed.
For example, two accounts A and B, while having initiated to transfer accounts to account C and having set the transactions requests of number currency, and this Two transactions requests execute parallel;At this point, store if the transactions requests implementing result of account A first comes into force into block, The version identifier of data that account B is read when executing, it is inconsistent with the version identifier that inquires data in block chain data.This When, transactions requests B can be re-executed, the version of data executes again after need to changing based on account A transactions requests.
S270 determines the validity of transactions requests implementing result according to matching result.
Technical solution provided in an embodiment of the present invention passes through at least two affairs initiated based on intelligent contract to obtain Request distribution respectively executes memory space, and executes corresponding transactions requests parallel at least two execution memory spaces, together When record the influence data set of each transactions requests in the process of implementation respectively;It then determines and is read in recorded influence data set According to Data Identification and version identifier, and the version of corresponding data is inquired in block chain data according to the Data Identification for reading data The version identifier of the version identifier and the data inquired of reading data is carried out uniformity comparison, and then tied according to comparing by mark Fruit determines the validity of corresponding transactions requests implementing result.Solves the serial executive mode of transactions requests in existing block chain network The problem of needing contradiction between larger handling capacity with practical application scene, meets the demand that transactions requests concurrently execute, simultaneously The dependence between transactions requests has been taken into account, has been executed parallel for the transactions requests based on intelligent contract and provides a kind of new think of Road.In addition, being not only convenient for the identification of dependence by introducing version identifier, it is also convenient for the subsequent version identifier that is based on and quickly cuts The data of other version identifiers are checked before shifting to, and provide a kind of new means for rapid data inquiry.
Embodiment three
Fig. 3 is a kind of flow chart of the parallel execution method of the transactions requests provided in the embodiment of the present invention three, this implementation Example on the basis of the above embodiments, the embodiment of the present invention scheme by the initiation node of transactions requests in block chain network Execute, and the implementation procedure of transactions requests be initiation node pre-execution process in the case where, further to according to transactions requests Influence data set determine that the validity of transactions requests implementing result is explained.Wherein, initiating node can be commonly Block chain node, is also possible to lightweight node.Wherein, lightweight node refers to the deployment data for being deployed with block chain, such as intelligence Can contract, common recognition mechanism etc., but the block chain network node of not stored or storage section block data and Transaction Information can be with The transactions requests interactive process of block chain is participated in, lightweight node can be generally deployed in terminal device.Referring to Fig. 3, this method It can specifically include:
S310 obtains at least two transactions requests initiated based on intelligent contract.
S320 executes memory space for the distribution of each transactions requests.
S330 executes the corresponding transactions requests of parallel pre-execution in memory space at least two, and records affairs respectively Request the influence data set during pre-execution.
S340, when obtaining the pre-execution result for the transactions requests submitted to block chain network, according to the shadow of transactions requests Ring the validity that data set determines the pre-execution result of transactions requests.
Specifically, executing the corresponding transactions requests of parallel pre-execution in memory space at least two, and thing is recorded respectively After influence data set during business request pre-execution, it can be obtained from each execution memory space at random or according to preset order The pre-execution for the transactions requests submitted to block chain network is as a result, simultaneously, according to acquisition sequence to each transactions requests, execute root The process of the validity of the pre-execution result of the transactions requests is determined according to the influence data set of the transactions requests.It can such as determine shadow The Data Identification and version identifier that data are read in data set are rung, and according to the Data Identification for reading data, in block chain data The data of the corresponding mark of inquiry, and inquire the version identifier of data;Then identification reads the version identifier of data and inquires number According to version identifier it is whether consistent, if unanimously, it is determined that for matching, be otherwise determined as mismatching;And then it can be according to matching result Determine the validity of transactions requests pre-execution result.
Illustratively, obtain to block chain network submit transactions requests pre-execution result before, can also include: by The pre-execution result for the multiple transactions requests submitted to block chain network is ranked up.It optionally, can be according to each transactions requests Initiation sequence or reception sequence, be ranked up to by the pre-execution result for the multiple transactions requests submitted to block chain network; It can also be the type according to transactions requests or random etc. held to by the pre- of multiple transactions requests submitted to block chain network Row result is ranked up, the present embodiment to how to the pre-execution results of the multiple transactions requests that will be submitted to block chain network into The mode of row sequence is unlimited, as long as rationally.
For example, localized nodes can be first according to the chronological order for receiving each transactions requests, to will be to block chain network The pre-execution result for the multiple transactions requests submitted is ranked up, and then obtains oriented region from each execution memory space in sequence The pre-execution for the transactions requests that block chain network is submitted was as a result, simultaneously, according to acquisition sequence to each transactions requests, executing basis should The influence data set of transactions requests determines the process of the validity of the pre-execution result of the transactions requests.
The pre-execution result of transactions requests is encapsulated in affairs if the pre-execution result of transactions requests is effective by S350 In request, transmission is initiated into block chain network, to request block chain link point to carry out cochain storage.
In the present embodiment, the implementing result of transactions requests, which is encapsulated in, be can be in transactions requests by the execution of transactions requests As a result it is added in the preset field of transactions requests.
Specifically, localized nodes are if it is determined that the pre-execution result of the transactions requests is effective, then for each transactions requests The pre-execution result of the transactions requests can be added in the preset field of the transactions requests, and be sent out in backward block chain network Transmission is played, to request other block chain nodes in block chain network that pre-execution result is stored in block chain as Transaction Information In, or request other block chain nodes to be verified according to pre-execution result to the transactions requests, and in the case where being verified, It is stored in pre-execution result as Transaction Information in block chain.
For a block chain node, locally generated multiple transactions requests, such as unit time may be obtained simultaneously The transactions requests of interior thousands of, tens of thousands of, the even higher order of magnitude, need support the node of big handling capacity application scenarios, have this Demand.Block chain node carries out the pre-execution processing of transactions requests first, then submits again into block chain network.The prior art In, in order to avoid the data collision between transactions requests, can only serial process, and use the technical solution of the embodiment of the present invention, Multiple transactions requests can be executed parallel in pre-execution treatment process.The affairs including pre-execution result after by parallel execute Request, when being committed to block chain network, transactions requests to be committed can be ranked up, one by one check pre-execution result with The conflict between the data that come into force is submitted to be submitted if do not conflicted.If there is conflict, then the pre- of the transactions requests is held Row result is invalid, it can be arranged to re-execute again.
For each transactions requests, for localized nodes if it is determined that the pre-execution result of the transactions requests is invalid, then being not necessarily to will The pre-execution result of the transactions requests is transmitted to block chain network, can be performed locally the transactions requests pretreatment operation again. Illustratively, after the influence data set according to transactions requests determines the validity of pre-execution result of transactions requests, may be used also If invalid with the pre-execution result for including: transactions requests, refuse transactions requests and initiate transmission, control into block chain network Transactions requests re-start pre-execution processing.
Technical solution provided in an embodiment of the present invention, provide a kind of transactions requests initiate node can parallel pre-execution affairs It is larger to can solve the serial executive mode of transactions requests and practical application scene needs in existing block chain network for the scheme of request Between handling capacity the problem of contradiction, meet the demand that transactions requests concurrently execute, combined between transactions requests according to The relationship of relying, executes parallel for the transactions requests based on intelligent contract and provides a kind of new approaches.In addition, initiating node to being initiated Transactions requests locally carry out pre-execution, can also effectively prevent the delayed execution of intelligent contract call request, avoid because prolonging Result caused by Shi Zhihang is uncertain.
Example IV
Fig. 4 is a kind of structural schematic diagram of the parallel executive device of the transactions requests provided in the embodiment of the present invention four, should Device is configured in block chain node, which can be performed holding parallel for transactions requests provided by any embodiment of the invention Row method has the corresponding functional module of execution method and beneficial effect.As shown in figure 4, the device includes:
Transactions requests obtain module 410, for obtaining at least two transactions requests initiated based on intelligent contract;
Memory allocation module 420, for executing memory space for the distribution of each transactions requests;
Transactions requests execution module 430 is asked for executing corresponding affairs parallel at least two execution memory spaces It asks, and records the influence data set in transactions requests implementation procedure respectively;
Validity determining module 440, for determining transactions requests implementing result according to the influence data set of transactions requests Validity.
Technical solution provided in an embodiment of the present invention passes through at least two affairs initiated based on intelligent contract to obtain Request distribution respectively executes memory space, and executes corresponding transactions requests parallel at least two execution memory spaces, together When record the influence data set of each transactions requests in the process of implementation respectively, then determined pair according to the influence data set that is recorded Answer the validity of transactions requests implementing result.It solves the serial executive mode of transactions requests in existing block chain network to answer with reality The problem of needing contradiction between larger handling capacity with scene, meets the demand that transactions requests concurrently execute, combines and get over Dependence between business request, executes parallel for the transactions requests based on intelligent contract and provides a kind of new approaches.
Illustratively, validity determining module 440 may include:
Version recognition unit influences to read the corresponding data that come into force in versions of data and block chain in data set for identification Whether version matches;
Validity determination unit, for determining the validity of transactions requests implementing result according to matching result.
Illustratively, version recognition unit specifically can be used for:
Determine the Data Identification and version identifier for influencing that data are read in data set, wherein version identifier corresponds to affairs The mark of request or the mark of block;
According to the Data Identification for reading data, the data of corresponding mark are inquired in block chain data, and inquire data Version identifier;
Whether the version identifier that identification reads the version identifier of data and inquires data is consistent, if unanimously, it is determined that is Match, is otherwise determined as mismatching.
Illustratively, if the implementation procedure of transactions requests is to initiate the pre-execution process of node, validity determining module 440 specifically can be used for:
When obtaining the pre-execution result for the transactions requests submitted to block chain network, according to the influence data set of transactions requests Determine the validity of the pre-execution result of transactions requests.
Correspondingly, above-mentioned apparatus can also include:
Transactions requests transmission module, for obtain submitted to block chain network transactions requests pre-execution result when, After the validity of pre-execution result for determining transactions requests according to the influence data set of transactions requests, if transactions requests is pre- Implementing result is effective, then the pre-execution result of transactions requests is encapsulated in transactions requests, and transmission is initiated into block chain network, To request block chain link point to carry out cochain storage.
Illustratively, above-mentioned apparatus can also include:
Sorting module will be to area for before obtaining the pre-execution result of transactions requests submitted to block chain network The pre-execution result for multiple transactions requests that block chain network is submitted is ranked up.
Illustratively, above-mentioned apparatus can also include:
Again processing module, for obtain submitted to block chain network transactions requests pre-execution result when, according to After the influence data set of transactions requests determines the validity of pre-execution result of transactions requests, if the pre-execution of transactions requests As a result invalid, then refuse transactions requests and initiate transmission into block chain network, control transactions requests re-start pre-execution processing.
Illustratively, above-mentioned apparatus can also include:
Memory space release module, for determining transactions requests implementing result according to the influence data set of transactions requests After validity, the execution memory space of transactions requests is discharged.
Embodiment five
Fig. 5 is a kind of structural schematic diagram for equipment that the embodiment of the present invention five provides.Fig. 5, which is shown, to be suitable for being used to realizing this The block diagram of the example devices 12 of invention embodiment.The equipment 12 that Fig. 5 is shown is only an example, should not be to of the invention real The function and use scope for applying example bring any restrictions.12 typical case of equipment can be the calculating for undertaking block chain network nodal function Equipment.
As shown in figure 5, equipment 12 is showed in the form of universal computing device.The component of equipment 12 may include but unlimited In one or more processor or processing unit 16, memory 28, different system components (including memory 28 He is connected Processing unit 16) bus 18.
Bus 18 indicates one of a few class bus structures or a variety of, including memory bus or Memory Controller, Peripheral bus, graphics acceleration port, processor or the local bus using any bus structures in a variety of bus structures.It lifts For example, these architectures include but is not limited to industry standard architecture (ISA) bus, microchannel architecture (MAC) Bus, enhanced isa bus, Video Electronics Standards Association (VESA) local bus and peripheral component interconnection (PCI) bus.
Equipment 12 typically comprises a variety of computer system readable media.These media can be it is any can be by equipment 12 The usable medium of access, including volatile and non-volatile media, moveable and immovable medium.
Memory 28 may include the computer system readable media of form of volatile memory, such as random access memory Device (RAM) 30 and/or cache memory 32.Equipment 12 may further include other removable/nonremovable, volatile Property/nonvolatile computer system storage medium.Only as an example, storage system 34 can be used for reading and writing immovable, non- Volatibility magnetic medium (Fig. 5 do not show, commonly referred to as " hard disk drive ").Although being not shown in Fig. 5, can provide for can The disc driver of mobile non-volatile magnetic disk (such as " floppy disk ") read-write, and to removable anonvolatile optical disk (such as CD- ROM, DVD-ROM or other optical mediums) read-write CD drive.In these cases, each driver can pass through one A or multiple data media interfaces are connected with bus 18.Memory 28 may include at least one program product, which produces Product have one group of (for example, at least one) program module, these program modules are configured to perform the function of various embodiments of the present invention Energy.
Program/utility 40 with one group of (at least one) program module 42 can store in such as memory 28 In, such program module 42 include but is not limited to operating system, one or more application program, other program modules and It may include the realization of network environment in program data, each of these examples or certain combination.Program module 42 is usual Execute the function and/or method in embodiment described in the invention.
Equipment 12 can also be communicated with one or more external equipments 14 (such as keyboard, sensing equipment, display 24 etc.), Can also be enabled a user to one or more equipment interacted with the equipment 12 communication, and/or with enable the equipment 12 with One or more of the other any equipment (such as network interface card, modem etc.) communication for calculating equipment and being communicated.It is this logical Letter can be carried out by input/output (I/O) interface 22.Also, equipment 12 can also by network adapter 20 and one or The multiple networks of person (such as local area network (LAN), wide area network (WAN) and/or public network, such as internet) communication.As shown, Network adapter 20 is communicated by bus 18 with other modules of equipment 12.It should be understood that although being not shown in Fig. 5, Ke Yijie It closes equipment 12 and uses other hardware and/or software module, including but not limited to: microcode, device driver, redundancy processing are single Member, external disk drive array, RAID system, tape drive and data backup storage system etc..
The program that processing unit 16 is stored in memory 28 by operation, thereby executing various function application and data Processing, such as realize the parallel execution method of transactions requests provided by the embodiment of the present invention.
Embodiment six
The embodiment of the present invention six additionally provides a kind of computer readable storage medium, be stored thereon with computer program (or Referred to as computer executable instructions), for executing a kind of parallel execution method of transactions requests when which is executed by processor, This method comprises:
Obtain at least two transactions requests initiated based on intelligent contract;
It is distributed for each transactions requests and executes memory space;
Corresponding transactions requests are executed parallel at least two execution memory spaces, and record transactions requests execute respectively Influence data set in the process;
The validity of transactions requests implementing result is determined according to the influence data set of transactions requests.
The computer storage medium of the embodiment of the present invention, can be using any of one or more computer-readable media Combination.Computer-readable medium can be computer-readable signal media or computer readable storage medium.It is computer-readable Storage medium for example may be-but not limited to-the system of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, device or Device, or any above combination.The more specific example (non exhaustive list) of computer readable storage medium includes: tool There are electrical connection, the portable computer diskette, hard disk, random access memory (RAM), read-only memory of one or more conducting wires (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD- ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this document, computer-readable storage Medium can be any tangible medium for including or store program, which can be commanded execution system, device or device Using or it is in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.
The program code for including on computer-readable medium can transmit with any suitable medium, including --- but it is unlimited In wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
The computer for executing operation of the present invention can be write with one or more programming languages or combinations thereof Program code, described program design language include object oriented program language-such as Java, Smalltalk, C++, Further include conventional procedural programming language-such as " C " language or similar programming language.Program code can be with It fully executes, partly execute on the user computer on the user computer, being executed as an independent software package, portion Divide and partially executes or executed on a remote computer or server completely on the remote computer on the user computer.? Be related in the situation of remote computer, remote computer can pass through the network of any kind --- including local area network (LAN) or Wide area network (WAN)-be connected to subscriber computer, or, it may be connected to outer computer (such as mentioned using Internet service It is connected for quotient by internet).
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation, It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.

Claims (10)

1. a kind of parallel execution method of transactions requests, which is characterized in that be applied to block chain node, which comprises
Obtain at least two transactions requests initiated based on intelligent contract;
Memory space is executed for each transactions requests distribution;
The corresponding transactions requests are executed parallel in at least two execution memory spaces, and record the affairs respectively Request the influence data set in implementation procedure;
The validity of the transactions requests implementing result is determined according to the influence data set of the transactions requests.
2. the method according to claim 1, wherein according to the determination of the influence data set of the transactions requests The validity of transactions requests implementing result, comprising:
Identify whether the version for reading to have come into force corresponding data in the influence data set in versions of data and block chain matches;
The validity of the transactions requests implementing result is determined according to matching result.
3. according to the method described in claim 2, it is characterized in that, reading versions of data and block in the identification influence data set Whether the version of corresponding data of having come into force in chain matches, comprising:
Determine the Data Identification and version identifier that data are read in the influence data set, wherein the version identifier corresponds to The mark of the transactions requests or the mark of block;
According to the Data Identification for reading data, the data of corresponding mark are inquired in block chain data, and inquire data Version identifier;
Identify whether the version identifier for reading data and the version identifier for inquiring data are consistent, if unanimously, it is determined that be Match, is otherwise determined as mismatching.
4. the method according to claim 1, wherein the implementation procedure of the transactions requests is the pre- of initiation node Implementation procedure then determines the validity of the transactions requests implementing result according to the influence data set of the transactions requests, comprising:
When obtaining the pre-execution result for the transactions requests submitted to block chain network, according to the influence data of the transactions requests Collection determines the validity of the pre-execution result of the transactions requests;
Correspondingly, determining the validity of the pre-execution result of the transactions requests in the influence data set according to the transactions requests Later, further includes:
If the pre-execution result of the transactions requests is effective, the pre-execution result of the transactions requests is encapsulated in affairs and is asked In asking, transmission is initiated into block chain network, to request block chain link point to carry out cochain storage.
5. according to the method described in claim 4, being held it is characterized in that, obtaining to the pre- of transactions requests that block chain network is submitted Before row result, further includes:
The pre-execution result for the multiple transactions requests submitted to block chain network is ranked up.
6. according to the method described in claim 4, it is characterized in that, determining institute according to the influence data set of the transactions requests After the validity of pre-execution result for stating transactions requests, further includes:
If the pre-execution result of the transactions requests is invalid, refuses the transactions requests and initiate to pass into block chain network It is defeated, it controls the transactions requests and re-starts pre-execution processing.
7. the method according to claim 1, wherein determining institute according to the influence data set of the transactions requests After the validity for stating transactions requests implementing result, further includes:
Discharge the execution memory space of the transactions requests.
8. a kind of parallel executive device of transactions requests, which is characterized in that be configured in block chain node, described device includes:
Transactions requests obtain module, for obtaining at least two transactions requests initiated based on intelligent contract;
Memory allocation module, for executing memory space for each transactions requests distribution;
Transactions requests execution module is asked for executing the corresponding affairs parallel in at least two execution memory spaces It asks, and records the influence data set in the transactions requests implementation procedure respectively;
Validity determining module, for determining the transactions requests implementing result according to the influence data set of the transactions requests Validity.
9. a kind of equipment characterized by comprising
One or more processors;
Memory, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real Now such as the parallel execution method of transactions requests of any of claims 1-7.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor The parallel execution method such as transactions requests of any of claims 1-7 is realized when execution.
CN201910372104.8A 2019-05-06 2019-05-06 A kind of parallel execution method, apparatus, equipment and the medium of transactions requests Pending CN110321219A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910372104.8A CN110321219A (en) 2019-05-06 2019-05-06 A kind of parallel execution method, apparatus, equipment and the medium of transactions requests

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910372104.8A CN110321219A (en) 2019-05-06 2019-05-06 A kind of parallel execution method, apparatus, equipment and the medium of transactions requests

Publications (1)

Publication Number Publication Date
CN110321219A true CN110321219A (en) 2019-10-11

Family

ID=68118831

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910372104.8A Pending CN110321219A (en) 2019-05-06 2019-05-06 A kind of parallel execution method, apparatus, equipment and the medium of transactions requests

Country Status (1)

Country Link
CN (1) CN110321219A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111312352A (en) * 2020-02-19 2020-06-19 百度在线网络技术(北京)有限公司 Data processing method, device, equipment and medium based on block chain
CN111475262A (en) * 2020-04-02 2020-07-31 百度国际科技(深圳)有限公司 Transaction request processing method, device, equipment and medium in block chain
CN111625254A (en) * 2020-05-06 2020-09-04 Oppo(重庆)智能科技有限公司 File processing method, device, terminal and storage medium
CN112764897A (en) * 2020-12-31 2021-05-07 杭州趣链科技有限公司 Method, device and system for processing task request and computer readable storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107688999A (en) * 2017-08-11 2018-02-13 杭州秘猿科技有限公司 A kind of parallel transaction based on block chain performs method
CN108122159A (en) * 2017-12-22 2018-06-05 中链科技有限公司 A kind of factoring information processing method and system based on block chain
US20180158034A1 (en) * 2016-12-07 2018-06-07 International Business Machines Corporation Dynamic reordering of blockchain transactions to optimize performance and scalability
CN108804112A (en) * 2018-05-22 2018-11-13 上海分布信息科技有限公司 A kind of block chain falls account processing method and system
CN108924130A (en) * 2018-07-02 2018-11-30 上海达家迎信息科技有限公司 A kind of verification method of block data, device, equipment and storage medium
WO2019002004A1 (en) * 2017-06-26 2019-01-03 International Business Machines Corporation Blockchain transaction commitment ordering
CN109493223A (en) * 2018-11-07 2019-03-19 联动优势科技有限公司 A kind of bookkeeping methods and device
CN109508337A (en) * 2018-11-12 2019-03-22 杭州秘猿科技有限公司 A kind of transaction is parallel to execute method, apparatus, electronic equipment and system
CN109685502A (en) * 2018-12-06 2019-04-26 成都佰纳瑞信息技术有限公司 A kind of acceleration common recognition method suitable for block chain network
CN109684050A (en) * 2018-12-06 2019-04-26 成都佰纳瑞信息技术有限公司 A kind of the affairs actuator and its application method of parallelization
CN109710695A (en) * 2018-12-26 2019-05-03 百度在线网络技术(北京)有限公司 The identification of transactions requests validity and initiating method, device, equipment and medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180158034A1 (en) * 2016-12-07 2018-06-07 International Business Machines Corporation Dynamic reordering of blockchain transactions to optimize performance and scalability
WO2019002004A1 (en) * 2017-06-26 2019-01-03 International Business Machines Corporation Blockchain transaction commitment ordering
CN107688999A (en) * 2017-08-11 2018-02-13 杭州秘猿科技有限公司 A kind of parallel transaction based on block chain performs method
CN108122159A (en) * 2017-12-22 2018-06-05 中链科技有限公司 A kind of factoring information processing method and system based on block chain
CN108804112A (en) * 2018-05-22 2018-11-13 上海分布信息科技有限公司 A kind of block chain falls account processing method and system
CN108924130A (en) * 2018-07-02 2018-11-30 上海达家迎信息科技有限公司 A kind of verification method of block data, device, equipment and storage medium
CN109493223A (en) * 2018-11-07 2019-03-19 联动优势科技有限公司 A kind of bookkeeping methods and device
CN109508337A (en) * 2018-11-12 2019-03-22 杭州秘猿科技有限公司 A kind of transaction is parallel to execute method, apparatus, electronic equipment and system
CN109685502A (en) * 2018-12-06 2019-04-26 成都佰纳瑞信息技术有限公司 A kind of acceleration common recognition method suitable for block chain network
CN109684050A (en) * 2018-12-06 2019-04-26 成都佰纳瑞信息技术有限公司 A kind of the affairs actuator and its application method of parallelization
CN109710695A (en) * 2018-12-26 2019-05-03 百度在线网络技术(北京)有限公司 The identification of transactions requests validity and initiating method, device, equipment and medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
蔡维德 等: "基于区块链的应用***开发方法研究", 《软件学报》 *

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111312352A (en) * 2020-02-19 2020-06-19 百度在线网络技术(北京)有限公司 Data processing method, device, equipment and medium based on block chain
EP3869434A1 (en) * 2020-02-19 2021-08-25 Baidu Online Network Technology (Beijing) Co., Ltd. Blockchain-based data processing method and apparatus, device, and medium
US11630821B2 (en) * 2020-02-19 2023-04-18 Baidu Online Network Technology (Beijing) Co., Ltd. Blockchain-based data processing method and apparatus, device, and medium
CN111475262A (en) * 2020-04-02 2020-07-31 百度国际科技(深圳)有限公司 Transaction request processing method, device, equipment and medium in block chain
CN111475262B (en) * 2020-04-02 2024-02-06 百度国际科技(深圳)有限公司 Transaction request processing method, device, equipment and medium in blockchain
CN111625254A (en) * 2020-05-06 2020-09-04 Oppo(重庆)智能科技有限公司 File processing method, device, terminal and storage medium
CN111625254B (en) * 2020-05-06 2023-09-08 Oppo(重庆)智能科技有限公司 File processing method, device, terminal and storage medium
CN112764897A (en) * 2020-12-31 2021-05-07 杭州趣链科技有限公司 Method, device and system for processing task request and computer readable storage medium
CN112764897B (en) * 2020-12-31 2024-03-22 杭州趣链科技有限公司 Task request processing method, device and system and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN110321219A (en) A kind of parallel execution method, apparatus, equipment and the medium of transactions requests
EP3591510B1 (en) Method and device for writing service data in block chain system
CN110297689A (en) Intelligent contract executes method, apparatus, equipment and medium
CN108984645B (en) Block chain processing method, device, equipment and storage medium
CN113094396B (en) Data processing method, device, equipment and medium based on node memory
CN109951547B (en) Transaction request parallel processing method, device, equipment and medium
CN109886681A (en) Block chain common recognition method and common recognition system
CN108810006A (en) resource access method, device, equipment and storage medium
CN108959621A (en) A kind of implementation method, device, equipment and the storage medium of block chain network
CN109684307A (en) A kind of date storage method, device, equipment and storage medium
CN109886693B (en) Consensus realization method, device, equipment and medium for block chain system
CN109710695B (en) Transaction request validity identification and initiation method, device, equipment and medium
CN108681565A (en) block chain data parallel processing method, device, equipment and storage medium
CN109542980A (en) A kind of data processing method, device, equipment and the medium of block chain
CN109951546A (en) Transactions requests processing method, device, equipment and medium based on intelligent contract
CN109684414A (en) Synchronous method, device, equipment and the storage medium of block data
CN109726206A (en) Data processing method, device, equipment and the storage medium of block chain node
CN109684335A (en) Data structure implementation method, device, equipment and storage medium based on key-value pair
CN109101664A (en) A kind of data transmission method, device, equipment and the medium of lightweight node
CN109194669A (en) A kind of data transmission method, device, equipment and the medium of lightweight node
CN108665272A (en) Block chain data processing method, device, equipment and storage medium
CN111460504A (en) Service processing method, device, node equipment and storage medium
CN110096542A (en) Data verification processing method, device, system and the medium of decentralization
CN111161078A (en) One-to-many block chain transfer realization method
CN110138767A (en) Processing method, device, equipment and the storage medium of transactions requests

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination