CN111813788A - Information query method and device, and information synchronization method and device - Google Patents
Information query method and device, and information synchronization method and device Download PDFInfo
- Publication number
- CN111813788A CN111813788A CN202010431296.8A CN202010431296A CN111813788A CN 111813788 A CN111813788 A CN 111813788A CN 202010431296 A CN202010431296 A CN 202010431296A CN 111813788 A CN111813788 A CN 111813788A
- Authority
- CN
- China
- Prior art keywords
- target
- record information
- data change
- transaction
- information
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2379—Updates performed during online database operations; commit processing
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION 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/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/389—Keeping log of transactions for guaranteeing non-repudiation of a transaction
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- Data Mining & Analysis (AREA)
- General Engineering & Computer Science (AREA)
- Accounting & Taxation (AREA)
- Computing Systems (AREA)
- Finance (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本申请涉及计算机领域,尤其涉及一种信息的查询方法和装置、信息的同步方法和装置。The present application relates to the field of computers, and in particular, to a method and device for querying information, and a method and device for synchronizing information.
背景技术Background technique
区块链是一种存储技术,区块链系统可以利用密码学保证数据传输和访问的安全,生成不可伪造且不可篡改的分布式账本系统。Blockchain is a storage technology. The blockchain system can use cryptography to ensure the security of data transmission and access, and generate an unforgeable and untamperable distributed ledger system.
BaaS(Blockchain as a Service,区块链即服务)是基于区块链技术的用于帮助用户创建、管理和维护企业级区块链网络及应用的服务,BaaS可以提供基于区块链网络的资产交易模块,包括:资产交易上链、交易确认等功能。BaaS可以与区块链网络中的各个区块链节点通信,以管理和维护区块链网络。BaaS (Blockchain as a Service) is a service based on blockchain technology to help users create, manage and maintain enterprise-level blockchain networks and applications. BaaS can provide assets based on blockchain networks Transaction module, including: asset transaction on-chain, transaction confirmation and other functions. BaaS can communicate with various blockchain nodes in the blockchain network to manage and maintain the blockchain network.
在区块链中存在很多行为,例如,用户注册、用户充值、资产发行等,这些行为会产生大量的数据记录,随着区块链业务的快速增长,给数据的变更历史查询带来了严峻考验。There are many behaviors in the blockchain, such as user registration, user recharge, asset issuance, etc. These behaviors will generate a large amount of data records. With the rapid growth of blockchain business, it brings severe challenges to the query of data change history. test.
目前,区块链中一般采用遍历的方式查询数据变更历史记录。如果要统计某一种数据在区块链上的整个变更历史记录,例如,如果要查询区块链网络中的某个用户的账户资产对应变更历史交易记录,需要从区块链网络的创世区块开始遍历区块,并寻找和鉴别出区块中全部的待查询数据对应的记录值,从而得到该数据的历史变更记录。At present, the traversal method is generally used to query the data change history in the blockchain. If you want to count the entire change history of a certain kind of data on the blockchain, for example, if you want to query the change history transaction records corresponding to the account assets of a user in the blockchain network, you need to start from the creation of the blockchain network. The block starts to traverse the block, and finds and identifies the record value corresponding to all the data to be queried in the block, so as to obtain the historical change record of the data.
上述区块链中的数据历史变更记录的查询方式,主要通过按照区块的产生次序多次遍历整个区块链,得到全部的数据(例如,交易记录)。然而,上述查询方式是一个顺序串行过程,每次都需要把整个区块链遍历一次,基于区块链的特性,无法多线程/多处理器并行处理,时间成本较高,不适于海量数据的历史溯源,当数据量规模较大时,容易受到单台机器内存、处理器能力的限制。The query method of the data historical change records in the above-mentioned blockchain mainly obtains all the data (for example, transaction records) by traversing the entire blockchain multiple times according to the generation order of the blocks. However, the above query method is a sequential serial process, and the entire blockchain needs to be traversed once each time. Based on the characteristics of the blockchain, multi-thread/multi-processor parallel processing is impossible, and the time cost is high, which is not suitable for massive data. When the data volume is large, it is easily limited by the memory and processor capacity of a single machine.
因此,相关技术中的区块链数据查询方式,存在由于无法并行处理导致的查询效率低的问题。Therefore, the blockchain data query method in the related art has the problem of low query efficiency due to inability to perform parallel processing.
发明内容SUMMARY OF THE INVENTION
本申请提供了一种信息的查询方法和装置、信息的同步方法和装置,以至少解决相关技术中的区块链数据查询方式存在的由于无法并行处理导致的查询效率低的问题。The present application provides a method and device for querying information, and a method and device for synchronizing information, to at least solve the problem of low query efficiency due to inability to perform parallel processing in the blockchain data query method in the related art.
根据本申请实施例的一个方面,提供了一种信息的查询方法,包括:接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端。According to an aspect of the embodiments of the present application, a method for querying information is provided, including: receiving a query request sent by a client, wherein the query request is used for requesting to query data change record information of a target object on the blockchain; responding to the query Request, find the data change record information of the target object from the target database, where the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and one or more objects include the target object; In the case of the target data change log information corresponding to the target object, the target data change log information is sent to the client.
根据本申请实施例的另一个方面,提供了一种信息的同步方法,包括:检测到区块链上与目标键值对应的记录信息发生更新,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;确定与目标键值对应的记录信息被更新为了第一交易记录信息;将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象。According to another aspect of the embodiments of the present application, a method for synchronizing information is provided, including: detecting that the record information corresponding to the target key value on the blockchain is updated, wherein the target key value is the target object in the blockchain The identification information, the record information corresponding to the target key value is used to record the transaction information of the target object; it is determined that the record information corresponding to the target key value is updated to the first transaction record information; the first transaction record information is synchronized as in the target database The first data change record information of the target object, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and the one or more objects include the target object.
根据本申请实施例的又一个方面,提供了一种信息的查询装置,包括:第一接收单元,用于接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;查找单元,用于响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;第一发送单元,用于在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端。According to yet another aspect of the embodiments of the present application, an apparatus for querying information is provided, including: a first receiving unit, configured to receive a query request sent by a client, wherein the query request is used to request a query of a target object on the blockchain The search unit is used to respond to the query request and find the data change record information of the target object from the target database, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain , the one or more objects include a target object; the first sending unit is configured to send the target data change record information to the client when the target data change record information corresponding to the target object is found.
根据本申请实施例的又一个方面,提供了一种信息的同步装置,包括:检测单元,用于检测到区块链上与目标键值对应的记录信息发生更新,其中,该目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;第一确定单元,用于确定与目标键值对应的记录信息被更新为了第一交易记录信息;第一同步单元,用于将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象。According to yet another aspect of the embodiments of the present application, an information synchronization device is provided, including: a detection unit configured to detect that the record information corresponding to a target key value on the blockchain is updated, wherein the target key value is The identification information of the target object in the blockchain, the record information corresponding to the target key value is used to record the transaction information of the target object; the first determination unit is used to determine that the record information corresponding to the target key value is updated to the first transaction record information; a first synchronization unit for synchronizing the first transaction record information as the first data change record information of the target object in the target database, wherein the target database is used to synchronously save the data changes of one or more objects on the blockchain Record information, one or more objects including the target object.
根据本申请实施例的又一个方面,还提供了一种计算机可读的存储介质,该存储介质中存储有计算机程序,其中,该计算机程序被设置为运行时执行上述任一项方法实施例中的步骤。According to yet another aspect of the embodiments of the present application, a computer-readable storage medium is also provided, where a computer program is stored in the storage medium, wherein the computer program is configured to execute any one of the above method embodiments when running. A step of.
根据本申请实施例的又一个方面,还提供了一种电子装置,包括存储器和处理器,存储器中存储有计算机程序,处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。According to yet another aspect of the embodiments of the present application, an electronic device is also provided, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute any of the above method embodiments. step.
在本申请实施例中,采用数据库同步保存区块链上一个或多个对象的数据变更记录信息的方式,通过接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端,由于查找用于同步保存区块链上一个或多个对象的数据变更记录信息的数据库的方式来查询区块链上目标对象的数据变更记录信息,无需按照区块的产生次序多次遍历整个区块链得到全部的交易记录,可以进行多线程/多处理器的并行处理,达到快速查找对象的数据变更记录的目的,从而实现了提高对区块链信息的查询效率的技术效果,进而解决了相关技术中的区块链数据查询方式存在的由于无法并行处理导致的查询效率低的问题。In the embodiment of the present application, the database synchronously saves the data change record information of one or more objects on the blockchain, and receives a query request sent by the client, wherein the query request is used to request to query the target on the blockchain The data change record information of the object; in response to the query request, find the data change record information of the target object from the target database, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain, one or more Each object includes the target object; when the target data change record information corresponding to the target object is found, the target data change record information is sent to the client, because the search is used to synchronously save one or more objects on the blockchain. The database of data change record information is used to query the data change record information of the target object on the blockchain. There is no need to traverse the entire blockchain multiple times to obtain all transaction records in the order of block generation. Multi-threading/multi-processor The parallel processing can achieve the purpose of quickly finding the data change record of the object, thereby achieving the technical effect of improving the query efficiency of blockchain information, and solving the problem of the blockchain data query method in the related technology due to the inability to parallel processing. This leads to the problem of low query efficiency.
附图说明Description of drawings
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本发明的实施例,并与说明书一起用于解释本发明的原理。The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description serve to explain the principles of the invention.
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. In other words, on the premise of no creative labor, other drawings can also be obtained from these drawings.
图1是根据本申请实施例的信息的查询方法的硬件环境的示意图;1 is a schematic diagram of a hardware environment of an information query method according to an embodiment of the present application;
图2是根据本申请实施例的一种可选的信息的查询方法的流程图;2 is a flowchart of an optional information query method according to an embodiment of the present application;
图3是根据本申请实施例的一种可选的记录交易数据的流程图;3 is an optional flowchart of recording transaction data according to an embodiment of the present application;
图4是根据本申请实施例的另一种可选的信息的查询方法的流程图;4 is a flowchart of another optional information query method according to an embodiment of the present application;
图5是根据本申请实施例的一种可选的信息的同步方法的流程图;5 is a flowchart of an optional information synchronization method according to an embodiment of the present application;
图6是根据本申请实施例的又一种可选的信息的查询方法的流程图;6 is a flowchart of another optional information query method according to an embodiment of the present application;
图7是根据本申请实施例的一种可选的信息的查询装置的示意图;7 is a schematic diagram of an optional information query apparatus according to an embodiment of the present application;
图8是根据本申请实施例的一种可选的信息的同步装置的示意图;8 is a schematic diagram of an optional information synchronization apparatus according to an embodiment of the present application;
图9是根据本申请实施例的一种电子装置的结构框图。FIG. 9 is a structural block diagram of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本申请方案,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分的实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本申请保护的范围。In order to make those skilled in the art better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only The embodiments are part of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the scope of protection of the present application.
需要说明的是,本申请的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second", etc. in the description and claims of the present application and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments of the application described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
根据本申请实施例的一方面,提供了一种信息的查询方法的实施例。可选地,在本实施例中,上述信息的查询方法可以应用于如图1所示的由终端101和服务器103所构成的硬件环境中。如图1所示,服务器103通过网络与终端101进行连接,可用于为终端或终端上安装的客户端提供服务(如游戏服务、应用服务等),可在服务器上或独立于服务器设置数据库,用于为服务器103提供数据存储服务,上述网络包括但不限于:广域网、城域网或局域网,终端101并不限定于PC、手机、平板电脑等。本申请实施例的信息的查询方法可以由服务器103来执行,也可以由终端101来执行,还可以是由服务器103和终端101共同执行。其中,终端101执行本申请实施例的信息的查询方法也可以是由安装在其上的客户端来执行。According to an aspect of the embodiments of the present application, an embodiment of a method for querying information is provided. Optionally, in this embodiment, the above method for querying information may be applied to a hardware environment composed of a
图2是根据本申请实施例的一种可选的信息的查询方法的流程图,如图2所示,该方法可以包括以下步骤:FIG. 2 is a flowchart of an optional information query method according to an embodiment of the present application. As shown in FIG. 2 , the method may include the following steps:
步骤S202,接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;Step S202, receiving a query request sent by the client, wherein the query request is used to request to query the data change record information of the target object on the blockchain;
步骤S204,响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;Step S204, in response to the query request, look up the data change record information of the target object from the target database, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and one or more objects include the target object. object;
步骤S206,在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端。Step S206 , when the target data change record information corresponding to the target object is found, send the target data change record information to the client.
通过上述步骤S202至步骤S206,接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端,解决了相关技术中的区块链数据查询方式存在的由于无法并行处理导致的查询效率低的问题,提高了对区块链信息的查询效率。Through the above steps S202 to S206, a query request sent by the client is received, wherein the query request is used to request to query the data change record information of the target object on the blockchain; in response to the query request, the data change of the target object is searched from the target database. Record information, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and one or more objects include the target object; when the target data change record information corresponding to the target object is found In this way, the target data change record information is sent to the client, which solves the problem of low query efficiency caused by the inability of parallel processing in the blockchain data query method in the related art, and improves the query efficiency of blockchain information.
在步骤S202提供的技术方案中,接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息。In the technical solution provided in step S202, a query request sent by the client is received, wherein the query request is used to request to query the data change record information of the target object on the blockchain.
本实施例中的信息的查询方法可以应用于现有的超级账本框架,例如,Fabric。在进行区块链数据变更历史查询时,可以采用超级账本框架中的SDK(Software DevelopmentKit,软件开发工具包)进行查询。相关技术中的数据查询方案需要大量的遍历和鉴别,使得区块链中数据变更历史的查询过程缓慢且复杂,降低了查询效率,在快速增长的区块链业务中,难以满足用户的高频的交易数据变更历史查询需求。The information query method in this embodiment can be applied to an existing hyperledger framework, for example, Fabric. When querying the blockchain data change history, you can use the SDK (Software Development Kit, software development kit) in the Hyperledger framework to query. The data query scheme in related technologies requires a lot of traversal and identification, which makes the query process of the data change history in the blockchain slow and complicated, which reduces the query efficiency. In the fast-growing blockchain business, it is difficult to meet the high frequency of users. transaction data change history query requirements.
BaaS平台可以为基于超级账本框架(如,Fabric)构建的服务平台,BaaS是结合区块链技术的用于帮助用户创建、管理和维护企业级区块链网络及应用的服务。BaaS的主要用途是:快速建立所需的区块链应用环境,提供基于区块链网络的搜索查询、交易、运维、数据分析等一系列操作服务。A BaaS platform can be a service platform based on a hyperledger framework (eg, Fabric). BaaS is a service that combines blockchain technology to help users create, manage, and maintain enterprise-level blockchain networks and applications. The main purpose of BaaS is to quickly establish the required blockchain application environment and provide a series of operational services such as search query, transaction, operation and maintenance, and data analysis based on the blockchain network.
BaaS通过把计算资源、通讯资源、存储资源,以及上层的区块链记账能力、区块链应用开发能力、区块链配套设施能力转化为可编程接口,让应用开发过程和应用部署过程简单而高效,同时通过标准化的能力建设,保障区块链应用的安全可靠,对区块链业务的运营提供支撑。BaaS simplifies the application development process and application deployment process by converting computing resources, communication resources, storage resources, and upper-layer blockchain accounting capabilities, blockchain application development capabilities, and blockchain supporting facilities capabilities into programmable interfaces. At the same time, through standardized capacity building, it ensures the safety and reliability of blockchain applications and provides support for the operation of blockchain business.
BaaS作为一种云服务,是区块链设施的云端租用平台,其多租户特性让计算资源、平台资源、软件资源得到了最大程度的共享。BaaS提供节点租用、链租用以及工具租用的能力,其中工具包括开发工具、部署工具、监控工具等,并通过大容量的资源池,保障租户的业务规模可灵活弹性伸缩,租用设施可共享和独享,安全可靠运行,此外还可以提供必要的技术支持服务。BaaS的能力包括:区块链节点及整链搭建的能力、区块链应用开发的能力、区块应用部署的能力、区块链运行监控的能力。As a cloud service, BaaS is a cloud rental platform for blockchain facilities. Its multi-tenant feature allows computing resources, platform resources, and software resources to be shared to the greatest extent. BaaS provides the capabilities of node rental, chain rental and tool rental, including development tools, deployment tools, monitoring tools, etc., and through a large-capacity resource pool, it ensures that tenants’ business scale can be flexibly and elastically scaled, and rental facilities can be shared and independent. Enjoy, safe and reliable operation, and can also provide necessary technical support services. The capabilities of BaaS include: the ability to build blockchain nodes and the entire chain, the ability to develop blockchain applications, the ability to deploy blockchain applications, and the ability to monitor blockchain operations.
Fabric中的系统链码可以被部署在超级账本框架的网络节点中,负责Fabric节点自身的处理逻辑,包括:系统配置、背书、校验等工作,在Peer节点启动时会自动完成注册和部署。The system chaincode in Fabric can be deployed in the network nodes of the Hyperledger framework, and is responsible for the processing logic of the Fabric node itself, including: system configuration, endorsement, verification, etc. The registration and deployment are automatically completed when the peer node starts.
系统链码共有五种类型:There are five types of system chaincodes:
(1)CSCC(Configuration System Chaincode,配置系统链码),负责账本和链的配置管理;(1) CSCC (Configuration System Chaincode), responsible for the configuration management of the ledger and chain;
(2)ESCC(Endorsement System Chaincode,背书管理系统链码),负责背书(签名)过程,并可以支持对背书策略进行管理;(2) ESCC (Endorsement System Chaincode), responsible for the endorsement (signature) process, and can support the management of endorsement policies;
(3)LSCC(Lifecycle System Chaincode,生命周期系统链码),负责对用户链码的生命周期进行管理;链码生命周期包括安装、部署、升级、权限管理、获取信息等环节;(3) LSCC (Lifecycle System Chaincode), responsible for managing the life cycle of the user chain code; the chain code life cycle includes installation, deployment, upgrade, rights management, information acquisition and other links;
(4)QSCC(Query System Chaincode,查询系统链码),负责提供账本和链的信息查询功能;(4) QSCC (Query System Chaincode), responsible for providing the information query function of the ledger and chain;
(5)VSCC(Verification System Chaincode,验证系统链码),负责交易提交前根据背书策略进行检查。(5) VSCC (Verification System Chaincode, verification system chain code), responsible for checking according to the endorsement strategy before the transaction is submitted.
可选地,本实施例中的信息的查询方法可以是由系统链码执行的,该系统链码可以是QSCC,或者,QSCC与其他系统链码结合。Optionally, the information query method in this embodiment may be performed by a system chain code, and the system chain code may be QSCC, or QSCC is combined with other system chain codes.
用户可以通过终端设备上运行的客户端提交查询请求,以请求查询区块链上目标对象的数据变更记录信息。该查询请求可以携带有用户通过终端设备(数据设备)输入的查询参数,查询参数的内容可以包括:待查询数据的键值名称,例如,目标键值。客户端可以将查询请求提交到给区块链上的系统链码。区块链上的系统链码可以接收客户端发送的该查询请求。The user can submit a query request through the client running on the terminal device to request to query the data change record information of the target object on the blockchain. The query request may carry query parameters input by the user through the terminal device (data device), and the content of the query parameters may include: the name of the key value of the data to be queried, for example, the target key value. Clients can submit query requests to the system chaincode on the blockchain. The system chaincode on the blockchain can receive the query request sent by the client.
在步骤S204提供的技术方案中,响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象。In the technical solution provided in step S204, the data change record information of the target object is searched from the target database in response to the query request, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and a or more objects including the target object.
为了提高数据查询的效率,可以将区块链上一个或多个对象的数据变更记录信息(例如,交易记录信息)同步保存为目标数据库中对应的数据变更记录信息,该一个或多个对象可以包括目标对象。In order to improve the efficiency of data query, the data change record information (for example, transaction record information) of one or more objects on the blockchain can be synchronously saved as the corresponding data change record information in the target database. The one or more objects can be Include the target object.
响应接收到的查询请求,系统链码可以从目标数据库中查找目标对象的数据变更记录信息,以确定目标数据库中是否保存有目标对象的数据变更记录信息,以及保存有目标对象的哪些数据变更记录信息。In response to the received query request, the system chain code can look up the data change record information of the target object from the target database to determine whether the data change record information of the target object is saved in the target database, and which data change records of the target object are saved. information.
作为一种可选的实施例,从目标数据库中查找目标对象的数据变更记录信息包括:获取查询请求中携带的目标键值,其中,目标键值为区块链中目标对象的标识信息;使用目标键值的哈希值从目标数据库中查找目标对象的数据变更记录信息。As an optional embodiment, searching the data change record information of the target object from the target database includes: obtaining the target key value carried in the query request, wherein the target key value is the identification information of the target object in the blockchain; using The hash value of the target key looks up the data change record information of the target object from the target database.
目标数据库可以为状态数据库(stateDB),该状态数据库中存储了交易(transaction)日志中所有键的最新值,也称世界状态(world state),可选择基于levelDB或couchDB实现。The target database can be a state database (stateDB), which stores the latest values of all keys in the transaction log, also called world state, which can be implemented based on levelDB or couchDB.
系统链码可以首先从查询请求的查询参数中解析出待查询的数据键值(目标键值),该数据键值为区块链中目标对象的标识信息,也就是,用于在区块链中唯一标识目标对象;然后,根据该数据键值的哈希值从stateDB中查找对应数据键值的变更历史,判断是否有查询到待查询的数据变更历史记录。The system chain code can first parse the data key value (target key value) to be queried from the query parameters of the query request. The data key value is the identification information of the target object in the blockchain, that is, it is used in the blockchain. Then, according to the hash value of the data key value, the change history of the corresponding data key value is searched from the stateDB, and it is judged whether there is any data change history record to be queried.
通过本实施例,通过对象对应的键值的哈希值进行变更历史记录的查询,可以提高查询的效率,提高数据查询的安全性。With this embodiment, the change history record is queried by using the hash value of the key value corresponding to the object, so that the efficiency of the query can be improved and the security of the data query can be improved.
作为一种可选的实施例,从目标数据库中查找目标对象的数据变更记录信息包括:获取查询请求中携带的时间段信息,其中,时间段信息用于表示查询目标对象在目标时间段内的数据变更记录信息;按照时间段信息,从目标数据库中查找目标对象在目标时间段内的数据变更记录信息。As an optional embodiment, searching for data change record information of the target object from the target database includes: acquiring time period information carried in the query request, where the time period information is used to indicate the query target object within the target time period. Data change record information; search for the data change record information of the target object within the target time period from the target database according to the time period information.
目标数据库中保存的数据变更记录信息可以包括:数据变更的时间戳信息,例如,交易时间戳,该交易时间戳在必要时可以用来追溯区块链中的原始信息,用于校验参考,可有效保证数据变更信息的真实性。The data change record information saved in the target database can include: timestamp information of data changes, for example, transaction timestamp, which can be used to trace the original information in the blockchain when necessary for verification reference, It can effectively guarantee the authenticity of data change information.
例如,在区块链网络系统中,用户A的初始余额为30元,发生一次交易后,用户A此次交易收入10元,余额变为40元。相关技术中可以读取的数据变更信息是“用户A初始余额为30元,用户收入10元,用户A的余额为40元”,以及确定该系统链码写入了该数据。但是不能确定该交易具体是什么时间发生的。For example, in the blockchain network system, user A's initial balance is 30 yuan. After a transaction occurs, user A earns 10 yuan from this transaction, and the balance becomes 40 yuan. The data change information that can be read in the related art is "the initial balance of user A is 30 yuan, the user's income is 10 yuan, and the balance of user A is 40 yuan", and it is determined that the system chain code has written the data. However, it is not certain when exactly the transaction took place.
为保证在需要时可对目标数据库中存储的变更记录进行追溯和校验,系统链码可以记录此次交易的交易ID,区块高度,时间戳等信息,并将区块高度和交易时间戳等信息保存到目标数据库。这样,可以根据需要快速到区块链中确认交易/区块产生的时间和交易参数等,以确保数据库中区块链数据变更历史的真实性。In order to ensure that the change records stored in the target database can be traced and verified when needed, the system chain code can record the transaction ID, block height, timestamp and other information of this transaction, and combine the block height and transaction timestamp. and other information is saved to the target database. In this way, it is possible to quickly confirm the transaction/block generation time and transaction parameters in the blockchain as needed to ensure the authenticity of the blockchain data change history in the database.
除了键值以外,用户通过数据设备输入的查询参数还可以包括:时间段信息,例如,指定查询的历史时间段,即,目标时间段。系统链码可以从查询请求的查询参数中解析出时间段信息,并从目标数据库中查找目标对象在目标时间段内的数据变更记录信息。In addition to the key value, the query parameters input by the user through the data device may also include: time period information, for example, the historical time period of the specified query, that is, the target time period. The system chain code can parse out the time period information from the query parameters of the query request, and find the data change record information of the target object in the target time period from the target database.
例如,用户A的数据历史变更信息如表1所示,查询参数指示返回用户A在2020年3月6日的余额变更记录,结果如表2所示。For example, user A's data history change information is shown in Table 1, and the query parameter indicates to return user A's balance change record on March 6, 2020, and the result is shown in Table 2.
表1Table 1
表2Table 2
通过本实施例,通过限定查询数据变更记录信息的时间段,可以提高数据查询的灵活性,并确保数据库中保存的区块链数据变更历史的真实性。Through this embodiment, by limiting the time period for querying data change record information, the flexibility of data query can be improved, and the authenticity of the blockchain data change history stored in the database can be ensured.
为了维护目标数据库,可以根据区块链上对象的交易记录,同步更新目标数据库中的数据变更记录信息。In order to maintain the target database, the data change record information in the target database can be updated synchronously according to the transaction records of the objects on the blockchain.
作为一种可选的实施例,可以在检测到区块链上与目标键值对应的记录信息发生更新的情况下,确定与目标键值对应的记录信息被更新为了第一交易记录信息,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;将第一交易记录信息同步为目标数据库中的第一数据变更记录信息,其中,目标数据变更记录信息包括第一数据变更记录信息。As an optional embodiment, when it is detected that the record information corresponding to the target key value on the blockchain is updated, it can be determined that the record information corresponding to the target key value is updated to the first transaction record information, wherein , the target key value is the identification information of the target object in the blockchain, and the record information corresponding to the target key value is used to record the transaction information of the target object; the first transaction record information is synchronized to the first data change record information in the target database , wherein the target data change record information includes first data change record information.
在区块链中存在很多行为,例如,用户注册、用户充值、资产发行等,这些行为会产生大量的数据记录,上述数据记录可以通过数据变更记录信息的方式保存在区块链上,系统链码可以周期性地或者事件触发监测区块链上变更历史的数据变化。There are many behaviors in the blockchain, such as user registration, user recharge, asset issuance, etc. These behaviors will generate a large number of data records. The above data records can be saved on the blockchain by means of data change record information. The system chain The code can periodically or event-triggered to monitor the data changes of the change history on the blockchain.
系统链码在区块链网络系统中可以自动追踪各交易记录中数据键值(key值,即,目标键值)的变化情况:在各数据键值对应的记录变量(value值,即,记录信息)写入区块链网络系统中的区块后,系统链码获取此次交易的信息,以及该交易所在区块的信息。The system chain code in the blockchain network system can automatically track the changes of the data key value (key value, that is, the target key value) in each transaction record: in the record variable (value value, that is, the record value corresponding to each data key value) information) is written into the block in the blockchain network system, the system chain code obtains the information of this transaction and the information of the transaction in the block.
对于目标对象,每当发现区块链上目标键值对应的记录变量因为产生交易而发生更新之后,系统链码可以将该交易信息(例如,第一交易记录信息)同步到stateDB中。For the target object, whenever it is found that the record variable corresponding to the target key value on the blockchain is updated due to a transaction, the system chaincode can synchronize the transaction information (for example, the first transaction record information) to the stateDB.
例如,用户A在某一时间点发生交易后,区块链账本中用户余额变为30元,为记录这一时间点在区块链上用户A的余额变更情况,系统链码会在stateDB中同步一条数据变更记录信息。For example, after user A conducts a transaction at a certain point in time, the user's balance in the blockchain ledger becomes 30 yuan. In order to record the change of user A's balance on the blockchain at this point in time, the system chain code will be stored in the stateDB. Synchronize a data change log message.
通过本实施例,通过监测区块链上的交易变更历史数据的变化,并同步到目标数据库中,可以提高目标数据库中数据信息的准确性和时效性。Through this embodiment, by monitoring the changes of the transaction change history data on the blockchain and synchronizing to the target database, the accuracy and timeliness of the data information in the target database can be improved.
作为一种可选的实施例,将第一交易记录信息同步为目标数据库中的第一数据变更记录信息包括:获取第一交易记录信息中的目标记录信息,其中,目标记录信息包括:交易标识,交易时间戳,第一交易记录信息所在的区块高度;将目标记录信息同步为目标数据库中的第一数据变更记录信息。As an optional embodiment, synchronizing the first transaction record information as the first data change record information in the target database includes: acquiring target record information in the first transaction record information, wherein the target record information includes: a transaction identifier , the transaction timestamp, the height of the block where the first transaction record information is located; the target record information is synchronized to the first data change record information in the target database.
在进行区块链上的交易记录信息与目标数据库中的数据变更记录信息之间的同步时,可以将交易记录信息直接同步到目标数据库中,在这种情况下,目标数据库中保存完整的交易记录信息。When synchronizing the transaction record information on the blockchain and the data change record information in the target database, the transaction record information can be directly synchronized to the target database. In this case, the complete transaction is saved in the target database. record information.
为了合理利用目标数据库的数据存储能力,避免由于信息量过大资源被过多占用,导致查询效率降低,可以将交易记录信息中的部分信息同步为目标数据库中的数据变更记录信息。In order to make reasonable use of the data storage capacity of the target database and avoid the query efficiency being reduced due to the excessive occupation of resources due to the large amount of information, part of the information in the transaction record information can be synchronized as the data change record information in the target database.
系统链码可以获取第一交易记录信息中包含的交易标识、交易时间戳、第一交易记录信息所在的区块高度等信息,即,目标记录信息,并将目标记录信息同步为目标数据库中的第一数据变更记录信息。The system chain code can obtain information such as the transaction identifier, transaction time stamp, and the height of the block where the first transaction record information is contained in the first transaction record information, that is, the target record information, and synchronize the target record information as the target record information in the target database. The first data change record information.
例如,在stateDB中,对于用户A余额的数据键值:key=用户A的hash值,value={交易ID-1,交易时间-1,区块高度-1}。For example, in stateDB, for the data key value of user A's balance: key=user A's hash value, value={transaction ID-1, transaction time-1, block height-1}.
通过本实施例,通过获取交易记录信息的部分同步到目标数据库中,可以提高目标数据库的数据存储能力,减少每个数据存储对资源的占用。Through this embodiment, by synchronizing the acquired transaction record information into the target database, the data storage capability of the target database can be improved, and the resource occupation of each data storage can be reduced.
作为一种可选的实施例,在将第一交易记录信息同步为目标数据库中的第一数据变更记录信息之后,可以在检测到区块链上与目标键值对应的记录信息发生更新的情况下,确定与目标键值对应的记录信息被更新为了第二交易记录信息;在目标数据库中第一数据变更记录信息所在的位置之后,添加与第二交易记录信息对应的第二数据变更记录信息,其中,目标数据变更记录信息包括第二数据变更记录信息。As an optional embodiment, after synchronizing the first transaction record information as the first data change record information in the target database, it may be detected that the record information corresponding to the target key value on the blockchain is updated Next, it is determined that the record information corresponding to the target key value is updated to the second transaction record information; after the location of the first data change record information in the target database, the second data change record information corresponding to the second transaction record information is added. , wherein the target data change record information includes second data change record information.
用户数据变更是随机的,也就是说,可以根据用户的需求等情况进行变更。因此,在将第一交易记录信息同步为第一数据变更记录信息之后,区块链上可以生成新的交易记录。系统链码可以同步新的交易记录到目标数据库中。User data changes are random, that is, they can be changed according to user needs and other circumstances. Therefore, after synchronizing the first transaction record information as the first data change record information, a new transaction record can be generated on the blockchain. The system chaincode can synchronize new transaction records to the target database.
为了提高数据查询效率,可以将新的交易记录信息同步到已有的数据变更记录信息之后,即,在已有的数据变更记录信息之后追加新的数据变更记录信息。In order to improve the data query efficiency, the new transaction record information can be synchronized after the existing data change record information, that is, new data change record information is added after the existing data change record information.
如果检测到区块链上与目标键值对应的记录信息更新为第二交易记录信息,系统链码可以在目标数据库中第一数据变更记录信息所在的位置之后追加与第二交易记录信息对应的第二数据变更记录信息。If it is detected that the record information corresponding to the target key value on the blockchain is updated to the second transaction record information, the system chain code can add the record information corresponding to the second transaction record information after the location of the first data change record information in the target database. The second data change record information.
例如,用户A在某一时间点发生交易后,区块链账本中用户余额变为40元,为记录这一时间点在区块链上某一区块的数据变更情况,系统链码会在stateDB中追加新的历史记录,历史记录内容包括:交易ID,交易记录所在区块高度,交易时间戳信息。key=用户A的hash值,value={{交易ID-1,交易时间-1,区块高度-1},{交易ID-2,交易时间-2,区块高度-2}}。For example, after user A has a transaction at a certain point in time, the user balance in the blockchain ledger becomes 40 yuan. In order to record the data changes of a block on the blockchain at this point in time, the system chain code will A new history record is added to the stateDB, and the content of the history record includes: transaction ID, block height where the transaction record is located, and transaction timestamp information. key = hash value of user A, value = {{transaction ID-1, transaction time-1, block height-1}, {transaction ID-2, transaction time-2, block height-2}}.
在区块链网络系统中后续若继续发生一系列交易行为,则可以继续采用以上方式,以对数据键值对应的记录变量进行更新。If a series of transaction behaviors continue to occur in the blockchain network system, the above methods can continue to be used to update the record variables corresponding to the data key values.
通过本实施例,通过在已有数据变更记录信息追加新的数据变更记录信息的方式同步新的交易记录信息,可以提高信息查询的效率。With this embodiment, the new transaction record information can be synchronized by adding new data change record information to the existing data change record information, so that the efficiency of information query can be improved.
需要说明的是,在进行交易记录上链或者信息同步之前,可以预先对信息进行验证:可以解析交易结构,并对交易结构格式进行校验;检查交易的读集合中的元素版本跟本地账本中的版本一致;检查带有合法的背书信息(主要是检查签名信息);通过则返回正确,否则返回错误消息。It should be noted that before the transaction records are uploaded to the chain or the information is synchronized, the information can be verified in advance: the transaction structure can be parsed, and the transaction structure format can be verified; the element version in the read set of the transaction and the local ledger can be checked The version is the same; check with valid endorsement information (mainly check signature information); return correct if passed, otherwise return an error message.
此外,还可以支持stop和start命令,以禁用和重新启用链代码,链代码成功安装和实例化后,链代码处于活动状态(正在运行),可通过invoke命令调用处理事务。In addition, stop and start commands are also supported to disable and re-enable the chaincode. After the chaincode is successfully installed and instantiated, the chaincode is active (running) and can be invoked by the invoke command to process transactions.
下面结合可选示例对交易历史的存储和记录进行说明。如图3所示,本示例中的交易数据记录方法的流程可以包括以下步骤:The storage and recording of transaction history is described below with optional examples. As shown in Figure 3, the flow of the transaction data recording method in this example may include the following steps:
步骤S302,监控并获取区块链上待查询变更历史的数据变化。Step S302, monitoring and acquiring the data changes of the change history to be queried on the blockchain.
系统链码可以对区块链上每条交易数据的key字段进行监测和追踪,自动追踪各交易记录中数据键值(key值)的变化情况,在各数据键值对应的记录变量(value值)写入区块链网络系统中的区块后,即,当一笔交易中该key字段对应的value值产生更新时,系统链码获取此次交易的信息,以及该交易所在区块的信息(具体为此次交易的交易ID,区块高度,时间戳等)。The system chain code can monitor and track the key field of each transaction data on the blockchain, and automatically track the changes of the data key value (key value) in each transaction record. ) is written into the block in the blockchain network system, that is, when the value corresponding to the key field in a transaction is updated, the system chain code obtains the information of the transaction and the transaction information in the block. Information (specifically, the transaction ID, block height, timestamp, etc. of this transaction).
步骤S304,区块链上更新的数据所对应的交易ID、区块高度、时间戳等信息同步并追加到stateDB。Step S304, the transaction ID, block height, timestamp and other information corresponding to the updated data on the blockchain are synchronized and added to the stateDB.
通过系统链码把区块链上更新的数据同步到stateDB:系统链码会在stateDB中以对应key字段的哈希值为新的key,追加写入此次变更记录信息,保持stateDB中数据变更信息的同步,其中,变更记录的内容包括:变更所涉及到的交易ID,区块高度,时间戳等信息。Synchronize the updated data on the blockchain to the stateDB through the system chain code: The system chain code will add a new key in the stateDB with the hash value of the corresponding key field, and additionally write the change record information to keep the data changes in the stateDB. Information synchronization, wherein the content of the change record includes: transaction ID, block height, timestamp and other information involved in the change.
重复以上步骤,以保证对数据键值变更产生的交易ID、区块高度、时间戳等信息的同步。Repeat the above steps to ensure the synchronization of transaction ID, block height, timestamp and other information generated by data key value changes.
在步骤S206提供的技术方案中,在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端。In the technical solution provided in step S206, when the target data change record information corresponding to the target object is found, the target data change record information is sent to the client.
如果查找到与目标对象对应的数据变更记录信息,即,目标数据变更记录信息,系统链码可以将目标数据变更记录信息发送给客户端。例如,返回的查询结果可以如表2所示。If the data change record information corresponding to the target object is found, that is, the target data change record information, the system chain code can send the target data change record information to the client. For example, the returned query results can be as shown in Table 2.
如果目标数据变更记录信息为目标交易记录信息的部分,即,目标数据库中保存有用户的交易记录信息的部分,而查询请求所请求查询的是完整的交易记录信息,则系统链码可以获取目标数据变更记录信息包含的目标区块高度;从区块链上该目标区块高度所指示的区块中获取与目标对象对应的目标交易记录信息;并将目标交易记录信息发送给客户端。If the target data change record information is part of the target transaction record information, that is, the part of the target database that stores the user's transaction record information, and the query request requests the complete transaction record information, the system chaincode can obtain the target The height of the target block contained in the data change record information; obtain the target transaction record information corresponding to the target object from the block indicated by the target block height on the blockchain; and send the target transaction record information to the client.
可选地,在本实施例中,目标数据变更记录信息可以与区块链上目标对象的目标交易记录信息(如果存在)对应,目标数据变更记录信息包括:目标交易记录信息的目标交易标识,目标交易记录信息的目标交易时间戳,目标交易记录信息所在的目标区块高度。在目标数据变更记录信息为多个的情况下,每个数据变更记录信息对应于一个交易标识、交易时间戳和区块高度的组合。Optionally, in this embodiment, the target data change record information may correspond to the target transaction record information (if any) of the target object on the blockchain, and the target data change record information includes: the target transaction identifier of the target transaction record information, The target transaction timestamp of the target transaction record information, and the height of the target block where the target transaction record information is located. In the case where there are multiple target data change record information, each data change record information corresponds to a combination of transaction identifier, transaction time stamp and block height.
作为一种可选的实施方式,在将目标数据变更记录信息发送给客户端之后,可以接收客户端发送的校验请求,其中,校验请求用于请求对目标数据变更记录信息进行校验,校验请求中携带有目标交易标识、目标交易时间戳和目标区块高度;根据目标交易标识和目标交易时间戳,从区块链上与目标区块高度对应的区块中获取目标交易记录信息;在获取到目标交易记录信息的情况下,使用目标交易记录信息对目标数据变更记录信息进行校验,得到第一校验结果;将第一校验结果发送到客户端。As an optional implementation manner, after the target data change record information is sent to the client, a verification request sent by the client may be received, wherein the verification request is used to request to verify the target data change record information, The verification request carries the target transaction ID, target transaction timestamp and target block height; according to the target transaction ID and target transaction timestamp, obtain the target transaction record information from the block corresponding to the target block height on the blockchain When the target transaction record information is obtained, use the target transaction record information to verify the target data change record information to obtain a first verification result; and send the first verification result to the client.
发送给用户的目标数据变更记录信息是系统链码从目标数据库中获取的,而不是从区块链上获取的。为了避免由于用户对获取的数据的真实性和准确性存在质疑而影响用户的使用体验。可以为用户提供在区块链上进行数据复验的服务。例如,通过BaaS根据交易标识、交易时间戳、与数据变更记录信息对应的交易记录信息所在的区块高度等信息在区块链上进行数据复验。The target data change record information sent to the user is obtained by the system chain code from the target database, not from the blockchain. In order to avoid affecting the user's experience due to the user's doubts about the authenticity and accuracy of the obtained data. It can provide users with the service of data re-inspection on the blockchain. For example, through BaaS, data re-inspection is performed on the blockchain based on information such as transaction identifiers, transaction timestamps, and the height of the block where the transaction record information corresponding to the data change record information is located.
在接收到目标数据变更记录信息之后,用户可以操作客户端的界面,触发对目标数据变更记录信息的校验过程。在检测到对客户端的界面执行的目标操作之后,客户端可以生成校验请求,该校验请求携带有目标交易标识、目标交易时间戳和目标区块高度,并将校验请求发送到系统链码(区块链节点的一种,也可以是其他区块链节点),以请求对目标数据变更记录信息进行校验。在目标数据变更记录信息为多个的情况下,校验请求可以携带有全部或者部分数据变更记录信息中的交易标识、交易时间戳和区块高度,以对全部或者部分数据变更记录信息进行校验。After receiving the target data change record information, the user can operate the interface of the client to trigger the verification process of the target data change record information. After detecting the target operation performed on the client's interface, the client can generate a verification request carrying the target transaction identifier, target transaction timestamp and target block height, and send the verification request to the system chain code (a type of blockchain node, or other blockchain nodes) to request verification of the target data change record information. In the case of multiple target data change record information, the verification request may carry the transaction identifier, transaction timestamp and block height in all or part of the data change record information, so as to verify all or part of the data change record information. test.
在接收到校验请求之后,系统链码可以根据目标交易标识和目标交易时间戳,从区块链上与目标区块高度对应的区块中获取目标交易记录信息。如果获取到目标交易记录信息,则可以使用目标交易记录信息对目标数据变更记录信息进行校验,例如,校验交易金额,交易方,金额变更信息等,得到第一校验结果,该校验结果可以指示该目标数据变更记录信息的真实性和准确性。After receiving the verification request, the system chain code can obtain the target transaction record information from the block corresponding to the height of the target block on the blockchain according to the target transaction identifier and the target transaction timestamp. If the target transaction record information is obtained, the target data change record information can be used to verify the target data change record information, for example, the transaction amount, transaction party, amount change information, etc. are verified, and the first verification result is obtained. The results may indicate the authenticity and accuracy of the target data change record information.
在得到第一校验结果之后,系统链码可以将第一校验结果发送给客户端,以便客户端向用户展示校验结果。After obtaining the first verification result, the system chain code can send the first verification result to the client, so that the client can display the verification result to the user.
作为另一种可选的实施方式,在根据目标交易标识和目标交易时间戳,从区块链上与目标区块高度对应的区块中获取目标交易记录信息之后,在未获取到目标交易记录信息的情况下,可以将第二校验结果发送到客户端,其中,第二校验结果用于指示目标数据变更记录信息校验未通过。As another optional implementation manner, after obtaining the target transaction record information from the block corresponding to the target block height on the blockchain according to the target transaction identifier and the target transaction time stamp, after the target transaction record is not obtained In the case of information, a second verification result may be sent to the client, where the second verification result is used to indicate that the target data change record information verification fails.
如果从区块链上与目标区块高度对应的区块中未获取到与目标交易标识和目标交易时间戳对应的交易记录信息,则可以确定该目标数据变更记录信息是不真实或者不准确的,进而确定目标数据变更记录信息校验未通过。系统链码可以将第二校验结果发送给客户端,以指示该目标数据变更记录信息校验未通过。If the transaction record information corresponding to the target transaction identifier and the target transaction timestamp is not obtained from the block corresponding to the target block height on the blockchain, it can be determined that the target data change record information is untrue or inaccurate , and then it is determined that the verification of the target data change record information fails. The system chain code may send the second verification result to the client to indicate that the verification of the target data change record information fails.
通过本实施例,通过接收携带有交易标识、交易时间戳和区块高度的校验请求,并对数据变更记录信息进行校验,可以避免由于用户对获取的数据的真实性和准确性存在质疑而影响用户的使用体验。Through this embodiment, by receiving the verification request carrying the transaction identifier, transaction timestamp and block height, and verifying the data change record information, it is possible to avoid users' doubts on the authenticity and accuracy of the acquired data. and affect the user experience.
作为一种可选的实施例,在从目标数据库中查找目标对象的数据变更记录信息之后,在未查找到与目标对象对应的数据变更记录信息的情况下,可以向客户端发送提示信息,其中,提示信息用于提示未查找到与目标对象对应的数据变更记录信息。As an optional embodiment, after the data change record information of the target object is searched from the target database, if no data change record information corresponding to the target object is found, prompt information may be sent to the client, wherein , the prompt information is used to prompt that the data change record information corresponding to the target object is not found.
例如,如果在stateDB的表中查询到对应数据键值的变更历史,则将查询结果返回给客户端,如果查询结果为空,可以返回相应的提示信息,以提示未查找到对应的变更记录信息。For example, if the change history of the corresponding data key value is queried in the stateDB table, the query result will be returned to the client. If the query result is empty, the corresponding prompt information can be returned to indicate that the corresponding change record information has not been found. .
下面结合可选示例对变更历史记录信息的查询过程进行说明。如图4所示,本示例中的信息的查询方法的流程可以包括以下步骤:The query process of the change history record information is described below with optional examples. As shown in Figure 4, the flow of the information query method in this example may include the following steps:
步骤S402,在BaaS输入查询请求。Step S402, a query request is input in the BaaS.
用户可以在BaaS中将要请求查询的数据变更历史的键值字段提交给区块链上的系统链码,查询请求为用户通过数据设备输入的查询参数。其中,查询参数的内容包括:待查询数据的键值名称和指定的查询历史时间段等。The user can submit the key-value field of the data change history to be queried in BaaS to the system chain code on the blockchain, and the query request is the query parameter input by the user through the data device. The content of the query parameter includes: the name of the key value of the data to be queried, the specified query historical time period, and the like.
步骤S404,系统链码在stateDB中查询。Step S404, the system chain code is queried in stateDB.
系统链码可以从查询参数中解析出待查询的数据键值,然后根据该数据键值的哈希值从stateDB的中查找对应数据键值的变更历史,判断是否有查询到待查询的数据变更历史记录。The system chain code can parse the data key value to be queried from the query parameters, and then find the change history of the corresponding data key value from the stateDB according to the hash value of the data key value, and judge whether there is any data change to be queried. history record.
步骤S406,将查询结果返回至BaaS。Step S406, returning the query result to the BaaS.
如果在stateDB的表中查询到对应数据键值的变更历史,系统链码可以将查询结果返回给BaaS,如果查询结果为空,返回相应的提示信息。If the change history of the corresponding data key value is queried in the stateDB table, the system chain code can return the query result to BaaS. If the query result is empty, it will return the corresponding prompt information.
根据本申请实施例的另一方面,还提供了一种信息的同步方法的实施例。该信息的同步方法可以应用于上述信息的查询方法的区块链上的数据与目标数据库中的数据的同步过程,也可以应用于其他需要同步区块链上的数据与目标数据库中的数据的场景,上述实施例中进行区块链上的数据与目标数据库中的数据的同步的方式均可用于本实施例中的信息同步过程。According to another aspect of the embodiments of the present application, an embodiment of a method for synchronizing information is also provided. The information synchronization method can be applied to the synchronization process of the data on the blockchain and the data in the target database of the above information query method, and can also be applied to other processes that need to synchronize the data on the blockchain and the data in the target database. In a scenario, the method of synchronizing the data on the blockchain and the data in the target database in the above-mentioned embodiment can be used for the information synchronization process in this embodiment.
可选地,在本实施例中,上述信息的同步方法可以应用于如图1所示的硬件环境中,该信息的同步方法可以由服务器103来执行,也可以由终端101来执行,还可以是由服务器103和终端101共同执行。其中,终端101执行本申请实施例的信息的同步方法也可以是由安装在其上的客户端来执行。Optionally, in this embodiment, the above method for synchronizing information may be applied to the hardware environment as shown in FIG. 1 , and the method for synchronizing information may be executed by the
图5是根据本申请实施例的一种可选的信息的同步方法的流程图,如图5所示,该方法可以包括以下步骤:FIG. 5 is a flowchart of an optional information synchronization method according to an embodiment of the present application. As shown in FIG. 5 , the method may include the following steps:
步骤S502,检测到区块链上与目标键值对应的记录信息发生更新,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息。Step S502, it is detected that the record information corresponding to the target key value on the blockchain is updated, wherein the target key value is the identification information of the target object in the blockchain, and the record information corresponding to the target key value is used to record the target object's identification information. Trading Information.
在区块链中存在多个用户的很多行为,例如,用户注册、用户充值、资产发行等,这些行为会产生大量的数据记录。上述数据记录可以通过数据变更记录信息的方式保存在区块链上,不同的用户的数据记录可以通过不同的键值进行唯一标识。对于目标对象,该目标对象可以通过目标键值进行唯一标识,目标对象的数据变更记录信息可以是目标对象的交易记录信息。There are many behaviors of multiple users in the blockchain, such as user registration, user recharge, asset issuance, etc. These behaviors will generate a large number of data records. The above data records can be stored on the blockchain by means of data change record information, and the data records of different users can be uniquely identified by different key values. For the target object, the target object can be uniquely identified by the target key value, and the data change record information of the target object can be transaction record information of the target object.
如果目标对象发生了交易等操作,可以生成新的交易记录,该交易记录可以被写入到区块链上。区块链上与目标键值对应的记录变量(value值,即,记录信息)因为产生交易而发生更新。If an operation such as a transaction occurs on the target object, a new transaction record can be generated, and the transaction record can be written to the blockchain. The record variable (value value, that is, record information) corresponding to the target key value on the blockchain is updated as a transaction is generated.
系统链码可以周期性地或者事件触发监测区块链上变更历史的数据变化。在与目标键值对应的记录变量写入区块链网络系统中的区块后,系统链码可以检测到区块链上与目标键值对应的记录信息发生了更新。The system chaincode can periodically or event-triggered to monitor the data changes of the change history on the blockchain. After the record variable corresponding to the target key value is written into the block in the blockchain network system, the system chain code can detect that the record information corresponding to the target key value on the blockchain has been updated.
步骤S504,确定与目标键值对应的记录信息被更新为了第一交易记录信息。Step S504, it is determined that the record information corresponding to the target key value is updated to the first transaction record information.
如果系统链码检测到区块链上与目标键值对应的记录信息发生了更新,则可以确定与目标键值对应的记录信息被更新为了第一交易记录信息。If the system chain code detects that the record information corresponding to the target key value on the blockchain has been updated, it can be determined that the record information corresponding to the target key value is updated to the first transaction record information.
步骤S506,将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象。Step S506, synchronizing the first transaction record information as the first data change record information of the target object in the target database, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain, one or more objects include the target object.
在区块链上,可以通过系统链码将该第一数据变更记录信息同步到多个区块上。同时,通过系统链码在同步区块的同时,可以就将每次变更所产生的记录追加到目标数据库中,每个交易记录可以同步为目标数据库中的一个数据变更记录信息。On the blockchain, the first data change record information can be synchronized to multiple blocks through the system chain code. At the same time, when synchronizing blocks through the system chain code, the records generated by each change can be appended to the target database, and each transaction record can be synchronized as a data change record information in the target database.
目标数据库可以用于同步保存区块链上一个或多个对象(例如,目标对象)的数据变更记录信息。对于第一交易记录信息,系统链码可以将其同步为目标数据库中目标对象的第一数据变更记录信息。The target database can be used to synchronously save the data change record information of one or more objects (eg, target objects) on the blockchain. For the first transaction record information, the system chain code can synchronize it as the first data change record information of the target object in the target database.
通过上述步骤S502至步骤S506,检测到区块链上与目标键值对应的记录信息发生更新,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;确定与目标键值对应的记录信息被更新为了第一交易记录信息;将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象,可以便于通过查询目标数据库的方式查询用户的交易记录,解决了相关技术中的区块链数据查询方式存在的由于无法并行处理导致的查询效率低的问题,提高了对区块链信息的查询效率。Through the above steps S502 to S506, it is detected that the record information corresponding to the target key value on the blockchain is updated, wherein the target key value is the identification information of the target object in the blockchain, and the record information corresponding to the target key value is used record the transaction information of the target object; determine that the record information corresponding to the target key value is updated to the first transaction record information; synchronize the first transaction record information as the first data change record information of the target object in the target database, wherein the target The database is used to synchronously save the data change record information of one or more objects on the blockchain. One or more objects include the target object, which can facilitate the query of the user's transaction records by querying the target database, which solves the problems in related technologies. The query method of blockchain data has the problem of low query efficiency due to the inability of parallel processing, which improves the query efficiency of blockchain information.
作为一种可选的实施例,将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息包括:As an optional embodiment, synchronizing the first transaction record information as the first data change record information of the target object in the target database includes:
获取第一交易记录信息中的目标记录信息,其中,目标记录信息包括:交易标识,交易时间戳,第一交易记录信息所在的区块高度;Obtain the target record information in the first transaction record information, wherein the target record information includes: a transaction identifier, a transaction timestamp, and the height of the block where the first transaction record information is located;
将目标记录信息同步为目标数据库中目标对象的第一数据变更记录信息。The target record information is synchronized as the first data change record information of the target object in the target database.
作为一种可选的实施例,在将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息之后,上述方法还包括:As an optional embodiment, after synchronizing the first transaction record information as the first data change record information of the target object in the target database, the above method further includes:
在检测到区块链上与目标键值对应的记录信息发生更新的情况下,确定与目标键值对应的记录信息被更新为了第二交易记录信息;When it is detected that the record information corresponding to the target key value on the blockchain is updated, it is determined that the record information corresponding to the target key value is updated to the second transaction record information;
在目标数据库中第一数据变更记录信息所在的位置之后,添加与第二交易记录信息对应的第二数据变更记录信息。After the location of the first data change record information in the target database, the second data change record information corresponding to the second transaction record information is added.
作为一种可选的实施例,将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息包括:As an optional embodiment, synchronizing the first transaction record information as the first data change record information of the target object in the target database includes:
获取与目标键值对应的目标哈希值,目标哈希值为目标数据库中目标对象的标识信息;Obtain the target hash value corresponding to the target key value, and the target hash value is the identification information of the target object in the target database;
根据第一交易记录信息确定第一数据变更记录信息;Determine the first data change record information according to the first transaction record information;
按照目标哈希值将第一数据变更记录信息写入到目标数据库中。Write the first data change record information into the target database according to the target hash value.
本申请还提供了一种可选实施例,该可选实施例提供了一种基于BaaS和系统链码的区块链数据变更历史查询方法。The present application also provides an optional embodiment, which provides a method for querying the history of blockchain data changes based on BaaS and system chain codes.
随着时间的推移,区块链上的区块的数量会越来越多,对于溯源类的查询,比如,查询某个key对应的value变更历史记录,需要从头遍历整个区块链,速度会较慢。With the passage of time, the number of blocks on the blockchain will increase. For traceability queries, such as querying the value change history record corresponding to a key, it is necessary to traverse the entire blockchain from the beginning, and the speed will increase. slower.
在本可选实施例中,采用系统链码监测和获取区块链业务中所需查询的数据键值,在这些键值对应的value值更新后,系统链码将此次更新操作生成的交易区块对应的交易ID、区块高度和时间戳等信息保存到stateDB中,后续可通过BaaS直接对stateDB进行查询。当需要查询区块链数据变更历史时,在BaaS中输入查询请求,通过系统链码在stateDB中查询得到区块链数据的变更历史。In this optional embodiment, the system chain code is used to monitor and obtain the data key values that need to be queried in the blockchain business. After the values corresponding to these key values are updated, the system chain code will update the transaction generated by the update operation. Information such as transaction ID, block height, and timestamp corresponding to the block are stored in the stateDB, and the stateDB can be directly queried through BaaS in the future. When it is necessary to query the change history of blockchain data, enter a query request in BaaS, and query the stateDB through the system chain code to obtain the change history of blockchain data.
如图6所示,本可选实施例中所提供的信息的查询方法的流程可以包括以下步骤:As shown in FIG. 6 , the process of the method for querying the information provided in this optional embodiment may include the following steps:
步骤S602,系统链码把区块链上更新的数据同步到stateDB。Step S602, the system chain code synchronizes the updated data on the blockchain to the stateDB.
通过系统链码在同步区块的同时就将每次变更所产生的交易及所属区块、时间戳等信息记录或追加到以该key计算hash得到的新key对应的stateDB的value中。Through the system chain code, while synchronizing the block, the transaction, the block, timestamp and other information generated by each change are recorded or appended to the value of the stateDB corresponding to the new key obtained by calculating the hash with the key.
步骤S604,通过BaaS输入查询请求,系统链码接收查询请求。Step S604, the query request is input through the BaaS, and the system chain code receives the query request.
步骤S606,系统链码在stateDB中查询数据变更历史。Step S606, the system chain code queries the data change history in the stateDB.
如果需要查询某个key对应的value变更历史记录,只需要根据该key的哈希值在stateDB中直接查询对应的value,就可以得到所有跟该key对应value变更相关的所有区块、交易、时间戳等信息,而无需遍历整个区块链。If you need to query the value change history record corresponding to a key, you only need to directly query the corresponding value in the stateDB according to the hash value of the key, and you can get all the blocks, transactions, and times related to the value change corresponding to the key. information such as stamps without traversing the entire blockchain.
步骤S608,系统链码将结果返回至BaaS。Step S608, the system chain code returns the result to the BaaS.
与相关技术中的区块链数据变更历史查询方法相比,本实施例的信息的查询方法由于减少了查询时遍历区块链的时间,能对区块链数据变更历史查询效率有一个较大的提升,且在stateDB的数据变更历史中保留了交易ID、区块高度和时间戳,当根据业务需求,需要单独检查某条变更历史记录时,可采用交易ID、区块高度和时间戳等信息直接定位查询的区块链,对该条数据进行查验,从而保证了数据变更历史的真实性和一致性。Compared with the blockchain data change history query method in the related art, the information query method of this embodiment reduces the time for traversing the blockchain during query, and can greatly improve the efficiency of the blockchain data change history query. In addition, the transaction ID, block height and timestamp are retained in the data change history of stateDB. When a certain change history needs to be checked separately according to business requirements, the transaction ID, block height and timestamp can be used. The information directly locates the queried blockchain, and checks the piece of data, thus ensuring the authenticity and consistency of the data change history.
通过本实施例,将数据变更历史记录存入数据库中,提高了数据变更历史的查询速度。Through this embodiment, the data change history record is stored in the database, which improves the query speed of the data change history.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本申请并不受所描述的动作顺序的限制,因为依据本申请,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本申请所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the described action sequence. Because in accordance with the present application, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本申请各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) execute the methods described in the various embodiments of this application.
根据本申请实施例的又一个方面,还提供了一种用于实施上述信息的查询方法的信息的查询装置。图7是根据本申请实施例的一种可选的信息的查询装置的示意图,如图7所示,该装置可以包括:According to yet another aspect of the embodiments of the present application, there is also provided an information query apparatus for implementing the above information query method. FIG. 7 is a schematic diagram of an optional information query apparatus according to an embodiment of the present application. As shown in FIG. 7 , the apparatus may include:
(1)第一接收单元72,用于接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;(1) The
(2)查找单元74,与接收单元72相连,用于响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;(2) The
(3)第一发送单元76,与查找单元74相连,用于在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端。(3) The first sending
需要说明的是,该实施例中的第一接收单元72可以用于执行上述步骤S202,该实施例中的查找单元74可以用于执行上述步骤S704,该实施例中的第一发送单元76可以用于执行上述步骤S706。It should be noted that the
通过上述模块,接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端,解决了相关技术中的区块链数据查询方式存在的由于无法并行处理导致的查询效率低的问题,提高了对区块链信息的查询效率。Through the above module, the query request sent by the client is received, wherein the query request is used for requesting to query the data change record information of the target object on the blockchain; in response to the query request, the data change record information of the target object is searched from the target database, wherein , the target database is used to synchronously save the data change record information of one or more objects on the blockchain, one or more objects include the target object; when the target data change record information corresponding to the target object is found, the target The data change record information is sent to the client, which solves the problem of low query efficiency caused by the inability of parallel processing in the blockchain data query method in the related art, and improves the query efficiency of blockchain information.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
(1)第二确定单元,用于在接收客户端发送的查询请求之前,在检测到区块链上与目标键值对应的记录信息发生更新的情况下,确定与目标键值对应的记录信息被更新为了第一交易记录信息,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;(1) The second determination unit is used to determine the record information corresponding to the target key when it is detected that the record information corresponding to the target key on the blockchain is updated before receiving the query request sent by the client is updated to the first transaction record information, wherein the target key value is the identification information of the target object in the blockchain, and the record information corresponding to the target key value is used to record the transaction information of the target object;
(2)第二同步单元,用于将第一交易记录信息同步为目标数据库中的第一数据变更记录信息,其中,目标数据变更记录信息包括第二数据变更记录信息。(2) A second synchronization unit, configured to synchronize the first transaction record information to the first data change record information in the target database, wherein the target data change record information includes the second data change record information.
作为一种可选的实施例,第二同步单元包括:As an optional embodiment, the second synchronization unit includes:
(1)第一获取模块,用于获取第一交易记录信息中的目标记录信息,其中,目标记录信息包括:交易标识,交易时间戳,第一交易记录信息所在的区块高度;(1) The first acquisition module is used to acquire the target record information in the first transaction record information, wherein the target record information includes: a transaction identifier, a transaction time stamp, and a block height where the first transaction record information is located;
(2)第一同步模块,用于将目标记录信息同步为目标数据库中的第一数据变更记录信息。(2) A first synchronization module, configured to synchronize the target record information to the first data change record information in the target database.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
(1)第三确定单元,用于在将第一交易记录信息同步为目标数据库中的第一数据变更记录信息之后,在检测到区块链上与目标键值对应的记录信息发生更新的情况下,确定与目标键值对应的记录信息被更新为了第二交易记录信息;(1) The third determining unit is used to detect that the record information corresponding to the target key value on the blockchain is updated after synchronizing the first transaction record information as the first data change record information in the target database Next, it is determined that the record information corresponding to the target key value is updated to the second transaction record information;
(2)第一添加单元,用于在目标数据库中第一数据变更记录信息所在的位置之后,添加与第二交易记录信息对应的第二数据变更记录信息。(2) A first adding unit, configured to add second data change record information corresponding to the second transaction record information after the location of the first data change record information in the target database.
作为一种可选的实施例,查找单元74包括:As an optional embodiment, the
(1)第二获取模块,用于获取查询请求中携带的目标键值,其中,目标键值为区块链中目标对象的标识信息;(1) The second acquisition module is used to acquire the target key value carried in the query request, wherein the target key value is the identification information of the target object in the blockchain;
(2)第一查找模块,用于使用目标键值的哈希值从目标数据库中查找目标对象的数据变更记录信息。(2) The first search module is used to search the data change record information of the target object from the target database by using the hash value of the target key value.
作为一种可选的实施例,查找单元74包括:As an optional embodiment, the
(1)第三获取模块,用于获取查询请求中携带的时间段信息,其中,时间段信息用于表示查询目标对象在目标时间段内的数据变更记录信息;(1) a third acquisition module, used for acquiring the time period information carried in the query request, wherein the time period information is used to represent the data change record information of the query target object within the target time period;
(2)第二查找模块,用于按照时间段信息,从目标数据库中查找目标对象在目标时间段内的数据变更记录信息。(2) The second search module is configured to search the data change record information of the target object within the target time period from the target database according to the time period information.
作为一种可选的实施例,目标数据变更记录信息与区块链上目标对象的目标交易记录信息对应,目标数据变更记录信息包括:目标交易记录信息的目标交易标识,目标交易记录信息的目标交易时间戳,目标交易记录信息所在的目标区块高度。As an optional embodiment, the target data change record information corresponds to the target transaction record information of the target object on the blockchain, and the target data change record information includes: the target transaction identifier of the target transaction record information, the target transaction record information of the target transaction record information. Transaction timestamp, the height of the target block where the target transaction record information is located.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
(1)第二接收单元,用于在将目标数据变更记录信息发送给客户端之后,接收客户端发送的校验请求,其中,校验请求用于请求对目标数据变更记录信息进行校验,校验请求中携带有目标交易标识、目标交易时间戳和目标区块高度;(1) a second receiving unit, configured to receive a verification request sent by the client after sending the target data change record information to the client, wherein the verification request is used to request to verify the target data change record information, The verification request carries the target transaction ID, target transaction timestamp and target block height;
(2)获取单元,用于根据目标交易标识和目标交易时间戳,从区块链上与目标区块高度对应的区块中获取目标交易记录信息;(2) an obtaining unit, used for obtaining target transaction record information from the block corresponding to the height of the target block on the blockchain according to the target transaction identifier and the target transaction timestamp;
(3)校验单元,用于在获取到目标交易记录信息的情况下,使用目标交易记录信息对目标数据变更记录信息进行校验,得到第一校验结果;(3) a verification unit, configured to use the target transaction record information to verify the target data change record information under the condition of acquiring the target transaction record information to obtain a first verification result;
(4)第二发送单元,用于将第一校验结果发送到客户端。(4) A second sending unit, configured to send the first verification result to the client.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
(1)第三发送单元,用于在未获取到目标交易记录信息的情况下,将第二校验结果发送到客户端,其中,第二校验结果用于指示目标数据变更记录信息校验未通过。(1) A third sending unit, configured to send a second verification result to the client without acquiring the target transaction record information, wherein the second verification result is used to indicate the target data change record information verification Did not pass.
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
(1)第四发送单元,用于在从目标数据库中查找目标对象的数据变更记录信息之后,在未查找到与目标对象对应的数据变更记录信息的情况下,向客户端发送提示信息,其中,提示信息用于提示未查找到与目标对象对应的数据变更记录信息。(1) The fourth sending unit is configured to send prompt information to the client when the data change record information corresponding to the target object is not found after searching for the data change record information of the target object from the target database, wherein , the prompt information is used to prompt that the data change record information corresponding to the target object is not found.
根据本申请实施例的又一个方面,还提供了一种用于实施上述信息的同步方法的信息的同步装置。图8是根据本申请实施例的一种可选的信息的同步装置的示意图,如图8所示,该装置可以包括:According to yet another aspect of the embodiments of the present application, an apparatus for synchronizing information for implementing the above method for synchronizing information is also provided. FIG. 8 is a schematic diagram of an optional information synchronization apparatus according to an embodiment of the present application. As shown in FIG. 8 , the apparatus may include:
(1)检测单元82,用于检测到区块链上与目标键值对应的记录信息发生更新,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;(1) The detection unit 82 is used to detect that the record information corresponding to the target key value on the blockchain is updated, wherein the target key value is the identification information of the target object in the blockchain, and the record information corresponding to the target key value Used to record the transaction information of the target object;
(2)第一确定单元84,与检测单元82相连,用于确定与目标键值对应的记录信息被更新为了第一交易记录信息;(2) the first determination unit 84, connected with the detection unit 82, is used to determine that the record information corresponding to the target key value is updated to the first transaction record information;
(3)第一同步单元86,与第一确定单元84相连,用于将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象。(3) The first synchronization unit 86, connected to the first determination unit 84, is used for synchronizing the first transaction record information as the first data change record information of the target object in the target database, wherein the target database is used for synchronously saving blocks Data change record information for one or more objects on the chain, including the target object.
可选地,在本实施例中,检测单元82与前述第三确定单元可以为相同的单元,也可以为不同的单元;第一确定单元84与前述第二确定单元可以为相同的单元,也可以为不同的单元。Optionally, in this embodiment, the detection unit 82 and the foregoing third determination unit may be the same unit or different units; the first determination unit 84 and the foregoing second determination unit may be the same unit, or Can be different units.
需要说明的是,该实施例中的检测单元82可以用于执行前述步骤S502,该实施例中的第一确定单元84可以用于执行前述步骤S504,该实施例中的第一同步单元86可以用于执行前述步骤S506。It should be noted that the detection unit 82 in this embodiment may be used to perform the foregoing step S502, the first determination unit 84 in this embodiment may be used to perform the foregoing step S504, and the first synchronization unit 86 in this embodiment may be used to perform the foregoing step S504. Used to execute the aforementioned step S506.
通过上述模块,检测到区块链上与目标键值对应的记录信息发生更新,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;确定与目标键值对应的记录信息被更新为了第一交易记录信息;将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象,解决了相关技术中的区块链数据查询方式存在的由于无法并行处理导致的查询效率低的问题,提高了对区块链信息的查询效率。Through the above module, it is detected that the record information corresponding to the target key value on the blockchain is updated, wherein the target key value is the identification information of the target object in the blockchain, and the record information corresponding to the target key value is used to record the target object. determine that the record information corresponding to the target key value is updated to the first transaction record information; synchronize the first transaction record information as the first data change record information of the target object in the target database, wherein the target database is used for synchronization Save the data change record information of one or more objects on the blockchain, and one or more objects include the target object, which solves the problem of low query efficiency caused by the inability of parallel processing in the blockchain data query method in the related art , which improves the query efficiency of blockchain information.
作为一种可选的实施例,第一同步单元86包括:As an optional embodiment, the first synchronization unit 86 includes:
(1)第四获取模块,用于获取第一交易记录信息中的目标记录信息,其中,目标记录信息包括:交易标识,交易时间戳,第一交易记录信息所在的区块高度;(1) The fourth acquisition module is used to acquire the target record information in the first transaction record information, wherein the target record information includes: a transaction identifier, a transaction time stamp, and the block height where the first transaction record information is located;
(2)第二同步模块,用于将目标记录信息同步为目标数据库中目标对象的第一数据变更记录信息。(2) A second synchronization module, configured to synchronize the target record information to the first data change record information of the target object in the target database.
需要说明的是,第四获取模块与前述第一获取模块可以为相同的模块,也可以为不同的模块;第二同步模块与前述第一同步模块可以为相同的模块,也可以为不同的模块。It should be noted that the fourth acquisition module and the aforementioned first acquisition module may be the same module or different modules; the second synchronization module and the aforementioned first synchronization module may be the same module or different modules .
作为一种可选的实施例,上述装置还包括:As an optional embodiment, the above device also includes:
(1)第四确定单元,用于在将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息之后,在检测到区块链上与目标键值对应的记录信息发生更新的情况下,确定与目标键值对应的记录信息被更新为了第二交易记录信息;(1) The fourth determination unit is configured to, after synchronizing the first transaction record information as the first data change record information of the target object in the target database, detects that the record information corresponding to the target key value on the blockchain is updated In the case of , it is determined that the record information corresponding to the target key value is updated to the second transaction record information;
(2)第二添加单元,用于在目标数据库中第一数据变更记录信息所在的位置之后,添加与第二交易记录信息对应的第二数据变更记录信息。(2) A second adding unit, configured to add second data change record information corresponding to the second transaction record information after the location of the first data change record information in the target database.
需要说明的是,第四确定单元与前述第三确定单元可以为相同的单元,也可以为不同的单元;第二添加单元与前述第一添加单元可以为相同的单元,也可以为不同的单元。It should be noted that the fourth determination unit and the aforementioned third determination unit may be the same unit or different units; the second adding unit and the aforementioned first adding unit may be the same unit or different units .
作为一种可选的实施例,第一同步单元86包括:As an optional embodiment, the first synchronization unit 86 includes:
(1)第五获取模块,用于获取与目标键值对应的目标哈希值,目标哈希值为目标数据库中目标对象的标识信息;(1) the 5th acquisition module is used for acquiring the target hash value corresponding to the target key value, and the target hash value is the identification information of the target object in the target database;
(2)确定模块,用于根据第一交易记录信息确定第一数据变更记录信息;(2) a determination module for determining the first data change record information according to the first transaction record information;
(3)写入模块,用于按照目标哈希值将第一数据变更记录信息写入到目标数据库中。(3) The writing module is used for writing the first data change record information into the target database according to the target hash value.
此处需要说明的是,上述模块与对应的步骤所实现的示例和应用场景相同,但不限于上述实施例公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在如图1所示的硬件环境中,可以通过软件实现,也可以通过硬件实现,其中,硬件环境包括网络环境。It should be noted here that the examples and application scenarios implemented by the foregoing modules and corresponding steps are the same, but are not limited to the contents disclosed in the foregoing embodiments. It should be noted that, as a part of the device, the above modules may run in the hardware environment as shown in FIG. 1 , and may be implemented by software or hardware, wherein the hardware environment includes a network environment.
根据本申请实施例的又一个方面,还提供了一种用于实施上述信息的查询方法、或者信息的同步方法的电子装置,该电子装置可以是服务器、终端或者其组合。可选地,该电子装置可以为区块链上的节点,该节点上可以布设有系统链码。According to yet another aspect of the embodiments of the present application, there is also provided an electronic device for implementing the above information query method or information synchronization method, where the electronic device may be a server, a terminal, or a combination thereof. Optionally, the electronic device may be a node on the blockchain, and a system chain code may be arranged on the node.
图9是根据本申请实施例的一种电子装置的结构框图,如图9所示,该电子装置包括存储器902和处理器904,该存储器902中存储有计算机程序,该处理器904被设置为通过计算机程序执行上述任一项方法实施例中的步骤。FIG. 9 is a structural block diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 9 , the electronic device includes a
可选地,在本实施例中,上述电子装置可以位于计算机网络的多个网络设备中的至少一个网络设备。Optionally, in this embodiment, the above-mentioned electronic apparatus may be located in at least one network device among multiple network devices of a computer network.
可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:
S1,接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;S1, receiving a query request sent by the client, wherein the query request is used to request to query the data change record information of the target object on the blockchain;
S2,响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;S2, in response to the query request, look up the data change record information of the target object from the target database, where the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and the one or more objects include the target object ;
S3,在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端。S3, in the case of finding the target data change record information corresponding to the target object, send the target data change record information to the client.
可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:
S1,检测到区块链上与目标键值对应的记录信息发生更新,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;S1, it is detected that the record information corresponding to the target key value on the blockchain is updated, wherein the target key value is the identification information of the target object in the blockchain, and the record information corresponding to the target key value is used to record the transaction of the target object information;
S2,确定与目标键值对应的记录信息被更新为了第一交易记录信息;S2, determine that the record information corresponding to the target key value is updated to the first transaction record information;
S3,将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象。S3: Synchronize the first transaction record information as the first data change record information of the target object in the target database, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and one or more Objects include target objects.
可选地,本领域普通技术人员可以理解,图9所示的结构仅为示意,电子装置也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌上电脑以及MID(MobileInternet Devices,移动互联网设备)、PAD等终端设备。图9其并不对上述电子装置的结构造成限定。例如,电子装置还可包括比图9中所示更多或者更少的组件(如网络接口等),或者具有与图9中不同的配置。Optionally, those of ordinary skill in the art can understand that the structure shown in FIG. 9 is only for illustration, and the electronic device can also be a smart phone (such as an Android mobile phone, an iOS mobile phone, etc.), a tablet computer, a palmtop computer, and a MID (Mobile Internet Devices, Mobile Internet equipment), PAD and other terminal equipment. FIG. 9 does not limit the structure of the above electronic device. For example, the electronic device may also include more or less components than those shown in FIG. 9 (eg, network interfaces, etc.), or have a different configuration than that shown in FIG. 9 .
其中,存储器902可用于存储软件程序以及模块,如本申请实施例中的信息的查询方法和装置对应的程序指令/模块、或者信息的同步方法和装置对应的程序指令/模块,处理器904通过运行存储在存储器902内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的信息的查询方法、或者信息的同步方法。存储器902可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器902可进一步包括相对于处理器904远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The
其中,存储器902具体可以但不限于用于存储一个或多个对象的数据变更记录信息。The
作为一种示例,如图9所示,上述存储器902中可以但不限于包括上述信息的查询装置中的第一接收单元72、查找单元74和第一发送单元76。此外,还可以包括但不限于上述信息的查询装置中的其他模块单元,本示例中不再赘述。As an example, as shown in FIG. 9 , the above-mentioned
作为另一种示例,上述存储器902中可以但不限于包括上述信息的同步装置中的检测单元82、第一确定单元84和第一同步单元86。此外,还可以包括但不限于上述信息的同步装置中的其他模块单元,本示例中不再赘述。As another example, the foregoing
可选地,上述的传输装置906用于经由一个网络接收或者发送数据。上述的网络具体实例可包括有线网络及无线网络。在一个实例中,传输装置906包括一个NIC(NetworkInterface Controller,网络适配器),其可通过网线与其他网络设备与路由器相连从而可与互联网或局域网进行通讯。在一个实例中,传输装置906为RF(Radio Frequency,射频)模块,其用于通过无线方式与互联网进行通讯。Optionally, the above-mentioned
此外,上述电子装置还可以包括:连接总线908,用于连接上述电子装置中的各个模块部件。In addition, the above-mentioned electronic device may further include: a
可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments, and details are not described herein again in this embodiment.
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、ROM(Read-Only Memory,只读存储器)、RAM(Random AccessMemory,随机存取器)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can Including: flash disk, ROM (Read-Only Memory, read-only memory), RAM (Random Access Memory, random access device), magnetic disk or optical disk, etc.
根据本申请实施例的又一个方面,还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以用于执行信息的查询方法、或者信息的同步方法的程序代码。According to yet another aspect of the embodiments of the present application, a storage medium is also provided. Optionally, in this embodiment, the above-mentioned storage medium may be used to execute the program code of the information query method or the information synchronization method.
可选地,在本实施例中,上述存储介质可以位于上述实施例所示的网络中的多个网络设备中的至少一个网络设备上。Optionally, in this embodiment, the foregoing storage medium may be located on at least one network device among multiple network devices in the network shown in the foregoing embodiment.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:
S1,接收客户端发送的查询请求,其中,查询请求用于请求查询区块链上目标对象的数据变更记录信息;S1, receiving a query request sent by the client, wherein the query request is used to request to query the data change record information of the target object on the blockchain;
S2,响应查询请求,从目标数据库中查找目标对象的数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象;S2, in response to the query request, look up the data change record information of the target object from the target database, where the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and the one or more objects include the target object ;
S3,在查找到与目标对象对应的目标数据变更记录信息的情况下,将目标数据变更记录信息发送给客户端。S3, in the case of finding the target data change record information corresponding to the target object, send the target data change record information to the client.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps:
S1,检测到区块链上与目标键值对应的记录信息发生更新,其中,目标键值为区块链中目标对象的标识信息,与目标键值对应的记录信息用于记录目标对象的交易信息;S1, it is detected that the record information corresponding to the target key value on the blockchain is updated, wherein the target key value is the identification information of the target object in the blockchain, and the record information corresponding to the target key value is used to record the transaction of the target object information;
S2,确定与目标键值对应的记录信息被更新为了第一交易记录信息;S2, determine that the record information corresponding to the target key value is updated to the first transaction record information;
S3,将第一交易记录信息同步为目标数据库中目标对象的第一数据变更记录信息,其中,目标数据库用于同步保存区块链上一个或多个对象的数据变更记录信息,一个或多个对象包括目标对象。S3: Synchronize the first transaction record information as the first data change record information of the target object in the target database, wherein the target database is used to synchronously save the data change record information of one or more objects on the blockchain, and one or more Objects include target objects.
可选地,本实施例中的具体示例可以参考上述实施例中所描述的示例,本实施例在此不再赘述。Optionally, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments, and details are not described herein again in this embodiment.
可选地,在本实施例中,上述存储介质可以包括但不限于:U盘、ROM、RAM、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。Optionally, in this embodiment, the above-mentioned storage medium may include, but is not limited to: U disk, ROM, RAM, removable hard disk, magnetic disk, or optical disk, and other mediums that can store program codes.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.
上述实施例中的集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在上述计算机可读取的存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在存储介质中,包括若干指令用以使得一台或多台计算机设备(可为个人计算机、服务器或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。If the integrated units in the above-mentioned embodiments are implemented in the form of software functional units and sold or used as independent products, they may be stored in the above-mentioned computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art, or all or part of the technical solution, and the computer software product is stored in a storage medium, Several instructions are included to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application.
在本申请的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的客户端,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed client may be implemented in other manners. The apparatus embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of units or modules, and may be in electrical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
以上所述仅是本申请的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。The above are only the preferred embodiments of the present application. It should be pointed out that for those skilled in the art, without departing from the principles of the present application, several improvements and modifications can also be made. It should be regarded as the protection scope of this application.
Claims (16)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010431296.8A CN111813788B (en) | 2020-05-20 | 2020-05-20 | Information query method and device, information synchronization method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010431296.8A CN111813788B (en) | 2020-05-20 | 2020-05-20 | Information query method and device, information synchronization method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN111813788A true CN111813788A (en) | 2020-10-23 |
| CN111813788B CN111813788B (en) | 2025-01-21 |
Family
ID=72847692
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010431296.8A Active CN111813788B (en) | 2020-05-20 | 2020-05-20 | Information query method and device, information synchronization method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN111813788B (en) |
Cited By (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112579291A (en) * | 2020-12-22 | 2021-03-30 | 北京航空航天大学 | StateDB-based intelligent contract parallel operation system and parallel operation method |
| CN113343292A (en) * | 2021-05-28 | 2021-09-03 | 网易(杭州)网络有限公司 | Transaction number processing method and device, storage medium and computer equipment |
| CN113379542A (en) * | 2021-05-28 | 2021-09-10 | 中邮信息科技(北京)有限公司 | Query method, device, medium and electronic equipment for block chain transaction |
| CN114065237A (en) * | 2021-11-04 | 2022-02-18 | 深圳华云信息系统有限公司 | Verification method, verification device, electronic equipment and storage medium |
| CN115017187A (en) * | 2022-05-26 | 2022-09-06 | 平安银行股份有限公司 | Data query method, device, equipment and storage medium |
| CN115114482A (en) * | 2021-03-19 | 2022-09-27 | 京东科技信息技术有限公司 | Resource record storage method and device |
| CN116561089A (en) * | 2023-07-10 | 2023-08-08 | 成都泛联智存科技有限公司 | Data synchronization method, device, client and computer readable storage medium |
| CN116719817A (en) * | 2023-06-12 | 2023-09-08 | 北京大学 | Digital object relationship tracing method and system for technological resources |
| JP7714202B1 (en) * | 2024-09-02 | 2025-07-29 | 国立大学法人佐賀大学 | Information and communication device and information and communication program |
Citations (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN107729383A (en) * | 2017-09-18 | 2018-02-23 | 联动优势科技有限公司 | A kind of library generation method, data verification method, device and platform |
| US20190042620A1 (en) * | 2017-08-01 | 2019-02-07 | International Business Machines Corporation | Optimizing queries and other retrieve operations in a blockchain |
| CN109710627A (en) * | 2018-12-29 | 2019-05-03 | 中国银联股份有限公司 | A transaction query method and device based on blockchain network |
| CN109741060A (en) * | 2018-12-29 | 2019-05-10 | 北京金山安全软件有限公司 | Information inquiry system, method, device, electronic equipment and storage medium |
| CN110489413A (en) * | 2019-07-15 | 2019-11-22 | 杭州复杂美科技有限公司 | A kind of storage of transaction record, querying method and system, equipment and storage medium |
| CN110597836A (en) * | 2019-09-19 | 2019-12-20 | 腾讯科技(深圳)有限公司 | Information query request response method and device based on block chain network |
| CN110633389A (en) * | 2018-05-31 | 2019-12-31 | 阿里巴巴集团控股有限公司 | Processing method, device and system of block chain data and electronic equipment |
| CN110909011A (en) * | 2019-12-03 | 2020-03-24 | 北京海益同展信息科技有限公司 | Citizen information processing method, device, equipment and storage medium |
| CN111078711A (en) * | 2019-12-31 | 2020-04-28 | 北京艾摩瑞策科技有限公司 | Block chain data storage and acquisition method and device based on data index |
| CN111143476A (en) * | 2019-12-31 | 2020-05-12 | 杭州趣链科技有限公司 | A database-based smart contract data fast query method |
| CN111161064A (en) * | 2019-12-12 | 2020-05-15 | 深圳前海微众银行股份有限公司 | A method and device for processing blockchain transaction records |
-
2020
- 2020-05-20 CN CN202010431296.8A patent/CN111813788B/en active Active
Patent Citations (11)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20190042620A1 (en) * | 2017-08-01 | 2019-02-07 | International Business Machines Corporation | Optimizing queries and other retrieve operations in a blockchain |
| CN107729383A (en) * | 2017-09-18 | 2018-02-23 | 联动优势科技有限公司 | A kind of library generation method, data verification method, device and platform |
| CN110633389A (en) * | 2018-05-31 | 2019-12-31 | 阿里巴巴集团控股有限公司 | Processing method, device and system of block chain data and electronic equipment |
| CN109710627A (en) * | 2018-12-29 | 2019-05-03 | 中国银联股份有限公司 | A transaction query method and device based on blockchain network |
| CN109741060A (en) * | 2018-12-29 | 2019-05-10 | 北京金山安全软件有限公司 | Information inquiry system, method, device, electronic equipment and storage medium |
| CN110489413A (en) * | 2019-07-15 | 2019-11-22 | 杭州复杂美科技有限公司 | A kind of storage of transaction record, querying method and system, equipment and storage medium |
| CN110597836A (en) * | 2019-09-19 | 2019-12-20 | 腾讯科技(深圳)有限公司 | Information query request response method and device based on block chain network |
| CN110909011A (en) * | 2019-12-03 | 2020-03-24 | 北京海益同展信息科技有限公司 | Citizen information processing method, device, equipment and storage medium |
| CN111161064A (en) * | 2019-12-12 | 2020-05-15 | 深圳前海微众银行股份有限公司 | A method and device for processing blockchain transaction records |
| CN111078711A (en) * | 2019-12-31 | 2020-04-28 | 北京艾摩瑞策科技有限公司 | Block chain data storage and acquisition method and device based on data index |
| CN111143476A (en) * | 2019-12-31 | 2020-05-12 | 杭州趣链科技有限公司 | A database-based smart contract data fast query method |
Cited By (12)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN112579291A (en) * | 2020-12-22 | 2021-03-30 | 北京航空航天大学 | StateDB-based intelligent contract parallel operation system and parallel operation method |
| CN115114482A (en) * | 2021-03-19 | 2022-09-27 | 京东科技信息技术有限公司 | Resource record storage method and device |
| CN113343292A (en) * | 2021-05-28 | 2021-09-03 | 网易(杭州)网络有限公司 | Transaction number processing method and device, storage medium and computer equipment |
| CN113379542A (en) * | 2021-05-28 | 2021-09-10 | 中邮信息科技(北京)有限公司 | Query method, device, medium and electronic equipment for block chain transaction |
| CN113379542B (en) * | 2021-05-28 | 2024-01-09 | 中邮信息科技(北京)有限公司 | Block chain transaction query method, device, medium and electronic equipment |
| CN114065237A (en) * | 2021-11-04 | 2022-02-18 | 深圳华云信息系统有限公司 | Verification method, verification device, electronic equipment and storage medium |
| CN115017187A (en) * | 2022-05-26 | 2022-09-06 | 平安银行股份有限公司 | Data query method, device, equipment and storage medium |
| CN116719817A (en) * | 2023-06-12 | 2023-09-08 | 北京大学 | Digital object relationship tracing method and system for technological resources |
| CN116719817B (en) * | 2023-06-12 | 2024-03-26 | 北京大学 | Digital object relationship tracing method and system for technological resources |
| CN116561089A (en) * | 2023-07-10 | 2023-08-08 | 成都泛联智存科技有限公司 | Data synchronization method, device, client and computer readable storage medium |
| CN116561089B (en) * | 2023-07-10 | 2023-09-19 | 成都泛联智存科技有限公司 | Data synchronization method, device, client and computer readable storage medium |
| JP7714202B1 (en) * | 2024-09-02 | 2025-07-29 | 国立大学法人佐賀大学 | Information and communication device and information and communication program |
Also Published As
| Publication number | Publication date |
|---|---|
| CN111813788B (en) | 2025-01-21 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN111813788A (en) | Information query method and device, and information synchronization method and device | |
| CN114238767B (en) | Service recommendation method, device, computer equipment and storage medium | |
| CN109474578A (en) | Message method of calibration, device, computer equipment and storage medium | |
| CN110063042B (en) | A database failure response method and its terminal | |
| CN110275992B (en) | Emergency treatment method, device, server and computer-readable storage medium | |
| CN113672692B (en) | Data processing method, data processing device, computer equipment and storage medium | |
| CN110088744A (en) | A database maintenance method and system thereof | |
| CN109445837B (en) | Application program publishing method and device | |
| CN109740129B (en) | Report generation method, device and equipment based on blockchain and readable storage medium | |
| CN113806816A (en) | Electronic file management method and device based on block chain and electronic equipment | |
| CN115333951A (en) | Method and device for generating network asset information and electronic equipment | |
| CN114866447A (en) | Automatic test method and device for message receiving and sending of vehicle controller | |
| CN114595127B (en) | Log exception processing method, device, equipment and storage medium | |
| CN117650937A (en) | Task permission verification method and device, nonvolatile storage medium and electronic equipment | |
| CN116383081A (en) | A software testing method, system, storage medium and electronic device | |
| CN110058995A (en) | A kind of the data library test method and system of the interference of avoidable type of database | |
| CN114598680B (en) | Domain name management method, device and storage medium | |
| CN111159988A (en) | Model processing method and device, computer equipment and storage medium | |
| CN113626409B (en) | Test data processing method, device, equipment and storage medium | |
| CN112085443B (en) | A distribution resource detection, task execution method, device and electronic equipment | |
| CN114741738A (en) | Tracing data processing method and device based on block chain, electronic equipment and medium | |
| CN114138769A (en) | System and method for automatic verification and collection of CMDB data | |
| CN112035358A (en) | Method, device and equipment for determining detection information | |
| CN111464395A (en) | Method and device for creating block chain and readable storage medium | |
| CN116009931B (en) | Method, system and related equipment for auditing application infrastructure resource architecture |
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 |