Disclosure of Invention
The purpose of the invention is as follows: in order to realize effective data sharing in a block chain, the invention provides a block chain-based power data storage method and a block chain-based power data sharing method.
The technical scheme is as follows: a storage node responding to a power data storage request is called a data receiver, a requester sending the power data storage request is called a data sender, and the data receiver and the data sender are connected to a block chain together; the method specifically comprises the following steps:
through the ring signature, the data sender broadcasts the power data storage request to the regional chain in an anonymous mode; if a data receiver responding to the power data storage request exists, the data sender can receive the stealth address of the data receiver, at the moment, the data sender generates a random value r, the stealth address of the data receiver and the random value r are subjected to Hash calculation, and a disposable public key address P is obtaineds(rA) G + B, and calculating R ═ r.G, where HsFor the cryptographic hash function {0,1}, G is the base point, (a, B) is the public key address of the data receiver; broadcasting (P, R) information to a block chain, sending power data to be stored to a one-time public key address, and recording data record information of the one-time public key address into the block chain;
when the data receiver receives the (P, R) information, the hash calculation using the key (a, b) of the key image to which the data receiver belongs is performed to obtain P' ═ Hs(aR) G + B; judging whether P' is satisfied or not, if so, the storage interaction is passed, and the data receiver passes the one-time public key address P-HsPrivate key x ═ H corresponding to (rA) G + Bs(aR) + b signature is carried out on the power data to be stored and then the data is transmitted to a data lake; if not, the storage interaction is not matched, and data storage is not carried out.
Further, the step of generating the stealth address of the data receiver is as follows:
and the data receiver generates a parent key pair, the parent key pair and the temporary key form a one-time adding key together, the one-time adding key is issued, and the issued one-time adding key is called the stealth address of the data receiver.
The invention also discloses a block chain-based power data sharing method, which comprises the following steps:
establishing a trusted operating environment in a data lake, storing the encrypted power data information into the data lake, completing trusted calculation by using an Intel SGX framework, and storing a hash address of the power data into a block chain;
and sharing the power data stored in the data lake with each application program based on a data sharing algorithm of the intelligent contract.
Further, the shared record of the power data is stored in the block chain.
Further, the intelligent contract-based data sharing algorithm comprises the following steps:
step 1: when the storage node NqReceiving a message from a storage node NpWhen a data sharing request Req is issued, the storage node NqBeing a data storage party, a storage node NpIs a data sharing requester; storage node NqProviding corresponding access rights to a storage node N by means of an intelligent contractpSetting access constraint condition and then authorizing access, and obtaining the private key SK of the access constraint conditionPIDTo a neighbouring data aggregator BSj;
Step 2: data aggregator BS
jAfter information is verified, according to the storage node N
qExecuting intelligent contract according to the access constraint condition, locking script according to the existing key, decrypting the shared data packet, and simultaneously utilizing public key
Encrypting the ring signature, and then outputting a decryption result of the shared data;
and step 3: judging storage node NqAnd storage node NpWhether or not to be in the same data aggregator BSjIf in the same data aggregator BSjClothes ofIn the service category, the storage node NpDirect acquisition data aggregator BSjThe data to be transmitted; if not in the same data aggregator BSjIn the service scope of (2), the data is transmitted to the distance storage node N from the storage node currently running the intelligent contract in an encrypted mannerpThe most recent data aggregator.
Further, the data sharing request Req includes an access address, a time stamp, and a frequency.
Has the advantages that: compared with the prior art, the invention has the following advantages:
1. the invention provides a distributed power data storage architecture, improves data storage efficiency and stability on a bottom architecture supported by a block chain, and solves the problems of great potential safety hazard, low storage efficiency and the like of a centralized data storage mode;
2. in the process of storing the electric power data, the disposable ring signature group and the key image provided by the CryptoNote protocol are used as the marks of the data storage, so that the problem that group signatures need to participate in a group manager is solved; the privacy address is used, so that the privacy in the data storage interaction process is ensured, and the storage safety of the power data in the block chain is improved;
3. according to the invention, a data lake data sharing method is designed in the intelligent contract, and the trusted execution data lake improved storage module is used, so that the problems that the internal access right limitation is difficult to control, data is difficult to share among nodes and the like are effectively solved, the efficient and safe sharing of private data is ensured, and the safety and the efficiency of electric power data storage and sharing are further improved.
Detailed Description
The technical solution of the present invention will be further explained with reference to the accompanying drawings and examples.
Example 1:
the embodiment is to implement power data storage in a distributed data storage system, where the distributed data storage system mentioned in this embodiment includes an intelligent power device, a power consumer, a local controller, a data aggregator, and a block chain; the block chain is composed of a plurality of blocks, and each block comprises a block head and a block body. The specific architecture is shown in fig. 3, and the main encryption storage process is as follows:
the requesting party (intelligent power equipment, power consumers and local controllers) sends a data storage demand, namely, one storage node is selected from the distributed data storage system for data storage. When a data storage request is issued, transmission of a request to another node is prohibited within one minute.
When the storage node receives the request, the corresponding storage service is required to be provided to the request sending party, the sequence of providing the storage service is according to the front-back relation of the request sending time, and when the confirmation message is received, the data transmission is carried out.
And uploading the record of the data storage completed by the storage node to the block chain, evaluating the storage process by the power equipment or the power user, and correspondingly evaluating the performance of the storage node by the local controller according to the evaluation result.
In short, the power consumer transmits a storage request to the local controller, the local controller transmits a demand to the storage node, the storage node responds according to the self condition, the whole storage process is recorded in the block chain, and only the hash address of the data is stored in the block chain.
In order to realize the encrypted storage of the power data of the above power data distributed storage architecture, the present embodiment proposes a power data storage method based on a block chain, in which a storage node responding to a power data storage request is referred to as a data receiver, a requester sending the power data storage request is referred to as a data sender, and the data receiver and the data sender are connected to one block chain together; the specific process is as follows:
through the ring signature, the data sender broadcasts the power data storage request to the regional chain in an anonymous mode;
after receiving the power data storage request, the data receiver generates a father key pair and a temporary key to form a one-time adding key together, and issues the one-time adding key, wherein the issued one-time adding key becomes a stealth address of the data receiver; the specific process can be seen in fig. 2;
the data sender receives the stealth address of the data receiver which responds, at the moment, the data sender generates a random value r, the stealth address of the data receiver and the random value r are subjected to Hash calculation, and a one-time public key address P is obtaineds(rA) G + B, and calculating R ═ r.G, where HsFor the cryptographic hash function {0,1}, G is the base point, (a, B) is the public key address of the data receiver; broadcasting (P, R) information to a block chain, sending power data to be stored to a one-time public key address, and recording data record information of the one-time public key address into the block chain; the one-time public key address is generated by threshold replacement, according to the above process, referring to fig. 1, each storage interaction generates a new address according to the stealth address of the data receiver, so that an attacker cannot determine the address of the receiver.
When the data receiver receives the (P, R) information, the hash calculation using the key (a, b) of the key image to which the data receiver belongs is performed to obtain P' ═ Hs(aR) G + B; judging whether P' is satisfied or not, if so, the storage interaction is passed, and the data receiver passes the one-time public key address P-HsPrivate key x ═ H corresponding to (rA) G + Bs(aR) + b signature is carried out on the power data to be stored and then the data is transmitted to a data lake; if not, the storage interaction is not matched, and data storage is not carried out. The key image referred to in this embodiment may provide information about having a particular signature phinStoring the interaction information.
The ring signature used in this embodiment is a digital signature scheme, and the final signature authentication requires that all members in the group agree to validate the message signing party, and the process is defined as follows: firstly, a signer calculates a symmetric key Sk, and takes the symmetric key Sk as a hash value of a message ms to be signed, namely Sk is h (ms); generating a symmetric key Sk as h by public key transformation(ms,Pk1,Pk2,…,Pr) (ii) a The signer then signs the signature in a random form {0,1}bUniformly selecting an initial random value RζAnd the signer selects the number x of signatures from the ring members 1 < i < r, i ≠ siWhere r is the ring member and s is the order of the members as the actual signers. Thus, the signature obtains a new value of yi=f(xi). Finally, the signature of the message to be signed ms is defined as (P)k1,Pk2,…,Pkn;Rζ;x1,x2,…,xr)。
In a distributed data storage system, there is a ring signature group consisting of intelligent power devices, power consumers and storage nodes. When a set of ring signatures can be cryptographically constructed based on the new member public key as long as the new member's public key is known:
in the formula, y
n=f
n(x
n) Wherein f is
nDefined by an extended threshold permutation function. f. of
n(x
n) At {0,1}
bIs extended upwards to
Storing data by b-bit number omega ═ l
in
i+r
iAnd (4) forming. Thus, f
iThe value of (ω) can be expressed as:
in the formula, riIs a random number generated by the sender,/iIs a random number, n, generated by the recipientiIs the number of signers.
Example 2:
the intelligent contract is used as an autonomous application program in a block chain, and the embodiment designs a data lake data sharing method by using the characteristic, so that the data lake can be trustingly executed to efficiently and safely share encrypted data information, and the mechanism is shown in fig. 4, and the implementation process is as follows:
step 1: a trusted operating environment needs to be constructed in the data lake to store original data information, and the original data is stored in the data lake after being encrypted. And an Intel SGX framework is utilized to complete trusted computing, wherein only the hash address of the data is stored in the block chain.
Step 2: the intelligent contract is used for providing corresponding access authority, namely, the identity of a data request sender needs to be checked, whether the identity is right to access data or not is determined, and the block link module can reserve data storage interaction and sharing records.
Step 2: providing corresponding access authority by using an intelligent contract, namely, verifying the identity of a data request sender to determine whether the data request sender has the right of data access, wherein a block link module can reserve data storage interaction and sharing records; the specific process is as follows:
when the storage node NqReceiving a message from a storage node NpWhen a data sharing request Req is issued, the data sharing request Req includes contents such as an access address, time, frequency, and the like, and at this time, the storage node NqBeing a data storage party, a storage node NpIs a data sharing requester; storage node NqFor storage node NpAccess constraint condition is established to authorize the access, and the private key SK of the information is usedPIDTo a neighbouring data aggregator BSj:
Where t is the timestamp, Cert is the certificate, fPKTo encrypt information using the entity's public key, PK is the public key and SK is the private key.
Data aggregator BS
jAfter the information is verified, the information can be stored according to the storage node N
qExecuting intelligent contract according to the access constraint condition, locking script according to the existing key, decrypting the shared data packet, and simultaneously utilizing public key
And encrypting the ring signature, and then outputting a decryption result of the shared data.
When N is presentqAnd NpWithin the same service scope of the data aggregator, for NpMaking data access to obtain data aggregator BS directlyjThe data to be transmitted; if N is presentqAnd NpIf the data packets are not in the service scope of the same data aggregator, the data packets are transmitted to the distance N by the storage node running the intelligent contract at present in an encrypted mannerpThe most recent data aggregator. The specific process is as follows:
and step 3: n is a radical ofpAfter receiving the data, the private key decryption party can access the data.
And 4, step 4: various applications are implemented, such as data management systems, data acquisition systems, and the like.
As will be appreciated by one skilled in the art, 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 embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams 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.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.