Electric power data storage method and device, computer equipment and computer program product
By collecting, encrypting, and verifying and storing power data using blockchain technology, the problems of data sharing and security under centralized management of power data are solved, achieving efficient and secure data storage and sharing.
Patent Information
- Application Number
- CN202511052284.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-29
- Publication Date
- 2025-11-11
AI Technical Summary
Under centralized management, power data suffers from problems such as closed data standard setting, low efficiency in data sharing and collaboration, and insufficient security and privacy protection.
By collecting operational data from power equipment and encrypting and encapsulating it into data blocks, the security and integrity of the data are ensured through the use of blockchain smart contract rules for verification and storage.
It enables secure storage and efficient sharing of power data, improves data transparency and immutability, and solves the limitations of data sharing and application under centralized management.
Smart Images

Figure CN120929532A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power information technology, and more specifically, to a power data storage method, apparatus, computer equipment, and computer program product. Background Technology
[0002] Currently, in power industry data management, the uploading and storage of power data mainly rely on traditional centralized databases or file systems. While these systems meet data storage needs to some extent, they have the following shortcomings and defects:
[0003] The data standardization process is closed: Currently, the development of power data standards is typically led by a few large power companies or regulatory agencies, employing a relatively closed approach that lacks transparency and multi-party participation mechanisms. This centralized process results in slow updates to data standards, making it difficult to adapt to the rapidly evolving needs of the power industry.
[0004] Inefficient data sharing and collaboration: Electricity data needs to be shared among multiple entities, such as power producers, consumers, regulatory agencies, and research institutions. Current centralized data storage methods require intermediaries for data sharing, leading to information delays, data redundancy, and duplication of work, thus reducing the efficiency of multi-party collaboration.
[0005] Insufficient data security and privacy protection: Traditional power data storage methods are vulnerable to hacking and data breaches. Centralized data storage points become focal points for attacks; once data is tampered with or leaked, it poses a significant threat to the safe operation of the power system and user privacy.
[0006] There is currently no effective solution to the above problems. Summary of the Invention
[0007] This invention provides a method, apparatus, computer device, and computer program product for storing electricity data, in order to at least solve the technical problems that electricity data often involves privacy data, and that data sharing and application are restricted, interactive work is cumbersome, and data sharing and application cannot be completed efficiently and securely in a centralized data management environment.
[0008] According to one aspect of the present invention, a method for storing electricity data is provided, comprising: collecting operating data of an electrical device within a preset time period; encrypting and encapsulating the operating data and the corresponding collection time into a data block to obtain an electricity data block; sending a data upload request and the electricity data block to a blockchain, wherein the blockchain verifies the upload request and the electricity data block based on preset smart contract rules; and storing the electricity data block to the blockchain upon receiving a notification that the blockchain has verified the data.
[0009] Optionally, the running data and the corresponding acquisition time are encrypted and encapsulated into a data block to obtain an electricity data block, including: encrypting the running data and the corresponding acquisition time based on a preset encryption algorithm to obtain encrypted data; creating a data block header and encapsulating the encrypted data into the data body of the data block to obtain an initial data block; performing a hash operation on the initial data block using a hash function to obtain a hash value; signing the hash value based on a preset private key to obtain a digital signature; and determining the electricity data block based on the initial data block and the digital signature.
[0010] Optionally, obtain the hash value of the power data block corresponding to the previous time period; encapsulate the hash value of the power data block corresponding to the previous time period into the data block header.
[0011] Optionally, sending a data upload request and an electricity data block to the blockchain includes: initiating a data upload request to the blockchain via an API interface; and broadcasting the electricity data block to the blockchain.
[0012] Optionally, upon receiving a notification that the blockchain has verified the data, the power data block is stored in the blockchain, including: monitoring whether the blockchain issues a notification; and upon receiving a notification that the blockchain has verified the data, storing the power data block in multiple nodes of the blockchain.
[0013] Optionally, the smart contract rules include at least one of the following: data format verification rules, data type verification rules, and data source verification rules, wherein the data format verification rules are used to verify whether the power data block conforms to the predefined data structure, the data type verification rules are used to confirm whether the data type in the power data block matches the predetermined type, and the data source verification rules are used to verify whether the device collecting the operation data has the data upload permission.
[0014] According to another aspect of the present invention, an electric power data storage device is also provided, comprising: a data acquisition module for acquiring operating data of electric equipment within a preset time period; an encapsulation module for encrypting the operating data and the corresponding acquisition time and encapsulating them into a data block to obtain an electric power data block; an upload module for sending a data upload request and the electric power data block to a blockchain, wherein the blockchain verifies the upload request and the electric power data block based on preset smart contract rules; and a storage module for storing the electric power data block to the blockchain upon receiving a notification that the blockchain has verified the data.
[0015] According to another aspect of the present invention, a non-volatile storage medium is also provided, the non-volatile storage medium including a stored program, wherein, when the program is running, it controls the device where the non-volatile storage medium is located to execute any of the above-described power data storage methods.
[0016] According to another aspect of the present invention, a computer device is also provided, the computer device including a processor for running a program, wherein the program executes any of the above-described power data storage methods during runtime.
[0017] According to another aspect of the present invention, a computer program product is also provided, including a computer program that, when executed by a processor, implements any of the above-described power data storage methods.
[0018] In this embodiment of the invention, a power data storage method is adopted. This involves collecting operational data from power equipment within a preset time period; encrypting the operational data and the corresponding collection time and encapsulating them into a data block to obtain a power data block; sending a data upload request and the power data block to the blockchain, where the blockchain verifies the upload request and the power data block based on preset smart contract rules; and storing the power data block on the blockchain upon receiving a notification that the blockchain verification is successful. This achieves the goal of storing encrypted power data on the blockchain, thereby improving the security and sharing efficiency of power data storage. Furthermore, it solves the technical problems that current power data often involves privacy data, and in centralized data management environments, data sharing and application are restricted, interaction is cumbersome, and data sharing and application cannot be completed efficiently and securely. Attached Figure Description
[0019] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0020] Figure 1 A hardware structure block diagram of a computer terminal for implementing a power data storage method is shown.
[0021] Figure 2 This is a flowchart illustrating the power data storage method provided according to an embodiment of the present invention;
[0022] Figure 3 This is a structural block diagram of a power data storage device provided according to an embodiment of the present invention. Detailed Implementation
[0023] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0025] According to an embodiment of the present invention, a method embodiment for power data storage is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.
[0026] The method embodiment provided in Embodiment 1 of this application can be executed on a mobile terminal, computer terminal, or similar computing device. Figure 1 A hardware block diagram of a computer terminal for implementing a power data storage method is shown. Figure 1 As shown, the computer terminal 10 may include one or more processors (shown as 102a, 102b, ..., 102n in the figure) (the processor may include, but is not limited to, a microprocessor MCU or a programmable logic device FPGA, etc.) and a memory 104 for storing data. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of a BUS bus), a network interface, a power supply, and / or a camera. Those skilled in the art will understand that... Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, computer terminal 10 may also include... Figure 1 The more or fewer components shown, or having the same Figure 1The different configurations shown.
[0027] It should be noted that the aforementioned one or more processors and / or other data processing circuits are generally referred to herein as "data processing circuits". These data processing circuits may be implemented wholly or partially as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuits may be a single, independent processing module, or may be wholly or partially integrated into any other element in the computer terminal 10. As involved in the embodiments of this application, the data processing circuits serve as processor control (e.g., selection of a variable resistor termination path connected to an interface).
[0028] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the power data storage method in this embodiment of the invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, thereby implementing the power data storage method of the aforementioned application. The memory 104 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor, and these remote memories can be connected to the computer terminal 10 via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0029] The display may be, for example, a touchscreen liquid crystal display (LCD) that allows the user to interact with the user interface of the computer terminal 10.
[0030] Figure 2 This is a flowchart illustrating the power data storage method provided according to an embodiment of the present invention, as shown below. Figure 2 As shown, the method includes the following steps:
[0031] Step S202: Collect the operating data of the power equipment within a preset time period.
[0032] In this step, the frequency and duration of data collection can be determined based on the characteristics of the power equipment and the purpose of the analysis. For example, for real-time monitoring of the power grid, the preset time period can be set to one minute or less; while for long-term trend analysis, the preset time period can be several hours.
[0033] Appropriate sensors and monitoring devices, such as current transformers, voltage transformers, temperature sensors, and vibration sensors, are installed on power equipment to measure and collect key operating parameters such as current, voltage, power, temperature, and vibration. A data acquisition system can be configured to ensure that sensors accurately and promptly transmit data to a central data processing platform. After the data arrives at the central processing platform, preprocessing can be performed, such as data cleaning (removing outliers and noise), data conversion (standardizing data formats), and timestamp correction (ensuring synchronization across data sources). Preprocessing ensures data quality and the accuracy of subsequent analysis.
[0034] Step S204: Encrypt the running data and the corresponding acquisition time and encapsulate them into a data block to obtain the power data block.
[0035] In this step, encryption algorithms can be used to encrypt the runtime data and acquisition time to protect data privacy and security. Encryption can be applied to all data or only key fields, depending on the sensitivity of the data and application requirements. Commonly used encryption algorithms include, but are not limited to, AES (Advanced Encryption Standard), RSA (Richter Algorithm for Public Keys), and Elliptic Curve Cryptography (ECC). To ensure the immutability of data blocks, a hash value can be generated for each data block. The hash value is calculated based on the content of the data block (including the encrypted runtime data and acquisition time) and the hash value of the previous data block. This process uses a cryptographic hash algorithm, such as SHA-256, which ensures that even small changes to the data block will result in a significantly different hash value.
[0036] The encrypted data, collection time, metadata (such as data type, data source identifier, etc.), and generated hash value are encapsulated into a data structure to form a data block. This data block typically contains: the hash value of the previous data block, the hash value of the current data block, the running data and collection time, and other metadata.
[0037] Through the above steps, after the power data blocks are encapsulated and encrypted, not only is the security of the data protected, but the integrity and traceability of the data on the blockchain are also ensured.
[0038] Step S206: Send a data upload request and an electricity data block to the blockchain, wherein the blockchain verifies the upload request and the electricity data block based on preset smart contract rules.
[0039] In this step, the packaged power data block, along with the data upload request, can be sent to the blockchain network via a blockchain client or API interface. Upon receiving the upload request, the blockchain network first verifies the authenticity and tamper-proof nature of the data block, then forwards it to a designated smart contract for further verification. The smart contract will verify the data block according to preset rules, which may include: checking the data format and data type to ensure the data conforms to blockchain storage standards; checking the validity of the timestamp to prevent old data from being re-uploaded; verifying the legitimacy of the device ID to ensure the data originates from authorized power equipment; and verifying the data's business logic, such as checking whether the data exceeds normal limits or exhibits any anomalies.
[0040] If the smart contract determines that a data block meets all preset rules, it will mark the data block as "verified" and allow it to be added to the blockchain. If the data block fails verification, the smart contract will reject the data block and may trigger an error notification to the initiator, informing them of the reason for the failure.
[0041] By using smart contracts to rigorously verify data upload requests and power data blocks through this series of steps, malicious data uploads can be effectively prevented, ensuring data security and reliability.
[0042] Step S208: Upon receiving a notification that the blockchain verification has been successful, the power data block is stored in the blockchain.
[0043] In this step, once a data block is verified by the smart contract, it is selected by a node in the blockchain network (usually a node with the authority to package new blocks, such as a miner node or a validator node) and packaged into a new block along with other pending transactions or data blocks. Once the new block is created and confirmed, it is broadcast throughout the entire blockchain network, and all nodes receive and verify it. If the new block meets the network consensus rules, the nodes add it to their own blockchain copies, thus completing the data block storage process. This propagation and confirmation process ensures data consistency and also increases the difficulty of tampering with the data.
[0044] Once a data block stored on the blockchain is confirmed, it cannot be modified or deleted. This is because the hash value of each data block is calculated based on its content and the hash value of the previous data block. If an attempt is made to modify a data block, its hash value will change, rendering the hash values of all subsequent data blocks invalid.
[0045] Through the above process, the power data blocks are securely and persistently stored on the blockchain, while ensuring the transparency and immutability of the data.
[0046] By combining operational data from power equipment with the time of data collection, and encrypting and encapsulating it into power data blocks, then verifying and storing it using blockchain technology, secure data transmission and tamper-proof storage are achieved. Specifically, the encryption process ensures that even if data is intercepted during transmission, it cannot be deciphered, enhancing data security. The blockchain, on the other hand, guarantees that once data is verified and added to the blockchain, it cannot be maliciously modified, thus solving the problems of data tampering and insufficient security in traditional data storage methods. Furthermore, the automatic execution feature of smart contracts reduces human intervention, improving the efficiency and accuracy of data processing. This solution is applicable to data management in the power industry, including but not limited to grid operation monitoring, equipment status monitoring, and energy trading records, providing strong guarantees for the reliability and security of power data.
[0047] Through the above steps, the goal of storing encrypted power data in the blockchain is achieved, thereby improving the security and sharing efficiency of power data storage. This solves the technical problems that power data often involves privacy data and that data sharing and application are restricted, interaction is cumbersome, and data sharing and application cannot be completed efficiently and securely in a centralized data management environment.
[0048] As an optional embodiment, the running data and the corresponding acquisition time are encrypted and encapsulated into a data block to obtain an electricity data block, including: encrypting the running data and the corresponding acquisition time based on a preset encryption algorithm to obtain encrypted data; creating a data block header and encapsulating the encrypted data into the data body of the data block to obtain an initial data block; performing a hash operation on the initial data block using a hash function to obtain a hash value; signing the hash value based on a preset private key to obtain a digital signature; and determining the electricity data block based on the initial data block and the digital signature.
[0049] Optionally, a preset encryption algorithm (such as AES, RSA, etc.) can be used to encrypt the collected power equipment operation data and the corresponding collection time to protect data privacy and security. The encrypted data, referred to as encrypted data, will be stored in this form on the blockchain. The data block header contains important information about the data block, such as the hash value of the previous data block, a timestamp (recording the time the data block was created), the data block version number, and some control information (such as block size limits). The encrypted operation data and collection time are encapsulated into the data body of the data block. The data body is the part of the data block that actually stores the data and contains all the information that needs to be recorded. In this scenario, the data body will contain the encrypted operation data and collection time, as well as any necessary additional metadata.
[0050] A hash function (such as SHA-256) can be used to hash the entire initial data block (including the block header and encrypted data in the body) to obtain a fixed-length hash value. This hash value is a digest of the data block, used to ensure the integrity and consistency of the block content; even a small change in the content will result in a significant difference in the hash value. The generated hash value is signed using a preset private key to produce a digital signature. The corresponding public key is sent to the blockchain when a data upload request is made, allowing the blockchain to authenticate the digital signature and determine whether the data has been tampered with. The digital signature provides non-repudiation, proving that the data block was created by the entity possessing the private key and has not been tampered with during transmission. The initial data block and the digital signature are combined to create the final power data block. The power data block should contain a block header, encrypted operating data and acquisition time, a hash value, and a digital signature.
[0051] Through the above steps, the power data block not only contains encrypted sensitive data, but also ensures data integrity and identity authentication through digital signatures and hash values, reducing security risks during data transmission.
[0052] Specifically, the RSA encryption algorithm can be used to encrypt the operating data and acquisition time of power equipment, generating encrypted data and ensuring its confidentiality during transmission. Subsequently, a data block header containing necessary metadata, such as the power equipment ID and data type, is created, and the encrypted data is encapsulated into the data body of the data block, forming the initial data block. Next, the hash value of the initial data block is calculated using the SHA-256 hash function. Finally, the hash value is signed using a preset private key to generate a digital signature, further strengthening the data's anti-counterfeiting capabilities. This entire process not only improves data security but also ensures data traceability and non-repudiation, which is crucial for the power industry, especially in sensitive areas involving energy trading and equipment status recording.
[0053] As an optional embodiment, the hash value of the power data block corresponding to the previous time period is obtained; the hash value of the power data block corresponding to the previous time period is encapsulated into the data block header.
[0054] Optionally, to maintain the continuity of the data chain, the system retrieves the hash value of the electricity data block corresponding to the previous time period (preset time period) and encapsulates it into the header of the data block to be created. This approach leverages the hash chaining characteristic of blockchain, where each data block contains the hash value of the previous data block, forming an irreversible chain structure. In this way, any modification to historical data will affect the hash value of subsequent data blocks, thereby compromising the integrity of the entire chain and effectively preventing data tampering.
[0055] The hash value of the power data block corresponding to the previous time period is encapsulated in the header of the current data block to ensure the continuity of the data chain. Once a block in the data chain is tampered with, its hash value will change, thereby breaking the link between data blocks. This makes it impossible for subsequent data blocks to match the tampered block, and the continuity of the entire chain is destroyed, thus making it easy to detect data inconsistency and tampering.
[0056] As an optional embodiment, sending a data upload request and an electricity data block to the blockchain includes: initiating a data upload request to the blockchain via an API interface; and broadcasting the electricity data block to the blockchain.
[0057] Optionally, a data upload request can be constructed via an API interface. This request may include the contract address, account information, request parameters, etc. The constructed data upload request is then sent to the blockchain network using the API interface. Once the request is sent, the electricity data block will be broadcast to all nodes in the entire blockchain network. Each node, upon receiving the request, will verify it according to network rules and the smart contract. If the verification passes, the node will accept the data block and add it to the pool of transactions to be packaged, awaiting inclusion in a new block.
[0058] Initiating a data upload request to the blockchain via the API interface and broadcasting the electricity data block to the blockchain are key steps in achieving secure data storage and sharing on the blockchain. This process leverages the distributed nature of the blockchain, the automated verification capabilities of smart contracts, and the reliability of the consensus mechanism to ensure the accuracy and security of the uploaded data.
[0059] The uploading of power data blocks is accomplished by calling the blockchain's API interface. This interface provides a standardized data interaction method, making the data uploading process more convenient and efficient. Once the power data block is ready, the system initiates a data upload request to the blockchain via the API interface. This request includes the power data block information and the digital signature required for verification. Upon receiving the request, the blockchain verifies the data block according to the smart contract rules, ensuring it meets the requirements for data format, type, and origin. Once verification is successful, the power data block is broadcast to all nodes in the blockchain network, where they jointly confirm and store it through a consensus mechanism. This distributed storage method not only improves data reliability but also enhances the system's resistance to attacks, as data modification requires the approval of a majority of nodes in the network, significantly increasing the difficulty of data tampering.
[0060] As an optional embodiment, upon receiving a notification message indicating that the blockchain has passed verification, the power data block is stored in the blockchain, including: monitoring whether the blockchain issues a notification message; and upon receiving a notification message indicating that the blockchain has passed verification, storing the power data block in multiple nodes of the blockchain.
[0061] Optionally, during the process of uploading the power data block to the blockchain, the system continuously monitors the blockchain network, awaiting feedback on the verification results. Once the blockchain verification is successful, the system immediately stores the power data block on multiple nodes in the blockchain; this process is typically completed automatically through a consensus mechanism. Once the data block is stored on multiple nodes, it forms a distributed, tamper-proof data record, improving data reliability and security. Furthermore, multi-node storage means that even if some nodes fail, the data can still be accessed and recovered, enhancing the system's fault tolerance and data persistence.
[0062] By monitoring the blockchain's verification messages, it can be confirmed whether the electricity data block has been successfully stored in the blockchain network. This process ensures data integrity and immutability because once the data is stored, it is distributed across multiple nodes, and modifications to any single node cannot affect the accuracy of the overall data.
[0063] As an optional embodiment, the smart contract rules include at least one of the following: data format verification rules, data type verification rules, and data source verification rules, wherein the data format verification rules are used to verify whether the power data block conforms to a predefined data structure, the data type verification rules are used to confirm whether the data type in the power data block matches a predetermined type, and the data source verification rules are used to verify whether the device collecting the operation data has data upload permissions.
[0064] Optionally, smart contract rules define the specific conditions and standards for data upload to the blockchain. Among these, data format validation rules ensure that power data blocks adhere to a unified data structure, such as JSON or XML format. This facilitates data parsing and subsequent processing, while also preventing data errors caused by format incompatibility. Data type validation rules check whether the data types in the data blocks are correct; for example, voltage should be a floating-point number, and timestamps should be integers. This helps ensure data accuracy and consistency. Data source validation rules check the identity and permissions of the devices, ensuring that only authorized power devices can upload data, which greatly improves data authenticity and security. The automatic execution feature of smart contracts reduces human intervention and improves the efficiency and accuracy of data processing.
[0065] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0066] Through the above description of the embodiments, those skilled in the art can clearly understand that the power data storage method according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0067] According to embodiments of the present invention, a power data storage device for implementing the above-described power data storage method is also provided. Figure 3 This is a structural block diagram of a power data storage device provided according to an embodiment of the present invention, such as... Figure 3 As shown, the power data storage device includes: acquisition module 302, encapsulation module 304, upload module 306 and storage module 308. The power data storage device will be described below.
[0068] The data acquisition module 302 is used to collect the operating data of power equipment within a preset time period.
[0069] The encapsulation module 304, connected to the acquisition module 302, is used to encrypt the running data and the corresponding acquisition time and encapsulate them into a data block to obtain a power data block.
[0070] The upload module 306, connected to the encapsulation module 304, is used to send data upload requests and power data blocks to the blockchain. The blockchain verifies the upload requests and power data blocks based on preset smart contract rules.
[0071] The storage module 308, connected to the upload module 306, is used to store the power data block to the blockchain upon receiving a notification message indicating that the blockchain verification has passed.
[0072] It should be noted that the acquisition module 302, encapsulation module 304, upload module 306, and storage module 308 mentioned above correspond to steps S202 to S208 in the embodiments. Multiple modules implement the same instances and application scenarios as their corresponding steps, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of the device, can run on the computer terminal 10 provided in the embodiments.
[0073] Embodiments of the present invention may provide a computer device. Optionally, in this embodiment, the computer device may be located in at least one of a plurality of network devices in a computer network. The computer device includes a memory and a processor.
[0074] The memory can be used to store software programs and modules, such as the program instructions / modules corresponding to the power data storage method and apparatus in this embodiment of the invention. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory, thereby realizing the aforementioned power data storage method. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory remotely located relative to the processor, and these remote memories can be connected to a computer terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0075] The processor can access information and applications stored in the memory via a transmission device to perform the following steps: collecting operating data of power equipment within a preset time period; encrypting and encapsulating the operating data and the corresponding collection time into a data block to obtain a power data block; sending a data upload request and the power data block to the blockchain, wherein the blockchain verifies the upload request and the power data block based on preset smart contract rules; and storing the power data block on the blockchain upon receiving a notification that the blockchain has verified the data.
[0076] Optionally, the processor may also execute program code that performs the following steps: encrypting and encapsulating the running data and the corresponding acquisition time into a data block to obtain an electricity data block, including: encrypting the running data and the corresponding acquisition time based on a preset encryption algorithm to obtain encrypted data; creating a data block header and encapsulating the encrypted data into the data body of the data block to obtain an initial data block; performing a hash operation on the initial data block using a hash function to obtain a hash value; signing the hash value based on a preset private key to obtain a digital signature; and determining the electricity data block based on the initial data block and the digital signature.
[0077] Optionally, the processor may also execute program code that performs the following steps: obtains the hash value of the power data block corresponding to the previous time period; and encapsulates the hash value of the power data block corresponding to the previous time period into the data block header.
[0078] Optionally, the processor may also execute program code that performs the following steps: sending a data upload request and an electricity data block to the blockchain, including: initiating a data upload request to the blockchain based on an API interface; and broadcasting the electricity data block to the blockchain.
[0079] Optionally, the processor may also execute program code that performs the following steps: upon receiving a notification message indicating that the blockchain has been verified, storing the power data block to the blockchain, including: listening to whether the blockchain issues a notification message; and upon receiving a notification message indicating that the blockchain has been verified, storing the power data block to multiple nodes in the blockchain.
[0080] Optionally, the processor may also execute program code for the following steps, wherein the smart contract rules include at least one of the following: data format verification rules, data type verification rules, and data source verification rules, wherein the data format verification rules are used to verify whether the power data block conforms to a predefined data structure, the data type verification rules are used to confirm whether the data type in the power data block matches a predetermined type, and the data source verification rules are used to verify whether the device collecting the operation data has data upload permissions.
[0081] This invention provides a method for storing electricity data. The method involves collecting operational data from power equipment within a preset time period; encrypting and encapsulating the operational data and corresponding collection time into a data block to obtain an electricity data block; sending a data upload request and the electricity data block to a blockchain, where the blockchain verifies the upload request and the electricity data block based on preset smart contract rules; and storing the electricity data block on the blockchain upon receiving a confirmation message that the blockchain has passed verification. This achieves the goal of storing encrypted electricity data on the blockchain, thereby improving the security and sharing efficiency of electricity data storage. It also solves the technical problems that electricity data often involves privacy data, and in centralized data management environments, data sharing and application are restricted, interaction is cumbersome, and data sharing and application cannot be completed efficiently and securely.
[0082] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a non-volatile storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, etc.
[0083] Embodiments of the present invention also provide a non-volatile storage medium. Optionally, in this embodiment, the aforementioned non-volatile storage medium can be used to store the program code executed by the power data storage method provided in the above embodiments.
[0084] Optionally, in this embodiment, the non-volatile storage medium may be located in any computer terminal in a group of computer terminals in a computer network, or in any mobile terminal in a group of mobile terminals.
[0085] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: collecting operating data of the power equipment within a preset time period; encrypting the operating data and the corresponding collection time and encapsulating them into a data block to obtain a power data block; sending a data upload request and the power data block to the blockchain, wherein the blockchain verifies the upload request and the power data block based on preset smart contract rules; and storing the power data block to the blockchain upon receiving a notification that the blockchain has verified the data.
[0086] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: encrypting and encapsulating the running data and corresponding acquisition time into a data block to obtain an electricity data block, including: encrypting the running data and corresponding acquisition time based on a preset encryption algorithm to obtain encrypted data; creating a data block header and encapsulating the encrypted data into the data body portion of the data block to obtain an initial data block; performing a hash operation on the initial data block using a hash function to obtain a hash value; signing the hash value based on a preset private key to obtain a digital signature; and determining the electricity data block based on the initial data block and the digital signature.
[0087] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: obtaining the hash value corresponding to the power data block corresponding to the previous time period; and encapsulating the hash value corresponding to the power data block corresponding to the previous time period into the data block header.
[0088] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: sending a data upload request and an electricity data block to the blockchain, including: initiating a data upload request to the blockchain based on an API interface; and broadcasting the electricity data block to the blockchain.
[0089] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps: upon receiving a notification message indicating that the blockchain has passed verification, storing the power data block to the blockchain, including: listening to whether the blockchain issues a notification message; upon receiving a notification message indicating that the blockchain has passed verification, storing the power data block to multiple nodes in the blockchain.
[0090] Optionally, in this embodiment, the non-volatile storage medium is configured to store program code for performing the following steps, wherein the smart contract rules include at least one of the following: data format verification rules, data type verification rules, and data source verification rules, wherein the data format verification rules are used to verify whether the power data block conforms to a predefined data structure, the data type verification rules are used to confirm whether the data type in the power data block matches a predetermined type, and the data source verification rules are used to verify whether the device collecting the operation data has data upload permissions.
[0091] Embodiments of the present invention also provide a computer program product, including a computer program. Optionally, in this embodiment, when the computer program is executed by a processor, it can: collect operating data of power equipment within a preset time period; encrypt the operating data and the corresponding collection time and encapsulate them into a data block to obtain a power data block; send a data upload request and the power data block to a blockchain, wherein the blockchain verifies the upload request and the power data block based on preset smart contract rules; and, upon receiving a notification that the blockchain has verified the data, store the power data block on the blockchain.
[0092] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0093] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0094] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units can be a logical functional division, and in actual implementation, there may be other division methods. For instance, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual coupling, direct coupling, or communication connection may be through some interfaces; the indirect coupling or communication connection between units or modules may be electrical or other forms.
[0095] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0096] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0097] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a non-volatile storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0098] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for storing electrical data, characterized in that, include: Collect operational data of power equipment within a preset time period; The operational data and corresponding acquisition time are encrypted and encapsulated into a data block to obtain a power data block; Send a data upload request and the power data block to the blockchain, wherein the blockchain verifies the upload request and the power data block based on preset smart contract rules; Upon receiving a notification that the blockchain verification has passed, the power data block is stored in the blockchain.
2. The method according to claim 1, characterized in that, The step of encrypting and encapsulating the operating data and the corresponding acquisition time into a data block to obtain a power data block includes: Based on a preset encryption algorithm, the running data and the corresponding acquisition time are encrypted to obtain encrypted data; Create a data block header and encapsulate the encrypted data into the data body portion of the data block to obtain the initial data block; The initial data block is hashed using a hash function to obtain a hash value; Based on a preset private key, the hash value is signed to obtain a digital signature; The power data block is determined based on the initial data block and the digital signature.
3. The method according to claim 2, characterized in that, Also includes: Obtain the hash value of the power data block corresponding to the previous time period of the preset time period; The hash value corresponding to the power data block of the previous time period is encapsulated into the data block header.
4. The method according to claim 1, characterized in that, Sending the data upload request and the power data block to the blockchain includes: Initiate a data upload request to the blockchain based on the API interface; The power data block is broadcast to the blockchain.
5. The method according to claim 1, characterized in that, Upon receiving a notification that the blockchain verification has passed, storing the power data block to the blockchain includes: Monitor whether the blockchain issues the notification message; Upon receiving a notification that the blockchain verification has passed, the power data block is stored on multiple nodes in the blockchain.
6. The method according to any one of claims 1 to 5, characterized in that, The smart contract rules include at least one of the following: data format verification rules, data type verification rules, and data source verification rules, wherein the data format verification rules are used to verify whether the power data block conforms to a predefined data structure, the data type verification rules are used to confirm whether the data type in the power data block matches a predetermined type, and the data source verification rules are used to verify whether the device collecting the operating data has data upload permissions.
7. A power data storage device, characterized in that, include: The data acquisition module is used to collect operating data of power equipment within a preset time period; The encapsulation module is used to encrypt the running data and the corresponding acquisition time and encapsulate them into a data block to obtain a power data block; An upload module is used to send a data upload request and the power data block to the blockchain, wherein the blockchain verifies the upload request and the power data block based on preset smart contract rules; A storage module is used to store the power data block to the blockchain upon receiving a notification that the blockchain verification has passed.
8. A non-volatile storage medium, characterized in that, The non-volatile storage medium includes a stored program, wherein, when the program is executed, it controls the device containing the non-volatile storage medium to perform the power data storage method according to any one of claims 1 to 6.
9. A computer device, characterized in that, include: Memory and processor The memory stores computer programs; The processor is configured to execute a computer program stored in the memory, wherein when the computer program is executed, the processor performs the power data storage method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the power data storage method according to any one of claims 1 to 6.