Block chain smart contract-based power grid data sharing system and method thereof
By using blockchain smart contracts and hybrid encryption technology, the problems of single point of failure, computational burden and access control flexibility in power data sharing are solved, achieving efficient and secure power data sharing and privacy protection, and supporting dynamic policy updates and malicious user tracking.
Patent Information
- Application Number
- CN202511498604.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-20
- Publication Date
- 2026-02-24
AI Technical Summary
Traditional power data sharing solutions suffer from single point of failure risk, heavy computational burden, difficulty in flexibly updating access control policies, and difficulty in tracing private key leaks.
By employing blockchain technology and generating user keys through smart contracts, combined with online/offline encryption and outsourced computation, decentralized access control management is achieved. This supports flexible adjustment of access control policies and tracking of malicious users, and utilizes a hybrid technology of attribute-based encryption and symmetric encryption to protect data privacy.
It enables efficient and secure power data sharing, reduces computational burden, supports dynamic policy updates and malicious user tracking, enhances the flexibility and credibility of data sharing, and promotes the development of the power industry.
Smart Images

Figure CN121567288A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power network security technology, specifically to a smart grid data privacy protection and data sharing system and method based on blockchain and attribute encryption technology. Background Technology
[0002] With the rapid development of smart grids, power data sharing has become increasingly important. However, traditional data sharing schemes face numerous challenges in practical applications. For example, most schemes rely on centralized attribute institutions for key management and distribution, which not only introduces single-point-of-failure risks but also increases trust costs. Furthermore, existing encryption schemes typically involve complex cryptographic calculations, which impose a heavy computational burden on smart grid devices with limited computing power (such as smart meters). More importantly, existing access control policies are difficult to update flexibly once established. When user attributes or access permissions change, data often needs to be re-encrypted, consuming significant resources. Finally, once private keys are leaked by malicious users, existing schemes often lack effective tracing mechanisms, making it difficult to identify the leaker and effectively prevent private key misuse. Summary of the Invention
[0003] The purpose of this invention is to solve the above-mentioned problems in the prior art and provide a smart grid data sharing method that uses blockchain technology, which is efficient, secure, flexibly updatable and traceable.
[0004] The technical solution of this invention is as follows: A smart grid data sharing system based on smart contracts includes the following components: The management and user management bodies are responsible for establishing and maintaining the blockchain. They help authorized bodies generate system parameters and user private keys, and track the identities of malicious users who leak keys.
[0005] Data owners and users who need to share power grid data encrypt and upload the data to a cloud server, and store the hash value of the power grid data on a blockchain. This process requires support for access control policies to ensure that only authorized users can access and manipulate the relevant data.
[0006] The authorizing authority is primarily responsible for generating system parameters and user private keys. This process requires support for access control policies to ensure that only authorized entities can perform specific operations, thereby ensuring system security and reliability.
[0007] The power grid cloud server is responsible for storing the original encrypted data and user conversion keys, updating access control policies, and performing outsourced encryption calculations.
[0008] Blockchain, specifically blockchains based on platforms like Ethereum or Hyperledger, is primarily used to store hash values of power grid data. These hash values are then decrypted to verify the integrity of the power grid data.
[0009] During data access, users obtain user keys from management and authorized agencies, request the power grid cloud server to return partially decrypted ciphertext, and then decrypt it locally to recover the power grid data. This process requires the implementation of complex access control policies to ensure data security and privacy.
[0010] The entire system utilizes blockchain to store power grid data. User keys are generated through blockchain smart contracts, and combined with online / offline encryption and outsourced computation methods, decentralized access control and data confidentiality protection are achieved. By leveraging power grid cloud servers and consensus technology, data integrity verification, flexible adjustment of access control policies, and tracking of malicious users are realized. Furthermore, by combining smart contracts and outsourced computation via power grid cloud servers, fine-grained access control, reduced computational burden, and resistance to collusion attacks are achieved. This invention enables the power industry to better improve power data processing efficiency, protect smart grid data privacy, verify data integrity, support dynamic policy updates and malicious user tracking, enhance the flexibility and credibility of data sharing, and promote the development and progress of the power industry.
[0011] In some embodiments, the management organization selects bilinear group parameters and generates its own public-private key pair for initialization. It only knows the user attribute set but not any user's key. The management organization and the authorizing organization initialize system parameters and generate user keys through a blockchain smart contract.
[0012] In this technical solution, there is a process of mutual information exchange between the management agency and the authorization agency. After the management agency generates a public-private key pair, it calls the authorization agency to generate a master key and public parameters, and deploys the smart contract on the blockchain. By using blockchain smart contracts to replace the traditional centralized attribute permission agency, decentralized permission management is achieved.
[0013] In some embodiments, the data owner encrypts and uploads the power grid data, a process divided into offline and online phases. The offline phase primarily involves pre-generating ciphertext and uploading it during idle time; the online phase is the real-time encryption process.
[0014] This technical solution employs online / offline encryption technology and cloud server outsourced computing. Encryption tasks are pre-computed offline, while decryption tasks are partially outsourced to the power grid cloud server, significantly reducing the computational burden on data owners and users, making it suitable for resource-constrained equipment.
[0015] In some embodiments, the authorization authority receives the user's global identity identifier distributed by the smart contract and generates a complete attribute key and a secret conversion key for the user.
[0016] This technical solution utilizes a management organization combined with blockchain smart contract technology, along with attribute-based encryption and symmetric encryption. By binding user identity and keys, it tracks malicious users who leak keys, enhancing system traceability, ensuring data confidentiality and fine-grained access control, and ensuring that only authorized users can decrypt data, effectively preventing key abuse and collusive attacks.
[0017] In some embodiments, the power grid cloud server receives encrypted data uploaded by the data owner. When the data user makes a request to the power grid cloud server, the power grid cloud server first performs authentication. If the authentication is successful, it generates a "semi-decrypted ciphertext" and provides it to the data user.
[0018] In this technical solution, access control policies are flexibly updated via a cloud server. Data owners can modify the key ciphertext, and the power grid cloud server updates the relevant policies to adapt to the dynamic needs of the smart grid, thus solving the problem of traditional policies becoming ineffective.
[0019] The technical solution of this invention is as follows: A blockchain-based data encryption and sharing method includes the following steps: S1. Smart contract initialization, including the following steps: S11. Generate the system's master key and public parameters: The authorizing agency generates bilinear mapping parameters, hash functions, attribute sets, and group elements randomly selected for each attribute.
[0020] S12. Deploying the Smart Contract: The authorized agency deploys a smart contract function onto the blockchain, then publicly publishes the generated public parameters and secretly stores the master key. After deployment, the authorized agency, the management agency, the power grid cloud server, and the blockchain communicate. S2, Identity Binding and Key Distribution, includes the following steps: S21. User Registration: Users select a random number to generate a partial key, which they send to the management organization along with their attribute set and identity identifier. The management organization uses its private key to recover and verify the user's true identity. After successful verification, the management organization generates a global identity identifier through a smart contract and binds it to the user ID, storing it in a list for traceability.
[0021] S22. Key Distribution by Authorized Institution: The management institution invokes a smart contract function on the blockchain, sending the global identity identifier and attribute set as input to the authorized institution. Upon receiving this, the authorized institution generates a complete attribute key and a secret conversion key for the user. The authorized institution uses the secret conversion key to calculate the conversion key used for outsourced decryption and sends it to the power grid cloud server for storage.
[0022] S3. Encryption and transmission of power data, including the following steps: S31. Encrypted Data Transmission: The data owner pre-performs numerous complex encryption calculations to generate ciphertext components. These calculations are independent of the specific plaintext message and access policy and can be completed at any idle time. When actual data needs to be encrypted, the data owner only needs to perform a small amount of lightweight computation for real-time encryption.
[0023] S32. Data Aggregation and Upload: The access policy, data encrypted with a symmetric key, attribute encryption ciphertext, and encrypted random parameter data used for policy updates are sent to the power grid cloud server for storage. The hash value of the data is calculated and uploaded to the blockchain for subsequent integrity verification.
[0024] S4. Power grid data sharing includes the following steps: S41. Power Grid Cloud Server Performs Outsourced Decryption: Data users send their global user identity identifier to the power grid cloud server. The power grid cloud server looks up the corresponding conversion key based on the identity identifier and verifies it. If the verification is successful, the power grid cloud server uses the conversion key to perform partial decryption calculation on the ciphertext, generating a "semi-decrypted ciphertext" and sending it to the data user.
[0025] S42. Data User Performs Local Decryption: After receiving the partially decrypted ciphertext, the data user uses their own secret conversion key to perform a final lightweight computation to recover the symmetric key, which is then used to decrypt the original power grid data. The hash value of the original power grid data is calculated and compared with the hash value retrieved from the blockchain.
[0026] This technical solution generates user keys through blockchain smart contracts and combines online / offline encryption and outsourced computation methods to achieve decentralized access control and data confidentiality protection. By utilizing power grid cloud servers and consensus technology, it enables data integrity verification, flexible adjustment of access control policies, and tracking of malicious users. Furthermore, by combining smart contracts and outsourced computation via power grid cloud servers, it achieves fine-grained access control, reduced computational burden, and resistance to collusion attacks. This invention can enable the power industry to better improve the efficiency of power data processing, protect smart grid data privacy, verify data integrity, support dynamic policy updates and malicious user tracking, enhance the flexibility and credibility of data sharing, and promote the development and progress of the power industry.
[0027] In some embodiments, in step S2, the data encryption transmission uses an attribute key and a secret conversion key for the power grid cloud server to perform outsourced decryption, which improves the system's computing efficiency and user performance experience. The power data is transmitted in encrypted form throughout the process; the encrypted data is hashed and the value is stored on the blockchain.
[0028] This technical solution employs a hybrid approach of attribute-based encryption and symmetric encryption to achieve secure, efficient, and fine-grained smart grid data sharing. Specifically, it leverages the complementary advantages of the two encryption technologies: utilizing the efficiency of symmetric encryption algorithms (such as AES) to encrypt the massive amounts of raw power data itself, while employing the complex access control structure of attribute-based encryption to encrypt the symmetric key used for decryption.
[0029] In some embodiments, in step S3, when the data owner needs to share power grid data, online / offline encryption technology is used, which greatly improves efficiency.
[0030] In this technical solution, the access policy is a set of attribute-based mathematical rules defined by the data owner to guide the key generation or selection process, ensuring key security and validity and appropriate adjustment of computational overhead. Since a large amount of computation is required during data encryption and decryption, the computational overhead needs to be considered, and the computational tasks need to be appropriately distributed and offloaded between the "offline" preprocessing stage and the "online" real-time stage.
[0031] Furthermore, considering the possibility of data theft by attackers during transmission, leading to the leakage of user privacy, a hybrid technology combining blockchain and attribute-based encryption with symmetric encryption is employed to protect the privacy of electricity data. This hybrid encryption system provides both encryption and decryption capabilities, allowing encrypted electricity data to be used for calculations and operations without exposing plaintext data. In electricity data protection, this hybrid encryption system can be used to encrypt sensitive data, ensuring that even if the data is stolen, attackers cannot easily decrypt and utilize it.
[0032] Compared with the prior art, the present invention has the following advantages: (1) This invention uses blockchain technology and attribute-based encryption technology to protect the privacy of power data; (2) The present invention uses optimized online / offline encryption technology to encrypt power data, so that the data is transmitted in ciphertext form throughout the process; then the ciphertext data is hashed and the value is stored on the blockchain. Attached Figure Description
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0034] Figure 1 This is a structural connection block diagram of the model of the present invention; Figure 2 This is a flowchart illustrating the principle of the method of the present invention. Detailed Implementation
[0035] To enable those skilled in the art to better understand the technical solutions of this invention, the technical solutions of the embodiments of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this invention, and not all embodiments. Based on the embodiments of this invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of this invention.
[0036] Example 1 like Figure 1 As shown, this embodiment provides a power grid data sharing method based on blockchain smart contracts, comprising the following components: The management and user management bodies are responsible for establishing and maintaining the blockchain. They help authorized bodies generate system parameters and user private keys, and track the identities of malicious users who leak keys.
[0037] Data owners and users who need to share power grid data encrypt and upload the data to a cloud server, and store the hash value of the power grid data on a blockchain. This process requires support for access control policies to ensure that only authorized users can access and manipulate the relevant data.
[0038] The authorizing authority is primarily responsible for generating system parameters and user private keys. This process requires support for access control policies to ensure that only authorized entities can perform specific operations, thereby ensuring system security and reliability.
[0039] The power grid cloud server is responsible for storing the original encrypted data and user conversion keys, updating access control policies, and performing outsourced encryption calculations.
[0040] Blockchain, specifically blockchains based on platforms like Ethereum or Hyperledger, is primarily used to store hash values of power grid data. These hash values are then decrypted to verify the integrity of the power grid data.
[0041] During data access, users obtain user keys from management and authorized agencies, request the power grid cloud server to return partially decrypted ciphertext, and then decrypt it locally to recover the power grid data. This process requires the implementation of complex access control policies to ensure data security and privacy.
[0042] The entire system utilizes blockchain to store power grid data. User keys are generated through blockchain smart contracts, and combined with online / offline encryption and outsourced computation methods, decentralized access control and data confidentiality protection are achieved. By leveraging power grid cloud servers and consensus technology, data integrity verification, flexible adjustment of access control policies, and tracking of malicious users are realized. Furthermore, by combining smart contracts and outsourced computation via power grid cloud servers, fine-grained access control, reduced computational burden, and resistance to collusion attacks are achieved. This invention enables the power industry to better improve power data processing efficiency, protect smart grid data privacy, verify data integrity, support dynamic policy updates and malicious user tracking, enhance the flexibility and credibility of data sharing, and promote the development and progress of the power industry.
[0043] In some embodiments, the management organization selects bilinear group parameters and generates its own public-private key pair for initialization. It only knows the user attribute set but not any user's key. The management organization and the authorizing organization initialize system parameters and generate user keys through a blockchain smart contract.
[0044] In this technical solution, there is a process of mutual information exchange between the management agency and the authorization agency. After the management agency generates a public-private key pair, it calls the authorization agency to generate a master key and public parameters, and deploys the smart contract on the blockchain. By using blockchain smart contracts to replace the traditional centralized attribute permission agency, decentralized permission management is achieved.
[0045] In some embodiments, the data owner encrypts and uploads the power grid data, a process divided into offline and online phases. The offline phase primarily involves pre-generating ciphertext and uploading it during idle time; the online phase is the real-time encryption process.
[0046] This technical solution employs online / offline encryption technology and cloud server outsourced computing. Encryption tasks are pre-computed offline, while decryption tasks are partially outsourced to the power grid cloud server, significantly reducing the computational burden on data owners and users, making it suitable for resource-constrained equipment.
[0047] In some embodiments, the authorization authority receives the user's global identity identifier distributed by the smart contract and generates a complete attribute key and a secret conversion key for the user.
[0048] This technical solution utilizes a management organization combined with blockchain smart contract technology, along with attribute-based encryption and symmetric encryption. By binding user identity and keys, it tracks malicious users who leak keys, enhancing system traceability, ensuring data confidentiality and fine-grained access control, and ensuring that only authorized users can decrypt data, effectively preventing key abuse and collusive attacks.
[0049] In some embodiments, the power grid cloud server receives encrypted data uploaded by the data owner. When the data user makes a request to the power grid cloud server, the power grid cloud server first performs authentication. If the authentication is successful, it generates a "semi-decrypted ciphertext" and provides it to the data user.
[0050] In this technical solution, access control policies are flexibly updated via a cloud server. Data owners can modify the key ciphertext, and the power grid cloud server updates the relevant policies to adapt to the dynamic needs of the smart grid, thus solving the problem of traditional policies becoming ineffective.
[0051] Example 2 like Figure 2 As shown, based on Embodiment 1, this embodiment provides a blockchain-based data encryption and sharing method, including the following steps: S1. Smart contract initialization, including the following steps: S11. Generate the system's master key and public parameters: The authorizing agency generates bilinear mapping parameters, hash functions, attribute sets, and group elements randomly selected for each attribute.
[0052] S12. Deploying the Smart Contract: The authorized agency deploys a smart contract function onto the blockchain, then publicly publishes the generated public parameters and secretly stores the master key. After deployment, the authorized agency, the management agency, the power grid cloud server, and the blockchain communicate. S2, Identity Binding and Key Distribution, includes the following steps: S21. User Registration: Users select a random number to generate a partial key, which they send to the management organization along with their attribute set and identity identifier. The management organization uses its private key to recover and verify the user's true identity. After successful verification, the management organization generates a global identity identifier through a smart contract and binds it to the user ID, storing it in a list for traceability.
[0053] S22. Key Distribution by Authorized Institution: The management institution invokes a smart contract function on the blockchain, sending the global identity identifier and attribute set as input to the authorized institution. Upon receiving this, the authorized institution generates a complete attribute key and a secret conversion key for the user. The authorized institution uses the secret conversion key to calculate the conversion key used for outsourced decryption and sends it to the power grid cloud server for storage.
[0054] S3. Encryption and transmission of power data, including the following steps: S31. Encrypted Data Transmission: The data owner pre-performs numerous complex encryption calculations to generate ciphertext components. These calculations are independent of the specific plaintext message and access policy and can be completed at any idle time. When actual data needs to be encrypted, the data owner only needs to perform a small amount of lightweight computation for real-time encryption.
[0055] S32. Data Aggregation and Upload: The access policy, data encrypted with a symmetric key, attribute encryption ciphertext, and encrypted random parameter data used for policy updates are sent to the power grid cloud server for storage. The hash value of the data is calculated and uploaded to the blockchain for subsequent integrity verification.
[0056] S4. Power grid data sharing includes the following steps: S41. Power Grid Cloud Server Performs Outsourced Decryption: Data users send their global user identity identifier to the power grid cloud server. The power grid cloud server looks up the corresponding conversion key based on the identity identifier and verifies it. If the verification is successful, the power grid cloud server uses the conversion key to perform partial decryption calculation on the ciphertext, generating a "semi-decrypted ciphertext" and sending it to the data user.
[0057] S42. Data User Performs Local Decryption: After receiving the partially decrypted ciphertext, the data user uses their own secret conversion key to perform a final lightweight computation to recover the symmetric key, which is then used to decrypt the original power grid data. The hash value of the original power grid data is calculated and compared with the hash value retrieved from the blockchain.
[0058] This technical solution generates user keys through blockchain smart contracts and combines online / offline encryption and outsourced computation methods to achieve decentralized access control and data confidentiality protection. By utilizing power grid cloud servers and consensus technology, it enables data integrity verification, flexible adjustment of access control policies, and tracking of malicious users. Furthermore, by combining smart contracts and outsourced computation via power grid cloud servers, it achieves fine-grained access control, reduced computational burden, and resistance to collusion attacks. This invention can enable the power industry to better improve the efficiency of power data processing, protect smart grid data privacy, verify data integrity, support dynamic policy updates and malicious user tracking, enhance the flexibility and credibility of data sharing, and promote the development and progress of the power industry.
[0059] In some embodiments, in step S2, the data encryption transmission uses an attribute key and a secret conversion key for the power grid cloud server to perform outsourced decryption, which improves the system's computing efficiency and user performance experience. The power data is transmitted in encrypted form throughout the process; the encrypted data is hashed and the value is stored on the blockchain.
[0060] This technical solution employs a hybrid approach of attribute-based encryption and symmetric encryption to achieve secure, efficient, and fine-grained smart grid data sharing. Specifically, it leverages the complementary advantages of the two encryption technologies: utilizing the efficiency of symmetric encryption algorithms (such as AES) to encrypt the massive amounts of raw power data itself, while employing the complex access control structure of attribute-based encryption to encrypt the symmetric key used for decryption.
[0061] In some embodiments, in step S3, when the data owner needs to share power grid data, online / offline encryption technology is used, which greatly improves efficiency.
[0062] In this technical solution, the access policy is a set of attribute-based mathematical rules defined by the data owner to guide the key generation or selection process, ensuring key security and validity and appropriate adjustment of computational overhead. Since a large amount of computation is required during data encryption and decryption, the computational overhead needs to be considered, and the computational tasks need to be appropriately distributed and offloaded between the "offline" preprocessing stage and the "online" real-time stage.
[0063] Furthermore, considering the possibility of data theft by attackers during transmission, leading to the leakage of user privacy, a hybrid technology combining blockchain and attribute-based encryption with symmetric encryption is employed to protect the privacy of electricity data. This hybrid encryption system provides both encryption and decryption capabilities, allowing encrypted electricity data to be used for calculations and operations without exposing plaintext data. In electricity data protection, this hybrid encryption system can be used to encrypt sensitive data, ensuring that even if the data is stolen, attackers cannot easily decrypt and utilize it.
[0064] Although the present invention has been described in detail with reference to the accompanying drawings and preferred embodiments, the invention is not limited thereto. Various equivalent modifications or substitutions can be made to the embodiments of the invention by those skilled in the art without departing from the spirit and essence of the invention, and such modifications or substitutions should all be within the scope of the invention. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the invention should also be covered within the protection scope of the invention. Therefore, the protection scope of the invention should be determined by the scope of the claims.
Claims
1. A smart grid data sharing system based on smart contracts, characterized in that, It includes the following components: The management organization, or user management organization, is responsible for establishing and maintaining the blockchain. It helps authorized organizations generate system parameters and user private keys, and tracks the identities of malicious users who leak keys. In addition, the management organization knows the user attribute set, but does not know any user's key. Data owners and users who need to share power grid data encrypt and upload the data to a cloud server, and store the hash value of the power grid data on a blockchain; The authorized agency is primarily responsible for generating system parameters and user private keys; The power grid cloud server is responsible for storing the original encrypted data and user conversion keys, updating access control policies, and performing encrypted outsourced decryption calculations. Blockchain, based on Ethereum or Hyperledger platforms, is mainly used to store the hash values of power grid data, and after decryption, the integrity of the power grid data is verified. During data access, users obtain user keys from management and authorization agencies, request the power grid cloud server to return partially decrypted ciphertext, and then decrypt it locally to restore the power grid data.
2. The smart grid data sharing system based on smart contracts as described in claim 1, characterized in that, In the management organization, the management organization selects bilinear group parameters and generates its own public-private key pair, and then performs initialization operations.
3. The smart grid data sharing system based on smart contracts as described in claim 1, characterized in that, Among the data owners, the power grid data is encrypted and uploaded. This process is divided into two stages: offline and online. The offline stage is mainly used to pre-generate ciphertext and upload it during idle time. The online phase is a process of real-time encryption.
4. The smart grid data sharing system based on smart contracts as described in claim 1, characterized in that, Among the authorized institutions, the receiving management institution generates a complete attribute key and a secret conversion key for the user by distributing the user's global identity identifier through a smart contract.
5. The smart grid data sharing system based on smart contracts as described in claim 1, characterized in that, The power grid cloud server receives encrypted data uploaded by the data owner. When the data user makes a request to the power grid cloud server, the power grid cloud server first performs authentication. If the authentication is successful, it generates a "semi-decrypted ciphertext" and provides it to the data user.
6. A smart grid data sharing method based on smart contracts using the system described in any one of claims 1-5, characterized in that, Includes the following steps: S1. Smart contract initialization, including the following steps: S11. Generate the system's master key and public parameters: The authorizing agency generates bilinear mapping parameters, hash functions, attribute sets, and group elements randomly selected for each attribute; S12. Deploying Smart Contracts: The authorized agency deploys a smart contract function onto the blockchain, then publicly publishes the generated public parameters and secretly stores the master key; after deployment, the authorized agency and the management agency communicate with the power grid cloud server and the blockchain; S2, Identity Binding and Key Distribution, includes the following steps: S21. Data User Registration: Users select a random number to generate a partial key, which is then sent to the management agency along with their attribute set and identity identifier. The management agency uses its private key to recover and verify the user's true identity. After successful verification, the management agency generates a global identity identifier through a smart contract and binds it to the user ID, storing it in a list for traceability. S22. Authorized agency distributes keys: The management agency calls the smart contract function on the blockchain and sends the global identity identifier and attribute set as input to the authorized agency; after receiving it, the authorized agency generates a complete attribute key and a secret conversion key for the user; the authorized agency uses the secret conversion key to calculate the conversion key for outsourced decryption and sends it to the power grid cloud server for storage; S3. Encryption and transmission of power data, including the following steps: S31. Encrypted data transmission: The data owner performs a large number of complex encryption calculations in advance to generate ciphertext components; when it is necessary to encrypt the actual data, the data owner only needs to perform a small number of lightweight calculations to encrypt it in real time. S32. Data Aggregation and Upload: Send the access policy, data encrypted with a symmetric key, attribute encryption ciphertext, and encrypted random parameter data for policy updates to the power grid cloud server for storage, calculate the hash value of the data and upload it to the blockchain for subsequent integrity verification. S4. Power grid data sharing includes the following steps: S41. Power Grid Cloud Server performs outsourced decryption: Data users send their global user identity identifier to the Power Grid Cloud Server. The Power Grid Cloud Server finds the corresponding conversion key based on the identity identifier and verifies it. If the verification is successful, the Power Grid Cloud Server uses the conversion key to perform partial decryption calculation on the ciphertext and generates "semi-decrypted ciphertext" which is then sent to the data user. S42. Data user performs local decryption: After receiving the semi-decrypted ciphertext, the data user uses their own secret conversion key to perform the final lightweight calculation to recover the symmetric key, which is then used to decrypt and obtain the original power grid data; the hash value of the original power grid data is calculated and compared with the hash value retrieved from the blockchain.
7. The smart grid data sharing method based on smart contracts as described in claim 6, characterized in that, In step S2, the data encryption transmission uses an attribute key and a secret conversion key, which are used by the power grid cloud server to achieve outsourced decryption. The power data is transmitted in encrypted form throughout the process. The encrypted data is hashed and the value is stored on the blockchain.
8. The smart grid data sharing method based on smart contracts as described in claim 6, characterized in that, In step S3, when the data owner needs to share power grid data, online / offline encryption technology is used.