Log recording and querying method and device, computer device and storage medium

By binding unique, non-reusable particle product numbers and constructing a particle product number graph in the blockchain operating system, the security and fast query issues of log information are solved, and decentralized storage and event tracking of logs are realized.

CN115687505BActive Publication Date: 2025-11-21SHENZHEN ZHONGJING QUANTUM TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110850928.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-07-27
Publication Date
2025-11-21
Estimated Expiration
2041-07-27

AI Technical Summary

Technical Problem

The logging system of a blockchain operating system is complex, making it difficult to effectively retrieve log information and track events. Furthermore, tampering with log files can pose serious security risks.

Method used

By binding unique and non-reusable particle product numbers to log nodes and combining them with a particle product number graph, decentralized storage and security of logs are achieved. Trusted nodes are used to write logs to the blockchain and cancel particle product numbers, thus building connections between particle product numbers and enabling quick querying of related events.

Benefits of technology

It achieves secure and tamper-proof logs and rapid querying of event-related information in the blockchain operating system, solving the problems of effective log information retrieval and event tracking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115687505B_ABST
    Figure CN115687505B_ABST
Patent Text Reader

Abstract

The application relates to a blockchain-based log recording and query method, device, computer equipment and storage medium. The log recording method comprises the following steps: assembling a log into an event component, the event component comprising an event topic, applying for and obtaining a particle product number, the particle product number having a unique and non-reusable identifier, binding the particle product number with the event component and obtaining a log, writing the log into a blockchain, and updating a particle product number atlas according to the log. The log query method comprises the following steps: obtaining an event topic to be queried, searching for a particle product number atlas, obtaining an atlas event corresponding to the event topic to be queried, obtaining a target particle product number identifier in the atlas event, querying block information corresponding to the target particle product number identifier through an event particle product number index in the particle product number atlas, querying a log from a block corresponding to the block information, and connecting the queried log based on a particle product number connection relationship in the event particle product number index to obtain a log chain under the event topic to be queried. The method ensures that the log cannot be tampered with and all related events can be quickly found.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of blockchains, and in particular to a log recording and querying method and device, a computer device, and a storage medium. BACKGROUND

[0002] Log files record every detail of the operation of an operating system and its various services, and play a very important role in enhancing the stability and security of the operating system. Once the log files are tampered with or modified, it will pose a serious security risk to the operating system.

[0003] The log system of a blockchain operating system is more complex than that of a single machine operating system, and it is difficult to effectively retrieve log information and track events. SUMMARY

[0004] Therefore, it is necessary to provide a log recording and querying method and device that can meet the requirements of decentralization, security, and traceability, a computer device, and a storage medium.

[0005] A log recording method based on a blockchain includes:

[0006] A log node creates an event component, which includes an event topic;

[0007] The log node applies for and obtains a particle product number, which has a unique and non-reusable identifier;

[0008] The log node binds the particle product number to the event component and obtains a log;

[0009] The log node writes the log to a blockchain;

[0010] The log node updates a particle product number atlas according to the log.

[0011] In one embodiment, the log node writes the log to the blockchain, including:

[0012] The log node broadcasts the log to nodes in a blockchain operating system;

[0013] A trusted node in the blockchain operating system assembles the log into a block in chronological order and publishes the block to the blockchain.

[0014] In one embodiment, after the log node writes the log to the blockchain, it further includes:

[0015] The trusted node deregisters the particle product number;

[0016] The trusted node will be able to create an increased number of particle multiplicity and cancel an equal number of particle multiplicity.

[0017] In one embodiment, the log node updates the particle multiplicity graph according to the log, including:

[0018] The log node queries whether there is a graph event related to the event topic according to the event topic of the log;

[0019] When there is no graph event related to the event topic, the log node creates a new graph event and an event particle multiplicity index corresponding to the new graph event according to the log;

[0020] When there is a graph event related to the event topic, the log node updates the graph event and the event particle multiplicity index corresponding to the graph event according to the log.

[0021] In one embodiment, the method for creating a particle multiplicity graph, including:

[0022] The synchronization node synchronizes the to-be-processed blockchain to the local;

[0023] The synchronization node obtains the latest block on the to-be-processed blockchain as the current block;

[0024] The synchronization node extracts all logs in the current block;

[0025] The synchronization node establishes the particle multiplicity graph according to the extracted logs,

[0026] The synchronization node obtains the next block as the current block in reverse order, and continues to extract all logs in the current block and update the particle multiplicity graph according to the extracted logs, until the blocks on the to-be-processed blockchain are all processed.

[0027] In one embodiment, the method for creating a particle multiplicity graph, further including:

[0028] The synchronization node obtains the target block and extracts the logs in the target block;

[0029] The synchronization node updates the particle multiplicity graph according to the logs in the target block.

[0030] In one embodiment, the log node applies for particle multiplicity, including:

[0031] The log node sends a particle multiplicity application request to the trusted node;

[0032] The trusted node verifies the particle product number application request through a pairing node of the log node, and sends a particle product number to the log node after verification; the particle product number sent by the trusted node is created by the trusted node.

[0033] A blockchain-based log query method, comprising:

[0034] The query node obtains a to-be-queried event topic;

[0035] The query node finds a particle product number graph to obtain a graph event corresponding to the to-be-queried event topic, and the particle product number graph is obtained by the log recording method in any one of claims 1 to 7;

[0036] The query node obtains a target particle product number identifier in the graph event;

[0037] The query node queries the block information corresponding to the target particle product number identifier through an event particle product number index in the particle product number graph;

[0038] The query node queries logs from the block corresponding to the block information, and connects the queried logs based on a particle product number connection relationship in the event particle product number index to obtain a log chain under the to-be-queried event topic.

[0039] A blockchain-based log recording device, comprising:

[0040] An event creation module for creating an event component by a log node, wherein the event component comprises an event topic;

[0041] A particle product number application module for applying for and obtaining a particle product number by the log node, wherein the particle product number has a unique and non-reusable identifier;

[0042] A log generation module for binding the particle product number and the event component by the log node to obtain a log;

[0043] A log writing module for writing the log into a blockchain by the log node;

[0044] A graph updating module for updating a particle product number graph according to the log by the log node.

[0045] A blockchain-based log query device, comprising:

[0046] An event topic acquisition module for obtaining a to-be-queried event topic by a query node;

[0047] An atlas event acquisition module is configured to find a particle product number atlas by the query node, and obtain an atlas event corresponding to the event theme to be queried, wherein the particle product number atlas is obtained by the log recording method in any one of claims 1 to 7.

[0048] A particle product number identifier acquisition module is configured to acquire a target particle product number identifier in the atlas event by the query node.

[0049] A block information acquisition module is configured to acquire block information corresponding to the target particle product number identifier by the query node through an event particle product number index in the particle product number atlas.

[0050] A log connection module is configured to query logs from a block corresponding to the block information by the query node, and connect the queried logs based on a particle product number connection relationship in the event particle product number index, to obtain a log chain under the event theme to be queried.

[0051] A computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the method described in any one of the above embodiments when executing the computer program.

[0052] A computer readable storage medium stores a computer program, and the computer program implements the steps of the method described in any one of the above embodiments when executed by a processor.

[0053] The above-mentioned log recording and query method, device, computer device and storage medium based on a blockchain ensure the security and non-tamperability of the decentralized storage of logs in a blockchain operating system by binding particle product numbers with unique identifiers and non-reproducibility on log components. Further, by constructing a particle product number atlas, the relationship between events under the same event theme is converted into a connection relationship between particle product numbers, solving the technical problem of how to quickly find all related events through an event theme in a blockchain. BRIEF DESCRIPTION OF DRAWINGS

[0054] Figure 1 It is an application environment diagram of the log recording and query method based on a blockchain in one embodiment;

[0055] Figure 2 It is a log data structure diagram in one embodiment;

[0056] Figure 3 It is a particle product number atlas principle diagram in one embodiment;

[0057] Figure 4 It is a flowchart of the log recording method based on a blockchain in one embodiment;

[0058] Figure 5 a flowchart of a blockchain-based log query method in an embodiment;

[0059] Figure 6 a block diagram of a blockchain-based log recording device in an embodiment;

[0060] Figure 7 a block diagram of a blockchain-based log query device in an embodiment;

[0061] Figure 8 an internal block diagram of a computer device in an embodiment. DETAILED DESCRIPTION

[0062] In order to make the purposes, technical solutions and advantages of the present application clearer, further detailed description will be made to the present application in combination with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.

[0063] The blockchain-based log recording and query method provided by the present application can be applied in an application environment as shown in Figure 1 The log node 102, the trusted node 104 and the synchronization / query node 106 are connected and communicated with each other through a blockchain operating system. The log node 102 generates logs and updates the particle number graph. The trusted node 104 is responsible for synchronizing the generated logs to the blockchain of the blockchain operating system. The synchronization / query node 106 can obtain the latest log information by synchronizing the blockchain, and can also create a local particle number graph through the blockchain. When it is necessary to query the logs of a specific event topic, the particle number graph can be used to quickly find all related event information. The log node 102, the trusted node 104 and the synchronization / query node 106 can be, but are not limited to, various personal computers, notebook computers, smart phones, tablet computers, portable wearable devices, single servers and server clusters.

[0064] In the log data structure diagram as shown in Figure 2 The log data structure includes a log header and a log body. The log header further includes a log identification, a log writing timestamp and a log type. The log type includes, but is not limited to, system, network and security. The log body further includes a particle number and an event component.

[0065] The particle number includes a particle number hash identification, a state (generation, distribution, use and cancellation), a generation timestamp, a distribution timestamp, a latest use timestamp, a cancellation timestamp, an input record of the particle number and an output record of the particle number.

[0066] The event component includes an event header and an event body. The event header includes a hash identifier of a previous event component, a hash identifier of the current event component, an event topic, and a content check code. The hash identifier of the previous event component and the hash identifier of the current event component in the event header are used to connect two event components under the same event topic. The event topic in the event header records the basic information of the event, for example, event topic 1 is an unnamed network access event, and event topic 2 is a data synchronization timeout event. The event body includes a specific description of the event, for example, the specific time of the event, the duration, the affected range, etc.

[0067] In the log data structure, the particle product and the event component are bound to each other. The particle product bound to the event component will be referred to as an event particle product in the following.

[0068] In Figure 3 In the particle product spectrum schematic diagram shown in the figure, the particle product spectrum includes a spectrum event and an event particle product index corresponding to the event particle product. Each event topic includes at least one event. The latest event under the event topic is referred to as the latest event, and the particle product bound to the latest event is referred to as the latest event particle product.

[0069] The spectrum event includes an event topic and a hash identifier of the latest event particle product under the event topic. The event particle product index mainly includes a hash identifier of the event particle product, a hash identifier of a block to which the event particle product belongs (the hash identifier of the block to which the event particle product belongs in the figure), a hash identifier of a log, a hash identifier of a previous event particle product (the hash identifier of the previous event particle product in the figure), a hash identifier of a next event particle product (the hash identifier of the next event particle product in the figure), and a hash identifier of an event component.

[0070] Figure 3 In the figure, there are event particle product 1, event particle product 2, and event particle product 3 under event topic 1. The event particle product 1 is the latest event particle product under the event topic 1, and the previous event particle product of the event particle product 1 is the event particle product 2. The previous event particle product of the event particle product 2 is the event particle product 3. The hash identifier of the previous event particle product and the hash identifier of the next event particle product of each event particle product are stored in the event particle product index.

[0071] In one embodiment, as Figure 4 shown, a blockchain-based log recording method is provided, including the following steps:

[0072] In step S402, the log node creates an event component, and the event component includes an event topic.

[0073] Specifically, the log node determines the subject of the event occurring in the node, including but not limited to determining the event subject by a pre-set subject naming rule. The log node records the specific description of the event occurrence. The log node generates a unique hash identifier of the current event by a hash generation algorithm. The log node checks whether the same event subject exists in the local record, and if so, finds the hash identifier of the previous event under the same subject. The log node generates a content check code. The log node creates an event component, which includes: the event subject, the event specific description, the hash identifier of the current event, the hash identifier of the previous event, and the content check code.

[0074] In step S404, the log node applies a particle product, which has a unique and non-reusable identifier.

[0075] The particle product is a usable product of particles generated by a trusted node when implementing new block assembly in the blockchain operating system. The initial usable product has a ranking of 1 for a single particle. Each particle product has a unique hash identifier, which cannot be reused after the particle product is cancelled. The particle product mechanism is one of the significant differences between the blockchain operating system and the traditional operating system. The core of the particle product mechanism is that the particle product has a life cycle, including four stages: generation, distribution, use, and cancellation, which realizes the recording of logs on the blockchain in combination with the four stages.

[0076] Each node retains two particle product pools, one of which is a globally shared particle product pool for particle product application services for all nodes in the blockchain operating system. The other is a self-controlled particle product pool for providing the required particle products for the node's own particle product consumption. Each node can only consume particle products in its own self-controlled particle product pool.

[0077] Specifically, when the log node checks whether there are sufficient particle products in its own self-controlled particle product pool for recording logs. When the log node's self-controlled particle product pool has sufficient particle products, the required number of particle products for recording logs are obtained. When the log node's self-controlled particle product pool does not have sufficient particle products, the required number of particle products are applied for and received from trusted nodes, and the input record of the particle products is changed after receiving the particle products.

[0078] For example, the log node itself is a trusted node, and 100 particle products are required for recording logs. The log node's self-controlled particle product pool has no particle products, and the log node applies 50 particle products from its own globally shared particle product pool and 50 particle products from the globally shared particle product pool of the trusted nodes around the log node.

[0079] Step S406, the log node binds the particle number with the event component and obtains the log.

[0080] Specifically, after the log node obtains the required particle number, the log node updates the state of the particle number and the latest use time stamp of the particle number. The log node binds the application of the particle number and the created event component together, and adds the corresponding log identification and log type to generate the target log. The structure of the target log is as shown in Figure 2

[0081] Step S408, the log node writes the log into the blockchain.

[0082] Specifically, the log node selects a trusted node from the surrounding trusted nodes, and sends the log to the selected trusted node. The selected trusted node assembles the log into a block in chronological order, and then synchronizes the block to the blockchain. Optionally, the log node can add the detailed description of the event to the log in the abbreviation mode, and restore the detailed description of the event in the normal mode when reading the event component in the future.

[0083] For example, the maximum value of a block is 4M, and the maximum value of a log component is 2K (usually 1K), and a block can store about 2000-4000 log components at most.

[0084] Step S410, the log node updates the particle number graph according to the log.

[0085] Specifically, the log node updates the event topic in the log and the hash identification of the latest event particle number under the event topic to the graph event, and updates the event particle number index under the event topic, including: the hash identification of the latest event particle number, the hash identification of the block to which the latest event particle number belongs, the hash identification of the log, the hash identification connection relationship between the latest event particle number and the previous event particle number, and the hash identification of the event component.

[0086] In the above-mentioned log recording method based on the blockchain, by binding the particle number with unique identification and non-reproducible on the log component, the security and non-tamperability of the decentralized storage of the log in the blockchain operating system are ensured, and further by constructing the particle number graph, the relationship between the events under the same event topic is converted into the connection relationship between the particle numbers, solving the technical problem of how to quickly find all related events through the event topic in the blockchain.

[0087] In one embodiment, the log node writes the log into the blockchain, including: the log node broadcasts the log to the nodes in the blockchain operating system; the trusted nodes in the blockchain operating system assemble the log into a block in chronological order and publish the block to the blockchain.​

[0088] wherein, Figure 1 In the application environment diagram shown, the log node 102 and the trusted node 104 are part of the blockchain operating system. The trusted node is a node with extremely high credibility in the blockchain operating system, which is screened according to certain screening rules, and can be used to execute transactions with high credibility, such as writing logs into the blockchain.

[0089] Specifically, the log node broadcasts the created to-be-synchronized log to the nodes in the blockchain operating system. After receiving the sent log, the trusted node in the blockchain operating system that meets the preset condition assembles the log into a to-be-synchronized block in chronological order. There can be multiple to-be-written logs in a to-be-synchronized block, and the multiple to-be-written logs are arranged in chronological order. The trusted node that meets the preset condition synchronizes the to-be-synchronized block to the blockchain. The preset condition is mainly used to screen trusted nodes with appropriate communication distance, active connection, good network communication condition, and high credibility. The preset condition can be, but is not limited to, the closest trusted node to the log node, the most active trusted node within a certain distance range of the log node (the most active means the most communication times with other nodes within a certain time), the trusted node with the best network communication condition within a certain distance range of the log node, the trusted node with the most particle mass number within a certain distance range of the log node, or the node that has been in the blockchain operating system for the longest time within a certain distance range of the log node. For example, system-level logs need extremely high credibility nodes to write into the blockchain, so the trusted node that has been in the blockchain operating system for the longest time within a certain distance range of the log node can be selected.

[0090] In this embodiment, because the trusted node itself has high credibility, and the trusted node screened in combination with the specific preset condition can ensure that the log is safely written into the blockchain and is not maliciously tampered with.

[0091] In one embodiment, after the log node writes the log into the blockchain, the trusted node also includes logging out the particle mass number. The trusted node can create a number of particle mass numbers equal to the number of logged particle mass numbers.

[0092] Specifically, after the trusted node writes the log into the blockchain, the particle product bound by the log is cancelled by the trusted node, and after the cancellation, the hash identification of the bound particle product cannot be used again. In order to tamper with the existing log, the hash value of the particle product bound by the log when the log is written needs to be obtained, but the hash value is cancelled after the trusted node writes the log into the blockchain. Therefore, the blockchain operating system ensures that the log information is tamper-proof in this way. After the trusted node cancels the particle product, the number of particle products that can be created in the entire blockchain operating system increases by an amount equal to the number of cancelled particle products. This can maintain the number of particle products at a reasonable level at all times and ensure the proper operation of the blockchain operating system.

[0093] In this embodiment, the blockchain operating system cancels the particle product through the trusted node, so that the hash value of the particle product bound by the log cannot be reused, ensuring the security of the log writing process and preventing hackers from maliciously tampering with the log.

[0094] In one embodiment, the log node updates the particle product graph according to the log, including: the log node queries whether there is a graph event related to the event topic according to the event topic of the log. When there is no graph event related to the event topic, the log node creates a new graph event and an event particle product index corresponding to the new graph event according to the log. When there is a graph event related to the event topic, the log node updates the graph event and the event particle product index corresponding to the graph event according to the log.

[0095] Specifically, the log node queries whether there is a graph event related to the event topic in the log in the particle product number graph. When there is no related graph event, it indicates that the log of the event topic is created for the first time, and a new graph event and related event particle product number index need to be created. The log node adds the event topic of the log and the hash identification of the corresponding event particle product number as a new graph event to the particle product number graph. The log node adds the hash identification of the event particle product number, the hash identification of the block to which the event particle product number belongs, the hash identification of the log, and the hash identification of the event component as the event particle product number index corresponding to the new graph event to the particle product number graph. When there is already a related graph event, it indicates that there are other events under the event topic. The log node keeps the event topic in the related graph event unchanged, and updates the hash identification of the latest event particle product number in the related graph event to the hash identification of the event particle product number corresponding to the log. The log node simultaneously adds the hash identification of the event particle product number, the hash identification of the block to which the event particle product number belongs, the hash identification of the log, and the hash identification of the event component as a new event particle product number index to the particle product number graph, and updates the hash identification connection relationship between the above event particle product number index and the previous event particle product number index under the event topic (for example, the hash identification of the event particle product number in the newly created event particle product number index is the first hash identification, and the hash identification of the event particle product number in the previous event particle product number index is the second hash identification, then the previous hash identification in the newly created event particle product number index is updated to the second hash identification, and the next hash identification in the previous event particle product number index is updated to the first hash identification.). In the graph event, the correspondence between the event topic and the hash identification of the latest event particle product number is stored in the form of a hash map. In another embodiment, the memory address of the block to which the event particle product number belongs is also directly recorded in the event particle product number index, and the block can be quickly accessed through a pointer or a reference.

[0096] In this embodiment, the log node updates the local particle product number graph according to the information in the created log, which facilitates the subsequent quick query and tracking of the log content under a specific event topic that needs to be understood.

[0097] In one embodiment, the method for creating a particle product number graph includes: a synchronization node synchronizing a to-be-processed block chain to a local. The synchronization node obtains the latest block on the to-be-processed block chain as a current block. The synchronization node extracts all logs in the current block. The synchronization node establishes a particle product number graph according to the extracted logs. The synchronization node obtains the next block as the current block in a reverse order, and continues to extract all logs in the current block, and updates the particle product number graph according to the extracted logs, until the blocks on the to-be-processed block chain are all processed.

[0098] Specifically, in some cases, the node just joins the blockchain operating system or the node re-installs the local operating system, at this time the node has no particle product number atlas locally, so it is necessary to re-create a complete particle product number atlas according to the latest blockchain. At this time, such a node is called a synchronization node.

[0099] The synchronization node synchronizes the blockchain to be synchronized to the local, first starts from the latest block on the above-mentioned blockchain, extracts all logs assembled on the latest block in chronological order from new to old. Then the synchronization node extracts all logs of the previous block of the latest block in reverse order, until the synchronization node extracts all logs in all blocks on the blockchain. The synchronization node can establish and update the particle product number atlas after extracting all logs, or can establish and update the particle product number atlas in the process of extracting the logs.

[0100] The process of the synchronization node establishing and updating the particle product number atlas is as follows: the synchronization node obtains the event topic, the hash identification of the event component, the hash identification of the log, and the event particle product number from the first extracted log.

[0101] The synchronization node establishes an initial particle product number atlas, and the synchronization node adds the event topic of the log and the hash identification of the corresponding event particle product number as a new atlas event to the initial particle product number atlas. The synchronization node adds the hash identification of the event particle product number, the hash identification of the block to which the event particle product number belongs, the hash identification of the log, and the hash identification of the event component as the event particle product number index corresponding to the new atlas event to the particle product number atlas.

[0102] Afterwards, the synchronization node obtains the event topic, the hash identifier of the event component, the hash identifier of the log, and the event particle product number from the next extracted log (all logs under the same block are extracted in chronological order from new to old). The synchronization node queries whether there is a graph event related to the event topic in the particle product number graph. When there is no related graph event, it means that the log of the event topic is created for the first time, and therefore a new graph event and related event particle product number index need to be created. The synchronization node adds the event topic of the log and the hash identifier of the corresponding event particle product number as a new graph event to the particle product number graph. The synchronization node adds the hash identifier of the event particle product number, the hash identifier of the block to which the event particle product number belongs, the hash identifier of the log, and the hash identifier of the event component as the event particle product number index corresponding to the new graph event to the particle product number graph. When there is already a related graph event, it means that there are other events under the event topic. Because the logs are extracted in chronological order from old to new, the synchronization node keeps the related graph event unchanged. The synchronization node adds the hash identifier of the event particle product number, the hash identifier of the block to which the event particle product number belongs, the hash identifier of the log, and the hash identifier of the event component as a new event particle product number index to the particle product number graph, and updates the hash identifier connection relationship between the above event particle product number index and the next event particle product number index. In addition, if the logs of the same block are assembled into the block without explicit time sequence, the write time stamp of the log can be checked. If the write time stamp of the log is the latest among all logs under the same event topic, the hash identifier of the latest event particle product number of the related graph event is updated, and after the establishment of the event particle product number index, the hash identifier connection relationship between the event particle product number and the previous event particle product number is updated. If the write time stamp of the log is not the latest among all logs under the same event topic, the synchronization node keeps the related graph event unchanged, and after the establishment of the event particle product number index, according to the write time stamp of the log, the previous and next event particle product numbers are found, and the hash identifier connection relationship between the previous and next event particle product numbers is updated.

[0103] In this embodiment, the synchronization node synchronizes the entire latest blockchain to the local, and creates a particle product number graph according to the log information in all blocks on the blockchain. Because the structure of the particle product number graph created by the synchronization node is the same as that of the particle product number graph created by other nodes in the blockchain operating system, and the entire creation logic is the same, the content of the particle product number graph is also consistent with each other. The synchronization node can then quickly track the logs of a specific event topic according to the created particle product number graph, and form a log chain.

[0104] In one embodiment, the method for creating the particle multiplicity map further comprises: a synchronization node obtaining a target block and extracting logs in the target block; and the synchronization node updating the particle multiplicity map according to the logs in the target block.

[0105] Specifically, when a log node in the blockchain operating system creates a log, after the created log is written into the blockchain, other nodes in the blockchain operating system, which are also called synchronization nodes, will update the existing particle multiplicity map in the local according to the log information on the latest block after synchronizing the latest block to the local.

[0106] The synchronization node obtains the latest target block through the synchronization blockchain, and extracts all logs assembled on the target block in chronological order from new to old. The process of updating the particle product graph by the synchronization node is as follows: the synchronization node obtains the event topic, the hash identifier of the event component, the hash identifier of the log, and the event particle product from the first extracted log. The synchronization node queries whether there is a graph event related to the event topic in the particle product graph. When there is no related graph event, it means that the log of the event topic is created for the first time, and therefore a new graph event and related event particle product index need to be created. The synchronization node adds the event topic of the log and the hash identifier of the corresponding event particle product as a new graph event to the particle product graph. The synchronization node adds the hash identifier of the event particle product, the hash identifier of the block to which the event particle product belongs, the hash identifier of the log, and the hash identifier of the event component as the event particle product index corresponding to the new graph event to the particle product graph. When there is a related graph event, it means that there are other events under the event topic. The synchronization node keeps the event topic in the related graph event unchanged, and updates the hash identifier of the latest event particle product in the related graph event to the hash identifier of the event particle product corresponding to the log. The synchronization node simultaneously adds the hash identifier of the event particle product, the hash identifier of the block to which the event particle product belongs, the hash identifier of the log, and the hash identifier of the event component as a new event particle product index to the particle product graph, and updates the hash identifier connection relationship between the above event particle product index and the previous event particle product index under the event topic. In addition, if the logs of the same block are assembled into the block without a clear time sequence, the write time stamp of the log can be checked. If the write time stamp of the log is the latest under the same event topic, the hash identifier of the latest event particle product in the related graph event is updated, and the hash identifier connection relationship between the event particle product and the previous event particle product is updated after the establishment of the event particle product index. If the write time stamp of the log is not the latest under the same event topic, the synchronization node keeps the related graph event unchanged, and finds the previous and subsequent event particle products according to the write time stamp of the log after the establishment of the event particle product index, and updates the hash identifier connection relationship between the previous and subsequent event particle products.

[0107] In this embodiment, the synchronization node obtains the log information in the latest block through the synchronization of the latest blockchain and updates the local particle product graph. Because the structure of the particle product graph created by the synchronization node is the same as that of the particle product graph created by other nodes in the blockchain operating system, and the entire creation logic is the same, the content of the particle product graph is also consistent. The synchronization node can subsequently quickly track the log of a specific event topic according to the updated particle product graph, and form a log chain.

[0108] In one embodiment, the log node applies for the particle product number, including: the log node sends a particle product number application request to a trusted node. The trusted node verifies the particle product number application request through a pairing node of the log node, and sends a particle product number to the log node after verification; the particle product number sent by the trusted node is created by the trusted node.

[0109] Specifically, the embodiment specifically introduces the allocation process of the particle product number. The trusted nodes in the blockchain operating system complete block assembly every fixed period. Each assembly produces a fixed number of particles to identify the time point of the assembly event. The newly generated particles are ranked as available product numbers. The newly generated particle product numbers are concentrated in the trusted nodes, which form a virtual particle product number pool. The log nodes in the blockchain operating system can randomly select or select a preset number of trusted nodes according to certain conditions. The preset number is optimized based on experience and test results, which can balance efficiency while preventing system overload. The log node sends a particle product number application request to the trusted node, which carries the application number of the particle product number and the pairing node list of the write-in party. The trusted node can randomly select or select an authentication node according to certain conditions and send a query message to the authentication node. The authentication node receiving the query message sends a confirmation message to the trusted node to confirm the qualification of the write-in party. The trusted node receives the confirmation message and sends the particle product number equal to the application number to the log node.

[0110] In the embodiment, the log node obtains the particle product number with a unique hash value by applying for the particle product number from the trusted node that uniformly produces the particle product number, which makes necessary preparations for subsequent log creation to ensure that the log cannot be tampered with. At the same time, the trusted node sends the particle product number to the log node only after verification, which ensures that the particle product number will not be overissued and misused.

[0111] In order for those skilled in the art to fully understand the log recording method based on the blockchain in the present application, a specific embodiment is given below.

[0112] An unauthorized access event occurs in the log node in the blockchain operating system. The log node A creates an event component according to the preset event topic naming rule, including an event header and an event body. The event topic is named "unauthorized access". The log node A obtains the event hash identifier of this event according to the hash identifier generation algorithm. The log node A generates a content checksum. The log node A assembles the event hash identifier, event topic and checksum into the event header. The log node A writes the specific content of the event into the event body in a compression mode.

[0113] The log node A then applies for a particle product number with a unique hash identification and non-reproducible from the nearest trusted node B to itself. The input record of the particle product number is updated as A, and the output record of the particle product number is updated as B. The log node A binds the particle product number and the created event component together to generate a final log 1, generates a hash identification of the log component through a hash identification generation algorithm, and locates the log type as a system type.

[0114] The log node A broadcasts the log to all nodes in the entire blockchain operating system. The nearest trusted node B to the log node A receives the log and assembles the log into a block in chronological order. The block contains another log 2. The log 1 occurs after the log 2, and the event topics of the two are the same, both being “unauthorized access”. The trusted node B publishes the block to the blockchain and cancels the event particle product number m of the log 1. After the log 1 is cancelled, the hash identification of the event particle product number m is non-reproducible. The number of particle product numbers that can be created by all trusted nodes in the blockchain operating system increases by 1.

[0115] After the trusted node B synchronizes the block containing the log 1 and the log 2 to the blockchain, the synchronization node C synchronizes the block to the local. The synchronization node C first extracts the information in the log 2. The event particle product number of the log 2 is n. The local does not have an event topic of “unauthorized access”, and therefore, the synchronization node C creates a graph event 1 with an event topic of “unauthorized access” and the latest event particle product number n. The synchronization node C establishes an event particle product number index p corresponding to the event particle product number n, and updates the block hash identification to which the event particle product number n belongs, the log hash identification, and the hash identification of the event component into the event particle product number index p.

[0116] Afterwards, the synchronization node C extracts the information in the log 1. Because the event topic of the log 1 is the same as that of the log 2, the graph event 1 has been created before, and the log 1 is assembled into the block later than the log 2, the synchronization node C updates the hash identification of the latest event particle product number in the graph event 1 as m. At the same time, the synchronization node C establishes an event particle product number index q corresponding to the event particle product number m, and sets the hash identification of the previous event particle product number in the event particle product number index q as the hash identification of the event particle product number n. The synchronization node C sets the hash identification of the next event particle product number in the event particle product number index p as the hash identification of the event particle product number m.

[0117] When the synchronization node C needs to query all events under the event topic “unauthorized access”, the log 1 and the log 2 can be found by querying the graph event in the particle product number graph and the corresponding event particle product number index.

[0118] In an embodiment, as Figure 5As shown, a blockchain-based log query method is provided, comprising the following steps:

[0119] In step S502, the query node acquires a to-be-queried event topic.

[0120] Specifically, the to-be-queried event topic acquired by the query node includes but is not limited to an event topic input by a user and an event topic spontaneously generated by an operating system and needing to be queried.

[0121] In step S504, the query node finds a particle multiplicity atlas to obtain an atlas event corresponding to the to-be-queried event topic, the particle multiplicity atlas being obtained by any one of the above-mentioned log recording methods.

[0122] Specifically, the query node finds an atlas event matching the event topic in the particle multiplicity atlas according to the event topic, and the query method includes various commonly used query matching methods in the algorithm field.

[0123] In step S506, the query node acquires a target particle multiplicity identifier in the atlas event.

[0124] Specifically, the event topic and the hash identifier of the latest event particle multiplicity in the atlas event are stored locally in the form of a hash map (HashMap), and the query node can quickly find the hash identifier of the corresponding latest event particle multiplicity according to the event topic.

[0125] In step S508, the query node queries the block information corresponding to the target particle multiplicity identifier through the event particle multiplicity index in the particle multiplicity atlas.

[0126] Specifically, the query node finds the block hash identifier to which the target particle multiplicity belongs according to the target particle multiplicity identifier, finds the memory address of the corresponding block through the block hash identifier, and directly accesses the corresponding block through a pointer or a reference.

[0127] In step S510, the query node queries the log from the block corresponding to the block information, and connects the queried log based on the particle multiplicity connection relationship in the event particle multiplicity index to obtain a log chain under the to-be-queried event topic.

[0128] Specifically, the query node accesses the corresponding block, finds the log corresponding to the latest event particle multiplicity on the block, and acquires the log content. Then the query node finds all event particle multiplicities under the same event topic according to the event particle multiplicity index of the latest event particle multiplicity, finds all target blocks according to the event particle multiplicity index corresponding to the event particle multiplicity, finds all log contents from the target blocks, splices all the log contents to obtain a complete log chain.

[0129] In this embodiment, because the connection relationship of all event particle numbers under the same event topic in the particle number atlas has been completely saved, the query node can quickly find all relevant event particle numbers under the event topic, and through the event particle number, the query node can quickly access the memory address of the block to which the event particle number belongs, so that the query node can splice the log information in the block to obtain a complete log chain in a short time, thereby solving the technical problem of how to quickly find all relevant events through the event topic in the blockchain.

[0130] It should be understood that, although Figure 4 and Figure 5 the steps in the flowcharts are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and these steps can be executed in other orders. Moreover, Figure 4 and Figure 5 at least some of the steps can include multiple steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be alternately executed with other steps or steps or stages in other steps.

[0131] In one embodiment, as shown in Figure 6 , a blockchain-based log recording device is provided, comprising: an event creation module 100, a particle number application module 200, a log generation module 300, a log writing module 400 and an atlas updating module 500, wherein:

[0132] The event creation module 100 is configured to create an event component by a log node, and the event component comprises an event topic;

[0133] The particle number application module 200 is configured to apply a particle number by the log node, and the particle number has a unique and non-reusable identifier;

[0134] The log generation module 300 is configured to bind the particle number with the event component by the log node and obtain a log;

[0135] The log writing module 400 is configured to write the log into a blockchain by the log node;

[0136] The atlas updating module 500 is configured to update the particle number atlas according to the log by the log node.

[0137] In one embodiment, the blockchain-based log recording apparatus comprises: a log broadcasting module configured to broadcast logs by a log node to nodes in a blockchain operating system; and a block publishing module configured to assemble the logs in chronological order into a block by a trusted node in the blockchain operating system and publish the block onto the blockchain.

[0138] In one embodiment, the blockchain-based log recording apparatus further comprises: a particle number cancellation module configured to cancel particle numbers by the trusted node; and a particle number quantity increasing module configured to increase a quantity of particle numbers capable of being created by the trusted node by an equal quantity to the quantity of the cancelled particle numbers.

[0139] In one embodiment, the blockchain-based log recording apparatus comprises: a query module configured to query, by a log node, whether a graph event related to an event topic of a log exists according to the event topic of the log; a creation module configured to create, by the log node, a new graph event and an event particle number index corresponding to the new graph event according to the log when the graph event related to the event topic does not exist; and an update module configured to update, by the log node, the graph event and the event particle number index corresponding to the graph event according to the log when the graph event related to the event topic exists.

[0140] In one embodiment, the blockchain-based log recording apparatus comprises: a chain synchronization module configured to synchronize, by a synchronization node, a to-be-processed blockchain to a local; a latest block acquisition module configured to acquire, by the synchronization node, a latest block on the to-be-processed blockchain as a current block; a log extraction module configured to extract, by the synchronization node, all logs in the current block; a graph establishment module configured to establish, by the synchronization node, a particle number graph according to the extracted logs; and an iteration module configured to acquire, by the synchronization node, a next block as the current block in a reverse order, continue to extract all logs in the current block, and update the particle number graph according to the extracted logs until all blocks on the to-be-processed blockchain are processed.

[0141] In one embodiment, the blockchain-based log recording apparatus further comprises: a target block acquisition module configured to acquire, by the synchronization node, a target block and extract logs in the target block; and a graph update module configured to update, by the synchronization node, the particle number graph according to the logs in the target block.

[0142] In one embodiment, the blockchain-based log recording apparatus comprises: a request sending module configured to send, by a log node, a particle number application request to a trusted node; and a particle number sending module configured to verify, by the trusted node, the particle number application request through a pairing node of the log node, and send a particle number to the log node after the verification is passed; the particle number sent by the trusted node is obtained by the trusted node.

[0143] In one embodiment, asFigure 7 As shown, a blockchain-based log query device is provided, characterized in that the blockchain-based log query device comprises an event topic acquisition module 600, a graph event acquisition module 700, a particle product number identifier acquisition module 800, a block information acquisition module 900, and a log connection module 1000, wherein:

[0144] The event topic acquisition module 600 is configured to acquire, by the query node, an event topic to be queried.

[0145] The graph event acquisition module 700 is configured to find, by the query node, a particle product number graph to obtain a graph event corresponding to the event topic to be queried, the particle product number graph being obtained by any one of the above-mentioned log recording methods.

[0146] The particle product number identifier acquisition module 800 is configured to acquire, by the query node, a target particle product number identifier in the graph event.

[0147] The block information acquisition module 900 is configured to acquire, by the query node, block information corresponding to the target particle product number identifier through an event particle product number index in the particle product number graph.

[0148] The log connection module 1000 is configured to query, by the query node, logs from a block corresponding to the block information, and connect the queried logs based on a particle product number connection relationship in the event particle product number index to obtain a log chain under the event topic to be queried.

[0149] The specific limitations of the blockchain-based log recording device can be referred to the limitations of the blockchain-based log recording method in the above, which will not be repeated here. Each module in the above-mentioned blockchain-based log recording device can be realized by software, hardware and their combinations in whole or in part. The above-mentioned each module can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each module.

[0150] In one embodiment, a computer device is provided, which can be a server, and the internal structure diagram thereof can be as shown in Figure 8As shown in the figure. The computer device includes a processor, a memory and a network interface connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the blockchain operating system data. The network interface of the computer device is used to communicate with the external terminal through the network connection. The computer program is executed by the processor to implement a blockchain-based logging and querying method.

[0151] Those skilled in the art can understand that, Figure 8 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0152] In one embodiment, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the following steps: a log node creates an event component, the event component including an event topic. The log node applies for and obtains a particle multiplicity, the particle multiplicity having a unique and non-reusable identifier. The log node binds the particle multiplicity to the event component and obtains a log. The log node writes the log into a blockchain. The log node updates a particle multiplicity atlas according to the log.

[0153] In one embodiment, the processor executing the computer program further implements the following steps: the log node broadcasts the log to nodes in a blockchain operating system. The trusted nodes in the blockchain operating system assemble the log into a block in chronological order and publish the block to the blockchain.

[0154] In one embodiment, the processor executing the computer program further implements the following steps: after the log node writes the log into the blockchain, the trusted nodes cancel the particle multiplicity. The trusted nodes increase the number of particle multiplicities that can be created by an amount equal to the number of particle multiplicities cancelled.

[0155] In one embodiment, the processor executing the computer program further implements the following steps: the log node queries whether there is an atlas event related to the event topic according to the event topic of the log. When there is no atlas event related to the event topic, the log node creates a new atlas event and an event particle multiplicity index corresponding to the new atlas event according to the log. When there is an atlas event related to the event topic, the log node updates the atlas event and the event particle multiplicity index corresponding to the atlas event according to the log.

[0156] In one embodiment, the processor, when executing the computer program, further implements the following steps: the synchronization node synchronizes the to-be-processed blockchain to the local. The synchronization node obtains the latest block on the to-be-processed blockchain as a current block. The synchronization node extracts all logs in the current block. The synchronization node establishes a particle product number atlas according to the extracted logs. The synchronization node obtains the next block as the current block in a reverse order, and continues to extract all logs in the current block, and updates the particle product number atlas according to the extracted logs, until the blocks on the to-be-processed blockchain are all processed.

[0157] In one embodiment, the processor, when executing the computer program, further implements the following steps: the synchronization node obtains a target block, and extracts logs in the target block. The synchronization node updates the particle product number atlas according to the logs in the target block.

[0158] In one embodiment, the processor, when executing the computer program, further implements the following steps: the log node sends a particle product number application request to a trusted node. The trusted node verifies the particle product number application request through a pairing node of the log node, and sends a particle product number to the log node after verification; the particle product number sent by the trusted node is obtained by the trusted node.

[0159] In one embodiment, the processor, when executing the computer program, further implements the following steps: the query node obtains a to-be-queried event topic. The query node finds a particle product number atlas to obtain an atlas event corresponding to the to-be-queried event topic, and the particle product number atlas is obtained by the log recording method in the above method embodiments. The query node obtains a target particle product number identifier in the atlas event. The query node queries the block information corresponding to the target particle product number identifier through the event particle product number index in the particle product number atlas. The query node queries the logs from the block corresponding to the block information, and connects the queried logs based on the particle product number connection relationship in the event particle product number index to obtain a log chain under the to-be-queried event topic.

[0160] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program. The computer program is executed by a processor to implement the following steps: a log node creates an event component, and the event component includes an event topic. The log node applies for and obtains a particle product number, and the particle product number has a unique and non-reusable identifier. The log node binds the particle product number with the event component to obtain a log. The log node writes the log into a blockchain. The log node updates a particle product number atlas according to the log.

[0161] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the log node broadcasts the log to the nodes in the blockchain operating system. The trusted nodes in the blockchain operating system assemble the log into a block in chronological order and publish the block onto the blockchain.

[0162] In one embodiment, the computer program, when executed by the processor, further implements the following steps: after the log node writes the log into the blockchain, the trusted node deregisters the particle product number. The trusted node will be able to create the number of particle product numbers equal to the number of deregistered particle product numbers.

[0163] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the log node queries whether there is a graph event related to the event topic according to the event topic of the log. When there is no graph event related to the event topic, the log node creates a new graph event and an event particle product number index corresponding to the new graph event according to the log. When there is a graph event related to the event topic, the log node updates the graph event and the event particle product number index corresponding to the graph event according to the log.

[0164] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the synchronization node synchronizes the to-be-processed blockchain to the local. The synchronization node obtains the latest block on the to-be-processed blockchain as the current block. The synchronization node extracts all logs in the current block. The synchronization node establishes a particle product number graph according to the extracted logs. The synchronization node obtains the next block as the current block in reverse order, and continues to extract all logs in the current block, and updates the particle product number graph according to the extracted logs, until the blocks on the to-be-processed blockchain are all processed.

[0165] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the synchronization node obtains the target block and extracts the log in the target block. The synchronization node updates the particle product number graph according to the log in the target block.

[0166] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the log node sends a particle product number application request to the trusted node. The trusted node verifies the particle product number application request through the pairing node of the log node, and sends a particle product number to the log node after verification; the particle product number sent by the trusted node is obtained by the trusted node.

[0167] In one embodiment, the computer program, when executed by the processor, further implements the following steps: the query node obtains a to-be-queried event topic. The query node finds a particle product number graph corresponding to the to-be-queried event topic. The particle product number graph is obtained by the log recording method in the above-mentioned method embodiments. The query node obtains a target particle product number identifier in the graph event. The query node queries the block information corresponding to the target particle product number identifier through the event particle product number index in the particle product number graph. The query node queries the log from the block corresponding to the block information, and connects the queried log based on the particle product number connection relationship in the event particle product number index, to obtain a log chain under the to-be-queried event topic.

[0168] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, the processes of the above-mentioned embodiments can be included. Any reference to memory, storage, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM).

[0169] Any combination of the technical features of the above embodiments can be combined. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described, however, as long as the combination of the technical features does not exist, it should be considered as the scope of the present application.

[0170] The above embodiments only express several implementation manners of the present application, and the description is more specific and detailed, but it should not be understood as a limitation on the scope of the patent. It should be noted that for ordinary skilled in the art, without departing from the concept of the present application, some modifications and improvements can be made, which are within the scope of the present application. Therefore, the scope of the patent of the present application should be subject to the appended claims.

Claims

1. A blockchain-based log recording method, characterized in that, The blockchain-based log recording method includes: Log nodes create event components, which include event topics; The log node requests and obtains the particle product count, which has a unique and non-reusable identifier. The log node binds the particle product to the event component and obtains the log; The log node writes the log to the blockchain; The log node updates the particle product graph based on the log; After the log node writes the log to the blockchain, it also includes: Trusted nodes can cancel the particle product; The trusted node will increase the number of particle accumulations it can create by an amount equal to the number of particle accumulations it can deregister; The method for creating the particle product number map includes: The synchronization node synchronizes the blockchain to be processed to its local machine; The synchronization node obtains the latest block on the blockchain to be processed as the current block; The synchronization node extracts all logs from the current block; The synchronization node establishes the particle product graph based on the extracted logs; The synchronization node obtains the next block in reverse order as the current block, continues to extract all logs in the current block, and updates the particle product graph according to the extracted logs until all blocks on the blockchain to be processed are processed. The log node requests and obtains the particle product, including: The log node sends a particle product request to the trusted node; The trusted node verifies the particle product request through the paired node of the log node, and sends the particle product to the log node after successful verification; the particle product sent by the trusted node is generated by the trusted node.

2. The method according to claim 1, characterized in that, The log node writes the logs to the blockchain, including: The log node broadcasts the log to the nodes in the blockchain operating system; Trusted nodes in the blockchain operating system assemble the logs into blocks in chronological order and publish the blocks to the blockchain.

3. The method according to claim 1, characterized in that, The log node updates the particle product graph based on the log, including: The log node queries whether there are any graph events related to the event topic based on the event topic of the log. When there is no graph event related to the event topic, the log node creates a new graph event and an event particle product index corresponding to the new graph event based on the log. When a graph event related to the event topic exists, the log node updates the graph event and the event particle product index corresponding to the graph event according to the log.

4. The method according to claim 1, characterized in that, The method for creating the particle product number map also includes: The synchronization node obtains the target block and extracts the logs from the target block; The synchronization node updates the particle product graph based on the logs in the target block.

5. A blockchain-based log query method, characterized in that, The blockchain-based log query method includes: The query node retrieves the topic of the event to be queried; The query node searches the particle product graph to obtain the graph event corresponding to the topic of the event to be queried, wherein the particle product graph is obtained by the logging method described in any one of claims 1 to 4; The query node retrieves the target particle multiplier identifier in the graph event; The query node retrieves the block information corresponding to the target particle product identifier using the event particle product index in the particle product graph; The query node queries logs from the block corresponding to the block information, and connects the queried logs based on the particle product connection relationship in the event particle product index to obtain the log chain under the event topic to be queried.

6. A blockchain-based log recording device, characterized in that, The blockchain-based log recording device includes: The event creation module is used by log nodes to create event components, which include event topics; The particle product application module is used for the log node to apply for and obtain the particle product, and the particle product has a unique and non-reusable identifier. A log generation module is used by the log node to bind the particle product to the event component and obtain logs; A log writing module is used by the log node to write the logs into the blockchain; The graph update module is used by the log node to update the particle product graph according to the log; The particle product cancellation module is used for trusted nodes to cancel the particle product. The particle count increase module is used to increase the number of particle counts that the trusted node can create by an amount equal to the number of particle counts that are deregistered. The chain synchronization module is used to synchronize the blockchain to be processed to the local machine by the synchronization node; The latest block acquisition module is used by the synchronization node to acquire the latest block on the blockchain to be processed as the current block; The log extraction module is used by the synchronization node to extract all logs in the current block; The graph building module is used by the synchronization node to build the particle product graph based on the extracted logs; The iteration module is used by the synchronization node to obtain the next block as the current block in reverse order, and to continue to extract all logs in the current block, and update the particle product graph according to the extracted logs, until all blocks on the blockchain to be processed are processed. The request sending module is used to send a particle product request from the log node to the trusted node. The particle product sending module is used by the trusted node to verify the particle product request through the paired node of the log node, and to send the particle product to the log node after the verification is successful; the particle product sent by the trusted node is created by the trusted node.

7. The apparatus according to claim 6, characterized in that, The device further includes: The log broadcasting module is used by the log node to broadcast the logs to nodes in the blockchain operating system; The block publishing module is used by trusted nodes in the blockchain operating system to assemble the logs into blocks in chronological order and publish the blocks to the blockchain.

8. The apparatus according to claim 6, characterized in that, The device further includes: The query module is used by the log node to query whether there are any graph events related to the event topic of the log. A creation module is used so that when there is no graph event related to the event topic, the log node creates a new graph event and the event particle product index corresponding to the new graph event based on the log; An update module is used to update the graph event and the event particle product index corresponding to the graph event according to the log when there is a graph event related to the event topic.

9. The apparatus according to claim 6, characterized in that, The device further includes: The target block acquisition module is used to synchronize nodes to acquire target blocks and extract logs from the target blocks; The graph update module is used by the synchronization node to update the particle product graph based on the logs in the target block.

10. A blockchain-based log query device, characterized in that, The blockchain-based log query device includes: The event topic acquisition module is used to retrieve the event topic to be queried from the query node; The graph event acquisition module is used by the query node to search the particle product graph and obtain the graph event corresponding to the topic of the event to be queried. The particle product graph is obtained by the log recording method according to any one of claims 1 to 4. A particle product number identifier acquisition module is used by the query node to acquire the target particle product number identifier in the graph event; The block information acquisition module is used by the query node to query the block information corresponding to the target particle product identifier through the event particle product index in the particle product graph; The log connection module is used by the query node to query logs from the block corresponding to the block information, and connect the queried logs based on the particle product connection relationship in the event particle product index to obtain the log chain under the event topic to be queried.

11. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.

12. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Operation log recording method and device based on block chain and storage medium

    CN110489313A

  • Emergency assistance information acquisition method and device, computer equipment and medium

    CN112650858A