Network configuration management method and related apparatus

By employing a multi-level management structure and caching mechanism, the management methods for blockchain network configuration parameters are enriched, improving flexibility and security. This ensures that configuration parameters are written to the cache after verification, thereby enhancing the reliability of the blockchain network.

CN116846748BActive Publication Date: 2026-05-19TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
TENCENT TECHNOLOGY (SHENZHEN) CO LTD
Filing Date
2022-03-23
Publication Date
2026-05-19

AI Technical Summary

Technical Problem

Existing blockchain networks employ a single method for managing network configuration parameters, lacking flexibility and security.

Method used

It adopts a multi-level management structure, supports configuration parameter caching and contract management through network configuration parameter caching, supports configuration parameter types with multiple data granularities, including configuration parameter categories, subcategories and keys, performs multi-level management, and writes to the cache after verification.

Benefits of technology

It improves the flexibility and security of network configuration parameter management, ensuring that configuration parameters are only written to the cache after verification, thus enhancing the reliability of the blockchain network.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116846748B_ABST
    Figure CN116846748B_ABST
Patent Text Reader

Abstract

The application provides a network configuration management method and related device. The method comprises the following steps: obtaining a query request sent by a network configuration parameter using module, wherein the query request carries a configuration parameter cache key of a target configuration parameter type and a first query height; if the corresponding network configuration parameter does not exist in a network configuration parameter cache, obtaining an effective height of a target data granularity and the network configuration parameter from a network configuration management contract according to the configuration parameter cache key of the target configuration parameter type and the first query height; sending the effective height of the target data granularity and the network configuration parameter to the network configuration parameter using module, so that the network configuration parameter using module obtains a verification result; and when the verification result is a verification pass, writing the effective height of the target data granularity and the network configuration parameter into the network configuration parameter cache. The application can enrich the management mode of the network configuration parameter, and improve the flexibility and security of the network configuration parameter management.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a network configuration management method, a network configuration management device, a computer equipment, a computer-readable storage medium, and a computer program product. Background Technology

[0002] A blockchain system is a network of blockchain nodes. All nodes in the network need to reach a consensus on network configuration parameters such as block interval, object permission list, and blockchain node list in order to properly execute consensus mechanisms, execute transactions, and generate new blocks. Therefore, a mechanism is needed in the blockchain network to maintain consistent network configuration parameters across all nodes at the same block height.

[0003] In current methods, network configuration parameters in blockchain networks are typically stored and managed using key-value pairs, which is a relatively simplistic approach. Therefore, enriching the management methods for blockchain node network configuration parameters is a pressing technical issue that needs to be addressed. Summary of the Invention

[0004] This application provides a network configuration management method, apparatus, computer device, computer-readable storage medium, and computer program product, which can enrich the management methods of network configuration parameters and improve the flexibility and security of network configuration parameter management.

[0005] On one hand, embodiments of this application provide a network configuration management method applied to a network configuration management module in a blockchain node, the method comprising:

[0006] The network configuration parameters are obtained by using a query request sent by the module. The query request carries the configuration parameter cache key of the target configuration parameter type and the first query height.

[0007] If the corresponding network configuration parameter does not exist in the network configuration parameter cache, then based on the configuration parameter cache key of the target configuration parameter type and the first query height, the effective height of the target data granularity and the network configuration parameter are obtained from the network configuration management contract. The network configuration management contract maintains network configuration parameters with multiple data granularities.

[0008] The effective height of the target data granularity and the network configuration parameters are sent to the network configuration parameter usage module so that the network configuration parameter usage module can verify the effective height of the target data granularity and the network configuration parameters and obtain the verification result.

[0009] When the verification result is successful, the effective height of the target data granularity and the network configuration parameters are written to the network configuration parameter cache.

[0010] On one hand, embodiments of this application provide a network configuration management device applied to a network configuration management module in a blockchain node. The device includes:

[0011] The acquisition unit is used to acquire the query request sent by the network configuration parameter usage module. The query request carries the configuration parameter cache key of the target configuration parameter type and the first query height.

[0012] The processing unit is used to obtain the effective height of the target data granularity and the network configuration parameter from the network configuration management contract if the corresponding network configuration parameter does not exist in the network configuration parameter cache, based on the configuration parameter cache key of the target configuration parameter type and the first query height. The network configuration management contract maintains network configuration parameters with multiple data granularities.

[0013] The sending unit is used to send the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, so that the network configuration parameter using module can verify the effective height of the target data granularity and the network configuration parameters and obtain the verification result.

[0014] The processing unit is also used to write the effective height of the target data granularity and the network configuration parameters to the network configuration parameter cache when the verification result is that the verification is passed.

[0015] In one possible implementation, the target configuration parameter type is a first type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories, configuration parameter subclasses, and configuration parameter keys; the target data granularity is key granularity.

[0016] The processing unit retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, and performs the following operations:

[0017] Based on the configuration parameter classification, configuration parameter subclass, and configuration parameter key, multiple ordered mappings from the effective height to the configuration parameter value are retrieved from the network configuration management contract. The effective heights in the multiple ordered mappings are arranged in ascending order.

[0018] Traverse each ordered mapping in reverse order. If the effective height encountered during traversal is less than or equal to the first query height, then the effective height encountered during traversal is used as the effective height at the key granularity, and the configuration parameter value encountered during traversal is used as the network configuration parameter at the key granularity.

[0019] In one possible implementation, the target configuration parameter type is a second type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories and configuration parameter subclasses; the target data granularity is subclass granularity;

[0020] The processing unit retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, and performs the following operations:

[0021] Based on the configuration parameter classification and the configuration parameter subclass, retrieve the configuration parameter key list from the network configuration management contract;

[0022] Iterate through each configuration parameter key in the configuration parameter key list, and retrieve the effective height and configuration parameter value corresponding to each configuration parameter key from the network configuration management contract based on the configuration parameter category, configuration parameter subclass, each configuration parameter key and the first query height.

[0023] The maximum value among the retrieved effective heights is taken as the effective height at the subclass level.

[0024] Based on all the retrieved configuration parameter keys, the established mapping from configuration parameter keys to configuration parameter values ​​is used as the network configuration parameters at the subclass granularity.

[0025] In one possible implementation, the target configuration parameter type is a third type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories; the target data granularity is category granularity.

[0026] The processing unit retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, and performs the following operations:

[0027] Based on the configuration parameter classification, retrieve the list of configuration parameter subclasses from the network configuration management contract;

[0028] Iterate through each configuration parameter subclass in the configuration parameter subclass list, and retrieve the effective height of the subclass granularity corresponding to each configuration parameter subclass and the mapping from configuration parameter key to configuration parameter value from the network configuration management contract based on the configuration parameter category, configuration parameter subclass and the first query height;

[0029] The maximum value among the effective heights of each subclass granularity obtained from the retrieval is taken as the effective height of the classification granularity;

[0030] Based on all the retrieved configuration parameter subclasses and the mapping from configuration parameter keys to configuration parameter values, the established mapping between configuration parameter subclasses and configuration parameter keys to configuration parameter values ​​is used as the network configuration parameter at the classification granularity.

[0031] In one possible implementation, after the acquisition unit obtains the query request sent by the module using the network configuration parameters, the processing unit is further configured to perform the following operations:

[0032] Based on the query request, retrieve the corresponding network configuration parameters from the network configuration parameter cache;

[0033] If the queried network configuration parameters are not empty, the queried network configuration parameters will be sent to the network configuration parameter usage module so that the network configuration parameter usage module can configure the blockchain node according to the queried network configuration parameters.

[0034] If the queried network configuration parameter is empty, it is determined that there is no corresponding network configuration parameter in the network configuration parameter cache, and the steps of obtaining the effective height of the target data granularity and the network configuration parameter from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height are triggered.

[0035] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues;

[0036] The processing unit retrieves the corresponding network configuration parameters from the network configuration parameter cache based on the query request, and performs the following operations:

[0037] Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache;

[0038] If the network configuration parameter cache key of the target configuration parameter type does not exist in the network configuration parameter cache, then the network configuration parameter retrieved from the network configuration parameter cache according to the query request is determined to be empty.

[0039] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues;

[0040] The processing unit retrieves the corresponding network configuration parameters from the network configuration parameter cache based on the query request, and performs the following operations:

[0041] Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache;

[0042] If the target configuration parameter cache queue is not empty, then traverse each element in the target configuration parameter cache queue in reverse order. Each element is used to store the ordered mapping between the effective height, the last accessed height and the cached content.

[0043] If the effective height of the target element is less than or equal to the first query height, the cached content of the target element will be used as the queried network configuration parameters.

[0044] In one possible implementation, the processing unit writes the effective height of the target data granularity and the network configuration parameters to the network configuration parameter cache for performing the following operations:

[0045] Retrieve the configuration parameter cache queue from the network configuration parameter cache based on the configuration parameter cache key of the target configuration parameter type;

[0046] If the configuration parameter cache queue is not found, a new configuration parameter cache queue to be cached is created, and the configuration parameter cache key of the target configuration parameter type and the configuration parameter cache queue to be cached are written to the network configuration parameter cache.

[0047] Among them, the effective height in the configuration parameter cache queue to be cached is the effective height of the target data granularity, and the cached content in the configuration parameter cache queue to be cached is the network configuration parameters of the target data granularity.

[0048] In one possible implementation, after the processing unit sends the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, it is also used to perform the following operations:

[0049] If the received verification result is that the verification fails, and the effective height of the target data granularity is greater than the preset value, then the effective height of the target data granularity is reduced by one to obtain the second query height.

[0050] Based on the configuration parameter cache key of the target configuration parameter type and the second query height, obtain the effective height of the target data granularity and the network configuration parameters from the network configuration management contract.

[0051] In one possible implementation, the network configuration parameter cache includes a cache retention span; the processing unit is also used to perform the following operations:

[0052] When a block to be added to the blockchain is detected to be inserted into the blockchain structure, and the block to be added to the blockchain is determined by calling the Bloom filter to include an event that updates network configuration parameters, each event that updates network configuration parameters in the block to be added to the blockchain is traversed.

[0053] The network configuration parameter cache is marked based on the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height included in each event that updates network configuration parameters;

[0054] The difference between the latest block height of the block to be added to the chain and the cache retention span is used as the minimum cache height, and the network configuration parameter cache is cleaned up based on the minimum cache height.

[0055] In one possible implementation, the processing unit marks the network configuration parameter cache based on the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height included in each event that updates network configuration parameters, for the following operations:

[0056] Generate cache keys for configuration parameters to be marked based on configuration parameter categories, configuration parameter subcategories, and configuration parameter keys;

[0057] Based on the configuration parameter cache key to be tagged, retrieve the configuration parameter cache queue to be tagged from the network configuration parameter cache;

[0058] Mark the configuration parameter cache queue to be marked based on the effective height and the latest block height corresponding to the current blockchain structure.

[0059] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to a configuration parameter cache queue; the configuration parameter cache queue includes one or more elements, each element being used to store an ordered mapping between the effective height, the last accessed height, and the cached content;

[0060] The processing unit performs a cleanup operation on the network configuration parameter cache based on the minimum cache height, which is used to perform the following operations:

[0061] Traverse each pair of configuration parameter cache keys and configuration parameter cache queues in the network configuration parameter cache to obtain at least one configuration parameter cache queue to be cleaned. Any configuration parameter cache queue to be cleaned refers to a configuration parameter cache queue with more than a preset number threshold.

[0062] For each element in any configuration parameter cache queue to be cleaned, traverse the last access height of each element in ascending order of the effective storage height;

[0063] If the last access height of any element is less than the minimum cache height, then the element will be removed from any pending configuration parameter cache queue.

[0064] On one hand, embodiments of this application provide a computer device, which includes a memory and a processor. The memory stores a computer program, and when the computer program is executed by the processor, the processor performs the network configuration management method described above.

[0065] On one hand, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when read and executed by a processor of a computer device, causes the computer device to perform the aforementioned network configuration management method.

[0066] On one hand, embodiments of this application provide a computer program product or computer program that includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned network configuration management method.

[0067] In this embodiment, the network configuration management module in the blockchain node can receive a query request sent by the network configuration parameter usage module. This query request carries a configuration parameter cache key of the target configuration parameter type and a first query height. If the corresponding network configuration parameter does not exist in the network configuration parameter cache, the effective height and network configuration parameter of the target data granularity can be obtained from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height. The network configuration management contract maintains network configuration parameters of various data granularities. Next, the effective height and network configuration parameter of the target data granularity can be sent to the network configuration parameter usage module, allowing the module to verify them and obtain a verification result. Then, when the verification result is successful, the effective height and network configuration parameter of the target data granularity are written to the network configuration parameter cache. Therefore, this application can support configuration parameters of various data granularities, and various configuration parameter types including network configuration parameter usage parameter classification, configuration parameter subclasses, and configuration parameter keys. This multi-level management structure enriches the management methods of network configuration parameters, thereby improving the flexibility of network configuration parameter management. Furthermore, network configuration parameters at the target granularity obtained from the network configuration management contract can only be written to the network configuration parameter cache after they have passed verification, thereby improving the reliability and security of the network configuration parameter management process. Attached Figure Description

[0068] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0069] Figure 1 This is a schematic diagram of the structure of a distributed system provided in an embodiment of this application;

[0070] Figure 2 This is a schematic diagram of a block structure provided in an embodiment of this application;

[0071] Figure 3 This is a schematic diagram of the structure of a blockchain node provided in an embodiment of this application;

[0072] Figure 4 This is a flowchart illustrating a network configuration management method provided in an embodiment of this application;

[0073] Figure 5 This is a flowchart illustrating another network configuration management method provided in an embodiment of this application;

[0074] Figure 6 This is a schematic diagram of the structure of a network configuration management device provided in an embodiment of this application;

[0075] Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation

[0076] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application.

[0077] This application proposes a network configuration management scheme. The general principle of this scheme is as follows: The network configuration management module in a blockchain node can receive a query request sent by the network configuration parameter usage module. This query request carries a configuration parameter cache key of the target configuration parameter type and a first query height. If the corresponding network configuration parameter does not exist in the network configuration parameter cache, the effective height and network configuration parameter of the target data granularity can be obtained from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height. The network configuration management contract maintains network configuration parameters of various data granularities. Next, the effective height and network configuration parameter of the target data granularity can be sent to the network configuration parameter usage module so that the network configuration parameter usage module can verify the effective height and network configuration parameter of the target data granularity and obtain the verification result. Then, when the verification result is successful, the effective height and network configuration parameter of the target data granularity are written to the network configuration parameter cache. As can be seen, this application can support configuration parameters at multiple data granularities, using various configuration parameter types such as parameter classification, configuration parameter subclasses, and configuration parameter keys for network configuration parameters. This multi-level management structure enriches the management methods for network configuration parameters. Furthermore, only after the target granularity network configuration parameters obtained from the network configuration management contract have passed verification can they be written to the network configuration parameter cache, thereby improving the reliability of the network configuration parameter management process.

[0078] The network configuration management solution presented in this application can be combined with blockchain technology. The following section provides a detailed introduction to the blockchain technology involved in the network configuration management solution provided in this application:

[0079] The system involved in the embodiments of this application can be a distributed system formed by connecting clients and multiple nodes (any form of computing device accessing the network, such as servers and terminal devices) through network communication. The following is a reference to the appendix... Figure 1 - Appendix Figure 3 This section provides an introduction to blockchain-related technologies.

[0080] I. Blockchain System:

[0081] First, taking a distributed system as an example of a blockchain system, please refer to [link to relevant documentation]. Figure 1 , Figure 1 This is a schematic diagram of the structure of a distributed system provided in an embodiment of this application. For example... Figure 1 As shown, the distributed system 100 can be formed by multiple nodes (any form of computing device in the network, such as servers and terminal devices) and clients. These nodes form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In the distributed system, any machine, such as a server or terminal, can join and become a node. A node includes a hardware layer, a middleware layer, an operating system layer, and an application layer.

[0082] See Figure 1 The functions of each node in the blockchain system shown include:

[0083] 1) Routing: A basic function of nodes used to support communication between nodes.

[0084] In addition to routing capabilities, nodes can also have the following functions:

[0085] 2) Applications are deployed in the blockchain to implement specific business needs. They record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system. When other nodes successfully verify the source and integrity of the record data, they add the record data to a temporary block.

[0086] For example, the business logic implemented by the application includes:

[0087] 2.1) A wallet is used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system; after other nodes successfully verify the transaction, they store the transaction record data in the temporary block of the blockchain as a response to acknowledge the validity of the transaction; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;

[0088] 2.2) Shared ledger, used to provide functions such as storage, query and modification of ledger data. It sends the record data of the operation on the ledger data to other nodes in the blockchain system. After the other nodes verify the validity, as a response to acknowledge the validity of the ledger data, they store the record data in a temporary block. They can also send confirmation to the node that initiated the operation.

[0089] 2.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented through code deployed on a shared ledger that executes when certain conditions are met. Based on actual business needs, the code is used to complete automated transactions, such as querying the logistics status of goods purchased by a buyer and transferring the buyer's electronic funds to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions; they can also execute contracts for processing received information. In this embodiment, a network configuration management contract is deployed within the smart contract, which maintains all network configuration parameters in the blockchain network.

[0090] 3) A blockchain consists of a series of blocks that are sequentially generated. Once a new block is added to the blockchain, it will not be removed. The blocks contain the data submitted by the nodes in the blockchain system.

[0091] II. Block Structure:

[0092] Please see Figure 2 , Figure 2 This is a schematic diagram of a block structure provided in an embodiment of this application. For example... Figure 2 As shown, each block includes the hash value of the transactions stored in that block (the hash value of this block) and the hash value of the previous block. Blocks are linked together through these hash values ​​to form the blockchain. Additionally, blocks may include information such as a timestamp when the block was generated. A blockchain is essentially a decentralized database, a chain of data blocks linked together using cryptographic methods. Each data block contains relevant information used to verify the validity of the information (anti-counterfeiting) and to generate the next block.

[0093] III. Blockchain Nodes:

[0094] It should be noted that, Figure 1 Any node in the blockchain system shown can be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, etc.

[0095] Figure 1 Any node in the blockchain system shown can also be, but is not limited to: mobile phones, tablets, laptops, PDAs, mobile internet devices (MIDs), smart voice interaction devices, in-vehicle terminals, roadside devices, aircraft, wearable devices, smart home appliances, or wearable devices with network configuration management functions such as smartwatches, smart bracelets, and pedometers, etc.

[0096] This application uses any blockchain node as an example to provide a detailed description of the structure included in any blockchain node. Please refer to [link / reference]. Figure 3 , Figure 3 This is a schematic diagram of the structure of a blockchain node provided in an embodiment of this application. Figure 3 As shown, a blockchain node can include, but is not limited to: a transaction pool, a block generation module, a consensus module, a blockchain structure, a network configuration management module, and smart contracts. The following sections will introduce each module and its related parameters:

[0097] ① Transaction Pool: When an object initiates a transaction (a transaction sent by a blockchain account: containing a transaction hash as a unique identifier, including an account address identifying the account that sent the transaction, and the transaction reads or modifies the account's state data through smart contract execution), each blockchain node can receive the transaction sent by that object and read the "Object Permission List" parameter in the network configuration. Then, based on this "Object Permission List" parameter, it can determine whether the object sending the transaction has the permission to modify blockchain data. If it does not have the permission to modify blockchain data, the transaction is discarded; if it does have the permission, the transaction is cached in the transaction pool. The "Object Permission List" parameter is a secondary configuration parameter, meaning that both the configuration parameter category and its subcategory are "Object Permission List". The configuration parameter key is the blockchain account address, and the configuration parameter value is write permission or read permission. The "Object Permission List" parameter records the operation permissions (e.g., read permission, write permission, etc.) corresponding to each blockchain account address. Only transactions sent by blockchain accounts with write permissions will be verified by the blockchain nodes. A blockchain account is defined as follows: it contains an account address as a unique identifier, a balance as the digital assets of that blockchain account in the current world state, and each blockchain account has several state data. The account contains an account state root as a snapshot of its state data. The data structure of the "Object Permission List" parameter can be shown in Table 1 below:

[0098] Table 1. Data Structure of the "Object Permission List" Parameter

[0099]

[0100] ② Block Generation Module: When a blockchain node is selected as a block-producing node according to the consensus mechanism, the block generation module reads the "block interval" parameter in the network configuration. Then, after a certain delay based on this parameter, it creates a candidate block in memory and packages transactions from the transaction pool into the candidate block. The "block interval" parameter is a primary configuration parameter, meaning that the configuration parameter category, subcategory, and key are all "block interval." The configuration parameter value is a specific interval time, recording the time interval (e.g., 1 second) that needs to be maintained during block generation in the blockchain network. It's understood that an excessively large block interval will reduce the blockchain network's transaction processing speed, while an excessively small block interval may result in a large number of empty blocks. Therefore, setting a reasonable block interval helps in effectively managing the blockchain network. The data structure of the "block interval" parameter is shown in Table 2 below.

[0101] Table 2. Data Structure of the "Block Interval" Parameter

[0102]

[0103] ③ Consensus Module: The formula module of each blockchain node reads the "Blockchain Node List" parameter from the network configuration. For candidate blocks, the consensus module can reach a consensus among the various blockchain nodes based on the consensus mechanism to generate new blocks. The "Blockchain Node List" parameter is a three-level configuration parameter. The three-level configuration parameter means that the configuration parameter category is fixed as "Blockchain Node List," with subcategories including "Ordinary Node List" and "Consensus Node List." The configuration parameter key is the blockchain node identifier. For the ordinary node list, the configuration parameter value is the blockchain node's public key, which can be used for mutual authentication and establishing encrypted communication connections between blockchain nodes. For the consensus node list, the configuration parameter value is the consensus weight. Only blockchain nodes in the consensus node list can participate in the block generation consensus. The consensus weight determines the probability that a blockchain node becomes a block-producing node in each round. The data structure of the "Blockchain Node List" parameter can be shown in Table 3 below.

[0104] Table 3. Data Structure of "Blockchain Node List" Parameters

[0105]

[0106] ④ Blockchain Structure: A blockchain structure refers to a chain-like structure composed of all blocks linked together. The blockchain structure stores all transactions of the blockchain system. Whenever a new block is inserted into the blockchain structure, a Bloom filter is used to quickly determine whether the new block contains an event that updates the network configuration parameters in the network configuration management contract. If the new block contains such an event, appropriate processing is performed.

[0107] ⑤ Network Configuration Management Module: This module is mainly used to implement the processes of "marking and clearing network configuration parameter cache" and "reading and writing network configuration parameter cache". It contains a network configuration parameter cache and is responsible for caching network configuration parameters in memory.

[0108] ⑥ Smart Contracts: The consensus mechanism requires the execution of each transaction within a block. Essentially, it is the process of executing smart contracts within transactions. Smart contracts deploy network configuration management contracts, which maintain all network configuration parameters.

[0109] IV. Next, the relevant terms (network configuration management contract, network configuration parameter cache, network configuration parameter cache queue) involved in the embodiments of this application will be introduced accordingly:

[0110] ① Network Configuration Management Contract:

[0111] The network configuration management contract maintains all network configuration parameters, which can utilize a multi-level management structure (i.e., network configuration parameters with multiple data granularities). The network configuration management contract can include multiple configuration parameter categories, each category can include multiple configuration parameter subcategories, each subcategory can include multiple configuration parameter keys, and each configuration parameter key can have multiple effective heights. For a given configuration parameter category, subcategory, and key, the effective heights are arranged in ascending order, and each effective height corresponds to a configuration parameter value, with the following specific functions:

[0112] Configuration parameter classification: Based on the configuration parameter classification, all subclasses of configuration parameters under that classification can be retrieved from the network configuration management contract to form a list of configuration parameter subclasses.

[0113] Configuration Parameter Subclass: Based on the configuration parameter category and configuration parameter subclass, all configuration parameter keys under that category and subclass can be retrieved from the network configuration management contract to form a configuration parameter key list.

[0114] Configuration parameter key: Based on configuration parameter category, configuration parameter subclass, and configuration parameter key, it can retrieve all effective heights and their corresponding configuration parameter values ​​under that configuration parameter category, configuration parameter subclass, and configuration parameter key from the network configuration management contract, forming an ordered mapping from effective height to configuration parameter value. The effective heights in this ordered mapping are arranged in ascending order.

[0115] Effective height: This means that the configuration parameter will only take effect after the block at this block height is uploaded to the blockchain. Uploading to the blockchain means that each block contains multiple transactions. When a block is inserted into the blockchain data structure of each blockchain node through consensus, it is called uploading to the blockchain.

[0116] Configuration parameter value: The specific value of the configuration parameter.

[0117] In summary, the data structure of the network configuration management contract is shown in Table 4 below:

[0118] Table 4. Data Structure of Network Configuration Management Contract

[0119]

[0120]

[0121] Understandably, this application employs a multi-level management structure for network configuration parameters, including parameter categories, subcategories, and keys. It supports configuration parameter types with different data granularities and uses these categories, subcategories, and keys as event indexes, allowing for rapid retrieval via Bloom filters. Furthermore, this application assigns different effective heights to each configuration parameter, supports pre-setting network configuration parameters for future block heights, and verifies and detects incorrectly set network configuration parameters. Parameters failing verification are disqualified, and the old version of the network configuration parameter is reused, thereby maintaining the stable operation of the blockchain system and improving the flexibility and security of blockchain network management.

[0122] ② Network configuration parameter caching:

[0123] Network configuration parameter caching in memory maintains a mapping from configuration parameter cache keys to the configuration parameter cache queue. A mapping is a data structure consisting of a collection of key-value pairs, generally described as a mapping from "key" to "value," allowing for quick lookup of values ​​based on keys. Each element in the mapping is a key-value pair, typically implemented using a HashMap. The configuration parameter cache keys can be of one of the following three types:

[0124] Type 1: Consists of configuration parameter categories, configuration parameter subcategories, and configuration parameter keys;

[0125] Type 2: Consists of both configuration parameter categories and configuration parameter subcategories;

[0126] Type 3: Composed of configuration parameter categories alone.

[0127] For example, the data structure for configuring parameter caching can be shown in Table 5 below:

[0128] Table 5. Data Structure of Configuration Parameter Cache

[0129] Configuration parameter cache key 1 Configuration parameter cache queue 1 Configuration parameter cache key 2 Configuration parameter cache queue 2 Configuration parameter cache key 3 Configuration parameter cache queue 3

[0130] It should be noted that the network configuration parameter cache also contains a constant called "cache retention span", which is used to identify the block span that needs to retain historical configuration parameters.

[0131] ③ Configure parameter caching queue:

[0132] The configuration parameter cache queue consists of one or more elements. Each element stores an ordered mapping between the effective height, the last accessed height, and the cached content. An ordered mapping means that the keys are arranged in a specific order (e.g., an ordered mapping from the effective height to the last accessed height and then to the cached content), typically implemented using a TreeMap. The elements in the configuration parameter cache queue are arranged in ascending order of their effective height. The last accessed height is the current block height at which the corresponding cached content was last read, updated, or marked. The cached content can be configuration parameter values, mappings from configuration parameter keys to configuration parameter values, mappings from configuration parameter subclasses to mappings from configuration parameter keys to configuration parameter values, or "none," indicating that the configuration for that effective height does not exist or has been invalidated. It can also be "empty," indicating that the effective height has been marked by the smart contract and needs to be retrieved from the smart contract to update the cache. The data structure of the configuration parameter cache queue is shown in Table 6 below.

[0133] Table 6. Data Structure of Configuration Parameter Cache Queue

[0134]

[0135] Based on the above description of network configuration management schemes and systems, this application proposes a network configuration management method. See also... Figure 4 As shown, Figure 4 This is a flowchart illustrating a network configuration management method provided in an embodiment of this application. This network configuration management method can be executed by the network configuration management module of the aforementioned blockchain node (terminal device or server). For ease of explanation, the following description will use a computer device executing this network configuration management method as an example. The network configuration management method may include the following steps S401 to S404:

[0136] S401: Obtain network configuration parameters using the query request sent by the module. The query request carries the configuration parameter cache key of the target configuration parameter type and the first query height.

[0137] In this embodiment of the application, the network configuration parameter usage module refers to the module that needs to use network configuration parameters. The network configuration parameter usage module may include, but is not limited to: a block generation module that uses the first-level configuration parameter "block interval", a transaction pool that uses the second-level configuration parameter "object permission list", and a consensus module that uses the third-level configuration parameter "blockchain node list".

[0138] In one possible implementation, the network configuration parameter using module can send a query request to the network configuration management module when it needs to use network configuration parameters. Specifically, if the network configuration parameter using module needs to query first-level configuration parameters, the query request can include the configuration parameter category, configuration parameter subclass, configuration parameter key, and a first query height; if the network configuration parameter using module needs to query second-level configuration parameters, the query request can include the parameter configuration parameter category, configuration parameter subclass, and a first query height; and if the network configuration parameter using module needs to query third-level configuration parameters, the query request can include the parameter configuration parameter category and a first query height.

[0139] Specifically, if querying a first-level configuration parameter ("block interval" parameter), the configuration parameter category, configuration parameter subclass, and configuration parameter key are combined into a type one configuration parameter cache key. If querying a second-level configuration parameter ("object permission list" parameter), the configuration parameter category and configuration parameter subclass are combined into a type two configuration parameter cache key. If querying a third-level configuration parameter ("blockchain node list" parameter), the configuration parameter category is combined separately into a type three configuration parameter cache key.

[0140] In one possible implementation, after the network configuration management module receives the query request sent by the network configuration parameter usage module, it further includes: querying the corresponding network configuration parameter from the network configuration parameter cache according to the query request; if the queried network configuration parameter is not empty, sending the queried network configuration parameter to the network configuration parameter usage module so that the network configuration parameter usage module configures the blockchain node according to the queried network configuration parameter; if the queried network configuration parameter is empty, determining that there is no corresponding network configuration parameter in the network configuration parameter cache, and triggering the step of obtaining the effective height of the target data granularity and the network configuration parameter from the network configuration management contract according to the configuration parameter cache key of the target configuration parameter type and the first query height.

[0141] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues. The network configuration management module queries the corresponding network configuration parameters from the network configuration parameter cache based on a query request. This may include: reading the target configuration parameter cache queue from the network configuration parameter cache based on the configuration parameter cache key of the target configuration parameter type; if the configuration parameter cache key of the target configuration parameter type does not exist in the network configuration parameter cache, then the network configuration parameter retrieved from the network configuration parameter cache based on the query request is determined to be empty.

[0142] In another possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues. The network configuration management module queries the corresponding network configuration parameters from the network configuration parameter cache based on the query request. This can include: reading the target configuration parameter cache queue from the network configuration parameter cache according to the configuration parameter cache key of the target configuration parameter type; if the read target configuration parameter cache queue is not empty, then traversing each element in the target configuration parameter cache queue in reverse order, with each element used to store an ordered mapping between the effective height, the last accessed height, and the cached content; when the effective height in the target element is less than or equal to the first query height, then the cached content in the target element is used as the queried network configuration parameter.

[0143] Next, the process of reading the network configuration parameter cache will be explained in detail:

[0144] Based on the configuration parameter cache key of the target configuration parameter type and the first query height, read the network configuration parameter cache. The specific steps are as follows:

[0145] (1) Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache: If the configuration parameter cache key of the target configuration parameter type does not exist in the network configuration parameter cache, it is determined that there is no corresponding network configuration parameter in the network configuration parameter cache, and "empty" is returned and this process ends. If the target configuration parameter cache queue is retrieved from the network configuration parameter cache, continue to execute the following steps;

[0146] (2) Traverse each element in the target configuration parameter cache queue in reverse order until the following condition is met:

[0147] The effective height of the element is less than or equal to the first query height.

[0148] If a target element that meets the above conditions can be found, the last access height of the target element is modified to the latest block height in the blockchain structure, and the cached content in the target element is used as the queried network configuration parameter and returned. Then the process ends.

[0149] If no target element that meets the above conditions is found, it is determined that the network configuration parameters retrieved from the network configuration parameter cache according to the query request are empty, that is, the result returned is "empty".

[0150] S402: If the corresponding network configuration parameter does not exist in the network configuration parameter cache, then based on the configuration parameter cache key of the target configuration parameter type and the first query height, obtain the effective height of the target data granularity and the network configuration parameter from the network configuration management contract. The network configuration management contract maintains network configuration parameters with multiple data granularities.

[0151] Specifically, if the network configuration parameter retrieved from the network configuration parameter cache is empty based on the query request, it is determined that the corresponding network configuration parameter does not exist in the network configuration parameter cache. The network configuration management module can then retrieve the effective height of the target data granularity and the network configuration parameter from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height.

[0152] In one possible implementation, the target configuration parameter type is a first type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter category, configuration parameter subclass, and configuration parameter key; the target data granularity is key granularity. Based on the configuration parameter cache key of the target configuration parameter type and the first query height, the effective height and network configuration parameters of the target data granularity are obtained from the network configuration management contract. This can include: retrieving multiple ordered mappings from the effective height to the configuration parameter value from the network configuration management contract based on the configuration parameter category, configuration parameter subclass, and configuration parameter key, where the effective heights in the multiple ordered mappings are arranged in ascending order; traversing each ordered mapping in reverse order, if the effective height encountered is less than or equal to the first query height, then the encountered effective height is used as the effective height of the key granularity, and the encountered configuration parameter value is used as the network configuration parameter of the key granularity.

[0153] In one possible implementation, the target configuration parameter type is a second type; the configuration parameter cache key of the target configuration parameter type includes a configuration parameter category and a configuration parameter subclass; the target data granularity is a subclass granularity. Based on the configuration parameter cache key of the target configuration parameter type and the first query height, obtaining the effective height and network configuration parameters of the target data granularity from the network configuration management contract can include: retrieving a list of configuration parameter keys from the network configuration management contract based on the configuration parameter category and configuration parameter subclass; traversing each configuration parameter key in the list, and retrieving the effective height and configuration parameter value corresponding to each configuration parameter key from the network configuration management contract based on the configuration parameter category, configuration parameter subclass, each configuration parameter key, and the first query height; using the maximum value among the retrieved effective heights as the effective height of the subclass granularity; and using the established mapping from configuration parameter keys to configuration parameter values ​​as the network configuration parameters of the subclass granularity based on all retrieved configuration parameter keys.

[0154] In one possible implementation, the target configuration parameter type is a third type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories; and the target data granularity is category granularity. Based on the configuration parameter cache key of the target configuration parameter type and the first query height, obtaining the effective height of the target data granularity and the network configuration parameters from the network configuration management contract can include: retrieving a list of configuration parameter subclasses from the network configuration management contract based on the configuration parameter categories; traversing each configuration parameter subclass in the list, and retrieving, based on the configuration parameter categories, configuration parameter subclasses, and the first query height, the effective height of the subclass granularity corresponding to each configuration parameter subclass, as well as the mapping from configuration parameter keys to configuration parameter values, from the network configuration management contract; using the maximum value among the retrieved effective heights of each subclass granularity as the effective height of the category granularity; and using the established mapping between configuration parameter subclasses and the mapping from configuration parameter keys to configuration parameter values ​​as the network configuration parameters of the category granularity, based on all retrieved configuration parameter subclasses and the mapping from configuration parameter keys to configuration parameter values.

[0155] S403: Send the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, so that the network configuration parameter using module can verify the effective height of the target data granularity and the network configuration parameters, and obtain the verification result.

[0156] In one possible implementation, the network configuration management module sends the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, so that the network configuration parameter using module can verify the effective height of the target data granularity and the network configuration parameters, and obtain the verification result. Then, the network configuration management module can receive the verification result sent by the network configuration parameter using module. The verification result can include whether the verification passed or failed.

[0157] S404: When the verification result is successful, the effective height of the target data granularity and the network configuration parameters are written to the network configuration parameter cache.

[0158] In one possible implementation, when the verification result is successful, the effective height of the target data granularity and the network configuration parameters are written to the network configuration parameter cache. This may include: retrieving a configuration parameter cache queue from the network configuration parameter cache based on the configuration parameter cache key of the target configuration parameter type; if no configuration parameter cache queue is retrieved, a new configuration parameter cache queue to be cached is created, and the configuration parameter cache key of the target configuration parameter type and the configuration parameter cache queue to be cached are written to the network configuration parameter cache. Here, the effective height in the configuration parameter cache queue to be cached is the effective height of the target data granularity, the cached content in the configuration parameter cache queue to be cached is the network configuration parameters of the target data granularity, and the last access height in the configuration parameter cache queue to be cached is the latest block height of the current blockchain structure.

[0159] In another possible implementation, after the network configuration management module sends the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, if the received verification result is a verification failure and the effective height of the target data granularity is greater than a preset value, then the effective height of the target data granularity is decremented by one to obtain a second query height. Based on the configuration parameter cache key of the target configuration parameter type and the second query height, the effective height of the target data granularity and the network configuration parameters are obtained from the network configuration management contract. Further, the network configuration management module will repeatedly execute the specific steps mentioned in steps S403-S404 above, which will not be repeated here in this embodiment.

[0160] It should be noted that the effective height used when writing network configuration parameters to the cache here is the effective height retrieved from the network configuration management contract for the first time. This step verifies and detects incorrectly set network configuration parameters, disabling those that fail the verification and reusing the old version of the network configuration parameters. This ensures the stable operation of the blockchain system and improves the flexibility and security of blockchain network management.

[0161] In this embodiment, the network configuration management module in the blockchain node can receive a query request sent by the network configuration parameter usage module. This query request carries a configuration parameter cache key of the target configuration parameter type and a first query height. If the corresponding network configuration parameter does not exist in the network configuration parameter cache, the effective height and network configuration parameter of the target data granularity can be obtained from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height. The network configuration management contract maintains network configuration parameters of various data granularities. Next, the effective height and network configuration parameter of the target data granularity can be sent to the network configuration parameter usage module, allowing the module to verify them and obtain a verification result. Then, when the verification result is successful, the effective height and network configuration parameter of the target data granularity are written to the network configuration parameter cache. Therefore, this application can support configuration parameters of various data granularities, and various configuration parameter types including network configuration parameter usage parameter classification, configuration parameter subclasses, and configuration parameter keys. This multi-level management structure enriches the management methods of network configuration parameters, thereby improving the flexibility of network configuration parameter management. Furthermore, network configuration parameters at the target granularity obtained from the network configuration management contract can only be written to the network configuration parameter cache after they have passed verification, thereby improving the reliability and security of the network configuration parameter management process.

[0162] Next, please see Figure 5 , Figure 5 This is a flowchart illustrating another network configuration management method provided in this application embodiment. This network configuration management method can be executed by the network configuration management module of the blockchain node (terminal device or server) mentioned above. Figure 5 As shown, this network configuration management method can include the following two main processes: a process for reading and writing network configuration parameter caches, and a process for marking and clearing network configuration parameter caches. The specific steps involved in each of these two processes will be described in detail below:

[0163] I. The process of reading and writing network configuration parameter cache, which may include the following steps S1 to S7:

[0164] S1, Query:

[0165] In this embodiment, the module that needs to use network configuration parameters (i.e., the network configuration parameter using module) can be a block generation module that uses the first-level configuration parameter "block interval", a transaction pool that needs to use the second-level configuration parameter "object permission list", or a consensus module that needs to use the third-level configuration parameter "blockchain node list". When the network configuration parameters need to be used, the network configuration parameter using module initiates a query request to the network configuration parameter cache. If it is a query for first-level configuration parameters, the query request should include the parameter configuration parameter category, configuration parameter subclass, configuration parameter key, and first query height; if it is a query for second-level configuration parameters, the query request should include the parameter configuration parameter category, configuration parameter subclass, and first query height; if it is a query for third-level configuration parameters, the query request should include the parameter configuration parameter category and first query height.

[0166] S2, Read:

[0167] If querying first-level configuration parameters, the configuration parameter category, subcategory, and key are combined into a type-one configuration parameter cache key. If querying second-level configuration parameters, the configuration parameter category and subcategory are combined into a type-two configuration parameter cache key. If querying third-level configuration parameters, the configuration parameter category is combined separately into a type-three configuration parameter cache key. Further, based on the configuration parameter cache key of the target configuration parameter type (i.e., including type-one, type-two, and type-three configuration parameter cache keys) and the first query height, the "read network configuration parameter cache process" is invoked to obtain the target data-granularity network configuration parameters.

[0168] In practice, the network configuration parameter cache is read based on the configuration parameter cache key of the target configuration parameter type and the first query height. The specific steps are as follows:

[0169] (1) Based on the configuration parameter cache key of the target configuration parameter type, retrieve the configuration parameter cache queue from the network configuration parameter cache. If the configuration parameter cache key of the target configuration parameter type does not exist in the network configuration parameter cache, return "empty" and the process ends. If the configuration parameter cache queue is retrieved, continue to execute the following steps.

[0170] (2) Traverse each element in the configuration parameter cache queue in reverse order until the following condition is met:

[0171] The effective height of the element is less than or equal to the first query height.

[0172] If a target element that meets the above conditions can be found, the last access height of the target element is modified to the latest block height in the blockchain structure, and the cached content of the target element is returned as the network configuration parameter of the target data granularity. Then the process ends. If no element that meets the above conditions can be found, the result is "empty".

[0173] S3, Usage:

[0174] It should be noted that if the read network configuration parameters are not "empty" (i.e., there are network configuration parameters at the target data granularity), the read network configuration parameters at the target data granularity are returned to the network configuration parameter using module so that the network configuration parameter using module can configure the blockchain node according to the read network configuration parameters, and this process ends; if the read network configuration parameters are "empty", then continue to execute the following steps.

[0175] S4. Search:

[0176] In practice, based on the configuration parameter cache key of the target configuration parameter type and the first query height, the effective height of the target data granularity and the network configuration parameters are obtained from the network configuration management contract.

[0177] (1) If it is a query of first-level configuration parameters, the "process of retrieving network configuration parameters of key granularity from smart contracts" is called according to the configuration parameter category, configuration parameter subclass, configuration parameter key and first query height to obtain the effective height of key granularity and configuration parameter value.

[0178] Specifically, based on configuration parameter classification, configuration parameter subclass, configuration parameter key, and first query height, the key-level network configuration parameters are retrieved from the smart contract. The specific steps are as follows:

[0179] ① The network configuration management module retrieves multiple ordered mappings from the network configuration management contract based on the configuration parameter classification, configuration parameter subclass, and configuration parameter key. The effective heights in these multiple ordered mappings are arranged in ascending order.

[0180] ② Traverse each pair of effective height and configuration parameter value in reverse order from the ordered mapping from effective height to configuration parameter value until the following condition is met:

[0181] Effective height <= First query height

[0182] If an effective height and configuration parameter value that meet the above conditions can be found, the found effective height is returned as the key-granularity effective height along with the found configuration parameter value, and the process ends. If an effective height and configuration parameter value that meet the above conditions cannot be found, the following steps continue.

[0183] ③ The effective height of the return key granularity is 0, and the return configuration parameter value is "none".

[0184] (2) If it is a query for secondary configuration parameters, the “process of retrieving network configuration parameters of subclass granularity from smart contract” is called according to the configuration parameter classification, configuration parameter subclass and first query height to obtain the effective height of subclass granularity and the mapping from configuration parameter key to configuration parameter value.

[0185] Specifically, based on the configuration parameter category, configuration parameter subclass, and first query height, the network configuration parameters at the subclass granularity are retrieved from the smart contract. The specific steps are as follows:

[0186] ① The network configuration management module retrieves the list of configuration parameter keys under the configuration parameter category and configuration parameter subcategory from the network configuration management contract based on the configuration parameter category and configuration parameter subcategory;

[0187] ② If the configuration parameter key list is empty, the effective height of the subclass granularity is returned as 0 and the mapping from configuration parameter key to configuration parameter value is "none", and this process ends. If the configuration parameter key list is not empty, continue to execute the following steps.

[0188] ③ Traverse each configuration parameter key in the configuration parameter key list, and call the "process of retrieving network configuration parameters at the key granularity from the smart contract" according to the configuration parameter category, configuration parameter subclass, configuration parameter key, and first query height (the specific execution process is shown in step (1) above, and will not be repeated here in this application embodiment) to retrieve the effective height and configuration parameter value of the configuration parameter key;

[0189] ④ Find the maximum value among all the effective heights retrieved above, and use it as the effective height of the subclass granularity. Also, based on all the configuration parameter keys and configuration parameter values ​​retrieved above, establish a mapping from configuration parameter keys to configuration parameter values ​​in memory.

[0190] ⑤ Returns the effective height of the subclass granularity and the mapping from configuration parameter keys to configuration parameter values.

[0191] The mapping from configuration parameter keys to configuration parameter values ​​is shown in Table 7 below:

[0192] Table 7. Mapping from configuration parameter keys to configuration parameter values

[0193]

[0194] (3) If it is a query of third-level configuration parameters, the "process of retrieving network configuration parameters of classification granularity from smart contracts" is called according to the configuration parameter classification and the first query height to obtain the effective height of classification granularity and the mapping between configuration parameter subclasses and configuration parameter keys to configuration parameter values.

[0195] Specifically, based on the configuration parameter classification and the first query height, the network configuration parameters at the classification granularity are retrieved from the smart contract. The specific steps are as follows:

[0196] ① The network configuration management module retrieves a list of subcategories of configuration parameters under each category from the network configuration management contract based on the classification of configuration parameters.

[0197] ② If the list of configuration parameter subclasses is empty, the effective height of the classification granularity is returned as 0, and the mapping between the configuration parameter subclass and the configuration parameter key to the configuration parameter value is "none", and this process ends; if the list of configuration parameter subclasses is not empty, continue to execute the following steps;

[0198] ③ Traverse each configuration parameter subclass in the configuration parameter subclass list, and call the "process of retrieving network configuration parameters of subclass granularity from smart contracts" according to the configuration parameter classification, configuration parameter subclass, and first query height (the specific execution process is shown in step (2) above, and will not be repeated here in this application embodiment) to retrieve the effective height of the subclass granularity of the configuration parameter subclass and the mapping from configuration parameter key to configuration parameter value;

[0199] ④ Find the maximum value among the effective heights of all subclass granularities retrieved above, and use it as the effective height of the classification granularity. Also, establish a mapping in memory between all the configuration parameter subclasses retrieved above and the mapping from configuration parameter keys to configuration parameter values.

[0200] ⑤ Returns the effective height of the classification granularity and the mapping between the configuration parameter subclass and the configuration parameter key to the configuration parameter value.

[0201] The mapping from configuration parameter subclasses to configuration parameter keys to configuration parameter values ​​is shown in Table 8 below:

[0202] Table 8. Mapping from configuration parameter subclasses to configuration parameter keys to configuration parameter values

[0203]

[0204] It should be noted that the effective height of the key granularity, the effective height of the subclass granularity, or the effective height of the category granularity mentioned above can be collectively referred to as the effective height. The configuration parameter values, the mapping from configuration parameter keys to configuration parameter values ​​(as shown in Table 7), or the mapping between configuration parameter subclasses and the mapping from configuration parameter keys to configuration parameter values ​​(as shown in Table 8) can be collectively referred to as smart contract query results.

[0205] S5, Verification:

[0206] The effective height and smart contract query results obtained from the S4 retrieval above are sent to the network configuration parameter usage module so that the network configuration parameter usage module can verify the effective height and smart contract query results. This verification logic is implemented by the network configuration parameter usage module, and may include security verification, legality verification, etc. Then the verification result is obtained, which may include verification passed or verification failed.

[0207] The network configuration management module can receive the verification result sent by the network configuration parameter usage module. If the verification result is successful, step S6 is triggered; if the verification result is unsuccessful, step S7 is triggered.

[0208] S6, Write:

[0209] In practice, when the verification result is successful, the effective height of the target data granularity and the network configuration parameters are written to the network configuration parameter cache. In other words, if the above verification passes, the smart contract query result (the network configuration parameters of the target data granularity) is used as cached content. Combined with the configuration parameter cache key and the effective height, the "write to network configuration parameter cache process" is invoked, and the smart contract query result is returned to the module that needs to use the network configuration parameters. This allows the network configuration parameter module to configure the blockchain node according to the read network configuration parameters, and the process ends.

[0210] Specifically, based on the target data granularity configuration parameter cache key, effective height, and cache content, the network configuration parameter cache is written. The specific steps are as follows:

[0211] ① Based on the configuration parameter cache key of the target data granularity, retrieve the configuration parameter cache queue from the network configuration parameter cache. If the corresponding configuration parameter cache queue does not exist, create a new configuration parameter cache queue and add the configuration parameter cache key of the target data granularity and the newly created configuration parameter cache queue to the network configuration parameter cache.

[0212] ② Update the effective height and cached content to the configuration parameter cache queue, and record the corresponding last access height as the latest block height of the current blockchain structure.

[0213] S7, Effective Height Decrease by 1:

[0214] If the effective height is not greater than 0, the system will report an error. If the effective height is greater than 0, the effective height will be reduced by 1 to obtain the second query height. Then, the operations shown in steps S4-S6 will be repeated based on the configuration parameter cache key of the target configuration parameter type and the second query height. It should be noted that the effective height used when writing to the network configuration parameter cache here is the effective height retrieved from the smart contract for the first time.

[0215] In addition, this step verifies and detects network configuration parameters that have been set incorrectly by human intervention. If the verification fails, the network configuration parameters that fail will not take effect and the old version of the network configuration parameters will be used. This will maintain the stable operation of the blockchain system and improve the flexibility and security of blockchain network management.

[0216] II. The process of marking and clearing the network configuration parameter cache:

[0217] (1) First, the process of updating network configuration parameters will be introduced. The blockchain object updates the network configuration parameters of all blockchain nodes in the blockchain network by sending transactions. The specific steps are as follows:

[0218] ① A blockchain object sends a transaction to a blockchain node, specifying the execution of the function to update network configuration parameters in the network configuration management contract. The transaction parameters may include: configuration parameter category, configuration parameter subclass, configuration parameter key, effective height, and configuration parameter value.

[0219] ② The blockchain node will receive the transaction sent by the object, read the "object permission list" parameter in the network configuration, and determine whether the object that sent the transaction has the permission to modify the blockchain data based on the parameter. If it does not have the permission to modify the blockchain data, the transaction will be discarded. If it has the permission to modify the blockchain data, the transaction will be cached in the transaction pool.

[0220] ③ According to the consensus mechanism, when a blockchain node is selected as a block-producing node, the block generation module will read the "block interval" parameter in the network configuration and, after a certain delay (e.g., 1 second) based on the parameter, create a candidate block in memory and package the transactions in the transaction pool into the candidate block;

[0221] ④ Each blockchain node reads the "blockchain node list" parameter in the network configuration, and for candidate blocks, reaches a consensus among the various blockchain nodes based on the consensus mechanism to generate a new block;

[0222] ⑤ After consensus is reached on the new block, each blockchain node executes each transaction in the new block. Specifically, when executing the function to update network configuration parameters in the network configuration management contract, the configuration parameter category, subcategory, key, effective height, and value are updated in the network configuration management contract, and a smart contract event is recorded. This smart contract event contains the following fields: configuration parameter category, subcategory, key, and effective height. The configuration parameter category, subcategory, and key can be used as indexes for the smart contract event, allowing for fast retrieval by a Bloom filter.

[0223] ⑥ Each blockchain node inserts a new block into the blockchain structure;

[0224] ⑦ Each blockchain node triggers the "marking and clearing of network configuration parameter cache" process.

[0225] (2) Next, the process of "marking and clearing network configuration parameter cache" is explained, and the specific steps are as follows:

[0226] ① When the network configuration parameters in the network configuration management contract are updated, a smart contract event is recorded. The smart contract event contains the following fields: configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height. The configuration parameter category, configuration parameter subclass, and configuration parameter key can be used as indexes for the smart contract event, which can then be quickly retrieved by a Bloom filter.

[0227] ② Whenever a new block is inserted into the blockchain structure, a Bloom filter can be used to quickly determine whether the new block contains a smart contract event that updates the network configuration parameters in the network configuration management contract;

[0228] ③ If the Bloom filter determines that the new block does not contain a smart contract event that updates the network configuration parameters in the network configuration management contract, then skip this step; if the Bloom filter determines that the new block contains a smart contract event that updates the network configuration parameters in the network configuration management contract, then iterate through each smart contract event that updates the network configuration parameters in the network configuration management contract in the new block, and call the "marking network configuration parameter cache process" according to the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height in the smart contract event.

[0229] ④ Subtract the cache retention span from the block height of the new block, and use the resulting value as the minimum cache height. Then, call the "process to clear the network configuration parameter cache" based on the minimum cache height.

[0230] (3) Finally, the process of marking and clearing the network configuration parameter cache may include the following steps S11 to S44:

[0231] S11, Record Event:

[0232] Understandably, during the execution of a smart contract, smart contract events can be recorded in a new block. These smart contract events can be read by blockchain nodes or applications using the blockchain. The smart contract events can contain indexes, which can then be quickly determined by a Bloom filter to determine whether the smart contract event is included.

[0233] In practice, when the network configuration parameters in the network configuration management contract are updated, a smart contract event is recorded. The smart contract event contains the following fields: configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height. The configuration parameter category, configuration parameter subclass, and configuration parameter key can be used as indexes for the smart contract event, which can then be quickly retrieved by a Bloom filter.

[0234] S22, Insert a new block:

[0235] Whenever a new block is inserted into the blockchain structure, a Bloom filter can be used to quickly determine whether the new block contains a smart contract event that updates the network configuration parameters in the network configuration management contract. If it does, proceed to step S33; otherwise, proceed to step S44.

[0236] S33, Marking:

[0237] In practice, network configuration parameters are cached based on configuration parameter categories, subcategories, keys, and effective heights. The specific steps are as follows:

[0238] ① Combine the configuration parameter categories, configuration parameter subcategories, and configuration parameter keys into a single type of configuration parameter cache key;

[0239] ② Combine the configuration parameter categories and configuration parameter subcategories into a type two configuration parameter cache key;

[0240] ③ Categorize and group the configuration parameters into a separate type three configuration parameter cache key;

[0241] ④ Perform the following operations on the cache keys of the configuration parameters generated in ①-③ above;

[0242] ⑤ Retrieve the configuration parameter cache queue from the network configuration parameter cache based on the configuration parameter cache key of the target configuration parameter type. If no corresponding configuration parameter cache queue is found, create a new configuration parameter cache queue and add the configuration parameter cache key of the target configuration parameter type and the newly created configuration parameter cache queue to the network configuration parameter cache.

[0243] ⑥ Record the effective height and the latest height of the current blockchain structure as the last access height in the configuration parameter cache queue, and set the corresponding cache content in the configuration parameter cache queue to "empty";

[0244] ⑦ Set the last access height of all elements in the configuration parameter cache queue whose effective height is greater than the effective height input in this process to the latest height of the current blockchain structure, and set the corresponding cache content to "empty".

[0245] S44. Cleaning:

[0246] In practice, the network configuration parameter cache is cleared based on the minimum cache height. The specific steps are as follows:

[0247] ① Traverse each pair of configuration parameter cache keys and configuration parameter cache queues in the network configuration parameter cache. For each configuration parameter cache queue (i.e., the configuration parameter cache queue to be cleared) with a number of elements greater than a preset threshold (e.g., 1), perform the following operations respectively.

[0248] ② For each element in any configuration parameter cache queue to be cleared, traverse the last access height stored in each element in ascending order of the effective height stored;

[0249] ③ If the last access height of an element is less than the minimum cache height, then remove the element from any pending configuration parameter cache queue. If the last access height of an element is not less than the minimum cache height, or if there is only one element left in any pending configuration parameter cache queue, then end the traversal of that pending configuration parameter cache queue.

[0250] Through the embodiments of this application, a multi-level management structure of parameter classification, configuration parameter subclasses, and configuration parameter keys can be used for network configuration parameters. This supports configuration parameter types with different data granularities, and the configuration parameter classification, configuration parameter subclasses, and configuration parameter keys serve as indexes for smart contract events, which can be quickly retrieved using Bloom filters. Furthermore, this application also assigns different effective heights to each network configuration parameter, supports pre-setting network configuration parameters for a future block height, and verifies and detects incorrectly set network configuration parameters. Network configuration parameters that fail verification are deactivated, and the old version of the network configuration parameters is reused, thereby maintaining the stable operation of the blockchain system and improving the flexibility and security of blockchain network management.

[0251] Please see Figure 6 , Figure 6 This is a schematic diagram of a network configuration management device provided in an embodiment of this application. The network configuration management device 600 can be applied to the computer device described in the foregoing embodiments. The network configuration management device 600 can be a computer program (including program code) running on the computer device; for example, the network configuration management device 600 is application software. The network configuration management device can be used to execute corresponding steps in the data processing method provided in the embodiments of this application. The network configuration management device 600 may include:

[0252] The acquisition unit 601 is used to acquire the query request sent by the network configuration parameter usage module. The query request carries the configuration parameter cache key of the target configuration parameter type and the first query height.

[0253] The processing unit 602 is used to obtain the effective height of the target data granularity and the network configuration parameter from the network configuration management contract according to the configuration parameter cache key of the target configuration parameter type and the first query height if the corresponding network configuration parameter does not exist in the network configuration parameter cache. The network configuration management contract maintains network configuration parameters with multiple data granularities.

[0254] The sending unit 603 is used to send the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, so that the network configuration parameter using module can verify the effective height of the target data granularity and the network configuration parameters and obtain the verification result.

[0255] The processing unit 602 is further configured to write the effective height of the target data granularity and the network configuration parameters into the network configuration parameter cache when the verification result is that the verification is passed.

[0256] In one possible implementation, the target configuration parameter type is a first type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories, configuration parameter subclasses, and configuration parameter keys; the target data granularity is key granularity.

[0257] Processing unit 602 retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, and performs the following operations:

[0258] Based on the configuration parameter classification, configuration parameter subclass, and configuration parameter key, multiple ordered mappings from the effective height to the configuration parameter value are retrieved from the network configuration management contract. The effective heights in the multiple ordered mappings are arranged in ascending order.

[0259] Traverse each ordered mapping in reverse order. If the effective height encountered during traversal is less than or equal to the first query height, then the effective height encountered during traversal is used as the effective height at the key granularity, and the configuration parameter value encountered during traversal is used as the network configuration parameter at the key granularity.

[0260] In one possible implementation, the target configuration parameter type is a second type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories and configuration parameter subclasses; the target data granularity is subclass granularity;

[0261] Processing unit 602 retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, and performs the following operations:

[0262] Based on the configuration parameter classification and the configuration parameter subclass, retrieve the configuration parameter key list from the network configuration management contract;

[0263] Iterate through each configuration parameter key in the configuration parameter key list, and retrieve the effective height and configuration parameter value corresponding to each configuration parameter key from the network configuration management contract based on the configuration parameter category, configuration parameter subclass, each configuration parameter key and the first query height.

[0264] The maximum value among the retrieved effective heights is taken as the effective height at the subclass level.

[0265] Based on all the retrieved configuration parameter keys, the established mapping from configuration parameter keys to configuration parameter values ​​is used as the network configuration parameters at the subclass granularity.

[0266] In one possible implementation, the target configuration parameter type is a third type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories; the target data granularity is category granularity.

[0267] Processing unit 602 retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, and performs the following operations:

[0268] Based on the configuration parameter classification, retrieve the list of configuration parameter subclasses from the network configuration management contract;

[0269] Iterate through each configuration parameter subclass in the configuration parameter subclass list, and retrieve the effective height of the subclass granularity corresponding to each configuration parameter subclass and the mapping from configuration parameter key to configuration parameter value from the network configuration management contract based on the configuration parameter category, configuration parameter subclass and the first query height;

[0270] The maximum value among the effective heights of each subclass granularity obtained from the retrieval is taken as the effective height of the classification granularity;

[0271] Based on all the retrieved configuration parameter subclasses and the mapping from configuration parameter keys to configuration parameter values, the established mapping between configuration parameter subclasses and configuration parameter keys to configuration parameter values ​​is used as the network configuration parameter at the classification granularity.

[0272] In one possible implementation, after the acquisition unit 601 acquires the query request sent by the network configuration parameter acquisition module, the processing unit 602 is further configured to perform the following operations:

[0273] Based on the query request, retrieve the corresponding network configuration parameters from the network configuration parameter cache;

[0274] If the queried network configuration parameters are not empty, the queried network configuration parameters will be sent to the network configuration parameter usage module so that the network configuration parameter usage module can configure the blockchain node according to the queried network configuration parameters.

[0275] If the queried network configuration parameter is empty, it is determined that there is no corresponding network configuration parameter in the network configuration parameter cache, and the steps of obtaining the effective height of the target data granularity and the network configuration parameter from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height are triggered.

[0276] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues;

[0277] Processing unit 602 retrieves the corresponding network configuration parameters from the network configuration parameter cache based on the query request, and performs the following operations:

[0278] Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache;

[0279] If the network configuration parameter cache key of the target configuration parameter type does not exist in the network configuration parameter cache, then the network configuration parameter retrieved from the network configuration parameter cache according to the query request is determined to be empty.

[0280] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues;

[0281] Processing unit 602 retrieves the corresponding network configuration parameters from the network configuration parameter cache based on the query request, and performs the following operations:

[0282] Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache;

[0283] If the target configuration parameter cache queue is not empty, then traverse each element in the target configuration parameter cache queue in reverse order. Each element is used to store the ordered mapping between the effective height, the last accessed height and the cached content.

[0284] If the effective height of the target element is less than or equal to the first query height, the cached content of the target element will be used as the queried network configuration parameters.

[0285] In one possible implementation, processing unit 602 writes the effective height of the target data granularity and the network configuration parameters to the network configuration parameter cache for performing the following operations:

[0286] Retrieve the configuration parameter cache queue from the network configuration parameter cache based on the configuration parameter cache key of the target configuration parameter type;

[0287] If the configuration parameter cache queue is not found, a new configuration parameter cache queue to be cached is created, and the configuration parameter cache key of the target configuration parameter type and the configuration parameter cache queue to be cached are written to the network configuration parameter cache.

[0288] Among them, the effective height in the configuration parameter cache queue to be cached is the effective height of the target data granularity, and the cached content in the configuration parameter cache queue to be cached is the network configuration parameters of the target data granularity.

[0289] In one possible implementation, after sending the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, the processing unit 602 is also used to perform the following operations:

[0290] If the received verification result is that the verification fails, and the effective height of the target data granularity is greater than the preset value, then the effective height of the target data granularity is reduced by one to obtain the second query height.

[0291] Based on the configuration parameter cache key of the target configuration parameter type and the second query height, obtain the effective height of the target data granularity and the network configuration parameters from the network configuration management contract.

[0292] In one possible implementation, the network configuration parameter cache includes a cache retention span; the processing unit 602 is also configured to perform the following operations:

[0293] When a block to be added to the blockchain is detected to be inserted into the blockchain structure, and the block to be added to the blockchain is determined by calling the Bloom filter to include an event that updates network configuration parameters, each event that updates network configuration parameters in the block to be added to the blockchain is traversed.

[0294] The network configuration parameter cache is marked based on the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height included in each event that updates network configuration parameters;

[0295] The difference between the latest block height of the block to be added to the chain and the cache retention span is used as the minimum cache height, and the network configuration parameter cache is cleaned up based on the minimum cache height.

[0296] In one possible implementation, the processing unit 602 performs a marking operation on the network configuration parameter cache based on the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height included in each event that updates network configuration parameters, for the following operations:

[0297] Generate cache keys for configuration parameters to be marked based on configuration parameter categories, configuration parameter subcategories, and configuration parameter keys;

[0298] Based on the configuration parameter cache key to be tagged, retrieve the configuration parameter cache queue to be tagged from the network configuration parameter cache;

[0299] Mark the configuration parameter cache queue to be marked based on the effective height and the latest block height corresponding to the current blockchain structure.

[0300] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to a configuration parameter cache queue; the configuration parameter cache queue includes one or more elements, each element being used to store an ordered mapping between the effective height, the last accessed height, and the cached content;

[0301] Processing unit 602 performs a cleanup operation on the network configuration parameter cache based on the minimum cache height, for the following operations:

[0302] Traverse each pair of configuration parameter cache keys and configuration parameter cache queues in the network configuration parameter cache to obtain at least one configuration parameter cache queue to be cleaned. Any configuration parameter cache queue to be cleaned refers to a configuration parameter cache queue with more than a preset number threshold.

[0303] For each element in any configuration parameter cache queue to be cleaned, traverse the last access height of each element in ascending order of the effective storage height;

[0304] If the last access height of any element is less than the minimum cache height, then the element will be removed from any pending configuration parameter cache queue.

[0305] In this embodiment, the network configuration management module in the blockchain node can receive a query request sent by the network configuration parameter usage module. This query request carries a configuration parameter cache key of the target configuration parameter type and a first query height. If the corresponding network configuration parameter does not exist in the network configuration parameter cache, the effective height and network configuration parameter of the target data granularity can be obtained from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height. The network configuration management contract maintains network configuration parameters of various data granularities. Next, the effective height and network configuration parameter of the target data granularity can be sent to the network configuration parameter usage module, allowing the module to verify them and obtain a verification result. Then, when the verification result is successful, the effective height and network configuration parameter of the target data granularity are written to the network configuration parameter cache. Therefore, this application can support configuration parameters of various data granularities, and various configuration parameter types including network configuration parameter usage parameter classification, configuration parameter subclasses, and configuration parameter keys. This multi-level management structure enriches the management methods of network configuration parameters, thereby improving the flexibility of network configuration parameter management. Furthermore, network configuration parameters at the target granularity obtained from the network configuration management contract can only be written to the network configuration parameter cache after they have passed verification, thereby improving the reliability and security of the network configuration parameter management process.

[0306] Please see Figure 7 , Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. The computer device 700 is used to execute the steps performed by the computer device in the aforementioned method embodiments. The computer device 700 includes: one or more processors 710; one or more input devices 720; one or more output devices 730; and a memory 740. The processors 710, input devices 720, output devices 730, and memory 740 are connected via a bus 750. The memory 740 is used to store a computer program, which includes program instructions. The processor 710 is used to call the program instructions stored in the memory 740 to perform the following operations:

[0307] The network configuration parameters are obtained by using a query request sent by the module. The query request carries the configuration parameter cache key of the target configuration parameter type and the first query height.

[0308] If the corresponding network configuration parameter does not exist in the network configuration parameter cache, then based on the configuration parameter cache key of the target configuration parameter type and the first query height, the effective height of the target data granularity and the network configuration parameter are obtained from the network configuration management contract. The network configuration management contract maintains network configuration parameters with multiple data granularities.

[0309] The effective height of the target data granularity and the network configuration parameters are sent to the network configuration parameter usage module so that the network configuration parameter usage module can verify the effective height of the target data granularity and the network configuration parameters and obtain the verification result.

[0310] When the verification result is successful, the effective height of the target data granularity and the network configuration parameters are written to the network configuration parameter cache.

[0311] In one possible implementation, the target configuration parameter type is a first type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories, configuration parameter subclasses, and configuration parameter keys; the target data granularity is key granularity.

[0312] The processor 710 retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, for the following operations:

[0313] Based on the configuration parameter classification, configuration parameter subclass, and configuration parameter key, multiple ordered mappings from the effective height to the configuration parameter value are retrieved from the network configuration management contract. The effective heights in the multiple ordered mappings are arranged in ascending order.

[0314] Traverse each ordered mapping in reverse order. If the effective height encountered during traversal is less than or equal to the first query height, then the effective height encountered during traversal is used as the effective height at the key granularity, and the configuration parameter value encountered during traversal is used as the network configuration parameter at the key granularity.

[0315] In one possible implementation, the target configuration parameter type is a second type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories and configuration parameter subclasses; the target data granularity is subclass granularity;

[0316] The processor 710 retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, for the following operations:

[0317] Based on the configuration parameter classification and the configuration parameter subclass, retrieve the configuration parameter key list from the network configuration management contract;

[0318] Iterate through each configuration parameter key in the configuration parameter key list, and retrieve the effective height and configuration parameter value corresponding to each configuration parameter key from the network configuration management contract based on the configuration parameter category, configuration parameter subclass, each configuration parameter key and the first query height.

[0319] The maximum value among the retrieved effective heights is taken as the effective height at the subclass level.

[0320] Based on all the retrieved configuration parameter keys, the established mapping from configuration parameter keys to configuration parameter values ​​is used as the network configuration parameters at the subclass granularity.

[0321] In one possible implementation, the target configuration parameter type is a third type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories; the target data granularity is category granularity.

[0322] The processor 710 retrieves the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height, for the following operations:

[0323] Based on the configuration parameter classification, retrieve the list of configuration parameter subclasses from the network configuration management contract;

[0324] Iterate through each configuration parameter subclass in the configuration parameter subclass list, and retrieve the effective height of the subclass granularity corresponding to each configuration parameter subclass and the mapping from configuration parameter key to configuration parameter value from the network configuration management contract based on the configuration parameter category, configuration parameter subclass and the first query height;

[0325] The maximum value among the effective heights of each subclass granularity obtained from the retrieval is taken as the effective height of the classification granularity;

[0326] Based on all the retrieved configuration parameter subclasses and the mapping from configuration parameter keys to configuration parameter values, the established mapping between configuration parameter subclasses and configuration parameter keys to configuration parameter values ​​is used as the network configuration parameter at the classification granularity.

[0327] In one possible implementation, after obtaining the query request sent by the module using the network configuration parameters, the processor 710 is also used to perform the following operations:

[0328] Based on the query request, retrieve the corresponding network configuration parameters from the network configuration parameter cache;

[0329] If the queried network configuration parameters are not empty, the queried network configuration parameters will be sent to the network configuration parameter usage module so that the network configuration parameter usage module can configure the blockchain node according to the queried network configuration parameters.

[0330] If the queried network configuration parameter is empty, it is determined that there is no corresponding network configuration parameter in the network configuration parameter cache, and the steps of obtaining the effective height of the target data granularity and the network configuration parameter from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height are triggered.

[0331] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues;

[0332] Based on the query request, processor 710 retrieves the corresponding network configuration parameters from the network configuration parameter cache to perform the following operations:

[0333] Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache;

[0334] If the network configuration parameter cache key of the target configuration parameter type does not exist in the network configuration parameter cache, then the network configuration parameter retrieved from the network configuration parameter cache according to the query request is determined to be empty.

[0335] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues;

[0336] Based on the query request, processor 710 retrieves the corresponding network configuration parameters from the network configuration parameter cache to perform the following operations:

[0337] Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache;

[0338] If the target configuration parameter cache queue is not empty, then traverse each element in the target configuration parameter cache queue in reverse order. Each element is used to store the ordered mapping between the effective height, the last accessed height and the cached content.

[0339] If the effective height of the target element is less than or equal to the first query height, the cached content of the target element will be used as the queried network configuration parameters.

[0340] In one possible implementation, the processor 710 writes the effective height of the target data granularity and the network configuration parameters to the network configuration parameter cache for performing the following operations:

[0341] Retrieve the configuration parameter cache queue from the network configuration parameter cache based on the configuration parameter cache key of the target configuration parameter type;

[0342] If the configuration parameter cache queue is not found, a new configuration parameter cache queue to be cached is created, and the configuration parameter cache key of the target configuration parameter type and the configuration parameter cache queue to be cached are written to the network configuration parameter cache.

[0343] Among them, the effective height in the configuration parameter cache queue to be cached is the effective height of the target data granularity, and the cached content in the configuration parameter cache queue to be cached is the network configuration parameters of the target data granularity.

[0344] In one possible implementation, after sending the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, the processor 710 is also used to perform the following operations:

[0345] If the received verification result is that the verification fails, and the effective height of the target data granularity is greater than the preset value, then the effective height of the target data granularity is reduced by one to obtain the second query height.

[0346] Based on the configuration parameter cache key of the target configuration parameter type and the second query height, obtain the effective height of the target data granularity and the network configuration parameters from the network configuration management contract.

[0347] In one possible implementation, the network configuration parameter cache includes a cache retention span; the processor 710 is also used to perform the following operations:

[0348] When a block to be added to the blockchain is detected to be inserted into the blockchain structure, and the block to be added to the blockchain is determined by calling the Bloom filter to include an event that updates network configuration parameters, each event that updates network configuration parameters in the block to be added to the blockchain is traversed.

[0349] The network configuration parameter cache is marked based on the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height included in each event that updates network configuration parameters;

[0350] The difference between the latest block height of the block to be added to the chain and the cache retention span is used as the minimum cache height, and the network configuration parameter cache is cleaned up based on the minimum cache height.

[0351] In one possible implementation, the processor 710 marks the network configuration parameter cache based on the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height included in each event that updates network configuration parameters, for the following operations:

[0352] Generate cache keys for configuration parameters to be marked based on configuration parameter categories, configuration parameter subcategories, and configuration parameter keys;

[0353] Based on the configuration parameter cache key to be tagged, retrieve the configuration parameter cache queue to be tagged from the network configuration parameter cache;

[0354] Mark the configuration parameter cache queue to be marked based on the effective height and the latest block height corresponding to the current blockchain structure.

[0355] In one possible implementation, the network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to a configuration parameter cache queue; the configuration parameter cache queue includes one or more elements, each element being used to store an ordered mapping between the effective height, the last accessed height, and the cached content;

[0356] The processor 710 performs a cleanup operation on the network configuration parameter cache based on the minimum cache height, to perform the following operations:

[0357] Traverse each pair of configuration parameter cache keys and configuration parameter cache queues in the network configuration parameter cache to obtain at least one configuration parameter cache queue to be cleaned. Any configuration parameter cache queue to be cleaned refers to a configuration parameter cache queue with more than a preset number threshold.

[0358] For each element in any configuration parameter cache queue to be cleaned, traverse the last access height of each element in ascending order of the effective storage height;

[0359] If the last access height of any element is less than the minimum cache height, then the element will be removed from any pending configuration parameter cache queue.

[0360] In this embodiment, the network configuration management module in the blockchain node can receive a query request sent by the network configuration parameter usage module. This query request carries a configuration parameter cache key of the target configuration parameter type and a first query height. If the corresponding network configuration parameter does not exist in the network configuration parameter cache, the effective height and network configuration parameter of the target data granularity can be obtained from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height. The network configuration management contract maintains network configuration parameters of various data granularities. Next, the effective height and network configuration parameter of the target data granularity can be sent to the network configuration parameter usage module, allowing the module to verify them and obtain a verification result. Then, when the verification result is successful, the effective height and network configuration parameter of the target data granularity are written to the network configuration parameter cache. Therefore, this application can support configuration parameters of various data granularities, and various configuration parameter types including network configuration parameter usage parameter classification, configuration parameter subclasses, and configuration parameter keys. This multi-level management structure enriches the management methods of network configuration parameters, thereby improving the flexibility of network configuration parameter management. Furthermore, network configuration parameters at the target granularity obtained from the network configuration management contract can only be written to the network configuration parameter cache after they have passed verification, thereby improving the reliability and security of the network configuration parameter management process.

[0361] Furthermore, it should be noted that this application also provides a computer storage medium storing a computer program, which includes program instructions. When the processor executes these program instructions, it can perform the methods described in the preceding embodiments. Therefore, further details will not be provided here. For technical details not disclosed in the embodiments of the computer storage medium involved in this application, please refer to the description of the method embodiments of this application. As an example, the program instructions can be deployed on a computer device, executed on multiple computer devices located in one location, or executed on multiple computer devices distributed in multiple locations and interconnected through a communication network.

[0362] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods described in the preceding embodiments; therefore, further details will not be provided here.

[0363] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.

[0364] The above-disclosed embodiments are merely preferred embodiments of this application and should not be construed as limiting the scope of this application. Therefore, any equivalent variations made in accordance with the claims of this application shall still fall within the scope of this application.

Claims

1. A network configuration management method, characterized in that, The network configuration management module applied in blockchain nodes includes: The network configuration parameters are obtained by using a query request sent by the module, the query request carrying a configuration parameter cache key of the target configuration parameter type and a first query height; If the corresponding network configuration parameter does not exist in the network configuration parameter cache, then based on the configuration parameter cache key of the target configuration parameter type and the first query height, the effective height of the target data granularity and the network configuration parameter are obtained from the network configuration management contract. The network configuration management contract maintains network configuration parameters of multiple data granularities. The effective height of the target data granularity and the network configuration parameters are sent to the network configuration parameter usage module so that the network configuration parameter usage module can verify the effective height of the target data granularity and the network configuration parameters and obtain the verification result. When the verification result is successful, the effective height of the target data granularity and the network configuration parameters are written to the network configuration parameter cache.

2. The method as described in claim 1, characterized in that, The target configuration parameter type is a first type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories, configuration parameter subcategories, and configuration parameter keys; the target data granularity is key granularity. The step of obtaining the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height includes: Based on the configuration parameter classification, the configuration parameter subclass, and the configuration parameter key, multiple ordered mappings from effective height to configuration parameter value are retrieved from the network configuration management contract, and the effective heights in the multiple ordered mappings are arranged in ascending order. Traverse each ordered mapping in reverse order. If the effective height encountered during traversal is less than or equal to the first query height, then the effective height encountered during traversal is used as the effective height at the key granularity, and the configuration parameter value encountered during traversal is used as the network configuration parameter at the key granularity.

3. The method as described in claim 1, characterized in that, The target configuration parameter type is the second type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories and configuration parameter subclasses; the target data granularity is the subclass granularity. The step of obtaining the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height includes: Based on the configuration parameter classification and the configuration parameter subclass, retrieve the configuration parameter key list from the network configuration management contract; Iterate through each configuration parameter key in the configuration parameter key list, and retrieve the effective height and configuration parameter value corresponding to each configuration parameter key from the network configuration management contract according to the configuration parameter category, the configuration parameter subclass, each configuration parameter key and the first query height; The maximum value among the retrieved effective heights is taken as the effective height at the subclass level. Based on all the retrieved configuration parameter keys, the established mapping from configuration parameter keys to configuration parameter values ​​is used as the network configuration parameters at the subclass granularity.

4. The method as described in claim 1, characterized in that, The target configuration parameter type is a third type; the configuration parameter cache key of the target configuration parameter type includes configuration parameter categories; the target data granularity is the category granularity. The step of obtaining the effective height of the target data granularity and the network configuration parameters from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height includes: Based on the configuration parameter classification, retrieve the configuration parameter subclass list from the network configuration management contract; Iterate through each configuration parameter subclass in the configuration parameter subclass list, and retrieve the effective height of the subclass granularity corresponding to each configuration parameter subclass and the mapping from configuration parameter key to configuration parameter value from the network configuration management contract based on the configuration parameter classification, the configuration parameter subclass, and the first query height. The maximum value among the effective heights of each subclass granularity obtained from the retrieval is taken as the effective height of the classification granularity; Based on all the retrieved configuration parameter subclasses and the mapping from configuration parameter keys to configuration parameter values, the established mapping between configuration parameter subclasses and configuration parameter keys to configuration parameter values ​​is used as the network configuration parameter at the classification granularity.

5. The method as described in claim 1, characterized in that, After obtaining the network configuration parameters using the query request sent by the module, the process also includes: Based on the query request, retrieve the corresponding network configuration parameters from the network configuration parameter cache; If the queried network configuration parameters are not empty, the queried network configuration parameters are sent to the network configuration parameter using module so that the network configuration parameter using module can configure the blockchain node according to the queried network configuration parameters; If the queried network configuration parameters are empty, it is determined that there are no corresponding network configuration parameters in the network configuration parameter cache, and the step of obtaining the effective height of the target data granularity and the network configuration parameters from the network configuration management contract according to the configuration parameter cache key of the target configuration parameter type and the first query height is triggered.

6. The method as described in claim 5, characterized in that, The network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues; The step of retrieving the corresponding network configuration parameters from the network configuration parameter cache according to the query request includes: Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache; If the network configuration parameter cache key of the target configuration parameter type does not exist in the network configuration parameter cache, then the network configuration parameter retrieved from the network configuration parameter cache according to the query request is determined to be empty.

7. The method as described in claim 5, characterized in that, The network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues; The step of retrieving the corresponding network configuration parameters from the network configuration parameter cache according to the query request includes: Based on the configuration parameter cache key of the target configuration parameter type, read the target configuration parameter cache queue from the network configuration parameter cache; If the target configuration parameter cache queue is not empty, then traverse each element in the target configuration parameter cache queue in reverse order. Each element is used to store the ordered mapping between the effective height, the last accessed height and the cached content. When the effective height in the target element is less than or equal to the first query height, the cached content in the target element is used as the queried network configuration parameter.

8. The method as described in claim 1, characterized in that, The step of writing the effective height of the target data granularity and the network configuration parameters to the network configuration parameter cache includes: Based on the configuration parameter cache key of the target configuration parameter type, retrieve the configuration parameter cache queue from the network configuration parameter cache; If the configuration parameter cache queue is not found, a new configuration parameter cache queue to be cached is created, and the configuration parameter cache key of the target configuration parameter type and the configuration parameter cache queue to be cached are written into the network configuration parameter cache. Wherein, the effective height in the configuration parameter cache queue to be cached is the effective height of the target data granularity, and the cached content in the configuration parameter cache queue to be cached is the network configuration parameters of the target data granularity.

9. The method as described in claim 1, characterized in that, After sending the effective height of the target data granularity and the network configuration parameters to the network configuration parameter usage module, the method further includes: If the received verification result is that the verification fails, and the effective height of the target data granularity is greater than the preset value, then the effective height of the target data granularity is reduced by one to obtain the second query height. Based on the configuration parameter cache key of the target configuration parameter type and the second query height, obtain the effective height of the target data granularity and the network configuration parameters from the network configuration management contract.

10. The method according to any one of claims 1-9, characterized in that, The network configuration parameter cache includes a cache retention span; the method further includes: When a block to be added to the blockchain is detected to be inserted into the blockchain structure, and it is determined by calling the Bloom filter that the block to be added to the blockchain includes an event that updates network configuration parameters, each event that updates network configuration parameters in the block to be added to the blockchain is traversed. The network configuration parameter cache is marked according to the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height included in each event that updates the network configuration parameters; The difference between the latest block height of the block to be added to the chain and the cache retention span is used as the minimum cache height, and the network configuration parameter cache is cleaned up according to the minimum cache height.

11. The method as described in claim 10, characterized in that, The step of marking the network configuration parameter cache based on the configuration parameter category, configuration parameter subclass, configuration parameter key, and effective height included in each event that updates network configuration parameters includes: Based on the configuration parameter classification, the configuration parameter subclass, and the configuration parameter key, generate a configuration parameter cache key to be marked; Based on the configuration parameter cache key to be tagged, retrieve the configuration parameter cache queue to be tagged from the network configuration parameter cache; The configuration parameter cache queue to be marked is marked based on the effective height and the latest block height corresponding to the current blockchain structure.

12. The method as described in claim 10, characterized in that, The network configuration parameter cache is used to maintain a mapping from configuration parameter cache keys to configuration parameter cache queues; the configuration parameter cache queue includes one or more elements, any element of which is used to store an ordered mapping between effective height, last access height and cached content; The step of clearing the network configuration parameter cache based on the minimum cache height includes: Traverse each pair of configuration parameter cache keys and configuration parameter cache queues in the network configuration parameter cache to obtain at least one configuration parameter cache queue to be cleaned. Any configuration parameter cache queue to be cleaned refers to a configuration parameter cache queue with a number of elements greater than a preset threshold. For each element in any configuration parameter cache queue to be cleaned, traverse the last access height stored in each element in ascending order of the effective height stored; If the last access height of any element is less than the minimum cache height, then the element will be removed from the cache queue of any pending configuration parameter.

13. A network configuration management device, characterized in that, The network configuration management module applied in blockchain nodes includes: The acquisition unit is used to acquire a query request sent by the network configuration parameter usage module, wherein the query request carries a configuration parameter cache key of the target configuration parameter type and a first query height; The processing unit is configured to, if no corresponding network configuration parameter exists in the network configuration parameter cache, obtain the effective height of the target data granularity and the network configuration parameter from the network configuration management contract based on the configuration parameter cache key of the target configuration parameter type and the first query height. The network configuration management contract maintains network configuration parameters with multiple data granularities. The sending unit is used to send the effective height of the target data granularity and the network configuration parameters to the network configuration parameter using module, so that the network configuration parameter using module can verify the effective height of the target data granularity and the network configuration parameters and obtain the verification result; The processing unit is further configured to write the effective height of the target data granularity and the network configuration parameters into the network configuration parameter cache when the verification result is a successful verification.

14. A computer device, characterized in that, include: A processor, adapted to execute computer programs; A computer-readable storage medium storing a computer program that, when executed by the processor, implements the network configuration management method as described in any one of claims 1-12.

15. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the network configuration management method as described in any one of claims 1-12.

16. A computer program product, characterized in that, The computer program product includes a computer program adapted to be loaded by a processor and execute the network configuration management method as described in any one of claims 1-12.