CN110162540B - Block chain account book data query method, electronic device and storage medium - Google Patents

Block chain account book data query method, electronic device and storage medium Download PDF

Info

Publication number
CN110162540B
CN110162540B CN201910308012.3A CN201910308012A CN110162540B CN 110162540 B CN110162540 B CN 110162540B CN 201910308012 A CN201910308012 A CN 201910308012A CN 110162540 B CN110162540 B CN 110162540B
Authority
CN
China
Prior art keywords
page
data
written
blockchain ledger
current
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.)
Active
Application number
CN201910308012.3A
Other languages
Chinese (zh)
Other versions
CN110162540A (en
Inventor
汪昌帅
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910308012.3A priority Critical patent/CN110162540B/en
Publication of CN110162540A publication Critical patent/CN110162540A/en
Priority to PCT/CN2019/103764 priority patent/WO2020211258A1/en
Application granted granted Critical
Publication of CN110162540B publication Critical patent/CN110162540B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Abstract

The invention discloses a query method of blockchain ledger data, an electronic device and a storage medium, wherein the method comprises the following steps: acquiring a query request, wherein the query request carries the page number of a target page; acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set; acquiring the corresponding value of each keyword in the keyword set from the blockchain account book; combining the obtained keyword set with the corresponding values of the keywords in the keywords; and taking the combined result as a query result, and returning the query result. By the method, the technical problem that the existing data in the blockchain ledger cannot be queried according to pages is solved, the purpose of effectively achieving page-based data query is achieved, and accordingly query and accounting efficiency of the blockchain ledger can be effectively improved.

Description

Block chain account book data query method, electronic device and storage medium
Technical Field
The invention relates to the technical field of databases, in particular to a block chain ledger data query method, an electronic device and a storage medium.
Background
With the continuous development of the blockchain technology, more and more people begin to research the blockchain technology, and the application of the blockchain technology is also wider and wider. For blockchains, the blockchain (Fabric) K-V ledger is an important component in blockchain technology.
For the processing efficiency of the accounting and query function operation of the blockchain ledger, the efficiency and the service condition of the blockchain system are directly affected, however, the existing blockchain ledger does not support the page-by-page query mode, so that the accounting and query efficiency of the blockchain ledger is greatly affected.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The invention aims to provide a block chain account book data query method, an electronic device and a storage medium, so as to solve the technical problems of low query and billing efficiency caused by incapability of carrying out query according to pages in the prior art.
The invention solves the technical problems by the following technical scheme:
according to one aspect of the present invention, there is provided a blockchain ledger data query method including the steps of:
acquiring a query request, wherein the query request carries the page number of a target page;
acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
acquiring the corresponding value of each keyword in the keyword set from the blockchain account book;
combining the obtained keyword set with the corresponding values of the keywords in the keywords;
and taking the combined result as a query result, and returning the query result.
In one embodiment, the blockchain ledger is established as follows, including:
acquiring an establishment rule of a blockchain ledger, wherein the establishment rule comprises limiting strips of each page;
obtaining data to be written into the blockchain ledger, wherein the data to be written into the blockchain ledger comprises: keywords and values;
acquiring the number of pages of the current written data of the blockchain ledger and the number of the written data of the current page;
determining whether the number of written data of the current page reaches the limit number of each page;
if the data to be written into the blockchain ledger is not reached, writing the data to be written into the current page;
and recording the page number of the current page and the written data number in the current page in the blockchain ledger.
In one embodiment, after determining whether the number of data stripes written to the current page reaches the limit number per page, the method further comprises:
under the condition that the written data number of the current page reaches the limit number of each page, adding 1 to the page number of the current page to serve as the next current page;
writing the data to be written into the blockchain ledger into the next current page;
and recording the page number of the current page of the next page and the number of the written data in the next current page in the blockchain ledger.
In one embodiment, after writing the data to be written into the blockchain ledger into the next current page, the method further includes:
recording the key words of the data to be written into the blockchain ledger, associating the key words of the data to be written into the blockchain ledger with the page number of the next page, and recording the key words of the data to be written into the blockchain ledger after the page number of the current page.
According to another aspect of the present invention, there is provided an electronic device including a memory and a processor, the memory for storing a query system of blockchain ledger data executable by the processor, the query system of blockchain ledger data comprising:
the first acquisition module is used for acquiring a query request, wherein the query request carries the page number of a target page;
the second acquisition module is used for acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
the third acquisition module is used for acquiring the corresponding value of each keyword in the keyword set from the blockchain ledger;
the combination module is used for combining the acquired keyword set with the corresponding values of the keywords in the keywords;
and the returning module is used for taking the combined result as a query result and returning the query result.
In one embodiment, the apparatus further comprises:
the building module is used for building the blockchain ledger according to the following mode:
acquiring an establishment rule of a blockchain ledger, wherein the establishment rule comprises limiting strips of each page;
obtaining data to be written into the blockchain ledger, wherein the data to be written into the blockchain ledger comprises: keywords and values;
acquiring the number of pages of the current written data of the blockchain ledger and the number of the written data of the current page;
determining whether the number of written data of the current page reaches the limit number of each page;
if the data to be written into the blockchain ledger is not reached, writing the data to be written into the current page;
and recording the page number of the current page and the written data number in the current page in the blockchain ledger.
In one embodiment, the establishing module is further configured to, after determining whether the number of data stripes written in the current page reaches the limit number of each page, add 1 to the page number of the current page as the next current page if it is determined that the number of data stripes written in the current page reaches the limit number of each page;
writing the data to be written into the blockchain ledger into the next current page;
and recording the page number of the next current page and the written data number in the next current page in the blockchain ledger.
In one embodiment, the building module is further configured to record a keyword of the data to be written in the blockchain ledger after writing the data to be written in the blockchain ledger in the next current page, and associate the keyword of the data to be written in the blockchain ledger with the page number of the next page to record the keyword of the data to be written in the blockchain ledger in the current page after the page number of the current page.
According to yet another aspect of the present invention, there is provided a computer apparatus comprising: a memory and a processor, wherein the processor is configured to perform the steps of:
acquiring a query request, wherein the query request carries the page number of a target page;
acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
acquiring the corresponding value of each keyword in the keyword set from the blockchain account book;
combining the obtained keyword set with the corresponding values of the keywords in the keywords;
and taking the combined result as a query result, and returning the query result.
According to one aspect of the present invention, there is provided a non-transitory computer readable storage medium having stored thereon computer instructions which, when executed, implement the steps of:
acquiring a query request, wherein the query request carries the page number of a target page;
acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
acquiring the corresponding value of each keyword in the keyword set from the blockchain account book;
combining the obtained keyword set with the corresponding values of the keywords in the keywords;
and taking the combined result as a query result, and returning the query result.
The invention has the positive progress effects that: acquiring a query request carrying the page number of a target page, and acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set; acquiring the corresponding value of each keyword in the keyword set from the blockchain account book; combining the obtained keyword set with the corresponding values of the keywords in the keywords; and taking the combined result as a query result, and returning the query result. By the method, the technical problem that the existing data in the blockchain ledger cannot be queried according to pages is solved, the purpose of effectively achieving page-based data query is achieved, and accordingly query and accounting efficiency of the blockchain ledger can be effectively improved.
Drawings
FIG. 1 is a method flow diagram of a method of querying blockchain ledger data in accordance with an embodiment of the invention;
FIG. 2 is a block diagram of a system for querying blockchain ledger data in accordance with an embodiment of the invention;
fig. 3 is a schematic diagram of an alternative hardware architecture of an electronic device according to an embodiment of the invention.
Detailed Description
The present invention will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present invention more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Considering the problem of low billing and query efficiency of the existing blockchain (Fabric) K-V ledger, mainly because the blockchain (Fabric) K-V ledger has no paging billing and query function, if the storage mode of the blockchain (Fabric) K-V ledger can be adjusted, the blockchain (Fabric) K-V ledger can realize paging management of data, and the billing and query efficiency of the blockchain (Fabric) K-V ledger can be effectively improved.
Therefore, in this embodiment, a method for querying blockchain ledger data and an electronic device are provided, and the method and the electronic device are specifically described as follows:
example 1
The method for inquiring the blockchain ledger data provided by the invention is described below with reference to the accompanying drawings.
FIG. 1 is a schematic flow chart of an alternative method for querying blockchain ledger data according to the present invention, as shown in FIG. 1, the method may include the following steps:
step 101: acquiring a query request, wherein the query request carries the page number of a target page;
step 102: acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
step 103: acquiring the corresponding value of each keyword in the keyword set from the blockchain account book;
step 104: combining the obtained keyword set with the corresponding values of the keywords in the keywords;
step 105: and taking the combined result as a query result, and returning the query result.
Specifically, the blockchain ledger may be established as follows, so that paging management of the blockchain ledger may be implemented:
s1: acquiring an establishment rule of a blockchain ledger, wherein the establishment rule comprises limiting strips of each page;
for example, the upper limit of the number of data pieces per page may be set to 10, and then, after ten pieces of data have been stored in the first page, when there is an eleventh piece of data to be stored, the eleventh piece of data is stored as the first piece of data of the second page. Pages are understood to be virtual concepts, not actually partitioning the database, but simply dividing the data into pages.
S2: obtaining data to be written into the blockchain ledger, wherein the data to be written into the blockchain ledger comprises: keywords and values;
that is, each piece of data may include a pair of K-V values, i.e., a key and a value corresponding to the key, such as: the key word is Zhang three, and the corresponding value is 400 yuan. Where a key may also correspond to two or more values, the key and values may be stored as a key-value pair, i.e., a piece of data.
S3: acquiring the number of pages of the current written data of the blockchain ledger and the number of the written data of the current page;
in actual implementation, an area or field may be specifically defined in the blockchain ledger for storing pages that have been written currently, and the number of pages that have been written several pieces of data.
S4: determining whether the number of written data of the current page reaches the limit number of each page;
that is, after reading that the current page number has been written with several pieces of data, it can be determined whether the current page has been full of data, compared with the limit number.
S4: if the data to be written into the blockchain ledger is not reached, writing the data to be written into the current page;
s5: under the condition that the written data number of the current page reaches the limit number of each page, adding 1 to the page number of the current page to serve as the next page;
s6: recording the page number of the next page and the number of the data written in the next page in the blockchain ledger, recording the key word of the data to be written in the blockchain ledger, and associating the key word of the data to be written in the blockchain ledger with the page number of the next page.
S7: and recording the page number of the next page and the written data number in the next page in the blockchain ledger.
For example, the number of the data to be stored is < Zhang San, 200> and the data to be stored is < Lifour, 400>, and the number of the data to be stored is limited to 2 at most. Therefore, a metadata value of 1,1 (where metadata indicates which page has been currently stored, and several pieces of data have been stored) can be acquired, and it can be determined based on the metadata value of 1,1 that the first piece of data of the first page has been currently stored, because 1 is smaller than 2, indicating that the first page is not yet full, and therefore, the page1 value can be updated as: < page1, [ Zhang San, lifour ] >, after completion, update metadata value to [1,2]; the < Lifour, 400> data is then added to the database to fulfill the billing requirements of the blockchain ledger.
Based on the block chain account book established by the paging, the paging inquiry can be performed.
The above method is described below in connection with a specific embodiment, however, it should be noted that this specific embodiment is only for better illustrating the present application and is not meant to be a undue limitation on the present application.
As described below in connection with one particular example, for a blockchain ledger, the following may be created to enable efficient billing and querying of the blockchain ledger:
1) Creating < cgage, < tagene & datnum > >, and storing the page number which has been actually stored and the number of data pieces which are already present in the page number through < cgage, < tagene & datnum > >;
that is, a part of the field or space is divided for recording the page number of the page currently stored to and the number of data pieces already stored in the current page.
2) Creating keywords of data stored in the data pages corresponding to each page number, wherein the keywords are < < page >, < key1> >, < < page >, < key2> >, < < page >, < key3> > ….
That is, a portion of the field or space is divided for storing the key corresponding to each page of data.
3) Creating < < key1>, < data1>, < key2>, < data2>, < key3>, < data3> > … for storing the actual data value corresponding to the key.
That is, the actual data value corresponding to each keyword is set.
Based on the above data content storage manner, the following operations may be performed to implement accounting and query functions for the blockchain ledger:
1) The newly added data can comprise the following steps:
s1: reading a cPage to acquire a page number which is already stored currently;
s2: inserting current data into the currently stored page number, completing datnum+1, if the datnum reaches the maximum data size of the page number in design, then tagenum+1 and datnum is set to 0, namely updating the value of the cPage;
that is, it is determined whether the maximum amount of data has been stored in the current page, if not, then stored, and if so, then stored to the next page.
S3: and storing key (key) value data corresponding to the current data.
2) Querying data may include the steps of:
s1: acquiring a query parameter from a query request, wherein the query parameter is a page number pagenum;
s2: acquiring all key values in tagenum;
s3: and inquiring the value values corresponding to all key values in the pagnum, thereby obtaining and returning the data of the page corresponding to the pagnum page.
Namely, 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.
By the method, the page number parameter can be input when the block chain account book (Fabric) is queried, and all data of the page can be returned.
Specifically, the K-V database in the blockchain ledger is paged, and the data on the ledger can be divided into three categories as shown in the following table 1 according to functions: metadata category, tagenum category, actual business data record.
TABLE 1
Figure BDA0002030486810000081
The following is a specific example: the account balance of three people of the third, the fourth and the fifth, there are 300, 400, 500 yuan, then the actual service data key pairs are shown in table 2 below:
TABLE 2
K value V value
Zhang San 300
Li Si 400
Wang Wu 500
Assuming that the number of pieces of data per page is specified as 2, these three pieces of data need to be stored in 2 pages, the first page of 2 pieces of data, and the second page of 1 piece of data. Assuming that the number of pieces of database data is 0, the page number starts from 1, and the number of pieces starts from 0, then at this time, the value corresponding to metadata is as shown in table 3 below:
TABLE 3 Table 3
K value V value
metadata 1,0
At this time, the K-V value records of the pagnum attribute are all empty.
The operation may then be as follows:
1) Newly added data
Increment < three, 300> record:
s1: checking whether the Zhang Sanrecorded exists or not, if so, directly updating, otherwise, continuing;
s2: obtaining metadata value as 1,0; i.e., at page1 at this time, contains 0 pieces of data, which is the initial state.
S3: recording data from a first page, adding page1, putting page1 with data of three pieces, adding data < page1, page three > with data of three pieces, updating metadata value to 1,1 after finishing, indicating that the current page is the first page and storing one piece of data into the first page;
s4: the < three, 300> data was added to the database, which is shown in table 4 below after completion:
TABLE 4 Table 4
K value V value
metadata 1,1
page1 Zhang San
Zhang San 300
Increment < Lifour, 400> record:
s1: checking whether the Li four records exist or not, if so, directly updating, otherwise, continuing;
s2: acquiring metadata value as 1 and 1, and checking that the number of page1 data stripes is 1 and less than 2 at the moment;
s3: the value of additional page1 is < page1, [ Zhang three, lifour ] >, and after completion, the value of metadata is updated to be [1,2];
s4: the < Lifour, 400> data is added to the database, which is shown in Table 5 below after completion:
TABLE 5
K value V value
metadata
1,2
page1 Zhang san, lisi
Zhang San 300
Li Si 400
Increment < wang five, 500> record:
s1: checking whether the king record exists or not, if so, directly updating, otherwise, continuing;
s2: acquiring metadata values of 1 and 2, and checking that the number of page1 data stripes is 2 and equal to 2 at the moment;
s3: newly added page2, < page2, wangwu >, after finishing, updating metadata value to be [2,1]
S4: the < wang, 500> data was added to the database, which is shown in table 6 below after completion:
TABLE 6
K value V value
metadata
2,1
page1 Zhang san, lisi
page2 Wang Wu
Zhang San 300
Li Si 400
Wang Wu 500
2) Querying data
Querying all pages:
s1: acquiring metadata data as 2,1, and determining that 2 pages of data exist in the database at the moment;
s2: respectively acquiring key value sets in the page1 and the page2, and then acquiring value sets corresponding to the key value sets;
s3: the data sets combined into page1 and page2 are returned;
s4: acquiring a page1 value set as [ Zhang San, liqu ], acquiring Zhang Sanvalue as 300 and acquiring Liqu 400;
s5: acquiring a page2 value set as [ Wangwu ], and acquiring a Wangwu value as 500;
s6: and then combining the obtained results to obtain the following steps:
{
page1:[
{ Zhang San: 300},
{ Lifour:400 }
],
page2:[
{ Wangwu:500 }
]
}
Querying a page of data: (e.g., query the second page for data with an incoming parameter of 2)
S1: acquiring a key value set in the page2, and then acquiring a value set corresponding to the key value set;
s2: the data sets combined into page2 are returned;
that is, the acquired page2 value set is [ wang wu ], and the acquired wang wu value is 500.
S3: combining the results
{
page2:[
{ Wangwu:500 }
]
}
Query-specific K-value data:
s1: directly inquiring a value corresponding to the user name by introducing a K value (namely the user name to be inquired) to form a K-V value and returning the K-V value;
for example: and inputting the Li IV, and inquiring to obtain the balance of the Li IV as 400.
S2: and (3) combination return:
{
lifour 400
}
In the above example, the page number which has been actually stored and the number of data pieces which already exist in the page number are stored in the blockchain ledger, and the key value of all the data contained in the page number and the data value corresponding to each key value are stored, so that the existence of the data based on the page number is realized, and when the blockchain ledger (Fabric) is queried, the parameters of the page number are input, so that all the data of the page can be returned. By the method, the problem of low storage and query efficiency caused by the fact that the existing blockchain ledger does not support paging query is solved, and the technical effect of effectively improving the storage and query efficiency of the blockchain ledger is achieved.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment.
Example two
Based on the method for querying blockchain ledger data provided in the first embodiment, an exemplary system for querying blockchain ledger data is provided, specifically, fig. 2 shows an optional block diagram of the system for querying blockchain ledger data, where the system for querying blockchain ledger data is divided into one or more program modules, and the one or more program modules are stored in a storage medium and executed by one or more processors to complete the present invention. Program modules in the present invention refer to a series of computer program instruction segments capable of performing specific functions, and are more suitable for describing the execution process of a query system for blockchain ledger data in a storage medium than the program itself, and the following description will specifically describe the functions of each program module in this embodiment:
as shown in fig. 2, the query system 20 of blockchain ledger data may include:
a first obtaining module 201, configured to obtain a query request, where the query request carries a page number of a target page;
a second obtaining module 202, configured to obtain, from a blockchain ledger, a keyword set corresponding to a page number of the target page according to the page number of the target page, where one or more keywords exist in the keyword set;
a third obtaining module 203, configured to obtain values corresponding to each keyword in the keyword set from the blockchain ledger;
a combination module 204, configured to combine the obtained keyword set with corresponding values of each keyword in the keywords;
and the returning module 205 is configured to return the combined result as a query result.
In one embodiment, the apparatus may further include: the building module is used for building the blockchain ledger according to the following mode:
s1: acquiring an establishment rule of a blockchain ledger, wherein the establishment rule comprises limiting strips of each page;
s2: obtaining data to be written into the blockchain ledger, wherein the data to be written into the blockchain ledger comprises: keywords and values;
s3: acquiring the number of pages of the current written data of the blockchain ledger and the number of the written data of the current page;
s4: determining whether the number of written data of the current page reaches the limit number of each page;
s5: if the data to be written into the blockchain ledger is not reached, writing the data to be written into the current page;
s6: and recording the page number of the current page and the written data number in the current page in the blockchain ledger.
In one embodiment, the establishing module may be further configured to add 1 to the page number of the current page as the next page after determining whether the number of data pieces written in the current page reaches the limit number of each page; writing the data to be written into the blockchain ledger into the next page; and recording the page number of the next page and the written data number in the next page in the blockchain ledger.
In one embodiment, the establishing module may be further configured to record a keyword of the data of the one blockchain ledger to be written after the data of the one blockchain ledger to be written is written to the next page, and associate the keyword of the data of the one blockchain ledger to be written with a page number of the next page.
The specific manner in which the respective units and modules perform the operations in the apparatus of the above embodiments has been described in detail in the embodiments related to the method, and will not be described in detail here.
In each implementation manner of the embodiment, a query request carrying a page number of a target page is obtained, and a keyword set corresponding to the page number of the target page is obtained from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set; acquiring the corresponding value of each keyword in the keyword set from the blockchain account book; combining the obtained keyword set with the corresponding values of the keywords in the keywords; and taking the combined result as a query result, and returning the query result. By the method, the technical problem that the existing data in the blockchain ledger cannot be queried according to pages is solved, the purpose of effectively achieving page-based data query is achieved, and accordingly query and accounting efficiency of the blockchain ledger can be effectively improved.
Example III
In a third preferred embodiment of the present invention, an electronic device is provided. Fig. 3 is a schematic diagram of a hardware architecture of an electronic device according to an embodiment of the invention. In the present embodiment, the electronic apparatus 2 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a preset or stored instruction. For example, it may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including a stand-alone server or a server cluster composed of a plurality of servers), etc. As shown, the electronic device 2 includes at least, but is not limited to: memory 21, processor 22, network interface 23, and blockchain ledger data query system 20 may be communicatively coupled to each other via a system bus. Wherein:
the memory 21 includes at least one type of computer-readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., 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 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 apparatus 2, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the electronic apparatus 2. Of course, the memory 21 may also comprise both an internal memory module of the electronic apparatus 2 and an external memory device thereof. In this embodiment, the memory 21 is generally used for storing an operating system installed in the electronic device 2 and various application software, such as program codes of the query system 20 of blockchain ledger data. Further, the memory 21 may be used to temporarily store various types of data that have been output or are to be output.
The processor 22 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 22 is typically used to control the overall operation of the electronic device 2, such as performing control and processing related to data interaction or communication with the electronic device 2, and the like. In this embodiment, the processor 22 is configured to execute program codes stored in the memory 21 or process data, such as the running blockchain ledger data query system 20.
The network interface 23 may comprise a wireless network interface or a wired network interface, which network interface 23 is typically used for establishing a communication connection between the electronic device 2 and other electronic devices. For example, the network interface 23 is used to connect the electronic apparatus 2 with an external terminal through a network, establish a data transmission channel and a communication connection between the electronic apparatus 2 and the external terminal, and the like. The network may be an Intranet (Intranet), the Internet (Internet), a global system for mobile communications (Global System of Mobile communication, GSM), wideband code division multiple access (Wideband Code Division Multiple Access, WCDMA), a 4G network, a 5G network, bluetooth (Bluetooth), wi-Fi, or other wireless or wired network.
It should be noted that fig. 3 only shows an electronic device with components 21-23, but it should be understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead.
In this embodiment, the query system 20 of the blockchain ledger data stored in the memory 21 may also be divided into one or more program modules, and one or more program modules are stored in the memory 21 and executed by one or more processors (the processor 22 in this embodiment) to complete the present invention.
Example IV
The present embodiment also provides a computer readable storage medium, in which a system for querying blockchain ledger data is stored, where the system for querying blockchain ledger data is executable by at least one processor, so that the at least one processor performs the steps of the method for querying blockchain ledger data according to the first embodiment.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of a computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may also be an external storage device of a computer device, such as a plug-in hard disk, smart Media Card (SMC), secure Digital (SD) Card, flash memory Card (Flash Card), etc. that are provided on the computer device. Of course, the computer-readable storage medium may also include both internal storage units of a computer device and external storage devices. In this embodiment, the computer readable storage medium is typically used to store an operating system and various types of application software installed on a computer device, such as program codes of the customer care analysis system of the second embodiment. Furthermore, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the invention described above may be implemented in a general purpose computing device, they may be concentrated on a single computing device, or distributed across a network of computing devices, they may alternatively be implemented in program code executable by computing devices, so that they may be stored in a storage device for execution by computing devices, and in some cases, the steps shown or described may be performed in a different order than what is shown or described, or they may be separately fabricated into individual integrated circuit modules, or a plurality of modules or steps in them may be fabricated into a single integrated circuit module. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (6)

1. The query method of the blockchain ledger data is characterized by comprising the following steps:
acquiring a query request, wherein the query request carries the page number of a target page;
acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
acquiring the corresponding value of each keyword in the keyword set from the blockchain account book;
combining the obtained keyword set with the corresponding values of the keywords in the keywords;
taking the combined result as a query result, and returning the query result;
the blockchain ledger is established as follows, including:
acquiring an establishment rule of a blockchain ledger, wherein the establishment rule comprises limiting strips of each page;
obtaining data to be written into the blockchain ledger, wherein the data to be written into the blockchain ledger comprises: keywords and values;
acquiring the number of pages of the current written data of the blockchain ledger and the number of the written data of the current page;
determining whether the number of written data of the current page reaches the limit number of each page;
if the data to be written into the blockchain ledger is not reached, writing the data to be written into the current page;
recording the page number of the current page and the written data number in the current page in the blockchain account book;
after determining whether the number of data written in the current page reaches the limit number of data written in each page, the method further comprises:
under the condition that the written data number of the current page reaches the limit number of each page, adding 1 to the page number of the current page to serve as the next page of the current page;
writing the data to be written into the blockchain ledger into the current page of the next page;
and recording the page number of the current next page and the written data number in the next current page in the blockchain ledger.
2. The method of claim 1, wherein after writing the piece of data to be written to the blockchain ledger to the next current page, further comprising:
and recording the key word of the data to be written into the blockchain ledger, and recording the association between the key word of the data to be written into the blockchain ledger and the page number of the next page after the page number of the current page.
3. An electronic device comprising a memory and a processor, wherein the memory is configured to store a query system of blockchain ledger data executable by the processor, the query system of blockchain ledger data comprising:
the first acquisition module is used for acquiring a query request, wherein the query request carries the page number of a target page;
the second acquisition module is used for acquiring a keyword set corresponding to the page number of the target page from a blockchain ledger according to the page number of the target page, wherein one or more keywords exist in the keyword set;
the third acquisition module is used for acquiring the corresponding value of each keyword in the keyword set from the blockchain ledger;
the combination module is used for combining the acquired keyword set with the corresponding values of the keywords in the keywords;
the return module is used for taking the combined result as a query result and returning the query result;
the building module is used for building the blockchain ledger according to the following mode:
acquiring an establishment rule of a blockchain ledger, wherein the establishment rule comprises limiting strips of each page;
obtaining data to be written into the blockchain ledger, wherein the data to be written into the blockchain ledger comprises: keywords and values;
acquiring the number of pages of the current written data of the blockchain ledger and the number of the written data of the current page;
determining whether the number of written data of the current page reaches the limit number of each page;
if the data to be written into the blockchain ledger is not reached, writing the data to be written into the current page;
recording the page number of the current page and the written data number in the current page in the blockchain account book;
the establishing module is further used for adding 1 to the page number of the current page as the next current page under the condition that the written data number of the current page reaches the limit number of each page after determining whether the written data number of the current page reaches the limit number of each page;
writing the data to be written into the blockchain ledger into the next current page;
and recording the page number of the current page of the next page and the written data number in the current page of the next page in the blockchain ledger.
4. The apparatus of claim 3, wherein the building module is further configured to record a keyword of the data of the one blockchain ledger to be written after writing the data of the one blockchain ledger to be written to a current page of a next page, and associate the keyword of the data of the one blockchain ledger to be written to the page number of the next page to record the keyword of the data of the one blockchain ledger to be written to the page number of the current page.
5. A computer device, comprising: a memory and a processor, characterized in that the processor is adapted to perform the steps of the method according to any one of claims 1 to 2.
6. A non-transitory computer readable storage medium having stored thereon computer instructions, which when executed, implement the steps of the method of any of claims 1 to 2.
CN201910308012.3A 2019-04-17 2019-04-17 Block chain account book data query method, electronic device and storage medium Active CN110162540B (en)

Priority Applications (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
PCT/CN2019/103764 WO2020211258A1 (en) 2019-04-17 2019-08-30 Blockchain account book data query method, electronic apparatus and storage medium

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN110162540A CN110162540A (en) 2019-08-23
CN110162540B true CN110162540B (en) 2023-06-06

Family

ID=67639417

Family Applications (1)

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

Country Status (2)

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

Families Citing this family (3)

* 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
US11210404B2 (en) * 2019-06-14 2021-12-28 Netiq Corporation Blockchain-based state verifications of software component vulnerability database for software products
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
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
CN109286676A (en) * 2018-10-15 2019-01-29 国网上海市电力公司 A kind of electric power data safety information system based on block chain
CN109522314A (en) * 2018-10-16 2019-03-26 平安科技(深圳)有限公司 Data archiving method and terminal device based on block chain
CN109542979A (en) * 2018-11-19 2019-03-29 广州矩阵信息科技有限公司 A kind of block catenary system Fast synchronization and the mode of simple smart data storage

Family Cites Families (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
CN107247773B (en) * 2017-06-07 2018-05-15 北京邮电大学 A kind of method that inquiry is traded in distributed data base based on block chain
CN107729371B (en) * 2017-09-12 2020-04-21 深圳先进技术研究院 Data indexing and querying method, device, equipment and storage medium of block chain
CN108897758A (en) * 2018-05-15 2018-11-27 深圳市网心科技有限公司 A kind of block chain Transaction Inquiries method, apparatus, system and storage medium
CN110162540B (en) * 2019-04-17 2023-06-06 平安科技(深圳)有限公司 Block chain account book data query method, electronic device and storage medium

Patent Citations (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
CN109286676A (en) * 2018-10-15 2019-01-29 国网上海市电力公司 A kind of electric power data safety information system based on block chain
CN109522314A (en) * 2018-10-16 2019-03-26 平安科技(深圳)有限公司 Data archiving method and terminal device based on block chain
CN109542979A (en) * 2018-11-19 2019-03-29 广州矩阵信息科技有限公司 A kind of block catenary system Fast synchronization and the mode of simple smart data storage

Also Published As

Publication number Publication date
WO2020211258A1 (en) 2020-10-22
CN110162540A (en) 2019-08-23

Similar Documents

Publication Publication Date Title
CN107958016B (en) Function page customization method and application server
CN110321344B (en) Information query method and device for associated data, computer equipment and storage medium
CN107818115B (en) Method and device for processing data table
CN110162540B (en) Block chain account book data query method, electronic device and storage medium
CN111506559B (en) Data storage method, device, electronic equipment and storage medium
US20120284270A1 (en) Method and device to detect similar documents
CN103530378A (en) Data paging query method and device and data base construction method and device
US20200257675A1 (en) Method, apparatus, and system for evaluating a partition in a database
CN112579608A (en) Case data query method, system, device and computer readable storage medium
CN106326295B (en) Semantic data storage method and device
CN112632266B (en) Data writing method and device, computer equipment and readable storage medium
CN106446080B (en) Data query method, query service equipment, client equipment and data system
CN114511314A (en) Payment account management method and device, computer equipment and storage medium
CN108984720B (en) Data query method and device based on column storage, server and storage medium
CN114595215A (en) Data processing method and device, electronic equipment and storage medium
CN113868138A (en) Method, system, equipment and storage medium for acquiring test data
CN111259201B (en) Data maintenance method and system
CN111986006A (en) Product recommendation method and device based on knowledge graph, computer equipment and storage medium
CN108073584B (en) Data processing method and server
CN104572711A (en) Distribution document-type data storage and extraction method and device
CN111131393B (en) User activity data statistical method, electronic device and storage medium
CN117555883B (en) Bank system data database separation method and device, memory and electronic equipment
CN112402955B (en) Game log recording method and system
CN111079391B (en) Report generation method and device
CN108984719B (en) Data deleting method and device based on column storage, server and storage medium

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