CN115408474A - Block chain mass data storage certificate system and method for multi-source database - Google Patents

Block chain mass data storage certificate system and method for multi-source database Download PDF

Info

Publication number
CN115408474A
CN115408474A CN202211365183.8A CN202211365183A CN115408474A CN 115408474 A CN115408474 A CN 115408474A CN 202211365183 A CN202211365183 A CN 202211365183A CN 115408474 A CN115408474 A CN 115408474A
Authority
CN
China
Prior art keywords
data
block chain
chain
field
module
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.)
Granted
Application number
CN202211365183.8A
Other languages
Chinese (zh)
Other versions
CN115408474B (en
Inventor
周炜
高礼杰
张东来
李金良
王宏杰
刘凯
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Technology Chain Guangdong Technology Co ltd
Dragon Totem Technology Hefei Co ltd
Original Assignee
Qingdao University of Technology
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 Qingdao University of Technology filed Critical Qingdao University of Technology
Priority to CN202211365183.8A priority Critical patent/CN115408474B/en
Publication of CN115408474A publication Critical patent/CN115408474A/en
Application granted granted Critical
Publication of CN115408474B publication Critical patent/CN115408474B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • 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)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a block chain mass data evidence storing system and method for a multi-source database, and relates to the field of block chains. The invention uses a small amount of intelligent contracts to link the data containing the main key in any database for storing the certificates, dynamically expands the forms of the stored certificate data and queries the data change records in a chained mode, thereby solving the problems of centralized certificate storage system power, easy data tampering, single certificate-storing data form, complicated expansion of certificate-storing data form and increased intelligent contract quantity.

Description

Block chain mass data storage certificate system and method for multi-source database
Technical Field
The invention relates to the technical field of block chains, in particular to a multi-source database-oriented block chain mass data storage system and a multi-source database-oriented block chain mass data storage method.
Background
The blockchain technology appears in the field of view of the public at first in the form of digital currency, and with the intensive research on the blockchain technology, the blockchain technology has been developed to have the characteristics of decentralization, openness and transparency, incapability of tampering on-chain data and the like, and has good applicability and application value in a plurality of scenes such as supply chain finance, data storage, product traceability and the like.
In the traditional evidence storing system, a user submits evidence storing data to an evidence storing mechanism, the evidence storing data is stored by the evidence storing mechanism instead, and the traditional evidence storing system belongs to centralized storage data, and if the storage system of the mechanism is attacked, the evidence storing data is easily tampered. Most of the existing block link evidence-storing systems are customized and developed aiming at single service scenes, and only can store and verify the information of electronic invoices or transaction records with fixed formats, and the format of the data for storing the evidence is single. The extension of the testable content needs to be continuously updated and maintained on the basis of the original intelligent contract, or a new testable intelligent contract is developed again aiming at the new content needing testable, so that the function extension is complicated, the number of the intelligent contracts can be continuously increased, the operation burden of a block chain is increased, and the operation efficiency of the block chain is influenced. If the data in the existing database is stored and chain-linked, the data must be read, processed according to the specification received by the intelligent contract and then uploaded to the block chain. If the data content stored in a certain field in the database in the service system is more critical, but the field is not defined in advance in the intelligent contract, the data needs to be spliced and recombined to meet the requirement of the intelligent contract receiving specification. However, the data is modified at this time, and the blockchain can only ensure that the data on the chain cannot be tampered, and cannot supervise the data modified under the chain, and there may be a risk of data tampering in the meantime.
Aiming at the problems that the authority of a centralized evidence storing system is centralized and data is easy to be distorted when a related evidence storing system is used, but the existing block chain evidence storing system has single evidence storing data form, complicated evidence storing data form expansion and increased intelligent contract quantity, an effective solution is not provided.
Disclosure of Invention
In order to overcome the problems in the prior art, the invention provides a block chain mass data storage certificate system and a block chain mass data storage certificate method for a multi-source database.
The technical scheme adopted by the invention for solving the technical problems is as follows: a block chain mass data storage and certification system facing a multi-source database comprises a data preprocessing subsystem, a data uploading subsystem, a block chain interaction subsystem and a certificate returning subsystem, wherein the data preprocessing subsystem is responsible for screening uplink table information in the database, the data uploading subsystem is responsible for reading data in the database and pushing the data to the block chain interaction subsystem, the block chain interaction subsystem provides functions of on-chain user management, data table management and certification storage data management, and the certificate returning subsystem is responsible for returning data uplink certificates generated by a block chain to the database after the data are written into the block chain;
the block chain interaction subsystem comprises a block chain user module, a chain upper table management module and a chain upper data management module, wherein the block chain user module provides functions of block chain user registration and block chain user login, the chain upper table management module provides functions of newly building a chain upper data table, listing a chain upper data table name, inquiring chain upper data table configuration, modifying chain upper data table fields and modifying chain upper data table names, and the chain upper data management module provides functions of newly adding chain upper data, deleting chain upper data, modifying chain upper data and inquiring chain upper data.
The block chain mass data storage and certification system for the multi-source database comprises a data preprocessing subsystem and a data certification subsystem, wherein the data preprocessing subsystem comprises a database connection module and a table screening module, the database connection module is used for loading corresponding database connection drivers according to database connection information input by a user, and pushing the database connection information which can be connected to the data preprocessing subsystem and the certification back-transmission subsystem; the table screening module is used for screening a data table meeting the block chain table building standard, pushing a table name meeting the standard to the data uploading subsystem, and pushing table building information meeting the standard to the table building module of the block chain interaction subsystem.
The block chain mass data storage and verification system for the multi-source database comprises a data reading module and a data pushing module, wherein the data reading module is used for automatically reading all field names and corresponding field values of each piece of data in a table after receiving database connection information and table names meeting a table building standard; and the data pushing module is used for pushing the read data to an on-chain data management module of the block chain interaction subsystem.
When the block chain mass data storage and verification system for the multi-source database is used for performing on-chain data adding operation, the on-chain data management module can automatically record the current time, the user address of added data and the Hash value of the current data storage and verification, adds separators to three pieces of information, and splices the three pieces of information into a field value to write the field value into a data operation information field; when the on-chain data management module carries out on-chain data modification operation, the on-chain data management module can automatically judge whether a user address is consistent with a user address written in the newly added user address, if not, the data is not allowed to be modified, if so, the data is modified according to the provided table name, the primary key name and the corresponding primary key value positioning data, and according to the provided field name and the field value, other fields which are not provided can inherit the original content by default, and are not modified and cannot be changed; when the data is modified, the on-chain data management module can automatically record the current time, the user address of the modified data, the Hash value of the current data certificate and the Hash value recorded last time of the data, add separators to the four pieces of information, and splice the four pieces of information into a field value to be written into a data operation information field; for the data uploaded to the blockchain, a user can only modify the common field value existing on the blockchain and cannot modify the main key value and the value of the data operation information.
In the block chain mass data storage system oriented to the multi-source database, the on-chain data query function of the on-chain data management module simultaneously supports two query modes, namely, a primary key query mode and a Hash query mode.
The system for storing and verifying the massive data of the block chain facing the multi-source database comprises a credential return subsystem and a credential module, wherein the credential return subsystem comprises a field adding module and a credential recording module, the field adding module is used for newly establishing a field for a table of currently uploaded data in the database, and the field is used for storing a Hash value generated when the data is written into the block chain; the voucher recording module is used for writing the Hash value into the newly added field of the corresponding data and storing the Hash value and the data together.
In the system for storing and verifying the massive data in the block chain oriented to the multi-source database, the on-chain management module and the on-chain data management module of the block chain interaction subsystem are realized by a layered intelligent contract, and include a data operation layer, a function realization layer and an external interaction layer;
the data operation layer comprises a basic contract which is provided by the block chain and directly carries out addition, deletion, modification and check on data on the chain; the function implementation layer comprises a function expansion contract and a tool library contract, the function expansion contract is used for performing function expansion on the contract of the data operation layer so as to realize the modularized distinguishing management of a block chain table and block chain data, and the tool library contract is used for providing a function code which is repeatedly multiplexed in the function expansion contract, reducing the repeatability of the contract code and improving the execution efficiency; the external interaction layer only has one intelligent contract which is used for calling the contract of the function realization layer and providing all functions of the table management module on the block chain and the data management module on the block chain.
The evidence storing method of the block chain mass data evidence storing system facing the multi-source database comprises an automatic full-amount evidence storing mode and a manual evidence storing mode, wherein the automatic full-amount evidence storing mode means that a user can designate a target database, the evidence storing system can automatically create a table containing a main key in the target database on a block chain, automatically upload data in the table to the block chain for evidence storing, and subsequently delete, modify and query uplink data;
the manual evidence storage mode means that a user can create a data table on a block chain by himself and then add, delete, modify and query data on the table.
The above method for storing massive data of a block chain for a multi-source database, the automatic full-volume storage mode includes the following steps:
step 1, a user sends a database type, a database name, a database connection address, a port, a user name and a password to a data preprocessing subsystem;
step 2, the data preprocessing subsystem screens out a table with a main key and pushes table building information of the table to the block chain interaction subsystem;
step 3, a data table newly-built module on the chain checks whether a table with the same name already exists on the block chain, if so, the table is not created, and if not, a table is created on the block chain according to the table name, the main key name and the common field name;
step 4, after the table is successfully established, the data uploading subsystem sends a table name to which the evidence storing data belongs, a field name of the evidence storing data and data corresponding to the field name to the chain data adding module of the block chain interaction subsystem;
step 5, the data newly-added module on the chain detects whether the data to be stored is in accordance with the standard, the standard comprises that the number of field names is consistent with the number of field values, the field names comprise primary key names, the primary key values are not repeated, all the field names are in a table, when the conditions are in accordance, the data is submitted by the data newly-added module on the chain, the data is written into the block chain after the nodes on the block chain are successfully identified, and the data is stored persistently, otherwise, the data is not stored;
step 6, after each data is successfully stored, the block chain returns a Hash value as a certificate of the data uplink, the certificate return subsystem adds a field in the table of the source database, and writes the Hash value into the field of the corresponding data;
and 7, after the data storage is successful, searching, modifying and deleting the data on the block chain.
The above method for storing the massive data of the block chain for the multi-source database, wherein the manual storage mode comprises the following steps:
step 1, a user pushes table building information to a block chain interaction subsystem;
step 2, a data table newly-built module on the chain checks whether a table with the same name already exists on the block chain, if so, the table is not created, and if not, a table is created on the block chain according to the table name, the main key name and the common field name;
step 3, after the table is successfully established, the user calls a link data adding function of the block link interaction subsystem, and pushes the table name to which the certificate storing data belongs, the field name of the certificate storing data and data corresponding to the field name;
step 4, the data newly-added module on the chain detects whether the data to be stored is in accordance with the standard, the standard comprises that the number of the field names is consistent with the number of the field values, the field names comprise primary key names, the primary key values are not repeated, all the field names are in the table, when the conditions are in accordance, the data is submitted by the data newly-added module on the chain, the data is written into the block chain after the nodes on the block chain are successfully identified, and the data is stored persistently, otherwise, the data is not stored;
step 5, after each piece of data succeeds in storing the certificate, the block chain returns a Hash value as a certificate of the data chaining, and a user needs to store the certificate by himself;
and 6, after the data storage is successful, searching, modifying and deleting the data on the block chain.
The method has the advantages that only a small amount of intelligent contracts are used, data containing a main key in any relational database can be linked for storing certificates, two automatic and manual certificate storing modes are supported, the form of the data certificates can be customized, the data in the automatic batch synchronous database can be supported to a block chain, data change records can be inquired in a chain mode, the form of certificate storing data can be dynamically expanded, the data change records can be inquired in a chain mode, and the problems that the authority of a centralized certificate storing system is centralized, the data is easy to be distorted, the certificate storing data form of the existing block chain certificate storing system is single, the certificate storing data form is expanded, and the number of intelligent contracts is increased are solved.
Drawings
The invention is further illustrated by the following examples in conjunction with the drawings.
FIG. 1 is a functional block diagram of the present invention;
FIG. 2 is a system architecture diagram of the present invention;
FIG. 3 is a flow chart of data preprocessing according to the present invention;
FIG. 4 is a block chain table building flow chart of the present invention;
FIG. 5 is a flow chart of data upload according to the present invention;
FIG. 6 is a flow chart of data addition according to the present invention;
FIG. 7 is a flowchart illustrating credential feedback according to the present invention;
FIG. 8 is a flowchart of data deletion according to the present invention;
FIG. 9 is a flow chart of data modification of the present invention;
FIG. 10 is a flow chart of data query according to the present invention;
FIG. 11 is a diagram of an intelligent contract architecture according to the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the present invention will be described in detail below with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1, the present embodiment discloses a blockchain massive data storage certification system for a multi-source database, which includes a data preprocessing subsystem, a data uploading subsystem, a certification returning subsystem, and a blockchain interaction subsystem. FIG. 2 is a system architecture diagram illustrating the general processes and functions of functional blocks for storing data in a database onto a blockchain according to the present invention. The data preprocessing subsystem screens table information capable of being linked in a database, the data uploading subsystem reads and uploads data in tables in batches and pushes the data to the block chain interaction subsystem, and the block chain interaction subsystem provides functions of on-chain user management, data table management and evidence storage data management. And the certificate returning subsystem returns the data chaining certificate generated by the block chain to the database after the data are written into the block chain.
The block chain interaction subsystem comprises a block chain user module, a chain upper table management module and a chain upper data management module. The block chain user module provides functions of block chain user registration and block chain user login, a user can obtain a randomly generated public key, a private key and an address from the block chain only through registration, and information on the chain is operated after login of the private key. All the operations of the user which change the data on the chain are recorded by the block chain and are permanently stored on the block chain.
The chain table management module comprises functions of chain table creation, chain table name list, chain table configuration query, chain table field modification and chain table name modification. Wherein the list of linked data table names function can query all data table names in the chain. When the chain table management module creates a table on the block chain, a data operation information field is automatically added. If the table primary key to be created only has one field, the chain table management module can directly take the field as the primary key and create the table; if the table to be created has a plurality of fields as the joint primary key, the chain table management module adds separators to the fields to be created and splices the fields into one field, and the spliced field is used as the primary key to create the table on the block chain.
The on-chain data management module comprises functions of on-chain data addition, on-chain data deletion, on-chain data modification and on-chain data query. When receiving data of multiple primary keys, the linked data management module can automatically add separators to the data of the primary keys and splice the data into complete primary key data for operation. When data is added newly, the current time, the user address of the added data and the Hash value of the current data certificate are automatically recorded, and separators are added to the three pieces of information and spliced into a field value to be written into a data operation information field. When the newly added function writes data, the data field to be written must contain all the primary keys of the table, and data with the same primary key value cannot be written into the same table. If a field is not uploaded, the value of the field is written into the table of the block chain in the form of an empty string by default, except for the primary key. The sequence of the field names of each piece of data can be inconsistent when the data is uploaded, but the sequence of the field names of the piece of data is consistent with the sequence of the field values and can be in one-to-one correspondence. When data is modified, the data management module on the chain can automatically judge whether the user address is consistent with the user address written in when the user address is newly added, if not, the data is not allowed to be modified, if so, the data is modified according to the provided table name, the primary key name and the corresponding primary key value positioning data, and the data is modified according to the provided field name and the field value, and other fields which are not provided can inherit the original content by default, are not modified, and cannot be changed. When modifying, the on-chain data management module can automatically record the current time, the user address of the modified data, the Hash value of the current data certificate and the Hash value recorded last time of the data, add separators to the four pieces of information, and splice the four pieces of information into a field value to write into the data operation information field. For the data uploaded to the blockchain, the user can only modify the common field value on the blockchain, and cannot modify the value of the primary key value and the data operation information.
The data query function of the uplink data management module supports two ways of querying uplink data at the same time. One is a primary key query mode; the other is a Hash query mode. The primary key query mode is to call an intelligent contract to query uplink data according to the table name, the primary key name and the primary key field, and the mode can query the complete data content and the content of the data operation information field which are stored in the chain. The Hash inquiry mode is to inquire directly on the block chain according to the Hash value generated during data uplink, and the mode can inquire the data content when the Hash is generated, the data operator, the timestamp when the Hash is generated and the block where the data is located. After the data on the blockchain is deleted, the data can not be queried again by means of the primary key query mode, but because all operations of the blockchain leave marks on the chain and have the characteristic of whole-process traceability, the data on the blockchain at the current time can still be resolved by virtue of the Hash value generated during the data chaining. When data is queried, a user can obtain complete data information, chain query can be realized through a Hash query mode according to a Hash value generated during last change in a data operation field, and all previous data during change of the data can be traced.
The upper table management module of the block chain interaction subsystem and the upper data management module of the block chain are realized by a layered intelligent contract, and the functions comprise a data operation layer, a function realization layer and an external interaction layer. The data operation layer comprises a basic contract which is provided by the block chain itself and directly carries out the increasing, deleting, modifying and checking on the data on the chain. The function implementation layer comprises a function expansion contract and a tool library contract, and the function expansion contract is used for performing function expansion on the contract of the data operation layer so as to realize modularized distinguishing management on the block chain table and the block chain data; the tool library contract is responsible for providing function codes which are multiplexed for many times in the function extension contract, reduces the repeatability of the contract codes and improves the execution efficiency. The external interaction layer only has one intelligent contract which is used for calling the contract of the function realization layer and providing all functions of the table management module on the block chain and the data management module on the block chain.
The function expansion contract is divided into two method areas, one method area specially processes the list on the chain, the contract of the data operation layer is called to increase, delete, modify and check the list information on the chain, whether the main key array input by the user is empty or not can be judged when the list is established, and the normalization judgment is carried out on the user input; the other method area specially processes data on the chain, calls a method of a data operation layer according to received increasing, deleting, modifying and checking operation instructions, then operates specific data according to a table name and data content in the instructions, automatically adds data operation information data, calls a tool library contract during execution to judge whether user input contains main key content, and returns the data after analyzing the data formed by splicing on the chain when inquiring the data.
The multiplexing function in the tool library contract comprises three functions, wherein one function is the automatic character string splicing and splitting function, when the combined main key data is written and searched and the data operation information data is recorded, the contents of the two functions are spliced by a plurality of information items, therefore, when the combined main key data is written and searched, the information items are detected, separators are automatically added in the contract, and the information items are combined into a complete character string. When the contract detects that the data content contains the separators when searching the data, the contract extracts the data before and after the separators and restores the data to the original plurality of information items. And secondly, the fields correspond to functions, when data is newly added and modified, the contract reads field information during table building, the field information is used as an information array, the array is traversed to be compared with field names input by a user one by one, field data in the table is extracted, and the field input by the user is prevented from being not the field in the table. And thirdly, the main key detection function needs to judge whether the user inputs the main key field when data is newly added, modified, searched and deleted. The contract reads the field information when building the table, takes the field information as a main key array, and traverses the array to judge whether the main key field does not appear in the input of the user.
In two method areas of an extended contract of a function implementation layer of an external interaction layer, all methods for providing functions of adding and deleting a table management module on a block chain and a data management module on the chain are extracted into the contract, a uniform contract use inlet is provided for a user, and management of the table and the data on the chain can be realized by calling the contract.
The certificate return subsystem comprises a field adding module and a certificate recording module. And the field adding module is used for newly establishing a field for the current table for uploading data in the database, and the field is used for storing a Hash value generated when the data is written into the block chain. The voucher recording module is used for writing the Hash value into the newly-added field of the corresponding data and storing the Hash value and the data together.
In the block chain mass data storage system of the embodiment, a plurality of databases to be stored are assumed to exist, and the databases can keep communication with the block chain nodes under the network environment. The certificate storing system of the embodiment has two use modes, wherein one mode is a full automatic certificate storing mode, and the other mode is a manual certificate storing mode.
The difference between the manual evidence storage and the full automatic evidence storage is that in the full automatic evidence storage mode, all data in the source database can be automatically uploaded, and a field is added to the original table for storing the Hash value of the data uplink. When the manual evidence storage mode is used, manual submission of table building information is needed before data uploading, and after receiving the table building information, a chain table management module of a block chain interaction subsystem firstly inquires whether a table with the same name exists on a block chain, and if the chain already has a table with the same name, the table cannot be continuously created. When the chain does not have a table with the same name, the table building module creates a table on the block chain according to the received database table name, the primary key name and the field name, then, the data can be subjected to the operation of adding, deleting, modifying and checking on the table, and the data need to be stored by a data storage certification initiator after the Hash value of the data chain is returned.
The automatic full-amount evidence storage mode comprises the following steps:
step 1, a user sends a database type, a database name, a database connection address, a port, a user name and a password to a data preprocessing subsystem;
step 2, the data preprocessing subsystem screens out a table with a main key and pushes table building information of the table to the block chain interaction subsystem;
step 3, a new function of the data table on the chain is used for checking whether a table with the same name already exists on the block chain, if so, the table is not created, and if not, a table is created on the block chain according to the table name, the main key name and the common field name;
step 4, after the table is successfully established, the data uploading subsystem sends a table name to which the evidence storing data belongs, a field name of the evidence storing data and data corresponding to the field name to a data adding module of the block chain interaction subsystem;
and 5, detecting whether the data to be stored accords with the standard by the data adding module, wherein the standard comprises that the number of field names and field values is consistent, the field names comprise primary key names, the primary key values are not repeated, all the field names are in the table, when the conditions are consistent, the data adding module submits the data, and after the nodes on the block chain are successfully identified, the data is written into the block chain, and the data is persistently stored. Otherwise, the data is not stored;
step 6, after each data is successfully stored, the block chain returns a Hash value as a certificate of the data uplink, the certificate feedback subsystem adds a field in the table of the source database, and writes the Hash value into the field of the corresponding data;
and 7, after the data storage is successful, searching, modifying and deleting the data on the block chain.
The manual certificate storage mode comprises the following steps:
step 1, a user pushes table building information to a block chain interaction subsystem;
step 2, the table building module checks whether a table with the same name already exists on the block chain, if so, the table is not created, and if not, a table is created on the block chain according to the table name, the main key name and the common field name;
step 3, after the table is successfully established, a user pushes the table name to which the certificate storing data belongs, the field name of the certificate storing data and data corresponding to the field name to the data adding module of the block chain interaction subsystem;
and 4, detecting whether the data to be stored is in accordance with the standard by the data adding module, wherein the standard comprises that the number of field names and field values is consistent, the field names comprise primary key names, the primary key values are not repeated, all the field names are in the table, when the conditions are all in accordance, the data adding module submits the data, the data is written into the block chain after the nodes on the block chain are successfully identified, and the data is stored persistently. Otherwise, the data is not stored;
step 5, after each piece of data succeeds in storing the certificate, the block chain returns a Hash value as a certificate of the data chaining, and a user needs to store the certificate by himself;
and 6, after the data storage is successful, searching, modifying and deleting the data on the block chain.
Fig. 3 is a flow chart of data preprocessing according to the present invention, in which the data preprocessing subsystem includes a database connection module and a table screening module, the database connection module is configured to load a corresponding database connection driver according to database connection information input by a user, determine whether a target database is connectable, and if the connection is successful, the database connection module pushes the database connection information to the data uploading subsystem and the credential returning subsystem. The database connection information comprises a database type, a database address, a database port, a database connection user name, a database connection password and a database name.
The table screening module is used for screening a data table meeting the block chain table building standard, pushing a table name meeting the standard to the data uploading subsystem, and pushing table building information meeting the standard to the table building module of the block chain interaction subsystem. The block link table building standard is met, and tables in the index database have primary keys. And establishing table information, including the table name, the primary key name of the table and all field names of the table.
When the automatic full-amount authentication mode is used, a user needs to select a database connection type (such as mysql, oracle and sql server) in a database connection module of the data preprocessing subsystem and input a user name, a password and a database name for connecting the database. At the moment, the database connection module tries to connect the database, and after the connection is successful, the database connection information is synchronized to the data uploading subsystem and the returning subsystem. The table screening module can automatically find out all table names in the database, then sequentially read all fields of each table, and distinguish the main key field and the common field according to the information set by the table in the database. If the table has a main key, the table screening module extracts the table name, the main key name and the field name of the table as table building information and pushes the table building information to a table building module of the block chain interaction subsystem; if the table has no primary key, the table building information of the table is not pushed.
Fig. 4 is a block chain table building flow chart of the present invention, after receiving table building information, a table building module of a block chain interaction subsystem first determines whether a table name is empty, and if the table name is not empty, queries whether a table with the same name exists on a block chain, and if a table with the same name already exists on the chain, the table building module cannot continue building. When the chain does not have the table with the same name, whether the primary key name of the table is received or not can be continuously judged, after the primary key name is received, the table building module adds a data operation information field according to the received table name, the primary key name and the field name of the database, a table is created on the block chain, and the data can be subjected to increasing, deleting, modifying and checking operations on the table.
Fig. 5 is a flow chart of data uploading according to the present invention, in which the data uploading subsystem includes a data reading module and a data pushing module. And the data reading module is used for automatically reading all field names and corresponding field values of each piece of data in the table after receiving the database connection information and the table names meeting the table building standard. And the data pushing module is used for pushing the read data to a chain data adding module of the block chain interaction subsystem. After the block chain interaction subsystem successfully creates the table, the data uploading subsystem connects the database according to the database information pushed by the data preprocessing subsystem, reads the data in the table one by one, and then submits the data to the data adding module of the block chain interaction subsystem one by one, wherein the submitted data content comprises the table name of the data, all field names and the data content corresponding to each field.
Fig. 6 is a flow chart of data addition in the present invention, after the uplink data management module of the block chain interaction subsystem receives the data to be uplinked, it will first query whether a table to which the data to be uploaded belongs already exists on the block chain, and if the table does not exist, the data cannot be uploaded. When the table exists, the data newly-added module can detect whether the data to be uploaded accords with the standard, and detects whether the content comprises field names and the number of field values are consistent, whether the field names contain primary key names, whether the primary key values are not repeated, and whether all the field names are in the table. If the specifications are all satisfied, the data management module on the chain can submit the data, automatically record the current time, the user address of the newly added data and the Hash value of the current data certificate, add separators to the three pieces of information, splice the three pieces of information into a field value and write the field value into the data operation information field. And writing the data into the block chain after the nodes on the block chain are successfully identified, and persistently storing the data.
Fig. 7 is a flowchart of credential return, where after the node consensus is over, a Hash value is generated, and the return subsystem connects the database according to the database connection information pushed by the data preprocessing module and adds a new field in the table of the uploaded data to store the credential of the data link. The return subsystem updates the data uplink certificate according to the primary key information of the uploaded data, namely, writes the Hash value generated by consensus in the newly added field of the data. When the back transmission subsystem finishes writing the Hash values of all the uplink data, the full automatic evidence storage is finished.
Fig. 8 is a flowchart of the data deleting function of the present invention, and after the chain data management module of the block chain interaction subsystem receives the data to be deleted, it will first query whether the table to which the data to be deleted belongs already exists on the block chain. When the table name exists, whether the received primary key name is consistent with the primary key name in the table building process is continuously confirmed. When the primary key name is consistent with the data, starting to search the data, if the data is inquired, judging whether the address of a data deleter is consistent with the user address recorded in the data operation information field when the data is newly added, if not, deleting the data, and if so, deleting the data; if the query is not successful, the deleting process is ended.
Fig. 9 is a flow chart of data modification according to the present invention, in which after the chain data management module of the blockchain interaction subsystem receives the data to be modified, it first queries whether a table to which the data to be modified belongs already exists on the blockchain. When the table name exists, continuously confirming whether the field name is consistent with the field number; when the number is consistent, continuously confirming whether the received field name contains the primary key name; when the main key name is included, whether the field names are all consistent with the field names in the table building process is continuously confirmed. When the field names are consistent, the data is searched, if the data is searched, whether the address of a data modifier is consistent with the user address recorded in the data operation information field when the data is newly added is judged, if the address is inconsistent, the data is not modified, if the address is consistent, the data is modified according to the content of the received field value, the content of other fields which are not received is kept unchanged, and when the data is modified, the chained data management module can automatically record the current time, the user address of the modified data, the Hash value of the current data certificate and the Hash value recorded last time of the data, add separators to four pieces of information, and splice the four pieces of information into a field value to be written into the data operation information field. If the query is not successful, the modification process is ended.
Fig. 10 is a data query flow chart of the present invention, in which after the data management module on the chain of the block chain interaction subsystem receives the data to be queried, it first distinguishes whether the data is queried according to the Hash value or according to the primary key. When the query is carried out according to the Hash value, the Hash value is directly submitted to the block chain, and the query result is returned. When inquiring according to the primary key, firstly confirming whether the table name to be inquired exists, and when the table name exists, continuously confirming whether the received primary key name is consistent with the primary key name when building the table. And when the primary key name is consistent with the default, starting to search and returning a search result. When the data is queried again, the complete content of the data can be obtained, and at the moment, the user can continuously realize chain query in a Hash query mode according to the Hash value generated during the last change in the data operation field, so that the data can be traced back to all the previous changed data of the data.
FIG. 11 is an intelligent contract architecture diagram of the present invention, which includes a data operation layer, a function implementation layer, and an external interaction layer. The data operation layer comprises a basic contract which is provided by the block chain itself and directly carries out the increasing, deleting, modifying and checking on the data on the chain. The function implementation layer comprises a function extension contract and a tool library contract, and the function extension contract is used for performing function extension on the contract of the data operation layer so as to realize the modularized distinguishing management of the block chain table and the block chain data; the tool library contract is responsible for providing the function codes which are multiplexed for many times in the function extension contract, so that the repeatability of the contract codes is reduced, and the execution efficiency is improved. The external interaction layer only has one intelligent contract which is used for calling the contract of the function realization layer and providing all functions of the table management module on the block chain and the data management module on the block chain. Through the design of the hierarchical intelligent contract framework, the intelligent contracts can be not newly increased or changed subsequently, and the data in various forms can be stored only by calling the table building function on the chain and building the table on the block chain, so that the use convenience of the system is improved. Due to the layered design, the coupling degree between contracts is reduced, the function expansion of subsequent contracts is facilitated, and the expandability of the system is improved.
The above embodiments are only exemplary embodiments of the present invention, and are not intended to limit the present invention, and the scope of the present invention is defined by the claims. Various modifications and equivalents may be made by those skilled in the art within the spirit and scope of the present invention, and such modifications and equivalents should also be considered as falling within the scope of the present invention.

Claims (10)

1. A block chain mass data storage and verification system for a multi-source database is characterized in that: the system comprises a data preprocessing subsystem, a data uploading subsystem, a block chain interaction subsystem and a certificate returning subsystem, wherein the data preprocessing subsystem is responsible for screening uplink table information in a database, the data uploading subsystem is responsible for reading data in the database and pushing the data to the block chain interaction subsystem, the block chain interaction subsystem provides functions of on-chain user management, data table management and evidence storage data management, and the certificate returning subsystem is responsible for returning a data uplink certificate generated by a block chain to the database after the data is written into the block chain;
the block chain interaction subsystem comprises a block chain user module, a chain upper table management module and a chain upper data management module, wherein the block chain user module provides functions of block chain user registration and block chain user login, the chain upper table management module provides functions of newly building a chain upper data table, listing a chain upper data table name, inquiring chain upper data table configuration, modifying chain upper data table fields and modifying chain upper data table names, and the chain upper data management module provides functions of newly adding chain upper data, deleting chain upper data, modifying chain upper data and inquiring chain upper data.
2. The system for storing and verifying the massive data of the block chain oriented to the multi-source database according to claim 1, wherein the data preprocessing subsystem comprises a database connection module and a table screening module, the database connection module is used for loading a corresponding database connection driver according to the database connection information input by a user, and pushing the database connection information which can be connected to the data uploading subsystem and the credential returning subsystem; the table screening module is used for screening a data table meeting the block chain table building standard, pushing a table name meeting the standard to the data uploading subsystem, and pushing table building information meeting the standard to the table building module of the block chain interaction subsystem.
3. The system for evidence storage of block chain mass data of multi-source database according to claim 1, wherein the data uploading subsystem comprises a data reading module and a data pushing module, the data reading module is configured to automatically read all field names of each data in the table and the corresponding field values thereof after receiving database connection information and table names meeting a table building standard; and the data pushing module is used for pushing the read data to an on-chain data management module of the block chain interaction subsystem.
4. The system for multi-source database-oriented blockchain mass data storage and verification as claimed in claim 1, wherein the on-chain data management module automatically records the current time, the user address of the newly added data and the Hash value of the current data storage and verification when performing on-chain data addition operation, adds a separator to three pieces of information, and splices the three pieces of information into a field value to write into a data operation information field; when the on-chain data management module carries out on-chain data modification operation, the on-chain data management module can automatically judge whether a user address is consistent with a user address written in the newly added user address, if not, the data is not allowed to be modified, if so, the data is modified according to the provided table name, the primary key name and the corresponding primary key value positioning data, and according to the provided field name and the field value, other fields which are not provided can inherit the original content by default, and are not modified and cannot be changed; when the data is modified, the on-chain data management module can automatically record the current time, the user address of the modified data, the Hash value of the current data certificate and the Hash value recorded last time of the data, add separators to the four pieces of information, and splice the four pieces of information into a field value to be written into a data operation information field; for the data uploaded to the blockchain, the user can only modify the common field value on the blockchain, and cannot modify the value of the primary key value and the data operation information.
5. The system for proving massive data in a block chain oriented to a multi-source database according to claim 1, wherein the function of the on-chain data query of the on-chain data management module supports two query modes, namely a main key query and a Hash query.
6. The system for storing and verifying the massive data in the block chain oriented to the multi-source database as claimed in claim 1, wherein the credential returning subsystem comprises a field adding module and a credential recording module, the field adding module is configured to newly add a field for a table of currently uploaded data in the database, and the field is configured to store a Hash value generated when the data is written into the block chain; the voucher recording module is used for writing the Hash value into the newly added field of the corresponding data and storing the Hash value and the data together.
7. The system for storing and verifying the massive data in the blockchain oriented to the multi-source database as claimed in claim 1, wherein the on-chain management module and the on-chain data management module of the blockchain interaction subsystem are implemented by a layered intelligent contract, and include a data operation layer, a function implementation layer, and an external interaction layer;
the data operation layer comprises a basic contract which is provided by the block chain and directly carries out addition, deletion, modification and check on data on the chain; the function implementation layer comprises a function expansion contract and a tool library contract, the function expansion contract is used for performing function expansion on the contract of the data operation layer so as to realize modularized distinguishing management on the block chain table and the block chain data, and the tool library contract is used for providing function codes which are multiplexed for multiple times in the function expansion contract; the external interaction layer only has one intelligent contract which is used for calling the contract of the function realization layer and providing all functions of the table management module on the block chain and the data management module on the block chain.
8. A multi-source database-oriented blockchain mass data evidence storing method is characterized in that the method is based on any one of claims 1 to 7, and comprises an automatic full-amount evidence storing mode and a manual evidence storing mode, wherein the automatic full-amount evidence storing mode refers to that a user can specify a target database, the evidence storing system can automatically create a table containing a main key in the target database on a blockchain, automatically upload data in the table to the blockchain for evidence storing, and subsequently delete, modify and query uplink data;
the manual evidence storing mode refers to that a user can create a data table on a block chain by himself and then can perform operations of adding, deleting, modifying and inquiring data on the created data table.
9. The method for multi-source database-oriented blockchain mass data certification according to claim 8, wherein the automatic full-volume certification mode includes the following steps:
step 1, a user sends a database type, a database name, a database connection address, a port, a user name and a password to a data preprocessing subsystem;
step 2, the data preprocessing subsystem screens out a table with a main key and pushes table building information of the table to the block chain interaction subsystem;
step 3, a new module of the data table on the chain checks whether a table with the same name already exists on the block chain, if so, the table is not created, and if not, a table is created on the block chain according to the table name, the main key name and the common field name;
step 4, after the table is successfully established, the data uploading subsystem sends the table name to which the certificate storing data belongs, the field name of the certificate storing data and the data corresponding to the field name to the chain data adding module of the block chain interaction subsystem;
step 5, the data newly-added module on the chain detects whether the data to be stored is in accordance with the standard, the standard comprises that the number of field names is consistent with the number of field values, the field names comprise primary key names, the primary key values are not repeated, all the field names are in a table, when the data to be stored is in accordance with the standard, the data is submitted by the data newly-added module on the chain, the data is written into the block chain after the nodes on the block chain are successfully identified, and the data is stored persistently, otherwise, the data is not stored;
step 6, after each data is successfully stored, the block chain returns a Hash value as a certificate of the data uplink, the certificate feedback subsystem adds a field in the table of the source database, and writes the Hash value into the field of the corresponding data;
and 7, after the data storage is successful, searching, modifying and deleting the data on the block chain.
10. The method for multi-source database-oriented blockchain mass data certification according to claim 8, wherein the manual certification mode includes the following steps:
step 1, a user pushes table building information to a block chain interaction subsystem;
step 2, a new building module of the data table on the chain checks whether a table with the same name already exists on the block chain, if so, the table is not created, and if not, a table is created on the block chain according to the table name, the main key name and the common field name;
step 3, after the table is successfully established, a user calls a chain data adding function of the block chain interaction subsystem, and the table name to which the certificate storing data belongs, the field name of the certificate storing data and data corresponding to the field name are pushed;
step 4, the chain data adding module detects whether the data to be stored is in accordance with the standard, the standard comprises that the number of field names and field values is consistent, the field names comprise primary key names, the primary key values are not repeated, all the field names are in a table, when the data to be stored is in accordance with the standard, the chain data adding module submits the data, after the nodes on the block chain are successfully identified, the data is written into the block chain, and the data is persistently stored, otherwise, the data is not stored;
step 5, after each piece of data succeeds in storing the certificate, the block chain returns a Hash value as a certificate of the data chaining, and a user needs to store the certificate by himself;
and 6, after the data storage is successful, searching, modifying and deleting the data on the block chain.
CN202211365183.8A 2022-11-03 2022-11-03 Block chain mass data storage certificate system and method for multi-source database Active CN115408474B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211365183.8A CN115408474B (en) 2022-11-03 2022-11-03 Block chain mass data storage certificate system and method for multi-source database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211365183.8A CN115408474B (en) 2022-11-03 2022-11-03 Block chain mass data storage certificate system and method for multi-source database

Publications (2)

Publication Number Publication Date
CN115408474A true CN115408474A (en) 2022-11-29
CN115408474B CN115408474B (en) 2023-01-24

Family

ID=84169309

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211365183.8A Active CN115408474B (en) 2022-11-03 2022-11-03 Block chain mass data storage certificate system and method for multi-source database

Country Status (1)

Country Link
CN (1) CN115408474B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200250174A1 (en) * 2019-01-31 2020-08-06 Salesforce.Com, Inc. Systems, methods, and apparatuses for implementing efficient storage and validation of data and metadata within a blockchain using distributed ledger technology (dlt)
CN112926085A (en) * 2021-03-05 2021-06-08 合肥都市链情商务有限公司 Database data storage and tamper-proof system and method based on block chain contract
CN113507526A (en) * 2021-07-13 2021-10-15 广州越创智数信息科技有限公司 Information transmission system of application block chain
CN113657911A (en) * 2021-08-16 2021-11-16 安徽大学 Safe and efficient traceability system based on block chain
WO2021232804A1 (en) * 2020-05-18 2021-11-25 杭州趣链科技有限公司 Blockchain data indexing method, and blockchain data storage method
CN114461673A (en) * 2022-01-19 2022-05-10 北京工业大学 Block chain query optimization method based on-chain and off-chain cooperation
CN114726554A (en) * 2022-06-08 2022-07-08 青岛理工大学 Copyright authentication system and method based on alliance chain and NFT

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200250174A1 (en) * 2019-01-31 2020-08-06 Salesforce.Com, Inc. Systems, methods, and apparatuses for implementing efficient storage and validation of data and metadata within a blockchain using distributed ledger technology (dlt)
WO2021232804A1 (en) * 2020-05-18 2021-11-25 杭州趣链科技有限公司 Blockchain data indexing method, and blockchain data storage method
CN112926085A (en) * 2021-03-05 2021-06-08 合肥都市链情商务有限公司 Database data storage and tamper-proof system and method based on block chain contract
CN113507526A (en) * 2021-07-13 2021-10-15 广州越创智数信息科技有限公司 Information transmission system of application block chain
CN113657911A (en) * 2021-08-16 2021-11-16 安徽大学 Safe and efficient traceability system based on block chain
CN114461673A (en) * 2022-01-19 2022-05-10 北京工业大学 Block chain query optimization method based on-chain and off-chain cooperation
CN114726554A (en) * 2022-06-08 2022-07-08 青岛理工大学 Copyright authentication system and method based on alliance chain and NFT

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
WEI ZHOU: "A Blockchain-Based Access Control Framework for Secured Data Sharing in Industrial Internet", 《2020 EIGHTH INTERNATIONAL CONFERENCE ON ADVANCED CLOUD AND BIG DATA (CBD)》 *
周炜: "基于区块链的隐私保护去中心化联邦学习模型", 《计算机研究与发展》 *
孙国梓: "基于区块链技术的电子数据存证系统", 《西安邮电大学学报》 *

Also Published As

Publication number Publication date
CN115408474B (en) 2023-01-24

Similar Documents

Publication Publication Date Title
US7966287B2 (en) Apparatus, system, and method for dynamic database driven document synchronization
US8682859B2 (en) Transferring records between tables using a change transaction log
CN103460208A (en) Methods and systems for loading data into a temporal data warehouse
CN102254029A (en) View-based data access system and method
US7519620B2 (en) Replication system, method and program for replicating a plurality of databases into a replica database
US9418154B2 (en) Push-model based index updating
US9594784B2 (en) Push-model based index deletion
CN115203750A (en) Hive data authority control and security audit method and system based on Hive plug-in
CN101013426B (en) Information management apparatus and method
CN111382142A (en) Database operation method, server and computer storage medium
CN112131228B (en) FABRIC-based alliance chain system convenient for data retrieval
CN115408474B (en) Block chain mass data storage certificate system and method for multi-source database
CN116070294B (en) Authority management method, system, device, server and storage medium
CN210691319U (en) File information safety management system based on block chain
CN111639478B (en) Automatic data auditing method and system based on EXCEL document
JP2005234945A (en) Concurrent execution control method and device
US20060238801A1 (en) System and method for transmitting data quickly between a client and a server
JP3282089B2 (en) Information space search method and apparatus
CN117527785B (en) Method and system for supporting space engineering file data uploading and full link management
CN116739397B (en) Dynamic management method for new energy indexes
CN116521698B (en) Data uplink method and system based on abstract information
WO2024114784A1 (en) Method and system for blockchain-based data management
CN116483926A (en) Data table synchronization method and device, storage medium and computer equipment
JPH08329093A (en) Distributed directory system and knowledge information changing method
CN115081031A (en) Tamper-proof block chain data storage method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20230825

Address after: Room 511, No. 1 Erheng Road, Shijing Industrial Zone, Shisha Road, Baiyun District, Guangzhou City, Guangdong Province, 510000

Patentee after: China Technology Chain (Guangdong) Technology Co.,Ltd.

Address before: 230000 floor 1, building 2, phase I, e-commerce Park, Jinggang Road, Shushan Economic Development Zone, Hefei City, Anhui Province

Patentee before: Dragon totem Technology (Hefei) Co.,Ltd.

Effective date of registration: 20230825

Address after: 230000 floor 1, building 2, phase I, e-commerce Park, Jinggang Road, Shushan Economic Development Zone, Hefei City, Anhui Province

Patentee after: Dragon totem Technology (Hefei) Co.,Ltd.

Address before: No. 777, Jialingjiang East Road, Huangdao District, Qingdao City, Shandong Province 266520

Patentee before: Qingdao University of Technology