CN112559599B - Block chain-based data query method, system and block chain processing device - Google Patents

Block chain-based data query method, system and block chain processing device Download PDF

Info

Publication number
CN112559599B
CN112559599B CN202011506318.9A CN202011506318A CN112559599B CN 112559599 B CN112559599 B CN 112559599B CN 202011506318 A CN202011506318 A CN 202011506318A CN 112559599 B CN112559599 B CN 112559599B
Authority
CN
China
Prior art keywords
data
target object
prison
integral
blockchain
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
CN202011506318.9A
Other languages
Chinese (zh)
Other versions
CN112559599A (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.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology 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 Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202011506318.9A priority Critical patent/CN112559599B/en
Publication of CN112559599A publication Critical patent/CN112559599A/en
Application granted granted Critical
Publication of CN112559599B publication Critical patent/CN112559599B/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
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • 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/248Presentation of query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • G06Q10/105Human resources
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Systems or methods specially adapted for specific business sectors, e.g. utilities or tourism
    • G06Q50/10Services
    • G06Q50/26Government or public services
    • 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 data query method, a block chain processing device and a data query system based on a block chain, which are used for effectively improving integral query efficiency. The method comprises the following steps: acquiring related data of a target object, wherein the related data comprises integral data; storing the integral data into an intelligent contract of the blockchain, wherein the intelligent contract comprises a sequencing contract method, and the sequencing contract method is used for sequencing the integral of the target object according to the integral data of the target object; receiving a first inquiry transaction request sent by a user terminal, wherein the first inquiry transaction request comprises a target object identifier; calling an intelligent contract according to the target object identification to call a sequencing contract method to sequence the integral of the target object; and feeding back the integral sequencing result of the target object to the user side.

Description

Block chain-based data query method, system and block chain processing device
Technical Field
The present invention relates to the field of blockchain technologies, and in particular, to a blockchain-based data query method, system, and blockchain processing device.
Background
In the prior art, when the integral is queried by using the blockchain field, the inventor finds that the integral data is generally read from the blockchain and then sorted, so that if the data size of the integral data is too large, the integral data may take a long time to be fetched, and the integral query efficiency is reduced.
Disclosure of Invention
The embodiment of the invention provides a data query method, a block chain processing device and a data query system based on a block chain, which are used for solving the technical problem of low integral query efficiency.
A blockchain-based data query method applied to a blockchain processing device, the method comprising:
acquiring related data of a target object, wherein the related data comprises integral data of an assessment item of the target object;
storing the integral data and the target object identification into an intelligent contract of a blockchain in an associated manner, wherein the intelligent contract comprises a sequencing contract method which is used for sequencing the assessment item integral of the target object according to the integral data;
receiving a first inquiry transaction request sent by a user terminal, wherein the first inquiry transaction request comprises the target object identifier;
calling the intelligent contract according to the target object identifier to call the sequencing contract method to sequence the assessment item points of the target object;
and feeding back the integral sequencing result of the target object to the user side.
Further, the related data further includes attribute data and/or assessment data, and the method further includes:
The attribute data and/or the assessment data are/is uplink to a blockchain, and transaction hash values corresponding to the attribute data and/or the assessment data are obtained;
associating the transaction hash value with the target object identifier and storing the transaction hash value and the target object identifier into the intelligent contract;
if a second inquiry transaction request which is sent by the user side and contains the target object identification is received, searching the transaction hash value associated with the target object identification from the intelligent contract;
according to the transaction hash value, attribute data and/or check data of the target object are read from the blockchain;
and feeding back attribute data and/or assessment data of the target object to the user side.
Further, the target object is a criminal and/or a prison manager in a prison, and the acquiring the related data of the target object includes:
and acquiring relevant data of the criminals and/or prison manager in a prison database corresponding to the prison.
Further, the acquiring, in the prison database corresponding to the prison, relevant data of the criminals and/or prison manager includes:
judging whether related data of the criminals and/or prison manager are acquired in the prison database for the first time;
If yes, the prison database is scanned completely so as to acquire relevant data of the criminals and/or prison manager.
Further, after the prison database is scanned completely to obtain relevant data of the criminals and/or prison manager, the method further includes:
creating a timing scanner in the prison database, wherein the timing scanner is used for acquiring related data of the newly added criminals and/or prison manager according to a preset polling period and the data identification value of the related data and the recorded cursor value;
receiving the newly added related data inquired by the timing scanner;
the method comprises the steps of recording a cursor value, wherein the cursor value is used for recording a data identification value of the relevant data which is finally uplink, each time of newly added relevant data in a prison database is provided with a unique corresponding data identification value, and the data identification values of the relevant data in the prison database are sequentially increased according to a time sequence stored in the prison database.
A blockchain processing device, comprising:
the acquisition module is used for acquiring related data of a target object, wherein the related data comprises integral data of an examination item of the target object;
The storage module is used for storing the integral data and the target object identification into an intelligent contract of a blockchain in an associated mode, wherein the intelligent contract comprises a sequencing contract method, and the sequencing contract method is used for sequencing the assessment item integral of the target object according to the integral data;
the receiving module is used for receiving a first inquiry transaction request sent by a user side, wherein the first inquiry transaction request comprises the target object identifier;
the calling module is used for calling the intelligent contract according to the target object identifier so as to call the ordering contract method to order the examination item points of the target object;
and the sending module is used for feeding back the integral sequencing result of the target object to the user side.
Further, the blockchain processing device further comprises a query module and a reading module, and the related data further comprises attribute data and/or assessment data;
the storage module is used for uploading the attribute data and/or the assessment data into a blockchain;
the acquisition module is used for acquiring transaction hash values corresponding to the attribute data and/or the assessment data;
the storage module is used for associating the transaction hash value with the target object identifier and storing the transaction hash value and the target object identifier into the intelligent contract;
The query module is configured to, if a second query transaction request including the target object identifier sent by the user side is received, find the transaction hash value associated with the target object identifier from the intelligent contract;
the reading module is used for reading attribute data and/or assessment data of the target object from the blockchain according to the transaction hash value;
the sending module is used for feeding back the attribute data and/or the assessment data of the target object to the user side.
Further, the target object is a criminal and/or a prison manager in a prison, and the acquisition module is specifically configured to:
and acquiring relevant data of the criminals and/or prison manager in a prison database corresponding to the prison.
A blockchain processing device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the blockchain processing method described above when executing the computer program.
A computer readable storage medium storing a computer program which when executed by a processor performs the steps of the blockchain processing method described above.
According to the data query method based on the blockchain, the blockchain processing device and the data query system, the integral data of the target object is acquired firstly, then the integral data and the target object identification are associated and stored in the intelligent contract, only the integral data in the related data of the target object are stored in the intelligent contract, excessive storage pressure is not given to the intelligent contract, on the other hand, the integral of the target object is sequenced in the blockchain by creating a sequencing contract method in the intelligent contract and calling the sequencing contract method, so that an integral sequencing result of the target object is obtained, finally the integral sequencing result can be fed back to a user side, the direct reading of the integral data from the intelligent contract can be avoided, the condition that the read data is not direct data on the blockchain and is modified is avoided, the reliability of the integral result is improved, the consumed time length caused by reading a large amount of integral data is also reduced, and the integral query efficiency is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the description of the embodiments of the present invention will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a data query system in accordance with an embodiment of the present invention;
FIG. 2 is a flow chart of a method for data query based on a blockchain in accordance with an embodiment of the present invention;
FIG. 3 is a flow chart of a block chain based data query method according to an embodiment of the invention;
FIG. 4 is a flow chart of a block chain based data query method according to an embodiment of the invention;
FIG. 5 is a flowchart illustrating a method for blockchain-based data querying in accordance with an embodiment of the present invention;
FIG. 6 is a block chain processing apparatus according to an embodiment of the present invention;
FIG. 7 is a block chain processing apparatus according to another embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments 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.
The embodiment of the invention provides a data query method based on a block chain, a block chain processing device and a data query system. First, a description will be given of a data query system provided in the present invention, as shown in fig. 1, where the data query system includes a blockchain processing device, a database, a blockchain, and a client. The user side can communicate with the blockchain processing device through a network, and the blockchain processing device can communicate with a database, so that data in the database can be acquired. The user terminal may include, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and other devices with display functions. The data query method based on the block chain provided by the invention can be applied to a block chain processing device shown in fig. 1, wherein the block chain processing device is used for acquiring integral data of a target object; and storing the integral data into the intelligent contracts of the blockchain, calling the intelligent contracts according to the target object identification after receiving a first inquiry transaction request which is sent by the user terminal and contains the target object identification, sequencing the integral of the target object by calling a sequencing contract method, and feeding back the integral sequencing result of the target object to the user terminal.
The blockchain-based data query method provided by the invention is described in detail below with reference to the drawings and specific embodiments. As shown in fig. 2 and 5, the blockchain-based data query method according to an embodiment of the present invention includes the following steps:
s10: and acquiring related data of a target object, wherein the related data comprises integral data of an examination item of the target object.
Wherein as an example the target object is a criminal and/or a prison manager in a prison, which may specifically be referred to as a prison policeman, which target object is referred to as all criminals in a prison, and/or all prison manager.
In prisons, in order to effectively manage criminals and/or prison administrators in the prisons, the criminals and/or prison administrators are often given an assessment, and the assessment results, i.e., points, are presented by specific scores. Wherein, the invention is not limited herein to specific examination items and amounts.
For example, for criminals 1, 2, N in prison, assessment items for each criminal may be set, including assessment item a, assessment item B, and assessment item C, which may specifically refer to physical ability assessment, efficiency compliance assessment, work assessment, and the like. And in a preset period, the assessment result of each criminal N can be recorded, so that the scores of different examination items of each criminal N are obtained, and the score data of all criminals are obtained.
For another example, for prison police 1, prison police 2, prison..once, prison police N, each prison police's assessment items may be set, including assessment item E, assessment item F, and assessment item G, which may specifically refer to fitness assessment, punching card assessment, work task assessment, and so forth. Similarly, in a preset period, the assessment result of each prison police N can be recorded, so that the scores of different assessment items of each prison police N are obtained, and the integral data of all the prison police N are obtained.
It should be noted that the above-mentioned target object is a criminal and/or a prison manager, which is only illustrated herein for exemplary purposes, and in some application scenarios, the target object may also specifically refer to the integral data of each prison partition in the prison, which is not limited herein.
The prison system in the prison can record the related data of the target object, and the related data comprise the integral data of the target object and upload the integral data into the prison database in real time. It should be noted that, the related data of the target object also includes other data, which will be further described in the following embodiments, and will not be described here. For a blockchain processing device, relevant data of a target object can be acquired.
S20: and storing the integral data and the target object identification into an intelligent contract of a blockchain in an associated mode, wherein the intelligent contract comprises a sequencing contract method, and the sequencing contract method is used for sequencing the assessment item integral of the target object according to the integral data.
It should be noted that, in the embodiment of the present invention, the smart contract needs to be deployed in the blockchain first, where, based on the data query method provided in the embodiment of the present invention, since the integral data needs to be ordered in the blockchain, the smart contract in the implementation of the present invention is different from the conventional smart contract, and the smart contract in the embodiment of the present invention includes an ordering contract method, where the ordering contract method is used to order the assessment item integral of the target object according to the integral data.
The process of generating and deploying the smart contract will be briefly described.
In an embodiment of the present invention, a deployment scenario is provided, including the following steps:
(1) The intelligent contract developer uses the language which can be compiled into the byte code to compile the intelligent contract source file corresponding to the blockchain, and can understand that the intelligent contract comprises a contract method, in particular a sequencing contract method.
(2) The intelligent contract source file is compiled using a compiler of the intelligent contract source code corresponding development language, and the compiling target is a WASM byte code file, so that an intelligent contract in the form of WASM byte codes (herein called WASM intelligent contract) is obtained. It should be noted that, for convenience of description, the following examples of the WASM intelligent combination are given, but the present invention is not limited thereto.
(3) Through the steps (1) and (2), the WASM intelligent contract which can be deployed in the blockchain database is obtained, and the user side can send an intelligent contract deployment transaction to the blockchain processing device, wherein the intelligent contract deployment transaction comprises deployment transaction parameters, and the deployment transaction parameters comprise contents such as a transaction sender address, signature information of the transaction sender on the deployment transaction, a binary representation form (namely WASM byte codes obtained by encoding in advance) of the WASM intelligent contract, and the like.
(4) After receiving the contract deployment transaction, the blockchain processing device can analyze deployment transaction parameters such as the address of a transaction sender, signature information of the transaction sender on the deployment transaction, a binary representation form (i.e. a WASM byte code file obtained by encoding) of the WASM intelligent contract, and the like, so that the WASM intelligent contract can be deployed in the blockchain subsequently.
(5) The blockchain processing device may deploy the smart contract in the blockchain upon receiving the contract deployment transaction.
After deployment of the smart contract, the point data and target object identification may be associated into the blockchain smart contract. It should be noted that the target object identifier is an identifier for uniquely identifying the target object. For example, when the target object is a criminal, the target object identification may specifically refer to a criminal number or an identity card; when the target object is a prison police, the target object identification may specifically refer to a prison police employee identification number or an identity card. The invention is not particularly limited.
S30: and receiving a first inquiry transaction request sent by a user terminal, wherein the first inquiry transaction request comprises the target object identifier.
After the first query transaction request is used for querying the integral sequencing result of the target object, and the integral data and the target object identification are associated and stored in the intelligent contract of the blockchain, when a user needs to query the integral data of the target object, the integral data of the target object can be searched through the target object identification, specifically, the first query transaction request sent by the user side to the blockchain processing device comprises the target object identification, the blockchain processing device can receive the integral query transaction request, and analyze the integral query transaction request to obtain the target object identification.
S40: and calling the intelligent contract according to the target object identification to call the sequencing contract method to sequence the integral of the target object.
As mentioned above, the ranking contract method is used for ranking the assessment item scores of the target object according to the score data. Thus, by invoking the smart contract, the sort contract method is invoked to perform a related sort of the integral data within the smart contract. The ranking herein may refer to ranking the points of the same assessment item in the target object. Therefore, for each examination item, the corresponding product score ordering result is provided. For example, for assessment item A, the score ranking result for each criminal may be as follows: criminal 1, criminal 2, &..criminal N. For example, for the assessment item E, the score ranking results for each prison police may be as follows: prison police 1, prison police 2, & prison police N.
S50: and feeding back the integral sequencing result of the target object to the user side.
After receiving the point inquiry transaction request sent by the user terminal, the intelligent contract is called according to the target object identification, so that the sorting contract method is called to sort the point data of the target object, the point result is obtained, and finally the point sorting result of the target object is fed back to the user terminal, so that the user can inquire the point inquiry result of any target object at any time through the user terminal.
Therefore, in the data query method based on the blockchain, the integral data of the target object is firstly obtained, then the integral data and the target object identifier are associated and stored in the intelligent contract, only the integral data in the related data of the target object is stored in the intelligent contract, and excessive storage pressure is not given to the intelligent contract, on the other hand, the integral data of the target object is sequenced in the blockchain by creating and calling a sequencing contract method in the intelligent contract, so that an integral sequencing result of the target object is obtained, and finally the integral sequencing result can be fed back to the user side, so that the condition that the read data is not the direct data on the blockchain but is modified and processed is avoided, the reliability of the integral result is improved, the time consumption caused by reading a large amount of integral data is also reduced, and the integral query efficiency is improved.
In an embodiment, the related data of the target object includes attribute data and/or assessment data, where the attribute data refers to attribute data of the target object, and the assessment data refers to specific assessment information of an assessment project, and the assessment record information includes video and photo and data related to assessment. For example, when the target object is a criminal, the attribute data refers to attribute information such as identity, age, past occupation, duration of the seat to be judged, reason of crime, time and place of the crime, and when the target object is a prison police, the attribute data of the early warning refers to information such as employee certificate of the early warning, main responsible work content, work duration, reward and punishment record. In the embodiment of the present invention, in order to provide a more practical query scenario, the processing manner is different from the integration data with respect to the attribute data and/or the assessment data of the target object, which is described in detail below.
Referring to fig. 3, the method further includes the following steps:
s60: and uploading the attribute data and/or the assessment data into a blockchain, and acquiring a transaction hash value corresponding to the attribute data and/or the assessment data.
It will be appreciated that after the relevant data of the target object is obtained, for the score data, the relevant data is processed by the processing logic of steps S10-S50, and for the attribute data and/or the assessment data, the attribute data and/or the assessment data is stored in the transaction, i.e. the attribute data and/or the assessment data is uplink to the blockchain, and the transaction hash value of the transaction in which the attribute data and/or the assessment data is stored is obtained. The process of calculating the transaction hash value is not described in detail herein.
S70: and associating the transaction hash value with the target object identification and storing the transaction hash value and the target object identification into the intelligent contract.
And after obtaining the transaction hash value, associating the transaction hash value with the target object identification and storing the transaction hash value into the intelligent contract. For example, taking criminal 1 as an example, attribute data and/or assessment data of the criminal 1 are stored in a transaction, a transaction hash value is obtained, and then the transaction hash value corresponding to the attribute data and/or the assessment data of the criminal 1 is stored in an intelligent contract in association with the identification of the criminal 1. The treatment is similar for other criminals, or for prison polices, and is not illustrated here.
It will be appreciated that, for attribute data and/or assessment data of a target object, since the number of prisons and/or criminals is high in prison, and the type of data stored in the prison database includes not only integral data, attribute data, but also a relatively large amount of data, the corresponding attribute data and/or assessment data, the data read from the prison database, and many thousands of characters, if all the data were to be linked, when the attribute data of a criminal requiring a query is hundreds of thousands of, the size of the character string being queried may be a very large number, which is very heavy to the load of the network, and the query speed will be very slow. In order to relieve the follow-up query pressure, the scheme needs to firstly uplink attribute data and/or check data corresponding to a target object into a blockchain, acquire transaction hash values corresponding to the attribute data and/or check data, then store the transaction hash values and the target object identification in an intelligent contract, and then quickly query corresponding transaction hash values in the intelligent contract through the target object identification.
S80: and if a second inquiry transaction request which is sent by the user side and contains the target object identification is received, searching the transaction hash value associated with the target object identification from the intelligent contract.
After the transaction hash value is associated with the target object identifier and stored in the intelligent contract, the transaction hash value of the intelligent transaction can be queried at any time. For the user, when the attribute data of a certain target object needs to be queried, a second query request transaction request can be triggered through the user side, wherein the second query request transaction request is used for querying the attribute data and/or the assessment data of the target object. And for the blockchain processing device, if a second inquiry transaction request which is sent by the user terminal and contains the target object identifier is received, the associated transaction hash value is searched according to the target object identifier.
S90: and according to the transaction hash value, the attribute data and/or the assessment data of the target object are read from the blockchain.
S90: and feeding back attribute data and/or assessment data of the target object to the user side.
It will be appreciated that after the transaction hash value associated with the target object identifier is found from the smart contract, the attribute data and/or the assessment data of the target object may be read from the blockchain based on the transaction hash value. For example, taking criminal 1 as an example, when attribute data and/or assessment data of the criminal 1 need to be queried, the attribute data and/or the assessment data of the criminal 1 are read from the blockchain according to the transaction hash value of the attribute data and/or the assessment data of the criminal 1.
In one embodiment, it should be noted that, in order to improve the efficiency of the related data of the target object during the uplink, the process of obtaining the related data of the target object is improved, and specifically, as shown in fig. 4, the method further includes the following steps:
s101: judging whether related data of the criminals and/or prison manager are acquired in the prison database for the first time;
s102: if yes, the prison database is scanned completely so as to acquire relevant data of the criminals and/or prison manager.
And when the data is firstly uploaded and acquired, performing full scanning on the prison database to acquire relevant data of the criminals and/or prison manager.
S103: creating a timing scanner in the prison database, wherein the timing scanner is used for acquiring related data of the newly added criminals and/or prison manager according to a preset polling period and the data identification value of the related data and the recorded cursor value;
s104: and receiving the newly added related data inquired by the timing scanner.
The method comprises the steps of recording a cursor value, wherein the cursor value is used for recording a data identification value of the relevant data which is finally uplink, each time of newly added relevant data in a prison database is provided with a unique corresponding data identification value, and the data identification values of the relevant data in the prison database are sequentially increased according to a time sequence stored in the prison database.
For steps S101-S104, as shown in fig. 5, the overall frame example diagram adopted in the embodiment of the present invention is shown, in the embodiment of the present invention, a trigger is added to a prison database, so that the relevant data of a target object can be captured at a moment when the relevant data appears, and then the newly added data is found by a timing scanner and directly linked. Specifically, the embodiment of the invention uses a record cursor, wherein the record cursor value is used for recording the data identification value of the relevant data which is finally uplink, the relevant data which is newly added each time in the prison database has a unique corresponding data identification value, and the data identification values of the relevant data in the prison database are sequentially increased according to the time sequence stored in the prison database, so that the timing scanner firstly checks the number of the current record cursor records each time when the newly added relevant data is read. For example, if the recorded cursor value is 3 at this time, we start to search from the data with the data identification value of 4, and perform the uplink operation on the extra related data, it can be seen that, since the data identification value of the table of the recorded newly-added data is automatically increased, the data identification value of the newly-added data added each time gradually increases, and when the new-added query is completed in the process of the query, the recorded cursor value is updated to the data identification value of the last newly-added related data, so that the next query can directly start to be uplink from the last data.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
In one embodiment, a blockchain processing device is provided, where the blockchain processing device corresponds to the blockchain processing method in the above embodiment one by one. As shown in fig. 6, the blockchain processing device includes an acquisition module 101, a storage module 102, a receiving module 103, a calling module 104, and a transmitting module 105. The functional modules are described in detail as follows:
the acquisition module is used for acquiring related data of a target object, wherein the related data comprises integral data of an examination item of the target object;
the storage module is used for storing the integral data and the target object identification into an intelligent contract of a blockchain in an associated mode, wherein the intelligent contract comprises a sequencing contract method, and the sequencing contract method is used for sequencing the assessment item integral of the target object according to the integral data;
the receiving module is used for receiving a first inquiry transaction request sent by a user side, wherein the first inquiry transaction request comprises the target object identifier;
The calling module is used for calling the intelligent contract according to the target object identifier so as to call the ordering contract method to order the examination item points of the target object;
and the sending module is used for feeding back the integral sequencing result of the target object to the user side.
Further, the blockchain processing device further comprises a query module and a reading module, and the related data further comprises attribute data and/or assessment data;
the storage module is used for uploading the attribute data and/or the assessment data into a blockchain;
the acquisition module is used for acquiring transaction hash values corresponding to the attribute data and/or the assessment data;
the storage module is used for associating the transaction hash value with the target object identifier and storing the transaction hash value and the target object identifier into the intelligent contract;
the query module is configured to, if a second query transaction request including the target object identifier sent by the user side is received, find the transaction hash value associated with the target object identifier from the intelligent contract;
the reading module is used for reading attribute data and/or assessment data of the target object from the blockchain according to the transaction hash value;
The sending module is used for feeding back the attribute data and/or the assessment data of the target object to the user side.
Further, the target object is a criminal and/or a prison manager in a prison, and the acquisition module is specifically configured to:
and acquiring relevant data of the criminals and/or prison manager in a prison database corresponding to the prison.
Further, the acquisition module is further configured to:
judging whether related data of the criminals and/or prison manager are acquired in the prison database for the first time;
if yes, the prison database is scanned completely so as to acquire relevant data of the criminals and/or prison manager.
Further, the acquisition module is further configured to:
after the prison database is fully scanned to acquire relevant data of the criminals and/or prison manager, a timing scanner is created in the prison database, wherein the timing scanner is used for acquiring the relevant data of the newly added criminals and/or prison manager according to a preset polling period and a data identification value of the relevant data and a recorded cursor value;
receiving the newly added related data inquired by the timing scanner;
The method comprises the steps of recording a cursor value, wherein the cursor value is used for recording a data identification value of the relevant data which is finally uplink, each time of newly added relevant data in a prison database is provided with a unique corresponding data identification value, and the data identification values of the relevant data in the prison database are sequentially increased according to a time sequence stored in the prison database.
According to the blockchain processing device provided by the embodiment, the integral data of the target object is firstly obtained, then the integral data and the target object identification are associated and stored in the intelligent contract, only the integral data in the related data of the target object is stored in the intelligent contract, and excessive storage pressure is not given to the intelligent contract, on the other hand, the integral of the target object is ordered in the blockchain by creating and calling a sorting contract method in the intelligent contract, so that an integral ordering result of the target object is obtained, finally, the integral ordering result can be fed back to the user side, and the condition that the read integral data is not the direct data on the blockchain and is subjected to modification processing can be avoided, so that the reliability of the integral result is improved, the consumed time length caused by reading a large amount of integral data is reduced, and the integral inquiring efficiency is improved.
For specific limitations on the blockchain processing device, reference may be made to the above limitation on the blockchain-based data querying method, and no further description is given here. The various modules in the blockchain processing device described above may be implemented in whole or in part in software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a blockchain processing device is provided, the internal structure of which may be as shown in fig. 7. The blockchain processing device includes a processor, a memory, a network interface, and a database connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the blockchain processing device is used for communicating with an external user terminal through a network connection. The computer program, when executed by a processor, implements a blockchain-based data querying method.
In one embodiment, a blockchain processing device is provided that includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program:
acquiring related data of a target object, wherein the related data comprises integral data of an assessment item of the target object;
storing the integral data and the target object identification into an intelligent contract of a blockchain in an associated manner, wherein the intelligent contract comprises a sequencing contract method which is used for sequencing the assessment item integral of the target object according to the integral data;
receiving a first inquiry transaction request sent by a user terminal, wherein the first inquiry transaction request comprises the target object identifier;
calling the intelligent contract according to the target object identifier to call the sequencing contract method to sequence the assessment item points of the target object;
and feeding back the integral sequencing result of the target object to the user side.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of:
Acquiring related data of a target object, wherein the related data comprises integral data of an assessment item of the target object;
storing the integral data and the target object identification into an intelligent contract of a blockchain in an associated manner, wherein the intelligent contract comprises a sequencing contract method which is used for sequencing the assessment item integral of the target object according to the integral data;
receiving a first inquiry transaction request sent by a user terminal, wherein the first inquiry transaction request comprises the target object identifier;
calling the intelligent contract according to the target object identifier to call the sequencing contract method to sequence the assessment item points of the target object;
and feeding back the integral sequencing result of the target object to the user side.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (10)

1. A blockchain-based data query method, applied to a blockchain processing device, the method comprising:
acquiring related data of a target object, wherein the related data comprises integral data of an assessment item of the target object;
Storing the integral data and the target object identification into an intelligent contract of a blockchain in an associated manner, wherein the intelligent contract comprises a sequencing contract method which is used for sequencing the assessment item integral of the target object according to the integral data;
receiving a first inquiry transaction request sent by a user terminal, wherein the first inquiry transaction request comprises the target object identifier;
calling the intelligent contract according to the target object identifier to call the sequencing contract method to sequence the assessment item points of the target object;
and feeding back the integral sequencing result of the target object to the user side.
2. The data query method of claim 1, wherein the related data further comprises attribute data and/or assessment data, the method further comprising:
the attribute data and/or the assessment data are/is uplink to a blockchain, and transaction hash values corresponding to the attribute data and/or the assessment data are obtained;
associating the transaction hash value with the target object identifier and storing the transaction hash value and the target object identifier into the intelligent contract;
if a second inquiry transaction request which is sent by the user side and contains the target object identification is received, searching the transaction hash value associated with the target object identification from the intelligent contract;
According to the transaction hash value, attribute data and/or check data of the target object are read from the blockchain;
and feeding back attribute data and/or assessment data of the target object to the user side.
3. The data query method according to claim 1 or 2, wherein the target object is a criminal and/or a prison manager in a prison, and the acquiring the relevant data of the target object includes:
and acquiring relevant data of the criminals and/or prison manager in a prison database corresponding to the prison.
4. The data query method of claim 3, wherein the acquiring the relevant data of the criminals and/or prison manager in the prison database corresponding to the prison comprises:
judging whether related data of the criminals and/or prison manager are acquired in the prison database for the first time;
if yes, the prison database is scanned completely so as to acquire relevant data of the criminals and/or prison manager.
5. The data query method of claim 4, wherein after said performing a full scan of said prison database to obtain relevant data of said criminals and/or prison manager, said method further comprises:
Creating a timing scanner in the prison database, wherein the timing scanner is used for acquiring related data of the newly added criminals and/or prison manager according to a preset polling period and the data identification value of the related data and the recorded cursor value;
receiving the newly added related data inquired by the timing scanner;
the method comprises the steps of recording a cursor value, wherein the cursor value is used for recording a data identification value of the relevant data which is finally uplink, each time of newly added relevant data in a prison database is provided with a unique corresponding data identification value, and the data identification values of the relevant data in the prison database are sequentially increased according to a time sequence stored in the prison database.
6. A blockchain processing device, comprising:
the acquisition module is used for acquiring related data of a target object, wherein the related data comprises integral data of an examination item of the target object;
the storage module is used for storing the integral data and the target object identification into an intelligent contract of a blockchain in an associated mode, wherein the intelligent contract comprises a sequencing contract method, and the sequencing contract method is used for sequencing the assessment item integral of the target object according to the integral data;
The receiving module is used for receiving a first inquiry transaction request sent by a user side, wherein the first inquiry transaction request comprises the target object identifier;
the calling module is used for calling the intelligent contract according to the target object identifier so as to call the ordering contract method to order the examination item points of the target object;
and the sending module is used for feeding back the integral sequencing result of the target object to the user side.
7. The blockchain processing device of claim 6, further comprising a query module and a read module, the related data further comprising attribute data and/or assessment data;
the storage module is used for uploading the attribute data and/or the assessment data into a blockchain;
the acquisition module is used for acquiring transaction hash values corresponding to the attribute data and/or the assessment data;
the storage module is used for associating the transaction hash value with the target object identifier and storing the transaction hash value and the target object identifier into the intelligent contract;
the query module is configured to, if a second query transaction request including the target object identifier sent by the user side is received, find the transaction hash value associated with the target object identifier from the intelligent contract;
The reading module is used for reading attribute data and/or assessment data of the target object from the blockchain according to the transaction hash value;
the sending module is used for feeding back the attribute data and/or the assessment data of the target object to the user side.
8. The blockchain processing device of claim 6, wherein the target object is a criminal and/or prison manager in a prison, the acquisition module being specifically configured to:
and acquiring relevant data of the criminals and/or prison manager in a prison database corresponding to the prison.
9. A blockchain processing device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the data polling method according to any of claims 1 to 5 when the computer program is executed by the processor.
10. A blockchain-based data querying system comprising a blockchain, a prison database, and a blockchain processing device for implementing the method of any of claims 1-5.
CN202011506318.9A 2020-12-18 2020-12-18 Block chain-based data query method, system and block chain processing device Active CN112559599B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011506318.9A CN112559599B (en) 2020-12-18 2020-12-18 Block chain-based data query method, system and block chain processing device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011506318.9A CN112559599B (en) 2020-12-18 2020-12-18 Block chain-based data query method, system and block chain processing device

Publications (2)

Publication Number Publication Date
CN112559599A CN112559599A (en) 2021-03-26
CN112559599B true CN112559599B (en) 2023-05-26

Family

ID=75030366

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011506318.9A Active CN112559599B (en) 2020-12-18 2020-12-18 Block chain-based data query method, system and block chain processing device

Country Status (1)

Country Link
CN (1) CN112559599B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018213672A1 (en) * 2017-05-18 2018-11-22 Codex Llc Decentralized digital content distribution system and process using block chains
CN111143748A (en) * 2019-12-30 2020-05-12 山东爱城市网信息技术有限公司 Method, device and medium for sorting E-commerce commodities based on block chain
CN111951112A (en) * 2020-09-01 2020-11-17 宁波富万信息科技有限公司 Intelligent contract execution method based on block chain, terminal equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111708825B (en) * 2020-06-11 2021-08-24 腾讯科技(深圳)有限公司 Data processing method, device and equipment based on block chain and readable storage medium
CN111797415A (en) * 2020-06-30 2020-10-20 远光软件股份有限公司 Block chain based data sharing method, electronic device and storage medium
CN111884807B (en) * 2020-07-13 2021-10-26 腾讯科技(深圳)有限公司 Article reservation method, apparatus, device and medium based on block chain

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018213672A1 (en) * 2017-05-18 2018-11-22 Codex Llc Decentralized digital content distribution system and process using block chains
CN111143748A (en) * 2019-12-30 2020-05-12 山东爱城市网信息技术有限公司 Method, device and medium for sorting E-commerce commodities based on block chain
CN111951112A (en) * 2020-09-01 2020-11-17 宁波富万信息科技有限公司 Intelligent contract execution method based on block chain, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN112559599A (en) 2021-03-26

Similar Documents

Publication Publication Date Title
CN110647438B (en) Event monitoring method and device, computer equipment and storage medium
CN108573371B (en) Data approval method, device, computer equipment and storage medium
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN108491450B (en) Data caching method, device, server and storage medium
CN110213357B (en) Service data rollback method, device, computer equipment and storage medium
CN109492019B (en) Service request response method, device, computer equipment and storage medium
CN109992601B (en) To-do information pushing method and device and computer equipment
CN108563734B (en) System information query method, device, computer equipment and storage medium
CN108717426B (en) Enterprise data updating method and device, computer equipment and storage medium
CN110908778B (en) Task deployment method, system and storage medium
CN109308305B (en) Monitoring data query method and device and computer equipment
CN111324905A (en) Image data labeling method and device, computer equipment and storage medium
CN108924258B (en) Background information pushing method and device, computer equipment and storage medium
CN112256318B (en) Construction method and equipment for dependent product
CN112380130A (en) Application testing method and device based on call dependency relationship
CN110457401B (en) Data storage method and device, computer equipment and storage medium
CN112527357A (en) Service hot loading updating method and device, computer equipment and storage medium
CN110555165B (en) Information identification method and device, computer equipment and storage medium
CN110147258B (en) Method and device for improving program loading efficiency, computer equipment and storage medium
CN111224939B (en) Task request intercepting method and device, computer equipment and storage medium
CN109614399B (en) Bitmap data query method and device, computer equipment and storage medium
CN112559599B (en) Block chain-based data query method, system and block chain processing device
CN112433925A (en) Log generation method and device based on artificial intelligence, computer equipment and medium
CN111935104A (en) Internet of things equipment illegal access detection method and device and computer equipment
CN113157754B (en) Method, device and equipment for displaying flow form data 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