CN111783141A - Data storage method, device and equipment based on block chain and storage medium - Google Patents
Data storage method, device and equipment based on block chain and storage medium Download PDFInfo
- Publication number
- CN111783141A CN111783141A CN202010634107.7A CN202010634107A CN111783141A CN 111783141 A CN111783141 A CN 111783141A CN 202010634107 A CN202010634107 A CN 202010634107A CN 111783141 A CN111783141 A CN 111783141A
- Authority
- CN
- China
- Prior art keywords
- data
- child node
- node server
- access
- storage
- 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
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Bioethics (AREA)
- Software Systems (AREA)
- Computer Security & Cryptography (AREA)
- Computer Hardware Design (AREA)
- General Health & Medical Sciences (AREA)
- Health & Medical Sciences (AREA)
- Computing Systems (AREA)
- Data Mining & Analysis (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The invention relates to the field of block chain storage, and discloses a data storage method, a data storage device, data storage equipment and a data storage medium based on a block chain. The method comprises the following steps: reading first storage data of a main node server in a block chain local area network, and acquiring access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data; generating an access authority matrix based on a preset matrix generation rule according to all access authority settings; generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data; updating the database of each child node server by using the second storage data to obtain a corrected child node database corresponding to each child node server; and closing the data access link of each child node server in the main node server, and confirming all the corrected child node databases as the databases corresponding to the data access of the child node servers.
Description
Technical Field
The present invention relates to the field of block chain storage, and in particular, to a data storage method, apparatus, device, and storage medium based on a block chain.
Background
The internet technology is continuously developed, and along with the technology upgrading, the data storage mode begins to evolve towards virtualization, decentralization and abstraction. From the first use of magnetic disks and optical disks for storing information data to the current technologies of cloud data storage, virtual container storage, fragmented multi-segment processing storage and the like. A technique of decentralization, which is a block chain technique, is gradually produced in the technique of update iteration.
Block chain techniques were developed that immediately caused a change in storage. The blockchain technology has the characteristic of commonly confirming data records in a shared area, and the blockchain becomes an important data record mode in the financial field along with the verification of a hash algorithm. In the financial field, the privacy of the client is an important issue, so different access rights need to be given to different clients. In the prior art, the change of the access authority can only suspend the access of the client, and then the access authority is modified. Therefore, there is a need for a technique to complete access permission modification without suspending client access.
Disclosure of Invention
The invention mainly aims to solve the technical problem that the data access permission of a child node is modified in the block chain storage and the data access cannot be carried out simultaneously.
The first aspect of the present invention provides a data storage method based on a block chain, where the data storage based on a block chain includes:
reading first storage data of a main node server in a block chain local area network, and acquiring access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data, wherein the main node server comprises a server for providing data access for each sub-node server;
generating an access authority matrix based on a preset matrix generation rule according to all the access authority settings;
generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data;
updating the database of each child node server according to the second storage data to obtain a corrected child node database corresponding to each child node server;
and closing the data access link of each child node server in the main node server, and confirming all the corrected child node databases as the databases corresponding to the data access of the child node servers.
Optionally, in a first implementation manner of the first aspect of the present invention, before reading the first storage data of the master node server in the blockchain local area network and acquiring the access right setting of each child node server in the blockchain local area network corresponding to the first storage data, the method further includes:
creating a database in the main node server and each sub-node server;
setting all the databases to be in a readable and writable state;
and writing the transaction data generated based on the blockchain into a database corresponding to the main node server to generate first storage data of the main node server.
Optionally, in a second implementation manner of the first aspect of the present invention, the generating an access right matrix based on a preset matrix generation rule according to all the access right settings includes:
performing sorting label processing on all the child node servers and the main node server, and counting the common quantity of all the child node servers and the main node server;
generating an initial matrix based on the sorting labels according to the quantity;
analyzing all corresponding authorization paths in the access authority setting;
and modifying the initial matrix according to all the authorization paths to generate an access authority matrix.
Optionally, in a third implementation manner of the first aspect of the present invention, the access permission matrix includes a connection path and a target data request corresponding to the connection path, and the generating, according to the access permission matrix and the first storage data and based on a preset data correction rule, second storage data includes:
reading all connection paths in the access right matrix;
respectively judging whether the connection path is the authorization path;
if yes, reading a target data request corresponding to the connection path, and capturing target data from the first storage data according to the target data request;
and generating second storage data according to the target data corresponding to all the connection paths.
Optionally, in a fourth implementation manner of the first aspect of the present invention, the updating the database of each child node server according to the second storage data to obtain a modified child node database corresponding to each child node server includes:
clearing database data corresponding to the first storage data in all the child node servers;
traversing all the connection paths of the child node servers, and modifying the database corresponding to the child node servers according to the target data corresponding to the connection paths in the second storage data;
and confirming the database corresponding to each child node server as a correction child node database.
Optionally, in a fifth implementation manner of the first aspect of the present invention, the closing a data access link of each child node server in the master node server, and confirming all the modified child node databases as databases corresponding to data access of the child node servers includes:
inquiring data access links in the main node server, and closing ports of the data access links corresponding to all the sub-node servers;
reading data access ports of all the child node servers to obtain corresponding data access object sets;
and adding the corresponding correction sub-node database in all the data access object sets, and confirming the corresponding correction sub-node database as a priority access object.
Optionally, in a sixth implementation manner of the first aspect of the present invention, after the closing the data access link of each child node server in the master node server, and confirming all the modified child node databases as databases corresponding to data access of the child node servers, the method further includes:
receiving a data reading request in the child node server;
analyzing and acquiring the data reading request to obtain a network link request and a data request to be acquired;
judging whether the network link request is authorized or not according to the access authority matrix corresponding to the child node server;
if so, capturing data to be acquired from a correction sub-node database of the node server according to the network link request;
if not, sending the feedback information which is forbidden to be read to the child node server, and stopping data acquisition.
A second aspect of the present invention provides a blockchain-based data storage device, including:
the system comprises a reading module, a storage module and a processing module, wherein the reading module is used for reading first storage data of a main node server in a block chain local area network and obtaining access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data, and the main node server comprises a server for providing data access for each sub-node server;
the matrix generation module is used for generating an access authority matrix based on a preset matrix generation rule according to all the access authority settings;
the data generation module is used for generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data;
the correction module is used for updating the database of each child node server according to the second storage data to obtain a corrected child node database corresponding to each child node server;
and the permission setting module is used for closing the data access link of each child node server in the main node server and confirming all the corrected child node databases as databases corresponding to the data access of the child node servers.
Optionally, in a first implementation manner of the second aspect of the present invention, the data storage device based on a blockchain further includes a preprocessing module, where the preprocessing module is specifically configured to:
creating a database in the main node server and each sub-node server;
setting all the databases to be in a readable and writable state;
and writing the transaction data generated based on the blockchain into a database corresponding to the main node server to generate first storage data of the main node server.
Optionally, in a second implementation manner of the second aspect of the present invention, the matrix generating module is specifically configured to:
performing sorting label processing on all the child node servers and the main node server, and counting the common quantity of all the child node servers and the main node server;
generating an initial matrix based on the sorting labels according to the quantity;
analyzing all corresponding authorization paths in the access authority setting;
and modifying the initial matrix according to all the authorization paths to generate an access authority matrix.
Optionally, in a third implementation manner of the second aspect of the present invention, the data generating module is specifically configured to:
reading all connection paths in the access right matrix;
respectively judging whether the connection path is the authorization path;
if yes, reading a target data request corresponding to the connection path, and capturing target data from the first storage data according to the target data request;
and generating second storage data according to the target data corresponding to all the connection paths.
Optionally, in a fourth implementation manner of the second aspect of the present invention, the modification module is specifically configured to:
clearing database data corresponding to the first storage data in all the child node servers;
traversing all the connection paths of the child node servers, and modifying the database corresponding to the child node servers according to the target data corresponding to the connection paths in the second storage data;
and confirming the database corresponding to each child node server as a correction child node database.
Optionally, in a fifth implementation manner of the second aspect of the present invention, the permission setting module is specifically configured to:
inquiring data access links in the main node server, and closing ports of the data access links corresponding to all the sub-node servers;
reading data access ports of all the child node servers to obtain corresponding data access object sets;
and adding the corresponding correction sub-node database in all the data access object sets, and confirming the corresponding correction sub-node database as a priority access object.
Optionally, in a sixth implementation manner of the second aspect of the present invention, the data storage device based on a block chain further includes an access application module, where the access application module is specifically configured to:
receiving a data reading request in the child node server;
analyzing and acquiring the data reading request to obtain a network link request and a data request to be acquired;
judging whether the network link request is authorized or not according to the access authority matrix corresponding to the child node server;
if so, capturing data to be acquired from a correction sub-node database of the node server according to the network link request;
if not, sending the feedback information which is forbidden to be read to the child node server, and stopping data acquisition.
A third aspect of the present invention provides a data storage device based on a block chain, including: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line; the at least one processor invokes the instructions in the memory to cause the blockchain based data storage device to perform the blockchain based data storage method described above.
A fourth aspect of the present invention provides a computer-readable storage medium having stored therein instructions, which, when run on a computer, cause the computer to execute the above-mentioned block chain-based data storage method.
In the technical scheme provided by the invention, first storage data of a main node server in a block chain local area network are read, and access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data is obtained, wherein the main node server comprises a server for providing data access for each sub-node server; generating an access authority matrix based on a preset matrix generation rule according to all the access authority settings; generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data; updating the database of each child node server according to the second storage data to obtain a corrected child node database corresponding to each child node server; and closing the data access link of each child node server in the main node server, and confirming all the corrected child node databases as the databases corresponding to the data access of the child node servers. In the embodiment of the invention, the access right of each child node server is set by using the access matrix for each child node server, so that when the access right is modified in the block chain local area network, the access right of each child node server can be modified while data in the local area network is accessed.
Drawings
FIG. 1 is a diagram of a first embodiment of a block chain-based data storage method according to an embodiment of the present invention;
FIG. 2 is a diagram of a second embodiment of a block chain-based data storage method according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a third embodiment of a data storage method based on a blockchain according to an embodiment of the present invention;
FIG. 4 is a diagram of an embodiment of a data storage device based on a blockchain in accordance with an embodiment of the present invention;
FIG. 5 is a diagram of another embodiment of a data storage device based on a blockchain in an embodiment of the present invention;
FIG. 6 is a diagram of an embodiment of a data storage device based on a blockchain in an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a data storage method, a device, equipment and a storage medium based on a block chain, which are used for reading first storage data of a main node server in a block chain local area network and acquiring access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data, wherein the main node server comprises a server for providing data access for each sub-node server; generating an access authority matrix based on a preset matrix generation rule according to all the access authority settings; generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data; updating the database of each child node server according to the second storage data to obtain a corrected child node database corresponding to each child node server; and closing the data access link of each child node server in the main node server, and confirming all the corrected child node databases as the databases corresponding to the data access of the child node servers. In the embodiment of the invention, the access right of each child node server is set by using the access matrix for each child node server, so that when the access right is modified in the block chain local area network, the access right of each child node server can be modified while data in the local area network is accessed.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
For convenience of understanding, a specific flow of the embodiment of the present invention is described below, and referring to fig. 1, a first embodiment of a block chain-based data storage method according to the embodiment of the present invention includes:
101. reading first storage data of a main node server in a block chain local area network, and acquiring access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data, wherein the main node server comprises a server for providing data access for each sub-node server;
in this embodiment, the master node server is a server responsible for data distribution in the local area network based on the blockchain technology, and the first stored data may be a single transaction data or a series of transaction data sets. Specifically, the first storage data may include: items of Access, TransactionID, From, To, Amount, Time, etc., are shown as { Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 8954, Time: xxxx.yy.zz }, where Access is represented as a readable attribute, TransactionID is represented as the name of the transaction account, From is the origination address of the transaction, To is the arrival address of the transaction, Amount is the Amount of the transaction, and Time is the Time of the transaction. The child node servers are servers for data acquisition, in practical application, the child node servers can access the main node server to acquire the first stored data, and different child node servers have different access rights. Furthermore, the sub-node servers can also access each other, and the access authority between the sub-node servers is written as the content of the access matrix.
102. Generating an access authority matrix based on a preset matrix generation rule according to all the access authority settings;
in the embodiment, N child node servers are arranged and marked with numbers of 1, 2, 3,. and N, a zero matrix of N x N is generated according to the arrangement data, and the access authority of all the child node servers to the main node server is written into the zero matrix. In the specific implementation, if the node 1 and the node 2 have access right to the node N, the order a is given1n=an1=a12=a21=a2n=an21, the shape of the matrix is:
0、1、…、1
1、0、…、1
…
1、1、…、0
after recording the access authority among all the child node servers, each child node server is also additionally provided with a setting of the access authority of the main node server, wherein the access authority is 1, and the access authority is 0 if the access authority is not present. Therefore, each access authority matrix is provided with a label, the connection relation between the sub node servers is written in the content, and the access authority to the main node server is also attached.
In another embodiment, N-1 child node servers are co-located with a master node server, wherein the master node server is the Nth node. Then respectively marking the N-1 sub-node servers and the main node server as: 1. 2, 3, N, reading the reference number1, if there is node 2 and node N with connection relation, then order a1n=an1=a12=a21=a2n=an21, the shape of the matrix is:
0、1、…、1
1、0、…、1
…
1、1、…、0
the authority matrixes corresponding to different child node servers are different, and N-1 access authority matrixes correspond to N-1 child node servers.
In a third embodiment, N-1 child node servers are co-located with a master node server, where the master node server is the Nth node. Then respectively marking the N-1 sub-node servers and the main node server as: 1. 2, 3, and N, and recording the access authority relationship between nodes 1 to N-1 and node N, wherein node 1 and node 2 have access authority to node N.
Let a1n=an1=a12=a21=a2n=an21, the shape of the matrix is:
0、1、…、1
1、0、…、1
…
1、1、…、0
the generated access matrix is unique, and only the access authority relation between the N-1 sub-node servers and the main node server is recorded.
103. Generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data;
in this embodiment, N-1 child node servers and a master node server are arranged together, where the master node server is the nth node. Then respectively marking the N-1 sub-node servers and the main node server as: 1. 2, 3, and N, and recording the access authority relationship between nodes 1 to N-1 and node N, wherein node 1 and node 2 have access authority to node N.
Let a1n=an1=a2n=an21, the shape of the matrix is:
0、0、…、1
0、0、…、1
…
1、1、…、0
the generated access matrix is unique, and only the access authority relation between the N-1 sub-node servers and the main node server is recorded. According to the connection relation of the Access authority matrix, reading the storage data corresponding to 1-N and 2-N in the first storage data, and then generating second storage data {1N, Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 8954, Time: xxxx.yy.zz; 2N, Access: n, TransactionID: QQW, From: a provice, To: b city, AMount: 8664, Time: xxxx.yy.zz }.
104. Updating the database of each child node server according to the second storage data to obtain a corrected child node database corresponding to each child node server;
in this embodiment, according to {1N, Access: y, TransactionID: QQW, From: a provice, To: bcity, Amount: 8954, Time: xxxx.yy.zz; 2N, Access: n, TransactionID: QQW, From: aprovince, To: b city, AMount: 8664, Time: xxxx, yy, zz } updating the database of child node server No. 1, and comparing { Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 8954, Time: xxxx, yy, zz } writing, updating data of the child node server No. 2, and converting { Access: n, TransactionID: QQW, From: a provice, To: b city, AMount: 8664, Time: XXXX. YY.ZZ }. Will be written with { Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 8954, Time: XXXXXX. YY.ZZ } and { Access: n, TransactionID: QQW, From: a provice, To: bcity, Amount: 8664, Time: xxxx.yy.zz } as a modifier node database.
105. And closing the data access link of each child node server in the main node server, and confirming all the corrected child node databases as the databases corresponding to the data access of the child node servers.
In the present embodiment, the data access between the master node server and all the child node servers is closed, but the data access links between the master node server and the aggregation apparatus of the present invention are not closed. And taking the database of the modified child node as the data of the child node server, wherein the database of the modified child node updated by the child node server without the connection authority with the main node server is { Access: TransactionID: QQW, From: and To: and Amount: time: and setting the database of the correction child node as an access database.
In the embodiment of the invention, the access right of each child node server is set by using the access matrix for each child node server, so that when the access right is modified in the block chain local area network, the access right of each child node server can be modified while data in the local area network is accessed.
Referring to fig. 2, a second embodiment of a data storage method based on a block chain according to the embodiment of the present invention includes:
201. creating a database in the main node server and each sub-node server;
in this embodiment, in the databases created in the master node server and each child node server, the database, the table, the fields of the table, the attributes, the definitions, and the associations between the tables of each node server are all the same, and the framework of the database is: { Access: TransactionID: from: and To: and Amount: time: }.
202. Setting all the databases to be in a readable and writable state;
in this embodiment, if all the attributes of the database are set to be readable, the data in the database is { Access: y, TransactionID: from: and To: and Amount: time: }.
203. Writing transaction data generated based on the blockchain into a database corresponding to the main node server to generate first storage data of the main node server;
in this embodiment, the blockchain generates transaction data, and each corresponding subject tag may be set according to the subject of the transaction data, where the Access tag is 888, the TransactionID tag is 887, From: the tag of To is 886, the tag of Amount is 885, the tag of Time is 884, and then the transaction data is written into Access according To tag matching: y, TransactionID: from: and To: and Amount: time: get { Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 8954, Time: xxxx.yy.zz }.
204. Reading first storage data of a main node server in a block chain local area network, and acquiring access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data, wherein the main node server comprises a server for providing data access for each sub-node server;
this embodiment has already been described in the first embodiment, and will not be described herein.
205. Generating an access authority matrix based on a preset matrix generation rule according to all the access authority settings;
this embodiment has already been described in the first embodiment, and will not be described herein.
206. Generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data;
this embodiment has already been described in the first embodiment, and will not be described herein.
207. Updating the database of each child node server according to the second storage data to obtain a corrected child node database corresponding to each child node server;
this embodiment has already been described in the first embodiment, and will not be described herein.
208. Closing a data access link of each child node server in the main node server, and confirming all the corrected child node databases as databases corresponding to data access of the child node servers;
this embodiment has already been described in the first embodiment, and will not be described herein.
209. Receiving a data reading request in the child node server;
in this embodiment, the data reading request is obtained from the child node server by using a WiFi connection, a bluetooth connection, a data line, a network connection, or the like.
210. Analyzing and acquiring the data reading request to obtain a network link request and a data request to be acquired;
in this embodiment, the data read request content is { link: 1-a-B-C-D-E-n; find: sjj 1.01.663), where link is followed by a network link request and find is followed by the version number of the required data combined with the tag.
211. Judging whether the network link request is authorized or not according to the access authority matrix corresponding to the child node server;
in this embodiment, whether the connection of 1-a-B-C-D-E-n is feasible is sequentially queried, and then whether the path of the connection of 1-a-B-C-D-E-n in the access right matrix of the child node server is authorized connection of node 1 and node n is read.
212. If so, capturing data to be acquired from a correction sub-node database of the node server according to the network link request;
in this embodiment, if the connection link is authorized, the child node servers are connected sequentially through 1 and A, B, C, D, E, n, and then the data of sjjj1.01.663 is captured from the modified child node database according to the version number of sjj1.01.663.
213. If not, sending the feedback information which is forbidden to be read to the child node server, and stopping data acquisition.
In this embodiment, if 1 and n are not nodes with permission to connect, sending "hello, this time connection is unauthorized connection and terminated" to the child node server, and then stopping data acquisition.
In the embodiment of the invention, the access right of each child node server is set by using the access matrix for each child node server, so that when the access right is modified in the block chain local area network, the access right of each child node server can be modified while data in the local area network is accessed.
Referring to fig. 3, a third embodiment of a data storage method based on a block chain according to the present invention includes:
301. reading first storage data of a main node server in a block chain local area network, and acquiring access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data, wherein the main node server comprises a server for providing data access for each sub-node server;
this embodiment has already been described in the first embodiment, and will not be described herein.
302. Performing sorting label processing on all the child node servers and the main node server, and counting the common quantity of all the child node servers and the main node server;
in this embodiment, N-1 child node servers and a master node server are numbered in sequence: 1. 2, 3, and N, counting that the number of all child node servers and the number of all main node servers are N.
303. Generating an initial matrix based on the sorting labels according to the quantity;
in this embodiment, a zero matrix of N × N is generated according to the number N, and the label of each zero element is a11、a12、a13、....、a1n、a21、a22、a23、...、a2n、....annWherein a isijRepresenting access rights between the i-node server and the j-node server, aijNo access rights are stated, aijThe access right is stated as 1.
304. Analyzing all corresponding authorization paths in the access authority setting;
in this embodiment, the data that is authorized or not in all the access permission settings is analyzed, and then the set of authorized paths is obtained, where node 1 and node n, node 2 and node n, node 3 and node n, node n-1, and node n.
305. Modifying the initial matrix according to all the authorization paths to generate an access authority matrix;
in this embodiment, it is sequentially determined whether the node 1 and the node n, the node 2 and the node n, the node 3 and the node n, · and the node n-1 and the node n are authorized, and if so, the element 0 is modified to the element 1 at the corresponding position in the initial matrix, and an access right matrix is generated.
306. Reading all connection paths in the access right matrix;
in this embodiment, the data of all connection paths in the access right matrix is analyzed to obtain a data set of {1-N Y, 1-2N.,. N-1-N Y }.
307. Respectively judging whether the connection path is the authorization path;
in this embodiment, {1-N Y, 1-2N,.. and N-1-N Y } sequentially determine whether node 1 and node N, node 1 and node 2,. and N-1 and node N are authorized paths.
308. If yes, reading a target data request corresponding to the connection path, and capturing target data from the first storage data according to the target data request;
in this embodiment, according to the fact that the target data requests of the node No. 1 and the node No. n are AA data, and the target data requests of the node No. 1 and the node No. 2 are SD data, corresponding target data are captured from the first storage data which are sequentially recorded.
309. Generating second storage data according to the target data corresponding to all the connection paths;
in this embodiment, all connection paths are combined with the target data, for example {1n, Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 8954, Time: xxxx.yy.zz; 2n, Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 844, Time: XXXX.IY.ZZ; ...; n-1n, Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 5554, Time: xxxx, io, zz, thus correspondingly combining to form second storage data.
310. Clearing database data corresponding to the first storage data in all the child node servers;
in this embodiment, the database storing the first storage data after accessing the first storage data in the child node server is emptied, so as to obtain a { nell } database.
311. Traversing all the connection paths of the child node servers, and modifying the database corresponding to the child node servers according to the target data corresponding to the connection paths in the second storage data;
in this embodiment, the connection paths of all child node servers are read, and the second storage data {1n, Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 8954, Time: xxxx.yy.zz; 2n, Access: y, TransactionID: QQW, From: a provice, To: b city, AMount: 844, Time: XXXX.IY.ZZ; ...; n-1n, Access: y, TransactionID: QQW, From: a provice, To: bcity, Amount: 5554, Time: and writing the data corresponding to XXXX, IO, ZZ into the corresponding nell to complete the data modification.
312. Confirming the database corresponding to each child node server as a correction child node database;
in this embodiment, the database { Access: y, TransactionID: QQW, From: aprovince, To: b city, AMount: 8954, Time: xxxx.yy.zz } is identified as a modified child node database.
313. And closing the data access link of each child node server in the main node server, and confirming all the corrected child node databases as the databases corresponding to the data access of the child node servers.
In the embodiment of the invention, the access right of each child node server is set by using the access matrix for each child node server, so that when the access right is modified in the block chain local area network, the access right of each child node server can be modified while data in the local area network is accessed.
With reference to fig. 4, the above description of the data storage method based on a block chain in the embodiment of the present invention is described, and a data storage device based on a block chain in the embodiment of the present invention is described below, where an embodiment of the data storage device based on a block chain in the embodiment of the present invention includes:
a reading module 401, configured to read first storage data of a master node server in a blockchain local area network, and acquire an access right setting of each child node server in the blockchain local area network corresponding to the first storage data, where the master node server includes a server that provides data access for each child node server;
a matrix generation module 402, configured to generate an access right matrix based on a preset matrix generation rule according to all the access right settings;
a data generating module 403, configured to generate second storage data according to the access right matrix and the first storage data and based on a preset data correction rule;
a modification module 404, configured to update the database of each child node server according to the second stored data, to obtain a modified child node database corresponding to each child node server;
and an authority setting module 405, configured to close a data access link of each child node server in the master node server, and determine all the modified child node databases as databases corresponding to data access of the child node servers.
In the embodiment of the invention, the access right of each child node server is set by using the access matrix for each child node server, so that when the access right is modified in the block chain local area network, the access right of each child node server can be modified while data in the local area network is accessed.
Referring to fig. 5, another embodiment of a data storage device based on a block chain according to an embodiment of the present invention includes:
a reading module 401, configured to read first storage data of a master node server in a blockchain local area network, and acquire an access right setting of each child node server in the blockchain local area network corresponding to the first storage data, where the master node server includes a server that provides data access for each child node server;
a matrix generation module 402, configured to generate an access right matrix based on a preset matrix generation rule according to all the access right settings;
a data generating module 403, configured to generate second storage data according to the access right matrix and the first storage data and based on a preset data correction rule;
a modification module 404, configured to update the database of each child node server according to the second stored data, to obtain a modified child node database corresponding to each child node server;
and an authority setting module 405, configured to close a data access link of each child node server in the master node server, and determine all the modified child node databases as databases corresponding to data access of the child node servers.
The data storage device based on the blockchain includes a preprocessing module 406, where the preprocessing module 406 is specifically configured to:
creating a database in the main node server and each sub-node server;
setting all the databases to be in a readable and writable state;
and writing the transaction data generated based on the blockchain into a database corresponding to the main node server to generate first storage data of the main node server.
Wherein the matrix generation module 402 is specifically configured to:
performing sorting label processing on all the child node servers and the main node server, and counting the common quantity of all the child node servers and the main node server;
generating an initial matrix based on the sorting labels according to the quantity;
analyzing all corresponding authorization paths in the access authority setting;
and modifying the initial matrix according to all the authorization paths to generate an access authority matrix.
The data generating module 403 is specifically configured to:
reading all connection paths in the access right matrix;
respectively judging whether the connection path is the authorization path;
if yes, reading a target data request corresponding to the connection path, and capturing target data from the first storage data according to the target data request;
and generating second storage data according to the target data corresponding to all the connection paths.
Wherein the modification module 404 is specifically configured to:
clearing database data corresponding to the first storage data in all the child node servers;
traversing all the connection paths of the child node servers, and modifying the database corresponding to the child node servers according to the target data corresponding to the connection paths in the second storage data;
and confirming the database corresponding to each child node server as a correction child node database.
The permission setting module 405 is specifically configured to:
inquiring data access links in the main node server, and closing ports of the data access links corresponding to all the sub-node servers;
reading data access ports of all the child node servers to obtain corresponding data access object sets;
and adding the corresponding correction sub-node database in all the data access object sets, and confirming the corresponding correction sub-node database as a priority access object.
The block chain-based data storage device includes an access application module 407, where the access application module 407 is specifically configured to:
receiving a data reading request in the child node server;
analyzing and acquiring the data reading request to obtain a network link request and a data request to be acquired;
judging whether the network link request is authorized or not according to the access authority matrix corresponding to the child node server;
if so, capturing data to be acquired from a correction sub-node database of the node server according to the network link request;
if not, sending the feedback information which is forbidden to be read to the child node server, and stopping data acquisition.
In the embodiment of the invention, the access right of each child node server is set by using the access matrix for each child node server, so that when the access right is modified in the block chain local area network, the access right of each child node server can be modified while data in the local area network is accessed.
Fig. 4 and 5 describe the data storage apparatus based on the block chain in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the data storage apparatus based on the block chain in the embodiment of the present invention is described in detail from the perspective of the hardware processing.
Fig. 6 is a schematic structural diagram of a blockchain-based data storage device according to an embodiment of the present invention, where the blockchain-based data storage device 600 may have relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 610 (e.g., one or more processors) and a memory 620, one or more storage media 630 (e.g., one or more mass storage devices) storing applications 633 or data 632. Memory 620 and storage medium 630 may be, among other things, transient or persistent storage. The program stored on the storage medium 630 may include one or more modules (not shown), each of which may include a series of instructions operating on the block chain based data storage device 600. Still further, the processor 610 may be configured to communicate with the storage medium 630 to execute a series of instruction operations in the storage medium 630 on the blockchain based data storage device 600.
The blockchain-based data storage device 600 may also include one or more power supplies 640, one or more wired or wireless network interfaces 650, one or more input-output interfaces 660, and/or one or more operating systems 631, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, and the like. Those skilled in the art will appreciate that the blockchain based data storage device architecture shown in fig. 6 does not constitute a limitation of blockchain based data storage devices and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and which may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the blockchain-based data storage method.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses, and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A data storage method based on a block chain is characterized in that the data storage method based on the block chain comprises the following steps:
reading first storage data of a main node server in a block chain local area network, and acquiring access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data, wherein the main node server comprises a server for providing data access for each sub-node server;
generating an access authority matrix based on a preset matrix generation rule according to all the access authority settings;
generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data;
updating the database of each child node server according to the second storage data to obtain a corrected child node database corresponding to each child node server;
and closing the data access link of each child node server in the main node server, and confirming all the corrected child node databases as the databases corresponding to the data access of the child node servers.
2. The blockchain-based data storage method according to claim 1, further comprising, before the reading the first storage data of the master node server in the blockchain local area network and obtaining the access right setting corresponding to the first storage data of each child node server in the blockchain local area network, the step of:
creating a database in the main node server and each sub-node server;
setting all the databases to be in a readable and writable state;
and writing the transaction data generated based on the blockchain into a database corresponding to the main node server to generate first storage data of the main node server.
3. The method for storing data based on block chain according to claim 1, wherein the generating an access right matrix based on a preset matrix generation rule according to all the access right settings comprises:
performing sorting label processing on all the child node servers and the main node server, and counting the common quantity of all the child node servers and the main node server;
generating an initial matrix based on the sorting labels according to the quantity;
analyzing all corresponding authorization paths in the access authority setting;
and modifying the initial matrix according to all the authorization paths to generate an access authority matrix.
4. The blockchain-based data storage method according to claim 3, wherein the access permission matrix includes a connection path and a target data request corresponding to the connection path, and wherein the generating of the second storage data based on a preset data correction rule according to the access permission matrix and the first storage data includes:
reading all connection paths in the access right matrix;
respectively judging whether the connection path is the authorization path;
if yes, reading a target data request corresponding to the connection path, and capturing target data from the first storage data according to the target data request;
and generating second storage data according to the target data corresponding to all the connection paths.
5. The method according to claim 4, wherein the updating the database of each child node server according to the second storage data to obtain the modified child node database corresponding to each child node server comprises:
clearing database data corresponding to the first storage data in all the child node servers;
traversing all the connection paths of the child node servers, and modifying the database corresponding to the child node servers according to the target data corresponding to the connection paths in the second storage data;
and confirming the database corresponding to each child node server as a correction child node database.
6. The method for block chain based data storage according to any one of claims 1 to 5, wherein said closing the data access link of each of said child node servers in said master node server and identifying all said modified child node databases as the databases corresponding to said child node server data access comprises:
inquiring data access links in the main node server, and closing ports of the data access links corresponding to all the sub-node servers;
reading data access ports of all the child node servers to obtain corresponding data access object sets;
and adding the corresponding correction sub-node database in all the data access object sets, and confirming the corresponding correction sub-node database as a priority access object.
7. The blockchain-based data storage method according to claim 1, further comprising, after the closing of the data access link of each of the child node servers in the master node server and the identification of all of the modified child node databases as databases corresponding to data access of the child node servers:
receiving a data reading request in the child node server;
analyzing and acquiring the data reading request to obtain a network link request and a data request to be acquired;
judging whether the network link request is authorized or not according to the access authority matrix corresponding to the child node server;
if so, capturing data to be acquired from a correction sub-node database of the node server according to the network link request;
if not, sending the feedback information which is forbidden to be read to the child node server, and stopping data acquisition.
8. A blockchain-based data storage device, the blockchain-based data storage device comprising:
the system comprises a reading module, a storage module and a processing module, wherein the reading module is used for reading first storage data of a main node server in a block chain local area network and obtaining access authority setting of each sub-node server in the block chain local area network corresponding to the first storage data, and the main node server comprises a server for providing data access for each sub-node server;
the matrix generation module is used for generating an access authority matrix based on a preset matrix generation rule according to all the access authority settings;
the data generation module is used for generating second storage data based on a preset data correction rule according to the access authority matrix and the first storage data;
the correction module is used for updating the database of each child node server according to the second storage data to obtain a corrected child node database corresponding to each child node server;
and the permission setting module is used for closing the data access link of each child node server in the main node server and confirming all the corrected child node databases as databases corresponding to the data access of the child node servers.
9. A blockchain-based data storage device, the blockchain-based data storage device comprising: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor invoking the instructions in the memory to cause the blockchain based data storage device to perform the blockchain based data storage method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, implements the blockchain-based data storage method according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010634107.7A CN111783141B (en) | 2020-07-02 | 2020-07-02 | Data storage method, device and equipment based on block chain and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010634107.7A CN111783141B (en) | 2020-07-02 | 2020-07-02 | Data storage method, device and equipment based on block chain and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111783141A true CN111783141A (en) | 2020-10-16 |
CN111783141B CN111783141B (en) | 2021-08-06 |
Family
ID=72758943
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010634107.7A Active CN111783141B (en) | 2020-07-02 | 2020-07-02 | Data storage method, device and equipment based on block chain and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111783141B (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113487286A (en) * | 2021-07-14 | 2021-10-08 | 重庆大宽科技发展有限公司 | Safety quality inspection system, method, computer equipment and storage medium |
CN113726749A (en) * | 2021-08-13 | 2021-11-30 | 刘应森 | Data management system based on big data and intelligent security |
CN114553766A (en) * | 2022-01-29 | 2022-05-27 | 福建星冠智通信息系统有限公司 | Block chain-based vehicle safety protection method and related device |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105528368A (en) * | 2014-09-30 | 2016-04-27 | 北京金山云网络技术有限公司 | A database migration method and device |
CN105550288A (en) * | 2015-12-10 | 2016-05-04 | 百度在线网络技术(北京)有限公司 | Database system updating method and management system |
US20170236196A1 (en) * | 2014-03-31 | 2017-08-17 | Monticello Enterprises, Llc | System and method for transitioning from a first site to a destination site in a one click purchasing state |
CN110011981A (en) * | 2019-03-15 | 2019-07-12 | 湖北工程学院 | A kind of credible cloud storage method and system based on block chain |
CN110309120A (en) * | 2018-03-06 | 2019-10-08 | 阿里巴巴集团控股有限公司 | Data processing method and data processing equipment |
-
2020
- 2020-07-02 CN CN202010634107.7A patent/CN111783141B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170236196A1 (en) * | 2014-03-31 | 2017-08-17 | Monticello Enterprises, Llc | System and method for transitioning from a first site to a destination site in a one click purchasing state |
CN105528368A (en) * | 2014-09-30 | 2016-04-27 | 北京金山云网络技术有限公司 | A database migration method and device |
CN105550288A (en) * | 2015-12-10 | 2016-05-04 | 百度在线网络技术(北京)有限公司 | Database system updating method and management system |
CN110309120A (en) * | 2018-03-06 | 2019-10-08 | 阿里巴巴集团控股有限公司 | Data processing method and data processing equipment |
CN110011981A (en) * | 2019-03-15 | 2019-07-12 | 湖北工程学院 | A kind of credible cloud storage method and system based on block chain |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113487286A (en) * | 2021-07-14 | 2021-10-08 | 重庆大宽科技发展有限公司 | Safety quality inspection system, method, computer equipment and storage medium |
CN113487286B (en) * | 2021-07-14 | 2023-04-07 | 重庆大宽科技发展有限公司 | Safety quality inspection system, method, computer equipment and storage medium |
CN113726749A (en) * | 2021-08-13 | 2021-11-30 | 刘应森 | Data management system based on big data and intelligent security |
CN114553766A (en) * | 2022-01-29 | 2022-05-27 | 福建星冠智通信息系统有限公司 | Block chain-based vehicle safety protection method and related device |
CN114553766B (en) * | 2022-01-29 | 2024-07-26 | 福建星冠智通信息系统有限公司 | Vehicle safety protection method based on block chain and related device |
Also Published As
Publication number | Publication date |
---|---|
CN111783141B (en) | 2021-08-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN111783141B (en) | Data storage method, device and equipment based on block chain and storage medium | |
US10565498B1 (en) | Deep neural network-based relationship analysis with multi-feature token model | |
JP2021527274A (en) | Distributed access, storage, and transfer of blockchain | |
US7814459B2 (en) | System and method for automated on demand replication setup | |
CN109997126A (en) | Event-driven is extracted, transformation, loads (ETL) processing | |
US7720863B2 (en) | Security view-based, external enforcement of business application security rules | |
CN103890709B (en) | Key value database based on caching maps and replicates | |
US7467140B2 (en) | System, method, and article of manufacture for maintaining and accessing a whois database | |
US20230244684A1 (en) | Techniques for decoupling access to infrastructure models | |
KR20190079324A (en) | Method and system for enhancing integrity of batabase based on the block chain system | |
US20050234934A1 (en) | System and method for controlling the release of updates to a database configuration | |
US20150066951A1 (en) | Combined deterministic and probabilistic matching for data management | |
CN113711221A (en) | Efficient chained record access | |
US10599614B1 (en) | Intersection-based dynamic blocking | |
US20230136439A1 (en) | Systems and methods for cloud-based federated records retention compliance orchestration, validation and enforcement | |
US11847121B2 (en) | Compound predicate query statement transformation | |
Parmar et al. | MongoDB as an efficient graph database: An application of document oriented NOSQL database | |
CN108121712A (en) | A kind of keyword storage method and device | |
US20240127379A1 (en) | Generating actionable information from documents | |
Abdelhafiz | Distributed database using sharding database architecture | |
CN109634976A (en) | O&M method, apparatus, system and the readable storage medium storing program for executing of non-relational database | |
JP2023543926A (en) | Method and system for storing genomic data in a file structure including an information metadata structure | |
US8270612B2 (en) | Mapping compound keys | |
US10769110B2 (en) | Facilitating queries for interaction data with visitor-indexed data objects | |
JP6631139B2 (en) | Search control program, search control method, and search server device |
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 |