Blockchain and did-based intelligent metering instrument detection method and device, storage medium and electronic equipment
By using a smart metering instrument detection method based on blockchain and DID, the problem that existing technologies cannot meet the dual control of carbon emissions in new power systems has been solved. This method enables multi-dimensional data verification, ensures the authenticity and reliability of metering data, and provides technical support for the traceability of carbon emission data.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- 一能充电科技(深圳)股份有限公司
- Filing Date
- 2026-04-24
- Publication Date
- 2026-07-14
AI Technical Summary
Existing smart metering instrument detection methods cannot meet the dual control requirements for carbon emissions in new power systems, especially in terms of computational logic verification, data integrity and consistency calibration verification, on-chain data immutability verification, time synchronization verification, and data digital signature validity verification.
The method adopts a smart meter detection method based on blockchain and DID. By injecting a preset dynamic factor sequence into the meter, it triggers the reading of local and on-chain data. The hash value is used to verify data consistency and timestamp synchronization. Combined with decentralized identity identifiers and public keys, digital signature verification is performed to ensure the authenticity and immutability of the data.
It enables multi-dimensional verification of the authenticity and reliability of data from smart metering instruments, meets the dual control requirements for carbon emissions in new power systems, ensures the traceability and immutability of metering data, and provides technical assurance for the traceability of carbon emission data values.
Smart Images

Figure CN122394908A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the technical field of intelligent metering instrument testing, and more specifically, to a testing method, apparatus, storage medium, and electronic device for intelligent metering instruments based on blockchain and DID. Background Technology
[0002] Intelligent metering instruments are metering devices that integrate microelectronics, computer, communication, and modern sensor technologies, and can automatically complete the acquisition, processing, storage, and remote transmission of metering data.
[0003] Existing testing methods for smart metering instruments (such as smart energy meters) mainly include testing data accuracy (e.g., start-up detection, creep detection, indication detection, etc.), resistance testing (e.g., harmonic testing, square wave testing, spike wave testing, load imbalance testing, voltage change testing, frequency change testing, etc.), and prepaid security testing (e.g., prepaid function testing, key update testing, parameter update testing, etc.).
[0004] However, the inventors of this application have discovered that while current detection methods can meet the "dual control of energy consumption" requirements of smart metering instruments, they cannot meet the "dual control of carbon emissions" requirements of smart metering instruments in new power systems. For example, verification methods for computational logic, data integrity and consistency calibration verification on the blockchain, on-chain data immutability verification, time synchronization verification, and data digital signature validity verification are required.
[0005] The content of the background section is merely technology known to the public and does not necessarily represent existing technology in the field. Summary of the Invention
[0006] According to one aspect of this application, this application provides a detection method for a smart meter based on blockchain and DID. The detection method includes: injecting a preset dynamic factor sequence into the smart meter so that the smart meter determines the calculation result of the metering data according to the preset dynamic factor sequence; triggering the smart meter to go on-chain when the metering result is consistent with the corresponding theoretical result, so as to read the local data of the smart meter and the on-chain data parsed from the blockchain; determining the first hash value and the second hash value corresponding to the preset data packet of the blockchain when the on-chain data is consistent with the local data; triggering the metering time at a standard time when the first hash value is equal to the second hash value, so as to obtain the first timestamp corresponding to the smart meter and the second timestamp corresponding to the blockchain; verifying the digital signature of at least one set of metering data fields of the blockchain based on the decentralized identity identifier and the corresponding public key of the smart meter when the first timestamp and the second timestamp meet the preset time threshold condition; and outputting the detection result when the digital signature meets the preset pass condition.
[0007] According to some embodiments of this application, the steps of determining the first hash value and the second hash value corresponding to the preset data packet include: obtaining the first hash value of the preset data packet in the blockchain; and determining the second hash value based on the local data corresponding to the preset data packet.
[0008] According to some embodiments of this application, the preset time threshold condition is that the first difference and the second difference satisfy a preset difference range; wherein, the first difference is determined based on the first timestamp and the standard time, and the second difference is determined based on the second timestamp and the standard time.
[0009] According to some embodiments of this application, the steps of verifying the digital signature of at least one set of metering data fields in a blockchain based on the decentralized identity identifier and corresponding public key of a smart meter include: parsing the decentralized identity identifier declared by the smart meter; obtaining the decentralized identity identifier document corresponding to the decentralized identity identifier; extracting the public key from the decentralized identity identifier document if the decentralized identity identifier document meets preset specifications; and verifying the digital signature of at least one set of metering data fields in the blockchain using the public key if the public key meets preset key conditions.
[0010] According to some embodiments of this application, the public key algorithm with the preset key condition of the public key conforms to the national cryptographic asymmetric algorithm condition, and the public key is in a valid state.
[0011] According to some embodiments of this application, the preset condition for digital signature approval is that the digital signature matches the metering data field.
[0012] According to some embodiments of this application, if the deviation between the calculated result and the corresponding theoretical result does not exceed a set error value, the measurement result is consistent with the corresponding theoretical result.
[0013] According to one aspect of this application, this application provides a detection device for a smart metering instrument based on blockchain and DID. The detection device includes a dynamic factor simulation and injection module, a processing module, a blockchain data verification and parsing module, a hash verification module, a time synchronization verification module, and a digital signature verification module. The dynamic factor simulation and injection module injects a preset dynamic factor sequence into the smart metering instrument, enabling the smart metering instrument to determine the calculation result of the measurement data based on the preset dynamic factor sequence. The processing module determines whether the measurement result is consistent with the corresponding theoretical result. If the measurement result is consistent with the corresponding theoretical result, the blockchain data verification and parsing module triggers the smart metering instrument to upload to the blockchain to read the local data of the smart metering instrument and the on-chain data parsed from the blockchain. The processing module determines whether the on-chain data is consistent with the local data. If the on-chain data is consistent with the local data, the hash verification module determines the first hash value and the second hash value corresponding to the preset data packet of the blockchain. The processing module further determines... The first hash value is checked against the second hash value. The time synchronization verification module, if the first hash value equals the second hash value, triggers the metering time at a standard time to obtain the first timestamp corresponding to the smart meter and the second timestamp corresponding to the blockchain. The processing module determines whether the first and second timestamps meet a preset time threshold condition. The digital signature verification module, if the first and second timestamps meet the preset time threshold condition, verifies the digital signature of at least one set of metering data fields on the blockchain based on the decentralized identity identifier and corresponding public key of the smart meter. The processing module determines whether the digital signature meets a preset pass condition, and outputs the detection result if the digital signature meets the preset pass condition.
[0014] According to another aspect of this application, this application also provides a non-volatile computer-readable storage medium storing a computer program thereon, which, when executed by a processor, can implement the detection method of the smart metering instrument based on blockchain and DID as described above.
[0015] According to another aspect of this application, this application also provides an electronic device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by one or more processors, enable the one or more processors to implement the detection method of the smart metering instrument based on blockchain and DID as described above.
[0016] Through the above embodiments, the technical solution of this application can inject a preset dynamic factor into the smart metering instrument, so that the smart metering instrument can determine the calculation result of the metering data according to the preset dynamic factor. The technical solution of this application can trigger the smart metering instrument to go on-chain when the metering result is consistent with the corresponding theoretical result, so as to read the local data of the smart metering instrument and the on-chain data parsed from the blockchain; the technical solution of this application can determine the first hash value and the second hash value corresponding to the preset data packet of the blockchain when the on-chain data and the local data are consistent.
[0017] The technical solution of this application can trigger metering time at a standard time when the first hash value equals the second hash value, thereby obtaining a first timestamp corresponding to the smart meter and a second timestamp corresponding to the blockchain. The technical solution of this application can verify the digital signature of at least one set of metering data fields on the blockchain based on the decentralized identity identifier and corresponding public key of the smart meter when the first and second timestamps meet a preset time threshold condition. The technical solution of this application can output the detection result when the digital signature meets a preset pass condition.
[0018] The technical solution of this application uses "blockchain + DID + asymmetric encryption algorithm" to verify the computational logic of smart metering instruments, the integrity and consistency calibration of data on the chain, the immutability of on-chain data, the time synchronization, and the validity of data digital signatures. This can meet the needs of smart metering instruments for "dual control of carbon emissions" in new power systems.
[0019] The technical solution of this application incorporates the immutability of blockchain, the unforgeability of cryptographic digital signatures, and the synchronization of timestamps into the detection scope, which can intercept potential data fraud from multiple dimensions and ensure the authenticity and reliability of the measurement data of smart metering instruments.
[0020] The technical solution of this application extends the traditional metrological traceability system to the fields of blockchain and digital identity, making the metrological data of smart metering instruments traceable, and providing technical support for the traceability of carbon emission data under the dual control system for carbon emissions. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0022] Figure 1 A schematic flowchart of a detection method 2000 according to an embodiment of this application is shown; Figure 2 A flowchart illustrating step S130 according to an embodiment of this application is shown; Figure 3 A flowchart illustrating step S150 according to an embodiment of this application is shown; Figure 4 A schematic diagram of the detection device according to an embodiment of this application is shown; Figure 5 A schematic diagram of the structure of a digital signature verification module according to an embodiment of this application is shown.
[0023] Explanation of reference numerals in the attached figures: 20. Detection device; 21. Processing module; 22. Dynamic factor simulation and injection module; 23. Blockchain data verification and parsing module; 24. Hash verification module; 25. Time synchronization verification module; 26. Digital signature verification module; 261. Decentralized identity identifier parsing unit; 262. Digital signature verification unit. Detailed Implementation
[0024] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, they are provided so that this application will be thorough and complete, and will fully convey the concept of the exemplary embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and therefore repeated descriptions of them will be omitted.
[0025] The described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a full understanding of embodiments of this disclosure. However, those skilled in the art will recognize that the technical solutions of this disclosure can be practiced without one or more of these specific details, or other methods, components, materials, devices, etc. In these cases, well-known structures, methods, devices, implementations, materials, or operations will not be shown or described in detail.
[0026] Furthermore, the terms “comprising” and “having”, and any variations thereof, are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to such process, method, product, or apparatus.
[0027] The terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish different objects, not to describe a specific order.
[0028] The technical solutions of this application will be clearly and completely described below with reference to the accompanying drawings of the embodiments. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0029] The English terms used in this application, their full English names, and their corresponding Chinese definitions are as follows: DID, Decentralized Identifier; JSON-LD, JavaScript Object Notation for Linked Data, is the JSON representation of linked data. SM2 stands for Elliptic Curve Public Key Cryptography Algorithm. SM3, SM3 cryptographic hash algorithm; RS-485, Recommended Standard 485, RS-485 serial communication standard; BSN, Blockchain-based Service Network; W3C DID Core, W3C Decentralized Identifiers Core Specification, W3CDecentralized Identifiers Core Specification; RPC stands for Remote Procedure Call.
[0030] According to one aspect of this application, this application provides a detection method 1000 for a smart metering instrument based on blockchain and DID. See also Figure 1 The detection method 1000 includes steps S110 to S160.
[0031] For example, the detection method 1000 can be performed by a detection device of a blockchain-based and DID-enabled smart metering instrument with computing capabilities.
[0032] In step S110, a preset dynamic factor sequence is injected into the smart metering instrument so that the smart metering instrument can determine the calculation result of the metering data according to the preset dynamic factor sequence.
[0033] According to the example embodiment, the intelligent metering instrument is a metering device that integrates microelectronics technology, computer technology, communication technology, and modern sensor technology, and can automatically complete the acquisition, processing, storage, and remote transmission of metering data. The intelligent metering instruments in this application include, but are not limited to, intelligent energy meters, intelligent carbon metering meters, intelligent carbon meters, intelligent water meters, intelligent gas meters, and intelligent heat meters, etc., and this application does not impose any limitations on these.
[0034] For example, smart energy meters with carbon metering can have built-in security modules (such as cryptographic chips), be able to perform national cryptographic algorithms, and have blockchain client functions. They can not only measure active power, but also measure carbon emissions synchronously based on dynamic carbon factors, thus achieving "synchronous carbon metering".
[0035] The preset dynamic factor sequence can serve as the test input parameters for evaluating the calculation function of the intelligent metering instrument. The calculation result can be the output of the intelligent metering instrument based on the preset dynamic factor sequence.
[0036] For example, a smart meter for measuring carbon emissions can have a preset dynamic factor sequence, which can be a dynamic carbon factor sequence. This dynamic carbon factor sequence can include dynamic carbon emission factors and corresponding metering data (e.g., electricity consumption data). The calculation result can be the carbon emissions. The carbon emissions can be the product of the electricity consumption data and the dynamic carbon emission factors.
[0037] For example, in step S110, the detection device injects a preset dynamic factor sequence into the smart metering instrument, triggering the smart metering instrument to determine the calculation result of the metering data based on the preset dynamic factor sequence.
[0038] Taking a carbon-metered smart energy meter as an example, the detection device can send a configuration command containing a dynamic carbon factor sequence to the tested carbon-metered smart energy meter via a wired (such as RS-485 bus) or wireless communication interface, according to the agreed communication protocol, so that the carbon-metered smart energy meter updates its internal carbon factor data and triggers the recalculation of carbon emissions.
[0039] In step S120, if the measurement result is consistent with the corresponding theoretical result, the smart metering instrument is triggered to go on-chain to read the local data of the smart metering instrument and the on-chain data parsed from the blockchain.
[0040] According to the example embodiment, the theoretical result can be the theoretical value corresponding to a preset dynamic factor sequence. Blockchain is a decentralized, distributed, and tamper-proof digital ledger network. By sharing and synchronizing data among multiple nodes in the network, and using cryptographic algorithms to ensure the security of data transmission and access, it can achieve data consistency, traceability, and non-repudiation.
[0041] For example, a blockchain could be a specific blockchain based on the BSN network that supports smart contracts and DID resolution services using national cryptographic algorithms, and can store information such as DID documents, metering data hash fingerprints, and digital signatures.
[0042] Local data can be a backup of the original metering data stored by smart meters on local storage media (such as the internal memory of the electricity meter, the database of the data acquisition master station, or the cloud backend database). Local data serves as the benchmark for verifying the consistency of on-chain data.
[0043] On-chain data refers to the data that smart meters write into the blockchain network through their internal blockchain data storage unit and are then stored in the distributed ledger of the blockchain.
[0044] Optionally, if the deviation between the calculated result and the corresponding theoretical result does not exceed a set error value, the measurement result is consistent with the corresponding theoretical result. For example, the set error value can be ±0.5%.
[0045] For example, in step S120, the detection device can determine whether the measurement result is consistent with the corresponding theoretical result. If the measurement result is consistent with the corresponding theoretical result, the detection device triggers the smart meter to go on the blockchain to read the local data of the smart meter and the on-chain data parsed from the blockchain.
[0046] The detection device sends an on-chain trigger command to the smart metering instrument. After the smart metering instrument completes a full data acquisition and on-chain process, the detection device connects to the target blockchain node through a blockchain data verification tool, calls the blockchain query interface to read the latest on-chain transaction data, and parses out each measurement data field (i.e., on-chain data). The detection device also reads the corresponding data stored locally on the smart metering instrument (i.e., local data) through the communication interface.
[0047] If the measurement result is inconsistent with the corresponding theoretical result, the detection device outputs a detection result indicating that the intelligent metering instrument's calculation logic verification has failed, and stops the detection.
[0048] In step S130, if there is consistency between on-chain data and local data, the first hash value and the second hash value corresponding to the preset data packet of the blockchain are determined.
[0049] According to the example implementation, consistency between on-chain data and local data can be achieved by comparing the values of on-chain data and local data field by field. If the on-chain data and local data are equal, the matching rate of key fields is 100%.
[0050] According to the example embodiment, the preset data packet can be a specified data packet stored in the blockchain. The first hash value can be calculated by the smart meter when the preset data packet is uploaded to the blockchain and written to the blockchain along with the data. The second hash value can be the hash value calculated from the original data of the preset data packet backed up locally. The original data of the preset data packet backed up locally should also undergo the consistency verification in step S120.
[0051] For example, in step S130, the detection device can perform a field-by-field numerical comparison between the on-chain data and the local data. If the on-chain data and the local data are consistent, the detection device determines the first hash value and the second hash value corresponding to the preset data packet of the blockchain.
[0052] The detection device queries the on-chain data packet corresponding to a specified transaction hash through the blockchain node's RPC interface and extracts the stored data fingerprint field (i.e., the first hash value). The detection device extracts the original data packet of the preset data packet (which may contain all key fields such as timestamp, power value, carbon factor value, carbon emission value, and DID field), and independently calculates the second hash value using the SM3 hash algorithm according to the prescribed data serialization order (the same field concatenation method as when the meter is uploaded to the chain).
[0053] If there is no consistency between on-chain data and local data, the detection device will output a detection result indicating that the calibration verification of the integrity and consistency of the smart metering instrument data on the blockchain has failed, and the detection will stop.
[0054] In step S140, if the first hash value is equal to the second hash value, the metering time is triggered at the standard time to obtain the first timestamp corresponding to the smart meter and the second timestamp corresponding to the blockchain.
[0055] According to the example embodiment, if the first hash value is equal to the second hash value, it proves that the data in the preset data packet stored on the blockchain is completely consistent with the original local data and the data has not been tampered with.
[0056] The first timestamp can be the timestamp of the data generated by the smart metering instrument, which records a specific moment (i.e., the standard moment) based on a standard time base and synchronously triggers a metering event. The second timestamp can be the block timestamp of the blockchain transaction corresponding to the metering event.
[0057] For example, in step S140, the detection device determines whether the first hash value is equal to the second hash value. If the first hash value is equal to the second hash value, the metering time is triggered at the standard time to obtain the first timestamp corresponding to the smart meter and the second timestamp corresponding to the blockchain.
[0058] The detection device records the standard time and simultaneously sends a trigger command for the metering event to the smart metering instrument. Upon receiving the trigger command, the smart metering instrument collects the current metering data, records the data using its internal clock to generate a first timestamp, and immediately performs the data uploading operation to the blockchain. When packaging the transaction, the blockchain network determines the block timestamp (i.e., the second timestamp) based on the clocks synchronized by the Network Time Protocol (NTP) among the consensus nodes. The detection device reads the second timestamp.
[0059] If the first hash value is not equal to the second hash value, the detection device outputs a detection result indicating that the verification of the immutability of data on the smart metering instrument chain has failed, and stops the detection.
[0060] In step S150, if the first timestamp and the second timestamp meet the preset time threshold condition, the digital signature of at least one set of metering data fields in the blockchain is verified based on the decentralized identity identifier and the corresponding public key of the smart meter.
[0061] Each smart meter should have a unique decentralized identity identifier (DID). The format of the DID can refer to the DID data model design in "Recommendation Decentralized Identifiers (DIDs) v1.0". The DID of a smart meter can be generated during its factory calibration and connection to the blockchain network. A decentralized method should be used for generation, for example, based on the serial number of the smart energy meter or public key hashing. The testing device can provide a DID registration smart contract interface. The DID of newly connected smart meters should be registered on the blockchain by an authorized agency (such as the power company) and written into the corresponding DID document.
[0062] For example, DID documents can be in JSON-LD format, designed according to "JSON-LD 1.1 A JSON-based Serialization for Linked Data". A DID document includes metadata such as the public key and service information of the DID subject.
[0063] For example, for smart energy meters with carbon metering, the DID document should include at least the following: DID: The DID of a smart energy meter with carbon metering is unique to that smart energy meter. VerificationMethod: A list of public keys used for digital signatures in the carbon-metered smart energy meter. Each public key should include a unique identifier (such as key ID), type (such as SM2), and public key value. The manufacturer can generate a key pair (including a public key and a private key) for the carbon-metered smart energy meter at the factory and write the public key into the DID document. Authentication: The verification method used to authenticate the identity of the carbon metering smart energy meter should reference the public key in verificationMethod. For example, the public key corresponding to the master private key under the carbon metering smart energy meter DID can be specified as the authentication key; Service: A list of service endpoints that describes the services provided by the carbon metering smart energy meter. For example, a carbon metering smart energy meter can define a data service endpoint that points to the address of its energy information acquisition terminal or data cache, and the service type can be defined as MeterReadingService.
[0064] For example, in step S150, the detection device can determine whether the first timestamp and the second timestamp meet a preset time threshold. If the first timestamp and the second timestamp meet the preset time threshold, the detection device verifies the digital signature of at least one set of metering data fields on the blockchain based on the decentralized identity identifier and corresponding public key of the smart meter.
[0065] The detection device can parse the decentralized identity identifier declared by the smart meter, obtain the corresponding decentralized identity identifier document, and extract the public key from the decentralized identity identifier document.
[0066] The testing device can use a public key to verify the digital signature of at least one set of measurement data fields on the blockchain.
[0067] If either the first or second timestamp fails to meet the preset time threshold, the detection device outputs a detection result indicating that the smart metering instrument time synchronization verification has failed, and stops the detection.
[0068] Optionally, the preset time threshold condition is that the first difference and the second difference satisfy a preset difference range. The first difference is determined based on the first timestamp and the standard time, and the second difference is determined based on the second timestamp and the standard time.
[0069] According to the example embodiment, the preset difference range can be the maximum allowable threshold (e.g., ±2 seconds) of the first difference and the second difference.
[0070] The technical solution of this application can determine whether the first timestamp and the second timestamp meet the preset time threshold condition by using the first difference and the second difference.
[0071] In step S160, if the digital signature meets the preset pass conditions, the detection result is output.
[0072] According to the example embodiment, the preset pass conditions can be the verification pass conditions for digital signatures. For example, in step S160, the detection device determines whether the digital signature meets the preset pass conditions. If the digital signature meets the preset pass conditions, it indicates that the digital signature verification is valid and the data content has not been tampered with. The detection device can output detection results indicating successful verification of the smart meter calculation logic, successful verification of data integrity and consistency calibration on the blockchain, successful verification of the immutability of on-chain data, successful verification of time synchronization, and successful verification of the validity of the data digital signature.
[0073] If the digital signature does not meet the preset pass conditions, the detection device will output a detection result indicating that the validity verification of the digital signature of the smart metering instrument data has failed, and stop the detection.
[0074] Optionally, the default pass condition is that the digital signature matches the measurement data field. For example, the default pass condition is that the digital signature verification pass rate is 100%.
[0075] The technical solution of this application can determine whether a digital signature meets the preset pass conditions by measuring the pass rate of digital signature verification.
[0076] Through the above embodiments, the technical solution of this application can inject a preset dynamic factor into the smart metering instrument, so that the smart metering instrument can determine the calculation result of the metering data according to the preset dynamic factor. The technical solution of this application can trigger the smart metering instrument to go on-chain when the metering result is consistent with the corresponding theoretical result, so as to read the local data of the smart metering instrument and the on-chain data parsed from the blockchain; the technical solution of this application can determine the first hash value and the second hash value corresponding to the preset data packet of the blockchain when the on-chain data and the local data are consistent.
[0077] The technical solution of this application can trigger metering time at a standard time when the first hash value equals the second hash value, thereby obtaining a first timestamp corresponding to the smart meter and a second timestamp corresponding to the blockchain. The technical solution of this application can verify the digital signature of at least one set of metering data fields on the blockchain based on the decentralized identity identifier and corresponding public key of the smart meter when the first and second timestamps meet a preset time threshold condition. The technical solution of this application can output the detection result when the digital signature meets a preset pass condition.
[0078] The technical solution of this application uses "blockchain + DID + asymmetric encryption algorithm" to verify the computational logic of smart metering instruments, the integrity and consistency calibration of data on the chain, the immutability of on-chain data, the time synchronization, and the validity of data digital signatures. This can meet the needs of smart metering instruments for "dual control of carbon emissions" in new power systems.
[0079] The technical solution of this application incorporates the immutability of blockchain, the unforgeability of cryptographic digital signatures, and the synchronization of timestamps into the detection scope, which can intercept potential data fraud from multiple dimensions and ensure the authenticity and reliability of the measurement data of smart metering instruments.
[0080] The technical solution of this application extends the traditional metrological traceability system to the fields of blockchain and digital identity, making the metrological data of smart metering instruments traceable, and providing technical support for the traceability of carbon emission data under the dual control system for carbon emissions.
[0081] Optionally, see Figure 2 Step S130 may include steps S131-S132.
[0082] In step S131, the first hash value of the preset data packet in the blockchain is obtained.
[0083] According to the example embodiment, in step S131, the detection device can obtain the first hash value of the preset data packet in the blockchain.
[0084] The detection device connects to a full node or light node of the blockchain, calls the blockchain query interface (such as getTransactionReceipt (get transaction receipt), queryBlock (query block) etc.), queries the on-chain data packet corresponding to the specified transaction hash, extracts the data fingerprint field stored in it, and thus obtains the first hash value.
[0085] In step S132, the second hash value is determined based on the local data corresponding to the preset data packet.
[0086] According to the example embodiment, the detection device determines the second hash value based on the local data corresponding to the preset data packet. The detection device extracts the original data of the preset data packet that is backed up locally, and calculates the second hash value using the same hash algorithm (e.g., SM3 hash algorithm) as the on-chain calculation, according to the prescribed data serialization format (the field concatenation order and encoding method are completely consistent with those when the instrument is uploaded to the chain).
[0087] Through the above embodiments, the technical solution of this application can obtain the first hash value of a preset data packet on the blockchain. The technical solution of this application can determine the second hash value using the local data corresponding to the preset data packet.
[0088] The technical solution of this application establishes a dual hash verification mechanism that is independent and mutually restrictive by clearly distinguishing the source of the first hash value and the source of the second hash value. Since the two hash value sources are completely independent, the ability to verify the immutability of on-chain data is improved, thus enhancing the security of the detection method.
[0089] Optionally, see Figure 3 Step S150 may include steps S151-S154.
[0090] In step S151, the decentralized identity identifier declared by the smart meter is parsed.
[0091] According to an example embodiment, in step S151, the detection device parses the decentralized identity identifier declared by the smart meter.
[0092] The detection device can read decentralized identity identifiers from the memory of smart meters and initiate a resolution request through a universal resolver or a decentralized identity identifier resolution interface of a specific blockchain network to obtain the decentralized identity identifier.
[0093] In step S152, the decentralized identity identifier document corresponding to the decentralized identity identifier is obtained.
[0094] According to the example embodiment, in step S152, the detection device can obtain the decentralized identity identifier document corresponding to the decentralized identity identifier.
[0095] The detection device calls the blockchain decentralized identity identifier parsing interface to search for the JSON content of the decentralized identity identifier document corresponding to the decentralized identity identifier, parses the JSON structure, and extracts the values of each field.
[0096] In step S153, if the decentralized identity identifier document meets the preset specifications, the public key is extracted from the decentralized identity identifier document.
[0097] According to the example implementation, the preset specification can be a technical specification for decentralized identity. For example, the preset specification can be the W3C DID Core specification, etc.
[0098] In step S153, the detection device can verify whether the decentralized identity identifier document meets the preset specifications. If the decentralized identity identifier document meets the preset specifications, the detection device extracts the public key from the decentralized identity identifier document.
[0099] The "verificationMethod" array in the DID document contains the public key information associated with that DID, including a unique identifier (such as key ID), type (such as SM2), and public key value (publicKeyMultibase) for each public key entry. The detection device can locate the corresponding entry in the "verificationMethod" array of the decentralized identity document and extract the public key.
[0100] In step S154, if the public key meets the preset key conditions, the digital signature of at least one set of metering data fields in the blockchain is verified using the public key.
[0101] Optionally, the preset key conditions can be that the public key algorithm conforms to the national cryptographic asymmetric algorithm conditions, and the public key is in a valid state.
[0102] According to the example embodiment, in step S154, the detection device determines whether the public key meets the preset key conditions using a public key algorithm (e.g., the SM2 algorithm). If the public key meets the preset key conditions, the detection device verifies the digital signature of at least one set of metering data fields in the blockchain using the public key.
[0103] The detection device can perform SM2 signature verification by using the digital signature field of at least one set of metering data fields in the blockchain of the smart metering instrument.
[0104] Through the above embodiments, the technical solution of this application can parse the decentralized identity identifier declared by a smart meter. The technical solution of this application can obtain the decentralized identity identifier document corresponding to the decentralized identity identifier. The technical solution of this application can extract the public key from the decentralized identity identifier document if the document meets preset specifications. The technical solution of this application can verify the digital signature of at least one set of metering data fields in the blockchain using the public key if the public key meets preset key conditions.
[0105] The technical solution of this application incorporates the complete steps of decentralized identity identifier parsing and public key extraction into the detection process, ensuring the authority and credibility of the public key source. By verifying the validity of the digital signature, it can verify both the integrity of the data and that the data does indeed come from a legitimate smart meter with a specific decentralized identity identifier, thus solving the problem that traditional detection methods cannot verify the credibility of the data source.
[0106] According to one aspect of this application, this application provides a detection device for a smart metering instrument based on blockchain and DID. See also Figure 4 The detection device 20 includes a processing module 21, a dynamic factor simulation and injection module 22, a blockchain data verification and parsing module 23, a hash verification module 24, a time synchronization verification module 25, and a digital signature verification module 26.
[0107] The processing module 21 can be a host or server with data processing capabilities.
[0108] The dynamic factor simulation and injection module 22 can simulate or access authoritative preset dynamic factor sequence data streams in real time and inject them into the smart metering instrument.
[0109] The blockchain data verification and parsing module 23 can read and parse transaction data on the blockchain and extract relevant measurement fields and hash values.
[0110] The hash verification module 24 can be a standalone software or hardware tool used to perform hash calculations on the raw data and compare it with the on-chain fingerprint.
[0111] The time synchronization verification module 25 can be set with a high-precision time source, and the clock synchronization error does not exceed 1 millisecond.
[0112] See Figure 5 The digital signature verification module 26 may include a decentralized identity identifier (DID) parsing unit 261 and a digital signature verification unit 262. The decentralized identity identifier (DID) parsing unit 261 supports DID parsing, DID document retrieval, and public key extraction. The digital signature verification unit 262 supports signature verification using Chinese national cryptographic asymmetric algorithms, verifying the original data using the public key bound to the DID.
[0113] According to the example embodiment, the dynamic factor simulation and injection module 22 injects a preset dynamic factor sequence into the smart metering instrument so that the smart metering instrument can determine the calculation result of the metering data based on the preset dynamic factor sequence.
[0114] Intelligent metering instruments are metering devices that integrate microelectronics, computer, communication, and modern sensor technologies, capable of automatically collecting, processing, storing, and remotely transmitting metering data. The intelligent metering instruments in this application include, but are not limited to, smart energy meters, carbon-metered smart energy meters, smart carbon meters, smart water meters, smart gas meters, and smart heat meters, etc., and this application does not impose any limitations on these. For example, a carbon-metered smart energy meter can have a built-in security module (such as a cryptographic chip), be able to execute national cryptographic algorithms, and possess blockchain client functionality. It can not only measure active power but also synchronously measure carbon emissions based on dynamic carbon factors, achieving "synchronous carbon metering."
[0115] The preset dynamic factor sequence can serve as the test input parameters for evaluating the calculation function of the intelligent metering instrument. The calculation result can be the output of the intelligent metering instrument based on the preset dynamic factor sequence.
[0116] For example, a smart meter for measuring carbon emissions can have a preset dynamic factor sequence, which can be a dynamic carbon factor sequence. This dynamic carbon factor sequence can include dynamic carbon emission factors and corresponding metering data (e.g., electricity consumption data). The calculation result can be the carbon emissions. The carbon emissions can be the product of the electricity consumption data and the dynamic carbon emission factors.
[0117] For example, the dynamic factor simulation and injection module 22 injects a preset dynamic factor sequence into the smart metering instrument, triggering the smart metering instrument to determine the calculation result of the metering data based on the preset dynamic factor sequence.
[0118] Taking a carbon-metered smart energy meter as an example, the dynamic factor simulation and injection module 22 can send a configuration command containing a dynamic carbon factor sequence to the tested carbon-metered smart energy meter through a wired (such as RS-485 bus) or wireless communication interface, according to the agreed communication protocol, so that the carbon-metered smart energy meter updates its internal carbon factor data and triggers the recalculation of carbon emissions.
[0119] According to the example embodiment, the processing module 21 can determine whether the measurement result is consistent with the corresponding theoretical result. The theoretical result can be the theoretical value corresponding to a preset dynamic factor sequence.
[0120] When the measurement result is consistent with the corresponding theoretical result, the blockchain data verification and parsing module 23 triggers the smart metering instrument to go on the chain, so as to read the local data of the smart metering instrument and the on-chain data parsed from the blockchain.
[0121] Blockchain is a decentralized, distributed, and tamper-proof digital ledger network. By sharing and synchronizing data among multiple nodes in the network, and using cryptographic algorithms to ensure the security of data transmission and access, it can achieve data consistency, traceability, and non-repudiation.
[0122] For example, a blockchain could be a specific blockchain based on the BSN network that supports smart contracts and DID resolution services using national cryptographic algorithms, and can store information such as DID documents, metering data hash fingerprints, and digital signatures.
[0123] Local data can be a backup of the original metering data stored by smart meters on local storage media (such as the internal memory of the electricity meter, the database of the data acquisition master station, or the cloud backend database). Local data serves as the benchmark for verifying the consistency of on-chain data.
[0124] On-chain data refers to the data that smart meters write into the blockchain network through their internal blockchain data storage unit and are then stored in the distributed ledger of the blockchain.
[0125] Optionally, if the deviation between the calculated result and the corresponding theoretical result does not exceed a set error value, the measurement result is consistent with the corresponding theoretical result. For example, the set error value can be ±0.5%.
[0126] For example, the blockchain data verification and parsing module 23 sends an on-chain trigger command to the smart metering instrument. After the smart metering instrument completes a complete metering data acquisition and on-chain process, the detection device connects to the target blockchain node through the blockchain data verification tool, calls the blockchain query interface to read the latest on-chain transaction data, and parses out each metering data field (i.e., on-chain data). The blockchain data verification and parsing module 23 reads the corresponding data (i.e., local data) stored locally by the smart metering instrument through the communication interface.
[0127] If the measurement result is inconsistent with the corresponding theoretical result, the processing module 21 outputs a detection result indicating that the intelligent metering instrument calculation logic verification has failed and stops the detection.
[0128] Processing module 21 determines whether there is consistency between on-chain data and local data. For example, processing module 21 performs a field-by-field numerical comparison between on-chain data and local data.
[0129] If the on-chain data and local data are consistent, the hash verification module 24 determines the first hash value and the second hash value corresponding to the preset data packet of the blockchain.
[0130] According to the example implementation, consistency between on-chain data and local data can be achieved by comparing the values of on-chain data and local data field by field. If the on-chain data and local data are equal, the matching rate of key fields is 100%.
[0131] The preset data packet can be a specified data packet stored on the blockchain. The first hash value can be calculated by the smart meter when the preset data packet is uploaded to the blockchain and written along with the data. The second hash value can be the hash value calculated from the original data of the preset data packet backed up locally. The original data of the preset data packet backed up locally should also undergo the consistency verification in step S120.
[0132] The hash verification module 24 queries the on-chain data packet corresponding to the specified transaction hash through the blockchain node RPC interface and extracts the stored data fingerprint field (i.e., the first hash value). The hash verification module 24 extracts the original data packet of the preset data packet (which may contain all key fields such as timestamp, power value, carbon factor value, carbon emission value, and DID field), and independently calculates the second hash value using the SM3 hash algorithm according to the prescribed data serialization order (the same field concatenation method as when the meter is uploaded to the chain).
[0133] If there is no consistency between the on-chain data and the local data, the processing module 21 will output a detection result indicating that the calibration verification of the integrity and consistency of the smart metering instrument data on the chain has failed, and stop the detection.
[0134] Processing module 21 determines whether the first hash value is equal to the second hash value. Time synchronization verification module 25, if the first hash value equals the second hash value, triggers the metering time at the standard time to obtain the first timestamp corresponding to the smart meter and the second timestamp corresponding to the blockchain.
[0135] According to the example embodiment, if the first hash value is equal to the second hash value, it proves that the data in the preset data packet stored on the blockchain is completely consistent with the original local data and the data has not been tampered with.
[0136] The first timestamp can be the timestamp of the data generated by the smart metering instrument, which records a specific moment (i.e., the standard moment) based on a standard time base and synchronously triggers a metering event. The second timestamp can be the block timestamp of the blockchain transaction corresponding to the metering event.
[0137] For example, the time synchronization verification module 25 records a standard time using a high-precision time source and simultaneously sends a trigger command for the metering event to the smart metering instrument. Upon receiving the trigger command, the smart metering instrument collects the current metering data, records the data using its internal clock to generate a first timestamp, and immediately performs the data uploading operation to the blockchain. When packaging the transaction, the blockchain network determines the block timestamp (i.e., the second timestamp) based on the clock synchronized by each consensus node using the Network Time Protocol (NTP). The detection device reads the second timestamp.
[0138] If the first hash value is not equal to the second hash value, the processing module 21 outputs a detection result indicating that the data immutability verification on the smart metering instrument chain has failed, and stops the detection.
[0139] Processing module 21 can determine whether the first timestamp and the second timestamp meet a preset time threshold. Digital signature verification module 26, if the first timestamp and the second timestamp meet the preset time threshold, verifies the digital signature of at least one set of metering data fields on the blockchain based on the decentralized identity identifier and corresponding public key of the smart meter.
[0140] Optionally, the first difference and the second difference satisfying a preset time threshold condition means that the first timestamp and the second timestamp satisfy the preset time threshold condition. The first difference is determined based on the first timestamp and the standard time, and the second difference is determined based on the second timestamp and the standard time.
[0141] According to the example embodiment, the preset time threshold condition can be that the first difference between the first timestamp and the standard time and the second difference between the second timestamp and the standard time do not exceed the maximum allowable threshold (e.g., ±2 seconds).
[0142] Each smart meter should have a unique decentralized identity identifier (DID). The format of the decentralized identity identifier can refer to the DID data model design in "Recommendation Decentralized Identifiers (DIDs) v1.0". The DID of the smart meter can be generated when it is connected to the blockchain network during its factory calibration. The generation method should preferably adopt a decentralized method, such as generating it based on the serial number of the smart energy meter or public key hashing. Service layer 13 can provide a DID registration smart contract interface. The DID of newly connected smart meters should be registered on the blockchain by an authorized agency (such as the power supply company) and written into the corresponding DID document.
[0143] DID documents can be in JSON-LD format, designed according to "JSON-LD 1.1 A JSON-based Serialization for Linked Data". A DID document includes metadata such as the public key and service information of the DID subject.
[0144] For example, for smart energy meters with carbon metering, the DID document should include at least the following: DID: The DID of a smart energy meter with carbon metering is unique to that smart energy meter. VerificationMethod: A list of public keys used for digital signatures in the carbon-metered smart energy meter. Each public key should include a unique identifier (such as key ID), type (such as SM2), and public key value. The manufacturer can generate a key pair (including a public key and a private key) for the carbon-metered smart energy meter at the factory and write the public key into the DID document. Authentication: The verification method used to authenticate the identity of the carbon metering smart energy meter should reference the public key in verificationMethod. For example, the public key corresponding to the master private key under the carbon metering smart energy meter DID can be specified as the authentication key; Service: A list of service endpoints that describes the services provided by the carbon metering smart energy meter. For example, a carbon metering smart energy meter can define a data service endpoint that points to the address of its energy information acquisition terminal or data cache, and the service type can be defined as MeterReadingService.
[0145] For example, the digital signature verification module 26 can parse the decentralized identity identifier declared by the smart meter, obtain the corresponding decentralized identity identifier document, and extract the public key from the decentralized identity identifier document.
[0146] The digital signature verification module 26 can use a public key to verify the digital signatures of at least one set of metering data fields on the blockchain.
[0147] If either the first or second timestamp fails to meet the preset time threshold, the processing module 21 outputs a detection result indicating that the smart metering instrument time synchronization verification has failed, and stops the detection.
[0148] Processing module 21 determines whether the digital signature meets the preset pass conditions. If the digital signature meets the preset pass conditions, processing module 21 outputs the detection result.
[0149] Optionally, the default pass condition is that the digital signature matches the measurement data field. For example, the default pass condition is that the digital signature verification pass rate is 100%.
[0150] For example, if the digital signature meets the preset pass conditions, it indicates that the digital signature verification is valid and the data content has not been tampered with. The processing module 21 can output the detection results of successful verification of the smart meter calculation logic, successful verification of data integrity and consistency calibration on the chain, successful verification of the immutability of on-chain data, successful verification of time synchronization, and successful verification of the validity of the data digital signature.
[0151] If the digital signature does not meet the preset pass conditions, the processing module 21 outputs a detection result indicating that the digital signature validity verification of the smart metering instrument data has failed, and stops the detection.
[0152] Through the above embodiments, the technical solution of this application can inject a preset dynamic factor into the smart metering instrument, so that the smart metering instrument can determine the calculation result of the metering data according to the preset dynamic factor. The technical solution of this application can trigger the smart metering instrument to go on-chain when the metering result is consistent with the corresponding theoretical result, so as to read the local data of the smart metering instrument and the on-chain data parsed from the blockchain; the technical solution of this application can determine the first hash value and the second hash value corresponding to the preset data packet of the blockchain when the on-chain data and the local data are consistent.
[0153] The technical solution of this application can trigger metering time at a standard time when the first hash value equals the second hash value, thereby obtaining a first timestamp corresponding to the smart meter and a second timestamp corresponding to the blockchain. The technical solution of this application can verify the digital signature of at least one set of metering data fields on the blockchain based on the decentralized identity identifier and corresponding public key of the smart meter when the first and second timestamps meet a preset time threshold condition. The technical solution of this application can output the detection result when the digital signature meets a preset pass condition.
[0154] The technical solution of this application uses "blockchain + DID + asymmetric encryption algorithm" to verify the computational logic of smart metering instruments, the integrity and consistency calibration of data on the chain, the immutability of on-chain data, the time synchronization, and the validity of data digital signatures. This can meet the needs of smart metering instruments for "dual control of carbon emissions" in new power systems.
[0155] The technical solution of this application incorporates the immutability of blockchain, the unforgeability of cryptographic digital signatures, and the synchronization of timestamps into the detection scope, which can intercept potential data fraud from multiple dimensions and ensure the authenticity and reliability of the measurement data of smart metering instruments.
[0156] The technical solution of this application extends the traditional metrological traceability system to the fields of blockchain and digital identity, making the metrological data of smart metering instruments traceable, and providing technical support for the traceability of carbon emission data under the dual control system for carbon emissions.
[0157] Optionally, the hash verification module 24 obtains the first hash value of the preset data packet on the blockchain.
[0158] According to the example embodiment, the hash verification module 24 can obtain the first hash value of the preset data packet in the blockchain.
[0159] The hash verification module 24 connects to the full node or light node of the blockchain, calls the blockchain query interface (such as getTransactionReceipt (get transaction receipt), queryBlock (query block) etc.), queries the on-chain data packet corresponding to the specified transaction hash, extracts the data fingerprint field stored therein, and thus obtains the first hash value.
[0160] The hash verification module 24 determines the second hash value based on the local data corresponding to the preset data packet.
[0161] According to the example embodiment, the hash verification module 24 determines the second hash value based on the local data corresponding to the preset data packet. The hash verification module 24 extracts the original data of the preset data packet that is backed up locally, and calculates the second hash value using the same hash algorithm (e.g., SM3 hash algorithm) as the on-chain calculation, according to the prescribed data serialization format (the field concatenation order and encoding method are completely consistent with those when the instrument is uploaded to the chain).
[0162] Through the above embodiments, the technical solution of this application can obtain the first hash value of a preset data packet on the blockchain. The technical solution of this application can determine the second hash value using the local data corresponding to the preset data packet.
[0163] The technical solution of this application establishes a dual hash verification mechanism that is independent and mutually restrictive by clearly distinguishing the source of the first hash value and the source of the second hash value. Since the two hash value sources are completely independent, the ability to verify the immutability of on-chain data is improved, thus enhancing the security of the detection method.
[0164] Optionally, the decentralized identity identifier parsing unit 261 parses the decentralized identity identifier declared by the smart meter.
[0165] According to the example embodiment, the decentralized identity identifier resolution unit 261 can read the decentralized identity identifier from the memory of the smart meter and initiate a resolution request through the Universal Resolver or the decentralized identity identifier resolution interface of a specific blockchain network to resolve and obtain the decentralized identity identifier.
[0166] Decentralized Identity Token Parsing Unit 261 retrieves the decentralized identity token document corresponding to the decentralized identity token. Decentralized Identity Token Parsing Unit 261 calls the blockchain decentralized identity token parsing interface to search for the JSON content of the decentralized identity token document corresponding to the decentralized identity token, parses the JSON structure, and extracts the values of each field.
[0167] According to the example embodiment, the decentralized identity identifier parsing unit 261 can verify whether the decentralized identity identifier document meets a preset specification. The preset specification can be a technical specification for decentralized identity. For example, the preset specification can be the W3C DID Core specification, etc.
[0168] The decentralized identity identifier parsing unit 261 extracts the public key from the decentralized identity identifier document if the document meets the preset specifications.
[0169] The "verificationMethod" array in the DID document contains the public key information associated with that DID, including a unique identifier (such as key ID), type (such as SM2), and public key value (publicKeyMultibase) for each public key entry. The detection device can locate the corresponding entry in the "verificationMethod" array of the decentralized identity document and extract the public key.
[0170] The decentralized identity identifier resolution unit 261 can determine whether a public key meets the preset key requirements using a public key algorithm (such as the SM2 algorithm). Optionally, the preset key requirements can be that the public key algorithm of the public key conforms to the national cryptographic asymmetric algorithm requirements, and the public key is in a valid state.
[0171] The digital signature verification unit 262 verifies the digital signature of at least one set of metering data fields in the blockchain using the public key, provided that the public key meets the preset key conditions.
[0172] The digital signature verification unit 262 can perform SM2 signature verification operations through the digital signature fields of at least one set of metering data fields in the blockchain of the smart metering instrument.
[0173] Through the above embodiments, the technical solution of this application can parse the decentralized identity identifier declared by a smart meter. The technical solution of this application can obtain the decentralized identity identifier document corresponding to the decentralized identity identifier. The technical solution of this application can extract the public key from the decentralized identity identifier document if the document meets preset specifications. The technical solution of this application can verify the digital signature of at least one set of metering data fields in the blockchain using the public key if the public key meets preset key conditions.
[0174] The technical solution of this application incorporates the complete steps of decentralized identity identifier parsing and public key extraction into the detection process, ensuring the authority and credibility of the public key source. By verifying the validity of the digital signature, it can verify both the integrity of the data and that the data does indeed come from a legitimate smart meter with a specific decentralized identity identifier, thus solving the problem that traditional detection methods cannot verify the credibility of the data source.
[0175] According to another aspect of this application, this application also provides a non-volatile computer-readable storage medium storing a computer program thereon, which, when executed by a processor, can implement the detection method of the smart metering instrument based on blockchain and DID as described above.
[0176] According to another aspect of this application, this application also provides an electronic device, including: one or more processors; and a storage device for storing one or more programs, which, when executed by one or more processors, enable the one or more processors to implement the detection method of the smart metering instrument based on blockchain and DID as described above.
[0177] According to another aspect of this application, this application also provides a computer program product, including: a computer program stored on a computer-readable storage medium; the computer program includes program instructions, which, when executed by a computer, cause the computer to perform the detection method of the smart metering instrument based on blockchain and DID as described above.
[0178] Finally, it should be noted that the above description is merely a preferred embodiment of this application and is not intended to limit this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions of the foregoing embodiments or make equivalent substitutions for some of the technical features. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A detection method for smart metering instruments based on blockchain and DID, characterized in that, The detection method includes: A preset dynamic factor sequence is injected into the smart metering instrument so that the smart metering instrument can determine the calculation result of the metering data based on the preset dynamic factor sequence; If the measurement result is consistent with the corresponding theoretical result, the smart metering instrument is triggered to go on the blockchain to read the local data of the smart metering instrument and the on-chain data parsed from the blockchain. If the on-chain data and the local data are consistent, determine the first hash value and the second hash value corresponding to the preset data packet of the blockchain; When the first hash value is equal to the second hash value, the metering time is triggered at the standard time to obtain the first timestamp corresponding to the smart meter and the second timestamp corresponding to the blockchain; When the first timestamp and the second timestamp meet the preset time threshold condition, the digital signature of at least one set of metering data fields of the blockchain is verified based on the decentralized identity identifier and the corresponding public key of the smart meter. If the digital signature meets the preset pass conditions, the detection result is output.
2. The detection method according to claim 1, characterized in that, The determination of the first hash value and the second hash value corresponding to the preset data packet includes: Obtain the first hash value of the preset data packet in the blockchain; The second hash value is determined based on the local data corresponding to the preset data packet.
3. The detection method according to claim 1, characterized in that, The preset time threshold condition is that the first difference and the second difference satisfy a preset difference range; The first difference is determined based on the first timestamp and the standard time, and the second difference is determined based on the second timestamp and the standard time.
4. The detection method according to claim 1, characterized in that, The verification of the digital signature of at least one set of metering data fields in the blockchain based on the decentralized identity identifier and corresponding public key of the smart meter includes: Parse the decentralized identity identifier declared by the smart metering instrument; Obtain the decentralized identity identifier document corresponding to the decentralized identity identifier; If the decentralized identity identifier document meets the preset specifications, the public key is extracted from the decentralized identity identifier document; When the public key meets the preset key conditions, the digital signature of at least one set of metering data fields of the blockchain is verified using the public key.
5. The detection method according to claim 4, characterized in that, The preset key conditions are that the public key algorithm of the public key conforms to the national cryptographic asymmetric algorithm conditions, and the public key is in a valid state.
6. The detection method according to claim 4, characterized in that, The preset pass condition is that the digital signature matches the measurement data field.
7. The detection method according to claim 1, characterized in that, If the deviation between the calculated result and the corresponding theoretical result does not exceed the set error value, the measurement result is consistent with the corresponding theoretical result.
8. A detection device for a smart metering instrument based on blockchain and DID, characterized in that, The detection device includes: The dynamic factor simulation and injection module injects a preset dynamic factor sequence into the smart metering instrument, so that the smart metering instrument can determine the calculation result of the metering data according to the preset dynamic factor sequence. The processing module determines whether the measurement results are consistent with the corresponding theoretical results. The blockchain data verification and parsing module triggers the smart metering instrument to go on-chain when the measurement result is consistent with the corresponding theoretical result, so as to read the local data of the smart metering instrument and the on-chain data parsed from the blockchain. The processing module determines whether the on-chain data and the local data are consistent. The hash verification module determines the first hash value and the second hash value corresponding to the preset data packet of the blockchain when the on-chain data and the local data are consistent. The processing module determines whether the first hash value is equal to the second hash value; The time synchronization verification module, when the first hash value is equal to the second hash value, triggers the metering time at a standard time to obtain the first timestamp corresponding to the smart metering instrument and the second timestamp corresponding to the blockchain; The processing module determines whether the first timestamp and the second timestamp meet the preset time threshold condition; The digital signature verification module verifies the digital signature of at least one set of metering data fields in the blockchain based on the decentralized identity identifier and corresponding public key of the smart metering instrument, provided that the first timestamp and the second timestamp meet a preset time threshold condition. The processing module determines whether the digital signature meets the preset pass conditions, and outputs the detection result if the digital signature meets the preset pass conditions.
9. A non-volatile computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the detection method as described in any one of claims 1-7.
10. An electronic device, characterized in that, include: One or more processors; Storage device for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the detection method as described in any one of claims 1-7.