WO2020220806A1 - 基于私有链的数据一致性验证方法、装置、设备及介质 - Google Patents

基于私有链的数据一致性验证方法、装置、设备及介质 Download PDF

Info

Publication number
WO2020220806A1
WO2020220806A1 PCT/CN2020/076398 CN2020076398W WO2020220806A1 WO 2020220806 A1 WO2020220806 A1 WO 2020220806A1 CN 2020076398 W CN2020076398 W CN 2020076398W WO 2020220806 A1 WO2020220806 A1 WO 2020220806A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
identifier
subscription
subscription table
private chain
Prior art date
Application number
PCT/CN2020/076398
Other languages
English (en)
French (fr)
Inventor
翁玉萍
卢道和
周杰
卓燕坤
方镇举
陈文龙
黄涛
袁文静
Original Assignee
深圳前海微众银行股份有限公司
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 深圳前海微众银行股份有限公司 filed Critical 深圳前海微众银行股份有限公司
Publication of WO2020220806A1 publication Critical patent/WO2020220806A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • 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/02Banking, e.g. interest calculation or account maintenance

Definitions

  • This application relates to the field of blockchain technology, and in particular to a data consistency verification method, device, equipment and medium based on a private chain.
  • Banks and partners generally use FTP (File Transfer Protocol) data files on T+1 days to verify the accounts at the intermediate sites of both parties.
  • FTP File Transfer Protocol
  • the timeliness is not high and there is a risk of data loss and tampering.
  • it relies on partners to actively initiate publication or subscription to obtain data and then jointly perform manual verification of offline publication data and subscription data. The verification efficiency is low. Therefore, the project progress is slow and does not meet the requirements of agile development and testing.
  • the main purpose of this application is to provide a data consistency verification method, device, equipment and medium based on a private chain, aiming to solve the technical problem of low efficiency of consistency verification of published data and subscription data in the prior art.
  • this application provides a data consistency verification method based on a private chain.
  • the data consistency verification method based on a private chain includes the following steps:
  • the publishing table stores the original data published by the publisher on the private chain
  • a data consistency verification report is generated according to the verification result of whether the data in the subscription table is consistent with the data in the publishing table.
  • the step of verifying whether the data in the subscription table is complete according to a preset integrity check rule includes:
  • the second data identifier is not the same as the first data identifier, calculate the total amount of first data corresponding to all data identifiers in the subscription table that are greater than the first data identifier and less than or equal to the second data identifier, and The total amount of second data corresponding to all data identifiers in the release table that is greater than the first data identifier and less than or equal to the second data identifier;
  • the step of judging whether the data in the subscription table is complete according to whether the total amount of the first data is equal to the total amount of the second data includes:
  • the method further includes:
  • the method further includes:
  • the step of verifying whether the data in the subscription table is consistent with the data in the publishing table according to a preset matching rule includes:
  • the data in the subscription table does not completely match the data in the publishing table, it is determined that the data in the subscription table is inconsistent with the data in the publishing table.
  • the step of generating a data consistency verification report according to a verification result of whether the data in the subscription table is consistent with the data in the publication table includes:
  • a data consistency verification report is generated according to the verification result of whether the data in the subscription table is consistent with the data in the publication table, and the data consistency verification report is sent to the user terminal.
  • the present application also provides a data consistency verification device based on a private chain, and the data consistency verification device based on a private chain includes:
  • the first verification module is configured to verify whether the data in the subscription table is complete according to a preset integrity check rule, and the subscription table stores subscription data on the private chain sent to the subscriber;
  • the second verification module is configured to, if the data in the subscription table is complete, verify whether the data in the subscription table is consistent with the data in the publishing table according to the preset matching rules, and the publishing table stores the data published by the publisher in the private Raw data on the chain;
  • the report generation module is used to generate a data consistency verification report based on the verification result of whether the data in the subscription table is consistent with the data in the release table.
  • the present application also provides a data consistency verification device based on a private chain.
  • the data consistency verification device based on a private chain includes a memory, a processor, and a memory and a processor.
  • the present application also provides a computer-readable storage medium that stores a data consistency verification program based on a private chain, and the data consistency verification based on a private chain
  • the program is executed by the processor, the steps of the data consistency verification method based on the private chain as described above are realized.
  • This application verifies whether the data in the subscription table is complete according to preset integrity verification rules.
  • the subscription table stores subscription data on the private chain sent to the subscriber; if the data in the subscription table is complete, it will Suppose the matching rule verifies whether the data in the subscription table is consistent with the data in the publishing table, and the publishing table stores the original data published by the publisher on the private chain; according to the data in the subscription table and the publishing table The verification result of whether the data is consistent generates a data consistency verification report.
  • This application implements online verification of published data and subscription data by verifying the integrity of the subscription table and verifying the consistency of the subscription table and the publishing table, thereby improving the efficiency of reconciliation of publisher data and subscriber data.
  • FIG. 1 is a schematic structural diagram of a device hardware operating environment involved in an embodiment of a data consistency verification device based on a private chain in this application;
  • FIG. 2 is a schematic flowchart of a first embodiment of a data consistency verification method based on a private chain of this application;
  • FIG. 3 is a schematic diagram of functional modules of a preferred embodiment of a data consistency verification device based on a private chain of the present application.
  • FIG. 1 is a schematic structural diagram of a device hardware operating environment involved in an embodiment of a private chain-based data consistency verification device in this application.
  • the data consistency verification device based on the private chain may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005.
  • the communication bus 1002 is used to implement connection and communication between these components.
  • the user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as a magnetic disk memory.
  • the memory 1005 may also be a storage device independent of the foregoing processor 1001.
  • the hardware structure of the data consistency verification device based on the private chain shown in FIG. 1 does not constitute a limitation on the data consistency verification device based on the private chain, and may include more or more Few parts, or combination of some parts, or different parts arrangement.
  • the memory 1005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a data consistency verification program based on a private chain.
  • the operating system is a program that manages and controls the data consistency verification equipment and software resources based on the private chain, and supports the operation of network communication modules, user interface modules, data consistency verification programs based on the private chain, and other programs or software;
  • the communication module is used to manage and control the network interface 1004;
  • the user interface module is used to manage and control the user interface 1003.
  • the network interface 1004 is mainly used to connect to the back-end server and perform data communication with the back-end server;
  • the user interface 1003 is mainly used to connect to the client (user side), Perform data communication with the client;
  • the processor 1001 can call the data consistency verification program based on the private chain stored in the memory 1005, and execute the following operations of the data consistency verification method based on the private chain.
  • the specific implementation of the data consistency verification device based on the private chain of this application is basically the same as the following embodiments of the data consistency verification method based on the private chain, and will not be repeated here.
  • This application also provides a data consistency verification method based on a private chain.
  • Fig. 2 is a schematic flowchart of a first embodiment of a method for verifying data consistency based on a private chain of the present application.
  • the embodiment of this application provides an embodiment of a method for verifying data consistency based on a private chain. It should be noted that although the logical sequence is shown in the flowchart, in some cases, the sequence may be different from here. Perform the steps shown or described.
  • a blockchain is a chain composed of a series of blocks. In addition to recording the data of this block, each block also records the Hash (hash) value of the previous block. In this way, a chain is formed.
  • a block consists of a block header and a block body.
  • the block header definition includes important fields such as the height of the block and the hash value of the previous block.
  • the block body mainly stores transaction data. Nodes specifically refer to the network nodes that participate in the blockchain network for transactions and data exchange.
  • Each independent institution member can have one or more transaction nodes.
  • Each transaction node is a set of physical networks, computers, and blockchain applications. The combination of software and database.
  • the nodes are connected to each other through TCP/IP (Transmission Control Protocol/Internet Protocol, Transmission Control Protocol/Internet Protocol) protocol.
  • TCP/IP Transmission Control Protocol/Internet Protocol, Transmission Control Protocol/Internet Protocol
  • Public chain refers to a blockchain that anyone in the world can read, send transactions and can effectively confirm, and can also participate in the consensus process.
  • the public chain provides services to the public.
  • Private chain refers to a blockchain in which all nodes in the network are in the hands of an organization.
  • the private chain provides services to specific organizations.
  • Data consistency verification methods based on private chains include:
  • Step S10 verifying whether the data in the subscription table is complete according to a preset integrity verification rule, and the subscription data on the private chain sent to the subscriber is stored in the subscription table;
  • the publishing node corresponding to the publisher system and the subscribing node corresponding to the subscriber system are both connected to the private chain and become nodes in the private chain.
  • Each node of the private chain adopts PBFT (Practical Byzantine Fault Tolerance, Practical Byzantine Fault Tolerance) consensus algorithm or RAFT algorithm (a distributed consensus algorithm) to reach consensus, and the conditions for reaching consensus are determined by the specific consensus algorithm used. This embodiment will not repeat this. All nodes of the private chain jointly confirm transactions in the private chain.
  • PBFT Practical Byzantine Fault Tolerance
  • RAFT algorithm a distributed consensus algorithm
  • the publishing node and the subscribing node use the same API (Application Programming Interface) to connect to the private chain, which avoids the existence of different merchants (publishers and subscribers) in the prior art
  • API Application Programming Interface
  • Different API interfaces need to be compatible with different interface standards during the data interaction process of different merchants, and the high cost of data interaction between different merchants improves the access efficiency of publishing nodes and subscription nodes in the private chain, and reduces The access cost of publishing nodes and subscribing nodes to the blockchain.
  • the open platform of the private chain can provide an open platform interface.
  • the publisher system and the subscriber system can access the private chain through the open platform interface and become a node in the private chain; or
  • the docking platform between the publisher system and the subscriber system is connected to the development platform of the private chain; or the publisher system and the subscriber system are connected to the trading platform of the private chain as a node of the private chain.
  • each service in the private chain service network, each service has an event-driven private chain corresponding to it, and each service corresponds to a unique corresponding service identifier, and each specific service has a different Business scenario, each business scenario has a unique corresponding business scenario identifier.
  • the publisher uploads the original data of the current business to the corresponding business private chain, the original data of the current business is stored in the private chain, and at the same time, the original data of the current business is stored in the original data of the publisher. Release table.
  • the subscription data sent to the subscriber is stored in the subscription table for confirmation of the subscription table and The consistency of the data in the release table. If there is no data loss or other data damage, the data in the subscription table and the data in the publication table should be exactly the same.
  • the data consistency verification of the private chain can be initiated when the consistency verification instruction is received, or it can be initiated by itself according to the preset consistency verification frequency.
  • the operation and maintenance personnel can set it as needed, and this embodiment does not make specific details. limit.
  • the data consistency verification based on the private chain can be to verify all business data in the private chain network, or to verify one of the services or multiple services.
  • the operation and maintenance personnel can set it according to their needs.
  • the embodiment does not make specific restrictions.
  • the integrity of the data in the subscription table must first be verified, that is, whether the data in the subscription table is complete according to the preset integrity verification rules. Specifically, the first data identifier in the summary table and the second data identifier of the latest data in the subscription table are acquired according to a preset frequency, and it is verified whether the second data identifier is the same as the first data identifier, and the first data identifier is the last one.
  • the total amount of data, and the total amount of the second data in the release table that is greater than the first data identifier and less than or equal to all the data identifiers of the second data identifier determine whether the total amount of data in the subscription table is equal to Is the data complete? If the second data identifier is the same as the first data identifier, it means that the data in the subscription table has not been updated within the preset time period after the last integrity verification, and there is no need to perform subsequent steps.
  • Step S20 If the data in the subscription table is complete, verify whether the data in the subscription table is consistent with the data in the publishing table according to the preset matching rules, and the publishing table stores the original data published by the publisher on the private chain. data;
  • the data in the subscription table and the data in the publication table need to be verified for consistency. Specifically, the data in the subscription table is matched with the data in the publication table based on a preset field; if the data in the subscription table exactly matches the data in the publication table, the data in the subscription table is determined It is consistent with the data in the publishing table; if the data in the subscription table does not completely match the data in the publishing table, it is determined that the data in the subscription table is inconsistent with the data in the publishing table.
  • the subscription table and the publishing table use the same preset fields, and the preset fields are set by the operation and maintenance personnel according to needs, and this embodiment does not make specific restrictions.
  • Step S30 Generate a data consistency verification report based on the verification result of whether the data in the subscription table is consistent with the data in the publishing table.
  • the verification result of the subscription form that has undergone integrity verification and consistency verification is generated to generate a data consistency verification report based on the business identifier, and the data consistency verification report is sent to the user terminal that initiated the verification.
  • the business identifier, the business scenario identifier (the business scenario under the specific business, that is, the subunit of the business identifier), the data consistency flag, etc. are used as the table fields of the data consistency verification report, and each field is divided according to the consistency verification result. The value of is written into the report, and the data consistency verification report based on the business identification is obtained.
  • the data consistency verification report includes, but is not limited to, business identification, business scenario identification (business scenarios under a specific business, that is, a subunit of business identification), data consistency flags, or other data consistency verification related more Or less data, this embodiment does not limit it.
  • this solution can be used for blockchain business testers to test and verify blockchain functions and data.
  • the testers use the private chain management platform as a publisher to publish data and also subscribe as a subscriber Data
  • the data consistency verification based on the private chain is also initiated by the tester, and the data consistency verification report is received, so that the tester can realize the publishing and subscription functions of the private chain at the same time, and improve the efficiency of data self-test and joint debugging.
  • the tester can be a third party, or can be either the publisher or the subscriber.
  • This embodiment verifies whether the data in the subscription table is complete according to a preset integrity check rule.
  • the subscription table stores subscription data on the private chain sent to the subscriber; if the data in the subscription table is complete, then The preset matching rule verifies whether the data in the subscription table is consistent with the data in the publishing table.
  • the publishing table stores the original data published by the publisher on the private chain; according to the data in the subscription table and the publishing table The verification result of whether the data in the data is consistent generates a data consistency verification report.
  • step S10 includes:
  • Step S11 Obtain the first data identifier in the summary table and the second data identifier of the latest data in the subscription table according to a preset frequency, and verify whether the second data identifier is the same as the first data identifier, and the first data
  • the identifier is the data identifier of the latest data in the subscription table obtained last time
  • data identification means that each transaction data on the private chain has a corresponding data identification (EVENT ID).
  • EVENT ID data identification
  • the size of the data identifier of transaction data is constantly increasing. For example, if the EVENT ID of the latest piece of data in the currently acquired subscription table is 1, then the EVENT ID of the subsequent piece of data is 2, and the subsequent EVENT IDs will be sequentially For 3, 4, 5,..., the size of the EVENT ID increases one by one.
  • the integrity verification of the subscription form data may be performed according to a preset frequency, where the preset frequency may be set according to specific needs, which is not limited in this embodiment.
  • the preset frequency is to conduct integrity verification every 1 hour
  • the summary table stores the EVENT ID of the latest data in the subscription table obtained at the preset frequency during the last integrity verification, that is, the first data identifier.
  • the first data identifier MAX B in the frequency acquisition summary table and the EVENT ID of the latest data in the subscription table, that is, the second data identifier MAX A determine whether MAX A and MAX B are equal.
  • the summary table stores the EVENT ID of the latest data in the subscription table obtained at the preset frequency during the last integrity verification, MAX A ⁇ MAX B.
  • Step S12 If the second data identifier is not the same as the first data identifier, calculate the total amount of first data corresponding to all data identifiers in the subscription table that are greater than the first data identifier and less than or equal to the second data identifier. And the total amount of second data corresponding to all data identifiers in the release table that are greater than the first data identifier and less than or equal to the second data identifier;
  • MAX A and MAX B are equal, it means that the data has not been updated within the preset period of time after the last integrity verification, and there is no need to perform subsequent steps. If MAX A and MAX B are not equal, it means that the data in the subscription table has been updated for the preset duration after the last integrity verification, and you need to verify the total amount of data updated in the subscription table during this period of time and the release table Whether the total amount of updated data is equal, first calculate the total amount of data of all EVENT IDs in the subscription table that are greater than MAX B and less than or equal to MAX A, that is, the first total amount of data, and the release table is greater than MAX B and less than Or equal to the total amount of data of all EVENT IDs of MAX A, that is, the total amount of second data.
  • Step S13 judging whether the data in the subscription table is complete according to whether the total amount of the first data is equal to the total amount of the second data.
  • a if the total amount of the first data is equal to the total amount of the second data, it is determined that the data in the subscription table is complete;
  • the first data identifier MAX B in the summary table is updated to the second data identifier MAX A for use in the next data consistency verification. Realize data tracking.
  • alarm information is sent to the preset alarm terminal to prompt the operation and maintenance personnel to perform manual intervention.
  • the preset alarm terminal Send alarm information to remind operation and maintenance personnel to perform manual intervention to troubleshoot problems.
  • step S10 further includes:
  • the data identification of the latest data in the subscription table is updated and stored in the summary table for use in the next data consistency verification.
  • Data tracking and because each verification only needs to verify the data updated within the preset time period, there is no need to scan all data, which greatly improves the efficiency of data integrity verification.
  • step S20 includes:
  • Step S21 matching the data in the subscription table with the data in the publishing table based on preset fields
  • the integrity verification of the data in the subscription table is completed, consistency verification is performed on the subscription table data and the published table data.
  • the data in the subscription table and the data in the publishing table are matched one by one based on the preset field.
  • the subscription table and the publishing table use the same preset fields, and the preset fields are set by the operation and maintenance personnel according to needs, and this embodiment does not make specific restrictions.
  • Step S22 if the data in the subscription table exactly matches the data in the publication table, it is determined that the data in the subscription table is consistent with the data in the publication table;
  • Step S23 If the data in the subscription table does not completely match the data in the publishing table, it is determined that the data in the subscription table is inconsistent with the data in the publishing table.
  • the data in the subscription table matches the data in each field of the publication table, that is, a complete match, it is determined that the data in the subscription table is consistent with the data in the publication table; if the data in the subscription table matches the publication If there is one mismatch or multiple mismatches in the data in the data preset field in the table, that is, incomplete match, it is determined that the data in the subscription table is inconsistent with the data in the publication table.
  • the data content of the subscription table and the publication table are aligned through the business identification and the data identification, and the data is matched based on the preset fields. If the subscription table and the publication table are exactly the same, the data consistency flag is set to 1, if the subscription table If it is not completely consistent with the release table, set the data consistency flag to 0.
  • the verification result is generated into a data consistency verification report based on the business identifier.
  • the business identifier, the business scenario identifier (the business scenario under the specific business, that is, the subunit of the business identifier), the data consistency flag, etc. are used as the table fields of the data consistency verification report, and each field is divided according to the consistency verification result. The value of is written into the report, and the data consistency verification report based on the business identification is obtained.
  • the data consistency verification report includes, but is not limited to, business identification, business scenario identification (business scenarios under a specific business, that is, a subunit of business identification), data consistency flags, or other data consistency verification related more Or less data, this embodiment does not limit it.
  • step S20 further includes:
  • step S30 includes:
  • the user terminal Upon receiving the report query request sent by the user terminal, obtain the query authority identifier and/or target service identifier carried in the report query request; determine whether the user terminal has query according to the query authority identifier and/or target service identifier Permission; if the user terminal has query permission, a data consistency verification report is generated based on the verification result of whether the data in the subscription table is consistent with the data in the publication table, and the data consistency verification report is sent to the The user terminal.
  • the private link data includes a large amount of user data, these data may involve the user's privacy.
  • the data consistency verification report when the data consistency verification report is obtained, it is first encrypted according to a pre-appointed data encryption protocol, and then the encrypted data is returned to the user terminal.
  • the verification result is obtained by matching the data in the subscription table with the data in the publishing table based on preset fields, and sends the verification result to the verification requester, without requiring the publisher and subscriber to export the billing data from the corresponding system Reconciliation is then carried out to improve the consistency verification efficiency of published data and subscribed data, and realize the intelligent verification of data consistency based on the private chain.
  • This application also provides a data consistency verification device based on a private chain.
  • Fig. 3 is a schematic diagram of the functional modules of the first embodiment of a data consistency verification device based on a private chain of the present application.
  • the data consistency verification device based on the private chain includes:
  • the first verification module 10 is configured to verify whether the data in the subscription table is complete according to a preset integrity verification rule, and the subscription table stores subscription data on the private chain sent to the subscriber;
  • the second verification module 20 is configured to, if the data in the subscription table is complete, verify whether the data in the subscription table is consistent with the data in the publishing table according to preset matching rules, and the publishing table stores the data published by the publisher.
  • the report generation module 30 is configured to generate a data consistency verification report according to the verification result of whether the data in the subscription table is consistent with the data in the release table.
  • the embodiment of the present application also proposes a computer-readable storage medium.
  • the computer-readable storage medium stores a data consistency verification program based on a private chain, and when the data consistency verification program based on a private chain is executed by a processor, the steps of the data consistency verification method based on the private chain as described above are implemented.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Storage Device Security (AREA)

Abstract

一种基于私有链的数据一致性验证方法、装置、设备及存储介质,该方法包括以下步骤:按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据(S1);若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据(S2);根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表(S3)。所述方法通过对订阅表进行完整性验证和对订阅表与发布表的一致性进行验证,实现了发布数据和订阅数据的线上验证,进而提高了发布方数据和订阅方数据对账的效率。

Description

基于私有链的数据一致性验证方法、装置、设备及介质
本申请要求于2019年4月30日提交中国专利局、申请号为201910365927.8、发明名称为“基于私有链的数据一致性验证方法、装置、设备及介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。
技术领域
本申请涉及区块链技术领域,尤其涉及一种基于私有链的数据一致性验证方法、装置、设备及介质。
背景技术
随着金融科技(Fintech),尤其是互联网科技金融的不断发展,区块链(Block chain)技术被逐渐引入银行等金融机构的业务交易中。
银行与合作方的对账一般采用T+1日FTP(File Transfer Protocol,文件传输协议)数据文件到双方中间站点来核对的方式,时效不高且数据存在丢失和被篡改的风险。为了满足对账实时性、交易数据不可篡改、不可丢失的要求,现有一种基于事件驱动的区块链方案,但是在该方案中不同业务项目私有链相互独立、各自维护,私有链下的数据相互隔离,没有形成完整的链上数据一致性校验,联调时依赖合作方主动发起发布或者订阅获取数据后再共同进行线下发布数据和订阅数据的人工核对校验,校验效率低下,因此项目进度缓慢,不满足敏捷开发测试需求。
发明概述
技术问题
问题的解决方案
技术解决方案
本申请的主要目的在于提供一种基于私有链的数据一致性验证方法、装置、设备及介质,旨在解决现有技术发布数据与订阅数据的一致性校验效率低下的技术问题。
为实现上述目的,本申请提供一种基于私有链的数据一致性验证方法,所述基 于私有链的数据一致性验证方法包括以下步骤:
按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;
若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;
根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。
可选地,所述按照预设完整性校验规则验证订阅表中的数据是否完整的步骤包括:
按照预设频率获取汇总表中的第一数据标识和订阅表中最新数据的第二数据标识,验证所述第二数据标识与所述第一数据标识是否相同,所述第一数据标识为上一次获取到的订阅表中最新数据的数据标识;
若所述第二数据标识与所述第一数据标识不相同,则计算所述订阅表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第一数据总量,和发布表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第二数据总量;
根据所述第一数据总量与所述第二数据总量是否相等判断所述订阅表中的数据是否完整。
可选地,所述根据所述第一数据总量与所述第二数据总量是否相等判断所述订阅表中的数据是否完整的步骤包括:
若所述第一数据总量与所述第二数据总量相等,则判定所述订阅表中的数据完整;
若所述第一数据总量与所述第二数据总量不相等,则判定所述订阅表中的数据不完整。
可选地,所述若所述第一数据总量与所述第二数据总量相等,则判定所述订阅表中的数据完整的步骤之后,还包括:
将所述汇总表中的第一数据标识更新为所述第二数据标识,以供下次数据一致 性验证使用。
可选地,所述若所述第一数据总量与所述第二数据总量不相等,则判定所述订阅表中的数据不完整的步骤之后,还包括:
向预设告警终端发送告警信息,以提示运维人员进行人工干预。
可选地,所述根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致的步骤包括:
基于预设字段将所述订阅表中的数据与发布表中的数据进行匹配;
若所述订阅表中的数据与发布表中的数据完全匹配,则判定所述订阅表中的数据与发布表中的数据一致;
若所述订阅表中的数据与发布表中的数据不完全匹配,则判定所述订阅表中的数据与发布表中的数据不一致。
可选地,所述根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表的步骤包括:
在接收到用户终端发送的报表查询请求时,获取所述报表查询请求携带的查询权限标识和/或目标业务标识;
根据所述查询权限标识和/或目标业务标识判断所述用户终端是否具有查询权限;
若所述用户终端具有查询权限,则根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表,并将所述数据一致性验证报表发送至所述用户终端。
进一步地,为实现上述目的,本申请还提供一种基于私有链的数据一致性验证装置,所述基于私有链的数据一致性验证装置包括:
第一验证模块,用于按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;
第二验证模块,用于若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;
报表生成模块,用于根据所述订阅表中的数据与发布表中的数据是否一致的验 证结果生成数据一致性验证报表。
进一步地,为实现上述目的,本申请还提供一种基于私有链的数据一致性验证设备,所述基于私有链的数据一致性验证设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的基于私有链的数据一致性验证程序,所述基于私有链的数据一致性验证程序被所述处理器执行时实现如上述所述的基于私有链的数据一致性验证方法的步骤。
进一步地,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有基于私有链的数据一致性验证程序,所述基于私有链的数据一致性验证程序被处理器执行时实现如上所述的基于私有链的数据一致性验证方法的步骤。
本申请通过按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。本申请通过对订阅表进行完整性验证和对订阅表与发布表的一致性进行验证,实现了发布数据和订阅数据的线上验证,进而提高了发布方数据和订阅方数据对账的效率。
发明的有益效果
对附图的简要说明
附图说明
图1为本申请基于私有链的数据一致性验证设备实施例方案涉及的设备硬件运行环境的结构示意图;
图2为本申请基于私有链的数据一致性验证方法第一实施例的流程示意图;
图3为本申请基于私有链的数据一致性验证装置较佳实施例的功能模块示意图。
本申请目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
发明实施例
本发明的实施方式
应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
需要说明的是,在面对传统银行与合作方的对账一般采用T+1日FTP数据文件进行对账而存在时效不高、数据易丢失和被篡改的缺陷的情况下,提出一种基于事件驱动的区块链方案,但该方案在实际测试过程中,发现不同业务项目私有链相互独立、各自维护,私有链下的数据相互隔离,没有形成完整的链上数据一致性校验,联调时依赖合作方主动发起发布或者订阅获取数据后再共同进行线下发布数据和订阅数据的人工核对校验,校验效率低下,因此项目进度缓慢,不满足敏捷开发测试需求。
基于上述缺陷,本申请提供一种基于私有链的数据一致性验证设备,参照图1,图1为本申请基于私有链的数据一致性验证设备实施例方案涉及的设备硬件运行环境的结构示意图。
如图1所示,该基于私有链的数据一致性验证设备可以包括:处理器1001,例如CPU,通信总线1002、用户接口1003,网络接口1004,存储器1005。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储设备。
本领域技术人员可以理解,图1中示出的基于私有链的数据一致性验证设备的硬件结构并不构成对基于私有链的数据一致性验证设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图1所示,作为一种计算机可读存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及基于私有链的数据一致性验证程序。其中,操作系统是管理和控制基于私有链的数据一致性验证设备与软件资源的程序,支持网络通信模块、用户接口模块、基于私有链的数据一致性验证程序以及 其他程序或软件的运行;网络通信模块用于管理和控制网络接口1004;用户接口模块用于管理和控制用户接口1003。
在图1所示的基于私有链的数据一致性验证设备硬件结构中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;处理器1001可以调用存储器1005中存储的基于私有链的数据一致性验证程序,并执行以下基于私有链的数据一致性验证方法的操作。本申请基于私有链的数据一致性验证设备的具体实施方式与下述基于私有链的数据一致性验证方法各实施例基本相同,在此不再赘述。
本申请还提供一种基于私有链的数据一致性验证方法。
参照图2,图2为本申请基于私有链的数据一致性验证方法第一实施例的流程示意图。
本申请实施例提供了基于私有链的数据一致性验证方法的实施例,需要说明的是,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。
基于私有链的数据一致性验证方法应用于区块链对应的私有链中。区块链是由一系列区块组成的一条链,每个块上除了记录本块的数据还会记录上一块的Hash(哈希)值,通过这种方式组成一条链。区块链的核心理念有两个,一个是密码学技术,另一个是去中心化思想,基于这两个理念做到区块链上的历史信息无法被篡改。一个区块由块头和块体组成,其中块头定义包括该区块高度,上一个区块的哈希值等重要字段,而块体主要存储交易数据。节点特指参与到区块链网络里,进行交易和数据交换的网络节点,每个独立机构成员可以拥有一个到多个交易节点,每个交易节点是一组物理网络、计算机、区块链应用软件以及数据库的组合。节点和节点之间,通过TCP/IP(Transmission Control Protocol/Internet Protocol,传输控制协议/因特网互联协议)协议互相连接。
公有链,是指全世界任何人都可以读取、发送交易且能够有效确认的、也可以参与其中共识过程的区块链,公有链面向公众提供服务。
私有链,是指网络中的所有节点都掌握在一家机构手中的区块链,私有链面向 特定的组织内部提供服务。
在基于私有链的数据一致性验证方法的各个实施例中,为了便于描述,省略执行主体进行阐述各个实施例。基于私有链的数据一致性验证方法包括:
步骤S10,按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;
在本申请实施例中,发布方系统对应的发布节点和订阅方系统对应的订阅节点都接入私有链中,成为私有链中的节点。私有链的各个节点之间采用PBFT(Practical Byzantine Fault Tolerance,实用拜占庭容错算法)共识算法或RAFT算法(一种分布式一致性算法)达成共识,而共识达成条件由具体采用的共识算法决定,本实施例对此不作赘述。私有链的各个节点共同确认私有链中的交易。
在本申请实施例中,发布节点和订阅节点采用相同的API(Application Programming Interface,应用程序编程接口)连接到私有链中,避免了现有技术中不同商户(发布方和订阅方)之间存在不同的API接口,在不同商户对接进行数据交互过程中,需要兼容不同的接口标准,不同商户数据交互成本高的问题,提高了发布节点和订阅节点接入私有链中的接入效率,降低了发布节点和订阅节点接入区块链的接入成本。在接入私有链过程中,私有链的开放平台可提供开放平台接口,发布方系统和订阅方系统可通过该开放平台接口接入到私有链中,成为私有链中的一个节点;或者将与发布方系统和订阅方系统对接的平台接入到私有链的开发平台中;或者将发布方系统和订阅方系统作为私有链的一个节点接入到私有链的交易平台中。
在本申请实施例中,在私有链业务网络中,每个业务都有一条与之对应的基于事件驱动的私有链,每个业务对应有唯一对应的业务标识,每个具体业务下有不同的业务场景,每个业务场景有唯一对应的业务场景标识。在发布方将当前业务的原始数据上传至对应的业务私有链时,以将当前业务的原始数据存储至私有链中,同时会将该当前业务的原始数据存储至用于存储发布方原始数据的发布表中。而当向订阅方发送业务私有链上的链上数据,或者当发布方需要对链上数据进行自检时,会将发送给订阅方的订阅数据存储至订阅表中,以供确认订阅表与发布表中数据的一致性。若无数据丢失或者其他数据损害,订阅表 中的数据与发布表中的数据应该是完全一致的。
私有链的数据一致性验证可以是在接收到一致性验证指令时发起的,也可以是按照预设的一致性验证频率自行发起的,运维人员可根据需要进行设置,本实施例不做具体限制。
此外,基于私有链的数据一致性验证可以是对私有链网络中的所有业务数据进行验证,也可以是针对其中的一种业务或者多种业务进行验证,运维人员可根据需要进行设置,本实施例不做具体限制。
要对私有链的订阅表数据和发布表数据进行一致性验证,首先要对订阅表中的数据进行完整性验证,即按照预设完整性验证规则验证订阅表中的数据是否完整。具体地,按照预设频率获取汇总表中的第一数据标识和订阅表中最新数据的第二数据标识,验证第二数据标识与第一数据标识是否相同,所述第一数据标识为上一次获取到的订阅表中最新数据的数据标识;若第二数据标识与第一数据标识不相同,则计算订阅表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识的第一数据总量,和发布表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识的第二数据总量;根据第一数据总量与第二数据总量是否相等判断订阅表中的数据是否完整。若第二数据标识与第一数据标识相同,则说明在上一次完整性验证后的预设时长内订阅表内数据没有更新,则无需执行后续步骤。
步骤S20,若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;
若经过完整性验证确认订阅表中的数据完整,则需对订阅表中的数据和发布表中的数据进行一致性验证。具体地,基于预设字段将所述订阅表中的数据与发布表中的数据进行匹配;若所述订阅表中的数据与发布表中的数据完全匹配,则判定所述订阅表中的数据与发布表中的数据一致;若所述订阅表中的数据与发布表中的数据不完全匹配,则判定所述订阅表中的数据与发布表中的数据不一致。其中,订阅表与发布表采用的预设字段相同,该预设字段由运维人员根据需要进行设置,本实施例不做具体限制。
步骤S30,根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。
将经过完整性验证和一致性验证的订阅表的验证结果生成基于业务标识的数据一致性验证报表,并将所述数据一致性验证报表发送至与发起该验证的用户终端。具体地,将业务标识、业务场景标识(具体业务下的业务场景,即业务标识的子单元)、数据一致性标记位等作为数据一致性验证报表的表字段,根据一致性验证结果将各字段的取值写入报表,即得到基于业务标识的数据一致性验证报表。其中,数据一致性验证报表中包括但不限于业务标识、业务场景标识(具体业务下的业务场景,即业务标识的子单元)、数据一致性标记位或其他与数据一致性验证有关的更多或者更少的数据,本实施例不做限制。
进一步地,本方案可用于区块链业务的测试人员对区块链功能和数据的测试验证场景,在该场景下,由测试人员通过私有链管理平台作为发布方发布数据,还作为订阅方订阅数据,基于私有链的数据一致性验证也由测试人员发起,并接收数据一致性验证报表,以实现测试人员可以同时实现私有链的发布和订阅功能,提高数据自测和联调效率,同时实现私有链上测试数据的统一管理。其中,测试人员可以是第三方人员,也可以是发布方和订阅方中的任一方。
本实施例通过按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。通过对存储有订阅方的订阅数据的订阅表进行完整性验证,和,对订阅表与存储有发布方原始数据的发布表的进行一致性验证,实现了发布数据和订阅数据的线上验证,进而提高了发布方数据和订阅方数据对账的效率。
进一步地,提出本申请基于私有链的数据一致性验证方法第二实施例,上述步骤S10包括:
步骤S11,按照预设频率获取汇总表中的第一数据标识和订阅表中最新数据的第二数据标识,验证所述第二数据标识与所述第一数据标识是否相同,所述第 一数据标识为上一次获取到的订阅表中最新数据的数据标识;
在本实施例中,数据标识指的是上链到私有链上的每一条交易数据都有一个与之对应的数据标识(EVENT ID),在基于事件驱动的私有链中,随着事件的发展,交易数据的数据标识的大小是不断增大的,例如,若当前获取到的订阅表中最新一条数据的EVENT ID为1,则之后的一条数据的EVENT ID为2,再之后的EVENT ID依次为3,4,5,......,EVENT ID的大小逐条递增。
对订阅表数据进行完整性验证可以是按照预设频率进行的,其中,预设频率可根据具体需要而设置,本实施例不做限制。例如若预设频率为每1小时进行一次完整性验证,汇总表中存储有上一次完整性验证时按照预设频率获取到的订阅表中最新数据的EVENT ID,即第一数据标识,按照预设频率获取汇总表中的第一数据标识MAX B,和订阅表中最新数据的EVENT ID,即第二数据标识MAX A,判断MAX A与MAX B是否相等。
此外,由于汇总表中存储的是上一次完整性验证时按照预设频率获取到的订阅表中最新数据的EVENT ID,所以MAX A≥MAX B。
步骤S12,若所述第二数据标识与所述第一数据标识不相同,则计算所述订阅表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第一数据总量,和发布表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第二数据总量;
若MAX A与MAX B相等,说明在上一次完整性验证后的预设时长内数据没有更新,则无需执行后续步骤。若MAX A与MAX B不相等,则说明在上一次完整性验证后的预设时长订阅表内的数据有更新,则需要验证在这段时间中订阅表内更新的数据总量与发布表内更新的数据总量是否相等,首先需要计算所述订阅表中大于MAX B且小于或者等于MAX A的所有EVENT ID的数据总量,即第一数据总量,和发布表中大于MAX B且小于或者等于MAX A的所有EVENT ID的数据总量,即第二数据总量。
步骤S13,根据所述第一数据总量与所述第二数据总量是否相等判断所述订阅表中的数据是否完整。
根据第一数据总量与第二数据总量是否相等判断订阅表中的数据是否完整。
具体地,a,若所述第一数据总量与所述第二数据总量相等,则判定所述订阅表中的数据完整;
进一步地,若判定订阅表中的数据完整,则将所述汇总表中的第一数据标识MAX B更新为所述第二数据标识MAX A,以供下次数据一致性验证使用,以此循环实现数据追踪。
b,若所述第一数据总量与所述第二数据总量不相等,则判定所述订阅表中的数据不完整。
进一步地,若判定订阅表中的数据不完整,向预设告警终端发送告警信息,以提示运维人员进行人工干预。
若判定订阅表中的数据不完整,说明订阅方收到的订阅消息与发布方的原始数据不一致,可能是数据在上链或者其他数据传输的过程中发生了数据损害,则向预设告警终端发送告警信息,以提示运维人员进行人工介入排查问题。
进一步地,为了提高私有链的数据一致性验证的灵活性,上述步骤S10还包括:
按照预设频率获取订阅表和发布表各自的数据总量,根据订阅表的数据总量和发布表的数据总量是否相等判断订阅表中的数据是否完整;若订阅表的数据总量和发布表的数据总量相等,则判定订阅表中的数据完整;若订阅表的数据总量和发布表的数据总量不相等,则判定订阅表中的数据不完整。
本实施例通过在对订阅表中数据的进行完整性验证后,将本次订阅表中最新数据的数据标识更新存储至汇总表,以供下次数据一致性验证时使用,以此循环了实现数据追踪,且由于每次验证只需对预设时长内更新的数据进行验证,无需扫描所有数据,大大提高了数据完整性验证的效率。
进一步地,提出本申请基于私有链的数据一致性验证方法第三实施例,上述步骤S20包括:
步骤S21,基于预设字段将所述订阅表中的数据与发布表中的数据进行匹配;
在本实施例中,在对订阅表中的数据完成完整性验证之后,对订阅表数据和发布表数据进行一致性验证。具体地,基于预设字段将订阅表中的数据与发布表中的数据进行一一匹配。其中,订阅表与发布表采用的预设字段相同,该预设 字段由运维人员根据需要进行设置,本实施例不做具体限制。
步骤S22,若所述订阅表中的数据与发布表中的数据完全匹配,则判定所述订阅表中的数据与发布表中的数据一致;
步骤S23,若所述订阅表中的数据与发布表中的数据不完全匹配,则判定所述订阅表中的数据与发布表中的数据不一致。
若订阅表中的数据与发布表中的数据每个字段中的数据都一一匹配,即完全匹配,则判定订阅表中的数据与发布表中的数据一致;若订阅表中的数据与发布表中的数据预设字段中的数据有一个不匹配或者多个不匹配,即不完全匹配,则判定订阅表中的数据与发布表中的数据不一致。
进一步地,通过业务标识和数据标识对齐订阅表与发布表的数据内容,并基于预设字段进行数据匹配,若订阅表与发布表完全一致,则设置数据一致性标记位为1,若订阅表与发布表不完全一致,则设置数据一致性标记位为0。
进一步地,若订阅表与发布表不完全一致,则将验证结果生成基于业务标识的数据一致性验证报表。具体地,将业务标识、业务场景标识(具体业务下的业务场景,即业务标识的子单元)、数据一致性标记位等作为数据一致性验证报表的表字段,根据一致性验证结果将各字段的取值写入报表,即得到基于业务标识的数据一致性验证报表。其中,数据一致性验证报表中包括但不限于业务标识、业务场景标识(具体业务下的业务场景,即业务标识的子单元)、数据一致性标记位或其他与数据一致性验证有关的更多或者更少的数据,本实施例不做限制。
进一步地,为了提高私有链的数据一致性验证的灵活性,上述步骤S20还包括:
基于发布表的所有字段生成随机验证字段;基于随机验证字段将订阅表中的数据与发布表中的数据进行匹配;若订阅表中的数据与发布表中的数据完全匹配,则判定订阅表中的数据与发布表中的数据一致;若订阅表中的数据与发布表中的数据不完全匹配,则判定订阅表中的数据与发布表中的数据不一致。
进一步地,上述步骤S30包括:
在接收到用户终端发送的报表查询请求时,获取所述报表查询请求携带的查询 权限标识和/或目标业务标识;根据所述查询权限标识和/或目标业务标识判断所述用户终端是否具有查询权限;若所述用户终端具有查询权限,则根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表,并将所述数据一致性验证报表发送至所述用户终端。
在本实施例中,由于私有链数据中包括了用户的大量数据,这些数据可能会涉及到用户的隐私。为了保护用户的隐私,需要对数据一致性验证报表的数据调用进行权限控制。具体的,在接收到用户终端发送的报表查询请求时,获取该报表查询请求携带的查询权限标识和/或目标业务标识,将根据查询权限标识和/或目标业务标识判断该用户终端对于目标业务标识对应的业务是否具有查询权限;若该用户终端具有查询权限,则根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表,并将数据一致性验证报表发送至该用户终端;若该用户终端不具有查询权限,则向该用户终端返回对应的无权限提示。
进一步地,为了保证数据传输的安全性,在获取到数据一致性验证报表时,先根据预先约定的数据加密协议将其进行加密,再将加密后的数据返回至用户终端。
本实施例通过基于预设字段将订阅表中的数据与发布表中的数据进行匹配得到验证结果,并将验证结果发送给验证请求方,不需要发布方和订阅方从对应系统中导出账单数据后再进行对账,提高了发布数据与订阅数据的一致性校验效率,实现了基于私有链的数据一致性智能验证。
本申请还提供一种基于私有链的数据一致性验证装置。
参照图3,图3为本申请基于私有链的数据一致性验证装置第一实施例的功能模块示意图。所述基于私有链的数据一致性验证装置包括:
第一验证模块10,用于按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;
第二验证模块20,用于若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;
报表生成模块30,用于根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。
本申请基于私有链的数据一致性验证装置具体实施方式与上述基于私有链的数据一致性验证方法各实施例基本相同,在此不再赘述。
此外,本申请实施例还提出一种计算机可读存储介质。
计算机可读存储介质上存储有基于私有链的数据一致性验证程序,基于私有链的数据一致性验证程序被处理器执行时实现如上所述的基于私有链的数据一致性验证方法的步骤。
本申请计算机可读存储介质具体实施方式与上述基于私有链的数据一致性验证方法各实施例基本相同,在此不再赘述。
上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,这些均属于本申请的保护之内。

Claims (20)

  1. 一种基于私有链的数据一致性验证方法,其中,所述基于私有链的数据一致性验证方法包括以下步骤:
    按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;
    若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;
    根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。
  2. 如权利要求1所述的基于私有链的数据一致性验证方法,其中,所述按照预设完整性校验规则验证订阅表中的数据是否完整的步骤包括:
    按照预设频率获取汇总表中的第一数据标识和订阅表中最新数据的第二数据标识,验证所述第二数据标识与所述第一数据标识是否相同,所述第一数据标识为上一次获取到的订阅表中最新数据的数据标识;
    若所述第二数据标识与所述第一数据标识不相同,则计算所述订阅表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第一数据总量,和发布表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第二数据总量;
    根据所述第一数据总量与所述第二数据总量是否相等判断所述订阅表中的数据是否完整。
  3. 如权利要求2所述的基于私有链的数据一致性验证方法,其中,所述根据所述第一数据总量与所述第二数据总量是否相等判断所述订阅表中的数据是否完整的步骤包括:
    若所述第一数据总量与所述第二数据总量相等,则判定所述订阅表中的数据完整;
    若所述第一数据总量与所述第二数据总量不相等,则判定所述订阅表中的数据不完整。
  4. 如权利要求3所述的基于私有链的数据一致性验证方法,其中,所述若所述第一数据总量与所述第二数据总量相等,则判定所述订阅表中的数据完整的步骤之后,还包括:
    将所述汇总表中的第一数据标识更新为所述第二数据标识,以供下次数据一致性验证使用。
  5. 如权利要求3所述的基于私有链的数据一致性验证方法,其中,所述若所述第一数据总量与所述第二数据总量不相等,则判定所述订阅表中的数据不完整的步骤之后,还包括:
    向预设告警终端发送告警信息,以提示运维人员进行人工干预。
  6. 如权利要求1所述的基于私有链的数据一致性验证方法,其中,所述根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致的步骤包括:
    基于预设字段将所述订阅表中的数据与发布表中的数据进行匹配;
    若所述订阅表中的数据与发布表中的数据完全匹配,则判定所述订阅表中的数据与发布表中的数据一致;
    若所述订阅表中的数据与发布表中的数据不完全匹配,则判定所述订阅表中的数据与发布表中的数据不一致。
  7. 如权利要求1所述的基于私有链的数据一致性验证方法,其中,所述根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表的步骤包括:
    在接收到用户终端发送的报表查询请求时,获取所述报表查询请求携带的查询权限标识和/或目标业务标识;
    根据所述查询权限标识和/或目标业务标识判断所述用户终端是否具有查询权限;
    若所述用户终端具有查询权限,则根据所述订阅表中的数据与发 布表中的数据是否一致的验证结果生成数据一致性验证报表,并将所述数据一致性验证报表发送至所述用户终端。
  8. 一种基于私有链的数据一致性验证装置,其中,所述基于私有链的数据一致性验证装置包括:
    第一验证模块,用于按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;
    第二验证模块,用于若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;
    报表生成模块,用于根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。
  9. 如权利要求8所述的基于私有链的数据一致性验证装置,其中,所述第一验证模块还用于:
    按照预设频率获取汇总表中的第一数据标识和订阅表中最新数据的第二数据标识,验证所述第二数据标识与所述第一数据标识是否相同,所述第一数据标识为上一次获取到的订阅表中最新数据的数据标识;
    若所述第二数据标识与所述第一数据标识不相同,则计算所述订阅表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第一数据总量,和发布表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第二数据总量;
    根据所述第一数据总量与所述第二数据总量是否相等判断所述订阅表中的数据是否完整。
  10. 如权利要求8所述的基于私有链的数据一致性验证装置,其中,所述第二验证模块还用于:
    基于预设字段将所述订阅表中的数据与发布表中的数据进行匹配;
    若所述订阅表中的数据与发布表中的数据完全匹配,则判定所述订阅表中的数据与发布表中的数据一致;
    若所述订阅表中的数据与发布表中的数据不完全匹配,则判定所述订阅表中的数据与发布表中的数据不一致。
  11. 如权利要求8所述的基于私有链的数据一致性验证装置,其中,所述报表生成模块还用于:
    在接收到用户终端发送的报表查询请求时,获取所述报表查询请求携带的查询权限标识和/或目标业务标识;
    根据所述查询权限标识和/或目标业务标识判断所述用户终端是否具有查询权限;
    若所述用户终端具有查询权限,则根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表,并将所述数据一致性验证报表发送至所述用户终端。
  12. 一种基于私有链的数据一致性验证设备,其中,所述基于私有链的数据一致性验证设备包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的基于私有链的数据一致性验证程序,所述基于私有链的数据一致性验证程序被所述处理器执行时实现如下步骤:
    按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;
    若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;
    根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。
  13. 如权利要求12所述的基于私有链的数据一致性验证设备,其中,所述基于私有链的数据一致性验证程序被所述处理器执行时还实现如下步骤:
    按照预设频率获取汇总表中的第一数据标识和订阅表中最新数据的第二数据标识,验证所述第二数据标识与所述第一数据标识是否相同,所述第一数据标识为上一次获取到的订阅表中最新数据的数据标识;
    若所述第二数据标识与所述第一数据标识不相同,则计算所述订阅表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第一数据总量,和发布表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第二数据总量;
    根据所述第一数据总量与所述第二数据总量是否相等判断所述订阅表中的数据是否完整。
  14. 如权利要求13所述的基于私有链的数据一致性验证设备,其中,所述基于私有链的数据一致性验证程序被所述处理器执行时还实现如下步骤:
    若所述第一数据总量与所述第二数据总量相等,则判定所述订阅表中的数据完整;
    若所述第一数据总量与所述第二数据总量不相等,则判定所述订阅表中的数据不完整。
  15. 如权利要求12所述的基于私有链的数据一致性验证设备,其中,所述基于私有链的数据一致性验证程序被所述处理器执行时还实现如下步骤:
    基于预设字段将所述订阅表中的数据与发布表中的数据进行匹配;
    若所述订阅表中的数据与发布表中的数据完全匹配,则判定所述订阅表中的数据与发布表中的数据一致;
    若所述订阅表中的数据与发布表中的数据不完全匹配,则判定所述订阅表中的数据与发布表中的数据不一致。
  16. 如权利要求12所述的基于私有链的数据一致性验证设备,其中,所述基于私有链的数据一致性验证程序被所述处理器执行时还实 现如下步骤:
    在接收到用户终端发送的报表查询请求时,获取所述报表查询请求携带的查询权限标识和/或目标业务标识;
    根据所述查询权限标识和/或目标业务标识判断所述用户终端是否具有查询权限;
    若所述用户终端具有查询权限,则根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表,并将所述数据一致性验证报表发送至所述用户终端。
  17. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储有基于私有链的数据一致性验证程序,所述基于私有链的数据一致性验证程序被处理器执行时实现如下步骤:
    按照预设完整性校验规则验证订阅表中的数据是否完整,所述订阅表中存储有发送给订阅方的私有链上的订阅数据;
    若订阅表中的数据完整,则根据预设匹配规则验证所述订阅表中的数据与发布表中的数据是否一致,所述发布表中存储有发布方发布在私有链上的原始数据;
    根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表。
  18. 如权利要求17所述的计算机可读存储介质,其中,所述基于私有链的数据一致性验证程序被处理器执行时还实现如下步骤:
    按照预设频率获取汇总表中的第一数据标识和订阅表中最新数据的第二数据标识,验证所述第二数据标识与所述第一数据标识是否相同,所述第一数据标识为上一次获取到的订阅表中最新数据的数据标识;
    若所述第二数据标识与所述第一数据标识不相同,则计算所述订阅表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第一数据总量,和发布表中大于第一数据标识且小于或者等于第二数据标识的所有数据标识对应的第二数据总量;
    根据所述第一数据总量与所述第二数据总量是否相等判断所述订阅表中的数据是否完整。
  19. 如权利要求17所述的计算机可读存储介质,其中,所述基于私有链的数据一致性验证程序被处理器执行时还实现如下步骤:
    基于预设字段将所述订阅表中的数据与发布表中的数据进行匹配;
    若所述订阅表中的数据与发布表中的数据完全匹配,则判定所述订阅表中的数据与发布表中的数据一致;
    若所述订阅表中的数据与发布表中的数据不完全匹配,则判定所述订阅表中的数据与发布表中的数据不一致。
  20. 如权利要求17所述的计算机可读存储介质,其中,所述基于私有链的数据一致性验证程序被处理器执行时还实现如下步骤:
    在接收到用户终端发送的报表查询请求时,获取所述报表查询请求携带的查询权限标识和/或目标业务标识;
    根据所述查询权限标识和/或目标业务标识判断所述用户终端是否具有查询权限;
    若所述用户终端具有查询权限,则根据所述订阅表中的数据与发布表中的数据是否一致的验证结果生成数据一致性验证报表,并将所述数据一致性验证报表发送至所述用户终端。
PCT/CN2020/076398 2019-04-30 2020-02-24 基于私有链的数据一致性验证方法、装置、设备及介质 WO2020220806A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910365927.8A CN110096511B (zh) 2019-04-30 2019-04-30 基于私有链的数据一致性验证方法、装置、设备及介质
CN201910365927.8 2019-04-30

Publications (1)

Publication Number Publication Date
WO2020220806A1 true WO2020220806A1 (zh) 2020-11-05

Family

ID=67446718

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/076398 WO2020220806A1 (zh) 2019-04-30 2020-02-24 基于私有链的数据一致性验证方法、装置、设备及介质

Country Status (2)

Country Link
CN (1) CN110096511B (zh)
WO (1) WO2020220806A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096511B (zh) * 2019-04-30 2024-02-20 深圳前海微众银行股份有限公司 基于私有链的数据一致性验证方法、装置、设备及介质
CN111552981B (zh) * 2020-04-26 2023-08-22 深圳前海壹互联科技投资有限公司 基于区块链技术的保险业务归属方法及系统
CN113098978B (zh) * 2021-04-21 2023-04-07 上海微盟企业发展有限公司 一种数据传输方法、装置及介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106817689A (zh) * 2017-01-22 2017-06-09 兴唐通信科技有限公司 一种高可靠性的数据订阅及发布方法及系统
CN107844976A (zh) * 2017-10-25 2018-03-27 武汉天喻信息产业股份有限公司 一种基于区块链的存证应用交易系统及方法
CN108683630A (zh) * 2018-04-03 2018-10-19 阿里巴巴集团控股有限公司 跨区块链的认证方法及装置、电子设备
US20190026450A1 (en) * 2017-07-24 2019-01-24 Dell Products, Lp Method and apparatus for optimized access of security credentials via mobile edge-computing systems
CN110096511A (zh) * 2019-04-30 2019-08-06 深圳前海微众银行股份有限公司 基于私有链的数据一致性验证方法、装置、设备及介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106817689A (zh) * 2017-01-22 2017-06-09 兴唐通信科技有限公司 一种高可靠性的数据订阅及发布方法及系统
US20190026450A1 (en) * 2017-07-24 2019-01-24 Dell Products, Lp Method and apparatus for optimized access of security credentials via mobile edge-computing systems
CN107844976A (zh) * 2017-10-25 2018-03-27 武汉天喻信息产业股份有限公司 一种基于区块链的存证应用交易系统及方法
CN108683630A (zh) * 2018-04-03 2018-10-19 阿里巴巴集团控股有限公司 跨区块链的认证方法及装置、电子设备
CN110096511A (zh) * 2019-04-30 2019-08-06 深圳前海微众银行股份有限公司 基于私有链的数据一致性验证方法、装置、设备及介质

Also Published As

Publication number Publication date
CN110096511B (zh) 2024-02-20
CN110096511A (zh) 2019-08-06

Similar Documents

Publication Publication Date Title
US20220231869A1 (en) Cross-blockchain mutual data storage
WO2020220806A1 (zh) 基于私有链的数据一致性验证方法、装置、设备及介质
CN110351133A (zh) 用于区块链系统中的主节点切换处理的方法及装置
US11475150B2 (en) Methods and apparatus for implementing state proofs and ledger identifiers in a distributed database
CN110110498A (zh) 一种基于联盟链的数字版权确权方法与系统
CN107241360A (zh) 一种数据安全共享交换方法和数据安全共享交换平台系统
US20230316273A1 (en) Data processing method and apparatus, computer device, and storage medium
CN110020956A (zh) 一种跨区块链的交互方法及系统、计算机设备及存储介质
CN110428257A (zh) 密码破解任务处理方法、设备及存储介质
CN110569674A (zh) 基于区块链网络的认证方法及装置
CN111461712B (zh) 区块链供应链金融场景下的交易隐私保护和分层监管
EP3797499A1 (en) Autocommit transaction management in a blockchain network
WO2021004058A1 (zh) 基于区块链的数据处理方法和装置
TW202034198A (zh) 基於區塊鏈的流量統計方法、裝置和設備
CN110264042A (zh) 一种项目管理的方法及相关装置
CN111339550A (zh) 一种基于区块链技术的评论信息可信化方法
CN113255014A (zh) 一种基于区块链的数据处理方法以及相关设备
CN113592476A (zh) 跨链资产转移方法、计算机设备和存储介质
CN115310920A (zh) 基于治理链的跨链互操作管理方法、装置及存储介质
WO2023045532A1 (zh) 基于区块链的交易处理
Li BCES: a blockchain based credible e-bidding system
WO2022241945A1 (zh) 一种数据处理方法、设备以及计算机可读存储介质
CN108038782B (zh) 一种用于证券交易的安全系统及用于证券交易的安全校验方法
Olivares-Rojas et al. A comparative assessment of blockchains in embedded systems
CN111626735B (zh) 一种数据交互系统、方法和模块

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20799354

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20799354

Country of ref document: EP

Kind code of ref document: A1