Disclosure of Invention
The embodiment of the application provides a data synchronization method and a related device based on a block chain so as to improve the safety of data synchronization.
The specific technical scheme provided by the embodiment of the application is as follows:
a blockchain-based data synchronization method, the blockchain network including a plurality of core cloud nodes and edge nodes, the method comprising:
Any core cloud node responds to a data synchronization request sent by the edge node, verifies a hash value in the data synchronization request, and determines a hash value verification result corresponding to the hash value, wherein the data synchronization request comprises data to be synchronized and the hash value acquired by the edge node;
Obtaining hash value verification results corresponding to other core cloud nodes, and determining node verification results of the edge nodes based on the hash value verification results;
And based on the node verification result, carrying out data synchronization on the data to be synchronized.
Optionally, verifying the hash value in the data synchronization request, and determining a hash value verification result corresponding to the hash value specifically includes:
Determining corresponding hash value sequence information based on node identifiers corresponding to any core cloud node;
Determining a corresponding node hash value from the hash values based on the hash value sequence information, wherein the hash value comprises node hash values corresponding to each core cloud node, and the node hash values are arranged based on a preset sequence;
And determining a hash value verification result based on the node hash value and in combination with a preset hash value authentication rule.
Optionally, determining the hash value verification result specifically includes:
If the node hash value is determined to be the same as the prestored standard node hash value, determining that the corresponding hash value verification result is passed;
If the node hash value is determined to be different from the standard node hash value, determining that the corresponding hash value verification result is failed.
Optionally, determining the node verification result of the edge node based on each hash value verification result specifically includes:
determining the number of the hash value verification results passing through from the hash value verification results, and taking the number of the hash value verification results as the number of the results corresponding to the edge nodes;
If the number of the results is not smaller than a preset number threshold, determining that the node verification result corresponding to the edge node is passed;
If the number of the results is smaller than a preset number threshold, determining that the node verification result corresponding to the edge node is failed.
Optionally, based on the node verification result, performing data synchronization on the data to be synchronized specifically includes:
If the node verification result is determined to be passed, carrying out data synchronization on the data to be synchronized by adopting a preset data synchronization mode;
if the node verification result is determined to be failed, determining the edge node as a problem node, generating alarm information based on the node verification result, and sending the alarm information to a client for display.
Optionally, a preset data synchronization mode is adopted to perform data synchronization on the data to be synchronized, which specifically includes:
reading a node authority type, wherein the node authority type is provided with a packaging authority and a non-authority;
If the node authority type is determined to have the packaging authority, packaging the data to be synchronized to obtain updated data, and storing the updated data into a preset system database;
If the node authority type is determined to be non-authority, a synchronization instruction is sent to a core cloud node with the node authority type being packaging authority, so that the core cloud node with the node authority type being packaging authority packages the data to be synchronized, update data is obtained, and the update data is stored in the system database.
A blockchain-based data synchronization method, the blockchain network including a plurality of core cloud nodes and edge computing nodes, the method comprising:
the edge node acquires data to be synchronized and determines a hash value;
generating a data synchronization request containing the data to be synchronized and the hash value;
And respectively sending the data synchronization requests to the plurality of core cloud nodes, so that the plurality of core cloud nodes respectively respond to the data synchronization requests sent by the edge nodes, verify hash values in the data synchronization requests, determine hash value verification results corresponding to the hash values, acquire hash value verification results corresponding to other core cloud nodes, determine node verification results of the edge nodes based on the hash value verification results, and perform data synchronization on the data to be synchronized based on the node verification results.
A blockchain-based data synchronization apparatus, the blockchain network including a plurality of core cloud nodes and edge nodes, the apparatus being applied to any one core cloud node, the apparatus comprising:
the verification module is used for verifying the hash value in the data synchronization request in response to the data synchronization request sent by the edge node by any core cloud node and determining a hash value verification result corresponding to the hash value, wherein the data synchronization request comprises the data to be synchronized and the hash value acquired by the edge node;
the determining module is used for acquiring hash value verification results corresponding to other core cloud nodes and determining node verification results of the edge nodes based on the hash value verification results;
and the processing module is used for carrying out data synchronization on the data to be synchronized based on the node verification result.
Optionally, the hash value in the data synchronization request is verified, a hash value verification result corresponding to the hash value is determined, and the verification module is further configured to:
Determining corresponding hash value sequence information based on node identifiers corresponding to any core cloud node;
Determining a corresponding node hash value from the hash values based on the hash value sequence information, wherein the hash value comprises node hash values corresponding to each core cloud node, and the node hash values are arranged based on a preset sequence;
And determining a hash value verification result based on the node hash value and in combination with a preset hash value authentication rule.
Optionally, when determining the hash value verification result, the verification module is further configured to:
If the node hash value is determined to be the same as the prestored standard node hash value, determining that the corresponding hash value verification result is passed;
If the node hash value is determined to be different from the standard node hash value, determining that the corresponding hash value verification result is failed.
Optionally, when determining the node verification result of the edge node based on each hash value verification result, the determining module is further configured to:
determining the number of the hash value verification results passing through from the hash value verification results, and taking the number of the hash value verification results as the number of the results corresponding to the edge nodes;
If the number of the results is not smaller than a preset number threshold, determining that the node verification result corresponding to the edge node is passed;
If the number of the results is smaller than a preset number threshold, determining that the node verification result corresponding to the edge node is failed.
Optionally, the processing module is further configured to:
If the node verification result is determined to be passed, carrying out data synchronization on the data to be synchronized by adopting a preset data synchronization mode;
if the node verification result is determined to be failed, determining the edge node as a problem node, generating alarm information based on the node verification result, and sending the alarm information to a client for display.
Optionally, a preset data synchronization mode is adopted, and when data synchronization is performed on the data to be synchronized, the processing module is further configured to:
reading a node authority type, wherein the node authority type is provided with a packaging authority and a non-authority;
If the node authority type is determined to have the packaging authority, packaging the data to be synchronized to obtain updated data, and storing the updated data into a preset system database;
If the node authority type is determined to be non-authority, a synchronization instruction is sent to a core cloud node with the node authority type being packaging authority, so that the core cloud node with the node authority type being packaging authority packages the data to be synchronized, update data is obtained, and the update data is stored in the system database.
A blockchain-based data synchronization device, the blockchain network including a plurality of core cloud nodes and edge nodes to which the device is applied, the device comprising:
The acquisition module is used for acquiring data to be synchronized and determining a hash value;
The generation module is used for generating a data synchronization request containing the data to be synchronized and the hash value;
And the processing module is used for respectively sending the data synchronization requests to the plurality of core cloud nodes, so that the plurality of core cloud nodes respectively respond to the data synchronization requests sent by the edge nodes, verify the hash values in the data synchronization requests, determine hash value verification results corresponding to the hash values, acquire hash value verification results corresponding to other core cloud nodes, determine node verification results of the edge nodes based on the hash value verification results, and perform data synchronization on the data to be synchronized based on the node verification results.
An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the blockchain-based data synchronization method described above when the program is executed.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the blockchain-based data synchronization method described above.
In the embodiment of the application, any core cloud node responds to a data synchronization request sent by an edge node, verifies a hash value in the data synchronization request, determines a hash value verification result corresponding to the hash value, wherein the data synchronization request comprises data to be synchronized and the hash value acquired by the edge node, acquires hash value verification results corresponding to other core cloud nodes, determines a node verification result of the edge node based on the hash value verification results, and performs data synchronization on the data to be synchronized based on the node verification result. Therefore, when the edge node initiates the data synchronization request, the node verification result of the edge node needs to be determined based on the hash value verification results corresponding to each core cloud node in the group, and the data synchronization is realized based on the node verification results, so that single-point authentication is converted into distributed authentication, and even if the edge node is broken, the authentication of all the core cloud nodes cannot be passed, thereby improving the security of the data synchronization.
Detailed Description
The following description of the embodiments of the present application will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments, but not all embodiments of the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
With the rapid development of the industrial internet along with the digitized transformation and upgrading of enterprises, more and more applications need to be deployed towards the edge to realize closer users, quicker interaction and lossless information transmission, such as remote medical treatment, industrial control, internet of vehicles and other scenes. Edge clouds are a major trend in the current development of cloud computing.
Edge cloud implementations bring computing, storage, network capabilities closer to user distributed deployment. In the edge computation of the cloud edge collaboration scene, a large amount of information is required to be transferred between the core cloud node and the edge node, and the cloud edge collaboration is very important characteristic and requirement in the edge computation, and comprises various synergies such as resource collaboration, application collaboration, data collaboration, intelligent collaboration and the like.
In the cloud-edge cooperative data synchronization, because the number of edge nodes is large and the security measures of the edge nodes are relatively weaker than those of the core cloud nodes, the risks of leakage from the edge nodes and illegal data uploading from the edge nodes in the data synchronization process must be prevented and controlled.
In the related art, when performing data synchronization of cloud-edge collaboration, the data synchronization can be generally achieved in the following two ways.
The first mode is that the edge node uploads the data transmitted from the user side to the nearest core cloud node through an encryption channel or uploads the data to the home core cloud node for synchronization, then the core cloud node receives the data through the encryption channel, when the received data is verified to have no problem, the data is stored in a system database, and according to the actual requirements of the system and the application, the core cloud node determines whether to synchronize the data to other edge nodes.
And the second mode is that the edge node uploads the data transmitted from the user side to the nearest core cloud node in a data encryption mode or uploads the data to the home core cloud node in a synchronization mode, then the core cloud node decrypts the received data, and when the received data is verified to have no problem, the data is stored in a system database, and according to the actual requirements of the system and the application, the core cloud node determines whether to synchronize the data to other edge nodes.
However, the data synchronization method of the cloud edge collaboration scene in the related art is still an update method of single-point verification, and is also a set of encryption on a channel between an edge node and a core cloud node or encryption on data transmitted between an edge node and a core cloud node, so that when the edge node is broken, an illegal data synchronization request can be initiated to the core cloud node, thereby causing the whole system data to be tampered and damaged or monitored and stolen, having larger security risk and reducing the security of data synchronization.
In order to solve the above problems, in an embodiment of the present application, a data synchronization method based on a blockchain is provided, any one core cloud node verifies a hash value in a data synchronization request in response to a data synchronization request sent by an edge node, determines a hash value verification result corresponding to the hash value, the data synchronization request includes data to be synchronized and the hash value obtained by the edge node, obtains hash value verification results corresponding to other core cloud nodes, determines a node verification result of the edge node based on the hash value verification results, and performs data synchronization on the data to be synchronized based on the node verification result. Therefore, the data synchronization is changed from single-point encryption and single-point authentication into distributed verification and authentication, any edge node initiates a data synchronization request, and the data synchronization can be performed only by the verification of all core cloud nodes in the group, so that the security of the data synchronization can be improved.
Based on the above embodiments, referring to fig. 1, a schematic view of a data synchronization method based on a blockchain in an embodiment of the present application is shown, which specifically includes:
And grouping and classifying each core cloud node and each edge node in the original cloud computing, wherein each edge node belongs to a group of core cloud nodes, so that the blockchain network comprises a plurality of node groups, and each node group comprises one edge node and a plurality of core cloud nodes.
As shown in fig. 1, each core cloud node in the blockchain network is A, B, C, D, E, each edge node is a, B, C, D, E, f, g, h, i, j, k, each core cloud node and each edge node are grouped and classified, edge node a, core cloud node B and core cloud node C are grouped, edge node f, core cloud node B, core cloud node C and core cloud node D are grouped, and edge node j, core cloud node C, core cloud node D and core cloud node E are grouped.
Each core cloud node in one group is used as a stakeholder node of a blockchain, a part of core cloud nodes in the authorized group are assigned to have the rights of blockchain accounting and data storage, each core cloud node verifies hash values in data synchronization requests respectively, hash value verification results corresponding to the hash values are determined, hash value verification results corresponding to other core cloud nodes in one group are obtained, node verification results of edge nodes are determined based on the hash value verification results, and data synchronization is performed on data to be synchronized based on the node verification results.
The edge computing nodes in the group are used as common nodes of the blockchain, receive data to be synchronized, which are automatically acquired by a user or a system, generate data synchronization requests based on the data to be synchronized, and respectively send the data synchronization requests to each core cloud node in the group.
Based on the above embodiments, referring to fig. 2, a flow chart of a data synchronization method based on a blockchain in an embodiment of the present application specifically includes:
And S20, any core cloud node responds to the data synchronization request sent by the edge node, verifies the hash value in the data synchronization request and determines a hash value verification result corresponding to the hash value.
The data synchronization request comprises data to be synchronized and a hash value acquired by the edge node.
In the embodiment of the application, the blockchain network comprises a plurality of core cloud nodes and an edge node, and the edge node sends a data synchronization request to each core cloud node in the blockchain network, so that after receiving the data synchronization request sent by the edge node, any core cloud node responds to the received data synchronization request to verify the hash value in the data synchronization request, and a hash value verification result corresponding to the hash value is obtained.
The data to be synchronized is update data received by the edge node from a user or automatically acquired by the system, and the update data may be, for example, local temperature, humidity and other information acquired by an industrial sensor.
Optionally, in the embodiment of the present application, a possible implementation manner is provided for determining a hash value verification result corresponding to a hash value, and a process for determining the hash value verification result in the embodiment of the present application is described in detail below, which specifically includes:
s201, determining corresponding hash value sequence information based on node identifiers corresponding to any core cloud node.
In the embodiment of the application, each core cloud node in the blockchain network corresponds to one node hash value, and the hash values are generated by arranging the node hash values corresponding to the core cloud nodes according to the preset sequence, so that each core cloud node is associated with corresponding hash value sequence information, and the hash value sequence information associated with the core cloud node can be determined based on the node identifier corresponding to any core cloud node.
It should be noted that, in the embodiment of the present application, the hash value sequence information is used to indicate the sequence of the node hash value corresponding to a certain core cloud node in the hash value.
In addition, it should be noted that in the embodiment of the present application, each core cloud node corresponds to one hash value sequence information, for example, a node identifier of the core cloud node a is 1, and hash value sequence information associated with the node identifier 1 is first, and then the node hash value corresponding to the core cloud node is arranged in the first bit in the hash values of the nodes.
S202, determining a corresponding node hash value from the hash values based on the hash value sequence information.
The hash value comprises node hash values corresponding to each core cloud node, and the node hash values are arranged based on a preset sequence.
In the embodiment of the application, after the hash value sequence information is obtained, the corresponding node hash value can be determined from the node hash values which are arranged according to the sequence.
For example, assume that the hash value is 99,100,20,31, where the node corresponding to the core cloud node a is identified as 1, the node corresponding to the core cloud node B is identified as 2, the node corresponding to the core cloud node C is identified as 3, and the node corresponding to the core cloud node D is identified as 4. If the core cloud node is the core cloud node B, determining that the corresponding hash value sequence information is third according to the node identifier 2 corresponding to the core cloud node B, and therefore determining that the node hash value corresponding to the core cloud node is 20 from the hash values according to the hash value sequence information.
In the embodiment of the application, different core cloud nodes in the group are respectively provided with different blockchain verification passwords, and the node hash value is generated by combining a hash algorithm according to the blockchain verification passwords corresponding to the core cloud nodes. The block chain verification password in the embodiment of the application is transmitted after being calculated by a hash algorithm, and is not transmitted by a plaintext, so that the safety of data synchronization can be improved.
S203, determining a hash value verification result based on the node hash value and combining a preset hash value authentication rule.
In the embodiment of the application, the hash value verification result is determined based on the node hash value and in combination with a preset hash value authentication rule, and specifically, the hash value verification result can be determined through the corresponding node hash value verification result.
Optionally, in the embodiment of the present application, a possible implementation manner is provided for determining the hash value verification result, and in the following embodiment of the present application, a process for determining the hash value verification result is described in detail, which specifically includes:
and S203-1, if the node hash value is determined to be the same as the prestored standard node hash value, determining that the corresponding hash value verification result is passed.
In the embodiment of the application, whether the node hash value is the same as the prestored standard node hash value is judged, and if the node hash value is the same as the prestored standard node hash value, the corresponding hash value verification result is determined to be passed.
And S203-2, if the node hash value is determined to be different from the standard node hash value, determining that the corresponding hash value verification result is failed.
In the embodiment of the application, whether the node hash value is the same as the prestored standard node hash value is judged, and if the node hash value is different from the prestored standard node hash value, the corresponding hash value verification result is determined to be failed.
In the embodiment of the application, the validity and compliance of the data to be synchronized are checked, so that the data to be synchronized is ensured to be legal.
S21, obtaining hash value verification results corresponding to other core cloud nodes, and determining node verification results of the edge nodes based on the hash value verification results.
In the embodiment of the application, hash value verification results corresponding to other core cloud nodes are obtained, and node verification results of the edge nodes are determined based on the hash value verification results.
Optionally, in the embodiment of the present application, a possible implementation manner is provided for determining hash value verification results corresponding to core cloud nodes, and a process for determining node verification results of edge nodes in the embodiment of the present application is described in detail below, which specifically includes:
S211, determining the number of the hash value verification results as the number of the results corresponding to the edge nodes from the hash value verification results.
In the embodiment of the application, since the hash value verification results are divided into pass and fail, the hash value verification results are counted as the pass number in each hash value verification result, and the determined number is used as the result number corresponding to the edge node.
For example, assuming that the hash value verification result corresponding to the core cloud node a is passing, the hash value verification result corresponding to the core cloud node B is passing, the hash value verification result corresponding to the core cloud node C is not passing, and the hash value verification result corresponding to the core cloud node D is passing, the number of the hash value verification results passing is determined to be 3, so the number of the results corresponding to the edge nodes is 3.
And S212, if the number of the determined results is not smaller than the preset number threshold, determining that the node verification result corresponding to the edge node is passed.
In the embodiment of the application, whether the number of the results is not smaller than the preset number threshold is judged, and if the number of the results is not smaller than the preset number threshold, the node verification result corresponding to the edge node is determined to be passed.
For example, assuming that the number of results is 10 and the preset number threshold is 9, it is determined that the node verification result corresponding to the edge node is passed.
It should be noted that, in the embodiment of the present application, the number threshold is determined based on the number of core cloud nodes and the verification success percentage.
For example, assuming that the number of core cloud nodes is 20 and the verification success percentage is 90%, the calculated number threshold is 18, that is, if the number of the determined results is greater than or equal to 18, the node verification result corresponding to the edge node is determined to be passed, and if the number of the determined results is less than 18, the node verification result corresponding to the edge node is determined to be failed.
And S213, if the number of the determined results is smaller than the preset number threshold, determining that the node verification result corresponding to the edge node is failed.
In the embodiment of the application, whether the number of the results is not smaller than the preset number threshold is judged, and if the number of the results is smaller than the preset number threshold, the node verification result corresponding to the edge node is determined to be failed.
For example, assuming that the number of results is 7 and the preset number threshold is 9, it is determined that the node verification result corresponding to the edge node is failed.
Optionally, in the embodiment of the present application, a possible implementation manner is further provided for determining a node verification result corresponding to an edge node, specifically, counting the number of passing hash value verification results, determining a ratio between the number of passing hash value verification results and the number of nodes of all core cloud nodes according to the number of passing hash value verification results, if the calculated ratio is determined not to be smaller than a preset ratio threshold, determining that the node verification result corresponding to the edge node is passing, and if the calculated ratio is determined to be smaller than the preset ratio threshold, determining that the node verification result corresponding to the edge node is not passing.
For example, assuming that the number of the counted hash value verification results is 10 and there are 20 core cloud nodes in total, if the number of the counted hash value verification results is 10, calculating the ratio of the number of the passing hash values to the number of all core cloud nodes to be 0.5, determining that the calculated ratio of 0.5 is smaller than a preset ratio threshold value of 0.8, and determining that the node verification result corresponding to the edge node is failed.
For another example, assuming that the number of the counted hash value verification results is 9 and 10 core cloud nodes are total, each hash value verification result is 9, the ratio between the number of the passing results and the number of all core cloud nodes is calculated to be 0.9, the calculated ratio 0.9 is determined to be greater than a preset ratio threshold value 0.8, the hash value verification result of the core cloud nodes in the group is determined to be that the passing ratio reaches the ratio threshold value, the node verification result corresponding to the edge node is determined to be passing, and the edge node passes authentication.
And S22, carrying out data synchronization on the data to be synchronized based on the node verification result.
In the embodiment of the application, after the node verification result is obtained, the data to be synchronized in the data synchronization request can be synchronized based on the node verification result.
Optionally, in the embodiment of the present application, a possible implementation manner is provided for performing data synchronization on data to be synchronized based on a node verification result, and a data synchronization process for data to be synchronized in the embodiment of the present application is described in detail below, which specifically includes:
S221, if the node verification result is determined to be passed, carrying out data synchronization on the data to be synchronized by adopting a preset data synchronization mode.
S2211, reading the node authority type.
The node authority types are package authority and no authority.
In the embodiment of the application, each core cloud node corresponds to a node authority type, and the node authority types are divided into a packaging authority type and a non-authority type, so that the node authority types of the core cloud nodes are read.
The specific packaging authority characterizes the core cloud node to have the authority of packaging the data to be synchronized, and the non-authority characterizes the core cloud node not to have the authority of packaging the data to be synchronized.
S2212, if the node authority type is determined to have the packaging authority, packaging the data to be synchronized to obtain updated data, and storing the updated data into a preset system database.
In the embodiment of the application, if the node authority type is determined to have the packaging authority, the data to be synchronized in the data synchronization request is packaged and uplink to obtain the updated data, and the updated data is stored in a preset system database.
S2213, if the node authority type is determined to be non-authority, a synchronous instruction is sent to the core cloud node with the node authority type of packing authority, so that the core cloud node with the node authority type of packing authority packs data to be synchronized, update data is obtained, and the update data is stored in a system database.
In the embodiment of the application, if the node authority type is determined to be non-authority, a synchronous instruction is sent to the core cloud node with the node authority type of packing authority, so that the core cloud node with the node authority type of packing authority corresponds to the node authority type to pack the data to be synchronized, update data is obtained, and the update data is stored in a system database, thereby realizing synchronous processing of the data to be synchronized.
For example, referring to FIG. 3, a block chain block diagram is shown in which each block is used to package verification and data update information and form hash values from node hash values in accordance with an embodiment of the present application.
And S222, if the node verification result is determined to be failed, determining the edge node as a problem node, generating alarm information based on the node verification result, and sending the alarm information to the client for display.
In the embodiment of the application, if the node verification result is not passed, determining the edge node as a problem node, generating relevant alarm information based on the node verification result, and sending the generated alarm information to the client for display, thereby determining the working state of the edge node by an administrator and deciding whether the edge node is required to be out of service.
In the embodiment of the application, the data synchronization process is changed from original single-point encryption and single-point authentication into distributed verification and authentication, any edge node initiates data synchronization, all core cloud nodes in the group need to be verified, and only the core cloud nodes with the hash value verification result that the number of the core cloud nodes passes through the threshold exceeds the preset number can perform data synchronization through verification, so that the safety of data synchronization can be ensured, in addition, in the embodiment of the application, in the data synchronization request, the verification passwords are not sent in the plaintext, the results of the hash values of the nodes are arranged in sequence, the messages are intercepted in time, the passwords cannot be cracked, and the security of data synchronization is further improved.
Based on the above embodiments, referring to fig. 4, another flowchart of a data synchronization method based on a blockchain in an embodiment of the present application specifically includes:
s40, acquiring data to be synchronized, and determining a hash value.
In the embodiment of the application, the edge node receives the data to be synchronized and determines the hash value corresponding to each core cloud node.
It should be noted that, when the edge node receives the data to be synchronized, the edge node may be divided into two modes, the first mode, for receiving the data to be synchronized uploaded by the user, and the second mode, for receiving the data to be synchronized automatically acquired by the system.
The data to be synchronized may be, for example, local temperature, humidity, etc. information acquired by an industrial sensor, which is not limited in the embodiment of the present application.
And S41, generating a data synchronization request containing data to be synchronized and a hash value.
In the embodiment of the application, the data synchronization request is generated based on the data to be synchronized and the hash value, so that the data synchronization request contains the data to be synchronized and the hash value.
And S42, respectively transmitting the data synchronization request to a plurality of core cloud nodes, so that the plurality of core cloud nodes respectively respond to the data synchronization request transmitted by the edge node, verify the hash value in the data synchronization request, determine hash value verification results corresponding to the hash value, acquire hash value verification results corresponding to other core cloud nodes, determine node verification results of the edge node based on the hash value verification results, and perform data synchronization on the data to be synchronized based on the node verification results.
In the embodiment of the application, the data synchronization request is respectively sent to the plurality of core cloud nodes in the group, so that the plurality of core cloud nodes respectively respond to the data synchronization request sent by the edge node after receiving the data synchronization request, verify the hash value in the data synchronization request, determine the hash value verification result corresponding to the hash value, then acquire the hash value verification results corresponding to other core cloud nodes respectively, and determine the node verification result corresponding to the edge node based on the hash value verification results, thereby determining whether the data to be synchronized uploaded by the edge node can be synchronized based on the node verification result.
Further, in the embodiment of the present application, the edge node may also receive data sent by the core cloud node, which is not limited in the embodiment of the present application.
Based on the same inventive concept, the embodiment of the application also provides a data synchronization device based on the block chain, wherein the data synchronization device based on the block chain can be a hardware structure, a software module or a hardware structure plus a software module. Based on the above embodiments, referring to fig. 5, in an embodiment of the present application, a block chain-based data synchronization device is shown, which specifically includes:
The verification module 500 is configured to verify a hash value in a data synchronization request sent by an edge node in response to the data synchronization request by any one core cloud node, and determine a hash value verification result corresponding to the hash value;
The determining module 510 is configured to obtain hash value verification results corresponding to other core cloud nodes, and determine a node verification result of the edge node based on the hash value verification results;
and the processing module 520 is configured to perform data synchronization on the data to be synchronized based on the node verification result.
Optionally, the hash value in the data synchronization request is verified, and a hash value verification result corresponding to the hash value is determined, and the verification module 500 is further configured to:
Determining corresponding hash value sequence information based on node identifiers corresponding to any core cloud node;
Determining a corresponding node hash value from the hash values based on the hash value sequence information, wherein the hash value comprises node hash values corresponding to each core cloud node, and the node hash values are arranged based on a preset sequence;
And determining a hash value verification result based on the node hash value and in combination with a preset hash value authentication rule.
Optionally, when determining the hash value verification result, the verification module 500 is further configured to:
If the node hash value is determined to be the same as the prestored standard node hash value, determining that the corresponding hash value verification result is passed;
If the node hash value is determined to be different from the standard node hash value, determining that the corresponding hash value verification result is failed.
Optionally, when determining the node verification result of the edge node based on each hash value verification result, the determining module 510 is further configured to:
determining the number of the hash value verification results passing through from the hash value verification results, and taking the number of the hash value verification results as the number of the results corresponding to the edge nodes;
If the number of the results is not smaller than a preset number threshold, determining that the node verification result corresponding to the edge node is passed;
If the number of the results is smaller than a preset number threshold, determining that the node verification result corresponding to the edge node is failed.
Optionally, the processing module 520 is further configured to:
If the node verification result is determined to be passed, carrying out data synchronization on the data to be synchronized by adopting a preset data synchronization mode;
if the node verification result is determined to be failed, determining the edge node as a problem node, generating alarm information based on the node verification result, and sending the alarm information to a client for display.
Optionally, when the data to be synchronized is synchronized by adopting a preset data synchronization manner, the processing module 520 is further configured to:
reading a node authority type, wherein the node authority type is provided with a packaging authority and a non-authority;
If the node authority type is determined to have the packaging authority, packaging the data to be synchronized to obtain updated data, and storing the updated data into a preset system database;
If the node authority type is determined to be non-authority, a synchronization instruction is sent to a core cloud node with the node authority type being packaging authority, so that the core cloud node with the node authority type being packaging authority packages the data to be synchronized, update data is obtained, and the update data is stored in the system database.
Based on the same inventive concept, another data synchronization device based on a block chain is also provided in the embodiment of the present application, where the data synchronization device based on a block chain may be a hardware structure, a software module, or a hardware structure plus a software module. Based on the above embodiments, referring to fig. 6, a schematic structural diagram of another data synchronization device based on a blockchain in an embodiment of the present application specifically includes:
an obtaining module 600, configured to obtain data to be synchronized and determine a hash value;
a generating module 610, configured to generate a data synchronization request including the data to be synchronized and the hash value;
And the processing module 620 is configured to send the data synchronization request to the plurality of core cloud nodes, so that the plurality of core cloud nodes respectively respond to the data synchronization request sent by the edge node, verify hash values in the data synchronization request, determine hash value verification results corresponding to the hash values, obtain hash value verification results corresponding to other core cloud nodes, determine node verification results of the edge node based on the hash value verification results, and perform data synchronization on the data to be synchronized based on the node verification results.
Based on the above embodiments, referring to fig. 7, a schematic structural diagram of an electronic device according to an embodiment of the present application is shown.
Embodiments of the present application provide an electronic device that may include a processor 710 (Center Processing Unit, a CPU), a memory 720, an input device 730, an output device 740, and the like, where the input device 730 may include a keyboard, a mouse, a touch screen, and the like, and the output device 740 may include a display device, such as a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), a Cathode Ray Tube (CRT), and the like.
Memory 720 may include Read Only Memory (ROM) and Random Access Memory (RAM) and provides processor 710 with program instructions and data stored in memory 720. In an embodiment of the present application, the memory 720 may be used to store a program of any of the blockchain-based data synchronization methods in the embodiment of the present application.
Processor 710 is configured to execute any of the blockchain-based data synchronization methods of the embodiments of the present application in accordance with the obtained program instructions by calling the program instructions stored in memory 720 by processor 710.
Based on the above embodiments, in the embodiments of the present application, there is provided a computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the blockchain-based data synchronization method in any of the method embodiments described above.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It will be apparent to those skilled in the art that various modifications and variations can be made to the present application without departing from the spirit or scope of the application. Thus, it is intended that the present application also include such modifications and alterations insofar as they come within the scope of the appended claims or the equivalents thereof.