Simulation method and simulation platform compatible with chain-type and graph-type distributed ledger systems
By constructing a heterogeneous ledger model and generating configuration matrix, compatible simulation of chain and schema ledger systems is realized, and the problem of difficult to compare the impact of different ledger structures in the existing technology is solved, and a flexible distributed ledger system is realized. simulation.
Patent Information
- Application Number
- CN202410604482.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-15
- Publication Date
- 2025-02-14
- Estimated Expiration
- 2044-05-15
AI Technical Summary
The existing distributed ledger system simulation methods are not compatible with chain and schema ledger systems, and it is difficult to compare the impact of different ledger structures on the system.
By abstracting the characteristics of chain and schema distributed ledger structures, a heterogeneous ledger model is constructed, and configuration items are designed layer by layer to generate configuration matrix, representing the execution logic of the distributed ledger system, thereby generating corresponding chain and schema ledger systems. Examples are simulated.
It realizes compatible simulation of chain and schema ledger systems, and can flexibly switch different distributed ledger systems for simulation, solving the problems of difficult configuration, difficult comparison and difficult analysis of different underlying ledger structures.
Smart Images

Figure CN118550805B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of distributed ledger technology, and in particular to a simulation method and simulation platform for a chain-type and graph-type distributed ledger system. Background Art
[0002] The distributed ledger system is a distributed data management system that uses a consensus mechanism between multiple nodes to record and maintain complete and comprehensive data information related to data ownership, dissemination, transaction chains, etc. It ensures the immutability and non-repudiation of data throughout the life cycle of data generation and flow, and provides support for the confirmation, protection and audit of data rights.
[0003] According to the different underlying ledger structures, distributed ledger systems can be divided into chain ledger systems and graphical ledger systems. Due to the change of the underlying ledger structure, the system's processing of transaction data also changes accordingly. Therefore, there are significant differences in the design of distributed ledger systems in software architecture, data storage, network transmission, and logical processing.
[0004] Distributed ledger system simulation supports the simulation of system behavior in a virtual way, mapping different system configurations to the simulation environment to analyze the system performance. However, existing simulation methods all use a single ledger structure and cannot compare the impact of different ledger structures on the system.
[0005] Therefore, there is an urgent need for a simulation method that is compatible with both chain and graph ledger systems to compare and analyze the performance of different distributed ledger systems. Summary of the invention
[0006] In view of the above problems, the embodiments of the present application provide a simulation method and a simulation platform that are compatible with chain-type and graph-type distributed ledger systems, so as to overcome the above problems or at least partially solve the above problems.
[0007] In a first aspect of an embodiment of the present application, a simulation method for a chain-type and graph-type distributed ledger system is disclosed, comprising:
[0008] According to the chain distributed ledger structure and the graphical distributed ledger structure, the ledger structure features are abstracted, and a heterogeneous ledger model is constructed according to the ledger structure features. The ledger structure features include the reference relationship between blocks and the transaction model within the block. The transaction model includes an unspent transaction output model and an account balance model. The heterogeneous ledger model includes a chain ledger model and a graphical ledger model.
[0009] Designing configuration items layer by layer according to the hierarchical structure of the heterogeneous ledger model, wherein the hierarchical structure includes a consensus layer, a data layer, and a storage layer;
[0010] Performing system configuration according to the configuration items, and generating a configuration matrix according to the system configuration, wherein the configuration matrix represents the execution logic of the distributed ledger system;
[0011] Generate a corresponding distributed ledger system instance according to the configuration matrix, wherein the distributed ledger system instance includes a chain ledger system and a graphical ledger system;
[0012] The load conditions under different business scenarios are set, and the distributed ledger system instance is simulated according to the load conditions to obtain simulation results.
[0013] Optionally, each row element of the configuration matrix represents a configuration item, and each column element represents a configuration item of a distributed ledger system, and the configuration matrix includes at least one column of configuration items of a chained ledger system and one column of configuration items of a graphical ledger system.
[0014] Optionally, performing system configuration according to the configuration items, and generating a configuration matrix according to the system configuration, includes:
[0015] According to the hierarchical structure of the heterogeneous ledger model, the parameter value of each configuration item is set layer by layer;
[0016] The parameter value of each of the configuration items is mapped to a corresponding key to obtain the configuration matrix.
[0017] Optionally, according to the hierarchical structure of the heterogeneous ledger model, the parameter value of each configuration item is set layer by layer, including:
[0018] Configure the parameter values of the consensus layer configuration items, including the accounting consensus and confirmation consensus;
[0019] Configure the parameter values of the data layer configuration items, the parameter values of the data layer configuration items include account mode, pre-block list, transaction and ledger mode, the account mode includes unspent transaction output model and account balance model, the pre-block list includes single pre-block and multiple pre-blocks, the transaction includes conflicting and non-conflicting, the ledger mode includes graphical ledger structure and chained ledger structure;
[0020] The parameter values of the configuration storage layer configuration items include the storage location of the ledger data, and the ledger data is stored in the specified storage device in the form of key-value.
[0021] Optionally, the method further comprises:
[0022] The nodes in the network layer of the distributed ledger system are set, and the set nodes are started in batches, and the nodes communicate with each other using a broadcast mechanism.
[0023] Optionally, generating a corresponding distributed ledger system instance according to the configuration matrix includes:
[0024] Processing logic is executed according to the node and the parameters in the configuration matrix to obtain the distributed ledger system instance.
[0025] Optionally, the method further comprises:
[0026] Calculate the metric index according to the simulation result to obtain the metric index value, wherein the metric index includes the abandoned block rate and the number of valid blocks produced per unit time;
[0027] According to the metric values, the performance of the chain ledger system and the graph ledger system are compared to obtain analysis results.
[0028] A second aspect of the embodiment of the present application discloses a simulation platform compatible with chain-type and graph-type distributed ledger systems, including:
[0029] A configuration management module is used to abstract the characteristics of the ledger structure according to the chain distributed ledger structure and the graphical distributed ledger structure, and to construct a heterogeneous ledger model according to the characteristics of the ledger structure, wherein the characteristics of the ledger structure include the reference relationship between blocks and the transaction model within the block, wherein the transaction model includes an unspent transaction output model and an account balance model, and wherein the heterogeneous ledger model includes a chain ledger model and a graphical ledger model; design configuration items layer by layer according to the hierarchical structure of the heterogeneous ledger model, wherein the hierarchical structure includes a consensus layer, a data layer, and a storage layer; and perform system configuration according to the configuration items, and generate a configuration matrix according to the system configuration, wherein the configuration matrix represents the execution logic of the distributed ledger system;
[0030] A simulation module, used to generate a corresponding distributed ledger system instance according to the configuration matrix, wherein the distributed ledger system instance includes a chain ledger system and a graphical ledger system;
[0031] The load management module is used to set load conditions under different business scenarios, and simulate the distributed ledger system instance according to the load conditions to obtain simulation results.
[0032] Optionally, the simulation platform further includes:
[0033] The node management module is used to set the nodes in the network layer of the distributed ledger system and start the set nodes in batches. The nodes communicate with each other using a broadcast mechanism.
[0034] Optionally, the simulation platform further includes:
[0035] The system analysis module is used to calculate the metric index according to the simulation results to obtain the metric index value, wherein the metric index includes the abandoned block rate and the number of valid blocks per unit time; and compare the performance of the chain ledger system and the graphical ledger system according to the metric index value to obtain the analysis result.
[0036] The embodiments of the present application include the following advantages:
[0037] In an embodiment of the present application, according to a chain distributed ledger structure and a graphical distributed ledger structure, the ledger structure features are abstracted, and a heterogeneous ledger model is constructed according to the ledger structure features, wherein the ledger structure features include reference relationships between blocks and transaction models within blocks, wherein the transaction models include unspent transaction output models and account balance models, and wherein the heterogeneous ledger models include chain ledger models and graphical ledger models; according to the hierarchical structure of the heterogeneous ledger model, configuration items are designed layer by layer, wherein the hierarchical structure includes a consensus layer, a data layer, and a storage layer; a system is configured according to the configuration items, and a configuration matrix is generated according to the system configuration, wherein the configuration matrix represents the execution logic of a distributed ledger system; a corresponding distributed ledger system instance is generated according to the configuration matrix, wherein the distributed ledger system instance includes a chain ledger system and a graphical ledger system; load conditions under different business scenarios are set, and the distributed ledger system instance is simulated according to the load conditions to obtain simulation results.
[0038] Since the configuration items are designed layer by layer according to the hierarchical structure of the heterogeneous ledger model, and the heterogeneous ledger model is constructed according to the ledger structure characteristics of the chain distributed ledger and the graphical distributed ledger, the system configuration can be flexibly performed according to the configuration items to obtain the configuration matrix that represents the execution logic of the distributed ledger system, and thus the corresponding chain ledger system and graphical ledger system can be obtained based on the configuration matrix. In this way, an on-demand distributed ledger simulation is realized, and different distributed ledger systems can be flexibly switched for simulation, thereby realizing the simultaneous simulation of the chain ledger system and the graphical ledger system, and comparing and analyzing the impact of different ledger structures on the system, solving the problem that different underlying ledger structures are difficult to configure, compare, and analyze. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments of the present application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0040] Figure 1It is a flowchart of the steps of a simulation method for a compatible chain-type and graph-type distributed ledger system provided in an embodiment of the present application;
[0041] Figure 2 is a schematic diagram of a data layer configuration item provided in an embodiment of the present application;
[0042] Figure 3 It is a flowchart of the steps of another simulation method for a chain-type and graph-type distributed ledger system provided in an embodiment of the present application;
[0043] Figure 4 It is a structural schematic diagram of a simulation platform compatible with chain-type and graph-type distributed ledger systems provided in an embodiment of the present application;
[0044] Figure 5 It is a workflow diagram of a simulation platform compatible with chain-type and graph-type distributed ledger systems provided in an embodiment of the present application. DETAILED DESCRIPTION
[0045] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0046] In order to better understand this patent, a brief introduction to the distributed ledger system is given:
[0047] The distributed ledger system enables data to be reliably managed in a distributed environment, recording complete and comprehensive information related to all aspects of the ledger, such as data ownership, dissemination, and transaction chains. Throughout the life cycle of data generation and flow, the distributed ledger system ensures the immutability and non-repudiation of data, and provides support for the confirmation, protection, and audit of data rights. Transactions are data recorded by the distributed ledger system and are the basic unit of ledger data. Several transactions are organized into blocks through hash calculations. Each computer participating in the distributed ledger system is called a node. They jointly maintain the ledger through a consensus mechanism.
[0048] Distributed ledger systems mainly include chain ledger systems and graph ledger systems. Chain ledger systems organize transactions into blocks through hash calculations and reference the previous block (predecessor block) in the block header, making the ledger a chain structure, ensuring the security and integrity of the data. Blockchain is a typical chain ledger system. It has been applied to various fields such as virtual currency, supply chain, asset management, privacy protection and the Internet of Things.
[0049] The performance of the graphical ledger system is potentially better than that of the chained ledger system. The graphical ledger system abandons the chain structure and adopts a multi-predecessor block design to form a mesh ledger with a partial order relationship. It optimistically accepts all blocks and verifies each block data through the partial order relationship between blocks, eliminating the waste caused by abandoning the forked chain, realizing concurrent data execution, and improving accounting efficiency. However, the changes in the graphical ledger structure require the upper-level system to consider issues such as predecessor block selection, double payment prevention, and verification of predecessor blocks. The transaction processing process of the graphical ledger system is more complicated than that of the chained ledger. For example, each newly added block in the ledger structure needs to select an appropriate predecessor block from the forked chain. This process takes into account factors such as timestamps and weights to ensure the unidirectional growth of the ledger. In addition, the partial order relationship between blocks increases the risk of double payment problems, which is solved by introducing a transaction sorting mechanism. The above complex design makes it difficult for testers to deeply understand the impact of the underlying ledger structure on the system.
[0050] Related technologies mainly use a single ledger structure to record data. The research on the analysis of distributed ledger systems has the following three common points: 1) Software testing of the system. Testing can help developers understand the system, but the implementation of different systems is complex and different. It is difficult for testers to control internal system variables and analyze the impact of data structures on the system; 2) Simulation of the network layer and consensus layer. This type of work uses a single chained ledger structure and studies the network and consensus design by adjusting the network and consensus strategies, and does not analyze the characteristics of the data layer; 3) Simulation of the graph structure. This type of work only analyzes the impact of the sorting algorithm of transactions in the graph ledger on the system. Therefore, there is no work that compares the chained ledger structure with the graph ledger structure and analyzes the impact of different ledgers on the system.
[0051] In order to overcome the limitations of related technologies, an embodiment of the present application provides a simulation method for a compatible chain and diagram distributed ledger system. This method is based on the idea of on-demand configuration, and performs flexible system configuration according to configuration items to obtain a configuration matrix that characterizes the execution logic of the distributed ledger system, thereby obtaining a corresponding chain ledger system or diagram ledger system according to the configuration matrix. In this way, a distributed ledger simulation that can be configured on demand is implemented, and different distributed ledger systems can be flexibly switched for simulation, thereby achieving simultaneous simulation of the chain ledger system and the diagram ledger system, and comparing and analyzing the impact of different ledger structures on the system, solving the problem that different underlying ledger structures are difficult to configure, compare, and analyze. The simulation method for a compatible chain and diagram distributed ledger system of the present application will be described in detail below.
[0052] Reference Figure 1 As shown, Figure 11 is a flowchart of the steps of a simulation method for a compatible chain-type and graph-type distributed ledger system provided in an embodiment of the present application. Figure 1 As shown, a simulation method for a chain-type and graph-type distributed ledger system provided in an embodiment of the present application may include steps S110 to S150:
[0053] Step S110: According to the chain distributed ledger structure and the graph distributed ledger structure, the ledger structure features are abstracted, and a heterogeneous ledger model is constructed according to the ledger structure features. The ledger structure features include reference relationships between blocks and transaction models within blocks. The transaction model includes an unspent transaction output model and an account balance model. The heterogeneous ledger model includes a chain ledger model and a graph ledger model.
[0054] In the embodiment of the present application, in order to accurately describe the distributed ledger, the ledger structure features are extracted from the chain distributed ledger structure and the diagram distributed ledger structure, so as to construct a chain ledger model and a diagram ledger model according to the ledger structure features. Among them, the reference relationship between blocks refers to the reference relationship between each block and the previous block. If a block references a previous block, the ledger is a chain structure. If a block references multiple previous blocks, the ledger is a diagram structure.
[0055] The transaction model includes the unspent transaction output model and the account balance model. The unspent transaction output model refers to the UTXO (Unspent Transaction Output) model. The unspent transaction output model refers to the transfer of ownership of UTXO in the transaction record system. The unspent transaction output model only records the transaction itself, but not the result of the transaction. The unspent transaction output model can effectively avoid the problem of double payment; the account balance model sets a balance status for each type of asset available to each account, which simplifies the transaction calculation process.
[0056] Step S120: Designing configuration items layer by layer according to the hierarchical structure of the heterogeneous ledger model, wherein the hierarchical structure includes a consensus layer, a data layer, and a storage layer.
[0057] Step S130: performing system configuration according to the configuration items, and generating a configuration matrix according to the system configuration, wherein the configuration matrix represents the execution logic of the distributed ledger system.
[0058] In the embodiment of the present application, according to the hierarchical structure of the chained ledger model and the graphical ledger model, configuration items are designed layer by layer, and the configuration items include the configuration contents of the three structures of the consensus layer, the data layer, and the storage layer in the distributed ledger system, so that the system is configured according to the configuration items, and the distributed ledger system is characterized on demand. The system configuration based on the configuration items enables the tester (user) to control the environmental variables inside the distributed ledger system and analyze the impact of different ledger structures on the system.
[0059] In addition, the embodiment of the present application uses a configuration matrix compatible with chained ledgers and graphical ledgers to record the configuration of the distributed ledger system. The configuration matrix can characterize the execution logic of the distributed ledger system, so that the corresponding distributed ledger system instance can be generated to realize the simulation of the distributed ledger system. Due to the different configured ledger modes, a chained ledger system or a graphical ledger system can be generated according to the configuration matrix, thereby realizing the performance simulation of different types of ledger systems (i.e., chained ledgers and graphical ledgers).
[0060] Each row element of the configuration matrix represents a configuration item, and each column element represents a configuration item of a distributed ledger system. The configuration matrix includes at least one column of configuration items of a chained ledger system and one column of configuration items of a graphical ledger system.
[0061] For example, taking 6 configuration items and 2 columns of elements as an example, the configuration matrix can be expressed as:
[0062]
[0063] In the configuration matrix C, the first column elements represent the configuration items of the chained ledger system, the second column elements represent the configuration items of the graphical ledger system, and each row element in the configuration matrix C represents a configuration item, that is, c11 and c61 represent a configuration item in the chained ledger system, and c12 and c62 represent a configuration item in the graphical ledger system. In a specific implementation, the configuration items include consensus, ledger structure, account mode, pre-block list, transaction, and storage configuration, and each row element of the configuration matrix represents consensus, ledger structure, account mode, pre-block list, transaction, and storage configuration from top to bottom.
[0064] In specific implementation, multiple columns of elements can be set in the configuration matrix to record the configuration information of multiple different distributed ledger systems, so as to analyze the performance of multiple different distributed ledger systems. For example, the configuration matrix includes two columns of configuration items of chained ledger systems (such as chained ledger system A and chained ledger system B) and one column of configuration items of graphical ledger system (such as graphical ledger system C). Then, the configuration matrix can be used to compare and analyze the performance of chained ledger system A and chained ledger system B, and can also compare and analyze chained ledger system A and graphical ledger system C, and can also compare and analyze chained ledger system B and graphical ledger system C.
[0065] In an optional embodiment, the system is configured according to the configuration items, and a configuration matrix is generated according to the system configuration, including: setting the parameter value of each configuration item layer by layer according to the hierarchical structure of the heterogeneous ledger model; and mapping the parameter value of each configuration item to a corresponding key to obtain the configuration matrix.
[0066] In the embodiment of the present application, the configuration item and the corresponding parameter value are a key-value pair. After setting the parameter value of each configuration item, the parameter value is mapped to the corresponding key to obtain a configuration matrix. Thus, according to the parameter value of each configuration item in the configuration matrix, the corresponding execution logic of the system can be triggered to generate a corresponding distributed ledger system instance.
[0067] Specifically, according to the hierarchical structure of the heterogeneous ledger model, the parameter value of each configuration item is set layer by layer, including steps A1 to A3:
[0068] Step A1: Configure the parameter values of the consensus layer configuration items, where the parameter values of the consensus layer configuration items include accounting consensus and confirmation consensus.
[0069] In the embodiment of the present application, the consensus layer can determine the blocks to be accounted and the blocks to be confirmed through certain rules and the interaction of multiple network nodes. Due to the different accounting and confirmation mechanisms of blocks, the consensus layer mainly includes accounting consensus and confirmation consensus. The implementation of consensus in the distributed ledger system specifically depends on the configuration data. For each distributed ledger system, it is necessary to configure the parameter values of the consensus layer configuration items, that is, to determine the type of accounting consensus adopted by the distributed ledger system, and to confirm the type of confirmation consensus adopted by the distributed ledger system, so that the subsequent distributed ledger system can execute the corresponding transaction processing process based on the configured accounting consensus and confirmation consensus.
[0070] Step A2: Configure parameter values of data layer configuration items, wherein the parameter values of the data layer configuration items include account mode, pre-block list, transaction and ledger mode, wherein the account mode includes an unspent transaction output model and an account balance model, the pre-block list includes a single pre-block and multiple pre-blocks, the transaction includes conflicting and non-conflicting, and the ledger mode includes a graphical ledger structure and a chained ledger structure.
[0071] In the embodiment of the present application, the data layer is the core layer of the distributed ledger system, which mainly includes account modes, transactions, pre-block lists and ledger structures. Different ledger structures can be realized by configuring different data layers. For example, if only different account modes are set in the two ledger systems, and the parameter values of other configuration items are the same, the impact of different account modes on the performance of the distributed ledger system can be analyzed. For another example, if different ledger modes are set in the two ledger systems, and the parameter values of other configuration items are the same, the impact of different ledger modes on the performance of the distributed ledger system can be analyzed.
[0072] The distributed ledger system includes two account modes, namely the unspent transaction output model and the account balance model. In the specific implementation, in order to analyze the impact of conflicting transactions on the distributed ledger system, the account_mode field is set in the block to control the account mode in the distributed ledger system.
[0073] In a distributed ledger system, several account transfers constitute a transaction, and several accumulated transactions constitute a block. Depending on whether there is a conflict in the transaction, the transaction is divided into a conflicting transaction and a non-conflicting transaction. According to the number of predecessor blocks in the predecessor block list, the ledger can be divided into a chain ledger structure or a graphical ledger structure. Specifically, the predecessor block list includes a single predecessor block and multiple predecessor blocks. If the predecessor block list is a single predecessor block, it means that the block in the blockchain only references one predecessor block, and the ledger presents a chain ledger structure; if the predecessor block list is multiple predecessor blocks, it means that the block in the blockchain references multiple predecessor blocks, and the ledger presents a graphical ledger structure. In the specific implementation, the ledger_mode field is set to control the size of the predecessor block list. When the size of the predecessor block list is 1 (i.e., a single predecessor block), the ledger presents a chain ledger structure. When the size of the predecessor block list is greater than 1 (i.e., multiple predecessor blocks), the ledger presents a graphical ledger structure.
[0074] For example, Figure 2 is a schematic diagram of a data layer configuration item provided in an embodiment of the present application. The ledger is composed of blocks, and the blocks include block headers and block bodies. Among them, the block body is used to store transactions, for example, Figure 2Transaction 1 to transaction n in the block are stored in the block body of the block; in addition to the account mode, the preceding block list, and the ledger mode, the block header also includes a block identifier (i.e., block ID), a transaction hash, a timestamp, and a random number (i.e., a one-time random number used to ensure the security and integrity of the message or transaction).
[0075] Step A3: Parameter values of configuration storage layer configuration items are configured, wherein the parameter values of configuration storage layer configuration items include storage locations of ledger data, and the ledger data is stored in a designated storage device in a key-value format.
[0076] In an embodiment of the present application, the storage layer stores the ledger data in a specified storage device in the form of key-value to achieve effective reading of the ledger data. For each distributed ledger system to be simulated, a corresponding storage location can be configured so that the distributed ledger system can achieve effective reading and writing of the ledger data based on the configured storage location. In a specific implementation, the storage layer can achieve effective reading and writing of the ledger data based on the LevelDB database (LevelDB is an efficient key-value database).
[0077] Step S140: Generate a corresponding distributed ledger system instance according to the configuration matrix, wherein the distributed ledger system instance includes a chain ledger system and a graph ledger system.
[0078] Step S150: setting load conditions under different business scenarios, and simulating the distributed ledger system instance according to the load conditions to obtain simulation results.
[0079] In the embodiment of the present application, different chain ledger systems and graphical ledger systems can be generated according to the different parameter values of each configuration item in the configuration matrix. For the distributed ledger system instance generated according to the configuration matrix, the load conditions (i.e., load pressure) under different business scenarios can be set for simulation. Each business scenario can set a variety of different load conditions, thereby realizing simulation in a variety of environments and obtaining accurate simulation results. Among them, the simulation results refer to test data related to the performance of the distributed ledger system instance; business scenarios can include four business scenarios: EtherId (Ethereum identity), SmallBank (small bank), YCSB (Yahoo Cloud Service) and DoNothing (simple).
[0080] In summary, in the embodiment of the present application, since the configuration items are designed layer by layer according to the hierarchical structure of the heterogeneous ledger model, and the heterogeneous ledger model is constructed according to the ledger structure characteristics of the chain distributed ledger and the graphical distributed ledger, the system configuration can be flexibly performed according to the configuration items, and the configuration matrix representing the execution logic of the distributed ledger system can be obtained, thereby obtaining the corresponding chain ledger system and the graphical ledger system based on the configuration matrix. In this way, a distributed ledger simulation that can be configured on demand is realized, and different distributed ledger systems can be flexibly switched for simulation, thereby realizing the simultaneous simulation of the chain ledger system and the graphical ledger system, and comparing and analyzing the impact of different ledger structures on the system, solving the problem that different underlying ledger structures are difficult to configure, compare, and analyze.
[0081] Reference Figure 3 As shown, Figure 3 is a flowchart of another simulation method for a chain-type and graph-type distributed ledger system provided in an embodiment of the present application. The simulation method for a chain-type and graph-type distributed ledger system may include steps S310 to S380:
[0082] Step S310: According to the chain distributed ledger structure and the graphical distributed ledger structure, the ledger structure features are abstracted, and a heterogeneous ledger model is constructed according to the ledger structure features. The ledger structure features include reference relationships between blocks and transaction models within blocks. The transaction model includes an unspent transaction output model and an account balance model. The heterogeneous ledger model includes a chain ledger model and a graphical ledger model.
[0083] Step S320: Design configuration items layer by layer according to the hierarchical structure of the heterogeneous ledger model, wherein the hierarchical structure includes a consensus layer, a data layer, and a storage layer.
[0084] Step S330: Perform system configuration according to the configuration items, and generate a configuration matrix according to the system configuration, wherein the configuration matrix represents the execution logic of the distributed ledger system.
[0085] In the embodiment of the present application, steps S310 to S330 may correspond to the relevant descriptions of the aforementioned steps S110 to S130, and will not be described again here to avoid repetition.
[0086] Step S340: Setting nodes in the network layer of the distributed ledger system, and starting the set nodes in batches, wherein the nodes communicate with each other using a broadcast mechanism.
[0087] In the embodiment of the present application, a node refers to a computer participating in a distributed ledger system. The distributed ledger system determines the blocks to be recorded and the blocks to be confirmed through the interaction of multiple nodes. When simulating a distributed ledger system, it is also necessary to configure the nodes of the network layer in the distributed ledger system, that is, to set the number of nodes in the network layer of the distributed ledger system, and to start and monitor the health of the nodes in batches. In addition, the nodes in the network layer adopt a P2P network structure (P2P refers to Peer-to-Peer, and P2P is a peer-to-peer network); at the same time, in order to ensure the consistency of the chained ledger system and the graphical ledger system, the nodes in the network layer adopt a broadcast mechanism for intra-node communication.
[0088] Step S350: Execute processing logic according to the node and the parameters in the configuration matrix to obtain the distributed ledger system instance.
[0089] In the embodiment of the present application, the configuration matrix is used to characterize the execution logic of the distributed ledger system. The corresponding processing logic is executed according to the started node and the parameters in the configuration matrix to form a corresponding distributed ledger system instance. The distributed ledger system instance can be divided into a chain ledger system and a graphical ledger system according to the different parameters in the configuration matrix, thereby realizing performance simulation analysis of different types of ledger systems.
[0090] Step S360: setting load conditions under different business scenarios, and simulating the distributed ledger system instance according to the load conditions to obtain simulation results.
[0091] In an embodiment of the present application, business scenarios may include four business scenarios: EtherId (Ethereum identity), SmallBank (small bank), YCSB (Yahoo Cloud Service) and DoNothing (simple). For each business scenario, a corresponding load pressure (load condition) may be set to simulate the generated distributed ledger system instance according to the set load pressure.
[0092] Step S370: Calculate the metric index according to the simulation result to obtain the metric index value, wherein the metric index includes the abandoned block rate and the number of valid blocks per unit time.
[0093] Among them, the abandoned block rate refers to the blocks that are not confirmed and executed by the system within a unit time (such as 1 second), and the number of valid blocks refers to the number of blocks confirmed and executed by the system within a unit time.
[0094] Step S380: According to the metric value, the performance of the chained ledger system and the graphical ledger system are compared to obtain an analysis result.
[0095] In an embodiment of the present application, after completing the simulation of the distributed ledger system instance, the simulation results are collected. The simulation results refer to test data related to the performance of the distributed ledger system instance, so as to calculate the metric index according to the simulation results, for example, the number of valid blocks produced by the distributed ledger system within 1 second is calculated. After obtaining the metric index value of the distributed ledger system, the performance of different types of distributed ledger systems can be compared according to the metric index value to obtain the analysis results of the impact of different ledger structures on the system. In a specific implementation, the analysis results are output by generating a test report.
[0096] For example, according to the method of steps S310 to S370 above, the metric index values of the chained ledger system and the metric index values of the graphical ledger system are obtained respectively, and then in step S380, the metric index values of the chained ledger system and the metric index values of the graphical ledger system are compared to obtain the analysis results of the impact of different ledger structures on the system, and the analysis results are output through a test report.
[0097] Therefore, the embodiment of the present application realizes an on-demand configurable distributed ledger simulation, which can flexibly switch different distributed ledger systems for simulation, realize simultaneous simulation of chain ledger systems and graphical ledger systems, compare and analyze the impact of different ledger structures on the system, and solve the problem that different underlying ledger structures are difficult to configure, compare, and analyze.
[0098] The present application also provides a simulation platform compatible with chain-type and graph-type distributed ledger systems. Figure 4 As shown, Figure 4 : is a schematic diagram of the structure of a simulation platform for a chain-type and graph-type distributed ledger system provided in an embodiment of the present application. The simulation platform is used to implement the simulation method for a chain-type and graph-type distributed ledger system described in the above embodiment. The simulation platform specifically includes:
[0099] A configuration management module is used to abstract the characteristics of the ledger structure according to the chain distributed ledger structure and the graphical distributed ledger structure, and to construct a heterogeneous ledger model according to the characteristics of the ledger structure, wherein the characteristics of the ledger structure include the reference relationship between blocks and the transaction model within the block, wherein the transaction model includes an unspent transaction output model and an account balance model, and wherein the heterogeneous ledger model includes a chain ledger model and a graphical ledger model; design configuration items layer by layer according to the hierarchical structure of the heterogeneous ledger model, wherein the hierarchical structure includes a consensus layer, a data layer, and a storage layer; and perform system configuration according to the configuration items, and generate a configuration matrix according to the system configuration, wherein the configuration matrix represents the execution logic of the distributed ledger system.
[0100] A simulation module is used to generate a corresponding distributed ledger system instance according to the configuration matrix, and the distributed ledger system instance includes a chain ledger system and a graphical ledger system.
[0101] The load management module is used to set load conditions under different business scenarios, and simulate the distributed ledger system instance according to the load conditions to obtain simulation results.
[0102] The node management module is used to set the nodes in the network layer of the distributed ledger system and start the set nodes in batches. The nodes communicate with each other using a broadcast mechanism.
[0103] The system analysis module is used to calculate the metric index according to the simulation results to obtain the metric index value, wherein the metric index includes the abandoned block rate and the number of valid blocks per unit time; and compare the performance of the chain ledger system and the graphical ledger system according to the metric index value to obtain the analysis result.
[0104] In the embodiment of the present application, the configuration management module and the node management module are used in the initialization phase of the distributed ledger system, while the simulation module, the load management module and the system analysis module are used in the simulation process and the system performance analysis phase of the distributed ledger system.
[0105] When the configuration management module configures the system according to the configuration items, it mainly configures the parameter values of the consensus layer configuration items, the parameter values of the data layer configuration items, and the parameter values of the storage layer configuration items, so as to characterize the distributed ledger system on demand, so that testers can control the system variables within the distributed ledger system and analyze the impact of different ledger structures on the system.
[0106] The distributed ledger system determines the blocks to be recorded and confirmed through multi-node interaction. Then, when simulating the distributed ledger system, the node management module is used to configure the nodes of the distributed ledger system, that is, to set the number of nodes in the network layer of the distributed ledger system, and to start and monitor the health of the nodes in batches.
[0107] The simulation module is compatible with both the chained ledger system and the graphical ledger system. The simulation module generates the corresponding distributed ledger system instance according to the configuration matrix, that is, it executes the processing logic according to the started nodes and the parameters in the configuration matrix to generate a chained ledger system or a graphical ledger system. The specific type of ledger generated is related to the configuration parameters of the configuration management module.
[0108] The load management module sets corresponding load conditions according to the four business scenarios of EtherId (Ethereum identity), SmallBank (small bank), YCSB (Yahoo Cloud Service) and DoNothing (simple), and then simulates the distributed ledger system instance (i.e., generating a chain ledger system or a graphical ledger system) according to the set load conditions. When the load management module completes the simulation, the system analysis module collects the simulation results and calculates metrics such as the abandoned block rate and the number of valid blocks per second. The performance of different ledger systems is compared and analyzed based on the calculated metric values to obtain the analysis results. Specifically, the simulation platform outputs the analysis results by generating a test report.
[0109] In the simulation platform compatible with chain and diagram distributed ledger systems provided in the embodiment of the present application, the system configuration is flexibly performed according to the configuration items to obtain a configuration matrix representing the execution logic of the distributed ledger system, thereby obtaining the corresponding chain ledger system and diagram ledger system based on the configuration matrix. In this way, an on-demand configuration distributed ledger simulation is realized, and different distributed ledger systems can be flexibly switched for simulation, thereby achieving simultaneous simulation of the chain ledger system and the diagram ledger system, and comparing and analyzing the impact of different ledger structures on the system, solving the problem that different underlying ledger structures are difficult to configure, compare, and analyze.
[0110] Reference Figure 5 As shown, Figure 5 It is a workflow diagram of a simulation platform compatible with chain-type and graph-type distributed ledger systems provided in an embodiment of the present application. The workflow of the simulation platform is:
[0111] Step 1: In the initialization phase, the tester configures the system based on the configuration management module.
[0112] Step 2: The configuration management module generates a configuration matrix based on the system configuration. The configuration matrix is used to characterize the execution logic of the distributed ledger system.
[0113] Step 3: Set the nodes in the distributed ledger system network layer according to the node management module, and start the set nodes in batches.
[0114] Step 4: During the testing phase, the simulation module executes the processing logic according to the parameters in the nodes and configuration matrix to obtain a distributed ledger system instance, which includes a chain ledger system and a graph ledger system.
[0115] Step 5: The tester determines the load conditions and sets the load conditions for different business scenarios based on the load management module.
[0116] Step 6: The load management module simulates the distributed ledger system instance according to the load conditions and obtains the simulation results.
[0117] Step 7: The system analysis module collects simulation results.
[0118] Step 8: The system analysis module calculates the metrics according to the simulation results to obtain the metrics values, which include the abandoned block rate and the number of valid blocks per unit time.
[0119] Step 9: The system analysis module compares the performance of the chain ledger system and the graph ledger system based on the metric values, obtains the analysis results, and generates a test report.
[0120] An embodiment of the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the steps of a simulation method for a compatible chain-type and graph-type distributed ledger system as described in an embodiment of the present application.
[0121] The embodiment of the present application also provides a computer-readable storage medium on which a computer program / instruction is stored. When the computer program / instruction is executed by a processor, the steps of the simulation method of the compatible chain-type and graph-type distributed ledger system described in the embodiment of the present application are implemented.
[0122] The embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the steps of the simulation method of the compatible chain-type and graph-type distributed ledger system described in the embodiment of the present application.
[0123] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0124] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods and simulation platforms according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0125] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0126] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions for executing on the computer or other programmable terminal device to implement the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0127] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.
[0128] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.
[0129] The above is a detailed introduction to a simulation method and simulation platform for a chain-type and graph-type distributed ledger system provided by the present application. This article uses specific examples to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A simulation method compatible with chain-type and graph-type distributed ledger systems, characterized in that: include: According to the chain distributed ledger structure and the graphical distributed ledger structure, the ledger structure features are abstracted, and a heterogeneous ledger model is constructed according to the ledger structure features. The ledger structure features include the reference relationship between blocks and the transaction model within the block. The transaction model includes an unspent transaction output model and an account balance model. The heterogeneous ledger model includes a chain ledger model and a graphical ledger model. Designing configuration items layer by layer according to the hierarchical structure of the heterogeneous ledger model, wherein the hierarchical structure includes a consensus layer, a data layer, and a storage layer; Performing system configuration according to the configuration items, and generating a configuration matrix according to the system configuration, wherein the configuration matrix represents the execution logic of the distributed ledger system, each row element of the configuration matrix represents a configuration item, and each column element represents a configuration item of the distributed ledger system, and the configuration matrix includes at least one column of configuration items of the chained ledger system and one column of configuration items of the graphical ledger system; Generate a corresponding distributed ledger system instance according to the configuration matrix, wherein the distributed ledger system instance includes a chain ledger system and a graphical ledger system; Setting load conditions under different business scenarios, and simulating the distributed ledger system instance according to the load conditions to obtain simulation results; The step of performing system configuration according to the configuration items and generating a configuration matrix according to the system configuration includes: According to the hierarchical structure of the heterogeneous ledger model, the parameter value of each configuration item is set layer by layer; The parameter value of each of the configuration items is mapped to a corresponding key to obtain the configuration matrix.
2. A simulation method for a chain-type and graph-type distributed ledger system according to claim 1, characterized in that: According to the hierarchical structure of the heterogeneous ledger model, the parameter value of each configuration item is set layer by layer, including: Configure the parameter values of the consensus layer configuration items, including the accounting consensus and confirmation consensus; Configure the parameter values of the data layer configuration items, the parameter values of the data layer configuration items include account mode, pre-block list, transaction and ledger mode, the account mode includes unspent transaction output model and account balance model, the pre-block list includes single pre-block and multiple pre-blocks, the transaction includes conflicting and non-conflicting, the ledger mode includes graphical ledger structure and chained ledger structure; The parameter values of the configuration storage layer configuration items include the storage location of the ledger data, and the ledger data is stored in the specified storage device in the form of key-value.
3. A simulation method for a chain-type and graph-type distributed ledger system according to claim 1, characterized in that: Also includes: The nodes in the network layer of the distributed ledger system are set, and the set nodes are started in batches, and the nodes communicate with each other using a broadcast mechanism.
4. A simulation method for a chain-type and graph-type distributed ledger system according to claim 3, characterized in that: Generating a corresponding distributed ledger system instance according to the configuration matrix includes: Processing logic is executed according to the node and the parameters in the configuration matrix to obtain the distributed ledger system instance.
5. A simulation method for a chain-type and graph-type distributed ledger system according to claim 1, characterized in that: Also includes: Calculate the metric index according to the simulation result to obtain the metric index value, wherein the metric index includes the abandoned block rate and the number of valid blocks produced per unit time; According to the metric values, the performance of the chain ledger system and the graph ledger system are compared to obtain analysis results.
6. A simulation platform compatible with chain-based and graph-based distributed ledger systems, characterized in that: include: A configuration management module is used to abstract the characteristics of the ledger structure according to the chain distributed ledger structure and the graphical distributed ledger structure, and to construct a heterogeneous ledger model according to the characteristics of the ledger structure, wherein the characteristics of the ledger structure include the reference relationship between blocks and the transaction model within the block, wherein the transaction model includes an unspent transaction output model and an account balance model, and wherein the heterogeneous ledger model includes a chain ledger model and a graphical ledger model; and to design configuration items layer by layer according to the hierarchical structure of the heterogeneous ledger model, wherein the hierarchical structure includes a consensus layer, a data layer, and a storage layer; And, performing system configuration according to the configuration items, and generating a configuration matrix according to the system configuration, wherein the configuration matrix represents the execution logic of the distributed ledger system, each row element of the configuration matrix represents a configuration item, and each column element represents a configuration item of the distributed ledger system, and the configuration matrix includes at least one column of configuration items of the chained ledger system and one column of configuration items of the graphical ledger system; A simulation module, used to generate a corresponding distributed ledger system instance according to the configuration matrix, wherein the distributed ledger system instance includes a chain ledger system and a graphical ledger system; A load management module, used to set load conditions under different business scenarios, and simulate the distributed ledger system instance according to the load conditions to obtain simulation results; Wherein, the configuration management module is also used for: According to the hierarchical structure of the heterogeneous ledger model, the parameter value of each configuration item is set layer by layer; The parameter value of each of the configuration items is mapped to a corresponding key to obtain the configuration matrix.
7. A simulation platform compatible with chain-type and graph-type distributed ledger systems according to claim 6, characterized in that: Also includes: The node management module is used to set the nodes in the network layer of the distributed ledger system and start the set nodes in batches. The nodes communicate with each other using a broadcast mechanism.
8. A simulation platform compatible with chain-type and graph-type distributed ledger systems according to claim 6, characterized in that: Also includes: A system analysis module, used to calculate metrics according to the simulation results to obtain metric values, wherein the metric includes a block abandonment rate and a number of valid blocks produced per unit time; And according to the measurement index value, the performance of the chain ledger system and the graphical ledger system is compared to obtain the analysis results.