Disclosure of Invention
The invention aims to provide a power data storage and sharing method.
To solve the above problems, the present invention provides a power data storage and sharing method, including:
the internal nodes of the power grid company store the address index of the power data of the bottom database by using the internal chain of the block chain;
an external chain of the block chain communicates access power data requests of external nodes and stores access records based on the access power data requests and the address index.
Further, in the above method, before the power grid company internal node uses the internal chain to store the address index of the power data in the underlying database, the method further includes:
and the data uploader formulates an access control strategy tree for the electric power data according to the authority requirement, randomly generates a symmetric encryption key, and puts the electric power data into the bottom database after symmetric encryption calculation.
Further, in the above method, the step of putting the electric power data into the bottom database after the symmetrical encryption calculation includes:
and the internal node of the power grid company encrypts the address index and the symmetric encryption key according to the access control strategy tree and broadcasts the address index and the symmetric encryption key to the block chain, and meanwhile, the internal node of the power grid company generates a mapping relation between the address index and data on the chain and puts the mapping relation into the bottom database.
Further, in the above method, before the external chain of the block chain transfers the request for accessing the power data from the external node, the method further includes:
and each external node generates a token containing the authority and attribute information of the external node, and then the external node which sends out the request for accessing the power data encrypts data which is subjected to intersection operation by other external nodes by using an access control strategy tree so as to enable the data to only meet the attribute of the requested enterprise.
Further, in the above method, an external chain of the block chain transfers an access power data request of an external node, and stores an access record based on the access power data request and the address index, including:
and the external node sending the request for accessing the power data sends the encrypted data and the token of the external node to an external chain, all the nodes can see and record the message, the source node is judged according to the information in the token, but only the edge node which accords with the access control strategy tree contained in the cipher text can decrypt the message, and after the edge node completes decryption, if the token meets the access control strategy tree of the intersection data, the edge node automatically performs intersection operation on the data and returns the data to the external node sending the request for accessing the power data through a safety channel.
Further, in the above method, after the edge node automatically performs an intersection operation on the data and returns the data to the internal node of the power grid company that issued the request for accessing the power data through the secure channel, the method further includes:
and globally broadcasting a piece of data containing the token, indicating that the intersection operation is completed, and recording the action on the external block chain after the other nodes confirm the action.
Compared with the existing storage model, the invention has the following effective effects:
the invention provides a block chain-based power data storage model.A power grid company internal node uses an internal chain to store an address index of bottom-layer database data. The external chain passes the request and stores the access record. Therefore, the combination of the block chain technology and the storage of the electric power data is realized, the electric power information is stored by using the parallel block chains, the data storage problems of large data volume, multiple types, complex relation and the like are solved, the safe and effective access control is performed on the information stored on the internal chain by using the attribute-based encryption technology, and the problems of low data sharing efficiency, unsafe data and the like are solved. In a modern society with unsafe information, effective data tracing also enables the definition of responsible persons to be simpler, and the information is safer due to the characteristic of non-falsification.
The invention uses a double-chain system, after the address of the information is stored by an internal chain in a power grid company, the internal node can efficiently access the information stored in the bottom database through the address; the nodes outside the company can submit own access requests through the external chain, after certain delay determines that the access is authorized, the required information is read out through ciphertext transmitted by the edge nodes, and meanwhile, the access records can be written on the external chain to ensure the safety. By adopting the data storage method, the monitoring of a third party is not needed, the safety of the information can be ensured, and the problems of information asymmetry, difficulty in positioning of responsible persons, incapability of tracing the information and the like in the power utilization field can be effectively solved.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
The invention provides a power data storage and sharing method, which comprises the following steps:
step S1, the internal nodes of the power grid company use the internal chain of the block chain to store the address index of the power data of the bottom database;
in step S2, the external chain of the block chain transmits an access power data request of the external node, and stores an access record based on the access power data request and the address index.
In an embodiment of the method for storing and sharing power data, before the step S1, the method for storing and sharing power data includes, by the internal node of the power grid company, storing an address index of the power data in the underlying database by using the internal chain, further including:
and the data uploader formulates an access control strategy tree for the electric power data according to the authority requirement, randomly generates a symmetric encryption key, and puts the electric power data into the bottom database after symmetric encryption calculation.
In an embodiment of the method for storing and sharing power data, the step of putting the power data into the bottom database after symmetric encryption calculation includes:
and the internal node of the power grid company encrypts the address index and the symmetric encryption key according to the access control strategy tree and broadcasts the address index and the symmetric encryption key to the block chain, and meanwhile, the internal node of the power grid company generates a mapping relation between the address index and data on the chain and puts the mapping relation into the bottom database.
Here, data is also uploaded after the data is encrypted.
In an embodiment of the power data storage and sharing method of the present invention, in step S2, before the external link of the block link transmits the request for accessing the power data from the external node, the method further includes:
and each external node generates a token containing the authority and attribute information of the external node, and then the external node which sends out the request for accessing the power data encrypts data which is subjected to intersection operation by other external nodes by using an access control strategy tree so as to enable the data to only meet the attribute of the requested enterprise.
In an embodiment of the power data storage and sharing method of the present invention, in step S2, the external link of the block link transmits an access power data request of an external node, and stores an access record based on the access power data request and the address index, including:
and the external node sending the request for accessing the power data sends the encrypted data and the token of the external node to an external chain, all the nodes can see and record the message, the source node is judged according to the information in the token, but only the edge node which accords with the access control strategy tree contained in the cipher text can decrypt the message, and after the edge node completes decryption, if the token meets the access control strategy tree of the intersection data, the edge node automatically performs intersection operation on the data and returns the data to the external node sending the request for accessing the power data through a safety channel.
In an embodiment of the method for storing and sharing power data, after the edge node automatically performs intersection operation on the data and returns the data to the internal node of the power grid company which sends the request for accessing the power data through the secure channel, the method further includes:
and globally broadcasting a piece of data containing the token, indicating that the intersection operation is completed, and recording the action on the external block chain after the other nodes confirm the action.
In the invention, all the data at the bottom layer are encrypted, and the information safety can still be ensured after the data are attacked or the data are leaked. Since all intersection requests will be logged on the external chain, no data abuse will occur. The external chain and the internal chain are not interfered with each other, the internal chain records the access control strategy of each piece of data, and the external chain only needs to record and confirm the intersection operation request.
Specifically, fig. 1 is a schematic diagram of a principle of a power data storage and sharing method according to an embodiment of the present invention, and as shown in fig. 1, in order to quickly generate a search block in a power grid company, a down-link storage method is adopted, only data addresses are stored in a link, and original data is stacked, encrypted, stored in a bottom database, and maintained inside the database. The token containing the authority and attribute information of the external node needs to be transmitted on an external chain when the external node of the power grid wants to access certain internal data, after the edge node checks that the external node has the authority to access, the data is transmitted to the external chain, and the encrypted data can be decrypted only by the applied node. The access information may be recorded on an external chain to facilitate administration and querying of the records.
Fig. 2 is a flowchart of a power data storage and sharing method according to an embodiment of the present invention, and as shown in fig. 2, the method may include:
the internal nodes of the power grid company store the address index of the data of the bottom database by using an internal chain;
the external chain passes the request and stores the access record.
Fig. 3 is a schematic diagram of an electric power data storage and sharing model according to an embodiment of the present invention, as shown in fig. 3, in this embodiment, a database layer includes a block chain and a bottom-layer encrypted database, the block chain is divided into an internal chain and an external chain, the internal chain is used to store an address index, the obtained index can obtain corresponding data information in the encrypted database, and the external chain is used to store records of intersection requests, so as to facilitate supervision and prevent data abuse.
The blockchain service layer provides consistency service and synchronization service, and particularly, services such as state synchronization, index service, attribute access control and internal account registration are included in an internal chain. And the external chain provides services such as state synchronization, index service, attribute access control, intersection request and the like. The edge nodes which are the external chain and the internal chain are additionally provided with certificate issuing services, and the authorization services are services such as intersection calculation.
The API layer is used for data query, block broadcast, transmission, and the like.
Code layer on chain: there are editing, executing services such as smart contracts, and providing attribute-based access control. In particular, customized access controls are provided on the external and internal chains.
An application layer: and providing an application program such as a supervision system and a query system.
In the embodiment, by using a double-chain structure to store the index address and the record of access control, the specific data at the bottom layer is put into the database at the bottom layer through encryption. Therefore, the data is safely stored and used, and the data is prevented from being leaked and abused. The method has the advantages that the method provides guidance for data security in the power field, realizes rapid data sharing, promotes the development of the power industry, can resist network attack, simplifies the definition of responsible persons and makes data traceable.
It should be noted that, the steps and implementation manners in the block chain-based power data storage and sharing method provided by the present invention may be implemented by using corresponding modules and units in the model of fig. 3, and those skilled in the art may refer to the technical scheme of the system to implement the step flow of the method, that is, the embodiments in the description may be understood as preferred examples of the implementation methods, and are not described herein again.
Compared with the existing storage model, the invention has the following effective effects:
the invention provides a block chain-based power data storage model.A power grid company internal node uses an internal chain to store an address index of bottom-layer database data. The external chain passes the request and stores the access record. Therefore, the combination of the block chain technology and the storage of the electric power data is realized, the electric power information is stored by using the parallel block chains, the data storage problems of large data volume, multiple types, complex relation and the like are solved, the safe and effective access control is performed on the information stored on the internal chain by using the attribute-based encryption technology, and the problems of low data sharing efficiency, unsafe data and the like are solved. In a modern society with unsafe information, effective data tracing also enables the definition of responsible persons to be simpler, and the information is safer due to the characteristic of non-falsification.
The invention uses a double-chain system, after the address of the information is stored by an internal chain in a power grid company, the internal node can efficiently access the information stored in the bottom database through the address; the nodes outside the company can submit own access requests through the external chain, after certain delay determines that the access is authorized, the required information is read out through ciphertext transmitted by the edge nodes, and meanwhile, the access records can be written on the external chain to ensure the safety. By adopting the data storage method, the monitoring of a third party is not needed, the safety of the information can be ensured, and the problems of information asymmetry, difficulty in positioning of responsible persons, incapability of tracing the information and the like in the power utilization field can be effectively solved.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.