A blockchain-based electric energy metering data archiving and trusted transaction method and system
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- NANJING DIANRUN TECH
- Filing Date
- 2026-07-07
- Publication Date
- 2026-08-07
AI Technical Summary
现有系统仅能记录简单采集日志,无法对数据从采集、预处理、上链、交易到结算的全流程进行完整追溯,出现计量争议、交易纠纷时难以快速定位问题节点与操作记录
[0010]The beneficial technical effects of this application are as follows: By deploying distributed nodes, configuring the PBFT consensus mechanism and smart contracts, node networking, identity authentication and hierarchical permission management are completed; the original metering data of electricity meters is cleaned, format verified and integrity checked, a hash algorithm is used to generate data digests, and a corresponding mapping relationship between meter codes and blockchain addresses is established; smart contracts are used to realize three on-chain methods: timed collection, anomaly monitoring and manual verification, and consensus verification, block packaging and distributed storage are automatically completed; the transaction entity verification, electricity calculation, price matching and settlement operations are automatically completed through contracts; an asymmetric encryption, permission control and full-process traceability mechanism is established to support multi-dimensional data query and anomaly monitoring; finally, data visualization is realized according to the three-level structure of power supply area, power supply substation and electricity meter, and block information, hash value, transaction record and traceability results are output, realizing trusted storage of metering data and automated operation of power trading.
Smart Images

Figure CN122529883A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data processing technology, and in particular to a blockchain-based method and system for storing and trusting electricity meter metering data. Background Technology
[0002] With the continuous advancement of smart grid construction, electricity meter data has become the core basis for electricity settlement, electricity consumption management, and electricity market transactions. Traditional electricity meter data collection and management models mainly rely on centralized platforms for data storage, transmission, and verification, which presents the following technical problems in practical applications: The security and reliability of metering data are insufficient. In traditional models, data is centrally stored on a single server or master system, making it susceptible to human tampering, misoperation, and unauthorized access. This makes it difficult to meet the legal requirements for the immutability and traceability of metering data, and lacks reliable supporting evidence in power trading and dispute verification scenarios. Data upload and business execution rely on manual intervention. Existing data acquisition systems are mostly passive uploads and scheduled data entry, lacking multi-dimensional automatic triggering mechanisms for scheduled, abnormal, and manual interventions. Abnormal data cannot be promptly documented, and transaction execution relies on offline processes, resulting in low automation, low efficiency, and difficulty in adapting to the real-time requirements of market-based power trading.
[0003] Lack of node collaboration and consensus mechanisms. Traditional systems employ a centralized architecture, lacking a unified and reliable collaborative verification mechanism among various data collection nodes, distribution terminals, trading systems, and regulatory platforms. Data consistency relies on manual verification, easily leading to issues such as data inconsistencies and unclear accountability. Inadequate access control and security protection. Traditional systems often use single-account access management, failing to implement refined permission divisions based on roles such as power grid operation, metering data collection, trading entities, and regulators. Highly sensitive metering and trading data lacks end-to-end encryption protection, posing risks of data leakage and unauthorized access.
[0004] The system suffers from weak full lifecycle traceability capabilities. Existing systems can only record simple data collection logs, failing to provide complete traceability of the entire data process from collection, preprocessing, on-chain processing, transaction to settlement. This makes it difficult to quickly locate problem nodes and operation records when metering disputes or transaction conflicts arise. Furthermore, the system lacks sufficient visualization and hierarchical management capabilities. Traditional platforms primarily display data in list and report formats, without hierarchical display by power supply area, transformer substation, and meter. Maintenance and regulatory personnel cannot quickly grasp the evidence storage status, transaction progress, and anomaly distribution across the entire region, transformer substation, and individual meters, resulting in low management and troubleshooting efficiency.
[0005] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention
[0006] According to one aspect of this application, a method for storing and trusting electricity meter metering data based on blockchain is provided, comprising: building an architecture for storing and trusting electricity meter metering data based on blockchain underlying technology, completing distributed node network deployment, consensus mechanism configuration, and smart contract module development, and simultaneously implementing node identity authentication and multi-role permission hierarchical settings; standardizing, cleaning, format verifying, and verifying the integrity of the raw metering data collected by the electricity meter, and generating a unique data digest through a hash algorithm by combining the meter's physical address and the geographical association information of the transformer substation, and establishing a binding mapping between the meter code and the blockchain account address; writing metering data storage rules based on smart contracts, setting three types of on-chain trigger conditions: timed collection, abnormal data, and manual verification, completing consensus verification, block packaging, and distributed storage when data is uploaded to the chain, and simultaneously recording the on-chain time; The system includes on-chain logs of operation nodes and evidence storage status; it defines the core logic of trusted transactions through smart contracts, clarifying the standards for verifying the qualifications of transaction entities, the method for calculating transaction electricity volume, price matching rules, and settlement processes, thereby achieving contractual execution of transaction order creation, signature verification, and on-chain data storage; it constructs an on-chain data security and traceability system, employing asymmetric encryption algorithms to ensure the security of data transmission and transaction interaction, setting access control, and supporting the retrieval of the entire lifecycle of data records through meter codes, order numbers, and block heights, completing the monitoring and early warning of tampering and illegal transaction behaviors; it integrates blockchain evidence storage data, metering data, and transaction data, building a hierarchical data visualization module, classifying and displaying evidence storage status, transaction progress, and data statistical results according to power supply area, transformer area, and meter dimensions, and outputting structured results including block data, data hash values, transaction details, and traceability records.
[0007] Another aspect of this application discloses a blockchain-based system for storing and trusting electricity meter metering data, comprising: a blockchain underlying support unit, used to build an electricity meter metering data storage and trusting transaction system based on a consortium blockchain distributed architecture, completing peer node networking, consensus mechanism configuration, and smart contract development, and realizing node identity authentication and hierarchical configuration of multi-role operation permissions; a metering data preprocessing unit, used to perform standardized cleaning, format verification, and integrity checks on the original metering data of the electricity meter, associate the meter's physical address with the geographical information of the transformer area, generate a unique data digest through a hash algorithm, and establish a one-to-one mapping between the meter code and the blockchain account address; and a metering data storage unit, used to write on-chain execution logic based on smart contracts, configure three types of triggering conditions: timed collection, abnormal data, and manual verification, complete node consensus verification, block encapsulation, and distributed storage, and synchronously record... The system includes: a blockchain log recording time, operation node, and notarization status; a trusted electricity trading unit, which defines transaction execution rules through smart contracts to complete the verification of transaction entity qualifications, electricity calculation, price matching, and automatic settlement, realizing the contractual operation of transaction order creation, digital signature verification, and on-chain notarization of transaction data; an on-chain security traceability unit, which uses asymmetric encryption algorithms to ensure the security of data transmission and transaction interaction, configures multi-dimensional access control strategies, supports the retrieval of full lifecycle data by meter code, order number, and block height, and realizes data tampering and illegal transaction monitoring and early warning; and a data visualization output unit, which integrates blockchain notarization data, metering data, and transaction data to build a three-level visualization module of region-transformer area-meter, classifying and displaying notarization status, transaction progress, and statistical results, and outputting structured results such as block data, hash values, transaction details, and traceability records.
[0008] According to another aspect of this application, an electronic device includes: a first processor; and a memory for storing executable instructions of the first processor; wherein the first processor is configured to execute the above-described blockchain-based method for storing and trusting electricity meter metering data via executing the executable instructions.
[0009] According to another aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a second processor, implements the above-described blockchain-based method for storing and trusting electricity meter metering data.
[0010] The beneficial technical effects of this application are as follows: By deploying distributed nodes, configuring the PBFT consensus mechanism and smart contracts, node networking, identity authentication and hierarchical permission management are completed; the original metering data of electricity meters is cleaned, format verified and integrity checked, a hash algorithm is used to generate data digests, and a corresponding mapping relationship between meter codes and blockchain addresses is established; smart contracts are used to realize three on-chain methods: timed collection, anomaly monitoring and manual verification, and consensus verification, block packaging and distributed storage are automatically completed; the transaction entity verification, electricity calculation, price matching and settlement operations are automatically completed through contracts; an asymmetric encryption, permission control and full-process traceability mechanism is established to support multi-dimensional data query and anomaly monitoring; finally, data visualization is realized according to the three-level structure of power supply area, power supply substation and electricity meter, and block information, hash value, transaction record and traceability results are output, realizing trusted storage of metering data and automated operation of power trading.
[0011] This application employs blockchain distributed storage and the PBFT consensus mechanism to ensure the immutability of metering data and consistent recognition across multiple nodes, thereby enhancing the credibility of electricity settlement and trading. Smart contracts enable automatic on-chain recording in multiple scenarios and automated execution of the entire transaction process, reducing manual operations and improving the efficiency of metering data collection and transaction processing. Asymmetric encryption and multi-role access control protect the security of core metering and trading data, preventing unauthorized access and operations, achieving full lifecycle data traceability, supporting multi-condition queries and anomaly alerts, and facilitating metering dispute resolution, audit verification, and liability determination. A three-tiered visual display by region, transformer area, and meter allows maintenance and regulatory personnel to quickly grasp the operational status, improving management and troubleshooting efficiency.
[0012] Simultaneously, 100,000 electricity meters were uploaded to the blockchain, and the system operated stably with a block packaging latency of ≤1.2s. A single consensus cluster could handle a peak of 2200 metering data entries per minute. In scenarios with 100,000 electricity meters, the system could be horizontally scaled up by adding transaction consensus nodes, linearly increasing throughput. It operated continuously for 30 days, 24 / 7, with an average daily block storage expansion of 1.2GB and stable memory usage of ≤12GB, without any memory leaks or consensus freezes.
[0013] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and are not intended to limit this disclosure. Attached Figure Description
[0014] Figure 1 The flowchart illustrates a blockchain-based method for storing and trusting electricity meter metering data, as provided in an embodiment of this application. Figure 2 This illustration shows a schematic diagram of a blockchain-based electricity meter metering data storage and trusted transaction system provided in one embodiment of this application. Detailed Implementation
[0015] The preferred embodiments of the present invention will be described below with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are for illustration and explanation only and are not intended to limit the present invention.
[0016] In one implementation, Figure 1 The diagram illustrates a flowchart of a blockchain-based method for storing and trusting electricity meter metering data according to an embodiment of this application.
[0017] S101 is based on blockchain technology to build an architecture for storing and trusting electricity meter metering data. It completes the deployment of distributed node networks, the configuration of consensus mechanisms, and the development of smart contract modules, while simultaneously realizing node identity authentication and multi-role permission hierarchical settings.
[0018] In one implementation, combining the actual business scenarios of electricity metering data storage and trusted electricity trading, and leveraging the technical characteristics of blockchain—distributed ledger, data immutability, and multi-node consensus verification—a consortium blockchain architecture is adopted for the underlying system construction. This architecture is adapted to the power industry's operational requirements of closed trust, controllable permissions, and traceable supervision. Regarding network access rules, a node whitelist mechanism is established, allowing only four types of entities—authorized and certified power grid operators, on-site metering and data acquisition devices, electricity trading service platforms, and industry regulatory agencies—to access the blockchain network. Unauthorized devices and institutions cannot join the network or participate in data consensus and contract execution. Simultaneously, a programmable and dynamically expandable smart contract mechanism is enabled, modularly encapsulating business logic such as metering data collection and verification, on-chain trigger judgment, consensus verification execution, block packaging and storage, and transaction process execution. This provides standardized calling interfaces and logical expansion space for subsequent processes such as scheduled on-chain data collection, abnormal data on-chain processing, manual verification on-chain processing, transaction order creation, electricity settlement, and signature verification. Through the aforementioned network constraints and architectural configuration, a blockchain infrastructure framework is formed specifically for power metering data management, electricity meter data storage, and trusted power transactions. This framework stably supports the entire business process, including metering data processing, on-chain storage, transaction execution, security control, and visualization. It exhibits good integration and compatibility with power metering terminals, data acquisition equipment, and information management platforms, meeting the implementation and application requirements in the fields of power metering and power information technology. Smart contracts employ a version number management mechanism; contract upgrades require approval from more than two-thirds of the consensus nodes, and upgrades are compatible with historical block transaction data. When a high-risk vulnerability is detected in the contract, the regulatory node can initiate an emergency freeze command, suspending all transactions and on-chain logic; the freeze record is permanently stored on the blockchain.
[0019] The cross-version data migration rules for contracts are as follows: After the new version contract is deployed, the historical block log structure is automatically read, and missing fields are automatically filled with the default NULL; newly added business fields (photovoltaic subsidies, peak-valley electricity prices) only apply to new transactions after the upgrade, and historical orders retain their original fields without being tampered with; version rollback mechanism: if a logic vulnerability is found in the new version contract, the regulator can initiate a vote to roll back to the previous stable version. The new block is not deleted on the chain, only the contract execution entry point is switched, and all new and old block data can be retrieved in parallel.
[0020] The distributed node communication information, consensus verification strategy, and business role permission elements are taken as input and fed into the already deployed and configured blockchain architecture module for parameter initialization. Pre-defined distributed node communication rules, consensus verification strategies, and business role permission definitions are also fed into the deployed blockchain architecture as input parameters to complete the system initialization configuration. Specifically, distributed node communication information includes data transmission format, communication port, and heartbeat detection cycle between nodes; consensus verification strategy includes the scope of consensus participating nodes, consensus voting conditions, and data verification timeout threshold; and business role permission elements include role type, operation scope, and data access level. All of these parameters are uniformly loaded into the blockchain configuration module, providing the basic conditions for stable network operation.
[0021] Leveraging the node management and contract execution capabilities of the blockchain architecture, this process completes distributed node networking, consensus mechanism loading, and smart contract module deployment, thus building the basic blockchain operating environment. Pre-defined distributed node communication rules, consensus verification strategies, and business role permission definitions are input parameters into the deployed blockchain architecture to complete system initialization configuration. This step is based on actual business scenarios such as power metering data collection, electricity consumption information management, and automated power distribution control, adapting to the access requirements of devices and systems such as smart meters, electricity collection terminals, distribution concentrators, and energy management platforms, ensuring stable blockchain network operation, reliable data interaction, and compliant permission control. Specifically, distributed node communication information, consensus verification strategies, and business role permission elements are configured according to power industry communication standards and business management requirements. All parameters are uniformly loaded into the blockchain configuration module to complete the initialization of the basic network operating environment, providing support for subsequent metering data on-chaining, power transaction execution, and data security traceability.
[0022] Distributed node communication information is used to standardize the data interaction methods between blockchain nodes, ensuring stable and consistent communication between metering acquisition terminals, distribution equipment, the main station platform, transaction service units, and regulatory terminals. The data transmission format adopts the DL / T645 and DL / T698 power industry common communication protocols, consistent with the metering data format output by smart meters and electricity consumption acquisition terminals, eliminating the need for additional format conversion to complete data interaction. Dedicated communication ports are allocated to different functional nodes; metering acquisition terminals, distribution concentrators, the power grid main station, transaction service nodes, and regulatory nodes each use independent ports to avoid port conflicts and support power grid isolation and firewall policy configuration. Heartbeat intervals are set according to the operating characteristics of field equipment: longer heartbeat cycles for field acquisition terminals and distribution concentrators, and shorter heartbeat cycles for the main station nodes and transaction service nodes, to monitor node online status in real time. Automatic reconnection and status recording are triggered when a node goes offline. For example, the distribution concentrator periodically uploads electricity metering data to the blockchain nodes according to a preset format and port; if the heartbeat times out without response, the node is automatically marked as abnormal and a record is retained.
[0023] The consensus verification strategy ensures that multiple nodes reach a consensus on the on-chain storage of metering data and the execution results of power transactions, preventing data tampering and fraudulent transactions. Only the grid master station node, core distribution area node, transaction service node, and regulatory node are allowed to participate in consensus voting. On-site data collection terminals are only responsible for data submission and do not participate in consensus calculations, balancing operational efficiency and security. A rule requiring a two-thirds majority vote from authorized nodes is adopted; data can only be stored on the blockchain after meeting this condition, ensuring data authenticity and consistency. A shorter verification timeout is set for regular metering data on the blockchain, while a longer timeout is set for abnormal data and power transaction data. If verification is not completed within the timeout period, the data automatically enters the pending verification process. For example, when a single metering data item is uploaded to the blockchain, the master station node, distribution area node, and regulatory node jointly participate in verification. After meeting the voting conditions, block encapsulation and data storage are completed.
[0024] The business role permission elements are divided according to the multi-role management needs of power operation, metering and data collection, power trading, and regulatory auditing, achieving hierarchical access, clear division of rights and responsibilities, and compatibility with the permission system of the power consumption management system and energy management platform. Role types are divided into power grid operation and maintenance management roles, metering and data collection roles, power trading roles, and regulatory auditing roles, covering all participants in power metering and trading. Power grid operation and maintenance roles can manage nodes, configure contracts, and audit data; metering and data collection roles can only upload data from their own distribution area and terminal, and cannot modify or delete data; power trading roles can initiate orders, verify signatures, and query their own transaction information; regulatory auditing roles can view all data and perform traceability verification, but do not participate in business operations.
[0025] Data access is bound to roles. Regulatory and operational roles are at a higher level and can access data across the entire domain; data collection and transaction roles are at a lower level and can only access data within their own permissions. For example, metering and data collection roles can only upload electricity meter data from their assigned area and cannot view transaction information from other areas; regulatory roles can retrieve the entire lifecycle record by meter number but do not have data modification permissions.
[0026] The three types of parameters—distributed node communication, consensus verification, and business role permissions—are uniformly written into the blockchain configuration module to complete system initialization. After configuration, the blockchain network possesses basic capabilities for node access verification, data format verification, consensus voting execution, and access control. It can stably connect to devices such as smart meters, electricity consumption acquisition terminals, and power distribution management platforms, meeting the engineering implementation requirements for metering data storage and trusted electricity transactions, and ensuring that the system can start up normally, run stably, and be repeatedly implemented. Node access adopts a dedicated CA certificate system for the power industry. Level 1 root certificates are issued to the power grid master station, transaction, and regulatory nodes, while level 2 equipment certificates are issued to the distribution area concentrators and acquisition terminals. The certificates include the node number, the region to which they belong, and the validity period of the role and permissions. The node heartbeat cycle is configured in stages: 300 seconds for distribution area acquisition terminals and 30 seconds for master station / transaction nodes. A heartbeat timeout of 120 seconds will automatically trigger reconnection and local caching of metering data. The consortium blockchain only allows a maximum of 1 / 3 of the consensus nodes to be malicious nodes. The consensus voting timeout threshold is set to 10 seconds. The packaging cycle for regular metering data blocks is 5 minutes, and the packaging cycle for transaction blocks is 1 minute. Edge acquisition terminals are only responsible for data uploading and do not participate in PBFT consensus voting. Only the power grid master station, 2 core transaction nodes, and 2 regulatory nodes constitute the consensus cluster.
[0027] This embodiment uses the FISCOBCOS power adaptation branch as the underlying consortium blockchain to meet the requirements of power grid isolation and access control. The PBFT consensus complete four-stage message structure is standardized and defined as follows: Pre-prepare message: Issued by the master consensus node, fields include block height, the hash array of the metering to be packaged, and the signature of the proposing node. Prepare message: Receipt from each consensus node, fields include block height, proposal hash, and node private key signature. Commit message: Sent after node verification, carrying its own CA certificate number and voting results. Reply message: Broadcast by the master node after summarizing more than 2 / 3 of the Commit messages, notifying the block to be written to disk.
[0028] All messages are transmitted using Protobuf serialization, with a maximum limit of 2MB for a single message. Messages exceeding this limit are automatically split into batches. If a chain fork is detected during the consensus process, the contract automatically executes the longest chain priority rule, and the data of the short fork block is rolled back to the off-chain cache. At the same time, abnormal nodes are marked and fork logs are stored on the chain, allowing regulatory nodes to trace the time of the fork and the participating nodes.
[0029] The block header contains the block height, parent block hash, Merkle root, consensus voting signature set, and timestamp; the block body stores multiple metering data entries, each containing meter code, metering hash, substation number, evidence type, and operation node identifier; all metering data entries are arranged in ascending order of meter code to construct a Merkle tree, and the Merkle root is written into the block header for fast integrity verification.
[0030] Based on the multi-role management requirements of the power industry, node identity credentials are configured in a targeted manner from the blockchain identity system to complete the hierarchical binding of multi-role permissions and the loading of access control policies, generating blockchain identity and permission configuration information. Relying on the node management, contract scheduling, and ledger storage capabilities provided by the blockchain architecture, three core deployment tasks are completed sequentially. The overall deployment process aligns with business scenarios such as smart meters, electricity consumption information collection, power distribution automation, and energy management system integration, adapting to the actual operational needs of power field terminal access, master station management, transaction settlement, and regulatory auditing, ensuring a stable, reliable, and feasible blockchain environment.
[0031] First, a distributed node network is established, connecting grid-side service nodes, field metering and data acquisition nodes, transaction processing nodes, and data monitoring nodes to enable mutual discovery and data exchange between nodes. The networking process employs a consortium blockchain access mechanism, allowing only certified grid operation master stations, distribution area acquisition terminals, concentrators, transaction service platforms, and monitoring platforms to access the network; unauthorized devices cannot join. Specifically, grid-side service nodes are responsible for overall scheduling and status management; field metering and data acquisition nodes correspond to smart meters, acquisition terminals, and distribution area concentrators; transaction processing nodes connect to power trading and electricity settlement services; and data monitoring nodes are used for industry supervision and data auditing. Each node establishes a peer-to-peer connection through a dedicated power network or encrypted communication link, supporting automatic node discovery and automatic link maintenance to ensure stable and reliable data transmission for metering data uploads, transaction command issuance, and regulatory information queries. For example, multiple smart meters and concentrators within a distribution area form a field acquisition node, connecting to the grid master station node and transaction processing node through a dedicated network, enabling real-time uploading of metering data and receiving on-chain commands.
[0032] The automatic handling rules for malicious nodes are as follows: if a node maliciously rejects consensus votes three times in a row, uploads tampered hash data, or forges a CA certificate to access the network, the contract will mark the node as malicious; the malicious node will be automatically added to the consortium blockchain blacklist, permanently blocking node networking and consensus voting; all historical operation logs and forged data hashes of malicious nodes will be archived separately and stored in the audit block, allowing regulators to permanently trace the evidence of wrongdoing, and the blacklist will be synchronized to all consensus nodes and take effect in real time.
[0033] Second, a pre-set consensus mechanism is loaded and enabled, enabling all nodes to reach a consensus on data uploading and transaction execution. This application employs a practical Byzantine fault-tolerant algorithm, with only power grid service nodes, core transaction nodes, and regulatory nodes participating in consensus voting. On-site data collection nodes only submit data and do not participate in consensus calculations, improving operational efficiency and security. After the consensus mechanism is activated, all metering data and transaction orders to be uploaded to the blockchain must be jointly verified by authorized nodes to ensure that the data has not been tampered with, has a legitimate source, and complies with permissions. Only after all nodes reach a consensus can the data be written to the blockchain. For example, when a piece of electricity meter metering data is initiated for uploading to the blockchain, the main station node, transaction node, and regulatory node simultaneously verify the authenticity of the data. After all nodes agree, consensus is completed, ensuring the credibility of metering evidence storage and transaction execution results.
[0034] Third, deploy basic contract modules such as metering data storage contracts and power transaction execution contracts to enable the blockchain to automatically execute business logic. Among them, the metering data storage contract is used to realize functions such as data cleaning and verification, scheduled on-chaining, anomaly triggering, manual verification, and log recording, which is matched with the electricity information collection process; the power transaction execution contract is used to realize functions such as entity qualification verification, electricity calculation, price matching, automatic settlement, and signature verification, which is adapted to the needs of electricity market transactions.
[0035] The standardized cleaning and quantification thresholds are as follows: Voltage is within the reasonable range of 0-400V; values outside this range are directly marked as abnormal and filtered. Data with the same collection timestamp uploaded repeatedly by the same meter within 5 minutes is directly discarded. A single-hour electricity consumption increase / decrease exceeding 50% compared to the average of the same period over the past 7 days is considered an abnormal electricity consumption change. Missing fields are uniformly filled with fixed placeholders (NULL), and the entire data is not discarded. The SHA-256 hash is concatenated in the following fixed order: Meter Code | Collection Timestamp (accurate to the second) | Forward Active Energy | Reverse Active Energy | Substation Number | Physical Address. Fields are concatenated using a fixed separator (#), and missing fields are uniformly filled with NULL to ensure a unique hash value for the same original data. The mapping relationship between meter codes and chain account addresses is stored in the on-chain configuration contract. When a new electricity meter is added, the substation node initiates an address binding transaction. When a meter is closed, the contract unbinding logic is executed. After unbinding, historical evidence data is retained and cannot be deleted. Multiple chain addresses are not allowed for the same meter within a single block; conflicts trigger manual review by regulatory nodes.
[0036] Once deployed, the contracts can run automatically without manual intervention, and support upgrades and iterations based on business rules, seamlessly integrating with power distribution automation systems and energy management platforms. For example, the metering data storage contract can collect electricity meter data hourly and automatically upload it to the blockchain, immediately triggering storage when anomalies such as voltage exceeding limits or sudden increases in electricity consumption occur; the power trading execution contract can automatically calculate tradable electricity based on on-chain metering data, completing the matching and settlement between buyers and sellers.
[0037] Through the three operations of node networking, consensus mechanism loading, and smart contract deployment, a blockchain basic operating environment adapted to electricity metering business is constructed, which can stably support the entire process of business such as reliable storage of electricity metering data, reliable electricity trading, data security traceability, and hierarchical visualization.
[0038] S102 standardizes, cleans, verifies the format and integrity of the raw metering data collected by the electricity meter, and generates a unique data digest through a hash algorithm by combining the meter's physical address and the geographical association information of the transformer substation to which it belongs, and establishes a binding mapping between the meter code and the blockchain account address.
[0039] In one implementation, the raw metering data collected and reported by electricity meters via the DL / T645 and DL / T698 power communication protocols is cleaned. Empty fields, duplicate records, and invalid values exceeding reasonable ranges are removed. The units and decimal places of data such as electricity consumption, voltage, and current are standardized. Missing electricity values, duplicate uploads of data from the same time point, and abnormal records with voltage values exceeding the reasonable range of 0-400V are directly filtered out. Active power reported by electricity meters from different manufacturers is standardized to kilowatt-hours (kWh), and two decimal places are uniformly retained, forming consistent and valid metering data.
[0040] In accordance with the electricity metering data specifications, the cleaned data undergoes a format compliance check. This involves verifying that fields such as data frame structure, meter address, and data acquisition timestamp conform to protocol requirements, and confirming data completeness. The check also verifies that the meter number is 10 digits long, the data acquisition timestamp conforms to the YYYY-MM-DDHH:MM:SS format, and that all core metering fields, including forward active power, reverse active power, voltage, and current, are present. Data with incorrect formats or missing fields is marked as requiring correction.
[0041] The cleaned and verified metering data is associated and bound with the physical installation address, power supply substation number, and power supply area number of the corresponding electricity meter, forming a complete data entry containing business data and geographical information. For example, the electricity meter with the meter code "0100234567" is bound to its installation address "Building 3, XX Community, XX Road, XX District, XX City", its substation number "TQ20250815001", and its power supply area "XX Power Supply Station", giving each metering data a locatable geographical attribute.
[0042] The SHA-256 hash algorithm is used to perform hash calculations on complete metering data entries bound to geographic information. This converts metering data of variable length into a fixed-length, unique, and irreversible hash value, serving as the data's unique identifier. Complete data containing meter code, collection time, active power, transformer area number, and physical address is input into the SHA-256 algorithm for processing, generating a 64-bit hexadecimal hash string. This string uniquely corresponds to the original metering data; any data modification will result in a change to the hash value.
[0043] Using the unique code of the electricity meter as an index, a corresponding on-chain account address is assigned to each electricity meter in the blockchain account system. The meter code and the on-chain address are bound and recorded one-to-one, so that subsequent metering data can be accurately uploaded to the corresponding account on the blockchain. A fixed mapping relationship is established between the meter code "0100234567" and the blockchain address "0x1a2b3c4d5e6f7g8h9i0j" and stored in the configuration library. When the metering data of the meter generates a hash digest, the corresponding on-chain address can be located directly through the mapping relationship, thus completing the data uploading and location on the blockchain.
[0044] S103 is based on smart contracts to write rules for storing measurement data. It sets three types of on-chain trigger conditions: timed collection, abnormal data, and manual verification. It completes consensus verification, block packaging, and distributed storage when data is uploaded to the chain, and synchronously records on-chain logs of on-chain time, operation nodes, and storage status.
[0045] In one implementation, combining the business requirements for reliable and tamper-proof storage of electricity meter data with the operational characteristics of smart contracts—automatic execution and condition-triggered operation—a contract-based coding method is adopted. The entire process of on-chain data storage, verification, storage, and logging is written into automatically executable smart contract logic, and the on-chain trigger conditions are configured within the contract. This contract logic is deeply adapted to the business processes of electricity metering acquisition and distribution data management, and can directly connect to electricity meters, acquisition terminals, concentrators, and back-end management platforms, operating stably without manual intervention.
[0046] The operations of electricity meter data collection, validity judgment, node consensus verification, block packaging, ledger writing, and log generation are written into smart contract code according to the electricity metering business specifications. After the contract is started, it monitors the data status and instruction information uploaded by the collection terminal in real time. When the preset conditions are met, the corresponding execution process is automatically triggered, and the data verification, consensus verification, block packaging, distributed storage, and log recording are completed in sequence, with the entire process being automated and closed-loop. Among them, the data validity judgment is performed in accordance with the electricity metering standards, checking the data integrity, format compliance, and numerical rationality, and removing invalid records such as null values, duplicates, and exceeding limits; the node consensus verification is performed by authorized nodes to verify the authenticity and legality of the data according to preset rules; the block packaging encapsulates multiple qualified data and corresponding hash digests into a standard block; the ledger writing synchronizes the block to each distributed node; and the log generation automatically records the on-chain time, operation node, and evidence storage results, and stores them on the chain.
[0047] When the data acquisition terminal uploads electricity meter readings at fixed intervals, the contract first verifies the validity of the data format, electricity value, and meter address. Upon successful verification, it automatically initiates node consensus verification. After successful verification, the contract encapsulates this data along with other valid data from the same period into a block, writes it to the distributed ledger, and simultaneously generates log information containing timestamps, node identifiers, and storage status, completing the entire automatic storage process without manual operation or intervention. The scheduled on-chain period supports dynamic configuration of 15min / 1h / 24h and allows for setting a pause for high-frequency data acquisition on holidays. Complete metering anomaly types include voltage loss, phase loss, current imbalance, sudden increases or decreases in electricity consumption, terminal communication offline, and clock anomalies. Manual verification supports batch import of meter numbers and batch on-chain uploads by time period, with a single batch limit of 200 meters. Batch tasks generate independent verification order numbers.
[0048] Based on three trigger dimensions—data collection timing, abnormal data status, and manual verification instructions—three on-chain trigger rules are defined for scheduled collection, abnormal data, and manual verification. Within the smart contract, these three independently effective on-chain trigger rules are configured and defined. Each rule is independent and can be executed in parallel, adapting to different business scenarios such as daily electricity metering collection, anomaly monitoring, and on-site verification, ensuring timely, accurate, and on-demand on-chain data storage.
[0049] The contract sets fixed cycles and time points based on the daily data collection frequency requirements for electricity metering. Upon reaching the set time, the system automatically reads the electricity meter data and initiates the on-chain process. The cycle can be flexibly configured according to the needs of distribution area management and settlement, supporting parallel operation of multiple cycles such as 15 minutes, hours, and days, achieving routine data storage without manual intervention. For example, for residential electricity metering, the contract is set to automatically collect the daily frozen electricity consumption at midnight and upload it to the blockchain; for industrial and commercial users, it is set to collect instantaneous electricity consumption and load data every hour and upload it to the blockchain, meeting the needs for periodic data storage and settlement traceability.
[0050] The contract incorporates built-in standards for judging abnormal electricity metering, and monitors received metering data online in real time. When data shows abnormalities such as voltage exceeding limits, abnormal current, sudden increases or decreases in electricity consumption, terminal communication interruption, or data loss, it immediately triggers on-chain recording, storing the abnormal data and abnormal type simultaneously, enabling traceability and verification of abnormal events. For example, if an electricity meter in a certain distribution area shows a voltage exceeding the reasonable range of 0-400V, or an hourly electricity consumption increase exceeding 50% compared to the historical average, the contract immediately identifies and triggers on-chain recording, storing the abnormal data, the time of occurrence, and the meter number, facilitating subsequent maintenance investigation and responsibility determination.
[0051] For scenarios such as on-site verification, metering spot checks, and dispute review, maintenance personnel can issue manual verification instructions to the blockchain system through the management platform. After recognizing a legitimate instruction, the contract will forcibly initiate the on-chain process for the corresponding meter and time period metering data, without being restricted by timed cycles or abnormal states, ensuring that key verification data can be stored in a timely manner. For example, when conducting meter cycle verification or user electricity dispute verification, maintenance personnel can issue verification instructions for a specified meter number and time period. The contract will immediately extract the corresponding data and complete the on-chain storage, ensuring that the verification process and results are credible and traceable.
[0052] By configuring and executing the above three types of triggering rules, it is possible to achieve automatic storage of metering data under normal circumstances, timely storage of abnormal data, and on-demand storage of verification data, which fully covers the business needs of all scenarios of power metering data management and trusted transactions, and ensures that the data is uploaded to the blockchain in a timely, complete and tamper-proof manner.
[0053] Based on the pre-defined notarization logic of the smart contract, the pre-processed metering data to be uploaded to the blockchain undergoes sequential node consensus verification, block data encapsulation, and distributed ledger writing operations. This process is executed according to the business specifications for power metering collection and distribution data management, driven entirely by smart contracts and completed collaboratively by nodes, ensuring that the uploaded data is authentic, consistent, and tamper-proof, and can be directly used for metering settlement and transaction traceability. The consensus verification employs the PBFT (Practical Byzantine Fault Tolerance) algorithm, with only authorized power grid master nodes, transaction service nodes, and regulatory nodes participating in voting; on-site data collection terminals do not participate in consensus calculations, balancing power system operational efficiency and data security. After the metering data and hash digest to be uploaded to the blockchain network, each consensus node simultaneously verifies three aspects: first, data legality, checking whether the metering value, collection time, and meter number comply with power metering standards; second, node identity, confirming that the data submitting node has completed authentication and has upload permissions; and third, operation permissions, determining whether the current operation is within the node's authorized scope. After verification, voting is conducted according to preset rules, and verification is successful if more than two-thirds of the votes are received.
[0054] A data concentrator in a certain distribution area uploads a set of electricity meter readings and corresponding hash values. The main station node, transaction node, and regulatory node sequentially verify the data format, identity, and permissions. If two or more of the three nodes agree, the data passes and proceeds to the subsequent block encapsulation process. After successful verification, the smart contract aggregates multiple qualified metering data entries and their hash digests from the same period, distribution area, or collection batch, and encapsulates them into independent blocks according to the standard blockchain structure. Each block contains key information such as the original data digest, hash value, collection time, meter number, and node identifier, ensuring that each piece of data is locatable and verifiable.
[0055] The pseudocode for constructing the Merkle tree of measurement data is as follows: Input an ordered list of measurement hashes H=[h1,h2...hn] (list numbers in ascending order); if the length of the hash list is odd, copy the last hash to make it even; loop through and concatenate the node hashes pairwise: new_h=SHA256(h_left+"#"+h_right); iterate until only one root hash remains, which is stored as the Merkle root of the block in the block header; each measurement data is stored separately in Merkle path for single-point fast integrity verification without traversing the entire block.
[0056] After a block is generated, the system synchronously broadcasts the block to all distributed nodes. Each node verifies the block locally and then writes it into the distributed ledger, achieving consistent storage across multiple nodes. No single node can tamper with the ledger data, effectively preventing malicious modification or deletion of metering data and ensuring the reliability of electricity metering data throughout the entire process from collection to storage.
[0057] The system synchronously collects and writes the on-chain timestamp, operation node identifier, and evidence storage status identifier to generate on-chain evidence storage log information, completing the entire process of on-chain evidence storage of electricity meter metering data. While completing data on-chain and ledger writing, the system simultaneously collects the on-chain timestamp, the node identifier initiating the operation, and the data evidence storage status identifier, writing this information as an evidence storage log to the blockchain to form a traceable and verifiable on-chain record. After successful on-chain data storage, the system automatically records the on-chain time as "2026-04-05 10:30:00", the operation node as "metering collection node-001", and the evidence storage status as "evidence stored - successful", and stores this log information on the blockchain, binding it to the corresponding metering data for easy subsequent auditing, querying, and traceability verification.
[0058] As a relay unit for traditional unencrypted electricity meters, the edge gateway parses DL / T645 and DL / T698 messages and converts them into standardized metering fields for the system. The gateway has a built-in hash calculation module that pre-generates data summaries locally before uploading to the blockchain. When the gateway is offline, it locally encrypts and caches metering data for a maximum of 7 days. After network recovery, it initiates batch requests to the blockchain in ascending order of collection time. The contract automatically verifies the timestamps of the cached data to avoid duplicate storage. A maximum of 50 metering data entries can be packaged into the same block per batch; exceeding this threshold results in splitting the data into multiple blocks for parallel consensus. An off-chain memory buffer queue is set up to delay block packaging during peak concurrency, alleviating the computing power pressure on consensus nodes.
[0059] S104 defines the core logic of trusted transactions through smart contracts, clarifies the standards for verifying the qualifications of trading entities, the method for calculating transaction volume, the price matching rules and settlement process, and realizes the contractual execution of transaction order creation, signature verification and data on-chain storage.
[0060] In one implementation, based on the business scenario of electricity meter data storage and trusted electricity trading, and leveraging the programmable, automatically executed, and tamper-proof characteristics of smart contracts, the entire electricity trading process rules are transformed into executable contract logic. The judgment and execution standards for four core rules are clearly defined within the contract. The access of electricity sellers and buyers, the calculation of available trading volume, the electricity price matching method, and the steps for transaction funds and electricity settlement are all written into the smart contract, forming an automatically running electricity trading execution logic that requires no manual intervention, ensuring that the trading process is open, transparent, and traceable.
[0061] The smart contract pre-defines the entry conditions for transaction participants, verifying the identities and qualifications of entities such as transaction initiators, transaction recipients, and power grid operators. Only entities that pass the verification are allowed to initiate or participate in transactions. The contract sets qualification verification standards, including whether the entity has completed blockchain identity authentication, whether it has power trading permissions, and whether it is in a normal service state. When a user initiates a transaction, the contract automatically reads and compares the identity information; entities that fail the qualification verification will be refused further transaction operations.
[0062] Based solely on the metering data stored on the blockchain, the smart contract sets the calculation method for tradable electricity volume, calculating the tradable volume based on parameters such as meter readings, historical electricity consumption, and available capacity. The contract employs a metering data difference calculation method, subtracting the electricity consumption from the previous settlement cycle from the current positive active power consumption recorded on the blockchain to obtain the available tradable volume. Simultaneously, line losses and minimum required electricity consumption are deducted to finally arrive at the valid tradable volume value, ensuring complete consistency between the calculation result and the on-chain metering data.
[0063] The contract logic is differentiated for three types of electricity users: Residential users: only monthly fixed settlement is supported, no time-of-use pricing, and the loss coefficient is fixed at 0.03. Industrial and commercial users: peak-valley time-of-use pricing is supported, with three price ranges: morning peak, flat period, and off-peak. Distributed photovoltaic (PV) systems: A surplus power grid connection is added, with an additional PV subsidy coefficient, and surplus power is automatically connected to the grid for guaranteed purchase.
[0064] The dynamic loss correction algorithm for power distribution areas is as follows: loss coefficient α = base_0.03 + load_factor × 0.01; load_factor = total load of the power distribution area in the current period / rated maximum load of the power distribution area. The on-chain loss parameters are automatically updated every 24 hours, replacing the static fixed coefficient and conforming to the real-time changes in the load of the power distribution area. The metering anomaly is handled in the following tiers: a sudden increase in power consumption of 50% is a general yellow alarm; no power consumption for 12 hours or reverse power consumption exceeding the threshold is considered a red alarm for electricity theft, and the contract will automatically push the information to the regulatory node and freeze the transaction permissions of the table for 7 days.
[0065] A pre-set electricity trading price matching mechanism is implemented in the smart contract. Based on parameters such as the buyer's quote, the seller's quote, and the grid's guidance price, the mechanism automatically determines the price match. If the conditions are met, the transaction continues; otherwise, it terminates. The contract sets price matching rules: a successful match is determined when the buyer's quote is not lower than the seller's quote, and both quotes are within the grid's specified fluctuation range. If the quotes exceed the range or the price difference between the two parties does not meet the conditions, the contract automatically terminates the transaction. The transaction price fluctuation range is the grid benchmark price ±15%. Transactions exceeding this range are terminated immediately. The line loss calculation formula is: tradable electricity = periodic positive active power × (1 - fixed loss coefficient of the distribution area 0.03). Transaction default handling is as follows: if the quote exceeds the fluctuation range or settlement is not completed on time after the transaction, the defaulting party's trading privileges are automatically frozen for 30 days, and an on-chain default record is generated.
[0066] The smart contract sets up the electricity settlement and data confirmation process after the transaction is completed. After the transaction is completed, it automatically executes operations such as freezing electricity, locking metering data, and generating transaction results, forming an unalterable settlement record. After a successful transaction match, the contract automatically deducts the corresponding transaction electricity from the electricity seller's available electricity and adds the corresponding available electricity to the electricity buyer; at the same time, the settlement time, settlement electricity, and settlement price are written to a temporary record on the blockchain, awaiting final confirmation. The entire settlement process is executed automatically by the contract and cannot be manually modified.
[0067] The smart contract executes the transaction order generation, participant digital signature verification, and on-chain storage of transaction and metering data according to preset logic, all fully automated. The signature verification employs an asymmetric encryption algorithm to verify identity legitimacy. After qualification and electricity verification are passed, the contract automatically generates an order containing information about both parties, transaction electricity, transaction price, and timestamp; it then verifies the order signature using an asymmetric encryption algorithm to confirm that the transaction instruction was initiated by a legitimate entity; upon successful verification, the order information, associated metering hash value, and settlement result are all stored on the blockchain, completing the entire contractual execution process.
[0068] S105 constructs an on-chain data security and traceability system, adopts asymmetric encryption algorithms to ensure the security of data transmission and transaction interaction, sets access control, and supports the retrieval of the entire lifecycle of data through meter code, order number, and block height, and completes the monitoring and early warning of tampering and illegal transaction behavior.
[0069] In one implementation, combining the security requirements of electricity meter data and electricity transaction data with the traceability and controllable access characteristics of blockchain data, corresponding encryption strategies and permission allocation rules are formulated based on the security level of data in the transmission, interaction and storage stages, and the implementation path of on-chain traceability is determined from the perspective of data lifecycle traceability.
[0070] In terms of data hierarchical management, raw data collected from electricity meters, electricity metering results, transaction order information, and settlement vouchers are classified as high-security data; while equipment online status, data statistics and summaries, and evidence storage progress queries are classified as ordinary-security data. High-security data involves metering accuracy and transaction authenticity, and requires encrypted transmission and storage throughout the process; ordinary-security data is only used for status display and can be accessed after identity verification, balancing security and operational efficiency.
[0071] High-security-level data employs asymmetric encryption throughout the entire process of terminal uploading, network transmission, and node interaction to prevent eavesdropping, tampering, and forgery. Ordinary-security-level data only verifies the accessor's identity and permissions, without end-to-end encryption. A traceability path is established covering all stages of data collection, preprocessing, on-chain evidence storage, transaction execution, and settlement archiving. Each step is linked to node identity and timestamps, ensuring that operations are locatable, verifiable, and non-repudiable. For example, a user's real-time electricity consumption and transaction orders are high-security-level data, encrypted from the moment the meter is uploaded, and protected by encryption throughout the on-chain and transaction processes. Meanwhile, statistical data such as the number of online meters and the evidence storage rate for that area are ordinary-security-level data, viewable only after successful login verification. All operations from collection to settlement are traceable and can be fully traced back using the meter number or order number. The system employs a RBAC three-dimensional permission control matrix: 1. Power grid operation and maintenance: node management, contract configuration, and full-domain data query; 2. Metering and data collection: data upload and local query only for the local area; 3. Transaction entities: query of their own meter data and their own orders; 4. Regulatory audit: full-volume traceability query and anomaly monitoring, with no modification permissions; it supports the issuance of 72-hour temporary verification authorizations by operation and maintenance roles, with automatic revocation of authorizations upon expiration and authorization records uploaded to the blockchain. Tampering monitoring logic: The latest 3 historical hash values of each meter are cached off-chain, and hashes are compared in batches when a new block is uploaded to the blockchain; hash inconsistencies are judged as data tampering, triggering a Level 1 alarm (red) that is pushed to the regulatory platform and notified to operation and maintenance via SMS; unauthorized access and illegal node access are judged as Level 2 alarms (yellow), intercepting operations and retaining the access IP and node identifier.
[0072] Based on on-chain data security requirements, asymmetric encryption algorithm (RSA) is adopted as the encryption mechanism for data transmission and transaction interaction. Combined with the access boundaries defined by the roles of participants in the power business, and relying on the immutability and traceability characteristics of blockchain, a complete security and traceability foundation solution is formed. Adapting to the State Grid's metering security standards, the system supports switching to national cryptographic algorithms, defaults to compatibility with RSA+SHA256, and enables SM2 asymmetric signature encryption and SM3 hash digests in private network confidential scenarios. The SM2 replacement rules are as follows: the meter terminal uses the device's SM2 public key to encrypt plaintext, the main station uses the global SM2 private key to decrypt, and transaction order signatures uniformly use SM2 private key signing. The SM3 replacement rules are as follows: the original metering digest abandons SHA256, and uses SM3 hash to generate a unique data fingerprint, while the hash concatenation separator and field order remain unchanged. The CA certificate's power-specific OID extension is as follows: the first-level root certificate OID = 1.2.156.300.1.1, the second-level equipment certificate OID = 1.2.156.300.1.2, and the certificate includes built-in extended fields for the equipment area and permission validity period. The Certificate Revocation List (CRL) is updated on the blockchain every 7 days. Certificates of expired nodes are automatically blocked from accessing the consensus network, and revocation records are permanently stored and traceable. Asymmetric encryption uses a public-key / private-key separation method. Metering data uploads, transaction instruction sending, and settlement information exchanges are all encrypted using the corresponding public key. Only authorized nodes holding the private key can decrypt and read the data, effectively preventing data from being stolen, tampered with, or forged during transmission, ensuring the security of electricity metering information and electricity transaction data throughout the entire process.
[0073] The public and private keys are distributed hierarchically as follows: the data collection terminal in the distribution area holds the device public key, while the main station, transaction, and regulatory nodes hold the global private key; the original plaintext of metering and the full text of transaction orders are transmitted using public key encryption, and the hash digest is only used for signing without encryption; the key is automatically rotated every 90 days, and the rotation record is stored on the blockchain for evidence; the terminal key is stored in the built-in security SE encryption chip of the energy meter. The unified SM2 / RSA signature verification process for transaction orders is as follows: read the plaintext data of the order, the sender's signature string, and the sender's public key; perform a hash operation (SM3 / SHA256) on the complete business fields of the order; decrypt the signature string using the sender's public key, and compare the decrypted hash with the locally calculated hash; if the hashes match completely, the signature is valid; any inconsistency indicates that the order is forged, the transaction is intercepted, and a secondary alarm is generated.
[0074] Simultaneously, operational permissions are divided according to the participating entities in the power business. Metering and data collection nodes only have data upload and local query permissions, but not data modification, deletion, or transaction initiation permissions. Transaction entities can only view metering data, order information, and settlement records related to themselves, and cannot access other users' or the entire domain's data. Regulators have permissions to view all data, trace back to the source, and monitor anomalies, and can audit the entire process record, but do not have business operation or data modification permissions. Grid operators are responsible for node management, contract configuration, and anomaly handling, with permissions allocated according to the principle of minimum necessity. An off-chain auxiliary index library is built, establishing three independent B+ tree indexes: meter code index, order number index, and block height index, supporting multi-condition joint retrieval (transformer area number + time period + anomaly type). Cross-block traceability uses a block height sequential traversal algorithm, with a maximum of 50 blocks traversed in a single query; exceeding this limit results in automatic pagination and return. The fixed fields for the full lifecycle operation log are as follows: operation node ID, node CA certificate number, operation timestamp (accurate to milliseconds), operation type, operation object (table number / order / block), hash before operation, hash after operation, permission verification result, and exception identifier. Massive logs are stored using monthly block compression, and the front-end pagination returns a maximum of 1,000 records at a time.
[0075] All access, operations, and on-chain activities are uniquely bound to the node's identity, recording timestamps and operation content, and are stored on the blockchain, making them tamper-proof and non-repudiable. For example, once a metering data collection node uploads electricity meter data for a certain area, it cannot modify the data already on the blockchain; trading users can only view their own meter's electricity consumption and transaction orders, and cannot view other people's information; regulatory personnel can retrieve any meter traceability record, but cannot initiate transactions or delete data.
[0076] The system implements control measures based on a security and traceability framework. Metering data, transaction instructions, and order information undergo asymmetric encryption during network transmission to prevent data theft and tampering. All on-chain operations are subject to authorization verification, with unauthorized operations directly intercepted. This ultimately forms an integrated security execution solution encompassing encryption protection, access control, and end-to-end traceability. During data transmission, before uploading metering data to the blockchain network, both the electricity meter acquisition terminal and the distribution concentrator employ asymmetric encryption algorithms to encrypt data packets. Data is transmitted in encrypted form throughout the entire transmission process, and only authorized nodes with the corresponding private key can decrypt and verify the data, effectively preventing eavesdropping, tampering, or forgery during transmission over the power grid or public network. For example, when the distribution concentrator uploads core metering data such as electricity consumption, voltage, and current to the main station node, it first encrypts the data using the public key before sending it. The receiving node then uses its private key to decrypt and verify the data, ensuring it has not been altered.
[0077] In the operational control phase, the blockchain network first performs identity and permission verification on all queries, on-chain operations, transactions, and verifications initiated by any node. The system automatically compares the initiating node's role type, operational scope, and data access level, directly rejecting and blocking operations that do not match the preset permissions. For example, a metering data collection node is only allowed to upload data from its assigned transformer area. If it attempts to initiate an electricity transaction or modify historical data, the system will immediately determine that it has exceeded its authority and terminate the operation, while also recording the interception in a log.
[0078] In the traceability and retention phase, all actions, including node access, data upload, consensus verification, block writing, transaction execution, and permission verification, are automatically bound to the node's identity, operation time, and operation content, and written to the blockchain in real time to form an immutable operation log. Every piece of data, from collection and on-chain storage to transaction and settlement, is traceable, forming a complete and traceable chain. For example, the entire process of data upload, on-chain storage, and participation in transactions for a particular electricity meter can be retrieved through the meter code, allowing for the identification of the corresponding operation node, time, and result, facilitating auditing and verification. By combining encrypted transmission, permission verification, and full-process traceability, a secure execution solution covering the entire data lifecycle is constructed, ensuring the security of electricity meter measurement and power transaction data while achieving full traceability and verifiability throughout the entire process.
[0079] According to the security execution plan, blockchain data is monitored in real time, and the system supports retrieving the entire lifecycle of data through three dimensions: meter code, transaction order number, and block height. It identifies and issues warnings for data tampering attempts, unauthorized access, and unauthorized operations, ultimately outputting execution results that meet the requirements of trusted power metering management. Leveraging the immutability of blockchain, the system continuously monitors all block data, metering hash values, and transaction information on the chain. Monitoring includes three key indicators: data integrity, identity legitimacy, and operational compliance. Any anomalies immediately trigger a judgment process.
[0080] For data retrieval, the system offers three independent and cross-verifiable retrieval methods: Retrieve by meter code: Enter the meter number to directly retrieve the meter's entire historical record from data collection, on-chain storage, notarization, to transaction and settlement, including operation nodes, timestamps, notarization status, and associated orders. Retrieve by transaction order number: Enter the order number to view the entire process information for that transaction, including information on both parties, electricity calculation, price matching, signature verification, and settlement results. Retrieve by block height: Enter the block number to view all metering data, hash digests, on-chain nodes, and consensus results within that block.
[0081] In terms of anomaly detection, the system compares the hash value of on-chain data with the original calculated hash value in real time. If the values are inconsistent, it is immediately determined that the data has been tampered with. Access requests from unauthenticated nodes and operation instructions that exceed the scope of permissions are directly determined as illegal access and unauthorized operations. After an anomaly is triggered, the system promptly generates warning information and simultaneously retains a complete chain of evidence, including the operation node, time, content, and the state of the data before and after, to ensure traceability of responsibility. For example, if a staff member enters the code of a certain electricity meter, they can query all the timed on-chain records of that meter in the past three months, two records of abnormal data storage, a transaction detail, and the corresponding operation node and time. If the backend detects that the hash value of a metering data in the table has been modified, the system immediately pops up a tampering warning, records the node and time of the modification attempt, and retains the comparison evidence of the original data and the abnormal data. Through real-time monitoring, multi-dimensional retrieval, anomaly warning, and evidence retention, the system achieves reliable management and control of the entire lifecycle of electricity metering data, ensuring that metering and transaction data are authentic, secure, and traceable.
[0082] S106 integrates blockchain-based evidence storage data, metering data, and transaction data to build a hierarchical data visualization module. It categorizes and displays evidence storage status, transaction progress, and data statistics results by power supply area, transformer area, and meter dimensions, and outputs structured results including block data, data hash values, transaction details, and traceability records.
[0083] In one implementation, core business elements are extracted from blockchain-based evidence storage data, electricity metering data, and electricity transaction data, including block information, data hashes, electricity consumption values, transaction orders, and traceability information. Key business information suitable for display, archiving, auditing, and platform integration is extracted from these data, ensuring completeness of extracted elements, traceability of the data chain, and verifiability of the data, providing a reliable data source for subsequent hierarchical display and structured output. Block height, on-chain timestamp, consensus node identifier, evidence storage status, and block hash value are extracted from the blockchain-based evidence storage data as core credentials ensuring data immutability. Meter number, distribution area, active power consumption, voltage and current, collection time, and data SHA-256 hash value are extracted from the electricity metering data to ensure the integrity and traceability of the original metering information. Transaction order number, transaction party information, transaction electricity consumption, transaction price, settlement time, and signature information are extracted from the electricity transaction data to ensure the entire transaction process is verifiable.
[0084] Simultaneously, using the meter code as the core index, order numbers and block heights are linked and bound, ensuring that each transaction and every on-chain entry corresponds to a specific electricity meter, a specific block, and a specific order, forming a three-in-one traceability relationship of "meter—transaction—block". For example, an electricity meter with meter code 0100234567 completes on-chain entry at block height 1085, generating a transaction record with order number JY20260405001. The system automatically links the meter code, block height, and order number, allowing subsequent retrieval of all relevant information through any field, achieving end-to-end verification. Through the above standardized extraction and association processing, all key information possesses uniqueness, verifiability, and traceability, directly supporting the needs of visualization, regulatory auditing, and data archiving.
[0085] Based on preset power business hierarchical classification rules, core business elements are divided into dimensions such as power supply area, transformer substation, and electricity meter, generating a hierarchical data classification sequence. Following the preset power business hierarchical rules, and based on geographical location and equipment affiliation, the extracted core elements are divided into three levels, forming a structured classification sequence. This hierarchical division method is consistent with the actual management model of power field operation and maintenance, transformer substation management, and meter measurement, and can intuitively reflect the physical distribution and business affiliation of data, facilitating hierarchical viewing, statistical analysis, and operation and maintenance verification.
[0086] The specific classification process is as follows: Level 1 Classification: Power Supply Area Affiliation: All metering data, record keeping information, and transaction data are categorized according to administrative power supply areas or power grid operation and maintenance zones to determine the power supply area to which the data belongs, achieving unified aggregation and management of large-scale data. Level 2 Classification: Power Distribution Area Affiliation: Within the same power supply area, data is further subdivided according to the on-site distribution area number, assigning data to the corresponding area, aligning with the actual network and acquisition architecture of the area's concentrators and low-voltage distribution. Level 3 Classification: Individual Energy Meter Affiliation: Under each distribution area, data is accurately associated with the corresponding meter using the meter's unique code, ensuring that every piece of metering data, every transaction, and every record keeping can be located to the specific device.
[0087] The calculation methods for core statistical indicators are as follows: 1. Evidence storage coverage rate = Number of meters successfully uploaded to the blockchain in the current period / Total number of online meters in the distribution area × 100%; 2. Transaction completion rate = Number of successfully settled orders / Total number of initiated orders × 100%; 3. Total regional electricity consumption = Sum of effective transaction electricity of all subordinate distribution areas in the current period; The visualization module pulls incremental data from the blockchain node every 60 seconds and outputs a structured JSON message containing block metadata, hash array, transaction details array, and traceability log array; Interface rendering rules: green for successful evidence storage, yellow for pending verification, and red for tampering / transaction abnormality. Abnormal distribution areas are automatically displayed at the top.
[0088] After the above three-level division, the collected data, on-chain evidence records, and related transaction orders of the same electricity meter will all be classified into the same hierarchical branch, forming an ordered data sequence of "power supply area - power supply substation - electricity meter". For example, if an electricity meter with meter number 0100234567 belongs to "Chengdong power supply area - Jixiang residential area substation", then all information of this meter, including its scheduled on-chain data, abnormal evidence records, and transaction orders, will be uniformly classified into the branch "Chengdong power supply area → Jixiang residential area substation → meter 0100234567", realizing the orderly collection of data according to geographical and equipment levels, which is convenient for operation and maintenance, supervision, and visualization.
[0089] By matching hierarchical data classification sequences with visualization rules and combining evidence storage status, transaction progress, and data statistical parameters, a multi-dimensional visualization structure is constructed. The categorized hierarchical data is then matched with visualization rules, and combined with evidence storage status, transaction progress, and statistical parameters to build an intuitive interface structure. This interface structure is designed according to actual business scenarios such as power operation and maintenance management, transformer area monitoring, and meter verification. It is clearly hierarchical, easy to operate, and provides intuitive support for on-site operation and maintenance, transaction supervision, and data auditing.
[0090] At the power supply area level, the system summarizes and displays overall operational indicators for the entire area, including total electricity consumption, total number of transactions, overall evidence storage coverage, number of online nodes, and total number of anomalies, facilitating management personnel's understanding of the overall operational status. At the power supply substation level, the system focuses on the operational quality of the substation, displaying the number of abnormal meters, transaction completion rate, evidence storage timeliness, and average daily data collection success rate, enabling rapid location and handling of abnormal substations. At the single-meter metering level, the system displays the real-time electricity consumption, on-chain status, historical on-chain records, and related transaction details of a single energy meter, facilitating on-site verification, user reconciliation, and dispute resolution. Simultaneously, the system uses different identifiers to differentiate business statuses for rapid identification: a "normal" identifier indicates successful evidence storage and completed transactions; a "pending verification" identifier indicates pending review and transactions in progress; and an "abnormal" identifier indicates failed evidence storage, interrupted transactions, and data anomalies.
[0091] At the regional level, you can view "Total electricity consumption in the Chengxi power supply area is 950,000 kWh, with 286 transactions and a certificate of authenticity coverage rate of 98.8%"; at the transformer substation level, you can view "One abnormal meter in the Sunshine Garden transformer substation, with a transaction completion rate of 96.5% and a certificate of authenticity timeliness rate of 97.8%"; at the meter level, you can view the real-time electricity consumption of meter number 0100234567, with the on-chain status being "certificate of authenticity successfully stored", and the on-chain times of the last 10 times and the details of one transaction are displayed, making the status clearly identifiable.
[0092] Based on the output requirements of the visualization module, the categorized data is structurally encapsulated to generate a structured output containing block data, data hashes, transaction details, and traceability records. The categorized hierarchical data is matched with visualization rules, and combined with evidence storage status, transaction progress, and statistical parameters to build an intuitive interface structure. The visualization interface follows the actual display needs of power metering operation and maintenance and supervision, adopting a hierarchical display, clear status, and intuitive data presentation method, facilitating quick viewing of business operation status by managers, maintenance personnel, and supervisors. At the power supply area level, the overall operational overview of the area is displayed, including cumulative total electricity consumption, total number of transactions in the entire area, overall evidence storage coverage of metering data, number of online nodes, and other summary information, used for macro-monitoring of the area's operational level.
[0093] At the power supply area level, the system displays operational quality indicators for each area, including the number of faulty meters, transaction completion rate, data storage timeliness, and data collection success rate, facilitating the location of problematic areas and the implementation of maintenance. At the individual metering level, the system displays detailed information about each meter, including real-time electricity consumption, current on-chain status, historical on-chain records, and related transaction details, for on-site verification, user reconciliation, and data traceability.
[0094] Meanwhile, the system uses different identifiers to distinguish various business statuses for easy and rapid identification: a normal identifier indicates successful evidence storage and completed transactions; a reminder identifier indicates pending verification and transactions in progress; and an abnormal identifier indicates failed evidence storage, abnormal transactions, and data timeouts. For example, a power supply area layer displays "Total electricity consumption 1.36 million kWh, total number of transactions 412, evidence storage coverage rate 99.1%"; the corresponding transformer area layer displays "2 abnormal meters, transaction completion rate 97.2%, evidence storage timeliness rate 98.3%"; the meter layer displays that the real-time electricity consumption of meter number 0100234567 is 1268.42 kWh, the on-chain status is successful evidence storage, and the system can view the on-chain times of the last 10 times and the details of 2 historical transactions, making the status intuitive and the data clear.
[0095] The consensus node server features an 8-core CPU, 16GB of RAM, and a 1TB SSD, deployed independently within the dedicated power network. The distribution area edge gateway is an industrial-grade embedded gateway equipped with an SE security encryption chip, supporting DL / T645 protocol parsing. The smart meters have built-in national cryptographic encryption modules, supporting local SHA-256 hash pre-computation.
[0096] The actual performance indicators are as follows: a single block can accommodate 50 electricity meter data entries, with an average PBFT consensus time of 280ms; the single meter code retrieval response time is ≤150ms; the RSA encryption latency for a single meter data entry is ≤20ms; and a single consensus cluster can support up to 2000 electricity meters simultaneously uploading data at its peak.
[0097] The fault handling process is as follows: when the metering hash does not match, the contract automatically retrieves the original cached data for secondary hash comparison and pushes it to the regulator for review simultaneously; after a node crashes, the remaining consensus nodes complete the voting normally, and the missing blocks are automatically synchronized after the crashed node restarts; when there is a dispute over a user transaction, the regulator retrieves the full-chain traceability log through the order number, and the on-chain record serves as a legally credible certificate.
[0098] In one implementation, such as Figure 2 As shown, this application also provides a blockchain-based system for storing and trusting electricity meter metering data, including: The underlying support unit 201 of the blockchain is used to build a system for storing and trusting electricity meter metering data based on the distributed architecture of the consortium blockchain, complete the networking of peer nodes, the configuration of consensus mechanism and the development of smart contracts, and realize node identity authentication and hierarchical configuration of multi-role operation permissions. The metering data preprocessing unit 202 is used to perform standardized cleaning, format verification and integrity check on the raw metering data of the electricity meter, associate the meter physical address with the geographical information of the transformer area, generate a unique data digest through a hash algorithm, and establish a one-to-one mapping between the meter code and the blockchain account address. The metering data storage unit 203 is used to write on-chain execution logic based on smart contracts, configure three types of triggering conditions: timed collection, abnormal data, and manual verification, complete node consensus verification, block encapsulation and distributed storage, and synchronously record on-chain time, operation node and storage status logs. The trusted electricity trading unit 204 is used to define transaction execution rules through smart contracts, complete the verification of the qualifications of the trading entities, electricity calculation, price matching and automatic settlement, and realize the contractual operation of transaction order creation, digital signature verification and on-chain storage of transaction data; The on-chain security traceability unit 205 is used to ensure the security of data transmission and transaction interaction by using asymmetric encryption algorithms, configure multi-dimensional access control policies, support the retrieval of full lifecycle data by meter code, order number, and block height, and realize data tampering and illegal transaction monitoring and early warning. The data visualization output unit 206 is used to integrate blockchain evidence data, metering data and transaction data to build a three-level visualization module of region-transformer area-meter, which classifies and displays evidence status, transaction progress and statistical results, and outputs structured results such as block data, hash value, transaction details and traceability records.
[0099] The computer-readable storage medium provided in the above embodiments of this application and the blockchain-based method for storing and trusting electricity meter metering data provided in the embodiments of this application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented by the applications stored therein.
[0100] The various embodiments in this application are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, for the embodiments evaluating the blockchain-based method for storing and trusting electricity meter metering data, electronic devices, electronic equipment, and readable storage media, since they are substantially similar to the embodiments of the blockchain-based method for storing and trusting electricity meter metering data described above, relevant parts can be referred to in the description of the embodiments of the blockchain-based method for storing and trusting electricity meter metering data.
Claims
1. A method for storing and facilitating trusted transactions of electricity meter metering data based on blockchain, characterized in that, include: Based on blockchain technology, an architecture for storing and trusting electricity meter metering data was built, completing the distributed node network deployment, consensus mechanism configuration, and smart contract module development, while simultaneously realizing node identity authentication and multi-role permission hierarchical settings. The raw metering data collected by the electricity meter is standardized, cleaned, format-verified, and integrity-verified. Combined with the meter's physical address and the geographical association information of the transformer substation, a unique data digest is generated through a hash algorithm to establish a binding mapping between the meter code and the blockchain account address. Based on smart contracts, rules for storing measurement data are written, and three types of on-chain trigger conditions are set: timed collection, abnormal data, and manual verification. Consensus verification, block packaging, and distributed storage are completed when data is uploaded to the chain, and on-chain logs of on-chain time, operation node, and storage status are recorded synchronously. By defining the core logic of trusted transactions through smart contracts, the standards for verifying the qualifications of trading entities, the method for calculating transaction volume, the price matching rules and settlement process are clarified, thereby realizing the contractual execution of transaction order creation, signature verification and data on-chain storage. Construct an on-chain data security and traceability system, adopt asymmetric encryption algorithms to ensure the security of data transmission and transaction interaction, set access control, support the retrieval of the entire life cycle record of data through meter code, order number, and block height, and complete the monitoring and early warning of tampering and illegal transaction behavior; By integrating blockchain-based evidence storage data, metering data, and transaction data, a hierarchical data visualization module is built. The module displays the evidence storage status, transaction progress, and data statistics results according to the dimensions of power supply area, transformer area, and meter. The output includes structured results such as block data, data hash value, transaction details, and traceability records.
2. The method as described in claim 1, characterized in that, A data storage and trusted transaction architecture for electricity meters is built based on blockchain technology. This includes distributed node network deployment, consensus mechanism configuration, and smart contract module development. Simultaneously, node identity authentication and multi-role permission hierarchical settings are implemented, including: Combining the needs of electricity metering data storage and trusted transaction scenarios with the distributed ledger characteristics of blockchain, we introduce consortium blockchain networking rules and smart contract programmable mechanisms to build and configure a blockchain underlying architecture adapted to electricity metering business. The distributed node communication information, consensus verification strategy, and business role permission elements are taken as input and passed to the already deployed and configured blockchain architecture module for parameter initialization; Leveraging the node management and contract execution capabilities of the blockchain architecture, the distributed node network, consensus mechanism loading, and smart contract module deployment are completed, thereby building the basic operating environment for the blockchain. Based on the multi-role management requirements of the power business, node identity credentials are configured in a targeted manner from the blockchain identity system to complete the hierarchical binding of multi-role permissions and the loading of access control policies, thereby generating blockchain identity and permission configuration information.
3. The method as described in claim 1, characterized in that, Based on smart contracts, rules for storing measurement data are developed, setting three types of on-chain trigger conditions: timed collection, abnormal data, and manual verification. This completes consensus verification, block packaging, and distributed storage during data upload, and synchronously records on-chain logs of upload time, operation nodes, and storage status, including: Combining the business requirements for electricity metering data storage with the characteristics of smart contract rule execution, a contract-based coding method was adopted to complete the writing of the logic for storing metering data on the blockchain and the configuration of triggering conditions. Based on three triggering dimensions—electricity meter data collection timing, abnormal data status, and manual verification instructions—three on-chain triggering rules are defined for timed collection, abnormal data, and manual verification. Based on the smart contract's preset evidence storage logic, the node consensus verification, block data encapsulation, and distributed ledger writing operations are performed on the metering data to be uploaded to the chain. Synchronously collect and write on-chain timestamps, operation node identifiers, and evidence storage status identifiers to generate on-chain evidence storage log information, completing the entire process of on-chain evidence storage of electricity meter metering data.
4. The method as described in claim 1, characterized in that, A blockchain-based data security and traceability system is constructed, employing asymmetric encryption algorithms to ensure secure data transmission and transaction interactions. Access control is implemented, and the system supports retrieving the entire lifecycle of data records via meter code, order number, and block height. This enables monitoring and early warning of tampering and illegal transactions, including: Based on the security protection requirements of electricity meter data and transaction information, the traceability characteristics of on-chain data and blockchain access control constraints, encryption and permission configuration rules are determined according to the security level of data transmission and transaction interaction, and the traceability implementation method is clarified through the data lifecycle traceability dimension. The encryption mechanism is determined in accordance with the requirements for on-chain data security. Asymmetric encryption algorithms are used in the data transmission and transaction interaction stages. Access permissions are determined based on business roles and operational scopes, and the immutability of the blockchain is constrained to generate a basic solution for on-chain data security and traceability. Based on the security and traceability fundamental scheme, security control logic is implemented. Data transmission adopts asymmetric encryption, and access operations are controlled by permission verification. A security execution scheme including encryption protection, permission control, and full-link traceability is generated. The on-chain data monitoring and retrieval are completed according to the security execution plan. Based on the meter code, order number, and block height, data retrieval and behavior judgment are performed to generate on-chain data security and traceability execution results that meet the requirements of trusted management of power metering data.
5. The method as described in claim 4, characterized in that, Integrating blockchain-based evidence storage data, metering data, and transaction data, a hierarchical data visualization module is built. It categorizes and displays evidence storage status, transaction progress, and data statistics by power supply area, transformer substation, and meter reading. The output includes structured results such as block data, data hash values, transaction details, and traceability records. Extract core business elements from blockchain-stored data, electricity meter readings, and electricity trading data, including block information, data hashes, electricity values, transaction orders, and traceability information; Based on the preset power business hierarchical classification rules, the core business elements are divided into dimensions according to power supply area, transformer area, and electricity meter, generating a hierarchical data classification sequence. The hierarchical data classification sequence is matched with the visualization display rules, and combined with the evidence storage status, transaction progress, and data statistical parameters, to construct a multi-dimensional visualization display structure; Based on the output requirements of the visualization module, the categorized data is encapsulated in a structured manner to generate structured results containing block data, data hashes, transaction details, and traceability records.
6. A blockchain-based system for storing and trusting electricity meter metering data, characterized in that: The system includes: The underlying support unit of the blockchain is used to build a system for storing and trusting electricity meter metering data based on the distributed architecture of the consortium blockchain, complete the networking of peer nodes, the configuration of consensus mechanisms and the development of smart contracts, and realize node identity authentication and hierarchical configuration of multi-role operation permissions. The metering data preprocessing unit is used to perform standardized cleaning, format verification and integrity check on the raw metering data of the electricity meter, associate the physical address of the meter with the geographical information of the transformer area, generate a unique data digest through a hash algorithm, and establish a one-to-one mapping between the meter code and the blockchain account address. The metering data storage unit is used to write on-chain execution logic based on smart contracts, configure three types of triggering conditions: timed collection, abnormal data, and manual verification, complete node consensus verification, block encapsulation and distributed storage, and synchronously record on-chain time, operation node and storage status logs. The trusted electricity trading unit is used to define transaction execution rules through smart contracts, complete the verification of the qualifications of trading entities, electricity calculation, price matching and automatic settlement, and realize the contractual operation of transaction order creation, digital signature verification and on-chain storage of transaction data; The on-chain security traceability unit is used to ensure the security of data transmission and transaction interaction by using asymmetric encryption algorithms, configure multi-dimensional access control policies, support the retrieval of full lifecycle data by meter code, order number, and block height, and realize data tampering and illegal transaction monitoring and early warning. The data visualization output unit is used to integrate blockchain evidence data, metering data, and transaction data to build a three-level visualization module of region, substation, and meter. It categorizes and displays the evidence status, transaction progress, and statistical results, and outputs structured results such as block data, hash values, transaction details, and traceability records.
7. An electronic device, characterized in that, include: First processor; and memory for storing executable instructions of the first processor; The first processor is configured to execute the blockchain-based method for storing and trusting electricity meter metering data as described in any one of claims 1 to 5 by executing the executable instructions.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the second processor, it implements the blockchain-based method for storing and trusting electricity meter metering data as described in any one of claims 1 to 5.