CN113392144A - Museum service data storage and query method and system based on block chain - Google Patents

Museum service data storage and query method and system based on block chain Download PDF

Info

Publication number
CN113392144A
CN113392144A CN202110950541.0A CN202110950541A CN113392144A CN 113392144 A CN113392144 A CN 113392144A CN 202110950541 A CN202110950541 A CN 202110950541A CN 113392144 A CN113392144 A CN 113392144A
Authority
CN
China
Prior art keywords
data
museum
hash value
service data
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
CN202110950541.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.)
NATIONAL MUSEUM OF CHINA
Beijing University of Posts and Telecommunications
Original Assignee
NATIONAL MUSEUM OF CHINA
Beijing University of Posts and Telecommunications
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 NATIONAL MUSEUM OF CHINA, Beijing University of Posts and Telecommunications filed Critical NATIONAL MUSEUM OF CHINA
Priority to CN202110950541.0A priority Critical patent/CN113392144A/en
Publication of CN113392144A publication Critical patent/CN113392144A/en
Pending legal-status Critical Current

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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/28Databases characterised by their database models, e.g. relational or object models
    • G06F16/284Relational databases
    • 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/602Providing cryptographic facilities or services
    • 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
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a museum business data storage and query method and system based on a block chain, wherein the storage method adopts a distributed relational database to store the whole amount of data containing museum business data and data numbers under a chain, simultaneously constructs a block chain network, and stores a first hash value obtained by hashing the whole amount of data and the data numbers on the block chain network; the query method is characterized in that when the full amount of data corresponding to the museum service data is queried and retrieved through the distributed relational database, the corresponding first hash value is queried on the block chain network, and the full amount of data corresponding to the museum service data is hashed and then compared with the first hash value, so that the integrity and consistency of the data are verified, whether the data are legal or not is confirmed, and the data are prevented from being tampered.

Description

Museum service data storage and query method and system based on block chain
Technical Field
The invention relates to the technical field of data processing, in particular to a museum service data storage and query method and system based on a block chain.
Background
The museum is approved by the document department and the related administrative department, and after being approved, the museum obtains the qualification of the legal person and is finally open to the public. The museum is a non-profit social service organization with rich collection resources and coexisting ornamental and cultural values. Museums exist primarily for the collection, presentation, protection, and study of witnesses that are both human activities and the natural movements. For a long time, people usually concentrate on the collections in the museum, and pay little attention to the diversified heterogeneous data behind the collections in the museum, including the digital assets of the collections and the business process data of the collections, such as the warehouse entry and exit information of the collections, the borrowing and the information modification of the collections, which are important processes for ensuring the safety of the collections and realizing the data sharing and exchange. In the process of service circulation of the collection, the problems of the loss of the collection and the tampering of the collection service flow may occur, and under the circumstance, the security of the digital asset data and the service flow data of the museum collection is very important to ensure, so that a safe and effective museum service data storage and query method is needed.
Disclosure of Invention
The embodiment of the invention provides a method and a system for storing and inquiring museum service data based on a block chain, which are used for eliminating or improving one or more defects in the prior art, realizing safe storage and calling of the museum service data and preventing data tampering.
The technical scheme of the invention is as follows:
in one aspect, the invention provides a museum service data storage method based on a block chain, which comprises the following steps:
acquiring museum service data, and configuring a data number corresponding to the museum service data according to a preset rule;
carrying out character string hashing on the total data containing the museum service data and the corresponding data numbers according to a set algorithm to obtain a first hash value;
the data numbers are used as row keys, the first hash values are used as numerical values, key value pairs are formed and stored in a key value database on a chain through nodes of a block chain network;
storing the full data in a distributed relational database under the blockchain network chain;
and the first hash value stored on the chain is used for checking the legality of the full data in the distributed relational database under the chain.
In some embodiments, performing a string hash on the full-size data including the museum service data and the corresponding data number to obtain a first hash value includes: and carrying out compression encryption on the full data by adopting an MD5 encryption mode to obtain a 16-bit first hash value.
In some embodiments, the key-value database is a LevelDB database or a CouchDB database.
In some embodiments, the distributed relational database is a TiDB database.
On the other hand, the invention provides a museum service data query method based on a block chain, which comprises the following steps:
searching the total data of the service data of the target museum by adopting a distributed relational database in the museum service data storage method based on the block chain;
carrying out character string hashing on the full data according to a set algorithm to obtain a second hash value;
acquiring a data number in the full data, retrieving the data number on a chain of a block chain network of the block chain-based museum service data storage method, and inquiring a corresponding first hash value;
and comparing the first hash value with the second hash value, if the first hash value and the second hash value are consistent, the full data is legal, the verification is prompted to pass, and the full data of the target museum service data is output.
In some embodiments, after comparing the first hash value and the second hash value, further comprising: and if the data is inconsistent, the full data is illegal, and the full data is prompted to be tampered.
In some embodiments, performing a string hash on the full amount of data to obtain a second hash value includes: and carrying out compression encryption on the full data by adopting an MD5 encryption mode to obtain a 16-bit second hash value.
In another aspect, the present invention provides a museum service data storage system based on a block chain, including:
the block chain network is composed of a plurality of network nodes, constructs and runs a distributed account book and is used for storing data numbers and first hash values corresponding to the museum business data in the museum business data storage method based on the block chain;
the system comprises a chain down server, a block chain-based museum service data storage method and a chain down server, wherein the chain down server is used for operating a distributed relational database and storing or inquiring the total data corresponding to the museum service data in the museum service data storage method based on the block chain; after the full data is obtained through query, carrying out character string hashing on the full data to obtain a third hash value, and retrieving the block chain network according to the data number in the full data to obtain a corresponding first hash value; and comparing the first hash value with the third hash value, if the first hash value and the third hash value are consistent, the full-size data is legal, the verification is prompted to pass, and the full-size data is output.
In some embodiments, the nodes on the blockchain network store the data number and the first hash value using a LevelDB database or a CouchDB database, and the distributed relational database is a TiDB database.
In another aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method when executing the program.
The invention has the beneficial effects that:
in the method and the system for storing and inquiring the museum service data based on the block chain, the storage method adopts a distributed relational database to store the whole amount of data containing the museum service data and the data number under the chain, simultaneously constructs the block chain network, and stores a first hash value obtained by hashing the whole amount of data and the data number on the block chain network; the query method is characterized in that when the full amount of data corresponding to the museum service data is queried and retrieved through the distributed relational database, the corresponding first hash value is queried on the block chain network, and the full amount of data corresponding to the museum service data is hashed and then compared with the first hash value, so that the integrity and consistency of the data are verified, whether the data are legal or not is confirmed, and the data are prevented from being tampered.
By establishing a distributed relational database under the chain, for large-scale data storage, the block pressure of block chain storage can be reduced, the tracing efficiency is improved, and the response speed of query is improved; the distributed structure has great expansibility on the application of inter-museum data sharing and tracing of a plurality of museum nodes, and the establishment of the distributed cluster is consistent with the establishment of multi-museum node data storage.
Additional advantages, objects, and features of the invention will be set forth in part in the description which follows and in part will become apparent to those having ordinary skill in the art upon examination of the following or may be learned from practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
It will be appreciated by those skilled in the art that the objects and advantages that can be achieved with the present invention are not limited to the specific details set forth above, and that these and other objects that can be achieved with the present invention will be more clearly understood from the detailed description that follows.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the principles of the invention. In the drawings:
fig. 1 is a logic diagram of a museum service data storage method based on a block chain according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a method for storing museum service data based on a block chain according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a museum service data query method based on a block chain according to an embodiment of the present invention;
fig. 4 is a logic diagram of a museum service data storage method based on a block chain according to another embodiment of the present invention;
fig. 5 is a schematic flowchart of a museum service data query method based on a block chain according to another embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to the following embodiments and accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
It should be noted that, in order to avoid obscuring the present invention with unnecessary details, only the structures and/or processing steps closely related to the scheme according to the present invention are shown in the drawings, and other details not so relevant to the present invention are omitted.
It should be emphasized that the term "comprises/comprising" when used herein, is taken to specify the presence of stated features, elements, steps or components, but does not preclude the presence or addition of one or more other features, elements, steps or components.
The content of museum service data is complex, the requirements for the safety and traceability of museum service data circulation are high based on the high safety requirement of cultural relic protection, and the introduction of a block chain for storage can be considered to ensure the information safety. The block chain technology can provide a set of safe and credible solution for museum data sharing by virtue of the characteristics of decentralization, non-tampering and traceability, so that a credible value network is established by core technologies such as point-to-point distributed accounts, a multipoint common identification mechanism, an intelligent contract, asymmetric encryption and the like. However, as the collection data of the museum is increasing, new collection business process data are linked up every day, and the data of each business process are heterogeneous, if all the data are stored on the blockchain, the blockchain load is large, and the operation cost is increased. Moreover, as the number of nodes increases over time, the overall data grows exponentially, making the query inefficient if the data is stored on a blockchain.
Therefore, the method and the system for storing and querying the museum service data based on the block chain are used for constructing the method and the system for synchronously storing and querying the museum service data based on the block chain network, realizing the safe storage of the museum service data and simultaneously checking the integrity and the safety of the data under the chain by using the data on the chain.
Specifically, it should be noted in advance that the blockchain is a shared database formed by connecting a plurality of nodes together, and the data or information stored in the shared database has characteristics of "anti-counterfeiting", "whole-course trace", traceability "," public transparency ", and" collective maintenance ". Applications of blockchains are classified into public, alliance, and private chains according to the openness and decentralization degree of the chain. Each node on the public chain can freely join and leave the network, and participates in reading and writing of data on the chain, the reading and writing are interconnected and intercommunicated in a flat topological structure, and no centralized service end node exists in the network. Each node of the federation chain usually has a corresponding entity organization, and can join and leave the network only after authorization. Organizations form interest-related alliances that collectively maintain healthy operation of blockchains. The write-in authority of each node in the private chain is controlled internally, and the read authority is selectively opened to the outside according to requirements. The block chain project based on the alliance chain and the private chain mainly uses a hyper ledger (hyper folder Fabric).
The hyper Ledger (hyper Ledger Fabric) is an open-source enterprise-level permission Distributed Ledger Technology (DLT) platform, which is designed for use in an enterprise environment, and compared with other popular Distributed Ledger or blockchain platforms, the Fabric has a highly modular and configurable architecture, which can provide innovativeness, diversity and optimization for businesses of various industries, and the Fabric is the first Distributed Ledger platform supporting general programming language writing of intelligent contracts (such as Java, Go and node. js), and also supports pluggable consensus protocols, so that the platform can be customized more effectively to adapt to specific business scenarios and trust models. Because the privacy problem of the data in the museum is limited to the internal sharing of the museum, the application of the museum can be realized by adopting the super ledger technology when a block chain network is constructed.
Specifically, the invention provides a museum service data storage method based on a block chain, which is used for synchronous operation on a block chain network chain and a down-chain server, and as shown in fig. 1 and fig. 2, the method comprises the following steps of S101-S104:
it should be emphasized that, in this embodiment, the steps S101 to S104 are not limited to the order of the steps, and it should be understood that, in a specific application scenario, the steps may be performed in parallel or the order may be changed.
S101: and acquiring the service data of the museum, and configuring a data number corresponding to the service data of the museum according to a preset rule.
S102: and carrying out character string hashing on the total data containing the museum service data and the corresponding data numbers according to a set algorithm to obtain a first hash value.
S103: and taking the data number as a row key, taking the first hash value as a numerical value, forming a key value pair, and storing the key value pair into a key value database on the chain through the nodes of the block chain network.
S104: the full amount of data is stored in a distributed relational database under the blockchain network chain.
And the first hash value stored on the chain is used for checking the legality of the full data in the distributed relational database under the chain.
In step S101, the museum service data is diversified heterogeneous data, and the heterogeneous data is represented by: heterogeneous computer architectures, heterogeneous operating systems, heterogeneous data formats, heterogeneous data storage locations, and heterogeneous logical models of data storage. The museum service data comprises digital data, image data and other contents of the collection, and also comprises collection service flow data, such as collection in and out records, collection borrowing, information modification and the like. Due to the high requirement on safety in the cultural relic protection process, the museum business data also have high requirement on safety. And in the process of storing the new museum service data, configuring each piece of data with a corresponding data number by adopting a preset rule configuration. The preset rule can be self-defined, each piece of data is marked according to a set coding format, for example, a 14-bit number mark can be adopted, wherein 1-2 bits mark the identity of the museum main body by using characters, 3-8 bits mark the year, month and day, 9-10 bits mark time intervals and 11-14 bits mark data ordinal numbers, for example, "RT 210721060036" indicates that 36 th information is generated in the 6 th time interval of 7, 21 and 21 days of 2021 year by a museum with the code "RT". In other embodiments, other rules may be used to generate the code.
In step S102, the museum service data and the corresponding data code are connected to obtain the total data. Because the data code is unique, even if the content of the museum service data is completely the same, the corresponding full amount of data is unique. Further, the data obtained by compressing and encrypting the whole amount of data is also unique. The character string hashing is to convert and map various data with different lengths into data with a fixed length, and the mapping is one-to-one correspondence and is unidirectional. The hash value X is easy to compute for a given data M, whereas a given X cannot compute M. The hashing can output completely different hash values for only a small amount of different data, and has great superiority for verifying the integrity of the data.
In some embodiments, in step S102, performing a string hash on the full-size data including the museum service data and the corresponding data number to obtain a first hash value, including: the full data is compressed and encrypted by adopting an MD5 encryption mode to obtain a 16-bit first hash value. In other embodiments, other hash algorithms may be used to verify the data.
In step S103 and step S104, based on the multi-node constructed blockchain network, a decentralized, non-tamper-able and traceable data network capable of storing data in a distributed manner is formed. Due to the fact that the whole data volume of the museum service data is large, the data structure is complex, and the query efficiency is extremely low if the museum service data are stored on a chain. Therefore, in the present application, only the data label and the first hash value corresponding to the museum service data are stored on the chain, and the full amount of data corresponding to the museum service data is stored in the server under the chain. The first hash value on the chain is only used for checking the integrity and the legality of the data under the chain. In some embodiments, the key-value database that may be employed by the nodes on the chain is a LevelDB database or a CouchDB database. The levelDB is a persistent key value single-machine database of Google open source and has high random writing and sequential reading/writing performance. CouchDB is a database facing documents, stores semi-structured data, is more similar to lucene index structure, and is particularly suitable for storing documents. The two database types have good effect on storing and inquiring the comparison data of the data number and the first hash value.
Specifically, the data number is used as a row key, the first hash value is used as a numerical value to form a key value pair, and the key value pair is stored in a key value database on the block chain network chain.
Further, the full amount of the museum business data is stored in the down-link server and is stored based on the distributed relational database. In some embodiments, the distributed relational database is a TiDB database. The TiDB is an open-source distributed relational database, has important characteristics of horizontal capacity expansion or capacity reduction, high financial level availability, cloud native distributed database, MySQL5.7 protocol and MySQL ecology compatibility and the like, and is suitable for various application scenarios with high availability, high consistency requirement, large data scale and the like.
And because the TiDB is a distributed database, the topological structure of the cluster can be customized, and the TiDB can be matched with the nodes of the block chain platform for use in a production environment. Due to the heterogeneity of museum collection data and business process data, the diversity of query schemes is very important, if only a key-value query mode the same as that of a state database on a chain is adopted, the limitation is more, and the storage of the TiDB on the bottom layer adopts a key-value pair mode, but the query mode of a relational database can be supported, the query function of a block chain system is enriched, and the query method is optimized. Therefore, the TiDB is adopted as the down-link database, so that the storage load of data on the block chain is reduced, and the query diversity is improved.
On the other hand, the invention provides a museum service data query method based on a blockchain, which corresponds to the steps S101 to S104 and is used for synchronous operation on a blockchain network chain and a server under the blockchain, as shown in fig. 3, the method comprises the steps S201 to S204:
it should be emphasized that, in this embodiment, the steps S201 to S204 are not limited to the order of the steps, and it should be understood that, in a specific application scenario, the steps may be performed in parallel or the order may be changed.
Step S201: and searching the total data of the service data of the target museum by adopting the distributed relational database in the museum service data storage method based on the block chain in the steps S101-S104.
Step S202: and carrying out character string hashing on the full data according to a set algorithm to obtain a second hash value.
Step S203: and acquiring a data number in the total data, retrieving the data number on the chain of the block chain network of the museum service data storage method based on the block chain in the steps S101-S104, and inquiring a corresponding first hash value.
Step S204: and comparing the first hash value with the second hash value, if the first hash value and the second hash value are consistent, the full data is legal, the verification is prompted to pass, and the full data of the service data of the target museum is output.
In step S201, since the total amount of the target museum service data is described under the chain, the distributed relational database under the chain needs to be searched first for the acquisition of the total amount of data. After the full amount of data of the service data of the target museum is obtained, the full amount of data needs to be further checked by using an account book recorded on the block chain network, so as to ensure the integrity and the legality of the data.
In step S202, the full amount of data retrieved from the distributed relational database under the link is subjected to string hashing according to a set algorithm to obtain a second hash value for verification. Wherein the setting algorithm should be the same as the algorithm for calculating the first hash value in step S102. Specifically, performing string hashing on the full data to obtain a second hash value includes: and carrying out compression encryption on the full data by adopting an MD5 encryption mode to obtain a 16-bit second hash value.
In step S203, the data number described in the entire amount of data is acquired, and a search is performed on the chain of the blockchain network based on the data number to search for the first hash code of the target museum service data on the chain.
In step S204, the legitimacy of the full amount of data of the target museum service data searched under the link is determined by comparing the first hash value with the second hash value. If the data is consistent with the data, the data is proved to be identical with the data written in the whole volume, and the data is legal, has not been tampered and has no data loss. Correspondingly, in step S204, after comparing the first hash value with the second hash value, the method further includes: if the data is inconsistent, the full data is illegal, and the fact that the full data is tampered is prompted.
In another aspect, the present invention provides a museum service data storage system based on a block chain, including:
and a block chain network consisting of a plurality of network nodes, wherein the block chain network constructs and runs a distributed account book for storing the data numbers and the first hash values corresponding to the museum service data in the museum service data storage method based on the block chain in the steps S101 to S104.
The system comprises a chain server and a database server, wherein the chain server is used for operating a distributed relational database, and storing or inquiring the total data corresponding to the service data of each museum in the museum service data storage method based on the block chain in the steps S101-S104; after the full data is obtained through query, carrying out character string hashing on the full data to obtain a third hash value, and searching a block chain network according to a data number in the full data to obtain a corresponding first hash value; and comparing the first hash value with the third hash value, if the first hash value and the third hash value are consistent, the full data is legal, the verification is prompted to pass, and the full data is output.
In this embodiment, a block chain network formed by network nodes may construct a hyper ledger (hyper ledger Fabric), where the hyper ledger is a platform of a distributed ledger solution, and a modular architecture is adopted to provide high security, elasticity, flexibility, and expandability. It is designed to support the implementation of different components in a pluggable manner and to accommodate complex economic ecosystems. To support updating information in the same way and to enable all the functions (transactions, queries, etc.) controlling the ledger, blockchain networks provide controlled access to the ledger using intelligent contracts, which are not only key mechanisms for encapsulating and simplifying information in the network, but which can also be written as contracts for automatically performing specific transactions of participants. A consensus mechanism is established, the process of keeping ledgers synchronized throughout the network, called consensus, ensures that ledgers are updated only when transactions are approved by the respective participants, and when ledgers are updated, the nodes update the same transactions in the same order. The nodes in the block chain network comprise Peer nodes and order nodes, wherein the Peer nodes are basic elements of the network and store an account book and an intelligent contract. Peer nodes can be created, started, stopped, reconfigured, or even deleted. They expose a series of APIs (Application Programming interfaces) that allow managers and applications to interact with the services provided by these APIs. The Order node is a network node providing consensus service, global ordering is carried out on all legal transactions in the network, and a batch of ordered transactions are combined to generate a block structure. A channel of a hyper ledger is a dedicated "subnet" of communications between two or more specific network members for conducting private and confidential transactions. The channel is defined by the members (organization), anchor nodes for each member, shared ledgers, chain code applications, and sequencing service nodes. Each transaction on the network is performed over a channel over which each party must be authenticated and authorized to conduct the transaction.
In some embodiments, the nodes on the blockchain network store the data number and the first hash value using a LevelDB database or a CouchDB database, and the distributed relational database is a TiDB database.
In another aspect, the present invention provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the steps of the method when executing the program.
The invention is illustrated below with reference to a specific example:
the embodiment provides a museum business data storage and query method based on a block chain. The on-chain storage module sets and runs a block chain state database, and the off-chain storage module sets and runs an off-chain distributed database.
For the on-chain storage module, the block chain platform adopted in this embodiment is a super account book platform, and the storage of the super account book platform is divided into the state database storage of the on-chain node and the storage of the on-chain block transaction information. Nodes stored in the chain mainly adopt peer nodes, and after the peer nodes are deployed on the docker, the peer nodes in the same channel can ensure the consistency of data, and ensure that the data stored in respective databases are the same. The databases available on the Peer node are a LevelDB database and a CouchDB database, and both are key value pair forms for storing data, so that json type data storage is convenient. The CouchDB increases the function of data query compared with a levelDB database, and can query a plurality of results according to partial keywords of a key. The sequencing service of block storage on the chain mainly uses an order node, the order node is responsible for sequencing the transactions transmitted to the block chain, when the information of one data forms the transactions according to the rule of an intelligent contract and sends the transactions to a block chain network, the order node can carry out preprocessing and inform all peer nodes, whether the transactions pass or not is judged according to an endorsement strategy, only the passed transactions can be stored in the state database of all the peer nodes, and all the transactions can be stored on the block chain to form a log. In order to obtain effective data and ensure the correctness of the data, the CouchDB is used as an on-chain state database of the peer node and is responsible for storing compressed museum collection data and collection service flow data.
In the data storage process, as shown in fig. 4, the working steps of the on-chain storage module include: the method comprises the steps of firstly obtaining the Tibetan data needing to be linked up from a browser and a client interface, adding a data number to form full data, carrying out character connection on the full data corresponding to the Tibetan data to form a character string, wherein the serial number of the Tibetan data is unique, and even if other data are the same, the compressed and encrypted data is unique. In consideration of the storage length of the block chain, the compression process adopts an MD5 encryption mode, the character strings of all data are hashed into 16-bit hash codes, then an intelligent contract is executed, the data number of the collection data is used as a key value, the encrypted hash codes are used as value values, and a key value pair is formed and stored in the block chain. And the full amount of the collection data is stored in the down-chain storage module.
For the offline storage module, a TiDB database is selected as the offline database for storage, the TiDB is an open-source distributed relational database, has important characteristics of horizontal capacity expansion or capacity reduction, high financial level availability, real-time HTAP, a cloud native distributed database, compatibility with MySQL5.7 protocol, MySQL ecology and the like, and is suitable for various application scenarios with high availability, high strong consistency requirement, large data scale and the like. And because the TiDB is a distributed database, the topological structure of the cluster can be customized, and the TiDB can be matched with the nodes of the block chain platform for use in a production environment. Due to the heterogeneity of museum collection data and business process data, the diversity of query schemes is very important, if only a key-value query mode the same as that of a state database on a chain is adopted, the limitation is more, and the storage of the TiDB on the bottom layer adopts a key-value pair mode, but the query mode of a relational database can be supported, the query function of a block chain system is enriched, and the query method is optimized. Therefore, the TiDB is adopted as the down-link database, so that the storage load of data on the block chain is reduced, and the query diversity is improved.
In the query process, as shown in fig. 5, since the total data of the museum collection and collection business process is stored under the blockchain, in order to ensure the tamper-proof property of using the blockchain technology, in the process of querying the data each time, the total data corresponding to the collection data stored in the TiDB database of the storage module under the chain is subjected to character string splicing, then MD5 encryption similar to the uplink is performed, the hash value (value) recorded on the chain of the collection data is obtained according to the obtained hash value and the query of the state database on the blockchain according to the data number (key), and the comparison is performed, and if the hash value and the data number (key) are not consistent, the collection data is proved to be tampered and changed.
Specifically, the building of the block chain network on the chain and the database under the chain comprises the steps 1) to 3):
1) building a block chain Hyperdger Fabric platform: installing docker and docker-compound on a server, compiling a configx.yaml configuration file, generating an created block of a block chain system chain code, a configuration file of a newly-built channel and a configuration file of an anchor node in an organization by using a configxgen tool, configuring a Fabric ca to generate a related certificate file of a corresponding user in a block chain network, creating an applied channel, adding a node deployed in the docker into the channel, and installing the chain code on the corresponding node, namely an intelligent contract of a super account book.
2) Deploying the down-link database: after the Mysql is installed on the server, the TiDB cluster is deployed according to a configuration file of the initialized cluster topology by using TiUP, and the TiDB database is used as a down-chain database of the museum block to store the total data of museum collections and the business processes thereof.
3) Front and back ends of the deployment project: the method includes the steps that a rear-end frame is built by using SpringBoot, Mybatis is integrated, a Service layer is completed, when museum collection data are transmitted into the museum collection data, the total collection data are stored in a TiDB (database data base) under a chain, then MD5 encryption is carried out, and the total collection data are stored in a block chain after hash.
In summary, in the method and system for storing and querying the museum service data based on the block chain, the storage method adopts the distributed relational database to store the whole amount of data including the museum service data and the data number under the chain, and simultaneously constructs the block chain network, and stores the first hash value obtained by hashing the whole amount of data and the data number on the block chain network; the query method is characterized in that when the full amount of data corresponding to the museum service data is queried and retrieved through the distributed relational database, the corresponding first hash value is queried on the block chain network, and the full amount of data corresponding to the museum service data is hashed and then compared with the first hash value, so that the integrity and consistency of the data are verified, whether the data are legal or not is confirmed, and the data are prevented from being tampered.
By establishing a distributed relational database under the chain, for large-scale data storage, the block pressure of block chain storage can be reduced, the tracing efficiency is improved, and the response speed of query is improved; the distributed structure has great expansibility on the application of inter-museum data sharing and tracing of a plurality of museum nodes, and the establishment of the distributed cluster is consistent with the establishment of multi-museum node data storage.
Those of ordinary skill in the art will appreciate that the various illustrative components, systems, and methods described in connection with the embodiments disclosed herein may be implemented as hardware, software, or combinations of both. Whether this is done in hardware or software depends upon the particular application and design constraints imposed on the solution. 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. When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, plug-in, function card, or the like. When implemented in software, the elements of the invention are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine-readable medium or transmitted by a data signal carried in a carrier wave over a transmission medium or a communication link. A "machine-readable medium" may include any medium that can store or transfer information. Examples of a machine-readable medium include electronic circuits, semiconductor memory devices, ROM, flash memory, Erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, Radio Frequency (RF) links, and so forth. The code segments may be downloaded via computer networks such as the internet, intranet, etc.
It should also be noted that the exemplary embodiments mentioned in this patent describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, may be performed in an order different from the order in the embodiments, or may be performed simultaneously.
Features that are described and/or illustrated with respect to one embodiment may be used in the same way or in a similar way in one or more other embodiments and/or in combination with or instead of the features of the other embodiments in the present invention.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the present invention, and various modifications and changes may be made to the embodiment of the present invention by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A museum service data storage method based on a block chain is characterized by comprising the following steps:
acquiring museum service data, and configuring a data number corresponding to the museum service data according to a preset rule;
carrying out character string hashing on the total data containing the museum service data and the corresponding data numbers according to a set algorithm to obtain a first hash value;
the data numbers are used as row keys, the first hash values are used as numerical values, key value pairs are formed and stored in a key value database on a chain through nodes of a block chain network;
storing the full data in a distributed relational database under the blockchain network chain;
and the first hash value stored on the chain is used for checking the legality of the full data in the distributed relational database under the chain.
2. The method for storing museum service data based on a blockchain according to claim 1, wherein the step of performing character string hashing on the total data including the museum service data and corresponding data numbers to obtain a first hash value comprises the steps of:
and carrying out compression encryption on the full data by adopting an MD5 encryption mode to obtain a 16-bit first hash value.
3. The method for storing museum service data based on block chains according to claim 1, wherein the key value database is a LevelDB database or a CouchDB database.
4. The method for storing museum service data based on block chains according to claim 1, wherein the distributed relational database is a TiDB database.
5. A museum service data query method based on a block chain is characterized by comprising the following steps:
the method for storing the service data of the museum based on the block chain comprises the steps of adopting a distributed relational database in the method for storing the service data of the museum based on the block chain according to any one of claims 1 to 4 to retrieve the full amount of service data of a target museum;
carrying out character string hashing on the full data according to a set algorithm to obtain a second hash value;
acquiring a data number in the full data, retrieving the data number on a chain of a block chain network of the block chain-based museum service data storage method according to any one of claims 1 to 4, and querying a corresponding first hash value;
and comparing the first hash value with the second hash value, if the first hash value and the second hash value are consistent, the full data is legal, the verification is prompted to pass, and the full data of the target museum service data is output.
6. The method for querying museum service data based on blockchain according to claim 5, wherein comparing the first hash value and the second hash value further comprises: and if the data is inconsistent, the full data is illegal, and the full data is prompted to be tampered.
7. The method for querying museum service data based on the blockchain according to claim 5, wherein the step of performing string hashing on the full-size data to obtain a second hash value comprises: and carrying out compression encryption on the full data by adopting an MD5 encryption mode to obtain a 16-bit second hash value.
8. A museum business data storage system based on a blockchain, comprising:
the system comprises a blockchain network consisting of a plurality of network nodes, wherein the blockchain network constructs and runs a distributed account book and is used for storing a data number and a first hash value corresponding to each museum service data in the museum service data storage method based on the blockchain according to any one of claims 1 to 4;
the system comprises a chain down server, a database management server and a database management server, wherein the chain down server is used for operating a distributed relational database and storing or inquiring the total data corresponding to the service data of each museum in the museum service data storage method based on the block chain according to any one of claims 1 to 4; after the full data is obtained through query, carrying out character string hashing on the full data to obtain a third hash value, and retrieving the block chain network according to the data number in the full data to obtain a corresponding first hash value; and comparing the first hash value with the third hash value, if the first hash value and the third hash value are consistent, the full-size data is legal, the verification is prompted to pass, and the full-size data is output.
9. The blockchain-based museum business data storage system of claim 8, wherein the nodes on the blockchain network store the data number and the first hash value using a LevelDB database or a CouchDB database, and the distributed relational database is a TiDB database.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method according to any of claims 1 to 7 are implemented when the processor executes the program.
CN202110950541.0A 2021-08-18 2021-08-18 Museum service data storage and query method and system based on block chain Pending CN113392144A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110950541.0A CN113392144A (en) 2021-08-18 2021-08-18 Museum service data storage and query method and system based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110950541.0A CN113392144A (en) 2021-08-18 2021-08-18 Museum service data storage and query method and system based on block chain

Publications (1)

Publication Number Publication Date
CN113392144A true CN113392144A (en) 2021-09-14

Family

ID=77623000

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110950541.0A Pending CN113392144A (en) 2021-08-18 2021-08-18 Museum service data storage and query method and system based on block chain

Country Status (1)

Country Link
CN (1) CN113392144A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114547641A (en) * 2022-01-05 2022-05-27 山东浪潮工业互联网产业股份有限公司 Industrial data tracking method, device, equipment and medium based on block chain
CN115438046A (en) * 2022-08-25 2022-12-06 北京万里开源软件有限公司 Distributed storage method based on HTAP database
CN116611851A (en) * 2023-07-18 2023-08-18 四川远方云天食品科技有限公司 Hotpot condiment product tracing method and system based on blockchain
WO2023178728A1 (en) * 2022-03-24 2023-09-28 香港大学深圳研究院 Museum cultural relic traceability method and system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180025181A1 (en) * 2016-07-21 2018-01-25 Acronis International Gmbh System and method for verifying data integrity using a blockchain network
CN107728941A (en) * 2017-09-28 2018-02-23 中国银行股份有限公司 A kind of block chain data compression method and system
CN108573741A (en) * 2017-12-25 2018-09-25 北京金山云网络技术有限公司 Business datum recording method, device, equipment and storage medium
CN111259448A (en) * 2020-01-17 2020-06-09 中国建设银行股份有限公司 Data sharing method and device
CN111339206A (en) * 2020-03-11 2020-06-26 中国建设银行股份有限公司 Data sharing method and device based on block chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180025181A1 (en) * 2016-07-21 2018-01-25 Acronis International Gmbh System and method for verifying data integrity using a blockchain network
CN107728941A (en) * 2017-09-28 2018-02-23 中国银行股份有限公司 A kind of block chain data compression method and system
CN108573741A (en) * 2017-12-25 2018-09-25 北京金山云网络技术有限公司 Business datum recording method, device, equipment and storage medium
CN111259448A (en) * 2020-01-17 2020-06-09 中国建设银行股份有限公司 Data sharing method and device
CN111339206A (en) * 2020-03-11 2020-06-26 中国建设银行股份有限公司 Data sharing method and device based on block chain

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114547641A (en) * 2022-01-05 2022-05-27 山东浪潮工业互联网产业股份有限公司 Industrial data tracking method, device, equipment and medium based on block chain
CN114547641B (en) * 2022-01-05 2024-04-26 浪潮工业互联网股份有限公司 Industrial data tracking method, device, equipment and medium based on block chain
WO2023178728A1 (en) * 2022-03-24 2023-09-28 香港大学深圳研究院 Museum cultural relic traceability method and system
CN115438046A (en) * 2022-08-25 2022-12-06 北京万里开源软件有限公司 Distributed storage method based on HTAP database
CN116611851A (en) * 2023-07-18 2023-08-18 四川远方云天食品科技有限公司 Hotpot condiment product tracing method and system based on blockchain

Similar Documents

Publication Publication Date Title
US11893584B2 (en) Constraining injection of unlocking transaction bytecode
US20230122875A1 (en) User controlled storage and sharing of personal user information on a blockchain
CN113392144A (en) Museum service data storage and query method and system based on block chain
JP6830549B2 (en) Blockchain World State Markle Patricia Trie (WORLD STATE MERKLE PATRICIA TRIE) Subtsu
CN110135986B (en) Method for realizing searchable encrypted file data based on blockchain intelligent contract
CN103595730B (en) A kind of ciphertext cloud storage method and system
US20190288847A1 (en) Industrial data verification using secure, distributed ledger
Das et al. A secure and distributed construction document management system using blockchain
CN115769241A (en) Privacy preserving architecture for licensed blockchains
CN112287033B (en) Data synchronization method, equipment and computer readable storage medium
Yadav et al. KYC optimization using blockchain smart contract technology
CN111651525A (en) Block chain data storage method and device
Wrona et al. Use of blockchains for secure binding of metadata in military applications of IoT
CN110942305A (en) Real estate information management method and device based on block chain
CN113627809A (en) Medical waste supervision system and method based on block chain
CN112069529B (en) Block chain-based volume management method and device, computer and storage medium
CN112966049B (en) Asset management system based on block chain
CN115203138A (en) Data retrieval method, device and storage medium
CN116405188B (en) Block chain-based insurance application flow data storage method and system
Shi et al. AUDITEM: toward an automated and efficient data integrity verification model using blockchain
US20230247018A1 (en) System and method for secure electronic document exchange and execution of contracts via a secure electronic platform with biometric access verification
Peng Application and research of blockchain technology in P2P network distributed data storage
Sonawane et al. Enriching Trustworthy trade in Decentralized system using Blockchain
CN116846674A (en) DAG-based high-throughput distributed account book system
CN116089463A (en) Full text searching method and device in 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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210914