CN109493223A - A kind of bookkeeping methods and device - Google Patents

A kind of bookkeeping methods and device Download PDF

Info

Publication number
CN109493223A
CN109493223A CN201811319215.4A CN201811319215A CN109493223A CN 109493223 A CN109493223 A CN 109493223A CN 201811319215 A CN201811319215 A CN 201811319215A CN 109493223 A CN109493223 A CN 109493223A
Authority
CN
China
Prior art keywords
node
block
catenary system
transaction
data
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.)
Granted
Application number
CN201811319215.4A
Other languages
Chinese (zh)
Other versions
CN109493223B (en
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.)
Union Mobile Pay Co Ltd
Original Assignee
Union Mobile Pay 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 Union Mobile Pay Co Ltd filed Critical Union Mobile Pay Co Ltd
Priority to CN201811319215.4A priority Critical patent/CN109493223B/en
Publication of CN109493223A publication Critical patent/CN109493223A/en
Application granted granted Critical
Publication of CN109493223B publication Critical patent/CN109493223B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/407Cancellation of a transaction

Abstract

The invention discloses a kind of bookkeeping methods and devices, are applied to block catenary system, the block catenary system includes at least two node, which comprises first node receives the first transaction request that transaction initiator sends;The first node is any node in the block catenary system;The first node obtains the first state data at current time according to first transaction request from the account book of the block catenary system;The first state data are used to characterize the current state of the corresponding account of first transaction;The first node executes first transaction request according to first transaction request and the first state data, and generates the first trading value;First trading value is the result executed after first transaction request;The first state data and second trading value are packaged as first message, are distributed to the block catenary system.

Description

A kind of bookkeeping methods and device
Technical field
The present invention relates to block chain technical field more particularly to a kind of bookkeeping methods and device.
Background technique
To improve traffic handing capacity, the different node servers in block chain may handle more transactions simultaneously, It, can be using multi version control protocol (MVCC) be based on, specifically, MVCC is block catenary system maintenance one to avoid concurrency conflict A version number (version), wherein version number is increasing sequence.It can be every after some node server receives transaction Additional version of trading relies on (verDep), and as trading terminates to be arranged the version of its status data to trading from the time point of sending Number.When transaction is finally finished, can verify additional version rely on the version of the status data of current block chain whether one It causes, if inconsistent, then refuses to trade.
When there is concurrency conflict, Fail Transaction can be directly resulted in, subsequent transaction is produced bigger effect.It is handed in refusal Yi Hou needs terminal to re-initiate transaction request, and node server re-executes transaction, causes the treatment effeciency of transaction very low.
Summary of the invention
The object of the present invention is to provide a kind of bookkeeping methods and devices, are held with solving concurrent transaction existing in the prior art Easily failure, causes the book keeping operation efficiency in block chain to decline.
The purpose of the present invention is what is be achieved through the following technical solutions:
In a first aspect, the embodiment of the present invention provides a kind of bookkeeping methods, it is applied to block catenary system, the block catenary system Including at least two node, which comprises
First node receives the first transaction request that transaction initiator sends;The first node is the block catenary system In any node;
The first node obtains current time from the account book of the block catenary system according to first transaction request First state data;The first state data are used to characterize the current state of the corresponding account of first transaction;
The first node executes first transaction and asks according to first transaction request and the first state data It asks, and generates the first trading value;First trading value is the result executed after first transaction request;
The first state data and second trading value are packaged as first message, are distributed to the block linkwork System.
A kind of possible implementation, the method also includes:
The first node receives the accounting results for the first message that second node is sent;
The first node receives the block that the second node is sent, and the block includes first trading value, institute Stating block is that the second node is determined and generated when the second status data is identical as the first state data;Second shape State data are described in the second node is obtained from the account book of the block catenary system after receiving the first message The current state of account.
A kind of possible implementation, the method also includes:
The first node then obtains the if it is determined that the accounting results are failure from the account book of the block catenary system Three condition data;The third state data are used to characterize the current state of the account;
The first node generates the second trading value according to the third state data and first transaction request;
The third state data and second trading value are packaged as second message by the first node, are distributed to institute State block catenary system.
Second aspect, the embodiment of the present invention provide a kind of bookkeeping methods, are applied to block catenary system, the block catenary system Including at least two node, which comprises
Second node receives the first message that first node is sent;The first message includes the first trading value and the first shape State data;The first state data are for the first node from institute after receiving the first transaction request that transaction initiator sends State the status data of the corresponding account of first transaction request obtained in the account book of block catenary system;First trading value It is generated for the first node according to first transaction request and the first state data;
The second node obtains the second status data, second status data from the account book of the block catenary system For the current state of the corresponding account of first transaction;
For the second node if it is determined that second status data is identical as the first state data, then generating includes institute State the block of the first trading value;
The block is distributed to the block catenary system by the second node.
A kind of possible implementation, the method also includes:
The second node then notifies described if it is determined that second status data is different from the first state data The book keeping operation of first message described in one node fails, so that the first node handles first transaction request again.
The third aspect, the embodiment of the present invention provide a kind of billing device, are applied to block catenary system, the block catenary system Including at least two node, described device includes:
Transmit-Receive Unit, the first transaction request sent for receiving transaction initiator;The first node is the block Any node in catenary system;
Processing unit is used for according to first transaction request, when obtaining current from the account book of the block catenary system The first state data at quarter;The first state data are used to characterize the current state of the corresponding account of first transaction;Root According to first transaction request and the first state data, first transaction request is executed, and generates the first trading value;Institute Stating the first trading value is the result executed after first transaction request;
The Transmit-Receive Unit is sent out for the first state data and second trading value to be packaged as first message Cloth is to the block catenary system.
A kind of possible implementation, the Transmit-Receive Unit are also used to: receiving the first message that second node is sent Accounting results;The block that the second node is sent is received, the block includes first trading value, and the block is institute It states second node and determines and generate when the second status data is identical as the first state data;Second status data is institute State the current of the account that second node is obtained from the account book of the block catenary system after receiving the first message State.
A kind of possible implementation, the processing unit are also used to: if it is determined that the accounting results are failure, then from institute State acquisition third state data in the account book of block catenary system;The third state data are used to characterize the current shape of the account State;According to the third state data and first transaction request, the second trading value is generated;
The Transmit-Receive Unit is also used to the third state data and second trading value being packaged as second message, It is distributed to the block catenary system.
Fourth aspect, the embodiment of the present invention provide a kind of billing device, are applied to block catenary system, the block catenary system Including at least two node, described device includes:
Transmit-Receive Unit, for receiving the first message of first node transmission;The first message include the first trading value and First state data;The first state data are the first node in the first transaction request for receiving transaction initiator's transmission The status data of the corresponding account of first transaction request obtained from the account book of the block catenary system afterwards;Described first Trading value is that the first node is generated according to first transaction request and the first state data;
Processing unit, for obtaining the second status data, second status number from the account book of the block catenary system According to the current state for the corresponding account of first transaction;If it is determined that second status data and the first state data It is identical, then generate the block comprising first trading value;
The Transmit-Receive Unit is also used to for the block to be distributed to the block catenary system.
A kind of possible implementation, the processing unit are also used to: if it is determined that second status data and described the One status data is different, then notifies the book keeping operation of first message described in the first node to fail, so that the first node is again Handle first transaction request.
5th aspect, the present invention provides a kind of billing devices, comprising:
Memory, for storing program instruction;
Processor executes first aspect according to the program of acquisition for calling the program instruction stored in the memory The method.
6th aspect, the embodiment of the invention provides a kind of computer readable storage medium, the computer-readable storage Media storage has computer instruction, when the computer instruction is run on computers, so that computer executes first aspect The method.
A kind of bookkeeping methods and device provided by the invention, first node is according to first transaction request, from the area The first state data at current time are obtained in the account book of block catenary system;The first state data are handed over for characterizing described first The current state of easy corresponding account;The first node is held according to first transaction request and the first state data Row first transaction request, and generate the first trading value;The first state data and second trading value are packaged as First message is distributed to the block catenary system;According to actual trading value rather than the stateful transaction of label determines whether Existing Fail Transaction avoids the problem of stateful transaction variation in accounting procedure is considered Fail Transaction caused by transaction conflicts, And then improve book keeping operation efficiency.
Detailed description of the invention
Fig. 1 is a kind of flow diagram of bookkeeping methods provided in an embodiment of the present invention;
Fig. 2 is a kind of schematic diagram of bookkeeping methods provided in an embodiment of the present invention;
Fig. 3 is a kind of schematic diagram of bookkeeping methods provided in an embodiment of the present invention;
Fig. 4 is a kind of structural schematic diagram of billing device provided in an embodiment of the present invention;
Fig. 5 is a kind of structural schematic diagram of billing device provided in an embodiment of the present invention;
Fig. 6 is a kind of structural schematic diagram of billing device provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, is not whole embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
It should be understood that the technical solution of the embodiment of the present invention can be applied in various internet financial systems, such as bit Coin system etc., the medium traded can be bit coin, ether coin, Lay spy's coin etc..
Block chain technology be decentralization and go trust by way of collective safeguard an authentic data library technical side Case, more popular theory, block chain technology are exactly a kind of mode of whole people's participation book keeping operation.
In above-described embodiment, the transaction data for obtaining multiple applications transmissions can be to be sent immediately using after completion transaction, It is also possible to be also possible to periodically obtain transaction data from each application using periodicity sending.Wherein, as long as can generate The application of transaction record is suitable for the invention embodiment, such as Alipay, Taobao etc.;The data of storage are an objects, For example, will include the time if it is transferring accounts, in object, the information such as both sides' account, transfer amounts of transferring accounts, if it is a Duan Wen Word records, and will include the mark of the information content and information transmitter in object;The type of storage can be file storage, caching, Relational data storage, the storage of non-relational data etc., for ensureing that the availability of transaction data, the type of storage include these Type but these types are not limited to, can also be other types.
In specific implementation, block chain architecture is divided into 6 layers, comprising: data Layer, network layer, common recognition layer, excitation layer, conjunction About layer, application layer, every layer is respectively completed a core function, works in coordination between each layer, realizes the trust of a decentralization Mechanism.The physical form of the main description block chain technology of data Layer, the physics realization of block chain technology are one identical by specification The chain that is made up of chain structure of block.The main purpose of network layer is the information realized between block chain network interior joint Exchange, block chain network is substantially a peer-to-peer network (Peer-to-peer networking, abbreviation P2P network), each A node both receives information, also generates information.Common recognition layer is responsible for providing a kind of mechanism, and the node of high degree of dispersion can be allowed to go to center Validity in the system of change efficiently for block data is reached common understanding.Common common recognition mechanism includes: proof of work (Proof of Work, abbreviation POW), equity prove (Proof of Stake, abbreviation POS) share authorisation verification mechanism (Delegate Proof of Stake, abbreviation DPOS).Excitation layer purpose is to provide certain incentive measure and node is encouraged to participate in The safety verification of block chain works.It the contract layer encapsulation all kinds of scripted codes of block catenary system, algorithm and thus generates more For complicated intelligent contract.The transaction of bit coin depends on the content of script, and script defines the mode and every details of transaction, This characteristic makes bit coin become a kind of currency that can be programmed.Application layer is mainly user oriented programmable applications.
Accounting nodes are the main bodys for executing record transaction data, and the accounting nodes course of work is first to collect all not yet to confirm Transaction data, and collected into a data block, data can be broadcast to one by one other nodes and tested by accounting nodes Transaction data can be put into built-in batch processing queue by card after verifying, when batch processing space reaches saturation or reaches time-out Between, these transaction data will be written in pretreated block space by accounting nodes, meanwhile, accounting nodes are also calculating spy The cryptographic Hash for the formula that fixes, the process that accounting nodes calculate the cryptographic Hash of specific format is to keep accounts, and accounting nodes calculate specific It is known as keeping accounts successfully after the cryptographic Hash of format, after keeping accounts successfully, transaction data that accounting nodes will have verified that in this period It is packaged into a block and is broadcast to other nodes and synchronize.
Block is the basic unit for forming block chain, the information for needing to record comprising concrete application in block.Such as bit Block stores Transaction Information in coin block chain.
Transaction data refer specifically to it is various forms of need the data that record, for example transaction record, record etc. of transferring accounts are valuable Information data;Accounting nodes can be the ability for periodically monitoring itself processing transaction data, and the setting period can foundation Depending on concrete condition.
The transaction data that each application is submitted is saved in the memory block;It refers specifically to, the number that each application is submitted in memory block According to being saved, so that memory block can be deposited using a variety of using transaction data directly will not be submitted in block chain network Storage form, such as message queue.Using the applications, such as Taobao, Alipay etc. that can be various generation transaction data;It obtains and hands over The ability of easy data refers to that accounting nodes obtain the amount of transaction data from memory block;
First accounting nodes are after obtaining transaction data in memory block, further includes:
It include M node in block chain network, M node includes a non-accounting nodes of N+1 accounting nodes and M-N-1, If the block that the first accounting nodes are the transaction data of the respective numbers generates node, the first accounting nodes are to the block The block of the transaction data of M-1 node broadcasts respective numbers in chain network;Otherwise, the second book keeping operation of the first accounting nodes downloading section Point generates the block of transaction data, and the second accounting nodes are any one book keeping operation in block chain network in addition to the first accounting nodes Node.
It include multiple nodes in block chain network in specific implementation, accounting nodes are a part in all nodes, each to save It participates in sharing 100 nodes in accounting nodes, such as block chain network belonging to for book keeping operation in point, wherein participating in the node of book keeping operation has 60, then have 60 accounting nodes in block chain network, 40 common nodes.60 book keeping operation sections are from memory block according to each Corresponding transaction data is obtained from the ability for obtaining processing transaction data, and is collected in respective batch processing queue, when Batch processing queue reaches saturation or reaches time-out time, and the transaction data that accounting nodes will acquire is written to pretreated block space In.While each accounting nodes obtain transaction data, each accounting nodes carry out book keeping operation operation, and 60 participate in the node of book keeping operation In have an accounting nodes that can keep accounts at first success, the accounting nodes won are that block generates node, and block generates node will The transaction having verified that in this period, which is packaged into a block, to be broadcasted and synchronizes to other 99 nodes, is removed in block chain network Block generates other 59 accounting nodes except node and stops that current book keeping operation operates and to download block raw after receiving broadcast Compare at the block of node broadcasts, while by the transaction data in the block of downloading with the transaction data in batch processing queue Compared with deleting transaction data identical with the transaction data in downloading block, 40 ordinary nodes in batch processing queue can also download The block of block generation node broadcasts.
First accounting nodes handle transaction data ability at least with network environment locating for the first accounting nodes and first The current equipment disposal ability of accounting nodes is related.In specific implementation, network environment locating for accounting nodes in block chain network Quality is affected by multiple factors, such as the bandwidth traffic of accounting nodes;Network environment locating for accounting nodes will affect book keeping operation section The speed of point broadcast, and then influence the ability of accounting nodes processing transaction.Accounting nodes need to carry out during book keeping operation greatly The mathematical computations of amount, the current hardware device of accounting nodes will affect the calculation power of accounting nodes itself, and then influence accounting nodes The ability of transaction data is handled, hardware device of the accounting nodes for book keeping operation can be central processing unit (Central Processing Unit, abbreviation CPU), graphics processor (Graphics Processing Unit, abbreviation GPU), dedicated core Piece etc..
In block chain network, some accounting nodes in block chain network can be received using the transaction data sent, The accounting nodes can broadcast the transaction data received to other accounting nodes, and each accounting nodes are receiving a certain amount of friendship After easy data, book keeping operation will do it, successful accounting nodes of keeping accounts can generate the block of transaction data, in block chain network Other nodes download block, to reach the mode that the whole people participate in book keeping operation.
With the development of business, the trading volume of transaction system gradually increases, certain time will appear transaction peak, when a large amount of Transaction data pour in block chain network, different nodes are likely to occur to same account in the billing cycle of an accounting nodes Family carries out transaction data and keeps accounts, and leads to concurrency conflict.
In concurrent reading and writing data, data (dirty reading) that read operation may be inconsistent.In order to avoid such case, need Realize the Parallel access control of data, simplest mode is exactly to lock access.Due to, locking can serialize read-write operation, So being not in inconsistent state.But read operation can be blocked by write operation, and reading performance is greatly reduced.
The method to prevent concurrency conflict has Multi version concurrency control (Multi-Version Concurrent at present Control, MVCC).Under MVCC agreement, each read operation can be appreciated that the snapshot of a consistency, and may be implemented The reading of non-obstruction.MVCC allows data to have multiple versions, this version can be the either global incremental affairs of timestamp ID, in point at the same time, the data that different affairs are seen are different.MVCC, when carrying out write operation, by data copy Portion will not influence legacy data, then modify, and atom replaces old data after the completion of modification, and read operation only can Read legacy data.Realize that write operation will not block read operation in this way, to optimize reading efficiency.And between write operation Want mutual exclusion, and every time write operation all can once copy, so being only suitable for reading to be greater than the case where writing.
Assuming that being affairs ID there are two concurrent operations R (T1) and U (T2), T1 and T2, it includes data in system that T1, which is less than T2, A=1 (T1), the operation of R and W are as follows:
The version T1 of R (read operation) indicates to read the version of data, and write operation just will be updated version later, read operation It will not.On a timeline, R is later than U, and since U is submitted after R starts, so being sightless for R.So R only can Read the data of T1 version, i.e. a=1.
Since the consistency of data with existing cannot be influenced, so will not change old number before update operation is submitted According to update operation can be split into insert+delete.It needs to mark and deletes old data, insert new data.Only After update is submitted, subsequent read operation just will affect.And for read operation moreover, before it all can only be read Write operation, be carrying out in write operation be sightless to it.
The isolation for realizing affairs well by MVCC can achieve repeated read rank.
Therefore, it can be controlled by multi version control protocol and con current control concurrently is carried out to block chain, super account book passes through Collected using read-write and carry out con current control, when carrying out transaction packing, read-write collection is attached in transaction, when falling block, compares reading Whether all keys in set are consistent with current status data, are bonded in status data if updating write collection always, if inconsistent, This batch of transaction invalid.Block chain safeguards the version number of status data, when transaction issues, is relied on by the version of node given transaction. If it is inconsistent version occur, directly refusal transaction.
However in real business, since block chain is asynchronous transaction, one goes out in block period, might have a large amount of version This number conflict is rejected so as to cause a large amount of transaction.Cause after submitting several transactions, if there is concurrent problem, finally Implementing result is uncontrollable, unpredictable, produces bigger effect to subsequent transaction.In addition, only being relied on by version, i.e. judgement is worked as Whether the version of the status data of preceding block chain is consistent, if inconsistent, then refuses the mode of transaction, these transaction being rejected Although version number changes, the status data of account may be also consistent, that is, be not necessarily present outcome conflict, therefore, By the con current control of MVCC, the handling capacity of block platform chain is reduced.
Therefore, as shown in Figure 1, the embodiment of the present invention provides a kind of bookkeeping methods, it is applied to block catenary system, the block Catenary system includes at least two node, which comprises
Step 101: first node receives the first transaction request that transaction initiator sends;The first node is the area Any node in block catenary system;
Step 102: first node obtains current according to first transaction request from the account book of the block catenary system The first state data at moment;The first state data are used to characterize the current state of the corresponding account of first transaction;
Step 103: first node executes described first and hands over according to first transaction request and the first state data Easily request, and generate the first trading value;First trading value is the result executed after first transaction request;
Step 104: the first state data and second trading value are packaged as first message by first node, publication To the block catenary system.
By the above method, the version that MVCC can be arranged to avoid the status data adopted as each account is relied on, and then avoids One version number of additional maintenance, additional committed memory space, with increasing for status data, version number will be consumed largely Memory headroom the problem of, also, since practical concurrent transaction quantity is more, and carried out according to the status data of actual account Con current control avoids in MVCC due to the erroneous judgement for judging largely to trade extremely caused by version number is inconsistent, improves area Execution efficiency and handling capacity in block chain.
After first message is distributed to block catenary system by first node, accounting nodes start in billing cycle on earth The verifying traded, determines whether the first transaction in first message can trade success, specifically, as shown in Fig. 2, packet It includes:
Step 201: second node receives the first message that first node is sent;The first message includes the first trading value And first state data;The first state data are that the first node is asked in the first transaction for receiving transaction initiator's transmission The status data of the corresponding account of first transaction request obtained from the account book of the block catenary system after asking;Described One trading value is that the first node is generated according to first transaction request and the first state data;
Step 202: second node obtains the second status data, second state from the account book of the block catenary system Data are the current state of the corresponding account of first transaction;
Step 203: second node then generates packet if it is determined that second status data is identical as the first state data Block containing first trading value;
Step 204: the block is distributed to the block catenary system by second node.
It should be noted that second node is the accounting nodes in block catenary system, first node and second node can be with For same node, or different nodes, it is not limited here.
It is successful scene for accounting results, the method also includes:
Step 1: first node receives the accounting results for the first message that second node is sent;
Step 2: first node receives the block that the second node is sent, the block includes first trading value, The block is that the second node is determined and generated when the second status data is identical as the first state data;Described second Status data is the institute that the second node is obtained from the account book of the block catenary system after receiving the first message State the current state of account.
It is the scene of failure for accounting results, second node is if it is determined that second status data and the first state Data are different, then notify the book keeping operation of first message described in the first node to fail, so that the first node handles institute again State the first transaction request.
Optionally, the method also includes:
Step 1: first node is if it is determined that the accounting results are then obtained from the account book of the block catenary system to fail Take third state data;The third state data are used to characterize the current state of the account;
Step 2: first node generates the second trading value according to the third state data and first transaction request;
Step 3: the third state data and second trading value are packaged as second message by first node, publication To the block catenary system.
In the above-described embodiments, it is asked by the verifying that the first node into block chain network sends the first transaction data It asks, verifies the first transaction data processing status, judge whether the processing of the first transaction data succeeds, if first transaction data Handle unsuccessful, then retransmit first transaction data to the block chain network to the block chain network, make described in Block chain network handles first transaction data again, avoids and causes institute because of concurrency conflict in the block chain network The first Fail Transaction is stated, needs that node is notified to initiate transaction, and then the problem for causing efficiency very low again.
Fig. 3 is a kind of bookkeeping methods flow diagram provided in an embodiment of the present invention, comprising the following steps:
Step 301: first node receives the first transaction request that application is sent;
Step 302: first node obtains current according to first transaction request from the account book of the block catenary system The first state data at moment;The first state data are used to characterize the current state of the corresponding account of first transaction;
Specifically, determining the status data v1 before executing after first node receives the first transaction request.
Step 303: first node executes described first and hands over according to first transaction request and the first state data Easily request, and generate the first trading value;
Specifically, node carries out pre-execution to transaction after first node receives the first transaction request, determine after executing As a result t1.
Step 304: the first state data and second trading value are packaged as first message by first node, publication To the block catenary system.
Specifically, node carries out pre-execution to transaction, by the shape before execution after first node receives the first transaction request State data v1 and execute after result t1, be attached in the first message of submission.
Step 305: second node receives the first message that first node is sent;
Step 306: second node obtains the second status data, second state from the account book of the block catenary system Data are the current state of the corresponding account of first transaction;
Step 307: judging whether second status data and the first state data are identical, if so, executing step Rapid 308;Otherwise, step 309 is executed;
Specifically, whether compare additional status data v1 in first message equal with status data current value v1 ', if It is equal to then follow the steps 308;Otherwise, step 309 is executed;
Step 308: first node receives the block that the second node is sent;
Specifically, second node locks the data, directly target value t1 is updated into status data;And by the area of generation Block is sent to the whole network, and records the block.
Step 309: the book keeping operation of first message described in the first node being notified to fail;
Step 310: first node return value step 302;
Specifically, first node obtains newest status data and implementing result, holds again according to current status data The first transaction request of row, the then repeatedly deterministic process of step 307, additional status data v1 whether with status data current value V1 ' is identical, updates implementing result to current status data.
For above method process, the embodiment of the present invention also provides a kind of dress of transaction data authentication to write-in block chain It sets, the particular content which disposes device in advance is referred to above method implementation.
As shown in figure 4, the embodiment of the present application also provides a kind of billing device, it is applied to block catenary system, the block chain System includes at least two node, and described device includes:
Transmit-Receive Unit 401, the first transaction request sent for receiving transaction initiator;The first node is the area Any node in block catenary system;
Processing unit 402, for being obtained from the account book of the block catenary system current according to first transaction request The first state data at moment;The first state data are used to characterize the current state of the corresponding account of first transaction; According to first transaction request and the first state data, first transaction request is executed, and generates the first trading value; First trading value is the result executed after first transaction request;
The Transmit-Receive Unit 401, for the first state data and second trading value to be packaged as first message, It is distributed to the block catenary system.
A kind of possible implementation, the Transmit-Receive Unit 401, is also used to: receiving second node is sent described first The accounting results of message;The block that the second node is sent is received, the block includes first trading value, the block The second node determines to be generated when the second status data is identical as the first state data;Second status data It is the account that the second node is obtained from the account book of the block catenary system after receiving the first message Current state.
A kind of possible implementation, the processing unit 402 are also used to: if it is determined that the accounting results are failure, then Third state data are obtained from the account book of the block catenary system;The third state data are for characterizing working as the account Preceding state;According to the third state data and first transaction request, the second trading value is generated;
The Transmit-Receive Unit 401 is also used to the third state data and second trading value being packaged as second to disappear Breath, is distributed to the block catenary system.
As shown in figure 5, the embodiment of the present application also provides a kind of billing device, it is applied to block catenary system, the block chain System includes at least two node, and described device includes:
Transmit-Receive Unit 501, for receiving the first message of first node transmission;The first message includes the first trading value And first state data;The first state data are that the first node is asked in the first transaction for receiving transaction initiator's transmission The status data of the corresponding account of first transaction request obtained from the account book of the block catenary system after asking;Described One trading value is that the first node is generated according to first transaction request and the first state data;
Processing unit 502, for obtaining the second status data, second state from the account book of the block catenary system Data are the current state of the corresponding account of first transaction;If it is determined that second status data and the first state number According to identical, then generate include first trading value block;
The Transmit-Receive Unit 501 is also used to for the block to be distributed to the block catenary system.
A kind of possible implementation, the processing unit 502 are also used to: if it is determined that second status data with it is described First state data are different, then notify the book keeping operation of first message described in the first node to fail, so that the first node weight Newly handle first transaction request.
It should be noted that realize can be with for the function of each unit in the above-mentioned billing device being related in the embodiment of the present invention With further reference to the description of related method embodiment, details are not described herein.
The embodiment of the present application also provides a kind of billing device, as shown in fig. 6, the device includes:
Memory 202, for storing program instruction;
Processor 200 executes the application according to the program of acquisition for calling the program instruction stored in the memory Method process either described in embodiment.
Transceiver 201, for sending and receiving the instruction of book keeping operation processing under the control of processor 200.
Wherein, in Fig. 6, bus architecture may include the bus and bridge of any number of interconnection, specifically by processor 200 The various circuits for the memory that the one or more processors and memory 202 of representative represent link together.Bus architecture is also Various other circuits of such as peripheral equipment, voltage-stablizer and management circuit or the like can be linked together, these are all It is it is known in the art, therefore, it will not be further described herein.Bus interface provides interface.
Transceiver 201 can be multiple element, that is, includes transmitter and transceiver, provide for over a transmission medium and respectively The unit of kind other devices communication.
Processor 200, which is responsible for management bus architecture and common processing, memory 202, can store processor 200 and is holding Used data when row operation.
Processor 200 can be central processing unit (CPU), specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, ) or Complex Programmable Logic Devices (Complex Programmable Logic Device, CPLD) FPGA.
The embodiment of the present application also provides a kind of computer storage mediums, for being stored as institute in above-mentioned the embodiment of the present application Computer program instructions used in any device stated, it includes for executing above-mentioned either method provided by the embodiments of the present application Program.
The computer storage medium can be any usable medium or data storage device that computer can access, packet Include but be not limited to magnetic storage (such as floppy disk, hard disk, tape, magneto-optic disk (MO) etc.), optical memory (such as CD, DVD, BD, HVD etc.) and semiconductor memory (such as it is ROM, EPROM, EEPROM, nonvolatile memory (NAND FLASH), solid State hard disk (SSD)) etc..
It should be understood by those skilled in the art that, the embodiment of the present invention can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the present invention Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the present invention, which can be used in one or more, The computer program implemented in usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) produces The form of product.
The present invention be referring to according to the method for the embodiment of the present invention, the process of equipment (system) and computer program product Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Although preferred embodiments of the present invention have been described, it is created once a person skilled in the art knows basic Property concept, then additional changes and modifications may be made to these embodiments.So it includes excellent that the following claims are intended to be interpreted as It selects embodiment and falls into all change and modification of the scope of the invention.
Obviously, various changes and modifications can be made to the invention without departing from essence of the invention by those skilled in the art Mind and range.In this way, if these modifications and changes of the present invention belongs to the range of the claims in the present invention and its equivalent technologies Within, then the present invention is also intended to include these modifications and variations.

Claims (12)

1. a kind of bookkeeping methods, which is characterized in that it is applied to block catenary system, the block catenary system includes at least two node, The described method includes:
First node receives the first transaction request that transaction initiator sends;The first node is in the block catenary system Any node;
The first node obtains the of current time according to first transaction request from the account book of the block catenary system One status data;The first state data are used to characterize the current state of the corresponding account of first transaction;
The first node executes first transaction request according to first transaction request and the first state data, And generate the first trading value;First trading value is the result executed after first transaction request;
The first state data and second trading value are packaged as first message, are distributed to the block catenary system.
2. the method as described in claim 1, which is characterized in that the method also includes:
The first node receives the accounting results for the first message that second node is sent;
The first node receives the block that the second node is sent, and the block includes first trading value, the area Block is that the second node is determined and generated when the second status data is identical as the first state data;Second status number According to being the account that the second node is obtained from the account book of the block catenary system after receiving the first message Current state.
3. method according to claim 2, which is characterized in that the method also includes:
The first node is if it is determined that the accounting results to fail, then obtain third shape from the account book of the block catenary system State data;The third state data are used to characterize the current state of the account;
The first node generates the second trading value according to the third state data and first transaction request;
The third state data and second trading value are packaged as second message by the first node, are distributed to the area Block catenary system.
4. a kind of bookkeeping methods, which is characterized in that it is applied to block catenary system, the block catenary system includes at least two node, The described method includes:
Second node receives the first message that first node is sent;The first message includes the first trading value and first state number According to;The first state data are for the first node from the area after receiving the first transaction request that transaction initiator sends The status data of the corresponding account of first transaction request obtained in the account book of block catenary system;First trading value is institute State what first node was generated according to first transaction request and the first state data;
The second node obtains the second status data from the account book of the block catenary system, and second status data is institute State the current state of the corresponding account of the first transaction;
The second node is then generated comprising described the if it is determined that second status data is identical as the first state data The block of one trading value;
The block is distributed to the block catenary system by the second node.
5. method as claimed in claim 4, which is characterized in that the method also includes:
The second node then notifies the first segment if it is determined that second status data is different from the first state data The book keeping operation failure of the point first message, so that the first node handles first transaction request again.
6. a kind of billing device, which is characterized in that it is applied to block catenary system, the block catenary system includes at least two node, Described device includes:
Transmit-Receive Unit, the first transaction request sent for receiving transaction initiator;The first node is the block linkwork Any node in system;
Processing unit, for obtaining current time from the account book of the block catenary system according to first transaction request First state data;The first state data are used to characterize the current state of the corresponding account of first transaction;According to institute The first transaction request and the first state data are stated, executes first transaction request, and generate the first trading value;Described One trading value is the result executed after first transaction request;
The Transmit-Receive Unit is distributed to for the first state data and second trading value to be packaged as first message The block catenary system.
7. device as claimed in claim 6, which is characterized in that the Transmit-Receive Unit is also used to: receiving what second node was sent The accounting results of the first message;The block that the second node is sent is received, the block includes first trading value, The block is that the second node is determined and generated when the second status data is identical as the first state data;Described second Status data is the institute that the second node is obtained from the account book of the block catenary system after receiving the first message State the current state of account.
8. device as claimed in claim 7, which is characterized in that the processing unit is also used to: if it is determined that the accounting results For failure, then third state data are obtained from the account book of the block catenary system;The third state data are for characterizing institute State the current state of account;According to the third state data and first transaction request, the second trading value is generated;
The Transmit-Receive Unit is also used to the third state data and second trading value being packaged as second message, publication To the block catenary system.
9. a kind of billing device, which is characterized in that it is applied to block catenary system, the block catenary system includes at least two node, Described device includes:
Transmit-Receive Unit, for receiving the first message of first node transmission;The first message includes the first trading value and first Status data;The first state data be the first node receive transaction initiator send the first transaction request after from The status data of the corresponding account of first transaction request obtained in the account book of the block catenary system;First transaction Value is that the first node is generated according to first transaction request and the first state data;
Processing unit, for obtaining the second status data from the account book of the block catenary system, second status data is The current state of the corresponding account of first transaction;If it is determined that second status data and the first state data phase Together, then the block comprising first trading value is generated;
The Transmit-Receive Unit is also used to for the block to be distributed to the block catenary system.
10. device as claimed in claim 9, which is characterized in that the processing unit is also used to: if it is determined that second state Data are different from the first state data, then notify the book keeping operation of first message described in the first node to fail, so that described First node handles first transaction request again.
11. a kind of billing device characterized by comprising
Memory, for storing program instruction;
Processor requires 1~3 according to the program execution benefit of acquisition for calling the program instruction stored in the memory Described in any item methods or perform claim require 4~5 described in any item methods.
12. a kind of computer readable storage medium, which is characterized in that the computer-readable recording medium storage has computer to refer to It enables, when the computer instruction is run on computers, so that computer perform claim requires 1~3 described in any item sides Method or perform claim require 4~5 described in any item methods.
CN201811319215.4A 2018-11-07 2018-11-07 Accounting method and device Active CN109493223B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811319215.4A CN109493223B (en) 2018-11-07 2018-11-07 Accounting method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811319215.4A CN109493223B (en) 2018-11-07 2018-11-07 Accounting method and device

Publications (2)

Publication Number Publication Date
CN109493223A true CN109493223A (en) 2019-03-19
CN109493223B CN109493223B (en) 2021-12-21

Family

ID=65695163

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811319215.4A Active CN109493223B (en) 2018-11-07 2018-11-07 Accounting method and device

Country Status (1)

Country Link
CN (1) CN109493223B (en)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110084600A (en) * 2019-04-29 2019-08-02 百度在线网络技术(北京)有限公司 Processing, verification method, device, equipment and the medium for transactions requests of resolving
CN110321219A (en) * 2019-05-06 2019-10-11 百度在线网络技术(北京)有限公司 A kind of parallel execution method, apparatus, equipment and the medium of transactions requests
CN110727964A (en) * 2019-10-22 2020-01-24 高坡 Block chain big data processing method and system
CN111353869A (en) * 2020-03-15 2020-06-30 策拉人工智能科技(云南)有限公司 Method applied to cloud financial learning and memorizing billing habit
CN111563124A (en) * 2020-05-08 2020-08-21 中国工商银行股份有限公司 Operation processing method, device and system based on block chain
CN111614707A (en) * 2019-02-26 2020-09-01 傲为信息技术(江苏)有限公司 Transaction system and transaction method based on block chain
CN111984421A (en) * 2020-09-03 2020-11-24 深圳壹账通智能科技有限公司 Data processing method, device and storage medium
CN112561695A (en) * 2019-09-25 2021-03-26 支付宝(杭州)信息技术有限公司 Method and apparatus for concurrently executing transactions in a blockchain
WO2021073452A1 (en) * 2019-10-15 2021-04-22 腾讯科技(深圳)有限公司 Blockchain network-based data processing method and device, electronic device and storage medium
WO2021135745A1 (en) * 2020-01-02 2021-07-08 支付宝(杭州)信息技术有限公司 Method and apparatus for carrying out transaction data processing at blockchain node
US11082527B2 (en) 2019-12-10 2021-08-03 International Business Machines Corporation Controlling transaction requests between applications and servers

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282474A (en) * 2018-01-18 2018-07-13 山东大学 The maintaining method of digital asset trade identity based on block chain
CN108717606A (en) * 2018-06-08 2018-10-30 北京工商大学 A kind of food security multiplicity of interests main body credit assessment method based on block chain

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282474A (en) * 2018-01-18 2018-07-13 山东大学 The maintaining method of digital asset trade identity based on block chain
CN108717606A (en) * 2018-06-08 2018-10-30 北京工商大学 A kind of food security multiplicity of interests main body credit assessment method based on block chain

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111614707A (en) * 2019-02-26 2020-09-01 傲为信息技术(江苏)有限公司 Transaction system and transaction method based on block chain
CN110084600A (en) * 2019-04-29 2019-08-02 百度在线网络技术(北京)有限公司 Processing, verification method, device, equipment and the medium for transactions requests of resolving
CN110321219A (en) * 2019-05-06 2019-10-11 百度在线网络技术(北京)有限公司 A kind of parallel execution method, apparatus, equipment and the medium of transactions requests
CN112561695A (en) * 2019-09-25 2021-03-26 支付宝(杭州)信息技术有限公司 Method and apparatus for concurrently executing transactions in a blockchain
US11386076B2 (en) 2019-10-15 2022-07-12 Tencent Technology (Shenzhen) Company Limited Data processing method and apparatus based on blockchain network, electronic device, and storage medium
WO2021073452A1 (en) * 2019-10-15 2021-04-22 腾讯科技(深圳)有限公司 Blockchain network-based data processing method and device, electronic device and storage medium
CN110727964A (en) * 2019-10-22 2020-01-24 高坡 Block chain big data processing method and system
US11082527B2 (en) 2019-12-10 2021-08-03 International Business Machines Corporation Controlling transaction requests between applications and servers
WO2021135745A1 (en) * 2020-01-02 2021-07-08 支付宝(杭州)信息技术有限公司 Method and apparatus for carrying out transaction data processing at blockchain node
CN111353869A (en) * 2020-03-15 2020-06-30 策拉人工智能科技(云南)有限公司 Method applied to cloud financial learning and memorizing billing habit
CN111353869B (en) * 2020-03-15 2023-04-07 策拉人工智能科技(云南)有限公司 Method applied to cloud financial learning and memorizing billing habit
CN111563124A (en) * 2020-05-08 2020-08-21 中国工商银行股份有限公司 Operation processing method, device and system based on block chain
CN111563124B (en) * 2020-05-08 2023-06-23 中国工商银行股份有限公司 Operation processing method, device and system based on block chain
CN111984421A (en) * 2020-09-03 2020-11-24 深圳壹账通智能科技有限公司 Data processing method, device and storage medium
CN111984421B (en) * 2020-09-03 2022-09-16 深圳壹账通智能科技有限公司 Data processing method, device and storage medium

Also Published As

Publication number Publication date
CN109493223B (en) 2021-12-21

Similar Documents

Publication Publication Date Title
CN109493223A (en) A kind of bookkeeping methods and device
US10986177B2 (en) Systems and methods of self-forking blockchain protocol
Thibault et al. Blockchain scaling using rollups: A comprehensive survey
US20190354518A1 (en) Chain mesh network for decentralized transaction systems
US20220239470A1 (en) Cross-blockchain data processing method and apparatus, device, and computer storage medium
WO2020107919A1 (en) Distributed network and ecosystem based on innovative proof-of-reputation consensus protocol
WO2021218459A1 (en) Cross-chain interaction method, apparatus and system
WO2019001141A1 (en) Cross-chain transaction method and device
CN109598147B (en) Data processing method and device based on block chain and electronic equipment
CN109241778A (en) A kind of public transport data processing method and device based on block chain
CN109003185B (en) Intelligent contract establishing method and device, computing equipment and storage medium
Wang et al. Performance benchmarking and optimization for blockchain systems: A survey
US20230245080A1 (en) Convergent Consensus Method for Distributed Ledger Transaction Processing
CN109447636A (en) A kind of assets transfer method and device
CN112015822B (en) Block chain data deleting method and device
Dinh et al. A blueprint for interoperable blockchains
CN113570460A (en) Method and apparatus for concurrently executing transactions in a blockchain
Bandara et al. Patterns for blockchain data migration
WO2020100602A1 (en) Blockchain system, approval terminal, user terminal, history management method, and history management program
US11245528B1 (en) Protocols for decentralized networks
EP3989151A1 (en) System and method for the secure peer-to-peer transmission of content in distributed ledger networks
US20220335525A1 (en) Event management and validation platform using a recursive hierarchic blockchain
US11570001B1 (en) Protocols for decentralized networks
Ren et al. BBSF: blockchain benchmarking standardized framework
GB2572339A (en) System and method for data processing using tokens

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
GR01 Patent grant
GR01 Patent grant