CN110231979A - Transaction methods, device, equipment and storage medium based on block chain - Google Patents

Transaction methods, device, equipment and storage medium based on block chain Download PDF

Info

Publication number
CN110231979A
CN110231979A CN201910376443.3A CN201910376443A CN110231979A CN 110231979 A CN110231979 A CN 110231979A CN 201910376443 A CN201910376443 A CN 201910376443A CN 110231979 A CN110231979 A CN 110231979A
Authority
CN
China
Prior art keywords
service terminal
transaction
block chain
key
target keywords
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
CN201910376443.3A
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.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart 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 OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201910376443.3A priority Critical patent/CN110231979A/en
Publication of CN110231979A publication Critical patent/CN110231979A/en
Priority to PCT/CN2019/121996 priority patent/WO2020224249A1/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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/52Program synchronisation; Mutual exclusion, e.g. by means of semaphores
    • G06F9/524Deadlock detection or avoidance

Abstract

The present invention provides a kind of transaction methods based on block chain, device, equipment and storage medium, i.e., determines corresponding target keywords Key according to the transaction request, and judge whether the target keywords Key is in occupied state;If being not at occupied state, corresponding Transaction Information is written into block chain according to the target keywords Key;When the Transaction Information, which is written, to be completed, corresponding write-in successful information is returned to the service terminal, and distribute the corresponding distributed lock of the target keywords Key to the service terminal, so that the service terminal executes corresponding exclusiveness affairs by the distributed lock.The present invention is based on the characteristics of the corresponding distributed account book of block chain, transaction process is controlled and managed by way of distributed lock, so that a certain item resource same time in high concurrent can only be gone to execute by a service terminal, to guarantee the order of issued transaction and the uniformity of data.

Description

Transaction methods, device, equipment and storage medium based on block chain
Technical field
The present invention relates to block chain technical field more particularly to a kind of transaction methods based on block chain, device, set Standby and computer readable storage medium.
Background technique
Block chain generally can be regarded as a distributed account book, its essence is also a distributed database, bottom Layer uses the key value Key-Value database an of persistence.Currently, having carried out data and management using block chain technology Through starting gradually to be applied in different practical business scenes.In the case where alliance's chain, each mechanism can be disposed certainly Oneself block chain application.But in practical business, it is easy to produce the confusion and conflict of high concurrent data, traffic affecting is normally transported Row.
Therefore, how to solve the problems, such as the existing confusion and conflict for being easy to produce high concurrent data, be current urgent need to resolve The problem of.
Summary of the invention
The main purpose of the present invention is to provide a kind of transaction methods based on block chain, device, equipment and calculating Machine readable storage medium storing program for executing, it is intended to the technical issues of solving the existing confusion and conflict for being easy to produce high concurrent data.
To achieve the above object, the present invention provides a kind of transaction methods based on block chain, which is characterized in that described Transaction methods based on block chain the following steps are included:
When receiving the transaction request of service terminal transmission, corresponding target is determined according to the transaction request Keyword Key, and judge whether the target keywords Key is in occupied state;
If the target keywords Key is not at occupied state, write according to the target keywords Key into block chain Enter corresponding Transaction Information;
When the Transaction Information, which is written, to be completed, Xiang Suoshu service terminal returns to corresponding write-in successful information, and by institute It states the corresponding distributed lock of target keywords Key to distribute to the service terminal, so that the service terminal passes through the distribution Formula lock executes corresponding exclusiveness affairs.
Optionally, described when completion is written in the Transaction Information, Xiang Suoshu service terminal returns to corresponding is written successfully Information, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, so that the service terminal is logical Crossing the step of distributed lock executes corresponding exclusiveness affairs includes:
When the Transaction Information, which is written, to be completed, the business that Transaction Information is written into the target keywords Key is obtained Terminal quantity, and judge whether the service terminal quantity is unique;
If the service terminal quantity is unique, corresponding write-in successful information is returned to the service terminal, and by institute It states the corresponding distributed lock of target keywords Key to distribute to the service terminal, so that the service terminal passes through the distribution Formula lock executes corresponding exclusiveness affairs.
Optionally, described when completion is written in the Transaction Information, it obtains and affairs is written into the target keywords Key The service terminal quantity of data, and after judging the whether unique step of the service terminal quantity, further includes:
If the service terminal quantity is not unique, corresponding be written successfully is returned to the service terminal being initially completed Information, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal being initially completed, for described The service terminal being initially completed executes corresponding exclusiveness affairs by the distributed lock.
Optionally, if it is described not unique in the service terminal quantity, it is returned to the service terminal being initially completed Corresponding write-in successful information, and the corresponding distributed lock of the target keywords Key is distributed to the industry being initially completed Be engaged in terminal, for the service terminal being initially completed by the distributed lock execution corresponding exclusiveness affairs the step of it Afterwards, further includes:
Other service terminals other than to the service terminal being initially completed return to write-in failure information, and will it is described its The terminal iidentification of his service terminal is added to the corresponding list to be allocated of the target keywords Key, in the distributed lock By the corresponding distribution of the distributed lock to other described service terminals after being released.
Optionally, described when receiving the transaction request of service terminal transmission, according to the transaction request It determines corresponding target keywords Key, and judges that the step of whether the target keywords Key is in occupied state includes:
When receiving the transaction request of service terminal transmission, corresponding mesh is determined according to the transaction request Mark keyword Key;
Judge whether target keywords Key described in block chain is existing, to judge whether the target keywords Key locates In occupied state;
If the target keywords Key is in occupied state, corresponding acquisition lock is returned to service terminal and is unsuccessfully prompted.
Optionally, described when completion is written in the Transaction Information, Xiang Suoshu service terminal returns to corresponding is written successfully Information, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, so that the service terminal is logical It crosses after the step of distributed lock executes corresponding exclusiveness affairs, further includes:
It obtains the service terminal and holds whether the time is more than pre- to the time of holding of the distributed lock, and described in judgement If time threshold;
If described hold the time more than preset time threshold, force to recycle the distributed lock, to discharge the business Lock resource of the terminal to the distributed lock.
Optionally, described when receiving the transaction request of service terminal transmission, according to the transaction request It determines corresponding target keywords Key, and judges that the step of whether the target keywords Key is in occupied state specifically includes:
When receiving the transaction request of service terminal transmission, the corresponding user identity letter of the service terminal is obtained Breath, and judge whether the subscriber identity information has the corresponding issued transaction permission of the transaction request;
If the subscriber identity information has the corresponding issued transaction permission of the transaction request, according to the thing Business processing request determines corresponding target keywords Key, and judges whether the target keywords Key is in occupied state;
If the subscriber identity information does not have the corresponding issued transaction permission of the transaction request, to business end End returns to corresponding lack of competence prompt.
In addition, to achieve the above object, it is described to be based on the present invention also provides a kind of transacter based on block chain The transacter of block chain includes:
Condition judgment module, for receive service terminal transmission transaction request when, according to the office Reason request determines corresponding target keywords Key, and judges whether the target keywords Key is in occupied state;
Data write. module, if occupied state is not at for the target keywords Key, according to the target critical Corresponding Transaction Information is written into block chain by word Key;
Distribution module is locked, for when completion is written in the Transaction Information, Xiang Suoshu service terminal to return to corresponding write-in Successful information, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, so that the business is whole End executes corresponding exclusiveness affairs by the distributed lock.
In addition, to achieve the above object, it is described to be based on the present invention also provides a kind of transaction facility based on block chain The transaction facility of block chain includes processor, memory and is stored on the memory and can be by the processor The transaction processing program based on block chain executed, wherein the transaction processing program based on block chain is held by the processor When row, realize such as the step of the above-mentioned transaction methods based on block chain.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium The transaction processing program based on block chain is stored on storage medium, wherein the transaction processing program based on block chain is located When managing device execution, realize such as the step of the above-mentioned transaction methods based on block chain.
The present invention provides a kind of transaction methods based on block chain, i.e., in the office for receiving service terminal transmission When reason request, corresponding target keywords Key is determined according to the transaction request, and judge that the target keywords Key is It is no to be in occupied state;If the target keywords Key is not at occupied state, according to the target keywords Key to area Corresponding Transaction Information is written in block chain;When the Transaction Information, which is written, to be completed, Xiang Suoshu service terminal returns to corresponding write Enter successful information, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, for the business Terminal executes corresponding exclusiveness affairs by the distributed lock.By the above-mentioned means, the present invention is receiving service terminal Transaction request when, transaction process is controlled and is managed by way of distributed lock so that a certain item provide Source same time in high concurrent can only be gone to execute by a service terminal, to guarantee the order sum number of issued transaction According to uniformity, solve it is existing be easy to produce high concurrent data confusion and conflict the technical issues of.
Detailed description of the invention
Fig. 1 is the hardware configuration signal of the transaction facility based on block chain involved in the embodiment of the present invention Figure;
Fig. 2 is that the present invention is based on the flow diagrams of the transaction methods first embodiment of block chain;
Fig. 3 is that the present invention is based on the flow diagrams of the transaction methods second embodiment of block chain;
Fig. 4 is that the present invention is based on the flow diagrams of the transaction methods 3rd embodiment of block chain;
Fig. 5 is that the present invention is based on the functional block diagrams of the transacter first embodiment of block chain.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The present embodiments relate to the transaction methods based on block chain be mainly used in the affairs based on block chain Processing equipment, being somebody's turn to do the transaction facility based on block chain can be PC, portable computer, mobile terminal etc. with display and place The equipment for managing function.
Referring to Fig.1, Fig. 1 is the hardware knot of the transaction facility based on block chain involved in the embodiment of the present invention Structure schematic diagram.In the embodiment of the present invention, the transaction facility based on block chain may include processor 1001 (such as CPU), Communication bus 1002, user interface 1003, network interface 1004, memory 1005.Wherein, communication bus 1002 is for realizing this Connection communication between a little components;User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard);Network interface 1004 optionally may include standard wireline interface and wireless interface (such as WI-FI interface);It deposits Reservoir 1005 can be high speed RAM memory, be also possible to stable memory (non-volatile memory), such as magnetic Disk storage, memory 1005 optionally can also be the storage device independently of aforementioned processor 1001.
It will be understood by those skilled in the art that hardware configuration shown in Fig. 1 is not constituted to the affairs based on block chain The restriction of processing equipment may include perhaps combining certain components or different components than illustrating more or fewer components Arrangement.
With continued reference to Fig. 1, the memory 1005 in Fig. 1 as a kind of computer readable storage medium may include operation system System, network communication module and the transaction processing program based on block chain.
In Fig. 1, network communication module is mainly used for connecting server, carries out data communication with server;And processor 1001 can call the transaction processing program based on block chain stored in memory 1005, and execute offer of the embodiment of the present invention The transaction methods based on block chain.
The embodiment of the invention provides a kind of transaction methods based on block chain.
It is that the present invention is based on the flow diagrams of the transaction methods first embodiment of block chain referring to Fig. 2, Fig. 2.
In the present embodiment, the transaction methods based on block chain the following steps are included:
Step S10 is determined when receiving the transaction request of service terminal transmission according to the transaction request Corresponding target keywords Key, and judge whether the target keywords Key is in occupied state;
Currently, carrying out data using block chain technology and managing to have begun gradually to be applied to different practical business fields Jing Zhong.In the case where alliance's chain, each mechanism can dispose the block chain application of oneself.But in practical business, need Guarantee that these block chains are applied and can only have one to operate same item resource in synchronization, otherwise can be easy to produce it is high simultaneously The confusion and conflict of data are sent out, traffic affecting operates normally.In this regard, the present invention provides a kind of issued transaction based on block chain Method controls transaction process by way of distributed lock in the transaction request for receiving service terminal System and management, so that a certain item resource same time in high concurrent can only be gone to execute by a service terminal, to protect The order of issued transaction and the uniformity of data are demonstrate,proved, and thus solves the existing confusion and punching for being easy to produce high concurrent data Prominent technical problem.
The present invention is based on the transaction methods of block chain to apply at block chain operation system (block chain business platform), should Each step of transaction methods then can be to be realized by intelligent contract, is previously provided with intelligent conjunction in block chain operation system About, intelligent contract is construed as the set of code and data, deposit in block chain node;Intelligent contract is in time or event Driving under can execute some functions automatically, such as can mutually transmit information between each node, modify the state (account of block chain Family information etc.), and figure spirit it is complete calculate (all things that can be accomplished with Turing machine, it is popular for be exactly general programming language Say all things that can be done) etc..And for each business participant of the block chain operation system, then it can pass through respective business The corresponding block chain node of terminal access, and relevant business operating instructions are sent to the intelligent contract of block chain operation system. Specifically, (being carried out to a certain item resource when a certain business participant needs to execute block chain operation system data write operation Operation), thing can be sent to the intelligent contract of block chain by a certain service terminal (such as PC, laptop, mobile phone, plate) Business processing request.For the transaction request, including the transaction object in need handled.Since block chain bottom uses Be a persistence key value Key-Value database, and to control distribution used in issued transaction process in the present invention Formula lock is to be configured with keyword (Key), therefore the transaction object in the transaction request may include target keywords Key.It, first can be according to the transaction request when block chain operation system (intelligent contract) receives the transaction request It determines corresponding target keywords Key, it is whether existing in block chain then will to inquire target keywords Key;If In the presence of can return to corresponding acquisitions to service terminal at this time and lock and unsuccessfully prompt then it is believed that the target keywords have occupied;And if It is not present, then it is believed that the target keywords are not at occupied state, next step data write operation can be carried out at this time.
Step S20, if the target keywords Key is not at occupied state, according to the target keywords Key to area Corresponding Transaction Information is written in block chain;
In the present embodiment, when judging that target keywords Key is not at occupied state, block chain operation system will basis Corresponding Transaction Information is written into block chain by target keywords Key.It is worth noting that when judging target keywords Key When being not at occupied state, corresponding distributed lock is not distributed to service terminal immediately, but first attempts to carry out data write-in Operation.
Step S30, when the Transaction Information, which is written, to be completed, Xiang Suoshu service terminal, which returns to corresponding be written, successfully to be believed Breath, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, so that the service terminal passes through The distributed lock executes corresponding exclusiveness affairs.
In the present embodiment, when Transaction Information, which is written, to be completed, block chain operation system be can determine the target keywords The service terminal is authorized in the corresponding exclusiveness operation qualification of Key, can be returned and be corresponded to service terminal to this block chain operation system Write-in successful information, and the corresponding distributed lock of target keywords Key is distributed to service terminal, for service terminal Corresponding exclusiveness affairs are executed by the distributed lock.Service terminal can be carried out when receiving the write-in successful information The logical operation of specific affairs.When that operation is complete, which will send corresponding operated to block chain operation system At information, block chain operation system then completes information according to the operation and discharges the distributed lock, so that other service terminals The distributed lock can be reacquired to be operated.
Further, after the step S30, further includes:
It obtains the service terminal and holds whether the time is more than pre- to the time of holding of the distributed lock, and described in judgement If time threshold;
If described hold the time more than preset time threshold, force to recycle the distributed lock, to discharge the business Lock resource of the terminal to the distributed lock.
In the present embodiment, for the distributed lock, a time-out time, i.e. preset time threshold can be preset, such as 2 minutes or 30 minutes etc., the preset time threshold can be correspondingly arranged according to actual transaction type.When service terminal obtains this point When cloth locks and carries out transaction operation, hold time of the service terminal to the distributed lock is counted by timer When.If described hold the time more than the preset time threshold, the transaction operation is remained unfulfilled, then block chain operation system can force Discharge the distributed lock, namely discharge the lock resource, recycle the resource of the distributed lock, and by the distributed lock into Row is redistributed, other problems caused by avoiding resource from occupying for a long time.
The present embodiment provides a kind of transaction methods based on block chain, i.e., in the affairs for receiving service terminal transmission When processing request, corresponding target keywords Key is determined according to the transaction request, and judge the target keywords Key Whether occupied state is in;If the target keywords Key is not at occupied state, according to the target keywords Key to Corresponding Transaction Information is written in block chain;When the Transaction Information, which is written, to be completed, Xiang Suoshu service terminal returns corresponding Successful information is written, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, for the industry Terminal of being engaged in executes corresponding exclusiveness affairs by the distributed lock.By the above-mentioned means, the present invention is receiving business end When the transaction request at end, transaction process is controlled and managed by way of distributed lock, so that a certain item Resource same time in high concurrent can only be gone to execute by a service terminal, thus guarantee issued transaction order and The uniformity of data solves the technical issues of existing confusion and conflict for being easy to produce high concurrent data.
It is that the present invention is based on the flow diagrams of the transaction methods second embodiment of block chain referring to Fig. 3, Fig. 3.
Based on above-mentioned embodiment illustrated in fig. 2, in the present embodiment, the step S30 includes:
Step S31 is obtained and number of transactions is written into the target keywords Key when the Transaction Information, which is written, to be completed According to service terminal quantity, and judge whether the service terminal quantity unique;
In the present embodiment, in order to avoid multiple service terminals occupy the distributed lock, synchronization is caused there are multiple industry Business terminal operates same item resource, data corruption and conflict is caused, in two or more service terminals with regard to same mesh When marking keyword Key progress Transaction Information write operation, an allocation rule is formulated, i.e., is preferentially distributed distributed lock to this at first The service terminal completed is written, in specific embodiment, allocation rule can also be and preferentially distribute distributed lock to initiating at first The service terminal etc. of the time of transaction request, i.e., the allocation rule of the described distributed lock can according to practical business demand into Row setting.Specifically, it when detecting that the Transaction Information write-in is completed, obtains and thing is written into the target keywords Key The service terminal quantity for data of being engaged in judges to carry out whether the service terminal of write-in data manipulation is two to the distributed lock Or it is more than two.
Step S32 returns to corresponding be written to the service terminal and successfully believes if the service terminal quantity is unique Breath, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, so that the service terminal passes through The distributed lock executes corresponding exclusiveness affairs.
In the present embodiment, when determining that only one service terminal carries out write-in data manipulation to the distributed lock, i.e., Directly the corresponding distributed lock of the target keywords Key can be distributed specifically can be to the business to the service terminal Terminal returns to corresponding write-in successful information, that is, the service terminal is notified to request the lock resource success of the distributed lock, Then the corresponding distributed lock of the target keywords Key can be distributed to the service terminal, for the service terminal Corresponding exclusiveness affairs are executed by the distributed lock.
Step S33 is returned corresponding if the service terminal quantity is not unique to the service terminal being initially completed Successful information is written, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal being initially completed, So that the service terminal being initially completed executes corresponding exclusiveness affairs by the distributed lock.
In the present embodiment, if it is determined that the service terminal data are two or more, then need according to default point With rule, the distributed lock is distributed to corresponding service terminal.Specifically, for same resource (same keyword Key), If there are two the service terminals of above (herein " more than " include this number) to need to carry out data write-in with regard to same keyword Key simultaneously Operation, block chain operation system can return to write-in successful information to the service terminal for being initially completed data write operation, and will divide The service terminal of completion is written to this at first for cloth lock distribution.
Further, after the step S33, further includes:
Other service terminals other than to the service terminal being initially completed return to write-in failure information, and will it is described its The terminal iidentification of his service terminal is added to the corresponding list to be allocated of the target keywords Key, in the distributed lock By the corresponding distribution of the distributed lock to other described service terminals after being released.
In the present embodiment, and for the non-service terminal being initially completed, that is, other other than the service terminal being initially completed Service terminal, then can to its return write-in failure information, to illustrate that the distributed lock has been obtained by other service terminals, at this time this A little non-service terminals being initially completed can be attempted to operate another resource (another keyword), or wait the distribution Formula lock is released.
It is that the present invention is based on the flow diagrams of the transaction methods 3rd embodiment of block chain referring to Fig. 4, Fig. 4.
Based on above-mentioned embodiment illustrated in fig. 2, in the present embodiment, the step S10 is specifically included:
Step S11 is determined when receiving the transaction request of service terminal transmission according to the transaction request Corresponding target keywords Key;
In the present embodiment, since block chain bottom uses the key value Key-Value database an of persistence, and originally It to control distributed lock used in issued transaction process is configured with keyword (Key) in invention, therefore the office Transaction object in reason request may include target keywords Key.Block chain operation system (intelligent contract) receives the affairs When processing request, corresponding target keywords Key should be determined according to the transaction request first, then will inquire the target Whether keyword Key is existing in block chain.
Step S12 judges whether target keywords Key described in block chain is existing, to judge the target keywords Whether Key is in occupied state;
In the present embodiment, if existing, it is believed that the target keywords have occupied, and if it does not exist, then it is believed that it should Target keywords are not at occupied state.As a result, can by judging whether target keywords Key described in block chain existing, To judge whether the target keywords Key is in occupied state.
Step S13 returns to corresponding acquisition lock to service terminal if the target keywords Key is in occupied state Failure prompts.
In the present embodiment, if existing, it is believed that the target keywords have occupied, it at this time can be to service terminal return pair The acquisition lock answered unsuccessfully prompts;And if it does not exist, then it is believed that the target keywords are not at occupied state, can carry out down at this time One step data write operation.
Further, the step S10 is specifically included:
When receiving the transaction request of service terminal transmission, the corresponding user identity letter of the service terminal is obtained Breath, and judge whether the subscriber identity information has the corresponding issued transaction permission of the transaction request;
If the subscriber identity information has the corresponding issued transaction permission of the transaction request, according to the thing Business processing request determines corresponding target keywords Key, and judges whether the target keywords Key is in occupied state;
If the subscriber identity information does not have the corresponding issued transaction permission of the transaction request, to business end End returns to corresponding lack of competence prompt.
In the present embodiment, block chain operation system, can be first to carrying out the operation when receiving the transaction request User carries out Authority Verification, that is, obtains the corresponding subscriber identity information of the service terminal, such as account information or user name, The subscriber identity information permission user information with issued transaction permission corresponding with the transaction request is carried out It compares, to judge whether the user has the corresponding issued transaction permission of the transaction request, such as data modification/deletion Permission.Corresponding target keywords Key is determined according to the transaction request if so, just will do it, and judges that the target is closed Whether key word Key is in the operation of occupied state.Otherwise corresponding lack of competence prompt will be returned to service terminal;Certainly for not Same affairs, operating right may have difference.
In addition, the embodiment of the present invention also provides a kind of transacter based on block chain.
It is that the present invention is based on the signals of the functional module of the transacter first embodiment of block chain referring to Fig. 5, Fig. 5 Figure.
In the present embodiment, the transacter based on block chain includes:
Condition judgment module 10, for receive service terminal transmission transaction request when, according to the affairs Processing request determines corresponding target keywords Key, and judges whether the target keywords Key is in occupied state;
Data write. module 20 closes if being not at occupied state for the target keywords Key according to the target Corresponding Transaction Information is written into block chain by key word Key;
Distribution module 30 is locked, for when completion is written in the Transaction Information, Xiang Suoshu service terminal to return to corresponding writes Enter successful information, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, for the business Terminal executes corresponding exclusiveness affairs by the distributed lock.
Further, the transacter based on block chain includes:
Time judgment module is handled, for obtaining the service terminal to the time of holding of the distributed lock, and is judged It is described to hold whether the time is more than preset time threshold;
Overtime resource release module forces described point of recycling if holding the time more than preset time threshold for described Cloth lock, to discharge the service terminal to the lock resource of the distributed lock.
Further, the lock distribution module 30 specifically includes:
Terminal quantity judging unit, for obtaining to the target keywords Key when completion is written in the Transaction Information The service terminal quantity of middle write-in Transaction Information, and judge whether the service terminal quantity is unique;
First allocation unit returns to corresponding write to the service terminal if unique for the service terminal quantity Enter successful information, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, for the business Terminal executes corresponding exclusiveness affairs by the distributed lock.
Second allocation unit, if not unique for the service terminal quantity, to the service terminal being initially completed Corresponding write-in successful information is returned, and the corresponding distributed lock of the target keywords Key is distributed to described and is initially completed Service terminal, execute corresponding exclusiveness affairs so that the service terminal being initially completed passes through the distributed lock.
Further, the lock distribution module 30 is also used to:
Other service terminals other than to the service terminal being initially completed return to write-in failure information, and will it is described its The terminal iidentification of his service terminal is added to the corresponding list to be allocated of the target keywords Key, in the distributed lock By the corresponding distribution of the distributed lock to other described service terminals after being released.
Further, the condition judgment module 10 specifically includes:
Keyword determination unit, for receive service terminal transmission transaction request when, according to the affairs Processing request determines corresponding target keywords Key;
Judging unit is occupied, for judging whether target keywords Key described in block chain is existing, to judge the mesh Whether mark keyword Key is in occupied state;
Failure prompt unit is returned to service terminal and is corresponded to if being in occupied state for the target keywords Key Acquisition lock unsuccessfully prompt.
Further, the condition judgment module 10 is also used to:
When receiving the transaction request of service terminal transmission, the corresponding user identity letter of the service terminal is obtained Breath, and judge whether the subscriber identity information has the corresponding issued transaction permission of the transaction request;
If the subscriber identity information has the corresponding issued transaction permission of the transaction request, according to the thing Business processing request determines corresponding target keywords Key, and judges whether the target keywords Key is in occupied state;
If the subscriber identity information does not have the corresponding issued transaction permission of the transaction request, to business end End returns to corresponding lack of competence prompt.
Wherein, modules and the above-mentioned issued transaction based on block chain in the above-mentioned transacter based on block chain Each step is corresponding in embodiment of the method, and function and realization process no longer repeat one by one here.
In addition, the embodiment of the present invention also provides a kind of computer readable storage medium.
The transaction processing program based on block chain is stored on computer readable storage medium of the present invention, wherein described be based on When the transaction processing program of block chain is executed by processor, the step such as the above-mentioned transaction methods based on block chain is realized Suddenly.
Wherein, the transaction processing program based on block chain, which is performed realized method, can refer to that the present invention is based on blocks Each embodiment of the transaction methods of chain, details are not described herein again.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the system that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or system institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or system.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone, Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of transaction methods based on block chain, which is characterized in that the transaction methods packet based on block chain Include following steps:
When receiving the transaction request of service terminal transmission, corresponding target critical is determined according to the transaction request Word Key, and judge whether the target keywords Key is in occupied state;
If the target keywords Key is not at occupied state, be written according to the target keywords Key into block chain pair The Transaction Information answered;
When the Transaction Information, which is written, to be completed, Xiang Suoshu service terminal returns to corresponding write-in successful information, and by the mesh The corresponding distributed lock of mark keyword Key is distributed to the service terminal, so that the service terminal passes through the distributed lock Execute corresponding exclusiveness affairs.
2. the transaction methods as described in claim 1 based on block chain, which is characterized in that described to work as the Transaction Information When write-in is completed, Xiang Suoshu service terminal returns to corresponding write-in successful information, and by corresponding point of the target keywords Key The distribution of cloth lock is to the service terminal, so that the service terminal executes corresponding exclusiveness affairs by the distributed lock The step of include:
When the Transaction Information, which is written, to be completed, the service terminal that Transaction Information is written into the target keywords Key is obtained Quantity, and judge whether the service terminal quantity is unique;
If the service terminal quantity is unique, corresponding write-in successful information is returned to the service terminal, and by the mesh The corresponding distributed lock of mark keyword Key is distributed to the service terminal, so that the service terminal passes through the distributed lock Execute corresponding exclusiveness affairs.
3. the transaction methods as claimed in claim 2 based on block chain, which is characterized in that described to work as the Transaction Information When write-in is completed, the service terminal quantity that Transaction Information is written into the target keywords Key is obtained, and judge the business After the whether unique step of terminal quantity, further includes:
If the service terminal quantity is not unique, corresponding be written is returned to the service terminal being initially completed and is successfully believed Breath, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal being initially completed, for it is described most The service terminal first completed executes corresponding exclusiveness affairs by the distributed lock.
4. the transaction methods as claimed in claim 3 based on block chain, which is characterized in that if described whole in the business It holds quantity not unique, then returns to corresponding write-in successful information to the service terminal being initially completed, and the target is closed The corresponding distributed lock of key word Key is distributed to the service terminal being initially completed, for the service terminal being initially completed After the step of executing corresponding exclusiveness affairs by the distributed lock, further includes:
Other service terminals other than to the service terminal being initially completed return to write-in failure information, and will other described industry The terminal iidentification of business terminal is added to the corresponding list to be allocated of the target keywords Key, to be released in the distributed lock By the corresponding distribution of the distributed lock to other described service terminals after putting.
5. the transaction methods as described in claim 1 based on block chain, which is characterized in that described to receive business end When holding the transaction request sent, corresponding target keywords Key is determined according to the transaction request, and judge the mesh Mark that the step of whether keyword Key is in occupied state includes:
When receiving the transaction request of service terminal transmission, determine that corresponding target is closed according to the transaction request Key word Key;
Judge whether target keywords Key described in block chain is existing, to judge whether the target keywords Key is in Occupied state;
If the target keywords Key is in occupied state, corresponding acquisition lock is returned to service terminal and is unsuccessfully prompted.
6. the transaction methods as described in claim 1 based on block chain, which is characterized in that described to work as the Transaction Information When write-in is completed, Xiang Suoshu service terminal returns to corresponding write-in successful information, and by corresponding point of the target keywords Key The distribution of cloth lock is to the service terminal, so that the service terminal executes corresponding exclusiveness affairs by the distributed lock The step of after, further includes:
The service terminal is obtained to the time of holding of the distributed lock, and when whether hold the time described in judging be more than default Between threshold value;
If described hold the time more than preset time threshold, force to recycle the distributed lock, to discharge the service terminal To the lock resource of the distributed lock.
7. the transaction methods based on block chain as described in claim 1 to 6 any one, which is characterized in that it is described When receiving the transaction request of service terminal transmission, corresponding target keywords Key is determined according to the transaction request, And judge that the step of whether the target keywords Key is in occupied state specifically includes:
When receiving the transaction request of service terminal transmission, the corresponding subscriber identity information of the service terminal is obtained, And judge whether the subscriber identity information has the corresponding issued transaction permission of the transaction request;
If the subscriber identity information has the corresponding issued transaction permission of the transaction request, according to the office Reason request determines corresponding target keywords Key, and judges whether the target keywords Key is in occupied state;
If the subscriber identity information does not have the corresponding issued transaction permission of the transaction request, returned to service terminal Return corresponding lack of competence prompt.
8. a kind of transacter based on block chain, which is characterized in that the transacter packet based on block chain It includes:
Condition judgment module, for being asked according to the issued transaction when receiving the transaction request of service terminal transmission It asks and determines corresponding target keywords Key, and judge whether the target keywords Key is in occupied state;
Data write. module, if occupied state is not at for the target keywords Key, according to the target keywords Corresponding Transaction Information is written into block chain by Key;
Distribution module is locked, for when completion is written in the Transaction Information, Xiang Suoshu service terminal to return to corresponding is written successfully Information, and the corresponding distributed lock of the target keywords Key is distributed to the service terminal, so that the service terminal is logical It crosses the distributed lock and executes corresponding exclusiveness affairs.
9. a kind of transaction facility based on block chain, which is characterized in that the transaction facility packet based on block chain It includes processor, memory and is stored in the affairs based on block chain that can be executed on the memory and by the processor Processing routine, wherein when the transaction processing program based on block chain is executed by the processor, realize such as claim 1 to The step of transaction methods based on block chain described in any one of 7.
10. a kind of computer readable storage medium, which is characterized in that be stored on the computer readable storage medium based on area The transaction processing program of block chain, wherein realizing such as right when the transaction processing program based on block chain is executed by processor It is required that the step of transaction methods based on block chain described in any one of 1 to 7.
CN201910376443.3A 2019-05-07 2019-05-07 Transaction methods, device, equipment and storage medium based on block chain Pending CN110231979A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910376443.3A CN110231979A (en) 2019-05-07 2019-05-07 Transaction methods, device, equipment and storage medium based on block chain
PCT/CN2019/121996 WO2020224249A1 (en) 2019-05-07 2019-11-29 Blockchain-based transaction processing method, device and apparatus, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910376443.3A CN110231979A (en) 2019-05-07 2019-05-07 Transaction methods, device, equipment and storage medium based on block chain

Publications (1)

Publication Number Publication Date
CN110231979A true CN110231979A (en) 2019-09-13

Family

ID=67860425

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910376443.3A Pending CN110231979A (en) 2019-05-07 2019-05-07 Transaction methods, device, equipment and storage medium based on block chain

Country Status (2)

Country Link
CN (1) CN110231979A (en)
WO (1) WO2020224249A1 (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110597923A (en) * 2019-09-29 2019-12-20 腾讯云计算(北京)有限责任公司 Block chain resource management method, device and storage medium
CN110888858A (en) * 2019-10-29 2020-03-17 北京奇艺世纪科技有限公司 Database operation method and device, storage medium and electronic device
CN111190913A (en) * 2019-12-30 2020-05-22 联动优势(北京)数字科技有限公司 Distributed lock implementation method and system
CN111209593A (en) * 2020-01-10 2020-05-29 杭州溪塔科技有限公司 Block chain-based distributed lock processing method, related device and electronic equipment
CN111210270A (en) * 2020-01-02 2020-05-29 广州虎牙科技有限公司 Business processing method and device, service cluster, computer equipment and storage medium
CN111897646A (en) * 2020-08-13 2020-11-06 银联商务股份有限公司 Asynchronous distributed lock implementation method and device, storage medium and electronic equipment
WO2020224249A1 (en) * 2019-05-07 2020-11-12 深圳壹账通智能科技有限公司 Blockchain-based transaction processing method, device and apparatus, and storage medium
CN112486696A (en) * 2020-12-11 2021-03-12 上海悦易网络信息技术有限公司 Method and equipment for acquiring distributed lock
CN113239059A (en) * 2021-05-28 2021-08-10 北京达佳互联信息技术有限公司 Switching method and device of distributed lock, server and storage medium
CN113806384A (en) * 2021-08-19 2021-12-17 紫光云(南京)数字技术有限公司 Method for allocating incremental integer data based on redis

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113205417B (en) * 2021-04-27 2022-10-25 华东师范大学 Alliance chain oriented transaction parallel processing method and system
CN113781230A (en) * 2021-09-24 2021-12-10 支付宝(杭州)信息技术有限公司 Transaction processing method and device based on block chain

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170220619A1 (en) * 2015-03-13 2017-08-03 Huawei Technologies Co., Ltd. Concurrency Control Method and Apparatus
CN107111596A (en) * 2015-12-14 2017-08-29 华为技术有限公司 The method of lock management, lock server and client in a kind of cluster
US20170338957A1 (en) * 2016-05-23 2017-11-23 Accenture Global Solutions Limited Rewritable blockchain
CN108769150A (en) * 2018-05-14 2018-11-06 百度在线网络技术(北京)有限公司 Data processing method, device, clustered node and the storage medium of block chain network
CN108804112A (en) * 2018-05-22 2018-11-13 上海分布信息科技有限公司 A kind of block chain falls account processing method and system
CN109684307A (en) * 2018-12-26 2019-04-26 百度在线网络技术(北京)有限公司 A kind of date storage method, device, equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10924283B2 (en) * 2017-06-12 2021-02-16 Cisco Technology, Inc. Dynamically-changing identity for IoT devices with blockchain validation
CN108920257B (en) * 2018-06-25 2021-09-10 百度在线网络技术(北京)有限公司 Transaction processing method, device, equipment and storage medium
CN109213791A (en) * 2018-08-22 2019-01-15 北京京东尚科信息技术有限公司 Data processing method, block chain node, system and computer readable storage medium
CN109165224B (en) * 2018-08-24 2021-02-19 东北大学 Indexing method for key words on block chain database
CN110231979A (en) * 2019-05-07 2019-09-13 深圳壹账通智能科技有限公司 Transaction methods, device, equipment and storage medium based on block chain

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170220619A1 (en) * 2015-03-13 2017-08-03 Huawei Technologies Co., Ltd. Concurrency Control Method and Apparatus
CN107111596A (en) * 2015-12-14 2017-08-29 华为技术有限公司 The method of lock management, lock server and client in a kind of cluster
US20170338957A1 (en) * 2016-05-23 2017-11-23 Accenture Global Solutions Limited Rewritable blockchain
CN108769150A (en) * 2018-05-14 2018-11-06 百度在线网络技术(北京)有限公司 Data processing method, device, clustered node and the storage medium of block chain network
CN108804112A (en) * 2018-05-22 2018-11-13 上海分布信息科技有限公司 A kind of block chain falls account processing method and system
CN109684307A (en) * 2018-12-26 2019-04-26 百度在线网络技术(北京)有限公司 A kind of date storage method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
DAZOU1: "redis分布式锁原理与实现", 《HTTPS://BLOG.CSDN.NET/DAZOU1/ARTICLE/DETAILS/88088223/》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020224249A1 (en) * 2019-05-07 2020-11-12 深圳壹账通智能科技有限公司 Blockchain-based transaction processing method, device and apparatus, and storage medium
CN110597923A (en) * 2019-09-29 2019-12-20 腾讯云计算(北京)有限责任公司 Block chain resource management method, device and storage medium
CN110597923B (en) * 2019-09-29 2024-02-02 腾讯云计算(北京)有限责任公司 Block chain resource management method, device and storage medium
CN110888858A (en) * 2019-10-29 2020-03-17 北京奇艺世纪科技有限公司 Database operation method and device, storage medium and electronic device
CN111190913A (en) * 2019-12-30 2020-05-22 联动优势(北京)数字科技有限公司 Distributed lock implementation method and system
CN111210270A (en) * 2020-01-02 2020-05-29 广州虎牙科技有限公司 Business processing method and device, service cluster, computer equipment and storage medium
CN111209593A (en) * 2020-01-10 2020-05-29 杭州溪塔科技有限公司 Block chain-based distributed lock processing method, related device and electronic equipment
CN111897646A (en) * 2020-08-13 2020-11-06 银联商务股份有限公司 Asynchronous distributed lock implementation method and device, storage medium and electronic equipment
CN112486696A (en) * 2020-12-11 2021-03-12 上海悦易网络信息技术有限公司 Method and equipment for acquiring distributed lock
CN113239059A (en) * 2021-05-28 2021-08-10 北京达佳互联信息技术有限公司 Switching method and device of distributed lock, server and storage medium
CN113806384A (en) * 2021-08-19 2021-12-17 紫光云(南京)数字技术有限公司 Method for allocating incremental integer data based on redis

Also Published As

Publication number Publication date
WO2020224249A1 (en) 2020-11-12

Similar Documents

Publication Publication Date Title
CN110231979A (en) Transaction methods, device, equipment and storage medium based on block chain
US11880712B1 (en) Resource tolerations and taints
CN100371899C (en) Resource management method and device, resource management program, and storage medium
CN106204217A (en) The methods, devices and systems of resource numerical value transfer, the method and apparatus of resource numerical value transfer request
CN102236764B (en) Method and monitoring system for Android system to defend against desktop information attack
US7328134B1 (en) Enterprise integration test tool
CN106296142A (en) A kind of method and system of pay this extra Channel Selection
CN110008665B (en) Authority control method and device for blockchain
US7747750B1 (en) Method for reserving resources in a storage area network with selective capabilities
CN110362409A (en) Based on a plurality of types of resource allocation methods, device, equipment and storage medium
CN110188103A (en) Data account checking method, device, equipment and storage medium
CN108492005A (en) Project data processing method, device, computer equipment and storage medium
CN111338645B (en) Method and device for creating system contract
CN105468619A (en) Resource distribution method and device used for database connection pool
CN115328752A (en) Cluster simulation method and system for Kubernetes control plane test
CN111045725B (en) Control method and device of code management system and storage medium
CN107391539B (en) Transaction processing method, server and storage medium
CN112084021A (en) Interface configuration method, device and equipment of education system and readable storage medium
CN102708416A (en) Method, device and system for ordering business by users
CN113094427A (en) Data management method and device based on block chain
CN110308968A (en) Maintain host and the consistent method, apparatus of container group #, equipment and medium
CN110069730A (en) Front end page display control method, device, equipment and readable storage medium storing program for executing
CN108989418A (en) A kind of resource amount method of mixed cloud object storage common authentication
CN111988383B (en) Method and device for verifying application opening micro-service treatment condition
CN110191133A (en) CDN server use right management method, equipment and computer readable storage medium

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190913

WD01 Invention patent application deemed withdrawn after publication