Invention content
The bill processing method that the main purpose of the present invention is to provide a kind of based on block chain database, system and readable
Storage medium, it is intended to which existing block data processing mode efficiency is low, the big technical problem of resource consumption.
To achieve the above object, a kind of bill processing method based on block chain database provided by the invention, is applied to
Data accounting system, the data accounting system are equipped with multiple accounting nodes, the bill processing based on block chain database
Method includes the following steps:
When receiving the Transaction Information of client transmission, local reconciliation operation is executed, reconciliation result is obtained;
When reconciliation result is that account book is consistent, the Transaction Information is broadcasted to block chain network, for block link network
Other accounting nodes in network initiate common recognition;
The reconciliation of other accounting nodes feedbacks is received as a result, simultaneously according to common recognition condition is preset, obtains accounting results;
The accounting results are issued to client, wherein the accounting results are included at least to keep accounts successfully or keep accounts and be lost
It loses.
Preferably, described when receiving the Transaction Information of client transmission, local reconciliation operation is executed, reconciliation knot is obtained
Fruit includes:
When receiving the Transaction Information of client transmission, determine that the client is transaction originating end and determines that transaction is initiated
The transaction id at end;
In local block data library, public key corresponding with the transaction transaction id of originating end is searched, for described
The private key of Transaction Information is verified;
When the public key is consistent with the private key, the transaction content of the Transaction Information is understood, obtains transaction acceptance end
Transaction id and transaction amount;
The transaction id of transaction id and the transaction acceptance end based on the transaction originating end, obtains local block data library
The account balance of middle record;
Based on the account balance and the transaction amount, judge whether the revenue and expenditure of both parties is equal;
If revenue and expenditure is equal, reconciliation result is that account book is consistent;
If revenue and expenditure is unequal, reconciliation result is that account book is inconsistent.
Preferably, the reconciliation for receiving other accounting nodes feedbacks is kept accounts as a result, simultaneously according to common recognition condition is preset
As a result include:
The reconciliation of other accounting nodes feedback is received as a result, simultaneously cumulative calculation quantity;
The sum in block chain network in online accounting nodes and current adjustment value are obtained, section is received to calculate
Points;
Whether the quantity for monitoring the cumulative calculation in preset time is greater than or equal to the receiving node number;
If the quantity of cumulative calculation is greater than or equal to the receiving node number in preset time, based on the other of reception
The participation of each accounting nodes calculates consensus value;
Judge whether the consensus value is greater than or equal to the receiving node number;
If the consensus value is greater than or equal to the receiving node number, it is determined that common recognition is reached an agreement, and determines book keeping operation knot
Fruit is to keep accounts successfully;
If the consensus value is less than the receiving node number, it is determined that common recognition is inconsistent, and determines that accounting results are book keeping operation
Failure;
If the quantity of cumulative calculation is less than the receiving node number in preset time, it is determined that network waits for time-out, and
Determine that accounting results are that book keeping operation fails.
Preferably, the bill processing method based on block chain database further includes:
When common recognition is reached an agreement, based on the Transaction Information and this accounting nodes known together is participated in, update is local
Transaction data in block data library.
Preferably, the bill processing method based on block chain database further includes:
When accounting results are book keeping operation failure, the prompt message of failure cause is sent to client, so that user looks into
It sees.
Preferably, the bill processing method based on block chain database further includes:
When receiving the inquiry request of client transmission, the inquiry operation of local block data is executed, and is looked into described
It askes request broadcast to block chain network to know together, for determining query result, wherein the query result includes at least transaction
It is detailed;
When common recognition is completed and is reached an agreement, query result is returned to client;
When common recognition complete and it is inconsistent when, to client issue inquiry failure and common recognition failure prompt message;
When waiting for the duration of common recognition completion to be more than preset duration, issues inquiry failure to client and network waits for and surpassing
When prompt message.
In addition, to achieve the above object, the present invention also provides a kind of data accounting system, the data accounting system includes
Multiple accounting nodes, and the client communicated to connect is established with the accounting nodes, the accounting nodes include processor, deposit
Reservoir and it is stored in the bill processing routine that can be run on the memory and on the processor, the bill processing routine
The step of the bill processing method based on block chain database as described in any one of above-mentioned is realized when being executed by the processor
Suddenly.
Preferably, the client is used for:
Based on preparatory function option, editing transaction content, and the transaction content is encrypted using the private key to prestore
And signature, obtain Transaction Information;
Based on the Transaction Information, transaction book keeping operation is initiated to block chain network, for any book keeping operation in block chain network
Node is received and is handled.
Preferably, the client is additionally operable to:
Based on preparatory function option, inquiry instruction is edited, wherein the inquiry instruction is bright including at least transaction id, transaction
Thin critical field;
Based on the inquiry instruction, inquiry request is initiated to block chain network, for any book keeping operation in block chain network
Node is received and is handled.
In addition, to achieve the above object, it is described computer-readable the present invention also provides a kind of computer readable storage medium
It is stored with bill processing routine on storage medium, is realized when the bill processing routine is executed by processor as any one of above-mentioned
The step of described bill processing method based on block chain database.
Bill processing method proposed by the present invention based on block chain database is applied to the number equipped with multiple accounting nodes
According to accounting system, when one of accounting nodes receive the Transaction Information of client transmission, local reconciliation operation is first carried out,
Reconciliation is obtained as a result, and when reconciliation result is that account book is consistent, Transaction Information is broadcasted to block chain network, for block chain
Other accounting nodes in network initiate common recognition, then receive the reconciliation of other accounting nodes feedbacks as a result, simultaneously basis is default altogether
Knowledge condition, obtains accounting results, to which the result for success or failure of keeping accounts is issued to client.The present invention passes through block chain skill
Art realizes that bill handles more safe and reliable advantageous effect, while reducing resource consumption, improves treatment effeciency, and reduce user
Wait for the time of trade confirmation.
Specific implementation mode
It should be appreciated that described herein, specific examples are only used to explain the present invention, is not intended to limit the present invention.
Referring to Fig.1, Fig. 1 is the structural schematic diagram for the accounting nodes running environment that the embodiment of the present invention is related to.
Accounting nodes of the embodiment of the present invention can be pocket computer, and can also be server, virtual machine facility etc. has
The equipment for receiving data, accessing network, initiating the functions such as common recognition.
As shown in Figure 1, the accounting nodes 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 the connection communication between these components.
User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), and network interface 1004 can
Choosing may include standard wireline interface and wireless interface (such as WI-FI interface).Memory 1005 can be high-speed RAM storage
Device can also be stable memory (non-volatile memory), such as magnetic disk storage.Memory 1005 is optional
It can also be the storage device independently of aforementioned processor 1001.
Book keeping operation is saved it will be understood by those skilled in the art that the hardware configuration of accounting nodes shown in Fig. 1 is not constituted
The restriction of point may include either combining certain components or different components arrangement than illustrating more or fewer components.
As shown in Figure 1, as may include operating system, net in a kind of memory 1005 of computer readable storage medium
Network communication module, Subscriber Interface Module SIM and computer program.Wherein, operating system is management and control accounting nodes and software
The program of resource supports the operation of bill processing routine and other softwares and/or program.
In the hardware configuration of accounting nodes shown in Fig. 1, network interface 1004 is mainly used for accessing network;User interface
1003, which are mainly used for detecting, confirms Command And Edit instruction etc..And processor 1001 can be used in calling memory 1005 storing
Bill processing routine, and execute following operation:
When receiving the Transaction Information of client transmission, local reconciliation operation is executed, reconciliation result is obtained;
When reconciliation result is that account book is consistent, the Transaction Information is broadcasted to block chain network, for block link network
Other accounting nodes in network initiate common recognition;
The reconciliation of other accounting nodes feedbacks is received as a result, simultaneously according to common recognition condition is preset, obtains accounting results;
The accounting results are issued to client, wherein the accounting results are included at least to keep accounts successfully or keep accounts and be lost
It loses.
Further, the accounting nodes call the bill stored in memory 1005 to handle journey by processor 1001
Sequence, to execute operations described below:
When receiving the Transaction Information of client transmission, determine that the client is transaction originating end and determines that transaction is initiated
The transaction id at end;
In local block data library, public key corresponding with the transaction transaction id of originating end is searched, for described
The private key of Transaction Information is verified;
When the public key is consistent with the private key, the transaction content of the Transaction Information is understood, obtains transaction acceptance end
Transaction id and transaction amount;
The transaction id of transaction id and the transaction acceptance end based on the transaction originating end, obtains local block data library
The account balance of middle record;
Based on the account balance and the transaction amount, judge whether the revenue and expenditure of both parties is equal;
If revenue and expenditure is equal, reconciliation result is that account book is consistent;
If revenue and expenditure is unequal, reconciliation result is that account book is inconsistent.
Further, the accounting nodes call the bill stored in memory 1005 to handle journey by processor 1001
Sequence, to execute operations described below:
The reconciliation of other accounting nodes feedback is received as a result, simultaneously cumulative calculation quantity;
The sum in block chain network in online accounting nodes and current adjustment value are obtained, section is received to calculate
Points;
Whether the quantity for monitoring the cumulative calculation in preset time is greater than or equal to the receiving node number;
If the quantity of cumulative calculation is greater than or equal to the receiving node number in preset time, based on the other of reception
The participation of each accounting nodes calculates consensus value;
Judge whether the consensus value is greater than or equal to the receiving node number;
If the consensus value is greater than or equal to the receiving node number, it is determined that common recognition is reached an agreement, and determines book keeping operation knot
Fruit is to keep accounts successfully;
If the consensus value is less than the receiving node number, it is determined that common recognition is inconsistent, and determines that accounting results are book keeping operation
Failure;
If the quantity of cumulative calculation is less than the receiving node number in preset time, it is determined that network waits for time-out, and
Determine that accounting results are that book keeping operation fails.
Further, the accounting nodes call the bill stored in memory 1005 to handle journey by processor 1001
Sequence, to execute operations described below:
When common recognition is reached an agreement, based on the Transaction Information and this accounting nodes known together is participated in, update is local
Transaction data in block data library.
Further, the accounting nodes call the bill stored in memory 1005 to handle journey by processor 1001
Sequence, to execute operations described below:
When accounting results are book keeping operation failure, the prompt message of failure cause is sent to client, so that user looks into
It sees.
Further, the accounting nodes call the bill stored in memory 1005 to handle journey by processor 1001
Sequence, to execute operations described below:
When receiving the inquiry request of client transmission, the inquiry operation of local block data is executed, and is looked into described
It askes request broadcast to block chain network to know together, for determining query result, wherein the query result includes at least transaction
It is detailed;
When common recognition is completed and is reached an agreement, query result is returned to client;
When common recognition complete and it is inconsistent when, to client issue inquiry failure and common recognition failure prompt message;
When waiting for the duration of common recognition completion to be more than preset duration, issues inquiry failure to client and network waits for and surpassing
When prompt message.
The present invention also provides a kind of data accounting systems.
It is the high-level schematic functional block diagram of one embodiment of data accounting system of the present invention with reference to Fig. 2, Fig. 2.
In the present embodiment, data accounting system includes multiple accounting nodes 10 and further includes establishing to lead to accounting nodes 10
Believe the client 20 of connection.Data accounting system preferably uses distributed deployment framework and is deployed to multiple independent each book keeping operation sections
Point 10, each accounting nodes 10 can establish independent communication connection with client 20 respectively, to realize that client 20 is visited rapidly
It asks network and transmission data, such as initiates transaction book keeping operation or Transaction Inquiries, realize information exchange.
Further, client 20 is for performing the following operations:
Step A1 is based on preparatory function option, editing transaction content, and is added to transaction content using the private key to prestore
Close and signature, obtains Transaction Information;
Step A2 is based on Transaction Information, transaction book keeping operation is initiated to block chain network, for any note in block chain network
Account node is received and is handled;Or
Step B1 is based on preparatory function option, edits inquiry instruction, wherein inquiry instruction includes at least transaction id, transaction
Detailed critical field;
Step B2 is based on inquiry instruction, inquiry request is initiated to block chain network, for any note in block chain network
Account node is received and is handled.
In the present embodiment, client is equipped with corresponding software, which is provided with function choosing-item, and function choosing-item is real
The entrance of existing application function, generally programmer pre-set.Each function choosing-item respective operations instruction, can be single
It can also be multiple combinations, the operational order for needing to operate selected to which editor obtains user.It should be noted that user is online
When upper progress funds transaction, it is necessary first to open up a user account, that is, transaction id or account address, and on this basis
Realize funds transaction.For example Zhang San initiates a transaction to Li Si, transaction content is that Zhang San transfers accounts 100 to Li Si, and Zhang San is branch
The side of going out, Li Si are recipient (recipient can be multiple), and Zhang San is obtained with the transaction amount 100 of this transaction of the private key encryption of oneself
To a string of encrypted characters, then use the content of this transaction of private key signature to get to Transaction Information again.It is initiated to block chain network
Transaction book keeping operation, i.e., be sent to any accounting nodes in block chain network by Transaction Information, receive the book keeping operation section of the Transaction Information
The operations such as the i.e. executable reconciliation of point.Further, encryption method is consistent with existing encryption method, preferably hash algorithm
(hash), including MD5, SHA2 etc. so that Transaction Information can not be distorted arbitrarily, ensure reliability and the safety of data.
In the present embodiment, user can also real-time query oneself account, the critical field of transaction details such as in a period of time
Transaction details, current balance, history produce or take in it is how many etc..For example the inquiry initiated to Zhang San's account is specifically inquired
Instruction includes transaction id and newest 10 transaction of inquiry of Zhang San.Inquiry request is initiated to block chain network, i.e., is referred to inquiry
Any accounting nodes being sent in block chain network are enabled, the behaviour such as the i.e. executable inquiry of accounting nodes of the inquiry instruction are received
Make.
Further, client also receives accounting nodes after initiating transaction book keeping operation or inquiry request to block chain network
The information of return, such as return book keeping operation successful information or query result.
Hardware configuration based on above-mentioned accounting nodes and data accounting system proposes that the present invention is based on block chain databases
Each embodiment of bill processing method.
It is that the present invention is based on the signals of the flow of one embodiment of bill processing method of block chain database with reference to Fig. 3, Fig. 3
Figure.
In the present embodiment, the bill processing method based on block chain database includes the following steps:
Step S10 executes local reconciliation operation, obtains reconciliation result when receiving the Transaction Information of client transmission;
In the present embodiment, block chain is the calculating such as Distributed Storage, point-to-point transmission, common recognition mechanism, Encryption Algorithm
The new application pattern of machine technology is a kind of one kind for being sequentially in time combined into data block in such a way that sequence is connected
Linked data structure, and the distributed account book that can not be distorted He can not forge ensured in a manner of cryptography.While mechanism of knowing together
It is that the mathematical algorithm for trusting, obtaining equity is established between realizing different nodes in block catenary system.Specifically, data accounting system
Distributed deployment has multiple independent accounting nodes, each accounting nodes can the reconciliation of complete independently local, receive and send messages.When
When any accounting nodes receive the Transaction Information of client transmission in system, local reconciliation operation is first carried out, also
It is the remaining sum according to both parties in Transaction Information and corresponding revenue and expenditure, is locally carrying out reconciliation, obtains reconciliation as a result, such as account book
It is consistent or inconsistent.Understand the method for the present invention to further facilitate, the book keeping operation section for the Transaction Information that client is sent will be received
Point is labeled as node a, and other accounting nodes are labeled as node b, c, d ..., and so on.
Step S20 broadcasts Transaction Information to block chain network, for block when reconciliation result is that account book is consistent
Other accounting nodes in chain network initiate common recognition;
In the present embodiment, mechanism of knowing together (NNAC, network notify agree consensus), is by special section
The ballot of point, the verification and confirmation of complete swap in a short period of time, i.e., to a transaction, if if interests are incoherent
A dry accounting nodes can reach common understanding, so that it may to think that the whole network can also reach common understanding to this.It is preferred that all accounting nodes are super
Cross 50% or more node reach an agreement after, could complete swap account approval and book keeping operation.
In the present embodiment, only when node a completes local reconciliation and reconciliation result a is that account book is consistent, by Transaction Information
Broadcast is to block chain network, even if online other accounting nodes receive the Transaction Information that node a is sent, then other book keeping operations
Node respectively carries out local reconciliation, then the result of respective reconciliation is broadcasted, and realizes common recognition.It is exactly briefly Qi Tajie
Point b, c, d receive the Transaction Information of node a broadcast, and node b local reconciliations obtain reconciliation result b, and broadcast to block link network
Network so that node a, c, d are received, same node c local reconciliations, obtain reconciliation result c, and are broadcasted to block chain network so that
Node a, b, d are received, and so on.It should be understood that in practical application, the quantity of other accounting nodes of common recognition is participated in very
To more, such as 1000, it is adjusted with specific reference to actual conditions.
Step S30 receives the reconciliation of other accounting nodes feedbacks as a result, simultaneously according to common recognition condition is preset, obtains book keeping operation knot
Fruit;
Accounting results are issued to client by step S40, wherein accounting results are included at least to keep accounts successfully or keep accounts and be lost
It loses.
In the present embodiment, default common recognition condition is a set of rule to judge whether common recognition reaches an agreement pre-set
Then, be pre-set it is a set of distinguishing the mode of different accounting results.By broadcasting Transaction Information, ginseng is then received again
The reconciliation fed back with other accounting nodes of common recognition is as a result, and using common recognition condition is preset, obtaining book keeping operation failure or keeping accounts successfully
Result.Accounting results are issued to client, so that user understands transaction progress.
In the present embodiment, the bill processing method based on block chain database of proposition is applied to be equipped with multiple book keeping operations section
The data accounting system of point, and realize that bill handles more safe and reliable advantageous effect by block chain technology, it reduces simultaneously
Resource consumption improves treatment effeciency, and reduces the time that user waits for trade confirmation.
Based on above-described embodiment, in the present embodiment, above-mentioned steps S10, when receiving the Transaction Information of client transmission,
Local reconciliation operation is executed, obtains reconciliation as a result, including:
Step S11 determines that the client is transaction originating end and determination when receiving the Transaction Information of client transmission
The transaction id of transaction originating end;
Step S12 searches public key corresponding with the transaction transaction id of originating end, for right in local block data library
The private key of Transaction Information is verified;
Step S13 understands the transaction content of Transaction Information when public key is consistent with private key, obtains the friendship at transaction acceptance end
Easy ID and transaction amount;
Step S14, the transaction id of transaction id and transaction acceptance end based on transaction originating end, obtains local block data library
The account balance of middle record;
Step S15 is based on account balance and transaction amount, judges whether the revenue and expenditure of both parties is equal;
Step S16, if revenue and expenditure is equal, reconciliation result is that account book is consistent;
Step S17, if revenue and expenditure is unequal, reconciliation result is that account book is inconsistent.
In the present embodiment, accounting nodes a receives the Transaction Information of client transmission, you can determines the user of the client
For transaction less, merchandise initiator, thus determines that the client is transaction originating end.It should be understood that each transaction
Less and beneficiary (corresponding transaction originating end and transaction acceptance end) are there will necessarily be, both sides are each with having one's own account by oneself
Location, i.e. transaction id.Be stored in the local block data library of accounting nodes multiple accounts and with the relevant transaction record of account,
The data such as public key.Since Transaction Information is encryption data, thus according to the transaction id of transaction originating end, in local block data library
In find corresponding public key, to decrypted transaction information.Such as after receiving the Transaction Information of Zhang San's transmission, uses open first
Three public key verifications trading signature, is verified, then reduction obtains transaction amount 100 from encryption word string with public key, then root
According to the amount of money summation in both parties' account, judge whether revenue and expenditure is equal, if revenue and expenditure is equal, proves that transaction is effective, can hold
Row common recognition operation in next step.For example Zhang San (less) account has 900 originally, after paying 100, account balance is 800 at present, Lee
Four (beneficiary) accounts have 500 originally, and after taking in 100, account balance is that 600, the i.e. expenditure of both sides and income are equal at present, this
Secondary transaction is effective.If revenue and expenditure is unequal, directly returns and fail to Zhang San, closing the transaction.
Based on above-described embodiment, in the present embodiment, above-mentioned steps S30, receive the reconciliation of other accounting nodes feedbacks as a result,
And according to default common recognition condition, accounting results are obtained, including:
Step S31 receives the reconciliation of other accounting nodes feedback as a result, simultaneously cumulative calculation quantity;
Step S32 obtains the sum in block chain network in online accounting nodes and current adjustment value, to count
Calculate receiving node number;
Whether step S33, the quantity for monitoring the cumulative calculation in preset time are greater than or equal to receiving node number;
Step S34, if the quantity of cumulative calculation is greater than or equal to receiving node number in preset time, based on reception
The participation of other each accounting nodes calculates consensus value;
Step S35, judges whether consensus value is greater than or equal to receiving node number;
Step S36, if consensus value is greater than or equal to receiving node number, it is determined that common recognition is reached an agreement, and determines book keeping operation knot
Fruit is to keep accounts successfully;
Step S37, if consensus value is less than receiving node number, it is determined that common recognition is inconsistent, and determines that accounting results are book keeping operation
Failure;
Step S38, if the quantity of cumulative calculation is less than receiving node number in preset time, it is determined that network waits for super
When, and determine that accounting results are that book keeping operation fails.
In the present embodiment, due to broadcasting Transaction Information to block chain network, and then the other notes online to current network
Account node initiates common recognition, to which other accounting nodes respectively complete local reconciliation after receiving Transaction Information, and by reconciliation knot
Fruit is broadcasted, to which accounting nodes a can receive the reconciliation result of other accounting nodes feedbacks.Simultaneously because the whole network is online
Accounting nodes quantity and to eventually receive the quantity of the corresponding accounting nodes of feedback be variable, thus cumulative calculation
The quantity of the reconciliation result of reception is to get to the quantity of the accounting nodes of feedback.
Wherein, the formula of calculating receiving node number is
NAlwaysTo be in the sum of online accounting nodes in block chain network, existing network Heartbeat mechanism can be passed through herein
All online accounting nodes, and statistical magnitude are monitored in real time;
T is current adjustment value, and T can be set according to actual business requirement herein, and
Calculate consensus value formula be
P is accounting nodes participation:(m is the whole network transaction count of this accounting nodes a records, and q saves for this book keeping operation
The accounting nodes b, c ... of point record wait the correct number of common recognition for once participating in book keeping operation.P initial values are 1,0 P≤1 <)
It should be noted that
Assuming that being in the total N of online accounting nodes in current block chain networkAlwaysIt is 1000, current adjustment value T is 1,
So receiving node number can be calculated 501.The accounting results of 501 accounting nodes feedback are not received in preset time, then
It determines that network waits for time-out, while determining that accounting results are that book keeping operation fails.If receiving 501 accounting nodes in preset time
When the accounting results of feedback, you can execute the consensus value that common recognition is calculated, and calculated and be greater than or equal to 501, then explanation is all at present
Accounting nodes are more than that 50% or more node is reached an agreement, and can complete approval and book keeping operation to this transaction account, at this time
Determine that accounting results are to keep accounts successfully.Illustrate that common recognition is not reached an agreement if the consensus value calculated is less than 501, determines book keeping operation at this time
As a result it is book keeping operation failure.Ensure the high reliability of data by common recognition, while operation is at low cost, can reduce resource consumption, improves
Efficiency.
It is further alternative, in one embodiment of bill processing method the present invention is based on block chain database, for update
And synchronous block data, the bill processing method based on block chain database of the present embodiment further include:
When common recognition is reached an agreement, based on Transaction Information and this accounting nodes known together is participated in, updates local block
Transaction data in database.
In the present embodiment, when common recognition is reached an agreement, illustrate that this transaction is effective, by consistent Transaction Information of knowing together, such as
Revenue and expenditure detail updates the personal account book of both parties.It will participate in the accounting nodes of this common recognition, a certain accounting nodes such as participated in
The corresponding historical records of update such as number, common recognition correct/error number, participation the whole network transaction count.Will know together majority side
The q values of book keeping operation point are updated to q+1, oneself local total number of deals m value of book keeping operation is updated to m+1.It should be understood that block chain
Data ensure that data are reliable, thus in order to make block data synchronize, i.e., each accounting nodes all in accordance with consistent Transaction Information of knowing together,
The accounting nodes of this common recognition are participated in, respectively local block data library data are updated, to make in entire block chain network
The being consistent property of data stored in either block database.
It is further alternative, in one embodiment of bill processing method the present invention is based on block chain database, to use
Family understands the reason of knowing book keeping operation failure, and then preferably solves the problems, such as, the bill based on block chain database of the present embodiment
Processing method further includes:
When accounting results are book keeping operation failure, the prompt message of failure cause is sent to client, so that user looks into
It sees.
In the present embodiment, while accounting results are issued to client, fails if accounting results are book keeping operation, will also lose
The prompt message for losing reason is handed down to client together.Such as because network waits for time-out, and enough reconciliations are not received
As a result, waiting for time-out and the prompt message of book keeping operation failure to be issued to client on network.As because receiving enough
Reconciliation as a result, but common recognition it is inconsistent, will know together it is inconsistent and book keeping operation failure prompt message be issued to client.User is logical
Cross client display reminding information, you can clearly know transaction progress, and shorten the time that user waits for trade confirmation, improve
The usage experience of user.
It is that the present invention is based on the signals of the flow of another embodiment of bill processing method of block chain database with reference to Fig. 4, Fig. 4
Figure.
Based on above-described embodiment, in the present embodiment, the bill processing method based on block chain database further includes following step
Suddenly:
Step S50 executes the inquiry operation of local block data when receiving the inquiry request of client transmission, and
Inquiry request is broadcasted to block chain network and is known together, for determining query result, wherein query result includes at least transaction
It is detailed;
Step S60 returns to query result when common recognition is completed and is reached an agreement to client;
Step S70, when common recognition complete and it is inconsistent when, to client issue inquiry failure and common recognition failure prompt letter
Breath;
Step S80 issues inquiry failure and net when the duration for waiting for common recognition to complete is more than preset duration to client
Network waits for the prompt message of time-out.
In the present embodiment, inquiry operation is consistent with the book keeping operation operating procedure in above-described embodiment, the difference is that one is note
Account stores data in local block data library, another inquiry is that the related data in database is returned to client,
So that user checks.Specifically, client initiates the inquiry to the transaction id of Zhang San, to inquire newest 10 transaction
It is detailed.When any accounting nodes receive the inquiry request of client transmission in the whole network, according to inquiry request, inquiry is originally
Data in ground block data library, while inquiry request being broadcasted into block chain network so that the online accounting nodes of the whole network
It can receive and respectively carry out local search, finally query result is known together.
In the present embodiment, accounting nodes a receives inquiry request, inquires and carries newest 10 friendships of transaction id account
Easily, this query result for being local node a.Since accounting nodes a has broadcasted the inquiry request, thus other book keeping operation sections to be received
The query result of point feedback, that is, receive the query result that node b, c, d ... are waited.Assuming that in online in current block chain network
Accounting nodes total NAlwaysIt is 1000, current adjustment value T is 1, then receiving node number can be calculated 501.If when default
In do not receive 501 accounting nodes feedback query result, it is determined that network wait for time-out, that is, wait for common recognition complete when
Long is more than preset duration, issues inquiry failure to client and network waits for the prompt message of time-out.If in preset time
When receiving the query result of 501 accounting nodes feedback, you can execute common recognition and calculate, and the consensus value calculated is greater than or equal to
501, then illustrate that current all accounting nodes are more than that 50% or more node is reached an agreement, can complete to this inquiry account
Approval, return to the consistent query result of knowing together to client at this time.Illustrate that common recognition does not reach if the consensus value calculated is less than 501
At consistent, the prompt message of inquiry failure and common recognition failure is issued to client at this time.It, will be consistent with common recognition by common recognition
Query result is handed down to client, ensures the high reliability of data, while operation is at low cost, can reduce resource consumption, improves effect
Rate.
Further alternative, to achieve the above object, the present invention also provides a kind of computer readable storage mediums, in this reality
It applies and is stored with bill processing routine on the computer readable storage medium proposed in example, including receive data, execute reconciliation and hair
Play common recognition etc..The bill processing routine of storage can be read out by the processor, understand and execute, to realize any of the above-described embodiment
In bill processing method based on block chain database the step of.
It should be noted that herein, the terms "include", "comprise" or its any other variant are intended to non-row
His property includes, so that process, method, article or device including a series of elements include not only those elements, and
And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including this
There is also other identical elements in the process of element, method, article or device.
The embodiments of the present invention are for illustration only, can not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical scheme of the present invention substantially in other words does the prior art
Going out the part of contribution can be expressed in the form of software products, which is stored in a readable storage medium
In matter (such as ROM/RAM, magnetic disc, CD), including some instructions are used so that a station terminal (can be mobile phone, computer, service
Device, air conditioner or network equipment etc.) method that executes each embodiment of the present invention.
The embodiment of the present invention is described with above attached drawing, but the invention is not limited in above-mentioned specific
Embodiment, the above mentioned embodiment is only schematical, rather than restrictive, those skilled in the art
Under the inspiration of the present invention, without breaking away from the scope protected by the purposes and claims of the present invention, it can also make very much
Form, it is every using equivalent structure or equivalent flow shift made by description of the invention and accompanying drawing content, directly or indirectly
Other related technical areas are used in, all of these belong to the protection of the present invention.
It these are only the preferred embodiment of the present invention, be not intended to limit the scope of the invention, it is every to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.