CN111488358A - Data query method and device based on service data block chain - Google Patents

Data query method and device based on service data block chain Download PDF

Info

Publication number
CN111488358A
CN111488358A CN202010271071.0A CN202010271071A CN111488358A CN 111488358 A CN111488358 A CN 111488358A CN 202010271071 A CN202010271071 A CN 202010271071A CN 111488358 A CN111488358 A CN 111488358A
Authority
CN
China
Prior art keywords
data
user
hash value
identifier
block chain
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.)
Pending
Application number
CN202010271071.0A
Other languages
Chinese (zh)
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.)
Beijing Ruice Technology Co Ltd
Original Assignee
Beijing Ruice 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 Beijing Ruice Technology Co Ltd filed Critical Beijing Ruice Technology Co Ltd
Priority to CN202010271071.0A priority Critical patent/CN111488358A/en
Publication of CN111488358A publication Critical patent/CN111488358A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2246Trees, e.g. B+trees
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • 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/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6227Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database where protection concerns the structure of data, e.g. records, types, queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Abstract

The application discloses a data query method and a device based on a service data block chain, wherein the method comprises the following steps: the user equipment receives a current block sent by a block chain node; determining user operation data from the current block, wherein the user operation data is the operation of a user on service data; determining a corresponding relation between a first identifier and a first hash value according to the user operation data, wherein the first identifier is the identifier of the user operation data, and the first hash value is the hash value of the user operation; and updating a local data table according to the corresponding relation between the first identifier and the first hash value, wherein the data table stores the corresponding relation between the identifier and the hash value so as to facilitate the query of a user. According to the method and the device, the user can inquire accurately, the inquiring efficiency of the user is improved, and the inquiring experience of the user on the block chain is improved.

Description

Data query method and device based on service data block chain
Technical Field
The invention relates to the technical field of internet big data, and discloses a data query method and device based on a service data block chain.
Background
Currently, the blockchain technology is a distributed stored ledger that uses technologies such as encryption algorithm and consensus mechanism. With the use of blockchain technology, more and more internet data is stored on the blockchain.
The data block generally includes a block header and a block body, wherein the block header encapsulates information such as a current version number, a previous block address, a target hash value of the current block, a random number of solution in a current block consensus process, a timestamp, and the like. The block body then contains the transaction data volume of the current block and all verified transaction records generated during the block creation process, and these data contained in the block body constitute the block data. The block data includes all data in the block creation process, and such storage manner may traverse all relevant records stored in the block chain when querying the data, thereby resulting in inefficient query. In addition, when a user acquires data information at any node in the blockchain, if all nodes are not traversed, there may be a case where the acquired data may be tampered. If all nodes are traversed, a serious waste of computer resources is caused, and therefore, how to improve the efficiency and accuracy of data query in the blockchain becomes a focus.
In the existing block chain, only transaction data can be stored, and the transaction data comprises an address of a transfer party, an address of a receiving party and a transfer amount. For various traffic data, for example: the data comprises internet related data such as evidence storage data, traceability data, financial data, tourism data, search data, self-media data, research data, advertisement data, e-commerce data, community data, knowledge question and answer data, knowledge payment data, shared bicycle data, recruitment data, life service data, renting data, voting data, OTO data (also called online to offline data), social data, approval data, evaluation data, network appointment data and the like, and the data also needs to be inquired on a block chain.
The foregoing description is merely for convenience in understanding and is not to be construed as limiting the prior art to the present application.
Disclosure of Invention
Based on the above problems, the application discloses a data query method and device based on a service data block chain, and the method can enable a user to query accurately, improve the query efficiency of the user, and improve the query experience of the user on the block chain.
A first aspect of the present application discloses a data query method based on a service data block chain, where the service data block chain includes a plurality of block chain nodes, and the method includes:
the user equipment receives a current block sent by a block chain node;
determining user operation data from the current block, wherein the user operation data is the operation of a user on service data;
determining a corresponding relation between a first identifier and a first hash value according to the user operation data, wherein the first identifier is the identifier of the user operation data, and the first hash value is the hash value of the user operation;
and updating a local data table according to the corresponding relation between the first identifier and the first hash value, wherein the data table stores the corresponding relation between the identifier and the hash value so as to facilitate the query of a user.
In a possible implementation manner, the local data table includes an attribute field, and the attribute value field is the attribute field of the first identifier, so that a user can query according to the attribute field.
In one possible implementation, the first identifier includes identifiers corresponding to one or more of user data, point data, entity data, user data-point data, entity data-user data, and entity data-point data.
In one possible implementation, the user operation data is operation data of a user on the internet, and the user operation data includes one or more of evidence storage data, traceability data, financial data, travel data, search data, self-media data, research data, advertisement data, e-commerce data, community data, knowledge question and answer data, knowledge payment data, shared bicycle data, recruitment data, living service data, rentals data, voting data, online-to-offline data, social data, praise data, evaluation data and online booking data.
In one possible implementation, the method further includes: the user equipment receives a current block sent by other block chain nodes, wherein the other block chain nodes are block chain nodes which are the block chain link nodes;
determining a relationship between the first identifier and a second hash value according to the user operation data of the current block of the link point of the other block, wherein the second hash value is the hash value of the user operation data;
and if the first hash value is the same as the second hash value, updating a local data table according to the corresponding relation between the first identifier and the first hash value.
A second aspect of the present application discloses a data query apparatus based on a service data block chain, where the service data block chain includes a plurality of block chain nodes, and the apparatus is a user equipment; wherein the content of the first and second substances,
the user equipment receives a current block sent by a block chain node;
determining user operation data from the current block, wherein the user operation data is the operation of a user on service data;
determining a corresponding relation between a first identifier and a first hash value according to the user operation data, wherein the first identifier is the identifier of the user operation data, and the first hash value is the hash value of the user operation;
and updating a local data table according to the corresponding relation between the first identifier and the first hash value, wherein the data table stores the corresponding relation between the identifier and the hash value so as to facilitate the query of a user.
In a possible implementation manner, the local data table includes an attribute field, and the attribute value field is the attribute field of the first identifier, so that a user can query according to the attribute field.
In one possible implementation, the first identifier includes identifiers corresponding to one or more of user data, point data, entity data, user data-point data, entity data-user data, and entity data-point data.
In one possible implementation, the user operation data is operation data of a user on the internet, and the user operation data includes one or more of evidence storage data, traceability data, financial data, travel data, search data, self-media data, research data, advertisement data, e-commerce data, community data, knowledge question and answer data, knowledge payment data, shared bicycle data, recruitment data, living service data, rentals data, voting data, online-to-offline data, social data, praise data, evaluation data and online booking data.
In a possible implementation manner, the user equipment receives a current block sent by other block chain nodes, where the other block chain nodes are block chain nodes that the block chain node is;
determining a relationship between the first identifier and a second hash value according to the user operation data of the current block of the link point of the other block, wherein the second hash value is the hash value of the user operation data;
and if the first hash value is the same as the second hash value, updating a local data table according to the corresponding relation between the first identifier and the first hash value.
In one possible implementation, the block link nodes organize relationships between global states after user operation into leaf nodes of a relationship tree; the method specifically comprises the following steps:
the value of the leaf node in the relational tree stores a user state-integral state, an entity state-integral state and an entity state-user state in a hash table or array mode; or
The value of a leaf node of the relation tree is used for storing a tree root of a relation sub-tree, the relation sub-tree stores a user state-integral state, an entity state-integral state and an entity state-user state, and the relation sub-tree is a Mercker tree or an MPT tree.
In a possible implementation manner, any one of the user state, the entity state, the integral state, the user state-the integral state, the entity state-the integral state, and the entity state-the user state is stored in the database supporting attribute query in a form of a data table, so that a user can query according to an attribute field in the data table; the system comprises a data table, a plurality of rows of state information and a plurality of groups of data tables, wherein one type of state information corresponds to one data table, any row in any one data table corresponds to one piece of state information, and one type of state information comprises a plurality of rows of state information; the database supporting attribute query comprises a relational database and a memory database; or
And any state information of the user state, the entity state, the integral state, the user state-the integral state, the entity state-the integral state and the entity state-the user state is stored by adopting a KV database and is stored in a key-value pair mode.
In one possible implementation, the user operation data includes one or more of a timestamp, an operation user address, an operated address, an operation type, a value of an operation, a credit address, a signature of the user on the user operation data, and a hash value of the user operation data; the operation type comprises an operation of a user on an entity and an operation on the credit, and the operated address comprises an operation address on the entity and addresses of other operation users.
In one possible implementation manner, the attributes of the user operation data include an associated attribute and a non-associated attribute; wherein the attribute value of the associated attribute is automatically increased or decreased according to the data state after the user operation.
A third aspect of the present application provides a computer-readable storage medium, which stores computer instructions, and when the computer instructions are executed by a processor, the computer instructions implement any one of the above-mentioned technical solutions.
A fourth aspect of the present application provides an electronic device, which includes a processor configured to execute any one of the above technical solutions.
According to the method and the device, the user can inquire accurately, the inquiring efficiency of the user is improved, and the inquiring experience of the user on the block chain is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flow chart illustrating a data query method for a service data block chain according to the present application;
fig. 2 is a schematic block head structure diagram of a service data block chain according to the present application;
fig. 3 is a schematic structural diagram of a data query device for a service data block chain according to the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The terms "first" and "second" in this application are used for convenience of understanding only, and are not to be construed as sequential or limiting in any way.
For the purpose of facilitating understanding of the embodiments of the present invention, the following description will be further explained with reference to specific embodiments, which are not to be construed as limiting the embodiments of the present invention.
Blockchains are generally divided into three types: public chain (Public Blockchain), private chain (PrivateBlockchain) and alliance chain (Consortium Blockchain). In addition, there are various types of combinations, such as private chain + federation chain, federation chain + public chain, and other different combinations. The most decentralized of these is the public chain. The public chain is represented by bitcoin and ether house, and the participators joining the public chain can read the data record on the chain, participate in transaction, compete for accounting right of new blocks, and the like.
Furthermore, each participant (i.e., node) is free to join and leave the network and perform related operations. Private chains are the opposite, with the network's write rights controlled by an organization or organization and the data read rights specified by the organization. Briefly, a private chain can be a weakly centralized system with strictly limited and few participating nodes. This type of blockchain is more suitable for use within a particular establishment.
Based on the basic characteristics of a blockchain, a blockchain is usually composed of several blocks. The time stamps corresponding to the creation time of the block are recorded in the blocks respectively, and all the blocks form a time-ordered data chain according to the time stamps recorded in the blocks strictly.
The real data generated by the physical world can be constructed into a standard transaction (transaction) format supported by a block chain, then is issued to the block chain, is identified by node equipment in the block chain, and is packed into a block by the node equipment serving as an accounting node in the block chain after the identification is achieved, and is subjected to persistent evidence storage in the block chain.
In the field of blockchain, an important concept is Account (Account); taking an ether house as an example, the ether house generally divides an account into an external account and a contract account; the external account is an account directly controlled by the user; and the contract account is created by the user through an external account, the account containing the contract code (i.e. the smart contract).
Of course, for some blockchain items derived based on the ethernet framework, the account types supported by the blockchain may be further expanded, and are not particularly limited in this specification.
For accounts in a blockchain, the account status of the account is usually maintained through a structure. When a transaction in a block is executed, the status of the account associated with the transaction in the block chain is also typically changed.
Taking etherhouses as an example, the structure of an account usually includes fields such as Balance, Nonce, Code, and storage. Wherein:
a Balance field for maintaining the current account Balance of the account;
a Nonce field for the number of transactions for the account; the counter is used for guaranteeing that each transaction can be processed only once, and replay attack is effectively avoided.
A code field for maintaining a contract code for the account; in practical applications, only the hash value of the contract code is typically maintained in the code field; thus, the code field is also commonly referred to as a codehash field. For external accounts, this field is null.
storage field to maintain the storage of the account (default to empty). In practical application, the storage field only maintains the root node of an MPT (Merkle Patricia Trie) tree constructed based on the storage content of the account; thus, the storage field is also commonly referred to as the storageRoot field.
Wherein, for the external account, the code field and storage field shown above are null values.
Most blockchain items typically use Merkle trees; alternatively, the data is stored and maintained based on the data structure of the Merkle tree. Taking etherhouses as an example, the etherhouses use MPT tree (a Merkle tree variation) as a data organization form for organizing and managing important data such as account status, transaction information, and the like.
The Etherhouse designs three MPT trees, namely an MPT state tree, an MPT transaction tree and an MPT receipt tree, aiming at data needing to be stored and maintained in a block chain.
The MPT state tree is an MPT tree organized by account state data (state) of all accounts in the block chain; the MPT transaction tree is transaction data (transaction) in a block and is organized into the MPT tree; the MPT receipt tree is an MPT tree organized by transaction receipts (receipts) corresponding to each transaction generated after the transaction in the block is completed. The hash values of the root nodes of the MPT state tree, MPT transaction tree, and MPT receipt tree shown above are all added to the block header.
Wherein the MPT transaction tree and the MPT receipt tree correspond to tiles, each tile having its own MPT transaction tree and MPT receipt tree. The MPT state tree is a global MPT tree, which does not correspond to a specific tile, but covers account state data of all accounts in the tile chain.
The present specification discloses a data operation method of a service data blockchain, as shown in fig. 1, the service data blockchain system includes a plurality of blockchain nodes; the method includes S101-S104.
The entity information in the present specification refers to abstraction of objective objects and also refers to specific objective objects, the entity information includes associated attributes and non-associated attributes, and the associated attributes refer to that attribute values can be increased or decreased; the user information refers to description information of a user, and the user information comprises a user address; the point information is point information issued by the user, and is point information other than the original points on the block chain, and the point information includes the name and the total amount of the point.
S101, the user equipment receives the current block sent by the block chain node.
S102, determining user operation data from the current block, wherein the user operation data is the operation of a user on service data.
S103, determining a corresponding relation between a first identifier and a first hash value according to the user operation data, wherein the first identifier is the identifier of the user operation data, and the first hash value is the hash value of the user operation.
S104, updating a local data table according to the corresponding relation between the first identification and the first hash value, wherein the data table stores the corresponding relation between the identification and the hash value so as to facilitate user query.
In one example, the local data table includes an attribute field, and the attribute value field is the attribute field of the first identifier, so that a user can conveniently inquire according to the attribute field.
In one example, the first identification includes an identification corresponding to one or more of user data, point data, entity data, user data-point data, entity data-user data, and entity data-point data.
For example, the entity is a commodity of an internet e-commerce platform, and the user can initiate an operation of purchasing the commodity, namely, a point transfer operation (point is transferred from the address of the operating user to the address of the operated user) for a point corresponding to the commodity entity; the user can also initiate a comment or a praise operation for the commodity, namely a user operation for the commodity entity.
Associated attributes in an attribute type, for example: the number of praise is automatically increased for the same commodity or the self-media (such as pictures, texts and small videos circled by WeChat friends) after praise is performed by different users. Non-associated attributes, such as: and after different users comment the comment content, the user searches the commodity on the block chain and can see the comments of the different users.
The points are user issued points, for example: after a user can pass the notarization and securitize the house, a point is issued on the block chain, and the point uniquely represents the house property on the block chain; alternatively, the house may be securitized, a predetermined number of points issued, possession of the point will have ownership of the house, and will have equal ownership of the house lease or change. In addition, the block chain is provided with native scores which can be used for restricting the operation of the user on the block chain, so that the user is prevented from using the resources of the block chain system without limit; for example: after the users on the blockchain are registered, the users are operated on the blockchain, and the native credits are required to be collated so as to uplink the user operation data.
In one example, the tile link nodes organize relationships between user-manipulated global states into leaf nodes of a relationship tree, the relationships between the global states including one or more of a user state-integral state, an entity state-integral state, and an entity state-user state.
The relationship between entity state and user state, for example: on an electronic commerce platform (such as Taobao, Tianmao and Jingdong shopping mall) of the Internet, a commodity is purchased by a plurality of different users; on a self-media platform (such as WeChat and microblog) on the Internet, one piece of self-media data is praised or commented by a plurality of users; the one-to-many relationship between such entities and users can be expressed by using the association relationship between the entity information and the user information. The method and the device facilitate chaining of the service data and query of the service data by the user.
The relationship between the user state and the integration state. A user may have multiple points, for example: a user has both native credits on the blockchain and other types of credits. The incidence relation can describe the one-to-many relation between the user and the score, and meanwhile, the user can conveniently inquire. It should be noted that a user in the blockchain system at least has the native scores of the blockchain system; it is possible to have credits issued by other users or by themselves.
The relation between the entity state and the integral state is equivalent to the securitization of the entity on the block chain. For example: the ownership of a commodity corresponds to an integral, and the transfer of the integral corresponds to the transfer of the ownership of the commodity; the ownership of a set of houses corresponds to a predetermined number of points, the number of owned points corresponds to the ownership proportion of the houses, and namely, the houses are owned to sell or rent the prices in the same proportion.
In one example, the user operation data is operation data of a user on the internet, and the user operation data comprises one or more of evidence storage data, traceability data, financial data, travel data, search data, self-media data, research data, advertisement data, e-commerce data, community data, knowledge question and answer data, knowledge payment data, shared bicycle data, recruitment data, life service data, house renting data, voting data, online-offline data, social data, praise data, evaluation data and net appointment data.
In one example, the method further comprises: the user equipment receives a current block sent by other block chain nodes, wherein the other block chain nodes are block chain nodes which are the block chain link nodes;
determining a relationship between the first identifier and a second hash value according to the user operation data of the current block of the link point of the other block, wherein the second hash value is the hash value of the user operation data;
and if the first hash value is the same as the second hash value, updating a local data table according to the corresponding relation between the first identifier and the first hash value.
In one example, the tile link nodes organize relationships between user-manipulated global states into leaf nodes of a relationship tree; the method specifically comprises the following steps: the value of the leaf node in the relation tree stores a user state-integral state, an entity state-integral state and an entity state-user state in a hash table or array mode.
In one example, the value of a leaf node of a relational tree is used to store the root of a relational sub-tree that stores a user state-integral state, an entity state-integral state, and an entity state-user state, the relational sub-tree being a merkel tree or an MPT tree.
In one example, any one of the user state, the entity state, the integral state, the user state-the integral state, the entity state-the integral state and the entity state-the user state is stored in the database supporting attribute query in the form of a data table, so that a user can query according to an attribute field in the data table; the system comprises a data table, a plurality of rows of state information and a plurality of groups of data tables, wherein one type of state information corresponds to one data table, any row in any one data table corresponds to one piece of state information, and one type of state information comprises a plurality of rows of state information; the database supporting attribute query comprises a relational database and an in-memory database.
The relational database can adopt MySql, and the memory database adopts a MongoDB database.
In one example, any one of the state information of the user state, the entity state, the integral state, the user state-the integral state, the entity state-the integral state, and the entity state-the user state is stored in a KV database in a key-value pair manner.
In one example, the state tree or the relationship tree employs a merkel tree or an MPT tree, whose root is stored in a chunk header; wherein the MPT Tree is a Mercker Tree variation of a Tree structure fused with a prefix Tree, and the Mercker Tree is a Merkle Patricia Tree Tree.
In one example, the user operation data is operation data of a user on the internet, and the user operation data comprises one or more of evidence storage data, traceability data, financial data, travel data, search data, self-media data, research data, advertisement data, e-commerce data, community data, knowledge question and answer data, knowledge payment data, shared bicycle data, recruitment data, life service data, house renting data, voting data, online-offline data, social data, praise data, evaluation data and net appointment data.
In one example, the user operation data includes one or more of a timestamp, an operation user address, an operated address, an operation type, a value of an operation, a credit address, a signature of the user on the user operation data, and a hash value of the user operation data; the operation type comprises an operation of a user on an entity and an operation on the credit, and the operated address comprises an operation address on the entity and addresses of other operation users.
As described above, any one of the user state (e.g., Account field), the credit state (e.g., Asset field), the entity state (e.g., Object field), the entity state-user state (e.g., Object-Account field), the user state-credit state (e.g., Account-Asset field), and the entity state-credit state (e.g., Object-Asset field) may be implemented by using an MPT state tree or a Mercker tree, and the tree roots of various MPT state trees are stored in the header of the block. As shown in FIG. 2, the user Action of the tile store (e.g., the Action field), and the root of the MPT status tree of the Receipt status of the on-chain database store (e.g., the Recept field) are also stored in the tile header.
In the above, the states are stored in an MPT state tree manner, and a user can query through address information; directly adopting a user address, a point address and an entity address to inquire the state aiming at the user state, the point state and the entity state; and respectively adopting the entity address, the user address and the entity address to carry out state query aiming at the entity state-user state, the user state-integral state and the entity state-integral state.
In addition, the user address can be obtained by carrying out multiple times of hash operation according to the user public key; the point address or the entity address may be obtained by a user operation of creating a point or an entity, for example: and carrying out multiple times of hash operation on the user operation, and selecting characters with preset digits from the obtained hash value as integral addresses or entity addresses.
According to the method and the device, the query of the user can be made accurately, the query efficiency of the user is improved, and the query experience of the user on the block chain is improved; in addition, the service data is stored by adopting a chain structure and a tree structure, and various attributes of the service data can be stored on the block chain; and the database supporting attribute query is adopted, so that the user can conveniently access the database, and the query efficiency is improved.
In addition, the present specification discloses a data manipulation apparatus of a service data blockchain, and a service data blockchain system includes a plurality of blockchain nodes.
The user equipment receives a current block sent by a block chain node;
determining user operation data from the current block, wherein the user operation data is the operation of a user on service data;
determining a corresponding relation between a first identifier and a first hash value according to the user operation data, wherein the first identifier is the identifier of the user operation data, and the first hash value is the hash value of the user operation;
and updating a local data table according to the corresponding relation between the first identifier and the first hash value, wherein the data table stores the corresponding relation between the identifier and the hash value so as to facilitate the query of a user.
In one example, the local data table includes an attribute field, and the attribute value field is the attribute field of the first identifier, so that a user can conveniently inquire according to the attribute field.
In one example, the first identification includes an identification corresponding to one or more of user data, point data, entity data, user data-point data, entity data-user data, and entity data-point data.
In one example, the user operation data is operation data of a user on the internet, and the user operation data comprises one or more of evidence storage data, traceability data, financial data, travel data, search data, self-media data, research data, advertisement data, e-commerce data, community data, knowledge question and answer data, knowledge payment data, shared bicycle data, recruitment data, life service data, house renting data, voting data, online-offline data, social data, praise data, evaluation data and net appointment data.
In one example, the user equipment receives a current block sent by other block chain nodes, wherein the other block chain nodes are block chain nodes which are taken as the block chain node;
determining a relationship between the first identifier and a second hash value according to the user operation data of the current block of the link point of the other block, wherein the second hash value is the hash value of the user operation data;
and if the first hash value is the same as the second hash value, updating a local data table according to the corresponding relation between the first identifier and the first hash value.
In one example, the tile link nodes organize relationships between user-manipulated global states into leaf nodes of a relationship tree; the method specifically comprises the following steps:
the value of the leaf node in the relational tree stores a user state-integral state, an entity state-integral state and an entity state-user state in a hash table or array mode; or
The value of a leaf node of the relation tree is used for storing a tree root of a relation sub-tree, the relation sub-tree stores a user state-integral state, an entity state-integral state and an entity state-user state, and the relation sub-tree is a Mercker tree or an MPT tree.
In one example, any one of the user state, the entity state, the integral state, the user state-the integral state, the entity state-the integral state and the entity state-the user state is stored in the database supporting attribute query in the form of a data table, so that a user can query according to an attribute field in the data table; the system comprises a data table, a plurality of rows of state information and a plurality of groups of data tables, wherein one type of state information corresponds to one data table, any row in any one data table corresponds to one piece of state information, and one type of state information comprises a plurality of rows of state information; the database supporting attribute query comprises a relational database and a memory database; or
And any state information of the user state, the entity state, the integral state, the user state-the integral state, the entity state-the integral state and the entity state-the user state is stored by adopting a KV database and is stored in a key-value pair mode.
In one example, the user operation data includes one or more of a timestamp, an operation user address, an operated address, an operation type, a value of an operation, a credit address, a signature of the user on the user operation data, and a hash value of the user operation data; the operation type comprises an operation of a user on an entity and an operation on the credit, and the operated address comprises an operation address on the entity and addresses of other operation users.
In one example, the attributes of the user operation data include an associated attribute and a non-associated attribute; wherein the attribute value of the associated attribute is automatically increased or decreased according to the data state after the user operation.
The same or similar parts in the above device embodiments and the above method embodiments can be referred to each other, and are not described herein again.
According to the method and the device, the user can inquire accurately, the inquiring efficiency of the user is improved, and the inquiring experience of the user on the block chain is improved.
The present specification also discloses a computer readable storage medium storing computer instructions which, when executed by a processor, implement any one of the above-mentioned technical solutions.
The present specification also discloses an electronic device comprising a processor configured to perform any of the above-described technical solutions.
Meanwhile, the application also provides an embodiment of the entity device.
Fig. 3 shows a schematic diagram of a computer device, which may include: a processor 310, a memory 320, an input/output interface 330, a communication interface 340, and a bus 350. Wherein the processor 340, the memory 320, the input/output interface 330, and the communication interface 340 are communicatively coupled to each other within the device via a bus 350.
The processor 310 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present specification.
The Memory 320 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random access Memory), a static storage device, a dynamic storage device, or the like. The memory 320 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 320 and called to be executed by the processor 310.
The input/output interface 330 is used for connecting an input/output module to realize information input and output. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 340 is used for connecting a communication module (not shown in the figure) to implement communication interaction between the present device and other devices. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 350 includes a path that transfers information between the various components of the device, such as processor 310, memory 320, input/output interface 330, and communication interface 340.
It should be noted that although the above-mentioned device only shows the processor 310, the memory 320, the input/output interface 330, the communication interface 340 and the bus 350, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only illustrative of the present invention and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the scope of the present invention should be included in the scope of the present invention.

Claims (10)

1. A data query method based on a service data block chain, wherein the service data block chain comprises a plurality of block chain nodes, the method comprising:
the user equipment receives a current block sent by a block chain node;
determining user operation data from the current block, wherein the user operation data is the operation of a user on service data;
determining a corresponding relation between a first identifier and a first hash value according to the user operation data, wherein the first identifier is the identifier of the user operation data, and the first hash value is the hash value of the user operation;
and updating a local data table according to the corresponding relation between the first identifier and the first hash value, wherein the data table stores the corresponding relation between the identifier and the hash value so as to facilitate the query of a user.
2. The data query method of claim 1, wherein the local data table comprises an attribute field, and the attribute value field is the attribute field of the first identifier, so as to facilitate a user to query according to the attribute field.
3. The data query method of claim 1, wherein the first identifier comprises identifiers corresponding to one or more of user data, point data, entity data, user data-point data, entity data-user data, and entity data-point data.
4. The data query method according to claim 1, wherein the user operation data is operation data of a user on the internet, and the user operation data includes one or more of evidence storage data, traceability data, financial data, travel data, search data, self-media data, survey data, advertisement data, e-commerce data, community data, question and answer data, pay for knowledge data, shared bicycle data, recruitment data, life service data, house renting data, voting data, online-to-offline data, social data, praise data, evaluation data and internet appointment data.
5. The data query method of claim 1, further comprising:
the user equipment receives a current block sent by other block chain nodes, wherein the other block chain nodes are block chain nodes which are the block chain link nodes;
determining a relationship between the first identifier and a second hash value according to the user operation data of the current block of the link point of the other block, wherein the second hash value is the hash value of the user operation data;
and if the first hash value is the same as the second hash value, updating a local data table according to the corresponding relation between the first identifier and the first hash value.
6. A data query device based on a service data block chain, wherein the service data block chain comprises a plurality of block chain nodes, and the device is a user equipment; wherein the content of the first and second substances,
the user equipment receives a current block sent by a block chain node;
determining user operation data from the current block, wherein the user operation data is the operation of a user on service data;
determining a corresponding relation between a first identifier and a first hash value according to the user operation data, wherein the first identifier is the identifier of the user operation data, and the first hash value is the hash value of the user operation;
and updating a local data table according to the corresponding relation between the first identifier and the first hash value, wherein the data table stores the corresponding relation between the identifier and the hash value so as to facilitate the query of a user.
7. The data query apparatus of claim 6, wherein the local data table comprises an attribute field, and the attribute value field is an attribute field of the first identifier, so as to facilitate a user to query according to the attribute field.
8. The data query device of claim 6, wherein the first identifier comprises an identifier corresponding to one or more of user data, point data, entity data, user data-point data, entity data-user data, and entity data-point data.
9. The data query device of claim 6, wherein the user operation data is operation data of a user on the internet, and the user operation data comprises one or more of evidence storage data, traceability data, financial data, travel data, search data, self-media data, survey data, advertisement data, e-commerce data, community data, question and answer data, pay for knowledge data, shared bicycle data, recruitment data, life service data, house renting data, voting data, online-to-offline data, social data, praise data, evaluation data and internet appointment data.
10. The apparatus according to claim 6, wherein the ue receives a current block sent by another blockchain node, where the another blockchain node is the blockchain node for which the blockchain node is the current blockchain node;
determining a relationship between the first identifier and a second hash value according to the user operation data of the current block of the link point of the other block, wherein the second hash value is the hash value of the user operation data;
and if the first hash value is the same as the second hash value, updating a local data table according to the corresponding relation between the first identifier and the first hash value.
CN202010271071.0A 2020-04-08 2020-04-08 Data query method and device based on service data block chain Pending CN111488358A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010271071.0A CN111488358A (en) 2020-04-08 2020-04-08 Data query method and device based on service data block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010271071.0A CN111488358A (en) 2020-04-08 2020-04-08 Data query method and device based on service data block chain

Publications (1)

Publication Number Publication Date
CN111488358A true CN111488358A (en) 2020-08-04

Family

ID=71812508

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010271071.0A Pending CN111488358A (en) 2020-04-08 2020-04-08 Data query method and device based on service data block chain

Country Status (1)

Country Link
CN (1) CN111488358A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180082023A1 (en) * 2016-09-16 2018-03-22 International Business Machines Corporation Secure Distributed Patient Consent and Information Management
CN109165224A (en) * 2018-08-24 2019-01-08 东北大学 A kind of indexing means being directed to keyword key on block chain database
CN109189782A (en) * 2018-08-02 2019-01-11 哈尔滨工程大学 A kind of indexing means in block chain commodity transaction inquiry
US20190372777A1 (en) * 2018-06-04 2019-12-05 Samsung Electronics Co., Ltd. User apparatus using block chain, block chain system including the same and product information managing method thereof
CN110908992A (en) * 2018-08-28 2020-03-24 北京天德科技有限公司 Design method of block chain core storage algorithm based on big data platform

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180082023A1 (en) * 2016-09-16 2018-03-22 International Business Machines Corporation Secure Distributed Patient Consent and Information Management
US20190372777A1 (en) * 2018-06-04 2019-12-05 Samsung Electronics Co., Ltd. User apparatus using block chain, block chain system including the same and product information managing method thereof
CN109189782A (en) * 2018-08-02 2019-01-11 哈尔滨工程大学 A kind of indexing means in block chain commodity transaction inquiry
CN109165224A (en) * 2018-08-24 2019-01-08 东北大学 A kind of indexing means being directed to keyword key on block chain database
CN110908992A (en) * 2018-08-28 2020-03-24 北京天德科技有限公司 Design method of block chain core storage algorithm based on big data platform

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
贾大宇 等: "存储容量可扩展区块链系统的高效查询模型", 《软件学报》 *

Similar Documents

Publication Publication Date Title
CN111488616A (en) Method and device for realizing preplan machine of service data block chain
CN111488615A (en) Cross-link realization method and device for service data block chain
CN111488614A (en) Digital identity storage method and device based on service data block chain
CN111737726A (en) Relation data query method and device based on business data block chain
CN111488396A (en) Data synchronization method and device for service data block chain
CN111488608A (en) Data verification method and device for service data block chain
CN111488349A (en) Data query method and device based on service data block chain
CN111488344A (en) User operation data uplink method and system based on service data block chain
CN111695136A (en) Method and system for realizing service data block chain
CN111488610A (en) State data query method and device based on service data block chain
CN111488613A (en) Data efficient query method and device for service data block chain
CN111488345A (en) Storage optimization method and device for service data block chain
CN111488356A (en) Data storage method and device for service data block chain
CN111488611B (en) Relation data storage method and device of business data block chain
CN111488353B (en) Intelligent contract implementation method and device for business data block chain
CN111488343A (en) E-commerce data uplink method and device based on business data block chain
CN111488352A (en) Point exchange method and device based on business data block chain
CN111523137A (en) Data recommendation method and device based on service data block chain
CN111695132A (en) Voting data storage method and system based on service data block chain
CN111488607A (en) Data processing method and device for service data block chain
CN111488358A (en) Data query method and device based on service data block chain
CN111737729A (en) Evaluation data storage method and system based on service data block chain
CN111488347A (en) Data query method and device based on service data block chain
CN111488354A (en) Data processing method and device based on service data block chain
CN111488351A (en) Data operation method and device for service data block chain

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