CN115408474B - 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
CN115408474B
CN115408474B CN202211365183.8A CN202211365183A CN115408474B CN 115408474 B CN115408474 B CN 115408474B CN 202211365183 A CN202211365183 A CN 202211365183A CN 115408474 B CN115408474 B CN 115408474B
Authority
CN
China
Prior art keywords
data
chain
block 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.)
Active
Application number
CN202211365183.8A
Other languages
Chinese (zh)
Other versions
CN115408474A (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
Qindao 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 Qindao University Of Technology filed Critical Qindao 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)
  • Computer Security & Cryptography (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Hardware Design (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 and certification 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 evidence storing system and an evidence storing 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 chain evidence storing systems are customized and developed intelligent contracts aiming at single service scenes, only electronic invoices or information of transaction records in a fixed format can be stored, and the format of evidence storing data 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 to be testable, so that the function extension is complicated, the number of the intelligent contracts can be continuously increased, the operation burden of the 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, the existing block chain evidence storing system has single evidence storing data form, complicated evidence storing data form expansion and increased intelligent contract quantity, and 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 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.
In the block chain mass data storage system oriented to the multi-source database, when the on-chain data management module performs on-chain data addition operation, the on-chain data management module automatically records the current time, the user address of the added data and the Hash value of the current data storage certificate, adds separators to the three pieces of information, and splices the three pieces of information into a field value to write into the 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 above system for storing and verifying the massive data in the blockchain oriented to the multi-source database, 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 extension contract and a tool library contract, 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, and the tool library contract is used for providing a function code which is repeatedly multiplexed in the function extension contract, so that the repeatability of the contract code 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.
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 storing mode refers to that a user can create a data table on a block chain by himself and then can 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 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 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 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 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 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 conditions are in accordance, 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 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, chain certificate storage can be carried out on data containing a main key in any relational database, automatic and manual certificate storage modes are supported, the form of the data certificate storage can be customized, automatic batch synchronization of the data in the database to a block chain is supported, data change records can be inquired in a chain mode, the form of certificate storage data can be dynamically expanded, and the data change records can be inquired in a chain mode, so that the problems that the authority of a centralized certificate storage system is centralized, the data are easy to be falsified, the form of the certificate storage data of an existing block chain certificate storage system is single, the form of the certificate storage data is complicated in expansion, and the number of intelligent contracts is increased are solved.
Drawings
The invention is further illustrated with reference to the following figures and examples.
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 of 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 data deletion flowchart of 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 a table in batches and pushes the data to the block chain interaction subsystem, and the block chain interaction subsystem provides functions of user management, data table management and evidence storage data management. And the certificate returning subsystem returns the data uplink certificate generated by the 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. 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 randomly generated private key and a randomly generated address from the block chain only through registration, and the information on the chain is operated after login by 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 inquiry, chain table field modification and chain table name modification. Wherein the list of data table names in a chain function may 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 data management module on the chain 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 being 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 query mode is to query directly on the block chain according to the Hash value generated during data chaining, and the mode can query the data content when Hash is generated, the data operator, the timestamp when 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 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.
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 for the data, the contract extracts the data before and after the separators and restores the data to the first plurality of information items. And secondly, the fields have corresponding 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 newly adding, modifying, searching and deleting data. 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 increasing, deleting and modifying 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 achieved by calling the contract.
The certificate returning subsystem comprises a field adding module and a certificate recording module. The field adding module is used for newly establishing a field for the table of the 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 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 manual evidence storage and 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 for storing the Hash value of the data uplink can be added to the original table. 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 the table with the same name, the table building module creates a table on the block chain according to the received table name, the primary key name and the field name of the database, then, the table can be subjected to the operation of adding, deleting, modifying and checking the data, and the Hash value of the data chaining chain is returned and needs to be stored by a data storage certification initiator.
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 newly-built function 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 a data adding module of the block chain interaction subsystem;
and 5, 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 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 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 primary key name and the common field name;
step 3, after the table is successfully established, pushing 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 data adding module of the block chain interaction subsystem by a user;
and 4, 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 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 database are indicated to 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 certificate storing mode is used, a user needs to select a database connection type (such as mysql, oracle and sql server) from 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 for 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 according to the present invention, after the uplink data management module of the block chain interaction subsystem receives the data to be uplinked, it will firstly 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 adding module detects whether the data to be uploaded meet 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 back transmission subsystem updates the data uplink certificate thereof 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. And when the Hash values of all uplink data are written into the return subsystem, 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. And when the table name exists, continuously confirming whether the received primary key name is consistent with the primary key name in the table building. When the primary key name is consistent with the primary key name, starting to search the data, if the data is inquired, judging whether the address of the 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 names contain 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 completed, the modification process is ended.
Fig. 10 is a data query flow chart of the present invention, after the data management module on the chain of the block chain interaction subsystem receives the data to be queried, it first distinguishes whether to query 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 establishing 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, at this time, the user can continue to realize chain query in a Hash query mode according to the Hash value generated during the last change in the data operation field, and the previous data during all changes of the data can be traced.
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 architecture, 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 block 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 of the invention may be made by those skilled in the art within the spirit and scope of the invention, and such modifications and equivalents should also be considered as falling within the scope of the invention.

Claims (5)

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;
the data preprocessing subsystem comprises a database connection module and a table screening module, wherein 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 uploading subsystem and the certificate 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;
the data uploading subsystem 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; 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 on-chain data management module performs on-chain data adding operation, the on-chain data management module can automatically record the current time, the user address of the added data and the Hash value of the current data certificate, adds separators to the three pieces of information, and splices the three pieces of information into a field value to write the field value into the data operation information field; when the on-chain data management module performs 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 increased process, 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 block chain, a user can only modify the common field value existing on the block chain and cannot modify the value of the primary key value and the data operation information of the data;
the certificate return subsystem comprises a field adding module and a certificate recording module, wherein the field adding module is used for newly adding a field for a current data uploading table in a database, and the field is used for storing a Hash value generated when data are written into a block chain; the certificate recording module is used for writing the Hash value into a newly-added field of the corresponding data and storing the Hash value and the data together;
the chain upper management module and the chain upper data management module of the block chain interaction subsystem realize functions by a layered intelligent contract, and 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 and directly carries out addition, deletion, modification and check on data on the chain; the function implementation layer comprises a function extension contract and a tool library contract, 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, and the tool library contract is used for providing a function code which is multiplexed for many times in the function extension 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.
2. 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 function of the data query in the chain of the data management module supports two query modes, namely a primary key query and a Hash query.
3. 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-2, 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 specifies 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 can delete, modify and query uplink data;
the manual evidence storage mode refers to that a user creates a data table on a block chain by himself and then performs operations of adding, deleting, modifying and inquiring data on the created data table.
4. The method for multi-source database-oriented block chain mass data storage according to claim 3, wherein 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 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 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.
5. The method for multi-source database-oriented blockchain mass data storage according to claim 3, wherein the manual storage 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 data certificate is successfully stored, the block chain returns a Hash value as a certificate of the data chain, 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 CN115408474A (en) 2022-11-29
CN115408474B true 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 (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
WO2021232804A1 (en) * 2020-05-18 2021-11-25 杭州趣链科技有限公司 Blockchain data indexing method, and blockchain data storage method
CN114726554A (en) * 2022-06-08 2022-07-08 青岛理工大学 Copyright authentication system and method based on alliance chain and NFT

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11971874B2 (en) * 2019-01-31 2024-04-30 Salesforce, Inc. Systems, methods, and apparatuses for implementing efficient storage and validation of data and metadata within a blockchain using distributed ledger technology (DLT)
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

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN114726554A (en) * 2022-06-08 2022-07-08 青岛理工大学 Copyright authentication system and method based on alliance chain and NFT

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于区块链技术的电子数据存证***;孙国梓;《西安邮电大学学报》;20180710;全文 *
基于区块链的隐私保护去中心化联邦学习模型;周炜;《计算机研究与发展》;20220901;全文 *

Also Published As

Publication number Publication date
CN115408474A (en) 2022-11-29

Similar Documents

Publication Publication Date Title
US7966287B2 (en) Apparatus, system, and method for dynamic database driven document synchronization
KR100981857B1 (en) System and method for scoping searches using index keys
JP4255373B2 (en) Management and synchronization application for network file systems
US8682859B2 (en) Transferring records between tables using a change transaction log
CN103460208A (en) Methods and systems for loading data into a temporal data warehouse
CN105956123A (en) Local updating software-based data processing method and apparatus
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
CN104142930A (en) Universal Delta data loading technology
US9594784B2 (en) Push-model based index deletion
CN101013426B (en) Information management apparatus and method
CN112232672A (en) Management system and method of industrial mechanism model
JP2001306372A (en) Method for managing document and storage medium storing program for executing the method
CN113704248B (en) Block chain query optimization method based on external index
CN115114372A (en) Data processing method, device and equipment based on block chain and readable 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
CN111382142A (en) Database operation method, server and computer storage medium
CN111639478B (en) Automatic data auditing method and system based on EXCEL document
JP2005234945A (en) Concurrent execution control method and device
JP3282089B2 (en) Information space search method and apparatus
WO2024114784A1 (en) Method and system for blockchain-based data management
JPH08329093A (en) Distributed directory system and knowledge information changing method
CN117194499A (en) Real estate service processing method, apparatus, device, storage medium and program product
CN116521698A (en) Data uplink method and system based on abstract information

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

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: Qindao University of Technology

TR01 Transfer of patent right