A system, method, apparatus, and storage medium for storing electric carbon emission data
By using a layered blockchain platform, the single point of failure and tampering risk of traditional electricity carbon emission data storage systems are solved, achieving efficient and secure data storage and synchronization, and making it suitable for large-scale, high-concurrency data processing.
Patent Information
- Application Number
- CN202411462189.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-12-05
- Estimated Expiration
- 2044-10-18
AI Technical Summary
Traditional methods for storing carbon emissions from electricity consumption have the risk of single points of failure, the data is easily tampered with and is complex to manage, making it difficult to meet the needs of large-scale, high-concurrency storage.
A layered blockchain platform, including leaf blockchain, middle layer blockchain and root blockchain, is adopted, which combines identity registration interface and message queue to achieve secure data storage and efficient synchronization.
It improves data security and storage efficiency, enables efficient and secure data storage and synchronization, supports large-scale, high-concurrency data transfer requests, and prevents data tampering.
Smart Images

Figure CN119323055B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of data storage, and in particular to a power consumption carbon emission data storage system, method, device and storage medium. BACKGROUND
[0002] Power consumption carbon emission data involves a large number of users, and a large amount of data upload and access requests will be generated by these users. Moreover, these data often involve important commercial privacy of users. Due to the above characteristics of power consumption carbon emission data, the industry has put forward a series of requirements for data storage, including large-scale storage capacity, high concurrent processing capability, high real-time performance and data security.
[0003] The traditional power consumption carbon emission data storage method is to upload data to a dedicated storage server in a centralized manner. The scale of the storage server cluster increases with the expansion of the storage data volume, thereby testing the data synchronization between different servers. A large number of data storage and access requests require higher server performance. In order to meet the high concurrency and high real-time performance of the requests, load balancing, flow limiting and fusing mechanisms need to be introduced, and the management of data requests will become more complex, which greatly increases the cost of data storage. The traditional centralized server data storage method has a single point of failure. Once the server is attacked, all data is at risk of being tampered with, and the tampering is not easy to be detected by the data users. SUMMARY
[0004] The present application provides a power consumption carbon emission data storage system, method, device and storage medium for improving the technical problem that the existing centralized server data storage system has a single point of failure and all data is easily tampered with once the server is attacked.
[0005] Therefore, the first aspect of the present application provides a power consumption carbon emission data storage system, comprising: a hierarchical blockchain platform and a power supply bureau, wherein the hierarchical blockchain platform comprises a leaf blockchain, an intermediate layer blockchain, a root blockchain, an identity registration interface, a data upload interface and a data download interface;
[0006] The power supply bureau is configured to register the identities of environmental monitoring departments and carbon emission users through the identity registration interface and issue certificates for accessing the blockchain;
[0007] The data upload interface is configured to receive a data upload request initiated by a carbon emission user;
[0008] The leaf blockchain is configured to store power consumption carbon emission data after the certificate of the carbon emission user is verified, and to periodically synchronize the block header of the leaf blockchain to the intermediate layer blockchain and download the block header of the intermediate layer blockchain and the block header of the root blockchain from the intermediate layer blockchain;
[0009] The intermediate layer blockchain is configured to collect and process block header information of all subordinate leaf blockchains, and periodically synchronize block headers of the intermediate layer blockchain to the root blockchain and download block headers of the root blockchain from the root blockchain;
[0010] The root blockchain is configured to collect and process block header information from the intermediate layer blockchain, and recursively broadcast block headers of the root blockchain to the intermediate layer blockchain and the leaf blockchains;
[0011] The data download interface is configured to receive a data download request initiated by the environmental protection monitoring department, and return electricity carbon emission data of a corresponding target user after certificate verification of the environmental protection monitoring department is passed.
[0012] Optionally, the hierarchical blockchain platform further comprises a message queue arranged at the data upload interface and the data download interface, and the message queue is configured to buffer interface requests.
[0013] Optionally, the power supply bureau specifically comprises:
[0014] A login unit is configured to log in to the electricity carbon emission data storage system as a system administrator.
[0015] A registration unit is configured to call the identity registration interface to initiate a registration request to the electricity carbon emission data storage system, and register an account according to identity information of a registered user, the registered user being an environmental protection monitoring department or a carbon emission user.
[0016] A certificate generation and sending unit is configured to generate an access blockchain platform certificate according to the account of the registered user and issue the certificate to the registered user.
[0017] Optionally, the certificate generation and sending unit is specifically configured to:
[0018] Receive a certificate signature request generated by the registered user based on the account and the public key, and verify the account of the registered user;
[0019] Combine the certificate with an expiration date, a serial number, the account and the public key of the registered user to generate certificate information, and perform a hash operation on the certificate information to generate a digest;
[0020] Sign the digest to obtain signature content;
[0021] Combine the certificate information and the signature content to generate an access blockchain certificate, and send the certificate to the registered user.
[0022] Optionally, the data on-chain interface is specifically configured to receive a data on-chain request initiated by the carbon emission user, the data on-chain request comprising electricity carbon emission data, a timestamp, and an account number;
[0023] The leaf blockchain is specifically configured to access the layered blockchain platform for the carbon emission user after the certificate of the carbon emission user is verified.
[0024] The hash value of the electricity carbon emission data uploaded by the carbon emission user is calculated, a transaction is created according to the hash value, the timestamp, and the account number, the transaction is signed by a private key of the carbon emission user, the transaction and the corresponding signature are broadcast to a blockchain network, the signature is verified by other nodes in the blockchain network, and the transaction is packaged into a new block;
[0025] The hash value of the new block and the previous block is calculated, a block header is generated, the block header is uploaded to the intermediate blockchain, and the block header of the intermediate layer blockchain and the block header of the root blockchain are downloaded from the intermediate layer blockchain.
[0026] Optionally, the data download interface is configured to receive a data download request initiated by the environmental protection monitoring department, the data download request carrying an account number of a target user to which the to-be-downloaded data belongs and a range of upload time of the to-be-downloaded data.
[0027] The layered blockchain platform is configured to verify the certificate of the environmental protection monitoring department and access the layered blockchain platform for the environmental protection monitoring department after the verification.
[0028] According to the data download request, all transactions meeting the conditions in the current blockchain are queried, if the transactions meeting the conditions exist in the current blockchain, all node hash values on the path from the block where the transaction is located to the Merkle root are obtained, and the hash values are calculated along the path to obtain a path hash value.
[0029] The path hash value is compared with the Merkle root of the block header of the current blockchain, if they are consistent, the electricity carbon emission data of the target user is returned to the environmental protection monitoring department after the block where the electricity carbon emission data of the target user is located and the integrity are determined.
[0030] If they are inconsistent, the transactions in other block headers downloaded from the current blockchain are queried, the blockchain where the queried transaction is located is located, the block where the electricity carbon emission data of the target user is located and the integrity are determined, and the electricity carbon emission data of the target user is returned to the environmental protection monitoring department.
[0031] The second aspect of the application provides a method for storing electricity carbon emission data, applied to any of the electricity carbon emission data storage systems of the first aspect, and the method comprises:
[0032] The power supply bureau registers the environmental protection monitoring department and the carbon emission user through an identity registration interface, and issues a certificate for accessing the blockchain;
[0033] The carbon emission user initiates a data chaining request through a data uploading interface;
[0034] The leaf blockchain stores the electricity carbon emission data after the certificate of the carbon emission user is verified, and periodically synchronizes the block header of the leaf blockchain to the intermediate layer blockchain, and downloads the block header of the intermediate layer blockchain and the block header of the root blockchain from the intermediate layer blockchain;
[0035] The intermediate layer blockchain collects and processes the block header information of all subordinate leaf blockchains, and periodically synchronizes the block header of the intermediate layer blockchain to the root blockchain, and downloads the block header of the root blockchain from the root blockchain;
[0036] The root blockchain collects and processes the block header information from the intermediate layer blockchain, and recursively broadcasts the block header of the root blockchain to the intermediate layer blockchain and the leaf blockchain;
[0037] The environmental protection monitoring department initiates a data download request through a data download interface to download the electricity carbon emission data of the target user.
[0038] Optionally, the power supply bureau registers the environmental protection monitoring department and the carbon emission user through an identity registration interface, and issues a certificate for accessing the blockchain, including:
[0039] The power supply bureau logs in to the electricity carbon emission data storage system as a system administrator;
[0040] The identity registration interface is called to initiate a registration request to the electricity carbon emission data storage system, and an account is registered according to the identity information of the registered user, the registered user being an environmental protection monitoring department or a carbon emission user;
[0041] A blockchain platform access certificate is generated according to the account of the registered user and issued to the registered user.
[0042] The third aspect of the present application provides an electronic device, the device comprising a processor and a memory;
[0043] The memory is used to store program code and transmit the program code to the processor;
[0044] The processor is used to execute the electricity carbon emission data storage method of any one of the second aspect according to the instructions in the program code.
[0045] The fourth aspect of the application provides a computer readable storage medium, characterized in that the computer readable storage medium is used for storing program codes, and the program codes are executed by a processor to realize the power carbon emission data storage method of any one of the second aspect.
[0046] From the above technical solutions, the application has the following advantages:
[0047] The power carbon emission data storage system provided by the application stores power carbon emission data by using a blockchain. The characteristics of the blockchain itself make the data difficult to be tampered even if it is leaked, thereby improving the data security. The layered blockchain platform is used for data storage and processing, thereby realizing efficient and secure data storage and synchronization. The root blockchain collects and processes the block headers of the leaf blockchains and broadcasts to each leaf blockchain, so that the data belonging to the block can be easily found, cross-chain data access and download are realized, and the flexibility of data retrieval is improved.
[0048] Further, the plurality of blockchains respectively receive the carbon emission data of the accessed nodes, and in combination with the message queue, large-scale and high-concurrency data flow requests can be effectively handled. The Merkle path of the found block can quickly determine the validity and chaining order of the data on the chain, thereby preventing data from being out of synchronization. BRIEF DESCRIPTION OF DRAWINGS
[0049] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description are only some embodiments of the application, and for those skilled in the art, other drawings can be obtained from these drawings without creative labor.
[0050] Figure 1 A structural schematic diagram of a power carbon emission data storage system provided by an embodiment of the application;
[0051] Figure 2 A structural schematic diagram of a layered blockchain platform provided by an embodiment of the application;
[0052] Figure 3 A flowchart of a power carbon emission data storage method provided by an embodiment of the application. DETAILED DESCRIPTION
[0053] In order to better understand the present application by those skilled in the art, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0054] For the convenience of understanding, please refer to Figure 1 The first aspect of the present application provides a power consumption carbon emission data storage system, comprising: a hierarchical blockchain platform and a power supply bureau, the hierarchical blockchain platform comprising a leaf blockchain, an intermediate layer blockchain, a root blockchain, an identity registration interface, a data upload interface and a data download interface;
[0055] The power supply bureau is used for identity registration of the environmental protection monitoring department and the carbon emission user through the identity registration interface, and issues a certificate for accessing the blockchain;
[0056] The data upload interface is used for receiving the data upload request initiated by the carbon emission user;
[0057] The leaf blockchain is used for storing the power consumption carbon emission data after the certificate of the carbon emission user is verified, and periodically synchronizing the block header of the leaf blockchain to the intermediate layer blockchain, and downloading the block header of the intermediate layer blockchain and the block header of the root blockchain from the intermediate layer blockchain;
[0058] The intermediate layer blockchain is used for collecting and processing the block header information of all subordinate leaf blockchains, and periodically synchronizing the block header of the intermediate layer blockchain to the root blockchain, and downloading the block header of the root blockchain from the root blockchain;
[0059] The root blockchain is used for collecting and processing the block header information from the intermediate layer blockchain, and recursively broadcasting the block header of the root blockchain to the intermediate layer blockchain and the leaf blockchain;
[0060] The data download interface is used for receiving the data download request initiated by the environmental protection monitoring department, and returning the power consumption carbon emission data of the corresponding target user after the certificate of the environmental protection monitoring department is verified.
[0061] In the embodiments of the present application, the core of the electricity carbon emission data storage system is a hierarchical blockchain platform, which provides services for power supply bureaus, carbon emission users and environmental protection monitoring departments, and realizes large-scale electricity carbon emission data storage and synchronization. The hierarchical blockchain platform provides an identity registration interface, a data upload interface and a data download interface. The power supply bureau registers the identities of the environmental protection monitoring departments and the carbon emission users through the identity registration interface, and issues certificates for accessing the blockchain; the carbon emission users upload electricity carbon emission data to the blockchain through the data upload interface; and the environmental protection monitoring departments download the uploaded electricity carbon emission data of target users (such as carbon emission users such as emission control enterprises, power generation facilities, metering facilities and energy storage facilities) through the data download interface.
[0062] The hierarchical blockchain data storage structure used by the electricity carbon emission data storage system is shown in FIG. 1. Figure 2 As shown in FIG. 1, the hierarchical blockchain platform is divided into three layers from bottom to top, namely leaf blockchain, intermediate layer blockchain and root blockchain.
[0063] The leaf blockchain is used to store electricity carbon emission data within a county. The nodes in the leaf blockchain include county environmental protection monitoring departments and carbon emission users such as emission control enterprises, power generation facilities, metering facilities and energy storage facilities. After completing identity registration, the carbon emission users upload carbon emission data to the leaf blockchain in which they are located. The platform automatically synchronizes the block headers of the leaf blockchain to the intermediate layer blockchain at regular intervals, and downloads the block headers of the intermediate layer blockchain and the block headers of the root blockchain from the intermediate layer blockchain. The county environmental protection monitoring departments do not participate in data uploading.
[0064] The intermediate layer blockchain collects and processes the block header information of all subordinate leaf blockchains. The nodes in the intermediate layer blockchain include the environmental protection monitoring departments of the counties and the municipal environmental protection bureau. The platform automatically synchronizes the block headers of the intermediate layer blockchain to the root blockchain at regular intervals, and downloads the block headers from the root blockchain.
[0065] There is only one root blockchain, which is responsible for collecting and processing the block header information from the intermediate layer blockchain, and recursively broadcasting the block headers of the root blockchain to the intermediate layer blockchain and the leaf blockchain. The nodes in the root blockchain include the ecological environment department, the power supply bureau and the municipal environmental protection bureau.
[0066] Further, in order to meet the large-scale and high-concurrency storage requirements of electricity carbon emission data, the hierarchical blockchain platform introduces a message queue as a data cache at the data upload interface and the data download interface. When data is concentrated during the peak of carbon emission, the interface request can be temporarily stored in the message queue to prevent data loss and maintain efficient system operation.
[0067] Further, the power supply bureau specifically includes:
[0068] A login unit configured to log in to the electricity carbon emission data storage system as a system administrator;
[0069] A registration unit is configured to call an identity registration interface to initiate a registration request to the electricity carbon emission data storage system, register an account according to identity information of a registered user, and the registered user is an environmental protection monitoring department or a carbon emission user; an administrator can register an account according to information such as an enterprise name and an enterprise nature of the user, and generate a user ID as a login account
[0070] A certificate generation and sending unit is configured to generate an access blockchain platform certificate according to the account of the registered user and issue the certificate to the registered user.
[0071] Further, the certificate generation and sending unit is specifically configured to:
[0072] receive a certificate signature request generated by the registered user based on the account and the public key, and verify the account of the registered user;
[0073] generate certificate information in combination with an expiration date of the certificate, a serial number, the account of the registered user and the public key, and perform a hash operation on the certificate information to generate a digest;
[0074] sign the digest to obtain signature content;
[0075] combine the certificate information and the signature content to generate a certificate for accessing the blockchain, and send the certificate to the registered user.
[0076] It should be noted that the registered user can independently generate a key pair (PK C ,SK C ) on the client of the system, can generate a certificate signature request (PK C ,userID) according to the account userID and the public key PK C , and send the certificate signature request to the server corresponding to the power supply bureau; the server verifies the account userID of the registered user, generates certificate information Cert=(userID,T C ,SN Cert ,PK C ) in combination with information such as a certificate expiration date T C , a serial number SN Cert , performs a hash operation on the certificate information to generate a digest H(Cert), signs the digest to obtain signature content Sign S (H(Cert)), and finally combines the certificate information and the signature content to obtain a certificate Cert C for accessing the blockchain Cert S ={Cert,Sign S (H(Cert))}, and sends the certificate to the registered user.
[0077] Further, the data uploading interface is specifically configured to receive a data uploading request initiated by the carbon emission user, the data uploading request comprising the electricity carbon emission data, the timestamp and the account number;
[0078] The leaf blockchain is specifically configured to connect the carbon emission user to the hierarchical blockchain platform after the certificate of the carbon emission user is verified;
[0079] The hash value of the electricity carbon emission data uploaded by the carbon emission user is calculated, and a transaction is created according to the hash value, the timestamp and the account number, the transaction is signed by the private key of the carbon emission user, and the transaction and the corresponding signature are broadcast to the blockchain network, the signature is verified by other nodes in the blockchain network, and the transaction is packaged into a new block;
[0080] The hash value of the new block and the previous block is calculated, the block header is generated, the block header is uploaded to the intermediate blockchain, and the block header of the intermediate blockchain and the block header of the root blockchain are downloaded from the intermediate blockchain.
[0081] The specific process of data uploading includes:
[0082] a. The carbon emission user logs in the electricity carbon emission data storage system using the account number userID, initiates a data uploading request through the data uploading interface, and uploads the electricity carbon emission data D, the timestamp TimeStamp and the account number userID. The system verifies the user certificate, connects the user to the blockchain platform, and the data uploading request enters the message queue for queuing.
[0083] b. The blockchain platform processes the data uploading request, calculates the hash value H(D) of the electricity carbon emission data D, creates a transaction T={H(D), TimeStamp, userID}, signs the transaction T using the user private key SK C , and obtains , and broadcasts it to the blockchain network.
[0084] c. Other nodes in the blockchain network verify the signature , and the transaction is packaged into a new block B. The hash value of the current block B and the previous block B prev is calculated, the block header Header={H(B), H(B prev ), TimeStamp} is generated, the block header Header is uploaded to the intermediate blockchain, and other block headers are downloaded.
[0085] d. Repeat steps b-c until the data is uploaded to the root blockchain.
[0086] Further, the data download interface is configured to receive a data download request initiated by the environmental protection monitoring department, and the data download request carries an account of a target user to which the to-be-downloaded data belongs and a range of upload time of the to-be-downloaded data.
[0087] The layered blockchain platform is configured to verify a certificate of the environmental protection monitoring department, and after verification, the environmental protection monitoring department is connected to the layered blockchain platform.
[0088] According to the data download request, all transactions meeting the conditions in the current blockchain are queried, if the transactions meeting the conditions are found in the current blockchain, all node hash values on the path from the block where the transaction is located to the Merkle root are obtained, and the hash values are calculated along the path to obtain path hash values.
[0089] The path hash values are compared with the Merkle root of the block header of the current blockchain, if the path hash values are consistent with the Merkle root, after the block where the carbon emission data of the target user is located and the integrity are determined, the carbon emission data of the target user is returned to the environmental protection monitoring department.
[0090] If the path hash values are not consistent with the Merkle root, other block headers downloaded from the current blockchain are traversed to query transactions, the blockchain where the transaction is located is located, after the block where the carbon emission data of the target user is located and the integrity are determined, the carbon emission data of the target user is returned to the environmental protection monitoring department.
[0091] The specific process of data download includes:
[0092] A. The environmental protection monitoring department logs in the system using an account userID, initiates a data download request through the data download interface, uploads an account userID of a target user to which to-be-downloaded data belongs and a range of upload time of the to-be-downloaded data (BeginTime, EndTime), BeginTime is a start time and EndTime is an end time;
[0093] B. The system verifies the certificate of the environmental protection monitoring department, after verification, the environmental protection monitoring department is connected to the blockchain platform, and the data download request enters a message queue for queuing;
[0094] C. The blockchain platform processes the data download request, according to the account userID of the target user and the range of upload time of the to-be-downloaded data (BeginTime, EndTime), all transactions T i meeting the conditions in the current blockchain are queried, if T i is in the current blockchain, the Merkle proof of T i is obtained, that is, all node hash values H on the path from the block where the transaction is located to the Merkle root. The hash values H are calculated along the path, and the finally calculated H currentThe Merkle root H of the block header root If the comparison is consistent, the block where the data is located and the integrity are determined, and the data is downloaded.
[0095] D, if the transaction T i is not in the current blockchain, the transactions in the downloaded other block headers are queried and traversed to locate the blockchain where the transaction T i is located, the block where the data is located and the integrity are determined, and the data is downloaded.
[0096] The power consumption carbon emission data storage system provided by the application stores power consumption carbon emission data by using a blockchain. The characteristics of the blockchain itself make the data difficult to be tampered even if it is leaked, thereby improving the data security. The hierarchical blockchain platform is used for data storage and processing, efficient and secure data storage and synchronization are realized, the root blockchain collects and processes the block headers of the leaf blockchains and broadcasts to each leaf blockchain, so that the block where the data belongs to is easily found, cross-chain data access and download are realized, and the flexibility of data retrieval is improved.
[0097] Further, a plurality of blockchains respectively receive carbon emission data of the accessed nodes, and in combination with a message queue, large-scale and high-concurrency data flow requests can be effectively handled. The Merkle path of the block can quickly determine the validity and chaining order of the data on the chain, thereby preventing data from being out of synchronization.
[0098] Please refer to Figure 3 The second aspect of the application provides a power consumption carbon emission data storage method applied to the power consumption carbon emission data storage system of the first aspect. The method comprises the following steps:
[0099] Step 110: The power supply bureau registers the environmental protection monitoring department and the carbon emission user through an identity registration interface, and issues a certificate for accessing the blockchain.
[0100] The power supply bureau logs in to the power consumption carbon emission data storage system as a system administrator; calls an identity registration interface to initiate a registration request to the power consumption carbon emission data storage system, registers an account according to the identity information of the registered user, and the registered user is an environmental protection monitoring department or a carbon emission user; generates a certificate for accessing the blockchain platform according to the account of the registered user and issues it to the registered user. Specifically, a certificate signature request generated by the registered user based on the account and the public key is obtained, and the account of the registered user is verified; certificate information is generated in combination with the validity period, serial number, account and public key of the registered user, and the certificate information is subjected to a hash operation to generate a digest; the digest is signed to obtain signature content; the certificate information and the signature content are combined to generate a certificate for accessing the blockchain, and the certificate is sent to the registered user.
[0101] It should be noted that the registered user can independently generate a key pair (PK C ,SKC ), the certificate signing request (PK C , userID) can be generated according to the account userID and the public key PK C , and sent to the server corresponding to the power supply bureau; the server verifies the account userID of the registered user, generates certificate information Cert=(userID, T C , SN Cert , PK C ) in combination with the certificate validity period T Cert , the serial number SN C , and the like, performs a hash operation on the certificate information to generate a digest H(Cert), then signs the digest to obtain signature content Sign S (H(Cert)), and finally combines the certificate information and the signature content to obtain a certificate Cert C = {Cert, Sign S (H(Cert))} for accessing the blockchain, and sends the certificate to the registered user.
[0102] Step 120, the carbon emission user initiates a data chaining request through a data chaining interface.
[0103] Step 130, the leaf blockchain stores the electricity carbon emission data after the certificate of the carbon emission user is verified, and periodically synchronizes the block header of the leaf blockchain to the intermediate layer blockchain, and downloads the block header of the intermediate layer blockchain and the block header of the root blockchain from the intermediate layer blockchain.
[0104] The data chaining interface is used to receive a data chaining request initiated by the carbon emission user, and the data chaining request includes electricity carbon emission data, a timestamp, and an account; the leaf blockchain accesses the hierarchical blockchain platform after the certificate of the carbon emission user is verified; a hash value of the electricity carbon emission data uploaded by the carbon emission user is calculated, and a transaction is created according to the hash value, the timestamp, and the account, the transaction is signed by the private key of the carbon emission user, and the transaction and the corresponding signature are broadcast to the blockchain network, and the transaction is verified by other nodes in the blockchain network, and packed into a new block; the hash value of the new block and the previous block is calculated to generate a block header, and the block header is uploaded to the intermediate blockchain, and the block header of the intermediate layer blockchain and the block header of the root blockchain are downloaded from the intermediate layer blockchain.
[0105] Step 140, the intermediate layer blockchain collects and processes the block header information of all the subordinate leaf blockchains, and periodically synchronizes the block header of the intermediate layer blockchain to the root blockchain, and downloads the block header of the root blockchain from the root blockchain.
[0106] Step 150, the root blockchain collects block header information from the intermediate layer blockchain, and recursively broadcasts the block header of the root blockchain to the intermediate layer blockchain and the leaf blockchain.
[0107] The specific process of data uploading includes:
[0108] a. The carbon emission user logs in the electricity carbon emission data storage system using an account userID, initiates a data uploading request through a data uploading interface, and uploads electricity carbon emission data D, a timestamp TimeStamp, and an account userID. The system verifies the user's credentials, connects the user to the blockchain platform, and queues the data uploading request in the message queue.
[0109] b. The blockchain platform processes the data uploading request, calculates the hash value H(D) of the electricity carbon emission data D, creates a transaction T={H(D), TimeStamp, userID}, signs the transaction T using the user's private key SK C , obtains , and broadcasts it to the blockchain network.
[0110] c. Other nodes in the blockchain network verify the signature , and the transaction is packaged into a new block B. The hash values of the current block B and the previous block B prev are calculated to generate a block header Header={H(B), H(B prev ), TimeStamp}, which is uploaded to the intermediate blockchain, and other block headers are downloaded.
[0111] d. Repeat steps b-c until the data is uploaded to the root blockchain.
[0112] Step 160, the environmental protection monitoring department initiates a data download request through a data download interface to download the electricity carbon emission data of the target user.
[0113] The data download interface receives the data download request initiated by the environmental protection monitoring department, and the data download request carries the account of the target user to which the to-be-downloaded data belongs and the range of the upload time of the to-be-downloaded data.
[0114] The layered blockchain platform verifies the certificate of the environmental monitoring department, and after verification, the environmental monitoring department is connected to the layered blockchain platform; all transactions in the current blockchain that meet the conditions are queried according to the data download request, if the current blockchain is queried to exist the transaction that meets the condition, all node hash values on the path from the block where the transaction is located to the merkle root are obtained, and the hash values along the path are calculated to obtain the path hash value; the path hash value is compared with the merkle root of the block header of the current blockchain, if they are consistent, the electricity carbon emission data of the target user is returned to the environmental monitoring department after determining the block where the electricity carbon emission data of the target user is located and the integrity; if they are inconsistent, the transactions in the other block headers downloaded by the current blockchain are queried, the blockchain where the transaction is located is located, the block where the electricity carbon emission data of the target user is located and the integrity are determined, and the electricity carbon emission data of the target user is returned to the environmental monitoring department.
[0115] Specifically, the specific process of data download includes:
[0116] A, the environmental monitoring department logs in the system using an account userID, initiates a data download request through a data download interface, uploads the account userID of the target user to which the to-be-downloaded data belongs and the range of to-be-downloaded data upload time (BeginTime, EndTime), BeginTime is the start time, EndTime is the end time;
[0117] B, the system verifies the certificate of the environmental monitoring department, and after verification, the environmental monitoring department is connected to the blockchain platform, and the data download request enters the message queue for queuing;
[0118] C, the blockchain platform processes the data download request, queries all transactions T i that meet the conditions in the current blockchain according to the account userID of the target user and the range of to-be-downloaded data upload time (BeginTime, EndTime); i If T i is in the current blockchain, the merkle proof of T current is obtained, that is, all node hash values on the path from the block where the transaction is located to the merkle root. The hash values along the path are calculated, and the finally calculated H root is compared with the merkle root H i of the block header, and if they are consistent, the data is downloaded.
[0119] D, if the transaction T i is not in the current blockchain, the transactions in the other block headers downloaded are queried, the blockchain where the transaction T is located is located, the data is downloaded after determining the block where the data is located and the integrity.
[0120] The power consumption carbon emission data storage method provided by the application stores power consumption carbon emission data by using a blockchain, and the characteristics of the blockchain itself make the data difficult to be tampered even if it is leaked, thereby improving data security; the hierarchical blockchain platform is used for data storage and processing, efficient and secure data storage and synchronization are realized, the root blockchain collects and processes the block headers of the leaf blockchains and broadcasts to each leaf blockchain, so that the block to which the data belongs can be easily found, cross-chain data access and download are realized, and the flexibility of data retrieval is improved.
[0121] Further, the plurality of blockchains respectively receive carbon emission data of the accessed nodes, and in combination with the message queue, large-scale and high-concurrency data flow requests can be effectively handled; the Merkle path of the found block can quickly determine the validity and chaining order of the data on the chain, thereby preventing data from being out of synchronization.
[0122] The third aspect of the application provides an electronic device, which comprises a processor and a memory;
[0123] The memory is used to store program code and transmit the program code to the processor;
[0124] The processor is used to execute the power consumption carbon emission data storage method of the second aspect according to the instructions in the program code.
[0125] The fourth aspect of the application provides a computer readable storage medium, which is used to store program code, and the program code is executed by the processor to realize the power consumption carbon emission data storage method of the second aspect.
[0126] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific process of the above-described method can refer to the corresponding process in the foregoing system embodiments, which will not be repeated here.
[0127] The terms "first", "second", "third", "fourth" and the like (if any) in the specification and the above drawings of the application are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.
[0128] It should be understood that, in the application, "at least one" means one or more, "multiple" means two or more. "And / or" is used to describe the relationship between the associated objects, which means that there can be three relationships, for example, "A and / or B" can mean: only A, only B, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally represents an "or" relationship between the associated objects. "At least one of the following" or the like means any combination of these items, including single or multiple items in any combination. For example, at least one of a, b or c, can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0129] In several embodiments provided in the application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the displayed or discussed units can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0130] The units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, that is, they can be located in one place, or they can be distributed on multiple network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiment scheme.
[0131] In addition, the functional units in each embodiment of the application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0132] The integrated unit, if implemented in the form of a software function unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or say the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, includes a plurality of instructions for executing all or part of the steps of the method described in various embodiments of the present application by a computer device (which can be a personal computer, a server, or a network device, etc.). The foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (English full name: Read-Only Memory, English abbreviation: ROM), a random access memory (English full name: Random Access Memory, English abbreviation: RAM), a magnetic disk or an optical disk, and various media that can store program codes.
[0133] The above-described and above-mentioned embodiments are only used to illustrate the technical solutions of the present application, rather than limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. An electrical carbon emissions data storage system, characterized by, Comprise: A hierarchical blockchain platform and a power supply bureau, the hierarchical blockchain platform comprising a leaf blockchain, an intermediate layer blockchain, a root blockchain, an identity registration interface, a data upload interface and a data download interface; The power supply bureau is used for identity registration of environmental protection monitoring departments and carbon emission users through the identity registration interface, and issuing certificates for accessing the blockchain; The data upload interface is used for receiving data upload requests initiated by carbon emission users; The leaf blockchain is used for storing electricity carbon emission data after the certificate of the carbon emission user is verified, and periodically synchronizing the block header of the leaf blockchain to the intermediate layer blockchain, and downloading the block header of the intermediate layer blockchain and the block header of the root blockchain from the intermediate layer blockchain; The intermediate layer blockchain is used for collecting and processing block header information of all subordinate leaf blockchains, and periodically synchronizing the block header of the intermediate layer blockchain to the root blockchain, and downloading the block header of the root blockchain from the root blockchain; The root blockchain is used for collecting and processing block header information from the intermediate layer blockchain, and recursively broadcasting the block header of the root blockchain to the intermediate layer blockchain and the leaf blockchain; The data download interface is used for receiving data download requests initiated by environmental protection monitoring departments, and returning electricity carbon emission data of corresponding target users after the certificate of the environmental protection monitoring department is verified; Wherein, the download process of electricity carbon emission data comprises: According to the data download request, all transactions meeting the conditions in the current blockchain are queried, if the transactions meeting the conditions are found in the current blockchain, all node hash values on the path from the block where the transaction is located to the merkle root are obtained, and the hash values along the path are calculated to obtain the path hash value; Compare the path hash value with the merkle root of the block header of the current blockchain, if they are consistent, determine the block where the electricity carbon emission data of the target user is located and the integrity, and return the electricity carbon emission data of the target user to the environmental protection monitoring department; If they are not consistent, traverse the transactions in other block headers downloaded by the current blockchain, locate the blockchain where the transaction is located, determine the block where the electricity carbon emission data of the target user is located and the integrity, and return the electricity carbon emission data of the target user to the environmental protection monitoring department.
2. The electrical carbon emissions data storage system of claim 1, wherein, The hierarchical blockchain platform further comprises a message queue arranged at the data upload interface and the data download interface, and the message queue is used for buffering interface requests.
3. The electrical carbon emissions data storage system of claim 1, wherein, The power supply bureau specifically comprises: A login unit for logging into the electricity carbon emission data storage system as a system administrator; A registration unit for calling the identity registration interface to initiate a registration request to the electricity carbon emission data storage system, registering an account according to the identity information of the registered user, and the registered user being an environmental protection monitoring department or a carbon emission user; A certificate generation and sending unit for generating a blockchain platform access certificate according to the account of the registered user and issuing it to the registered user.
4. The electrical carbon emissions data storage system of claim 3, wherein, The certificate generation and sending unit is specifically used for: receive a certificate signature request generated by the registered user based on the account and the public key, and verify the account of the registered user; generate certificate information in combination with the validity period of the certificate, the serial number, the account and the public key of the registered user, and perform a hash operation on the certificate information to generate a digest; sign the digest to obtain signature content; combine the certificate information and the signature content to generate a certificate for accessing the blockchain, and send the certificate to the registered user.
5. The electrical carbon emissions data storage system of claim 1, wherein, The data on-chain interface is specifically used for receiving a data on-chain request initiated by a carbon emission user, and the data on-chain request includes electricity carbon emission data, a timestamp and an account; The leaf blockchain is specifically used for accessing the hierarchical blockchain platform by the carbon emission user after the certificate of the carbon emission user is verified; The hash value of the electricity carbon emission data uploaded by the carbon emission user is calculated, and a transaction is created according to the hash value, the timestamp and the account, the transaction is signed by the private key of the carbon emission user, and the transaction and the corresponding signature are broadcast to the blockchain network, and the signature is verified by other nodes in the blockchain network, and the transaction is packaged into a new block; The hash values of the new block and the previous block are calculated to generate a block header, and the block header is uploaded to the intermediate layer blockchain, and the block headers of the intermediate layer blockchain and the root blockchain are downloaded from the intermediate layer blockchain.
6. A method for storing electrical carbon emission data, characterized by, The method is applied to the electricity carbon emission data storage system of any one of claims 1-5, and the method comprises: The power supply bureau registers the environmental protection monitoring department and the carbon emission user through an identity registration interface, and issues a certificate for accessing the blockchain; The carbon emission user initiates a data on-chain request through a data on-chain interface; The leaf blockchain stores the electricity carbon emission data after the certificate of the carbon emission user is verified, and synchronizes the block header of the leaf blockchain to the intermediate layer blockchain at regular intervals, and downloads the block headers of the intermediate layer blockchain and the root blockchain from the intermediate layer blockchain; The intermediate layer blockchain collects and processes the block header information of all subordinate leaf blockchains, and synchronizes the block header of the intermediate layer blockchain to the root blockchain at regular intervals, and downloads the block header of the root blockchain from the root blockchain; The root blockchain collects and processes the block header information from the intermediate layer blockchain, and recursively broadcasts the block header of the root blockchain to the intermediate layer blockchain and the leaf blockchain; The environmental protection monitoring department initiates a data download request through a data download interface to download the electricity carbon emission data of a target user; The download process of the electricity carbon emission data comprises: According to the data download request, all transactions meeting the conditions in the current blockchain are queried, if the transactions meeting the conditions are found in the current blockchain, all node hash values on the path from the block where the transaction is located to the Merkle root are obtained, and the hash values along the path are calculated to obtain a path hash value; Compare the path hash value with the Merkle root of the block header of the current blockchain. If they are consistent, the electricity carbon emission data of the target user is returned to the environmental protection monitoring department after determining the block where the electricity carbon emission data of the target user is located and the integrity. If they are not consistent, the transactions in other block headers downloaded by the current blockchain are traversed and queried, the blockchain where the queried transaction is located is located, the block where the electricity carbon emission data of the target user is located and the integrity are determined, and then the electricity carbon emission data of the target user is returned to the environmental protection monitoring department.
7. The method of claim 6, wherein, The power supply bureau registers the environmental protection monitoring department and the carbon emission user through an identity registration interface, issues a certificate for accessing the blockchain, including: The power supply bureau logs in to the electricity carbon emission data storage system as a system administrator; An identity registration interface is called to initiate a registration request to the electricity carbon emission data storage system, register an account according to the identity information of the registered user, and the registered user is an environmental protection monitoring department or a carbon emission user; The access blockchain platform certificate is generated according to the account of the registered user and issued to the registered user.
8. An electronic device, comprising: The device includes a processor and a memory; The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the electricity carbon emission data storage method according to the instructions in the program code.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium is used to store program code, and the program code is executed by the processor to realize the electricity carbon emission data storage method. The computer readable storage medium is used to store program code, and the program code is executed by the processor to realize the electricity carbon emission data storage method.
Citation Information
Patent Citations
Intelligent medical data storage method based on multi-level blockchain system architecture
CN110727737A
Carbon emission data processing method and device
CN115250176A