Blockchain-based power event management method, device, equipment and medium
By introducing blockchain technology and dual indexes into power event management, a behavioral data chain of power events and power resources is constructed, which solves the problem of power data tampering and realizes high-reliability management of power events and multi-dimensional data traceability.
Patent Information
- Application Number
- CN202511272254.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-08
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2045-09-08
AI Technical Summary
Traditional power event management systems are prone to power data tampering, resulting in low credibility of power events.
Blockchain technology is used to construct an event record index for power events and a state change index for power resources, forming a behavioral data chain to ensure the mapping relationship between power events and power resources, and hash processing is used to ensure the immutability of the data.
It improves the credibility of power events, ensures the security and reliability of power event records, and supports multi-dimensional data tracking and tracing.
Smart Images

Figure CN120780709B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to a blockchain-based method, apparatus, device, and medium for power event management. Background Technology
[0002] With the rapid development of the power industry, more and more power-related incidents have occurred, and how to effectively manage these incidents has become an urgent problem to be solved.
[0003] In traditional technologies, power events are typically managed by local management systems within the power industry. However, this approach is prone to data tampering, resulting in low credibility of power events. Summary of the Invention
[0004] Therefore, it is necessary to provide a blockchain-based power event management method, device, equipment, and medium that can improve the credibility of power events in response to the above-mentioned technical problems.
[0005] Firstly, this application provides a blockchain-based method for managing power events, applied to a blockchain platform, including:
[0006] When an event record for a power event is received from the power management system, the power event identifier and the resource identifier of the power resource associated with the power event are extracted from the event record.
[0007] Based on power event identifiers, construct an event record index for power events;
[0008] When a power resource's state changes due to a power event, a state change index for the power resource is constructed based on the resource identifier;
[0009] The behavioral data chain of power events is determined based on the event record index and the state change index; the behavioral data chain is used to characterize the mapping relationship between power events and power resources.
[0010] In one embodiment, the blockchain-based power event management method further includes:
[0011] The event record is hashed to obtain its hash value.
[0012] Based on power event identifiers, an event record index for power events is constructed, including:
[0013] The event record index of the power event is obtained by combining the power event identifier, hash value, and resource identifier.
[0014] In one embodiment, when a power resource triggers a state change due to a power event, a state change index for the power resource is constructed based on the resource identifier, including:
[0015] When a power resource's state changes due to a power event, the resource status information of the power resource is obtained.
[0016] Extract the resource identifier of the power resource from the resource status information;
[0017] An index of power resource status changes is constructed based on resource identifiers and power event identifiers.
[0018] In one embodiment, the power event includes at least one target power event, the event record index includes a target event record index of the target power event, the state change index includes at least one target state change index, and the target state change index corresponds one-to-one with the target event record index.
[0019] The behavioral data chain of power events is determined based on the event log index and state change index, including:
[0020] Obtain the first index generation time for each target event record index, and the second index generation time for each target state change index;
[0021] The event data chain is obtained by arranging the target event record indexes in order of the first index generation time, and the state data chain is obtained by arranging the target state change indexes in order of the second index generation time.
[0022] The event data chain and the state data chain are merged to obtain the behavior data chain.
[0023] In one embodiment, the blockchain-based power event management method further includes:
[0024] In response to a power event query request, extract the query identifier from the power event query request;
[0025] Query path matching is performed based on query identifiers to obtain query paths that match the query identifiers.
[0026] The query results for power events are obtained by querying the data chain of the query path.
[0027] In one embodiment, when an event record for a power event is received from the power management system, the power event identifier of the power event is extracted from the event record, including:
[0028] When an event record for a power event is received from the power management system, a compliance verification is performed on the power event based on the event record to obtain the compliance verification result of the power event.
[0029] If the compliance verification result meets the compliance conditions, extract the power event identifier of the power event from the event record.
[0030] Secondly, this application also provides a blockchain-based power event management device, applied to a blockchain platform, comprising:
[0031] The identifier extraction module is used to extract the power event identifier of the power event and the resource identifier of the power resource associated with the power event from the event record reported by the power management system when it receives the event record of the power event.
[0032] The event log index building module is used to build an event log index for power events based on power event identifiers;
[0033] The state change index construction module is used to construct a state change index of power resources based on resource identifiers when the state of power resources is triggered by power events.
[0034] The behavior data chain generation module is used to determine the behavior data chain of power events based on the event record index and the state change index; the behavior data chain is used to characterize the mapping relationship between power events and power resources.
[0035] Thirdly, this application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0036] When an event record for a power event is received from the power management system, the power event identifier and the resource identifier of the power resource associated with the power event are extracted from the event record.
[0037] Based on power event identifiers, construct an event record index for power events;
[0038] When a power resource's state changes due to a power event, a state change index for the power resource is constructed based on the resource identifier;
[0039] The behavioral data chain of power events is determined based on the event record index and the state change index; the behavioral data chain is used to characterize the mapping relationship between power events and power resources.
[0040] Fourthly, this application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, performs the following steps:
[0041] When an event record for a power event is received from the power management system, the power event identifier and the resource identifier of the power resource associated with the power event are extracted from the event record.
[0042] Based on power event identifiers, construct an event record index for power events;
[0043] When a power resource's state changes due to a power event, a state change index for the power resource is constructed based on the resource identifier;
[0044] The behavioral data chain of power events is determined based on the event record index and the state change index; the behavioral data chain is used to characterize the mapping relationship between power events and power resources.
[0045] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, performs the following steps:
[0046] When an event record for a power event is received from the power management system, the power event identifier and the resource identifier of the power resource associated with the power event are extracted from the event record.
[0047] Based on power event identifiers, construct an event record index for power events;
[0048] When a power resource's state changes due to a power event, a state change index for the power resource is constructed based on the resource identifier;
[0049] The behavioral data chain of power events is determined based on the event record index and the state change index; the behavioral data chain is used to characterize the mapping relationship between power events and power resources.
[0050] The aforementioned blockchain-based power event management method, apparatus, computer equipment, computer-readable storage medium, and computer program product are applied to a blockchain platform. When the blockchain platform receives event records of power events reported by the power management system, it first extracts the power event identifier and the resource identifier of the associated power resource from the event records. An event record index for the power event is then constructed based on the power event identifier. Furthermore, when a power resource undergoes a state change due to a power event, a state change index for the power resource is constructed based on the resource identifier. Finally, the behavioral data chain of the power event is determined based on the event record index and the state change index, which represents the mapping relationship between the power event and the power resource. Therefore, this application, on the one hand, introduces blockchain technology for power event management. Leveraging the decentralized, immutable, and transparent characteristics of blockchain, it effectively prevents the risk of power event record loss and tampering, ensuring the security and reliability of power event records, thereby improving the credibility of power events. On the other hand, a dual indexing technology is introduced, namely, constructing an event record index for power events and an index for the state changes of power resources affected by power events, ultimately forming a clear data chain of power event behavior. This aims to fully record the entire process of power events and the full-cycle state of power resources under the influence of power events, further improving the credibility of power events. Attached Figure Description
[0051] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0052] Figure 1 This is a diagram illustrating the application environment of a blockchain-based power event management method in one embodiment.
[0053] Figure 2 This is a flowchart illustrating a blockchain-based power event management method in one embodiment.
[0054] Figure 3 This is a schematic diagram of the behavioral data chain in one embodiment;
[0055] Figure 4 This is a flowchart illustrating the process of constructing a behavioral data chain in one embodiment;
[0056] Figure 5 This is a flowchart illustrating the power event query process in one embodiment;
[0057] Figure 6This is a flowchart illustrating the compliance verification process for power events in one embodiment.
[0058] Figure 7 This is a flowchart illustrating a blockchain-based power event management method in a specific embodiment.
[0059] Figure 8 This is a structural block diagram of a blockchain-based power event management device in one embodiment;
[0060] Figure 9 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0061] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0062] It should be noted that the terms "comprising" and "having," and any variations thereof, as used in this application, are intended to cover non-exclusive inclusion. The term "multiple" as used in this application refers to two or more. The term "and / or" as used in this application refers to one of the solutions, or any combination of multiple solutions.
[0063] With the rapid development of the power industry, it is actively promoting electricity events such as carbon emissions from electricity consumption and green electricity consumption. How to effectively manage these electricity events has become a pressing issue. Traditionally, electricity event management is typically achieved through local management systems within the power industry. However, this approach is susceptible to data tampering, resulting in low credibility of electricity events.
[0064] Blockchain is a distributed database technology characterized by decentralization, immutability, and transparency. It can meet the power industry's needs for digital, visualized, and trusted management of the entire power event process. Therefore, this solution introduces blockchain technology to manage power events and ensure the credibility of power event records. Building on this, this solution further considers that traditional blockchain management often uses a single event record approach, only proving that a power event was recorded at a certain time, but failing to understand the entire chain of events, such as the changes in power resource status caused by the event. Therefore, traditional blockchain management methods have certain limitations, not only affecting the credibility of power event records but also making it difficult to support data traceability across different dimensions. To address these issues, this solution also introduces a dual-indexing technology: constructing an event record index for power events and a power resource status change index. The combination of these two index structures forms a clear data chain of power event behavior, further ensuring the credibility of power event records and supporting data traceability across different dimensions.
[0065] The blockchain-based power event management method provided in this application can be applied to, for example... Figure 1 In the application environment shown, the blockchain platform 102 communicates with the power management system 104 via a network. The power management system 104 is an information system used to manage and monitor various aspects of the power system; it can be a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing cloud computing services.
[0066] Specifically, when the blockchain platform 102 receives an event record for a power event reported by the power management system 104, it extracts the power event identifier and the resource identifier of the power resource associated with the power event from the event record. It then constructs an event record index for the power event based on the power event identifier. When a power resource triggers a state change due to a power event, a state change index for the power resource can be constructed based on the resource identifier. Finally, the behavioral data chain of the power event is determined based on the event record index and the state change index. This behavioral data chain is used to represent the mapping relationship between the power event and the power resource.
[0067] In one exemplary embodiment, such as Figure 2 As shown, a blockchain-based method for power event management is provided, which can be applied to... Figure 1 Taking blockchain platform 102 as an example, the following is an explanation:
[0068] Step S202: When an event record for a power event is received from the power management system, the power event identifier of the power event and the resource identifier of the power resource associated with the power event are extracted from the event record.
[0069] In this context, an electricity event can refer to a key operational node in the power management system that generates data changes or facilitates the flow of power resources. This can include, but is not limited to, at least one of green electricity trading, electricity metering, and carbon trading. Green electricity trading involves purchasing or selling renewable energy power, such as power companies connecting with photovoltaic and wind power generation companies through a power trading platform to purchase electricity with zero or near-zero carbon emissions during production. Electricity metering refers to the real-time reporting of actual electricity consumption by the power management system. Carbon trading, or carbon emission rights trading, involves setting total limits and quotas for greenhouse gas emissions, allowing companies to buy and sell quotas in the carbon emission rights market to achieve greenhouse gas emission reduction goals. An event record can be a record containing details of an electricity event. For example, the event record may include the type of electricity event (e.g., green electricity trading, electricity metering, carbon trading), the event identifier, the executing entity of the event (i.e., the direct participant or controller of the event, such as a power plant, smart meter, or carbon trading platform), the timestamp of the event, and the resource identifier of the power resources associated with the event. An electricity event identifier is a unique identifier for an electricity event. It can be an event number or other custom identifier. Electricity resources can be understood as the object entity of an electricity event, such as carbon data, green electricity resources, or green certificates. This embodiment aims to clearly identify the electricity resources affected by an electricity event, facilitating subsequent tracking of resource status. A resource identifier is a unique identifier for an electricity resource. It can be a resource number or other custom identifier.
[0070] For example, after detecting a power event, the power management system can automatically generate an event record for the power event and report the power event to the blockchain platform through the communication link between the power management system and the blockchain platform. After receiving the event record, the blockchain platform can extract the unique identifier of the power event and the unique identifier of the power resource associated with the power event from the event record, so as to facilitate the subsequent construction of an index structure.
[0071] In some embodiments, there can be multiple power events, and multiple power resources can be associated with each power event. For example, a power management system can simultaneously report event records for carbon emissions and green electricity trading, and green electricity trading can simultaneously affect both green electricity resources and carbon emission data.
[0072] In some embodiments, the power management system can be a single system or multiple different systems, such as a power trading platform, a carbon management system, and so on. In different system scenarios, each system can independently connect to the blockchain platform and transmit its own power event records to the blockchain platform.
[0073] Step S204: Construct an event record index for power events based on the power event identifier.
[0074] An index is an on-chain data structure that improves the efficiency of data retrieval in the blockchain. In this embodiment, the first step is to construct an event record index, which may include the type of power event, the power event identifier, the executing entity, the timestamp, and the resource identifier. The event record index can be used to construct an event data chain, that is, a complete link of a series of power events executed around power resources.
[0075] For example, after extracting the power event identifier, the blockchain platform can use the power event identifier as the primary key of the index, and use a smart contract to structure and store the fields in the event record as an on-chain index record. For instance, the event record index may include: Power Event Identifier: E001; Executing Entity: A; Power Event Type: Carbon Emission; Timestamp: Year Month Day; Resource Identifier: D001. It can be understood that one power event can correspond to one event record index.
[0076] Step S206: When a power resource triggers a state change due to a power event, construct a state change index for the power resource based on the resource identifier.
[0077] The state change index can be an index structure used to record changes in the state of power resources. Taking carbon emission data as an example, the state change index can include at least one of the following: measured, confirmed, traded, or written off. In addition to specific resource state types, the state change index can also record information such as resource identifiers, associated power event identifiers, and timestamps. The state change index can also be used to construct a state data chain, that is, the state of power resources at each stage under the influence of a series of power events.
[0078] For example, when a power resource undergoes a state change due to a power event, the blockchain platform can use the acquired resource identifier as the index key and store the relevant field information of the power resource in a structured manner as an on-chain index record through a smart contract. For instance, the state change index could include: Resource Identifier: D001; Resource Status: Measured; Timestamp: Year xx Month xx Day; Power Event Identifier: E001. It is understood that a state change index can exist for a power resource under the influence of different power events.
[0079] In some embodiments, the blockchain platform can obtain information on changes in power resources through the power management system. Specifically, when the power management system detects a change in the state of power resources, it reports the relevant information back to the blockchain platform. Alternatively, the power management system can report both the event record and the state change information to the blockchain platform after a power event triggers a change in the state of power resources.
[0080] In some embodiments, the event log index and state change index may be stored in an on-chain queryable structure, such as a mapping table embedded in a smart contract or an on-chain indexable node database.
[0081] Step S208: Determine the behavioral data chain of the power event based on the event record index and the state change index; the behavioral data chain is used to characterize the mapping relationship between the power event and the power resource.
[0082] The behavioral data chain can be understood as a logical data chain constructed by cross-referencing event record indexes and state change indexes. This logical data chain can include an event data chain constructed based on the event record index and a state data chain constructed based on the state change index.
[0083] For example, after constructing the event record index and the state change index, the event record index and the state change index can be combined to form a complete behavioral data chain. Figure 3 The diagram illustrates a behavioral data chain, where power events 1, 2, and 3 occur, corresponding to event record indexes 1, 2, and 3, respectively. Under the influence of these events, the power resources undergo state changes, resulting in state change indices 1, 2, and 3. Since event record index 1 is associated with state change index 1, event record index 2 with state change index 2, and event record index 3 with state change index 3, the event data chain, composed of these indices, is associated with the state data chain, also composed of these indices. Finally, combining the event data chain and the state data chain yields a complete behavioral data chain. This behavioral data chain clearly shows the entire process of power event behavior and the state changes of power resources throughout their lifecycle. This facilitates data traceability from different dimensions, such as querying resource status based on event identifiers or querying power events based on resource identifiers.
[0084] In some embodiments, the blockchain platform can use smart contracts to automatically query the behavioral data chain and output power event behavior reports to the power management system so that the power management system can perform auditing or generate resource proofs, etc.
[0085] In some embodiments, based on this behavioral data chain, the blockchain platform can query all power events and corresponding power resource changes for a given entity, as well as all power events affecting a specific power resource, and the preceding and following power events of a given power event. The query interface can be designed to support multi-dimensional queries by entity, power event identifier, resource identifier, power event type, etc.
[0086] In this embodiment, when the blockchain platform receives an event record for a power event reported by the power management system, it first extracts the power event identifier and the resource identifier of the associated power resource from the event record. An event record index for the power event is then constructed based on the power event identifier. When a power resource undergoes a state change due to the power event, a state change index for the power resource is constructed based on the resource identifier. Finally, the behavioral data chain of the power event is determined based on the event record index and the state change index, which represents the mapping relationship between the power event and the power resource. Therefore, this embodiment, on the one hand, introduces blockchain technology for power event management. Leveraging the decentralized, immutable, and transparent characteristics of blockchain, it effectively prevents the risk of power event record loss and tampering, ensuring the security and reliability of power event records, thereby improving the credibility of power events. On the other hand, it introduces a dual indexing technique, namely, constructing an event record index for the power event and a state change index for the power resource affected by the power event, ultimately forming a clear behavioral data chain for the power event. This aims to fully record the entire process of the power event and the full-cycle state of the power resource under the influence of the power event, further improving the credibility of power events.
[0087] In one exemplary embodiment, the blockchain-based power event management method further includes: hashing the event records to obtain the hash value of the event records.
[0088] Hash processing is a process of transforming an input of arbitrary length into a fixed-length output using a hash function. Its core idea is to map data from a larger space to a smaller space using a hash function, while preserving certain characteristics of the data. In this embodiment, the event records of electricity events are converted into a fixed-length unique string using a hash function; this unique string is the hash value. The hash value can be used to subsequently build an event record index.
[0089] For example, after receiving an event record reported by the power management system, the blockchain can use at least one hash function, such as MD5, SHA-1, SHA-256, SHA-3, BLAKE2, etc., to hash the event record and obtain a hash value.
[0090] In some embodiments, an event record index for an power event is constructed based on the power event identifier, including: combining the power event identifier, hash value, and resource identifier to obtain the event record index for the power event.
[0091] For example, after obtaining the hash value of the event record, the power event identifier, hash value, and resource identifier can be combined and stored in a structured way as an on-chain index record to obtain the event record index.
[0092] In this embodiment, an event record index is constructed based on the hash value of the event record, the power event identifier, and the resource identifier. This ensures the integrity and immutability of the event record index and associates power events with power resources, which is beneficial for achieving efficient multi-dimensional data traceability in the future.
[0093] In an exemplary embodiment, when a power resource triggers a state change due to a power event, a state change index of the power resource is constructed based on the resource identifier, including: when a power resource triggers a state change due to a power event, obtaining resource state information of the power resource; extracting the resource identifier of the power resource from the resource state information; and constructing a state change index of the power resource based on the resource identifier and the power event identifier.
[0094] Resource status information is used to describe the changes in the status of electricity resources, and may include, but is not limited to, status type (such as measured, confirmed, traded, or written off), timestamp, resource type (such as carbon emission data or green electricity resources), and resource identifier.
[0095] For example, when a power resource undergoes a state change due to a power event, the blockchain platform can obtain the resource status information of the power resource. If there are multiple power resources, it can obtain the resource status information of each power resource separately. Resource identifiers are extracted from the resource status information, and then an index of the power resource's state change is constructed based on the resource identifiers and the power event identifiers.
[0096] In this embodiment, a state change index of power resources is constructed based on resource identifiers and power event identifiers, aiming to associate power resources with power events, so as to facilitate efficient multi-dimensional data traceability in the future.
[0097] In one exemplary embodiment, such as Figure 4 As shown, the behavioral data chain of power events is determined based on the event record index and the state change index, including:
[0098] Step S402: Obtain the first index generation time for each target event record index and the second index generation time for each target state change index.
[0099] The power events can include at least one target power event. A target power event can refer to a key operational node in the power management system that generates data changes or power resource flows, and can include, but is not limited to, any of green electricity trading, electricity metering, carbon trading, etc. The event record index can include the target event record index corresponding to each target power event. Similarly, the state change index can include at least one target state change index. A target state change index is an index structure that records a certain change state of power resources, such as measured, confirmed, traded, or written off. The target state change index and the target event record index can correspond one-to-one, meaning that a target power event will trigger a change in the power resource. The first index generation time can refer to the generation time of the target event record index, and the second index generation time can refer to the generation event of the target state change index.
[0100] For example, when there are multiple power events, the generation time of each target event record index and the generation time of each target state change index can be obtained separately for subsequent construction of event data chains and state data chains.
[0101] It is understandable that, given the existence of a power event, the event record index of that power event can independently form an event data chain, and the corresponding state change index can also independently form a state data chain.
[0102] Step S404: Arrange the target event record indexes sequentially according to the first index generation time to obtain the event data chain, and arrange the target state change indexes sequentially according to the second index generation time to obtain the state data chain.
[0103] For example, the event record indices are arranged sequentially according to the generation time of the first index to obtain an event data chain. Similarly, the state change indices are arranged sequentially according to the generation time of the second index to obtain a state data chain. Figure 3 For example, the event record index 1 was generated earlier than the event record index 2, and the event record index 2 was generated earlier than the event record index 3. Similarly, the state change index 1 was generated earlier than the state change index 2, and the state change index 2 was generated earlier than the state change index 3.
[0104] Step S406: Merge the event data chain and the state data chain to obtain the behavior data chain.
[0105] For example, the event data chain and state data chain obtained by merging are finally combined to obtain the behavior data chain. If a power event affects multiple power resources, the event data chain can be merged with each state data chain to obtain the behavior data chain.
[0106] In some embodiments, the behavioral data chain can also be based on power resources, such as the state data chain of a certain type of power resource, together with the event data chain corresponding to all power events that have triggered a state change of that power resource, to constitute the behavioral data chain.
[0107] In this embodiment, the indexes of each target event record and each target state change are arranged according to the index generation time to obtain the event data chain and the state data chain. Merging the event data chain and the state data chain yields a complete behavior data chain, which is beneficial for subsequent efficient multi-dimensional data tracing.
[0108] In one exemplary embodiment, such as Figure 5 As shown, blockchain-based power event management methods also include:
[0109] Step S502: In response to the power event query request, extract the query identifier from the power event query request.
[0110] In this context, a power event query request can refer to a request to query information related to a power event and / or information related to power resources associated with the power event. The query identifier can be an identifier for the query parameters, such as an event number or resource identifier, which serves as the primary key of the index. Of course, in practical applications, auxiliary queries can also be performed by selecting the execution subject, time range, etc. That is, this embodiment supports queries using a single parameter or queries combining multiple query parameters.
[0111] For example, upon receiving a power event query request, the blockchain platform can first extract the query parameter identifier from the power event query request for subsequent matching of query paths.
[0112] Step S504: Perform query path matching based on the query identifier to obtain the query path that matches the query identifier.
[0113] The query path refers to the information retrieval path selected based on the query parameters. The information retrieval path can be a bidirectional retrieval path. A forward retrieval can be understood as retrieving power resources from power events, while a reverse retrieval is retrieving power events from power resources. It should be noted that forward and reverse here do not refer to direction. A forward retrieval can also be retrieving power events from power resources, and a reverse retrieval can be retrieving power resources from power events.
[0114] For example, after obtaining the query identifier, the query path matching that identifier can be determined. For instance, if the query identifier is power event identifier E001, the query path is to query power resources from power events. Therefore, based on power event identifier E001, the associated resource identifier D001 can be found, and thus the resource status can be queried. Of course, if the query requirement only needs to query the event records of a power event, then the event record query can be performed directly based on power event identifier E001. Similarly, if the query identifier is resource identifier D001, then the event records of all associated power events can be traced based on resource identifier D001.
[0115] Step S506: Query the behavior data chain according to the query path to obtain the power event query results.
[0116] For example, after matching the query path based on the query identifier, the query behavior data chain can be queried according to the query path to obtain the power event query results, which may include, but are not limited to, at least one result such as event records, resource status, query duration, and query event stamp. For instance, if the query identifier is power event identifier E001, the associated resource identifier D001 can be queried, and then the status data chain can be queried to obtain the full life cycle changes of the power resource. If the query identifier is resource identifier D001, all power event identifiers associated with it can be queried, and then the behavior data chain can be queried to trace the behavior trajectory of the power event.
[0117] In this embodiment, query path matching is performed based on multi-dimensional query identifiers, thereby querying the behavior data chain according to the query path and obtaining the power event query results, which significantly improves the query efficiency of power data.
[0118] In one exemplary embodiment, such as Figure 6 As shown, when an event record for a power event is received from the power management system, the power event identifier of the power event is extracted from the event record, including:
[0119] Step S602: When an event record for a power event is received from the power management system, the power event is verified for compliance based on the event record to obtain the compliance verification result of the power event.
[0120] Step S604: If the compliance verification result meets the compliance conditions, extract the power event identifier of the power event from the event record.
[0121] The compliance verification result can be used to characterize whether an electricity event is compliant, specifically including two results: compliant and non-compliant. Compliance verification dimensions may include, but are not limited to, data integrity verification (e.g., whether required fields are missing or formatted incorrectly), and logical consistency verification (e.g., whether the electricity event matches the resource status). Of course, other verification methods can be set in practical applications; this embodiment does not limit the specific method of compliance verification. Compliance conditions refer to pre-set conditions for the compliance verification results. For example, if both the data integrity verification result and the logical consistency verification result pass, the electricity event is considered compliant. Conversely, if at least one of the data integrity verification result or the logical consistency verification result fails, the electricity event is considered non-compliant, and the event record can be refused on the blockchain.
[0122] For example, when receiving event records for a power event reported by the power management system, the blockchain platform can first perform data integrity verification on the event records. If the data integrity verification passes, it can then perform logical consistency verification on the power event. For instance, it can determine the preceding power event, obtain the resource status under the preceding power event, and consider the logical consistency verification to have passed if the resource status is logically consistent with the current power event. For example, a "carbon trading" event requires carbon data to be in a "confirmed rights" state. At this point, the power event can be considered compliant, and the blockchain platform can extract the power event identifier to proceed with the subsequent event record index construction process.
[0123] In this embodiment, by performing compliance verification on power events, the compliance of power events can be guaranteed, thereby further ensuring the credibility of power event records.
[0124] Figure 7 A flowchart of a blockchain-based power event management method is shown in a specific embodiment, applied to a blockchain platform. The steps include:
[0125] S1: When the blockchain platform receives event records for multiple target power events reported by the power management system, it performs compliance verification on each target power event based on the event records.
[0126] S2: If the compliance verification is passed, extract the target power event identifier of the target power event and the resource identifier of the power resources associated with the target power event from the event log;
[0127] S3: Perform hash processing on the event record to obtain the hash value of the event record;
[0128] S4: Use the power event identifier as the primary key of the index, and construct a target event record index for the target power event based on the hash value of the event record, the power event identifier, and the resource identifier;
[0129] S5: When a power resource triggers a state change due to a target power event, construct a target state change index for the power resource based on the target power event identifier and the resource identifier;
[0130] S6: Obtain the first index generation time for each target event record index and the second index generation time for each target state change index;
[0131] S7: Arrange the target event record indexes in the order of the first index generation time to obtain the event data chain; and arrange the target state change indexes in the order of the second index generation time to obtain the state data chain.
[0132] S8: Merge the event data chain and the state data chain to obtain the behavior data chain; the behavior data chain is used to characterize the mapping relationship between each target power event and power resources.
[0133] In this embodiment, when the blockchain platform receives an event record for a power event reported by the power management system, it first extracts the power event identifier and the resource identifier of the associated power resource from the event record. An event record index for the power event is then constructed based on the power event identifier. When a power resource undergoes a state change due to the power event, a state change index for the power resource is constructed based on the resource identifier. Finally, the behavioral data chain of the power event is determined based on the event record index and the state change index, which represents the mapping relationship between the power event and the power resource. Therefore, this embodiment, on the one hand, introduces blockchain technology for power event management. Leveraging the decentralized, immutable, and transparent characteristics of blockchain, it effectively prevents the risk of power event record loss and tampering, ensuring the security and reliability of power event records, thereby improving the credibility of power events. On the other hand, it introduces a dual indexing technique, namely, constructing an event record index for the power event and a state change index for the power resource affected by the power event, ultimately forming a clear behavioral data chain for the power event. This aims to fully record the entire process of the power event and the full-cycle state of the power resource under the influence of the power event, further improving the credibility of power events.
[0134] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages in other steps. It is understood that the steps in different embodiments can be freely combined as needed, and all non-contradictory solutions formed by such combinations are within the scope of protection of this application.
[0135] Based on the same inventive concept, this application also provides a blockchain-based power event management device for implementing the blockchain-based power event management method described above. The solution provided by this device is similar to the implementation described in the above method; therefore, the specific limitations of the one or more blockchain-based power event management device embodiments provided below can be found in the limitations of the blockchain-based power event management method described above, and will not be repeated here.
[0136] In one exemplary embodiment, such as Figure 8 As shown, a blockchain-based power event management device is provided, applied to a blockchain platform, including:
[0137] The identifier extraction module 802 is used to extract the power event identifier of the power event and the resource identifier of the power resource associated with the power event from the event record when it receives the event record of the power event reported by the power management system.
[0138] Event record index building module 804 is used to build an event record index of power events based on power event identifiers;
[0139] The state change index construction module 806 is used to construct a state change index of power resources based on resource identifiers when the state of power resources is triggered by power events.
[0140] The behavior data chain generation module 808 is used to determine the behavior data chain of power events based on the event record index and the state change index; the behavior data chain is used to characterize the mapping relationship between power events and power resources.
[0141] In one embodiment, the blockchain-based power event management device is further used to: hash the event records to obtain the hash value of the event records.
[0142] In one embodiment, the event record index building module 804 is further configured to: combine the power event identifier, hash value and resource identifier to obtain the event record index of the power event.
[0143] In one embodiment, the state change index construction module 806 is further configured to:
[0144] When a power resource's state changes due to a power event, the resource status information of the power resource is obtained.
[0145] Extract the resource identifier of the power resource from the resource status information;
[0146] An index of power resource status changes is constructed based on resource identifiers and power event identifiers.
[0147] In one embodiment, the power event includes at least one target power event, the event record index includes a target event record index of the target power event, the state change index includes at least one target state change index, and the target state change index corresponds one-to-one with the target event record index; the behavior data chain generation module 808 is further configured to:
[0148] Obtain the first index generation time for each target event record index, and the second index generation time for each target state change index;
[0149] The event data chain is obtained by arranging the target event record indexes in order of the first index generation time, and the state data chain is obtained by arranging the target state change indexes in order of the second index generation time.
[0150] The event data chain and the state data chain are merged to obtain the behavior data chain.
[0151] In one embodiment, the blockchain-based power event management device is also used for:
[0152] In response to a power event query request, extract the query identifier from the power event query request;
[0153] Query path matching is performed based on query identifiers to obtain query paths that match the query identifiers.
[0154] The query results for power events are obtained by querying the data chain of the query path.
[0155] In one embodiment, the identifier extraction module 802 is further configured to:
[0156] When an event record for a power event is received from the power management system, a compliance verification is performed on the power event based on the event record to obtain the compliance verification result of the power event.
[0157] If the compliance verification result meets the compliance conditions, extract the power event identifier of the power event from the event record.
[0158] The modules in the aforementioned blockchain-based power event management device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can invoke and execute the corresponding operations of each module.
[0159] In one exemplary embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 9 As shown, the computer device includes a processor, memory, input / output interfaces (I / O), and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operating system and computer programs in the non-volatile storage media to run. The database stores blockchain-based power event management data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network. When the computer program is executed by the processor, it implements a blockchain-based power event management method.
[0160] Those skilled in the art will understand that Figure 9 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0161] In one exemplary embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to perform the following steps:
[0162] When an event record for a power event is received from the power management system, the power event identifier and the resource identifier of the power resource associated with the power event are extracted from the event record.
[0163] Based on power event identifiers, construct an event record index for power events;
[0164] When a power resource's state changes due to a power event, a state change index for the power resource is constructed based on the resource identifier;
[0165] The behavioral data chain of power events is determined based on the event record index and the state change index; the behavioral data chain is used to characterize the mapping relationship between power events and power resources.
[0166] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0167] The event record is hashed to obtain its hash value.
[0168] Based on power event identifiers, an event record index for power events is constructed, including:
[0169] The event record index of the power event is obtained by combining the power event identifier, hash value, and resource identifier.
[0170] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0171] When a power resource's state changes due to a power event, the resource status information of the power resource is obtained.
[0172] Extract the resource identifier of the power resource from the resource status information;
[0173] An index of power resource status changes is constructed based on resource identifiers and power event identifiers.
[0174] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0175] Obtain the first index generation time for each target event record index, and the second index generation time for each target state change index;
[0176] The event data chain is obtained by arranging the target event record indexes in order of the first index generation time, and the state data chain is obtained by arranging the target state change indexes in order of the second index generation time.
[0177] The event data chain and the state data chain are merged to obtain the behavior data chain.
[0178] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0179] In response to a power event query request, extract the query identifier from the power event query request;
[0180] Query path matching is performed based on query identifiers to obtain query paths that match the query identifiers.
[0181] The query results for power events are obtained by querying the data chain of the query path.
[0182] In one embodiment, the processor, when executing a computer program, also performs the following steps:
[0183] When an event record for a power event is received from the power management system, a compliance verification is performed on the power event based on the event record to obtain the compliance verification result of the power event.
[0184] If the compliance verification result meets the compliance conditions, extract the power event identifier of the power event from the event record.
[0185] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon, the computer program performing the following steps when executed by a processor:
[0186] When an event record for a power event is received from the power management system, the power event identifier and the resource identifier of the power resource associated with the power event are extracted from the event record.
[0187] Based on power event identifiers, construct an event record index for power events;
[0188] When a power resource's state changes due to a power event, a state change index for the power resource is constructed based on the resource identifier;
[0189] The behavioral data chain of power events is determined based on the event record index and the state change index; the behavioral data chain is used to characterize the mapping relationship between power events and power resources.
[0190] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0191] The event record is hashed to obtain its hash value.
[0192] Based on power event identifiers, an event record index for power events is constructed, including:
[0193] The event record index of the power event is obtained by combining the power event identifier, hash value, and resource identifier.
[0194] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0195] When a power resource's state changes due to a power event, the resource status information of the power resource is obtained.
[0196] Extract the resource identifier of the power resource from the resource status information;
[0197] An index of power resource status changes is constructed based on resource identifiers and power event identifiers.
[0198] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0199] Obtain the first index generation time for each target event record index, and the second index generation time for each target state change index;
[0200] The event data chain is obtained by arranging the target event record indexes in order of the first index generation time, and the state data chain is obtained by arranging the target state change indexes in order of the second index generation time.
[0201] The event data chain and the state data chain are merged to obtain the behavior data chain.
[0202] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0203] In response to a power event query request, extract the query identifier from the power event query request;
[0204] Query path matching is performed based on query identifiers to obtain query paths that match the query identifiers.
[0205] The query results for power events are obtained by querying the data chain of the query path.
[0206] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0207] When an event record for a power event is received from the power management system, a compliance verification is performed on the power event based on the event record to obtain the compliance verification result of the power event.
[0208] If the compliance verification result meets the compliance conditions, extract the power event identifier of the power event from the event record.
[0209] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps:
[0210] When an event record for a power event is received from the power management system, the power event identifier and the resource identifier of the power resource associated with the power event are extracted from the event record.
[0211] Based on power event identifiers, construct an event record index for power events;
[0212] When a power resource's state changes due to a power event, a state change index for the power resource is constructed based on the resource identifier;
[0213] The behavioral data chain of power events is determined based on the event record index and the state change index; the behavioral data chain is used to characterize the mapping relationship between power events and power resources.
[0214] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0215] The event record is hashed to obtain its hash value.
[0216] Based on power event identifiers, an event record index for power events is constructed, including:
[0217] The event record index of the power event is obtained by combining the power event identifier, hash value, and resource identifier.
[0218] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0219] When a power resource's state changes due to a power event, the resource status information of the power resource is obtained.
[0220] Extract the resource identifier of the power resource from the resource status information;
[0221] An index of power resource status changes is constructed based on resource identifiers and power event identifiers.
[0222] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0223] Obtain the first index generation time for each target event record index, and the second index generation time for each target state change index;
[0224] The event data chain is obtained by arranging the target event record indexes in order of the first index generation time, and the state data chain is obtained by arranging the target state change indexes in order of the second index generation time.
[0225] The event data chain and the state data chain are merged to obtain the behavior data chain.
[0226] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0227] In response to a power event query request, extract the query identifier from the power event query request;
[0228] Query path matching is performed based on query identifiers to obtain query paths that match the query identifiers.
[0229] The query results for power events are obtained by querying the data chain of the query path.
[0230] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0231] When an event record for a power event is received from the power management system, a compliance verification is performed on the power event based on the event record to obtain the compliance verification result of the power event.
[0232] If the compliance verification result meets the compliance conditions, extract the power event identifier of the power event from the event record.
[0233] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0234] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0235] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0236] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A blockchain-based power event management method, characterized in that, Applied to a blockchain platform, the method comprises: When receiving an event record of a power event reported by a power management system, extracting a power event identifier of the power event and a resource identifier of a power resource associated with the power event from the event record, wherein the power event comprises at least one target power event; Hash processing the event record to obtain a hash value of the event record; Combining the power event identifier, the hash value and the resource identifier to obtain an event record index of the power event, wherein the event record index comprises a target event record index of the target power event; When a state change of the power resource is triggered due to the power event, obtaining resource state information of the power resource; Extracting the resource identifier of the power resource from the resource state information; Based on the resource identifier and the power event identifier, constructing a state change index of the power resource, wherein the state change index comprises at least one target state change index, and the target state change index corresponds to the target event record index one by one; Respectively obtaining a first index generation time of each target event record index and a second index generation time of each target state change index; Arranging the target event record indexes in order according to the first index generation time to obtain an event data chain, and arranging the target state change indexes in order according to the second index generation time to obtain a state data chain; Merging the event data chain and the state data chain to obtain a behavior data chain; the behavior data chain is used to represent a mapping relationship between the power event and the power resource.
2. The method of claim 1, wherein, The method further comprises: In response to a power event query request, extracting a query identifier from the power event query request; Based on the query identifier, performing query path matching to obtain a query path matched with the query identifier; According to the query path, querying the behavior data chain to obtain a power event query result.
3. The method of claim 1, wherein, When receiving an event record of a power event reported by a power management system, extracting a power event identifier of the power event from the event record, comprising: When receiving an event record of a power event reported by a power management system, performing compliance verification on the power event based on the event record to obtain a compliance verification result of the power event; In the case that the compliance verification result meets the compliance condition, extracting the power event identifier of the power event from the event record.
4. The method according to any one of claims 1 to 3, characterized in that, The power event refers to a key operation node of power resource circulation. 5.A blockchain-based power event management apparatus, characterized by, Applied to the blockchain-based power event management method of claim 1, the device comprises: An identifier extraction module is configured to, when receiving an event record of a power event reported by a power management system, extract a power event identifier of the power event and a resource identifier of a power resource associated with the power event from the event record, wherein the power event comprises at least one target power event; An event record index construction module is configured to hash the event records to obtain hash values of the event records, and combine the power event identifier, the hash values, and the resource identifier to obtain an event record index of the power event, wherein the event record index comprises a target event record index of the target power event. A state change index construction module is configured to, when a state of the power resource is changed due to the power event, acquire resource state information of the power resource, extract a resource identifier of the power resource from the resource state information, and construct a state change index of the power resource based on the resource identifier and the power event identifier, wherein the state change index comprises at least one target state change index, and the target state change index is one-to-one corresponding to the target event record index. An action data chain generation module is configured to acquire a first index generation time of each target event record index and a second index generation time of each target state change index, arrange the target event record indexes in sequence according to the first index generation time to obtain an event data chain, arrange the target state change indexes in sequence according to the second index generation time to obtain a state data chain, and combine the event data chain and the state data chain to obtain the action data chain, wherein the action data chain is used to represent a mapping relationship between the power event and the power resource.
6. The apparatus of claim 5, wherein, The device is further configured to: extract a query identifier from a power event query request in response to the power event query request; perform query path matching based on the query identifier to obtain a query path matched with the query identifier; query the action data chain according to the query path to obtain a power event query result.
7. The apparatus of claim 5, wherein, The identifier extraction module is further configured to: perform compliance verification on the power event based on the event record when an event record of a power event reported by a power management system is received, and obtain a compliance verification result of the power event; extract a power event identifier of the power event from the event record when the compliance verification result meets a compliance condition. 8.A computer device, comprising a memory and a processor, wherein the memory stores a computer program, and the computer device is configured to perform the method according to any one of claims 1-7. The processor executes the computer program to implement the steps of the method in any one of claims 1 to 4.
9. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 4.
10. A computer program product comprising a computer program, characterized in that, The computer program is executed by the processor to implement the steps of the method in any one of claims 1 to 4.
Citation Information
Patent Citations
Log recording and querying method and device, computer equipment and storage medium
CN115687505A
Streaming traceability graph real-time attack detection method and system based on label and graph alignment
CN117560228A