WO2020211258A1 - Blockchain account book data query method, electronic apparatus and storage medium - Google Patents

Blockchain account book data query method, electronic apparatus and storage medium Download PDF

Info

Publication number
WO2020211258A1
WO2020211258A1 PCT/CN2019/103764 CN2019103764W WO2020211258A1 WO 2020211258 A1 WO2020211258 A1 WO 2020211258A1 CN 2019103764 W CN2019103764 W CN 2019103764W WO 2020211258 A1 WO2020211258 A1 WO 2020211258A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
data
blockchain ledger
written
piece
Prior art date
Application number
PCT/CN2019/103764
Other languages
French (fr)
Chinese (zh)
Inventor
汪昌帅
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020211258A1 publication Critical patent/WO2020211258A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE 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/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • This application relates to the field of database technology, in particular to a method for querying blockchain ledger data, an electronic device and a storage medium.
  • the inventor realizes that the processing efficiency of the accounting and query function operations of the blockchain ledger will directly affect the efficiency and usage of the blockchain system.
  • the existing blockchain ledger does not support page-by-page query. In this way, it will greatly affect the efficiency of blockchain ledger accounting and query.
  • the purpose of this application is to provide a query method, electronic device and storage medium for blockchain ledger data, so as to solve the existing technical problems of low query and accounting efficiency caused by the inability to query by page.
  • a method for querying blockchain ledger data includes the following steps:
  • the page number of the target page obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
  • the combined result is used as the query result, and the query result is returned.
  • an electronic device including a memory and a processor, the memory is used to store a query system for blockchain ledger data that can be executed by the processor, the blockchain ledger
  • the data query system includes:
  • the first obtaining module is configured to obtain a query request, wherein the query request carries the page number of the target page;
  • the second obtaining module is configured to obtain a keyword set corresponding to the page number of the target page from the blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
  • the third obtaining module is configured to obtain the value corresponding to each keyword in the keyword set from the blockchain ledger;
  • the combination module is used to combine the acquired keyword set and the corresponding value of each keyword in the keyword;
  • the return module is used to take the combined result as the query result and return the query result.
  • a computer device including a memory and a processor, the processor is configured to execute the following steps:
  • the page number of the target page obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
  • the combined result is used as the query result, and the query result is returned.
  • a non-volatile computer-readable storage medium on which computer instructions are stored, and the following steps are implemented when the instructions are executed:
  • the page number of the target page obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
  • the combined result is used as the query result, and the query result is returned.
  • This application obtains the query request carrying the page number of the target page, and obtains the keyword set corresponding to the page number of the target page from the blockchain ledger according to the page number of the target page, where one or more keywords exist in the keyword set Get the value corresponding to each keyword in the keyword set from the blockchain ledger; combine the obtained keyword set and the corresponding value of each keyword in the keyword; use the combined result as the query result and return The query result.
  • Fig. 1 is a method flowchart of a method for querying blockchain ledger data according to an embodiment of the present application
  • FIG. 2 is a structural block diagram of a query system for blockchain ledger data according to an embodiment of the present application
  • Fig. 3 is a schematic diagram of an optional hardware architecture of an electronic device according to an embodiment of the present application.
  • the blockchain (Fabric) KV ledger does not have page accounting and query functions. If the blockchain (Fabric) can be adjusted The storage method of the KV ledger enables the Blockchain (Fabric) KV ledger to realize the paging management of data, which can effectively improve the efficiency of accounting and query of the Blockchain (Fabric) KV ledger.
  • a method and electronic device for querying blockchain ledger data are provided.
  • the method and electronic device are specifically described as follows:
  • Figure 1 is a schematic diagram of an optional flow chart of the query method for blockchain ledger data of this application. As shown in Figure 1, the method may include the following steps:
  • Step 101 Obtain a query request, where the query request carries the page number of the target page;
  • Step 102 According to the page number of the target page, obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
  • Step 103 Obtain the value corresponding to each keyword in the keyword set from the blockchain ledger
  • Step 104 Combine the acquired keyword set and the corresponding value of each keyword in the keyword;
  • Step 105 Use the combined result as the query result, and return the query result.
  • the above-mentioned blockchain ledger can be established as follows, so as to realize the paging management of the blockchain ledger:
  • S1 Obtain the establishment rules of the blockchain ledger, where the establishment rules include a limit on the number of items per page;
  • the page can be understood as a virtual concept, not the actual partition of the database, but the data divided into one page by one page.
  • S2 Obtain a piece of data to be written into the blockchain ledger, where the piece of data to be written into the blockchain ledger includes: keywords and values;
  • each piece of data may include a pair of K-V values, that is, include a keyword and a value corresponding to the keyword, for example, the keyword is Zhang San, and the corresponding value is 400 yuan.
  • a keyword can also correspond to two or more values, then this keyword and multiple values can be used as a key-value pair, that is, a piece of data storage.
  • an area or field can be specifically delineated in the blockchain ledger to store the pages that have been currently written, and the current number of pages that have been written into several pieces of data.
  • S6 Record the page number of the next page and the number of data written in the next page in the blockchain ledger, record the key of the data to be written in the blockchain ledger, and add the A key word of data to be written into the blockchain ledger is associated with the page number of the next page.
  • S7 Record the page number of the next page and the number of data written in the next page in the blockchain ledger.
  • the metadata value can be obtained as 1,1 (where metadata indicates which page has been stored currently, and how many pieces of data have been stored on this page), based on the metadata value 1,1 can be determined, and the first page has been stored currently
  • 1,1 the metadata value
  • the value of page1 can be updated to: ⁇ page1,[ ⁇ , ⁇ ]>, after completion, update the metadata value [1,2];
  • the data of ⁇ Li Si, 400> is added to the database to realize the accounting requirements of the blockchain ledger.
  • paging query can also be performed.
  • a part of the field or space is divided to record the page number of the page currently stored to and the number of data items already stored on the current page.
  • New data can include the following steps:
  • S3 Query the value values corresponding to all the key values in the pagenum, thereby obtaining and returning the data of a page corresponding to the pagenum page.
  • the keyword query operation based on the page number can be completed through the stored page number and the keyword corresponding to the page number.
  • a paging design is adopted for the K-V database in the blockchain ledger, and the data on the ledger can be divided into three categories as shown in Table 1 below according to functions: metadata category, pagenum category, and actual business data records.
  • S2 Get the metadata value as 1,0; that is, it is on page 1 and contains 0 pieces of data. This is the initial state.
  • S3 Start recording data from the first page. At this time, page1 is added, and the data of Zhang San is placed on page1, so there is new data ⁇ page1, Zhang San>. After completion, the metadata value is updated to [1,1], which means the current Page is the first page and a piece of data is stored on the first page;
  • S2 Get the metadata value as 1,1, check that the number of data items in page1 at this time is 1, which is less than 2;
  • S2 Get the metadata value to be 1, and check that the number of data in page1 is 2, which is equal to 2;
  • the obtained metadata data is 2, 1, and it can be determined that there are 2 pages of data in the database at this time;
  • Query a page of data (for example: query the data of the second page, the input parameter is 2)
  • the acquired page2 value set is [ ⁇ ]
  • the acquired Wang five value is 500.
  • the actual stored page number and the number of data items already stored in the page number are stored in the blockchain ledger, as well as the key value of all the data contained in the page number and the data value corresponding to each key value.
  • the existence of data based on page number is realized, so that when the blockchain fabric is inquired, the page number parameter is passed in, and all the data of the page can be returned.
  • this embodiment provides a blockchain ledger data query system.
  • Figure 2 shows the blockchain ledger data query system
  • the optional structural block diagram of the blockchain ledger data query system is divided into one or more program modules, one or more program modules are stored in a storage medium and executed by one or more processors, To complete this application.
  • the program module referred to in this application refers to a series of computer program instruction segments that can complete specific functions. It is more suitable than the program itself to describe the execution process of the blockchain ledger data query system in the storage medium. The following description will specifically introduce this implementation Examples of the functions of each program module:
  • the blockchain ledger data query system 20 may include:
  • the first obtaining module 201 is configured to obtain a query request, wherein the query request carries the page number of the target page;
  • the second obtaining module 202 is configured to obtain a keyword set corresponding to the page number of the target page from the blockchain ledger according to the page number of the target page, where one or more keywords exist in the keyword set;
  • the third obtaining module 203 is configured to obtain the value corresponding to each keyword in the keyword set from the blockchain ledger;
  • the combination module 204 is configured to combine the acquired keyword set and the corresponding value of each keyword in the keyword;
  • the return module 205 is configured to use the combined result as the query result and return the query result.
  • the above-mentioned device may further include: an establishment module for establishing the blockchain ledger in the following manner:
  • S1 Obtain the establishment rules of the blockchain ledger, where the establishment rules include a limit on the number of items per page;
  • S2 Obtain a piece of data to be written into the blockchain ledger, where the piece of data to be written into the blockchain ledger includes: keywords and values;
  • S6 Record the page number of the current page and the number of data items written in the current page in the blockchain ledger.
  • the above-mentioned establishment module may also be used to determine whether the number of data items written in the current page reaches the limit number of items per page, and after determining whether the number of data items written in the current page reaches the limit number per page In the case of the number of entries, add 1 to the page number of the current page as the next page; write the piece of data to be written into the blockchain ledger to the next page; record the next page in the blockchain ledger The page number and the number of data written in the next page.
  • the above-mentioned establishment module may also be used to record the keyword of the piece of data to be written into the blockchain ledger after writing the piece of data to be written into the blockchain ledger into the next page , And associate the key of the piece of data to be written into the blockchain ledger with the page number of the next page.
  • the query request carrying the page number of the target page is obtained, and the keyword set corresponding to the page number of the target page is obtained from the blockchain ledger according to the page number of the target page, where the keyword There are one or more keywords in the set; obtain the value corresponding to each keyword in the keyword set from the blockchain ledger; combine the obtained keyword set with the corresponding value of each keyword in the keyword; The combined result is used as the query result, and the query result is returned.
  • FIG. 3 is a schematic diagram of the hardware architecture of an embodiment of the electronic device according to the present application.
  • the electronic device 2 is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions.
  • it can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers).
  • the electronic device 2 at least includes, but is not limited to, a memory 21, a processor 22, a network interface 23, and a blockchain ledger data query system 20 that can communicate with each other through a system bus. among them:
  • the memory 21 includes at least one type of computer-readable storage medium.
  • the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), and static random access memory.
  • SRAM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • PROM programmable read-only memory
  • magnetic memory magnetic disk, optical disk, etc.
  • the memory 21 may be an internal storage module of the electronic device 2, such as a hard disk or a memory of the electronic device 2.
  • the memory 21 may also be an external storage device of the electronic device 2, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SD card, Flash Card, etc.
  • the memory 21 may also include both an internal storage module of the electronic device 2 and an external storage device thereof.
  • the memory 21 is generally used to store the operating system and various application software installed in the electronic device 2, for example, the program code of the query system 20 for blockchain ledger data.
  • the memory 21 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 22 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments.
  • the processor 22 is generally used to control the overall operation of the electronic device 2, for example, perform data interaction or communication-related control and processing with the electronic device 2.
  • the processor 22 is used to run the program code or process data stored in the memory 21, such as the running blockchain ledger data query system 20 and so on.
  • the network interface 23 may include a wireless network interface or a wired network interface, and the network interface 23 is generally used to establish a communication connection between the electronic device 2 and other electronic devices.
  • the network interface 23 is used to connect the electronic device 2 with an external terminal through a network, and establish a data transmission channel and a communication connection between the electronic device 2 and the external terminal.
  • the network can be corporate intranet (Intranet), Internet (Internet), Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Wireless or wired networks such as Bluetooth and Wi-Fi.
  • FIG. 3 only shows an electronic device with components 21-23, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
  • the query system 20 for blockchain ledger data stored in the memory 21 can also be divided into one or more program modules, one or more program modules are stored in the memory 21, and are composed of one or more program modules.
  • Multiple processors in this embodiment, the processor 22 are executed to complete the application.
  • This embodiment also provides a non-volatile computer-readable storage medium.
  • the computer-readable storage medium stores a query system for blockchain ledger data.
  • the query system for blockchain ledger data can be executed by at least one processor.
  • At least one processor implements the steps of the following method when executing: obtaining a query request, where the query request carries the page number of the target page; according to the page number of the target page, the keyword corresponding to the page number of the target page is obtained from the blockchain ledger Set, where one or more keywords exist in the keyword set; obtain the value corresponding to each keyword in the keyword set from the blockchain ledger; combine the obtained keyword set and the corresponding value of each keyword in the keyword; Use the combined result as the query result and return the query result.
  • the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc.
  • the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device.
  • the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital) equipped on the computer device. , SD) card, flash card (Flash Card), etc.
  • the computer-readable storage medium may also include both the internal storage unit and the external storage device of the computer device.
  • the computer-readable storage medium is generally used to store the operating system and various application software installed in the computer device, such as the program code of the customer assurance analysis system in the second embodiment.
  • the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.
  • modules or steps of the above-mentioned embodiments of the application can be implemented by a general computing device, and they can be concentrated on a single computing device or distributed among multiple computing devices.
  • they can be implemented with program codes executable by a computing device, so that they can be stored in a storage device for execution by the computing device, and in some cases, can be different from here
  • the steps shown or described are executed in the order of, or they are respectively fabricated into individual integrated circuit modules, or multiple modules or steps of them are fabricated into a single integrated circuit module to achieve. In this way, the embodiments of the present application are not limited to any specific hardware and software combination.

Abstract

Disclosed are a blockchain account book data query method, an electronic apparatus and a storage medium. The method comprises: acquiring a query request, wherein the query request carries a page number of a target page (101); acquiring a keyword set corresponding to the page number of the target page from a blockchain account book according to the page number of the target page, wherein there are one or more keywords in the keyword set (102); acquiring a value corresponding to each keyword in the keyword set from the blockchain account book (103); combining the acquired keyword set and the value corresponding to each keyword in the keywords (104); and taking a combination result as a query result, and returning the query result (105). By means of the method, the existing technical problem of data in a blockchain account book being unable to be queried by page is solved, the aim of effectively querying by page is achieved, and thus the querying and accounting efficiency of a blockchain account book can be effectively improved.

Description

区块链账本数据的查询方法、电子装置及存储介质Block chain ledger data query method, electronic device and storage medium
本申请申明享有2019年4月17日递交的申请号为CN 201910308012.3、名称为“区块链账本数据的查询方法、电子装置及存储介质”的中国专利申请的优先权,该中国专利申请的整体内容以参考的方式结合在本申请中。This application affirms that it enjoys the priority of the Chinese patent application with the application number CN201910308012.3 and the name "Blockchain ledger data query method, electronic device and storage medium" filed on April 17, 2019. The entire Chinese patent application The content is incorporated in this application by reference.
技术领域Technical field
本申请涉及数据库技术领域,具体涉及一种区块链账本数据的查询方法、电子装置及存储介质。This application relates to the field of database technology, in particular to a method for querying blockchain ledger data, an electronic device and a storage medium.
背景技术Background technique
随着区块链技术的不断发展,越来越多的人开始研究区块链技术,区块链技术的应用也越来越广泛。对于区块链而言,区块链(Fabric)K-V账本是区块链技术中很重要的组成。With the continuous development of blockchain technology, more and more people have begun to study blockchain technology, and the application of blockchain technology has become more and more extensive. For the blockchain, the Fabric K-V ledger is a very important component of the blockchain technology.
发明人意识到对于区块链账本的记账和查询功能操作的处理效率,将直接影响区块链系统的效率和使用情况,然而,现有的区块链账本都还不支持按页的查询方式,这样将极大地影响区块链账本记账和查询的效率。The inventor realizes that the processing efficiency of the accounting and query function operations of the blockchain ledger will directly affect the efficiency and usage of the blockchain system. However, the existing blockchain ledger does not support page-by-page query. In this way, it will greatly affect the efficiency of blockchain ledger accounting and query.
针对上述问题,目前尚未提出有效的解决方案。In view of the above problems, no effective solutions have been proposed yet.
发明内容Summary of the invention
本申请的目的在于提供一种区块链账本数据的查询方法、电子装置及存储介质,进而解决现有的无法按页进行查询导致的查询和记账效率低下的技术问题。The purpose of this application is to provide a query method, electronic device and storage medium for blockchain ledger data, so as to solve the existing technical problems of low query and accounting efficiency caused by the inability to query by page.
本申请是通过下述技术方案来解决上述技术问题:This application solves the above technical problems through the following technical solutions:
根据本申请的一个方面,提供了一种区块链账本数据的查询方法,包括如下步骤:According to one aspect of this application, a method for querying blockchain ledger data is provided, which includes the following steps:
获取查询请求,其中,所述查询请求中携带有目标页的页码;Acquiring a query request, where the query request carries the page number of the target page;
根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;According to the page number of the target page, obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
从所述区块链账本中获取所述关键字集中各个关键字对应的值;Obtaining the value corresponding to each keyword in the keyword set from the blockchain ledger;
将获取的关键字集和所述关键字中各个关键字对应值进行组合;Combine the acquired keyword set and the corresponding value of each keyword in the keyword;
将组合结果作为查询结果,返回所述查询结果。The combined result is used as the query result, and the query result is returned.
根据本申请的另一个方面,提供了一种电子装置,包括存储器和处理器,所述存储器用于存储可被所述处理器执行的区块链账本数据的查询系统,所述区块链账本数据的查询系统包括:According to another aspect of the present application, there is provided an electronic device, including a memory and a processor, the memory is used to store a query system for blockchain ledger data that can be executed by the processor, the blockchain ledger The data query system includes:
第一获取模块,用于获取查询请求,其中,所述查询请求中携带有目标页的页码;The first obtaining module is configured to obtain a query request, wherein the query request carries the page number of the target page;
第二获取模块,用于根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;The second obtaining module is configured to obtain a keyword set corresponding to the page number of the target page from the blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
第三获取模块,用于从所述区块链账本中获取所述关键字集中各个关键字对应的值;The third obtaining module is configured to obtain the value corresponding to each keyword in the keyword set from the blockchain ledger;
组合模块,用于将获取的关键字集和所述关键字中各个关键字对应值进行组合;The combination module is used to combine the acquired keyword set and the corresponding value of each keyword in the keyword;
返回模块,用于将组合结果作为查询结果,返回所述查询结果。The return module is used to take the combined result as the query result and return the query result.
根据本申请的又一个方面,提供了一种计算机设备,包括:存储器和处理器,所述处理器用于执行如下步骤:According to another aspect of the present application, there is provided a computer device, including a memory and a processor, the processor is configured to execute the following steps:
获取查询请求,其中,所述查询请求中携带有目标页的页码;Acquiring a query request, where the query request carries the page number of the target page;
根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;According to the page number of the target page, obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
从所述区块链账本中获取所述关键字集中各个关键字对应的值;Obtaining the value corresponding to each keyword in the keyword set from the blockchain ledger;
将获取的关键字集和所述关键字中各个关键字对应值进行组合;Combine the acquired keyword set and the corresponding value of each keyword in the keyword;
将组合结果作为查询结果,返回所述查询结果。The combined result is used as the query result, and the query result is returned.
根据本申请的有一个方面,提供了一种非易失性计算机可读存储介质,其上存储有计算机指令,所述指令被执行时实现如下步骤:According to one aspect of the present application, there is provided a non-volatile computer-readable storage medium, on which computer instructions are stored, and the following steps are implemented when the instructions are executed:
获取查询请求,其中,所述查询请求中携带有目标页的页码;Acquiring a query request, where the query request carries the page number of the target page;
根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;According to the page number of the target page, obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
从所述区块链账本中获取所述关键字集中各个关键字对应的值;Obtaining the value corresponding to each keyword in the keyword set from the blockchain ledger;
将获取的关键字集和所述关键字中各个关键字对应值进行组合;Combine the acquired keyword set and the corresponding value of each keyword in the keyword;
将组合结果作为查询结果,返回所述查询结果。The combined result is used as the query result, and the query result is returned.
本申请获取携带有目标页的页码的查询请求,根据目标页的页码,从区块链账本中获取目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;从所述区块链账本中获取所述关键字集中各个关键字对应的值;将获取的关键字集和所述关键字中各个关键字对应值进行组合;将组合结果作为查询结果,返回所述查询结果。通过上述方式解决了现有的无法按页对区块链账本中的数据进行查询的技术问题,达到了有效实现按页数据查询的目的,从而可以有效提升区块链账本的查询和记账效率。This application obtains the query request carrying the page number of the target page, and obtains the keyword set corresponding to the page number of the target page from the blockchain ledger according to the page number of the target page, where one or more keywords exist in the keyword set Get the value corresponding to each keyword in the keyword set from the blockchain ledger; combine the obtained keyword set and the corresponding value of each keyword in the keyword; use the combined result as the query result and return The query result. Through the above method, the existing technical problem that the data in the blockchain ledger cannot be queried by page is solved, and the purpose of effectively realizing the data query by page is achieved, thereby effectively improving the query and accounting efficiency of the blockchain ledger. .
附图说明Description of the drawings
图1是根据本申请实施例的区块链账本数据的查询方法的方法流程图;Fig. 1 is a method flowchart of a method for querying blockchain ledger data according to an embodiment of the present application;
图2是根据本申请实施例的区块链账本数据的查询系统的结构框图;2 is a structural block diagram of a query system for blockchain ledger data according to an embodiment of the present application;
图3是根据本申请实施例的电子装置的一种可选的硬件架构示意图。Fig. 3 is a schematic diagram of an optional hardware architecture of an electronic device according to an embodiment of the present application.
具体实施方式detailed description
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions, and advantages of this application clearer, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the application, and not used to limit the application. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
考虑到现有的区块链(Fabric)K-V账本记账和查询效率低下的问题,主要是因为区块链(Fabric)K-V账本没有分页记账和查询功能,如果可以调整区块链(Fabric)K-V账本的存储方式,使得区块链(Fabric)K-V账本可以实现数据的分页管理,那么可以有效提升区块链(Fabric)K-V账本记账和查询的效率。Taking into account the low efficiency of accounting and querying of the existing blockchain (Fabric) KV ledger, the main reason is that the blockchain (Fabric) KV ledger does not have page accounting and query functions. If the blockchain (Fabric) can be adjusted The storage method of the KV ledger enables the Blockchain (Fabric) KV ledger to realize the paging management of data, which can effectively improve the efficiency of accounting and query of the Blockchain (Fabric) KV ledger.
为此,在本例中提供了一种区块链账本数据的查询方法方法、电子设备,下面对该方法和电子设备进行具体说明如下:For this reason, in this example, a method and electronic device for querying blockchain ledger data are provided. The method and electronic device are specifically described as follows:
实施例一Example one
下面结合附图对本申请提供的区块链账本数据的查询方法进行说明。The method for querying the blockchain ledger data provided in this application will be described below in conjunction with the accompanying drawings.
图1为本申请区块链账本数据的查询方法的一种可选的流程示意图,如图1所示,该方法可以包括以下步骤:Figure 1 is a schematic diagram of an optional flow chart of the query method for blockchain ledger data of this application. As shown in Figure 1, the method may include the following steps:
步骤101:获取查询请求,其中,所述查询请求中携带有目标页的页码;Step 101: Obtain a query request, where the query request carries the page number of the target page;
步骤102:根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;Step 102: According to the page number of the target page, obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
步骤103:从所述区块链账本中获取所述关键字集中各个关键字对应的值;Step 103: Obtain the value corresponding to each keyword in the keyword set from the blockchain ledger;
步骤104:将获取的关键字集和所述关键字中各个关键字对应值进行组合;Step 104: Combine the acquired keyword set and the corresponding value of each keyword in the keyword;
步骤105:将组合结果作为查询结果,返回所述查询结果。Step 105: Use the combined result as the query result, and return the query result.
具体的,上述区块链账本可以是按照如下方式建立的,从而可以实现区块链账本的分页管理:Specifically, the above-mentioned blockchain ledger can be established as follows, so as to realize the paging management of the blockchain ledger:
S1:获取区块链账本的建立规则,其中,所述建立规则中包括每页的限制条数;S1: Obtain the establishment rules of the blockchain ledger, where the establishment rules include a limit on the number of items per page;
例如,可以设定每页的数据条数上限为10条,那么在第一页已经存入了十条数据之后,再有第十一条数据需要存储的时候,就将第十一条数据作为第二页的第一条数据存储进去。其中,页可以理解为一个虚拟的概念,不是实际对数据库的分区,仅是将数据分为一页一页的数据。For example, you can set the upper limit of the number of data items per page to 10, then after the first page has stored ten pieces of data, when there is another eleventh piece of data to be stored, the eleventh piece of data is taken as the first The first data of the second page is stored in. Among them, the page can be understood as a virtual concept, not the actual partition of the database, but the data divided into one page by one page.
S2:获取一条待写入所述区块链账本的数据,其中,所述一条待写入所述区块链账本的数据包括:关键字和值;S2: Obtain a piece of data to be written into the blockchain ledger, where the piece of data to be written into the blockchain ledger includes: keywords and values;
即,每一条数据可以包括一对K-V值,即,包括一个关键字和该关键字对应的数值,例如:关键字为张三,对应的值为400元。其中,一个关键字也可以对应两个或者多个值,那么这一个关键字和多个值可以作为一个键值对,也就是一条数据存储。That is, each piece of data may include a pair of K-V values, that is, include a keyword and a value corresponding to the keyword, for example, the keyword is Zhang San, and the corresponding value is 400 yuan. Among them, a keyword can also correspond to two or more values, then this keyword and multiple values can be used as a key-value pair, that is, a piece of data storage.
S3:获取所述区块链账本当前已写入数据的页数和当前页已写入的数据条数;S3: Obtain the number of currently written data pages and the number of data written on the current page of the blockchain ledger;
在实际实现的时候,可以在区块链账本中专门划定一个区域或者字段,用于存储当前已被写入的页面,和当前页数已经被写入了几条数据。In actual implementation, an area or field can be specifically delineated in the blockchain ledger to store the pages that have been currently written, and the current number of pages that have been written into several pieces of data.
S4:确定当前页已写入的数据条数是否达到每页的限制条数;S4: Determine whether the number of data items written in the current page reaches the limit number of items per page;
即,在读取当前页数已经被写入了几条数据之后,就可以确定与限制条数进行对比,确定当前页是否已经存满数据。That is, after reading the current page number and several pieces of data have been written, it can be determined to compare with the limit number to determine whether the current page is full of data.
S4:在确定未达到的情况下,将所述一条待写入区块链账本的数据写入当前页;S4: In the case where it is determined that it is not reached, write the piece of data to be written into the blockchain ledger into the current page;
S5:在确定当前页已写入的数据条数达到每页的限制条数的情况下,将当前页的页码加1,作为下一页;S5: When it is determined that the number of data items written on the current page reaches the limit number of items per page, the page number of the current page is increased by 1, as the next page;
S6:在所述区块链账本中记录下一页的页码和下一页中已写入的数据条数,记录所述一条待写入区块链账本的数据的关键字,并将所述一条待写入区块链账本的数据的关键字与所述下一页的页码关联。S6: Record the page number of the next page and the number of data written in the next page in the blockchain ledger, record the key of the data to be written in the blockchain ledger, and add the A key word of data to be written into the blockchain ledger is associated with the page number of the next page.
S7:在所述区块链账本中记录下一页的页码和下一页中已写入的数据条数。S7: Record the page number of the next page and the number of data written in the next page in the blockchain ledger.
举例而言,限制每页条数最多为2条,已存入的数据为<张三,200>待存入的数据为<李四,400>。因此,可以获取metadata值为1,1(其中,metadata表示当前已经存储到哪一页,该页已经存储了几条数据),基于metadata值为1,1可以确定,当前已经存储到了第一页的第一条数据,因1小于2,表明当前第一页还没存满,因此,可以将page1值更新为:<page1,[张三,李四]>,在完成之后,更新metadata值为[1,2];然后,将<李四,400>数据增加到数据库中,实现区块链账本的记账需求。For example, limit the number of entries per page to a maximum of 2, and the stored data is <Zhang San, 200> and the data to be stored is <Li Si, 400>. Therefore, the metadata value can be obtained as 1,1 (where metadata indicates which page has been stored currently, and how many pieces of data have been stored on this page), based on the metadata value 1,1 can be determined, and the first page has been stored currently The first piece of data, because 1 is less than 2, indicating that the current first page is not full, therefore, the value of page1 can be updated to: <page1,[张三,李四]>, after completion, update the metadata value [1,2]; Then, the data of <Li Si, 400> is added to the database to realize the accounting requirements of the blockchain ledger.
基于该分页建立的区块链账本,也就可以进行分页的查询。Based on the blockchain ledger established by this paging, paging query can also be performed.
下面结合一个具体实施例对上述方法进行说明,然而,值得注意的是,该具体实施例仅是为了更好地说明本申请,并不构成对本申请的不当限定。The above method will be described below in conjunction with a specific embodiment. However, it is worth noting that this specific embodiment is only for better describing the application, and does not constitute an improper limitation of the application.
针对区块链账本,可以创建如下内容以实现对区块链账本的有效记账和查询:For the blockchain ledger, the following content can be created to realize effective accounting and query on the blockchain ledger:
1)创建<cpage,<pagenum&datanum>>,通过<cpage,<pagenum&datanum>>存储实际已经存储到的页码和该页码中已经存在的数据条数;1) Create <cpage, <pagenum&datanum>>, and store the actually stored page number and the number of data items in the page number through <cpage, <pagenum&datanum>>;
即,划分一部分字段或者空间用于记录当前存储至的页的页码和当前页已经存储的数据条数。That is, a part of the field or space is divided to record the page number of the page currently stored to and the number of data items already stored on the current page.
2)创建<<pagenum>、<key1>>,<<pagenum>、<key2>>,<<pagenum>、<key3>>…用于存储每个页码对应的数据页中所存储数据的关键字。2) Create <<pagenum>, <key1>>, <<pagenum>, <key2>>, <<pagenum>, <key3>>...Keywords used to store the data stored in the data page corresponding to each page number .
即,划分一部分字段或空间,用于存储每页数据对应的关键字。That is, a part of the field or space is divided to store keywords corresponding to each page of data.
3)创建<<key1>、<data1>>,<<key2>、<data2>>,<<key3>、<data3>>…用于存储关键字对应的实际数据值。3) Create <<key1>, <data1>>, <<key2>, <data2>>, <<key3>, <data3>>... to store the actual data value corresponding to the keyword.
即,设置各个关键字对应的实际数据值。That is, set the actual data value corresponding to each keyword.
基于上述的数据内容存储方式,可以执行如下操作,以实现对区块链账本的记账和查询功能:Based on the above data content storage method, the following operations can be performed to realize the accounting and query functions of the blockchain ledger:
1)新增数据,可以包括如下步骤:1) New data can include the following steps:
S1:读取cpage,以获取当前已经存储到的页码;S1: Read cpage to obtain the currently stored page number;
S2:在当前已经存储到的页码中插入当前数据,完成后datanum+1,如果datanum达到设计时页码最大数据量,那么pagenum+1并且datanum置0,即,对cpage的值进行更新;S2: Insert the current data into the currently stored page number, and datanum+1 after completion. If datanum reaches the maximum data amount of the page number at the design time, then pagenum+1 and datanum is set to 0, that is, the value of cpage is updated;
即,确定当前页中是否已存储至最大数据量,如果没有存储至最大数据量,则存储,如果存储至最大数据量,则存储至下一页。That is, it is determined whether the maximum amount of data has been stored in the current page, if the maximum amount of data has not been stored, then the storage is stored, and if the maximum amount of data is stored, the storage is moved to the next page.
S3:存储当前数据对应的key(关键字)-value(值)数据。S3: Store the key (keyword)-value (value) data corresponding to the current data.
2)查询数据,可以包括如下步骤:2) Query data, which can include the following steps:
S1:从查询请求中获取查询参数,其中,该查询参数为页码号pagenum;S1: Obtain query parameters from the query request, where the query parameter is the page number pagenum;
S2:获取pagenum中的所有key值;S2: Get all the key values in pagenum;
S3:查询pagenum中的所有key值对应的value值,从而得到并返回pagenum页对应的一页的数据。S3: Query the value values corresponding to all the key values in the pagenum, thereby obtaining and returning the data of a page corresponding to the pagenum page.
即,可以通过存储的页码,及页码对应的关键字,完成基于页码的关键字查询操作。That is, the keyword query operation based on the page number can be completed through the stored page number and the keyword corresponding to the page number.
通过上述方式可以支持区块链账本(Fabric)查询时传入页码参数,返回该页的所有数据。Through the above method, it is possible to pass in the page number parameter when querying the blockchain ledger (Fabric), and return all the data of the page.
具体的,对区块链账本中的K-V数据库采用分页设计的方式,对账本上的数据按照功能可以划分为如下表1所示的三个类别:metadata类别、pagenum类别、实际业务数据记录。Specifically, a paging design is adopted for the K-V database in the blockchain ledger, and the data on the ledger can be divided into three categories as shown in Table 1 below according to functions: metadata category, pagenum category, and actual business data records.
表1Table 1
Figure PCTCN2019103764-appb-000001
Figure PCTCN2019103764-appb-000001
Figure PCTCN2019103764-appb-000002
Figure PCTCN2019103764-appb-000002
下面以一个具体实例说明:现张三、李四、王五三人的账户余额,分别有300,400,500元,那么实际的业务数据键值对如下表2所示:Let's take a specific example to illustrate: The account balances of Zhang San, Li Si, and Wang Wu are 300, 400, and 500 yuan respectively. Then the actual business data key-value pairs are shown in Table 2 below:
表2Table 2
K值K value V值V value
张三Zhang San 300300
李四Li Si 400400
王五Wang Wu 500500
假设,每页的数据条数规定为2,那么这三条数据需要存放2页,第一页2条数据,第二页1条数据。假设,当前数据库数据条数为0,页码从1开始,条数从0开始,那么此时,metadata对应的值如下表3所示:Assuming that the number of data items per page is specified as 2, then these three pieces of data need to be stored in 2 pages, 2 pieces of data on the first page, and 1 piece of data on the second page. Assuming that the number of data items in the current database is 0, the page number starts from 1, and the number of items starts from 0, then the corresponding values of metadata are shown in Table 3 below:
表3table 3
K值K value V值V value
metadatametadata 1,01, 0
此时,pagenum属性的K-V值记录均为空。At this time, the K-V value records of the pagenum attribute are all empty.
然后,可以按照如下方式进行操作:Then, you can proceed as follows:
1)新增数据1) New data
增加<张三,300>记录:Add <Zhang San, 300> record:
S1:检查张三记录是否存在,如果存在直接更新,否则继续;S1: Check whether the Zhang San record exists, if it exists, update it directly, otherwise continue;
S2:获取metadata值为1,0;即此时处于第1页,含有0条数据,这是初始状态。S2: Get the metadata value as 1,0; that is, it is on page 1 and contains 0 pieces of data. This is the initial state.
S3:从第一页开始记录数据,此时新增page1,将张三数据放到page1,于是有新增数据<page1,张三>,完成后更新metadata值为[1,1],表示当前页为第一页并且有一条数据存放到第一页;S3: Start recording data from the first page. At this time, page1 is added, and the data of Zhang San is placed on page1, so there is new data <page1, Zhang San>. After completion, the metadata value is updated to [1,1], which means the current Page is the first page and a piece of data is stored on the first page;
S4:将<张三,300>数据增加到数据库,完成后数据库如下表4所示:S4: Add the data of <Zhang San, 300> to the database. After completion, the database is shown in Table 4 below:
表4Table 4
K值K value V值V value
metadatametadata 1,11,1
page1page1 张三Zhang San
张三Zhang San 300300
增加<李四,400>记录:Add <Li Si, 400> record:
S1:检查李四记录是否存在,如果存在直接更新,否则继续;S1: Check whether the Li Si record exists, if it exists, update it directly, otherwise continue;
S2:获取metadata值为1,1,检查此时page1数据条数为1,小于2;S2: Get the metadata value as 1,1, check that the number of data items in page1 at this time is 1, which is less than 2;
S3:追加page1值为,<page1,[张三,李四]>,完成后,更新metadata值为[1,2];S3: Add the value of page1, <page1,[Zhang San, Li Si]>, after completion, update the metadata value to [1,2];
S4:将<李四,400>数据增加到数据库,完成后数据库如下表5所示:S4: Add the data of <Li Si, 400> to the database. After completion, the database is shown in Table 5 below:
表5table 5
K值K value V值 V value
metadatametadata 1,21,2
page1page1 张三,李四Zhang San, Li Si
张三Zhang San 300300
李四Li Si 400400
增加<王五,500>记录:Add <Wang Wu, 500> record:
S1:检查王五记录是否存在,如果存在直接更新,否则继续;S1: Check whether the king five record exists, if it exists, update it directly, otherwise continue;
S2:获取metadata值为1,2,检查此时page1数据条数为2,等于2;S2: Get the metadata value to be 1, and check that the number of data in page1 is 2, which is equal to 2;
S3:新增page2,<page2,王五>,完成后更新metadata值为[2,1]S3: Add page2, <page2, Wang Wu>, update the metadata value after completion to [2,1]
S4:将<王五,500>数据增加到数据库,完成后数据库如下表6所示:S4: Add the data of <王五,500> to the database. After completion, the database is shown in Table 6 below:
表6Table 6
K值K value V值 V value
metadatametadata 2,12,1
page1page1 张三,李四Zhang San, Li Si
page2page2 王五Wang Wu
张三Zhang San 300300
李四Li Si 400400
王五Wang Wu 500500
2)查询数据2) Query data
查询所有页:Query all pages:
S1:获取metadata数据为2,1,可以确定此时数据库中有2页数据;S1: The obtained metadata data is 2, 1, and it can be determined that there are 2 pages of data in the database at this time;
S2:分别获取page1和page2中的key值集,然后,获取key值集对应的value值集;S2: Obtain the key value sets in page1 and page2 respectively, and then obtain the value value set corresponding to the key value set;
S3:组合成page1与page2的数据集返回;S3: The data set combined into page1 and page2 is returned;
S4:获取page1值集为[张三,李四],获取张三值为300,获取李四值为400;S4: Obtain the value set of page1 as [Zhang San, Li Si], obtain the value of Zhang San as 300, and obtain the value of Li Si as 400;
S5:获取page2值集为[王五],获取王五值为500;S5: Obtain the page2 value set as [Wang Wu], and obtain the Wang Wu value as 500;
S6:然后对获取的结果进行组合,可以得到:S6: Then combine the obtained results to get:
Figure PCTCN2019103764-appb-000003
Figure PCTCN2019103764-appb-000003
Figure PCTCN2019103764-appb-000004
Figure PCTCN2019103764-appb-000004
查询某一页数据:(例如:查询第二页的数据,传入参数为2)Query a page of data: (for example: query the data of the second page, the input parameter is 2)
S1:获取page2中的key值集,然后获取key值集对应value值集;S1: Get the key value set in page2, and then get the value value set corresponding to the key value set;
S2:组合成page2的数据集返回;S2: Return the data set combined into page2;
即,获取page2值集为[王五],获取王五值为500。That is, the acquired page2 value set is [王五], and the acquired Wang five value is 500.
S3:组合结果S3: Combined result
Figure PCTCN2019103764-appb-000005
Figure PCTCN2019103764-appb-000005
查询指定K值数据:Query specified K value data:
S1:传入K值(即,要查询的用户名),直接查询该用户名对应的value值,组合成K-V值返回;S1: Pass in the K value (that is, the user name to be queried), directly query the value corresponding to the user name, and combine it into a K-V value to return;
例如:输入李四,查询得到李四的余额为400。For example: Enter Li Si, and the query will get the balance of Li Si as 400.
S2:组合返回:S2: Combination returns:
{{
   李四:400Li Si: 400
}}
在上例中,在区块链账本中存储实际已经存储到的页码和该页码中已经存在的数据条数,以及页码中所包含的所有数据的键值和每个键值对应的数据值,从而实现了基于页码的数据存在,使得区块链账本(Fabric)在查询时,传入页码参数,就可以返回该页的所有数据。通过上述方式解决了现有的区块链账本不支持分页查询而导致的存储和查询效率低下的问题,达到了有效提升区块链账本存储和查询效率的技术效果。In the above example, the actual stored page number and the number of data items already stored in the page number are stored in the blockchain ledger, as well as the key value of all the data contained in the page number and the data value corresponding to each key value. In this way, the existence of data based on page number is realized, so that when the blockchain fabric is inquired, the page number parameter is passed in, and all the data of the page can be returned. Through the above method, the problem of low storage and query efficiency caused by the existing blockchain ledger not supporting paging query is solved, and the technical effect of effectively improving the efficiency of blockchain ledger storage and query is achieved.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。Through the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。
实施例二Example two
基于上述实施例一中提供的区块链账本数据的查询方法,本实施例中提供一种区块链账本数据的查询系统,具体地,图2示出了该区块链账本数据的查询系统的可选的结构框图,该区块链账本数据的查询系统被分割成一个或多个程序模块,一个或者多个程序模块被存储于存储介质中,并由一个或多个处理器所执行,以完成本申请。本申请所称的程序模块是指能够完成特定功能的一系列计算机程序指令段,比程序本身更适合描述区块链账本数据的查询系统在存储介质中的执行过程,以下描述将具体介绍本实施例各程序模块的功能:Based on the blockchain ledger data query method provided in the first embodiment above, this embodiment provides a blockchain ledger data query system. Specifically, Figure 2 shows the blockchain ledger data query system The optional structural block diagram of the blockchain ledger data query system is divided into one or more program modules, one or more program modules are stored in a storage medium and executed by one or more processors, To complete this application. The program module referred to in this application refers to a series of computer program instruction segments that can complete specific functions. It is more suitable than the program itself to describe the execution process of the blockchain ledger data query system in the storage medium. The following description will specifically introduce this implementation Examples of the functions of each program module:
如图2所示,区块链账本数据的查询系统20可以包括:As shown in Figure 2, the blockchain ledger data query system 20 may include:
第一获取模块201,用于获取查询请求,其中,所述查询请求中携带有目标页的页码;The first obtaining module 201 is configured to obtain a query request, wherein the query request carries the page number of the target page;
第二获取模块202,用于根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;The second obtaining module 202 is configured to obtain a keyword set corresponding to the page number of the target page from the blockchain ledger according to the page number of the target page, where one or more keywords exist in the keyword set;
第三获取模块203,用于从所述区块链账本中获取所述关键字集中各个关键字对应的值;The third obtaining module 203 is configured to obtain the value corresponding to each keyword in the keyword set from the blockchain ledger;
组合模块204,用于将获取的关键字集和所述关键字中各个关键字对应值进行组合;The combination module 204 is configured to combine the acquired keyword set and the corresponding value of each keyword in the keyword;
返回模块205,用于将组合结果作为查询结果,返回所述查询结果。The return module 205 is configured to use the combined result as the query result and return the query result.
在一个实施方式中,上述装置还可以包括:建立模块,用于按照如下方式建立所述区块链账本:In an embodiment, the above-mentioned device may further include: an establishment module for establishing the blockchain ledger in the following manner:
S1:获取区块链账本的建立规则,其中,所述建立规则中包括每页的限制条数;S1: Obtain the establishment rules of the blockchain ledger, where the establishment rules include a limit on the number of items per page;
S2:获取一条待写入所述区块链账本的数据,其中,所述一条待写入所述区块链账本的数据包括:关键字和值;S2: Obtain a piece of data to be written into the blockchain ledger, where the piece of data to be written into the blockchain ledger includes: keywords and values;
S3:获取所述区块链账本当前已写入数据的页数和当前页已写入的数据条数;S3: Obtain the number of currently written data pages and the number of data written on the current page of the blockchain ledger;
S4:确定当前页已写入的数据条数是否达到每页的限制条数;S4: Determine whether the number of data items written in the current page reaches the limit number of items per page;
S5:在确定未达到的情况下,将所述一条待写入区块链账本的数据写入当前页;S5: In the case of determining that it is not reached, write the piece of data to be written into the blockchain ledger into the current page;
S6:在所述区块链账本中记录当前页的页码和当前页中已写入的数据条数。S6: Record the page number of the current page and the number of data items written in the current page in the blockchain ledger.
在一个实施方式中,上述建立模块还可以用于在确定当前页已写入的数据条数是否达到每页的限制条数之后,在确定当前页已写入的数据条数达到每页的限制条数的情况下,将当前页的页码加1,作为下一页;将所述一条待写入区块链账本的数据写入下一页;在所述区块链账本中记录下一页的页码和下一页中已写入的数据条数。In an embodiment, the above-mentioned establishment module may also be used to determine whether the number of data items written in the current page reaches the limit number of items per page, and after determining whether the number of data items written in the current page reaches the limit number per page In the case of the number of entries, add 1 to the page number of the current page as the next page; write the piece of data to be written into the blockchain ledger to the next page; record the next page in the blockchain ledger The page number and the number of data written in the next page.
在一个实施方式中,上述建立模块还可以用于在将所述一条待写入区块链账本的数据写入下一页之后,记录所述一条待写入区块链账本的数据的关键字,并将所述一条待写入区块链账本的数据的关键字与所述下一页的页码关联。In one embodiment, the above-mentioned establishment module may also be used to record the keyword of the piece of data to be written into the blockchain ledger after writing the piece of data to be written into the blockchain ledger into the next page , And associate the key of the piece of data to be written into the blockchain ledger with the page number of the next page.
关于上述实施例中的装置,其中各个单元、模块执行操作的具体方式已经在有关该方法的实施例中进行了详细描述,此处将不做详细阐述说明。Regarding the device in the foregoing embodiment, the specific manner in which each unit and module perform operations has been described in detail in the embodiment related to the method, and will not be elaborated here.
在本实施例的各个实施方式中,获取携带有目标页的页码的查询请求,根据目标页的页码,从区块链账本中获取目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;从所述区块链账本中获取所述关键字集中各个关键字对应的值;将获取的关键字集和所述关键字中各个关键字对应值进行组合;将组合结果作为查询结果,返回所述查询结果。通过上述方式解决了现有的无法按页对区块链账本中的数据进行查询的技术问题,达到了有效实现按页数据查询的目的,从而可以有效提升区块链账本的查询和记账效率。In each implementation of this embodiment, the query request carrying the page number of the target page is obtained, and the keyword set corresponding to the page number of the target page is obtained from the blockchain ledger according to the page number of the target page, where the keyword There are one or more keywords in the set; obtain the value corresponding to each keyword in the keyword set from the blockchain ledger; combine the obtained keyword set with the corresponding value of each keyword in the keyword; The combined result is used as the query result, and the query result is returned. Through the above method, the existing technical problem that the data in the blockchain ledger cannot be queried by page is solved, and the purpose of effectively realizing the data query by page is achieved, thereby effectively improving the query and accounting efficiency of the blockchain ledger. .
实施例三Example three
在本申请优选的实施例三中提供一种电子装置。图3是根据本申请电子装置一实施例的硬件架构示意图。本实施例中,电子装置2是一种能够按照事先设定或者存储的指令,自动进行数值计算和/或信息处理的设备。例如,可以是智能手机、平板电脑、笔记本电脑、台式计算机、机架式服务器、刀片式服务器、塔式服务器或机柜式服务器(包括独立的服务器,或者多个服务器所组成的服务器集群)等。如图所示,电子装置2至少包括但不限于:可通过系统总线相互通信连接存储器21、处理器22、网络接口23、以及区块链账本数据的查询系统20。其中:In the third preferred embodiment of the present application, an electronic device is provided. FIG. 3 is a schematic diagram of the hardware architecture of an embodiment of the electronic device according to the present application. In this embodiment, the electronic device 2 is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions. For example, it can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a cabinet server (including an independent server or a server cluster composed of multiple servers). As shown in the figure, the electronic device 2 at least includes, but is not limited to, a memory 21, a processor 22, a network interface 23, and a blockchain ledger data query system 20 that can communicate with each other through a system bus. among them:
存储器21至少包括一种类型的计算机可读存储介质,可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,存储器21可以是电子装置2的内部存储模块,例如该电子装置2的硬盘或内存。在另一些实施例中,存储器21也可以是电子装置2的外部存储设备,例如该电子装置2上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,存储器21还可以既包括电子装置2的内部存储模块也包括其外部存储设备。本实施例中,存储器21通常用于存储安装于电子装置2的操作系统和各类应用软件,例如区块链账本数据的查询系统20的程序代码等。此外,存储器21还可以用于暂时地存储已经输出或者将要输出的各类数据。The memory 21 includes at least one type of computer-readable storage medium. The readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), and static random access memory. (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 21 may be an internal storage module of the electronic device 2, such as a hard disk or a memory of the electronic device 2. In other embodiments, the memory 21 may also be an external storage device of the electronic device 2, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital, SD card, Flash Card, etc. Of course, the memory 21 may also include both an internal storage module of the electronic device 2 and an external storage device thereof. In this embodiment, the memory 21 is generally used to store the operating system and various application software installed in the electronic device 2, for example, the program code of the query system 20 for blockchain ledger data. In addition, the memory 21 can also be used to temporarily store various types of data that have been output or will be output.
处理器22在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器22通常用于控制电子装置2的总体操作,例如执行与电子装置2进行数据交互或者通信相关的控制和处理等。本实施例中,处理器22用于运行存储器21中存储的程序代码或者处理数据,例如运行的区块链账本数 据的查询系统20等。The processor 22 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 22 is generally used to control the overall operation of the electronic device 2, for example, perform data interaction or communication-related control and processing with the electronic device 2. In this embodiment, the processor 22 is used to run the program code or process data stored in the memory 21, such as the running blockchain ledger data query system 20 and so on.
网络接口23可包括无线网络接口或有线网络接口,该网络接口23通常用于在电子装置2与其他电子装置之间建立通信连接。例如,网络接口23用于通过网络将电子装置2与外部终端相连,在电子装置2与外部终端之间的建立数据传输通道和通信连接等。网络可以是企业内部网(Intranet)、互联网(Internet)、全球移动通讯系统(Global System of Mobile communication,GSM)、宽带码分多址(Wideband Code Division Multiple Access,WCDMA)、4G网络、5G网络、蓝牙(Bluetooth)、Wi-Fi等无线或有线网络。The network interface 23 may include a wireless network interface or a wired network interface, and the network interface 23 is generally used to establish a communication connection between the electronic device 2 and other electronic devices. For example, the network interface 23 is used to connect the electronic device 2 with an external terminal through a network, and establish a data transmission channel and a communication connection between the electronic device 2 and the external terminal. The network can be corporate intranet (Intranet), Internet (Internet), Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), 4G network, 5G network, Wireless or wired networks such as Bluetooth and Wi-Fi.
需要指出的是,图3仅示出了具有部件21-23的电子装置,但是应理解的是,并不要求实施所有示出的部件,可以替代的实施更多或者更少的部件。It should be pointed out that FIG. 3 only shows an electronic device with components 21-23, but it should be understood that it is not required to implement all the components shown, and more or fewer components may be implemented instead.
在本实施例中,存储于存储器21中的区块链账本数据的查询系统20还可以被分割为一个或者多个程序模块,一个或者多个程序模块被存储于存储器21中,并由一个或多个处理器(本实施例为处理器22)所执行,以完成本申请。In this embodiment, the query system 20 for blockchain ledger data stored in the memory 21 can also be divided into one or more program modules, one or more program modules are stored in the memory 21, and are composed of one or more program modules. Multiple processors (in this embodiment, the processor 22) are executed to complete the application.
实施例四Example four
本实施例还提供一种非易失性计算机可读存储介质,计算机可读存储介质内存储有区块链账本数据的查询系统,区块链账本数据的查询系统可被至少一个处理器所执行,至少一个处理器执行时实现如下方法的步骤:获取查询请求,其中,查询请求中携带有目标页的页码;根据目标页的页码,从区块链账本中获取目标页的页码对应的关键字集,其中,关键字集中存在一个或多个关键字;从区块链账本中获取关键字集中各个关键字对应的值;将获取的关键字集和关键字中各个关键字对应值进行组合;将组合结果作为查询结果,返回查询结果。This embodiment also provides a non-volatile computer-readable storage medium. The computer-readable storage medium stores a query system for blockchain ledger data. The query system for blockchain ledger data can be executed by at least one processor. , At least one processor implements the steps of the following method when executing: obtaining a query request, where the query request carries the page number of the target page; according to the page number of the target page, the keyword corresponding to the page number of the target page is obtained from the blockchain ledger Set, where one or more keywords exist in the keyword set; obtain the value corresponding to each keyword in the keyword set from the blockchain ledger; combine the obtained keyword set and the corresponding value of each keyword in the keyword; Use the combined result as the query result and return the query result.
本实施例中,计算机可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。在一些实施例中,计算机可读存储介质可以是计算机设备的内部存储单元,例如该计算机设备的硬盘或内存。在另一些实施例中,计算机可读存储介质也可以是计算机设备的外部存储设备,例如该计算机设备上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,计算机可读存储介质还可以既包括计算机设备的内部存储单元也包括其外部存储设备。本实施例中,计算机可读存储介质通常用于存储安装于计算机设备的操作系统和各类应用软件,例如实施例二的客户保障分析系统的程序代码等。此外,计算机可读存储介质还可以用于暂时地存储已经输出或者将要输出的各类数据。In this embodiment, the computer-readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read only memory ( ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the computer-readable storage medium may be an internal storage unit of a computer device, such as a hard disk or memory of the computer device. In some other embodiments, the computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), and a secure digital (Secure Digital) equipped on the computer device. , SD) card, flash card (Flash Card), etc. Of course, the computer-readable storage medium may also include both the internal storage unit and the external storage device of the computer device. In this embodiment, the computer-readable storage medium is generally used to store the operating system and various application software installed in the computer device, such as the program code of the customer assurance analysis system in the second embodiment. In addition, the computer-readable storage medium can also be used to temporarily store various types of data that have been output or will be output.
显然,本领域的技术人员应该明白,上述的本申请实施例的各模块或各步骤可以用通 用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本申请实施例不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the application can be implemented by a general computing device, and they can be concentrated on a single computing device or distributed among multiple computing devices. Optionally, they can be implemented with program codes executable by a computing device, so that they can be stored in a storage device for execution by the computing device, and in some cases, can be different from here The steps shown or described are executed in the order of, or they are respectively fabricated into individual integrated circuit modules, or multiple modules or steps of them are fabricated into a single integrated circuit module to achieve. In this way, the embodiments of the present application are not limited to any specific hardware and software combination.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

  1. 一种区块链账本数据的查询方法,其特征在于,包括如下步骤:A method for querying blockchain ledger data is characterized in that it comprises the following steps:
    获取查询请求,其中,所述查询请求中携带有目标页的页码;Acquiring a query request, where the query request carries the page number of the target page;
    根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;According to the page number of the target page, obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
    从所述区块链账本中获取所述关键字集中各个关键字对应的值;Obtaining the value corresponding to each keyword in the keyword set from the blockchain ledger;
    将获取的关键字集和所述关键字中各个关键字对应值进行组合;Combine the acquired keyword set and the corresponding value of each keyword in the keyword;
    将组合结果作为查询结果,返回所述查询结果。The combined result is used as the query result, and the query result is returned.
  2. 根据权利要求1所述的方法,其特征在于,按照如下方式建立所述区块链账本,包括:The method according to claim 1, wherein the establishment of the blockchain ledger in the following manner includes:
    获取区块链账本的建立规则,其中,所述建立规则中包括每页的限制条数;Obtain the establishment rules of the blockchain ledger, where the establishment rules include a limit on the number of items per page;
    获取一条待写入所述区块链账本的数据,其中,所述一条待写入所述区块链账本的数据包括:关键字和值;Acquiring a piece of data to be written into the blockchain ledger, where the piece of data to be written into the blockchain ledger includes: keywords and values;
    获取所述区块链账本当前已写入数据的页数和当前页已写入的数据条数;Obtaining the number of data pages currently written in the blockchain ledger and the number of data items written in the current page;
    确定当前页已写入的数据条数是否达到每页的限制条数;Determine whether the number of data items written on the current page has reached the limit on each page;
    在确定未达到的情况下,将所述一条待写入区块链账本的数据写入当前页;If it is determined that it is not reached, write the piece of data to be written into the blockchain ledger into the current page;
    在所述区块链账本中记录当前页的页码和当前页中已写入的数据条数。The page number of the current page and the number of data items written in the current page are recorded in the blockchain ledger.
  3. 根据权利要求2所述的方法,其特征在于,在确定当前页已写入的数据条数是否达到每页的限制条数之后,还包括:The method according to claim 2, wherein after determining whether the number of data items written in the current page reaches the limit number of items per page, the method further comprises:
    在确定当前页已写入的数据条数达到每页的限制条数的情况下,将当前页的页码加1,作为下一页;When it is determined that the number of data items written on the current page has reached the limit number of items per page, the page number of the current page is increased by 1, as the next page;
    将所述一条待写入区块链账本的数据写入下一页;Write the piece of data to be written into the blockchain ledger into the next page;
    在所述区块链账本中记录下一页的页码和下一页中已写入的数据条数。The page number of the next page and the number of data items written in the next page are recorded in the blockchain ledger.
  4. 根据权利要求3所述的方法,其特征在于,将所述一条待写入区块链账本的数据写入下一页之后,还包括:The method according to claim 3, wherein after writing the piece of data to be written into the blockchain ledger into the next page, the method further comprises:
    记录所述一条待写入区块链账本的数据的关键字,并将所述一条待写入区块链账本的数据的关键字与所述下一页的页码关联。Record the key of the piece of data to be written into the blockchain ledger, and associate the key of the piece of data to be written into the blockchain ledger with the page number of the next page.
  5. 根据权利要求3所述的方法,其特征在于,在所述区块链账本中记录当前页的页码和当前页中已写入的数据条数,包括:The method according to claim 3, wherein recording the page number of the current page and the number of data items written in the current page in the blockchain ledger includes:
    在所述区块链账本中划分一部分字段或者空间用于记录当前页的页码和当前页中已写入的数据条数。Part of the fields or space is divided in the blockchain ledger to record the page number of the current page and the number of data written in the current page.
  6. 一种电子装置,包括存储器和处理器,其特征在于,所述存储器用于存储可被 所述处理器执行的区块链账本数据的查询系统,所述区块链账本数据的查询系统包括:An electronic device includes a memory and a processor, wherein the memory is used to store a query system for blockchain ledger data that can be executed by the processor, and the blockchain ledger data query system includes:
    第一获取模块,用于获取查询请求,其中,所述查询请求中携带有目标页的页码;The first obtaining module is configured to obtain a query request, wherein the query request carries the page number of the target page;
    第二获取模块,用于根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;The second obtaining module is configured to obtain a keyword set corresponding to the page number of the target page from the blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
    第三获取模块,用于从所述区块链账本中获取所述关键字集中各个关键字对应的值;The third obtaining module is configured to obtain the value corresponding to each keyword in the keyword set from the blockchain ledger;
    组合模块,用于将获取的关键字集和所述关键字中各个关键字对应值进行组合;The combination module is used to combine the acquired keyword set and the corresponding value of each keyword in the keyword;
    返回模块,用于将组合结果作为查询结果,返回所述查询结果。The return module is used to take the combined result as the query result and return the query result.
  7. 根据权利要求6所述的装置,其特征在于,还包括:The device according to claim 6, further comprising:
    建立模块,用于按照如下方式建立所述区块链账本:The establishment module is used to establish the blockchain ledger in the following manner:
    获取区块链账本的建立规则,其中,所述建立规则中包括每页的限制条数;Obtain the establishment rules of the blockchain ledger, where the establishment rules include a limit on the number of items per page;
    获取一条待写入所述区块链账本的数据,其中,所述一条待写入所述区块链账本的数据包括:关键字和值;Acquiring a piece of data to be written into the blockchain ledger, where the piece of data to be written into the blockchain ledger includes: keywords and values;
    获取所述区块链账本当前已写入数据的页数和当前页已写入的数据条数;Obtaining the number of data pages currently written in the blockchain ledger and the number of data items written in the current page;
    确定当前页已写入的数据条数是否达到每页的限制条数;Determine whether the number of data items written on the current page has reached the limit on each page;
    在确定未达到的情况下,将所述一条待写入区块链账本的数据写入当前页;If it is determined that it is not reached, write the piece of data to be written into the blockchain ledger into the current page;
    在所述区块链账本中记录当前页的页码和当前页中已写入的数据条数。The page number of the current page and the number of data items written in the current page are recorded in the blockchain ledger.
  8. 根据权利要求7所述的装置,其特征在于,所述建立模块还用于在确定当前页已写入的数据条数是否达到每页的限制条数之后,在确定当前页已写入的数据条数达到每页的限制条数的情况下,将当前页的页码加1,作为下一页;7. The device according to claim 7, wherein the establishing module is further configured to determine whether the number of data written in the current page reaches the limit of the number of data per page, after determining whether the number of data written in the current page When the number of entries reaches the limit of the number of entries per page, the page number of the current page is increased by 1, as the next page;
    将所述一条待写入区块链账本的数据写入下一页;Write the piece of data to be written into the blockchain ledger into the next page;
    在所述区块链账本中记录下一页的页码和下一页中已写入的数据条数。The page number of the next page and the number of data items written in the next page are recorded in the blockchain ledger.
  9. 根据权利要求8所述的装置,其特征在于,所述建立模块还用于在将所述一条待写入区块链账本的数据写入下一页之后,记录所述一条待写入区块链账本的数据的关键字,并将所述一条待写入区块链账本的数据的关键字与所述下一页的页码关联。The device according to claim 8, wherein the establishment module is further configured to record the piece of data to be written into the block chain after writing the piece of data to be written into the blockchain ledger into the next page The key of the data of the chain ledger, and the key of the piece of data to be written into the blockchain ledger is associated with the page number of the next page.
  10. 根据权利要求7所述的装置,其特征在于,所述建立模块具体用于在所述区块链账本中划分一部分字段或者空间用于记录当前页的页码和当前页中已写入的数据条数。The device according to claim 7, wherein the establishment module is specifically configured to divide a part of fields or spaces in the blockchain ledger for recording the page number of the current page and the data strips written in the current page number.
  11. 一种计算机设备,包括:存储器和处理器,其特征在于,所述处理器用于执行如下步骤:A computer device includes a memory and a processor, wherein the processor is used to execute the following steps:
    获取查询请求,其中,所述查询请求中携带有目标页的页码;Acquiring a query request, where the query request carries the page number of the target page;
    根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;According to the page number of the target page, obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
    从所述区块链账本中获取所述关键字集中各个关键字对应的值;Obtaining the value corresponding to each keyword in the keyword set from the blockchain ledger;
    将获取的关键字集和所述关键字中各个关键字对应值进行组合;Combine the acquired keyword set and the corresponding value of each keyword in the keyword;
    将组合结果作为查询结果,返回所述查询结果。The combined result is used as the query result, and the query result is returned.
  12. 根据权利要求11所述的计算机设备,其特征在于,按照如下方式建立所述区块链账本,包括:The computer device according to claim 11, wherein the establishment of the blockchain ledger in the following manner includes:
    获取区块链账本的建立规则,其中,所述建立规则中包括每页的限制条数;Obtain the establishment rules of the blockchain ledger, where the establishment rules include a limit on the number of items per page;
    获取一条待写入所述区块链账本的数据,其中,所述一条待写入所述区块链账本的数据包括:关键字和值;Acquiring a piece of data to be written into the blockchain ledger, where the piece of data to be written into the blockchain ledger includes: keywords and values;
    获取所述区块链账本当前已写入数据的页数和当前页已写入的数据条数;Obtaining the number of data pages currently written in the blockchain ledger and the number of data items written in the current page;
    确定当前页已写入的数据条数是否达到每页的限制条数;Determine whether the number of data items written on the current page has reached the limit on each page;
    在确定未达到的情况下,将所述一条待写入区块链账本的数据写入当前页;If it is determined that it is not reached, write the piece of data to be written into the blockchain ledger into the current page;
    在所述区块链账本中记录当前页的页码和当前页中已写入的数据条数。The page number of the current page and the number of data items written in the current page are recorded in the blockchain ledger.
  13. 根据权利要求12所述的计算机设备,其特征在于,在确定当前页已写入的数据条数是否达到每页的限制条数之后,还包括:The computer device according to claim 12, wherein after determining whether the number of data pieces written in the current page reaches the limit number of pieces per page, the method further comprises:
    在确定当前页已写入的数据条数达到每页的限制条数的情况下,将当前页的页码加1,作为下一页;When it is determined that the number of data items written on the current page has reached the limit number of items per page, the page number of the current page is increased by 1, as the next page;
    将所述一条待写入区块链账本的数据写入下一页;Write the piece of data to be written into the blockchain ledger into the next page;
    在所述区块链账本中记录下一页的页码和下一页中已写入的数据条数。The page number of the next page and the number of data items written in the next page are recorded in the blockchain ledger.
  14. 根据权利要求13所述的计算机设备,其特征在于,将所述一条待写入区块链账本的数据写入下一页之后,还包括:The computer device according to claim 13, wherein after the piece of data to be written into the blockchain ledger is written into the next page, it further comprises:
    记录所述一条待写入区块链账本的数据的关键字,并将所述一条待写入区块链账本的数据的关键字与所述下一页的页码关联。Record the key of the piece of data to be written into the blockchain ledger, and associate the key of the piece of data to be written into the blockchain ledger with the page number of the next page.
  15. 根据权利要求13所述的计算机设备,其特征在于,在所述区块链账本中记录当前页的页码和当前页中已写入的数据条数,包括:The computer device according to claim 13, wherein recording the page number of the current page and the number of data items written in the current page in the blockchain ledger includes:
    在所述区块链账本中划分一部分字段或者空间用于记录当前页的页码和当前页中已写入的数据条数。Part of the fields or space is divided in the blockchain ledger to record the page number of the current page and the number of data written in the current page.
  16. 一种非易失性计算机可读存储介质,其上存储有计算机指令,其特征在于,所述指令被执行时实现如下方法的步骤:A non-volatile computer-readable storage medium having computer instructions stored thereon, characterized in that, when the instructions are executed, the steps of the following method are implemented:
    获取查询请求,其中,所述查询请求中携带有目标页的页码;Acquiring a query request, where the query request carries the page number of the target page;
    根据所述目标页的页码,从区块链账本中获取所述目标页的页码对应的关键字集,其中,所述关键字集中存在一个或多个关键字;According to the page number of the target page, obtain a keyword set corresponding to the page number of the target page from the blockchain ledger, where one or more keywords exist in the keyword set;
    从所述区块链账本中获取所述关键字集中各个关键字对应的值;Obtaining the value corresponding to each keyword in the keyword set from the blockchain ledger;
    将获取的关键字集和所述关键字中各个关键字对应值进行组合;Combine the acquired keyword set and the corresponding value of each keyword in the keyword;
    将组合结果作为查询结果,返回所述查询结果。The combined result is used as the query result, and the query result is returned.
  17. 根据权利要求16所述的非易失性计算机可读存储介质,其特征在于,按照如下方式建立所述区块链账本,包括:The non-volatile computer-readable storage medium according to claim 16, wherein the establishment of the blockchain ledger in the following manner includes:
    获取区块链账本的建立规则,其中,所述建立规则中包括每页的限制条数;Obtain the establishment rules of the blockchain ledger, where the establishment rules include a limit on the number of items per page;
    获取一条待写入所述区块链账本的数据,其中,所述一条待写入所述区块链账本的数据包括:关键字和值;Acquiring a piece of data to be written into the blockchain ledger, where the piece of data to be written into the blockchain ledger includes: keywords and values;
    获取所述区块链账本当前已写入数据的页数和当前页已写入的数据条数;Obtaining the number of data pages currently written in the blockchain ledger and the number of data items written in the current page;
    确定当前页已写入的数据条数是否达到每页的限制条数;Determine whether the number of data items written on the current page has reached the limit on each page;
    在确定未达到的情况下,将所述一条待写入区块链账本的数据写入当前页;If it is determined that it is not reached, write the piece of data to be written into the blockchain ledger into the current page;
    在所述区块链账本中记录当前页的页码和当前页中已写入的数据条数。The page number of the current page and the number of data items written in the current page are recorded in the blockchain ledger.
  18. 根据权利要求17所述的非易失性计算机可读存储介质,其特征在于,在确定当前页已写入的数据条数是否达到每页的限制条数之后,还包括:The non-volatile computer-readable storage medium according to claim 17, wherein after determining whether the number of data items written in the current page reaches the limit number of items per page, the method further comprises:
    在确定当前页已写入的数据条数达到每页的限制条数的情况下,将当前页的页码加1,作为下一页;When it is determined that the number of data items written on the current page has reached the limit number of items per page, the page number of the current page is increased by 1, as the next page;
    将所述一条待写入区块链账本的数据写入下一页;Write the piece of data to be written into the blockchain ledger into the next page;
    在所述区块链账本中记录下一页的页码和下一页中已写入的数据条数。The page number of the next page and the number of data items written in the next page are recorded in the blockchain ledger.
  19. 根据权利要求18所述的非易失性计算机可读存储介质,其特征在于,将所述一条待写入区块链账本的数据写入下一页之后,还包括:The non-volatile computer-readable storage medium according to claim 18, wherein after writing the piece of data to be written into the blockchain ledger into the next page, the method further comprises:
    记录所述一条待写入区块链账本的数据的关键字,并将所述一条待写入区块链账本的数据的关键字与所述下一页的页码关联。Record the key of the piece of data to be written into the blockchain ledger, and associate the key of the piece of data to be written into the blockchain ledger with the page number of the next page.
  20. 根据权利要求18所述的非易失性计算机可读存储介质,其特征在于,在所述区块链账本中记录当前页的页码和当前页中已写入的数据条数,包括:The non-volatile computer-readable storage medium of claim 18, wherein recording the page number of the current page and the number of data items written in the current page in the blockchain ledger includes:
    在所述区块链账本中划分一部分字段或者空间用于记录当前页的页码和当前页中已写入的数据条数。Part of the fields or space is divided in the blockchain ledger to record the page number of the current page and the number of data written in the current page.
PCT/CN2019/103764 2019-04-17 2019-08-30 Blockchain account book data query method, electronic apparatus and storage medium WO2020211258A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910308012.3A CN110162540B (en) 2019-04-17 2019-04-17 Block chain account book data query method, electronic device and storage medium
CN201910308012.3 2019-04-17

Publications (1)

Publication Number Publication Date
WO2020211258A1 true WO2020211258A1 (en) 2020-10-22

Family

ID=67639417

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/103764 WO2020211258A1 (en) 2019-04-17 2019-08-30 Blockchain account book data query method, electronic apparatus and storage medium

Country Status (2)

Country Link
CN (1) CN110162540B (en)
WO (1) WO2020211258A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11210404B2 (en) * 2019-06-14 2021-12-28 Netiq Corporation Blockchain-based state verifications of software component vulnerability database for software products

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110162540B (en) * 2019-04-17 2023-06-06 平安科技(深圳)有限公司 Block chain account book data query method, electronic device and storage medium
CN110618972A (en) * 2019-08-26 2019-12-27 达疆网络科技(上海)有限公司 Method for improving deep paging by using self-increasing Id

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160342977A1 (en) * 2015-05-20 2016-11-24 Vennd.io Pty Ltd Device, method and system for virtual asset transactions
CN107247773A (en) * 2017-06-07 2017-10-13 北京邮电大学 A kind of method that inquiry is traded in distributed data base based on block chain
CN107729371A (en) * 2017-09-12 2018-02-23 深圳先进技术研究院 The data directory and querying method of block chain, device, equipment and storage medium
CN108897758A (en) * 2018-05-15 2018-11-27 深圳市网心科技有限公司 A kind of block chain Transaction Inquiries method, apparatus, system and storage medium
CN110162540A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Querying method, electronic device and the storage medium of block chain account book data

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107463655A (en) * 2017-07-27 2017-12-12 无锡雅座在线科技股份有限公司 Inquire about the methods, devices and systems of data
CN109241361A (en) * 2018-08-31 2019-01-18 上海雄九投资控股(集团)有限公司 Data processing method based on block chain
CN109286676B (en) * 2018-10-15 2021-06-11 国网上海市电力公司 Electric power data safety information system based on block chain
CN109522314B (en) * 2018-10-16 2023-04-14 平安科技(深圳)有限公司 Block chain-based data archiving method and terminal equipment
CN109542979B (en) * 2018-11-19 2023-08-22 北京市密网信息科技有限公司 Fast synchronization and simple data storage mode of block chain system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160342977A1 (en) * 2015-05-20 2016-11-24 Vennd.io Pty Ltd Device, method and system for virtual asset transactions
CN107247773A (en) * 2017-06-07 2017-10-13 北京邮电大学 A kind of method that inquiry is traded in distributed data base based on block chain
CN107729371A (en) * 2017-09-12 2018-02-23 深圳先进技术研究院 The data directory and querying method of block chain, device, equipment and storage medium
CN108897758A (en) * 2018-05-15 2018-11-27 深圳市网心科技有限公司 A kind of block chain Transaction Inquiries method, apparatus, system and storage medium
CN110162540A (en) * 2019-04-17 2019-08-23 平安科技(深圳)有限公司 Querying method, electronic device and the storage medium of block chain account book data

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11210404B2 (en) * 2019-06-14 2021-12-28 Netiq Corporation Blockchain-based state verifications of software component vulnerability database for software products

Also Published As

Publication number Publication date
CN110162540B (en) 2023-06-06
CN110162540A (en) 2019-08-23

Similar Documents

Publication Publication Date Title
CN110321344B (en) Information query method and device for associated data, computer equipment and storage medium
WO2020211258A1 (en) Blockchain account book data query method, electronic apparatus and storage medium
US10296508B2 (en) Systems and methods to manage online analytical and transactional processing for an in-memory columnar database
WO2019076062A1 (en) Function page customization method and application server
US9875272B1 (en) Method and system for designing a database system for high event rate, while maintaining predictable query performance
WO2019019769A1 (en) Service function implementation method, device, computer apparatus and storage medium
KR20100115818A (en) Dynamic formulas for spreadsheet cells
US20200257675A1 (en) Method, apparatus, and system for evaluating a partition in a database
WO2015074477A1 (en) Path analysis method and apparatus
WO2019085463A1 (en) Department demand recommendation method, application server, and computer-readable storage medium
WO2017161540A1 (en) Data query method, data object storage method and data system
US11907251B2 (en) Method and system for implementing distributed lobs
CN111177113B (en) Data migration method, device, computer equipment and storage medium
CN106484699B (en) Method and device for generating database query field
WO2023124217A1 (en) Method and device for acquiring comprehensively sorted data of multi-column data
CA3149710A1 (en) Data collecting method, device, computer equipment and storage medium
WO2019071968A1 (en) Salary calculation method, application server, and computer readable storage medium
CN112434015B (en) Data storage method and device, electronic equipment and medium
CN114020790A (en) Data query method and device
US9454557B2 (en) Unit of work based incremental data processing
CN108763341B (en) Electronic device, automatic table building method and storage medium
CN106326295B (en) Semantic data storage method and device
CN111666302A (en) User ranking query method, device, equipment and storage medium
CN112632266B (en) Data writing method and device, computer equipment and readable storage medium
CN111259201B (en) Data maintenance method and system

Legal Events

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

Ref document number: 19924963

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19924963

Country of ref document: EP

Kind code of ref document: A1