Summary of the invention
To solve the above-mentioned problems, the present invention proposes fund transfer system, examination side that location technology is recalled based on Merkle treeMethod and method of commerce.
Based on the fund transfer system of Merkle tree backtracking location technology, including center-side and client;It is set in the center-sideThere is central store module;The central store module includes central database and block chain;The central database is for storingTransaction record;The block chain is that the successive block of the timing of several temporally pieces is made up of Hash iteration;InstituteStating block includes block head and block body;The block head is used to store the root of the system general ledger tree of the block, system point familyThe root and father's block build hashed value of account tree;The block body is used to store the transaction details of the block;In the clientEquipped with module is locally stored;The module that is locally stored includes local data base and build chain;The local data base is for depositingStore up individual ledger tree;The build chain is the data-link that all block heads are constituted.
The structure of the system general ledger tree is Merkle tree, for storing all current Transaction Informations of all depositors;SystemEach leaf node of system general ledger tree corresponds to the hashed values of a current particular transactions, and when all leaf nodes are according to tradingBetween sequencing arrange, the root node of system general ledger tree locked current All Activity information.
The structure of the individual ledger tree is multistage expansible, reverse self-growing Merkle tree, for storing individualAll historical transactional informations of depositor.
The system ledger tree condenses together for the root node of all individual ledger trees and is constructed of MerkleTree, each leaf node correspond to the root node of the individual ledger tree of single depositor, the system ledger leaf nodes with it is aBody ledger root vertex corresponding relationship is constant;Each leaf node of the system ledger tree is in affiliated Merkle treeSequence of positions uses the layout of position serial number.
Each leaf node of the Merkle tree is unique by the backtracking path that Hash iteration traces back to root node.
The path of the backtracking be leaf node by mostly wheel Hash iteration trace back to Merkle root vertex duringEach Hash factor is mutual to put in order.
The timeslice is the isometric period for periodically dividing exchange hour.
The client and center-side are provided with respective private key and public key, and are recognized by digital signature to carry out identityCard.
Based on the checking method of transferring accounts of Merkle tree backtracking location technology, the examination includes that general ledger examination and ledger are looked intoIt tests, the general ledger examination is for verifying transaction existence, and the ledger examination is for verifying authenticity of transferring accounts;
The checking method the following steps are included:
S11. the transaction leaf node that client is chosen on itself individual ledger tree is used as wait check transaction, is corresponded toTransaction hashed value be sent to center-side as echo request;
S12. the examination of client executing general ledger and ledger examination.
General ledger examination specifically: client is returned according to center-side, wait check in corresponding block of trading, fromGiven transaction hashed value to itself build chain system general ledger root vertex the path Merkle, which is verified by Hash iterationThe correctness of diameter;
The ledger examination specifically:
S121. client is returned according to center-side, in newest block, from the root of itself individual ledger tree to systemThe path Merkle of ledger root vertex and from the root of counterpart individual ledger tree to system ledger root vertexThe path Merkle, pass through Hash iteration verify two paths Merkle correctness;
S122. according to two paths Merkle in step S121, client application Merkle tree recalls location technology, respectivelyItself and leaf segment point serial number of the counterpart in system ledger tree are calculated, and compares whether the two serial numbers are distinguishedIt is consistent with the position serial number code in respective account;
S123. client according to center-side return slave given transaction hashed value to counterpart's individual ledger tree root valueThe correctness in the path is verified in the path Merkle by Hash iteration.
Before the general ledger examination and ledger examination carry out Transaction Inquiries, need advanced row data synchronous and data verification.
Synchronous, the detailed process of the synchronous synchronization including build chain of the data and individual ledger are as follows: client is sentData update request to center-side, update the maximum block number in request including client local build chain, and local individualThe hashed value of most end transaction leaf node on ledger tree;Then all after the maximum block number that reception center-side returnsThe hashed value and most new root of all newest transaction of the individual ledger tree after new block, and local most end transaction leaf nodeValue.
The process of the data verification are as follows:
(1) client is using the hashed value of the last one block of build chain before synchronizing as starting point, to synchronize the last one rear blockHashed value is terminal, and the continuity of build chain data is verified by Hash iteration;
(2) client is using a nearest quasi- root node before synchronizing as starting point, using the individual ledger tree root value after synchronizing as terminal,The continuity of individual ledger tree data is verified by Hash calculation.
Based on the transfer transaction method of Merkle tree backtracking location technology, including following money transfer transactions step:
S31. depositor A is transferred accounts by issuing transfer to bank center to depositor B;
S32. bank center generates transfer information simultaneously for transfer information receipt depositor A;
S33. transfer result information is sent to depositor B by bank center.
The transfer includes: the account and transfer amounts, request time, remark information and depositor's A private of depositor AThe digital signature that key trades to this;
The transfer information includes: account balance, the depositor A of depositor A after the completion of transfer, book keeping operation time, transactionThe digital signature that individual ledger root vertex and the private key of bank center trade to this;
The transfer result information includes: transfer, book keeping operation time, the account balance of depositor B, depositor after the completion of transactionThe digital signature that the individual ledger root vertex of B and the private key of bank center trade to this.
It further include system general ledger tree, system ledger tree and individual ledger tree with the generation of the money transfer transactionsData synchronization updating.
The beneficial effects of the present invention are:
(1) take into account data transparency and execution efficiency: writing to test and separate by data realizes bank and efficiently concentrates book keeping operation, depositorThe new mode for dispersing democratic supervision greatly promotes bank's public affairs letter by inspection supervision mechanism " latching " data of ledger treeThe role of bank is changed the go-between being subjected to supervision by traditional manager by power;
(2) take into account secret protection and Fund Supervision: compared to bit coin network, irrelevant personnel can not obtain the transaction of other depositorsRecord and account information, can not also know the globality business information of bank, while data storage centerization and can not distortFeature is also convenient for auditing bodies and implements supervision and internal auditing to bank;
(3) system reform is easy, and implementation cost is low: without additionally creating public chain or the new digital cash of distribution, only by drawingThe storage for entering asymmetric encryption account management technology and carrying out block chain type to accounting data is transformed, and bank can be allowed to keep systemWhile system Central Position, the characteristic service and function of numerous ideal moneys are realized.
Specific embodiment
It is with reference to the accompanying drawing and specific real in order to make those skilled in the art more fully understand technical solution of the present inventionApplying example, the present invention is described in further detail.
Need to illustrate: Merkle tree is Hash binary tree, it is used as quickly concluding and verifying large-scale data integralityData structure.The complete Merkle tree needs of construction one are recursive to carry out Hash operation to back end, and will be newly-generatedHash node is inserted into Merkle tree, and until only remaining next Hash node, which is exactly Merkle root.It is provided fastlyThe method of fast verify data existence: when N number of data element is by Hash calculation and is inserted into Merkle tree, any one full sectionPoint dates back more log2(N) a path node can reach Merkle root, i.e., at most pass through log2(N) secondary Hash calculation can be examinedFinding arbitrary data element whether there is in the Merkle tree, to complete its existence proof.
Fund transfer system based on Merkle tree backtracking location technology, comprising: center-side and client;It is set in the center-sideThere is central store module;The central store module includes central database and block chain;The central database is for storingTransaction record;The block chain is that the successive block of the timing of several temporally pieces is made up of Hash iteration, instituteStating block includes block head and block body;The block head is used to store the root of the system general ledger tree of the block, system point familyThe root and father's block build hashed value of account tree;The block body is used to store the transaction details of the block;In the clientEquipped with module is locally stored;The module that is locally stored includes local data base and build chain;The local data base is for depositingStore up individual ledger tree;The build chain is the data-link that all block heads are constituted.
The individual ledger tree is all historical tradings composition that individual ledger is stored by Merkle tree, eachLeaf node corresponds to the hashed value of the particular transactions of the depositor;
The system ledger tree condenses together for the root node of all individual ledger trees and is configured to, and equally passes throughThe storage of Merkle tree, each leaf node correspond to the root node of the individual ledger tree of single depositor;The system ledger treeIn the root nodes of all individual ledger trees there is fixed position serial number, and this serial number is specifically shown in the depositor coupleIn the account information answered.
The timeslice is the isometric period for periodically dividing exchange hour, it is proposed that daily divides, is set as 24Hour, so as to corresponding with bank existing " journal account ".By the distributed storage and verifying to build chain, all depositors reachTransaction common recognition, and then realize the supervision to center bank.The system general ledger tree root value of the block of block head storage and it isSystem ledger tree root value, respectively corresponds the system general ledger tree and system ledger tree of insertion block chain;Respectively from general ledger and dividing familyTwo dimensions of account lock historical trading, and system general ledger tree root value and system ledger tree root value are announced to all depositors, realThe data showed under secret protection disclose.
The client and center-side are provided with respective private key and public key, and are recognized by digital signature to carry out identityCard.For example, depositor ensures the authenticity of transaction request by digital signature, bank ensures system message by digital signatureWith the authenticity for receipt of transferring accounts.Meanwhile the registration mode of the virtual digits currency such as similar bit coin, do not have in digital banking systemThe key pair of the CA mechanism (i.e. " certificate authority ") of so-called centralization, depositor is generated by depositor oneself, public key and accountNumber corresponding relationship complete mapping when it carries out Account Registration to bank, and be written in the individual ledger of the depositor, private keyIt is taken care of by depositor oneself.The asymmetric encryption account management technology of no CA mechanism is to realize the basis of Trusted Digital bank.It comparesIn existing banking system, symmetric cryptosystem is generallyd use based on the absolute trust to bank to protect account safety and progressThe mode of identification, the asymmetric encryption techniques that the present invention uses can be to avoid banks using the Information Superiority in hand, arbitrarilyForge or distort the transaction record of depositor.
As shown in Figure 1, the entire flow of a money transfer transactions, wherein in transaction request TX, VA、VBRespectively indicate the side of producingThe account of Alice and the side of being transferred to Bob, Amount are transfer amounts, Time1For request time, Memo is remark information, SgnAForThe side's of producing private key is to the signature of the request, to confirm the authenticity of the request;It transfers accounts in receipt RE, Time2For keep accounts the time,BalanceAFor the account balance of the side of producing after the completion of transaction, rootAIndicate the root node of the individual ledger tree in the side of producing, SgncIt is bank's private key to the signature of the transaction, to confirm the completed authenticity of the transaction;It transfers accounts and notifies parameter in Msg and RE classSeemingly.The receipt RE and transferring accounts of transferring accounts notifies in Msg that the effect of root is both the confirmation to currently trading, and owns to the depositorThe confirmation of historical trading.
Further, the system general ledger tree (General Ledger Tree, abbreviation GLT) is to be deposited by Merkle treeCurrent total transaction is stored up to constitute.Specifically, each leaf node of GLT corresponds to the hashed value hash of a current particular transactions(TX), all leaf nodes of GLT are arranged according to exchange hour sequencing, and root node GLT_ROOT has locked current allTransaction Information.
The individual ledger tree (Customer Ledger Tree, abbreviation CLT) is to store individual by Merkle treeLedger is constituted.Specifically, each leaf node of CLT corresponds to the hashed value hash of the particular transactions of certain individual depositor(TX), all leaf nodes of CLT are arranged according to exchange hour sequencing, and root node root has locked all of the depositor and gone throughHistory transaction.The individual ledger tree CLT can multi-tier, reverse growth certainly.As shown in Fig. 2, 3 grades of -8 node structureIndividual ledger tree CLT, CLT are an incomplete binary tree on the whole, but every level-one all can individually be considered as a full binary tree.The wherein mapping relations between #0 leaf node record depositor's account and its public key, to ensure that the public and private key of the account will not be usurpedChange;#1-#21(is without child node) it is transaction leaf node, record the hashed value of particular transactions;Root node subject to #A and #B leaf node,They were once the root nodes of CLT, but with the growth of itself trading volume, they are changed into the common of higher level binary tree again successivelyNode.Such design can be lockked all historical tradings of depositor by tree root root and be provided transaction recently quickBack forecasting path, while meet different depositors to transaction extend the needs of, and retraction verification process in greatest extentProtect depositor's privacy.
The system ledger tree (System Ledger Tree, abbreviation SLT) is the root of all individual ledger treesNode aggregation is configured to Merkle tree together.Specifically, each leaf node of SLT corresponds to the individual point family of single depositorAll leaf nodes of the root node root, SLT of account tree according to account open an account the time sequencing arrange, root node SLT_ROOT locks all historical tradings of all depositors.
The backtracking path of Merkle tree has uniqueness, that is, each leaf node traces back to root node by Hash iterationPath be it is unique, different leaf nodes corresponds to different backtracking paths.Therefore, the backtracking road of some leaf node is givenDiameter can calculate position serial number of the leaf node in Merkle tree;Conversely, providing the position serial number of some leaf node, can also countCalculate the backtracking path of the leaf node.
The backtracking path be leaf node by the way that mostly wheel Hash iteration traces back to Merkle root vertex during, each KazakhstanThe uncommon factor is mutual to put in order, and unrelated with specific hashed value.Institute's rheme serial number leaf node is in affiliated Merkle treeIn sequence of positions, i.e. which leaf node.For example, including 2nIn the full binary tree of a leaf node, the position serial number of leaf nodeIt is followed successively by i=0,1,2 ..., 2n-1.Specifically, the position serial number of leaf node recalls the relationship in path with it are as follows: by leaf segment point sequenceNumber it is converted into binary system, then turned left backward ranking, since first Hash factor (leaf node itself), new Hash from the right sideThe factor meets 0 to postpone, and before meeting 1 to set, by taking turns Hash iteration, finally traces back to the root node of Merkle tree more.The Kazakhstan obtained in this wayUncommon factor sequence is exactly the backtracking path of the leaf node.
As shown in figure 3, a system ledger tree of insertion is to include 16 leaf nodes in account block link compositionFull binary tree, leaf node trace back to system ledger root vertex ROOT need 4 (log216) Hash iteration.Wherein, riBothI-th of leaf node of system ledger tree, at the same be also position serial number i(i=0..15) individual ledger tree root noderooti.Enable xj(j=1..4) is ri4 path nodes in trace-back process, although xjNumerical value it is ever-changing, but to sameFor the serial number i of position, each xjFront-rear position be fixed, i.e. riHash sequence sequence be constant.
If as a result, with r2For, 2=(0010)2, then corresponding Hash sequence is (x2r2x1x3x4), that is, by leaf node r2It returnsIt traces back to the Hash iteration sequence of root ROOT are as follows:
ROOT=hash(hash(hash(x2|hash(r2|x1))|x3)|x4), it is abbreviated as ROOT=hash (x2r2x1x3x4)。
If with r11For, 11=(1011)2, then corresponding Hash sequence is (x4x2x1r11x3), that is, by leaf node r11BacktrackingTo the Hash iteration sequence of root ROOT are as follows:
ROOT=hash(x4|hash(hash(x2|hash(x1|r11)) |x3)), it is abbreviated as ROOT=hash (x4x2x1r11x3)。
It should be noted that the subsequent growth of system ledger tree has no effect on original account leaf node riRelative to previousxjSequence.I.e. as the time increases, bank size expands, and more accounts are created, and system ledger tree extends to the right, butThe new Hash factor is only placed in the right of current Hash sequence by the Hash sequence before having no effect on extension, new backtracking path?.Equally with r2And r11For, when in Fig. 3 SLT by 16 point spreads be 32 node when, 2=(00010)2, r2Corresponding HashSequence is (x2r2x1x3x4x5);11=(01011)2, r11Corresponding Hash sequence is (x4x2x1r11x3x5)。
The fixed position serial number of the root node setting of all individual ledger trees in system ledger tree, and referring to citizen's bodyThe coding mode of the essential informations such as personal address code, birthday, this serial number direct coding is written in the account of depositor in part card,Account information discloses owner.In this way, the people that transfers accounts is aware of the account of counterpart, it is also known that the individual of counterpartLeaf segment point serial number of the root node root of ledger tree CLT in SLT, has equally also been known that the root Hash iterates toThe backtracking path of SLT_ROOT.Bank thus be can effectively prevent using the possibility of data edge note " unilateral account ", that is, use otherLeaf node pretends to be the possibility of true sale other side.
As shown in figure 4, the checking method of transferring accounts based on Merkle tree backtracking location technology, the examination includes that general ledger is checkedIt is checked with ledger;
(1) general ledger examination is for verifying transaction existence, i.e., according to exchange hour, in the system general ledger tree GLT of corresponding blockCheck whether the transaction occurred strictly according to the facts;
(2) ledger examination checks newest system ledger tree SLT, whether the transaction is same for verifying authenticity of transferring accountsSample is strictly according to the facts to be recorded in oneself and the individual ledger of counterpart.
The checking method the following steps are included:
S11. the transaction leaf node that client is chosen on itself individual ledger tree is used as wait check transaction, is corresponded toTransaction hashed value be sent to center-side as echo request;
S12. the examination of client executing general ledger and ledger examination.
General ledger examination specifically: client is returned according to center-side, wait check in corresponding block of trading, fromGiven transaction hashed value to itself build chain system general ledger root vertex GLT_ROOT the path Merkle, pass through Hash iterationVerify the correctness in the path;
The ledger examination specifically:
S121. client is returned according to center-side, in newest block, from the root of itself individual ledger tree to systemThe path Merkle of ledger root vertex SLT_ROOT and from the root of counterpart individual ledger tree to system ledgerThe correctness in two paths Merkle is verified in the path Merkle of root vertex SLT_ROOT by Hash iteration;
S122. according to two paths Merkle in step S121, client application Merkle tree recalls location technology, respectivelyItself and leaf segment point serial number of the counterpart in system ledger tree are calculated, and compares whether the two serial numbers are distinguishedIt is consistent with the position serial number code in respective account;
S123. client according to center-side return slave given transaction hashed value to counterpart's individual ledger tree root valueThe correctness in the path is verified in the path Merkle by Hash iteration.
Before the general ledger examination and ledger examination carry out Transaction Inquiries, need advanced row data synchronous and data verification.
The synchronous synchronization including build chain of the data is synchronous with individual ledger, specifically: client sends dataCenter-side is updated request to, updates the maximum block number in request including client local build chain, and on the CLT of local mostThe hashed value of end transaction leaf node;Then all new blocks after the maximum block number that center-side returns, Yi Jiben are receivedThe hashed value of all newest transaction of the CLT and newest root root after ground most end transaction leaf node.
The data verification specifically:
(1) client is using the hashed value of the last one block of build chain before synchronizing as starting point, to synchronize the last one rear blockHashed value is terminal, and the continuity of build chain data is verified by Hash iteration;
(2) client, using the CLT root root after synchronizing as terminal, passes through using a nearest quasi- root node before synchronizing as starting pointThe continuity of Hash calculation verifying CLT data.
The beneficial effects of the present invention are:
(1) take into account data transparency and execution efficiency: writing to test and separate by data realizes bank and efficiently concentrates book keeping operation, depositorThe new mode for dispersing democratic supervision greatly promotes bank's public affairs letter by inspection supervision mechanism " latching " data of ledger treeThe role of bank is changed the go-between being subjected to supervision by traditional manager by power;
(2) take into account secret protection and Fund Supervision: compared to bit coin network, irrelevant personnel can not obtain the transaction of other depositorsRecord and account information, can not also know the globality business information of bank, while data storage centerization and can not distortFeature is also convenient for auditing bodies and implements supervision and internal auditing to bank;
(3) system reform is easy, and implementation cost is low: without additionally creating public chain or the new digital cash of distribution, only by drawingThe storage for entering asymmetric encryption account management technology and carrying out block chain type to accounting data is transformed, and bank can be allowed to keep systemWhile system Central Position, the characteristic service and function of numerous ideal moneys are realized.
It should be noted that for simple description, therefore, it is stated as a systems for each embodiment of the method above-mentionedThe combination of actions of column, but those skilled in the art should understand that, the application is not limited by the described action sequence, becauseFor according to the application, certain some step be can be performed in other orders or simultaneously.Secondly, those skilled in the art also shouldKnow, the embodiments described in the specification are all preferred embodiments, related movement and unit not necessarily this ShenIt please be necessary.
In the above-described embodiments, it all emphasizes particularly on different fields to the description of each embodiment, is not described in some embodimentPart, reference can be made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be withRelevant hardware is instructed to complete by computer program, the program can be stored in computer-readable storage mediumIn, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can be magneticDish, CD, ROM, RAM etc..
The above disclosure is only the preferred embodiments of the present invention, cannot limit the right model of the present invention with this certainlyIt encloses, therefore equivalent changes made in accordance with the claims of the present invention, is still within the scope of the present invention.