Electronic archive management system, method and device based on topological optimization blockchain
By introducing topology optimization technology into the blockchain storage system, optimizing the blockchain network structure and data management process, the problems of low efficiency and high cost of blockchain storage electronic files are solved, and more efficient data storage and transmission are achieved. Improves system performance and reliability.
Patent Information
- Application Number
- CN202411117725.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-08-15
AI Technical Summary
The existing blockchain storage electronic archive technology has insufficient efficiency and scalability, limited storage space and high cost, and the execution efficiency and security of smart contracts need to be further improved, especially in the data storage and transmission paths. and bandwidth consumption issues.
Adopt topological optimization-based blockchain management system to store electronic files into a first-level blockchain network through data collection, preprocessing, consensus mechanism and smart contracts, and adjust the network structure into a second-level blockchain network through topological optimization algorithm. , optimize the connection cost and communication delay between nodes, and build user interfaces and APIs for management.
It improves the efficiency of data storage and transmission paths, reduces network latency and bandwidth consumption, improves the overall performance and fault tolerance of the system, and enhances the scalability and maintainability of the system.
Smart Images

Figure CN118646660B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data storage, and in particular to an electronic archive management system, method and device based on topologically optimized blockchain. Background Art
[0002] The development of blockchain technology has brought new opportunities for the storage and management of electronic archives. Blockchain storage of electronic archives is a method of storing and managing electronic archives by utilizing the characteristics of blockchain such as decentralization, immutability and transparency. Traditional electronic archive storage systems mainly rely on centralized databases. Although this method can meet basic storage needs, it has many problems in data security, privacy protection and system stability. Especially in the current context of frequent data leaks and cyber attacks, the safe storage of electronic archives has become an important issue that needs to be solved urgently. Blockchain technology can effectively improve the security and reliability of electronic archive storage systems through its unique distributed ledger mechanism. The main uses of blockchain storage of electronic archives include but are not limited to: improving the security of data storage. Due to the immutable nature of blockchain, electronic archives stored on the chain cannot be tampered with by unauthorized personnel, thereby ensuring the integrity and authenticity of the data. Enhance the transparency and traceability of data. The public ledger function of blockchain makes the operation records of data transparent and traceable, which helps to discover and track abnormal operations. Decentralized storage methods reduce the risk of single point failures and improve the stability and availability of the system. Provide higher privacy protection. Through cryptographic technology, blockchain can protect user privacy while ensuring data access control.
[0003] Existing blockchain technologies for electronic archive storage mainly include: distributed ledger technology, smart contracts, encryption algorithms and distributed storage technology. Distributed ledger technology maintains ledger data through multiple nodes to achieve decentralized storage and management of data; smart contracts realize automated data operations and management processes through preset program logic; encryption algorithms provide strong security guarantees during data transmission and storage; and distributed storage technology ensures high availability and fault tolerance of data. However, there are still some problems with the existing blockchain technology when applied to electronic archive storage. For example, the storage efficiency and scalability of data are low, the storage space of blockchain is limited and the storage cost is high; at the same time, the execution efficiency and security of smart contracts still need to be further improved. In order to solve the above problems, a variety of methods have been proposed. These methods include: sharding technology, which improves data processing efficiency and scalability by dividing the blockchain network into multiple small pieces; off-chain storage, which reduces the storage burden of the blockchain by storing most of the data in a distributed storage system under the chain and only storing the hash value of the data on the blockchain; using more efficient consensus algorithms, such as proof of stake (PoS) and practical Byzantine fault tolerance (PBFT), to increase transaction processing speed and reduce energy consumption. These methods have solved the efficiency and cost issues in blockchain storage of electronic archives to a certain extent, but there are still some defects. For example, sharding technology has challenges in cross-shard communication and data consistency, off-chain storage requires additional trust mechanisms to ensure data integrity and security, and new consensus algorithms may have compromises in terms of security and decentralization.
[0004] Therefore, there is an urgent need for a technical solution that can design more efficient data storage and transmission paths, reduce network latency and bandwidth consumption, and thus improve the overall performance of the system. Summary of the invention
[0005] In order to solve the deficiencies of the prior art, the embodiments of the present application provide an electronic archive management system, method and device based on topologically optimized blockchain. The present application solves the technical problems such as low efficiency in storing electronic archives in blockchain of the prior art.
[0006] The embodiment of the present application provides an electronic archive management system based on a topology-optimized blockchain, comprising: a data collection unit, a blockchain storage unit, a topology optimization unit, and a user access unit; wherein the data collection unit is used to collect data and pre-process the data to form an electronic archive; the blockchain storage unit is used to store the electronic archive in a primary blockchain network through a consensus mechanism and a smart contract; the topology optimization unit is used to optimize the configuration of the primary blockchain network according to a topology optimization algorithm, and adjust the structure of the primary blockchain network to the structure of a secondary blockchain network; the user access unit is used to build a user interface and an API to access or manage electronic archives.
[0007] In a possible implementation, data is collected and preprocessed to form an electronic archive, including: obtaining a collection sequence of a data source based on a target collection frequency and a target data volume; performing data cleaning operations on the collection sequence including missing value processing, duplicate value processing, and outlier processing; performing data conversion and data normalization on the collection sequence after data cleaning to obtain a standard sequence; and splicing one or more standard sequences from different data sources to form an electronic archive.
[0008] In a possible implementation, electronic files are stored in a primary blockchain network through a consensus mechanism and a smart contract, including: data packaging of the electronic files to generate blockchain blocks; nodes in the primary blockchain network verify the newly generated blocks through a consensus mechanism to obtain a target random number that meets preset conditions; when a qualified block is obtained, the block is broadcast to the entire primary blockchain network for verification by other nodes; when the verification of other nodes is passed, the block is added to the primary blockchain network, and predefined operations are automatically executed through smart contracts.
[0009] In a possible implementation, the structure of the primary blockchain network is adjusted to the structure of the secondary blockchain network according to the optimization configuration of the primary blockchain network by a topology optimization algorithm, including: obtaining an undirected graph of the primary blockchain network to calculate the connection cost between nodes in the undirected graph; constructing an optimization target of the undirected graph to minimize the overall connection cost; according to the geographical location of the nodes, nodes with similar geographical locations are assigned to the same cluster to reduce the communication delay between nodes; within each cluster, a greedy heuristic algorithm is used to construct a network topology; a minimum spanning tree is constructed to connect super nodes of different clusters to obtain a secondary blockchain network; when a node joins or leaves, the topological structure of the secondary blockchain network is iteratively and dynamically maintained.
[0010] In one possible implementation, a greedy heuristic algorithm is used to construct a network topology within each cluster, including: selecting the node with the strongest computing power as the super node within the cluster; sorting the other nodes within the cluster from small to large according to the connection cost with the super node; connecting the other nodes to the super node in sequence according to the sorting until all nodes within the cluster are connected.
[0011] In one possible implementation, a minimum spanning tree is constructed to connect super nodes of different clusters to obtain a secondary blockchain network, including: constructing an edge set, the edge set including edges between all cluster pairs; wherein the edge weight is the connection cost between two super nodes; sorting the edge set according to the order of edge weight from small to large; starting from the edge with the smallest weight, if adding the edge will not produce a loop, adding it to the spanning tree until all clusters are connected.
[0012] In one possible implementation, calculating the connection cost between nodes in an undirected graph includes: ,in, represents the connection cost between nodes i and j, Represents the first parameter, represents the geographical distance between nodes i and j, Represents the second parameter, represents the computing power of node i, represents the computing power of node j, represents the network bandwidth of node i, represents the network bandwidth of node j, Represents the third parameter.
[0013] In one possible implementation, the optimization objective of constructing an undirected graph to minimize the overall connection cost includes: ,in, is a decision variable, indicating whether there is a link connection between nodes i and j. represents the connection cost between nodes i and j.
[0014] The embodiment of the present application also provides a method for managing electronic archives based on a topology-optimized blockchain, including: collecting data and preprocessing the data to form an electronic archive; storing the electronic archive in a primary blockchain network through a consensus mechanism and a smart contract; optimizing the primary blockchain network according to a topology optimization algorithm, and adjusting the structure of the primary blockchain network to the structure of a secondary blockchain network; and building a user interface and API to access and / or manage the electronic archive.
[0015] An embodiment of the present application also provides an electronic archive management device based on a topology-optimized blockchain, comprising: a processor, a memory, and a system bus; wherein the processor and the memory are connected via the system bus; the memory is used to store one or more programs, and the one or more programs include instructions, which, when executed by the processor, enable the processor to execute the method described in the above embodiment.
[0016] In the electronic archive management system, method and device based on topology optimization blockchain provided above, the embodiment of the present application can optimize the structure and layout of the system by combining blockchain technology and topology optimization methods to achieve the optimization of certain performance indicators. Furthermore, in some embodiments, more efficient data storage and transmission paths can be designed through topology optimization, reducing network latency and bandwidth consumption, thereby improving the overall performance of the system. In other embodiments, topology optimization can help optimize the distribution and replication strategies of data, further improving the fault tolerance and data availability of the system. In yet other embodiments, methods based on topology optimization can better balance the load of the system, avoid single-point bottlenecks, and improve the scalability and maintainability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are 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 work.
[0018] Figure 1 A schematic block diagram of an electronic archive management system based on a topology-optimized blockchain provided in an embodiment of the present application;
[0019] Figure 2 A flowchart of a method for storing an electronic file in a primary blockchain network provided in an embodiment of the present application;
[0020] Figure 3 A flowchart of a method for topological optimization of a primary blockchain network provided in an embodiment of the present application. DETAILED DESCRIPTION
[0021] Various exemplary embodiments of the present application will now be described in detail with reference to the accompanying drawings. It should be noted that unless otherwise specifically stated, the relative arrangement of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present application.
[0022] Those skilled in the art will appreciate that the terms "first", "second" and the like in the embodiments of the present application are only used to distinguish different steps, devices or modules, etc., and do not represent any specific technical meaning, nor do they represent the necessary logical order between them. It should also be understood that in the embodiments of the present application, "multiple" may refer to two or more, and "at least one" may refer to one, two or more. It should also be understood that for any component, data or structure mentioned in the embodiments of the present application, in the absence of explicit limitation or contrary revelation given in the context, it can generally be understood as one or more. In addition, the term "and / or" in the present application is only a kind of association relationship describing the associated objects, indicating that there can be three kinds of relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the present application generally indicates that the associated objects before and after are an "or" relationship. It should also be understood that the description of each embodiment in the present application emphasizes the differences between the embodiments, and the same or similar parts can refer to each other. For the sake of brevity, they will not be repeated one by one.
[0023] At the same time, it should be understood that, for ease of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship. The following description of at least one exemplary embodiment is actually only illustrative and is by no means intended to limit the present application and its application or use. The techniques, methods and devices known to ordinary technicians in the relevant fields may not be discussed in detail, but where appropriate, the techniques, methods and devices should be considered as part of the specification. It should be noted that similar numbers and letters represent similar items in the following drawings, so once an item is defined in one drawing, it does not need to be further discussed in subsequent drawings.
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution 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.
[0025] Figure 1A schematic block diagram of an electronic archive management system based on a topology optimized blockchain provided in an embodiment of the present application. It should be understood that the system shown in the figure is exemplary and not restrictive. This means that the system architecture involved is not limited to a specific form or design, but is presented as an example. In other words, the architecture shown in the figure can be regarded as a way of expression to clearly describe related concepts and relationships, and does not exclude other forms of architecture. Therefore, when interpreting the architecture in the picture, it should be understood that the model is flexible and diverse, and its purpose is to provide an exemplary description rather than a restrictive provision on a specific form.
[0026] like Figure 1 As shown, at the data collection unit 101, data is collected and preprocessed to form an electronic file. It should be understood that collecting data refers to the process of obtaining data from various sources. These sources may include sensors, databases, file systems, the Internet, etc. The collected data may be structured, semi-structured or unstructured.
[0027] Specifically, first, based on the target collection frequency and target data volume, obtain the collection sequence of the data source. In an implementation scenario, it is necessary to determine the collection frequency (F1, F2, ..., Fn) and data volume (L1, L2, ..., Ln) of each data source. The collection frequency determines the time interval for data collection, while the data volume affects the amount of data collected each time. For example, when developing an electronic medical record management system (EMR), the system needs to collect data from multiple systems in the hospital. Specifically, it includes:
[0028] Patient Information System (PIS): This system contains basic information of patients, such as name, age, gender, address, etc. In order to ensure the latest status of these data, the collection frequency can be set to once a day (F1 = 1 / day), and the data volume L1 depends on the number of new and modified patient information records.
[0029] Electronic Medical Record System (EMR): This system contains the patient's diagnosis records, treatment plans, surgical records, drug prescriptions, etc. These data are crucial for clinical decision-making, and the collection frequency should be high, which can be once an hour (F2 = 1 / hour). The data volume L2 is determined by the number of new and modified records per hour.
[0030] Laboratory Information Management System (LIMS): This system contains the patient's test and examination results. Because the test results directly affect diagnosis and treatment, the frequency of data collection can be set to once every half hour (F3 = 1 / 30min), and the data volume L3 is determined by the frequency of each test and examination result.
[0031] Define the data source as (S1, S2, ..., Sn), and record the data collected from each data source as (D1, D2, ..., Dn), then the total data set D can be expressed as: In actual operation, in order to ensure the real-time and integrity of data, the scheduling of data collection needs to be optimized. The following algorithm can be used to achieve efficient data collection: First, initialize and set the collection frequency (F1, F2, ..., Fn) and data volume (L1, L2, ..., Ln) of each data source. Then, a priority queue is established according to the urgency and importance of data collection. For example, the data of the EMR system has the highest priority, followed by the PIS system, and the LIMS system is the last. Secondly, perform time wheel scheduling (TimeWheel Scheduling), using the time wheel scheduling algorithm to put the collection tasks of each data source into the corresponding slot of the time wheel. The number of slots of the time wheel can be set to the reciprocal of the greatest common divisor (GCD) collection frequency to ensure that the collection tasks of each data source can be executed on time. For example, if F1 = 1 / day, F2 = 1 / hour, F3 = 1 / 30min, then the number of slots of the time wheel is 24 (i.e. 24 hours a day).
[0032] Next, after obtaining the collection sequence based on the target collection frequency and target data volume, the collection sequence is cleaned by data processing including missing value processing, duplicate value processing and outlier processing. Data cleaning is the process of deleting or correcting erroneous data. Erroneous data includes missing values, duplicate values, outliers, etc. Missing value processing can be done by deletion, filling (mean filling, interpolation, etc.) and other methods. Duplicate value processing ensures data uniqueness by identifying and deleting duplicate records. Outlier value processing uses statistical methods (such as z-score) to identify and process outliers.
[0033] A data set X = {x1, x2, ..., xn} contains some missing values. A missing value processing function is defined as f. The processed data set is: For mean imputation, missing values are replaced by the mean of the dataset. replace:
[0034] .
[0035] Then, the collected sequence after data cleaning is converted and normalized to obtain a standard sequence. Data conversion is the process of converting data from one format to another. For example, converting categorical data to numerical data, or standardizing data to eliminate dimensionality. For example, a categorical variable C, whose values are {c1, c2, ..., ck}, can be converted to numerical data using one-hot encoding. The converted data is a matrix:
[0036] ,in, .
[0037] Data normalization is the process of scaling data to a specific range, often used to eliminate the impact of different dimensions. Common methods include min-max normalization and z-score normalization. Further, min-max normalization: . z-score normalization: ,in, and are the mean and standard deviation of the data set, respectively.
[0038] Finally, one or more standard sequences from different data sources are spliced to form an electronic archive. Data integration is the process of combining data from different sources to form a unified data set. In the above-mentioned embodiment of the medical record management system, patient information, electronic medical records, and laboratory results need to be integrated. When there are two data sets D1 and D2, containing m and n records respectively, data integration can be expressed as: ,in, Indicates a join operation, which can be an inner join, outer join, etc. For example, an inner join based on the patient ID: .
[0039] At the blockchain storage unit 102, the electronic archive is stored in the primary blockchain network through the consensus mechanism and smart contracts. It should be understood that blockchain is a distributed ledger technology that ensures the security and integrity of data through consensus mechanisms and cryptography. Each block in the blockchain contains a set of data records that are encrypted and linked through a hash algorithm to form an unalterable chain. The consensus mechanism is the core of the blockchain, and multiple nodes in the distributed network jointly participate in decision-making to reach a consensus and ensure the authenticity and validity of each block. Smart contracts are an automated protocol running on the blockchain that is used to execute predefined operations and ensure the transparency and automation of transactions.
[0040] Specifically, electronic files are stored in the primary blockchain network through consensus mechanisms and smart contracts, including (e.g. Figure 2 The specific method will be shown in Figure 2 First, the electronic files are packaged to generate blockchain blocks. Then, the nodes in the primary blockchain network verify the newly generated blocks through the consensus mechanism to obtain the target random number that meets the preset conditions. Secondly, when the qualified blocks are obtained, the blocks are broadcast to the entire primary blockchain network for verification by other nodes. Finally, when the verification of other nodes is passed, the blocks are added to the primary blockchain network and the predefined operations are automatically executed through smart contracts.
[0041] At the topology optimization unit 103, according to the optimization configuration of the primary blockchain network by the topology optimization algorithm, the structure of the primary blockchain network is adjusted to the structure of the secondary blockchain network. It should be noted that the topology of the blockchain network has an important impact on its performance and efficiency. By optimizing the topology of the blockchain network, the communication delay between nodes can be reduced, the connection cost can be reduced, and the overall performance of the system can be improved. The topology optimization algorithm is used to find an optimal network structure configuration under given constraints to minimize the connection cost and maximize performance.
[0042] Specifically (such as Figure 3 The specific method will be shown in Figure 3 ), first, obtain the undirected graph of the primary blockchain network to calculate the connection cost between nodes in the undirected graph. Then, construct the optimization target of the undirected graph to minimize the overall connection cost. Secondly, according to the geographical location of the nodes, nodes with similar geographical locations are assigned to the same cluster to reduce the communication delay between nodes. Next, within each cluster, a greedy heuristic algorithm is used to build the network topology. Subsequently, a minimum spanning tree is constructed to connect the super nodes of different clusters to obtain a secondary blockchain network. Finally, when nodes join or leave, the topological structure of the secondary blockchain network is iteratively and dynamically maintained.
[0043] At the user access unit 104, a user interface and an API are constructed to access or manage the electronic archive. It should be understood that the design and implementation of the user interface (UI) and the application program interface (API) are crucial to improving the usability and user experience of the system. The user interface is a bridge for users to interact with the system, while the API provides a programmatic way to access and manage electronic archives.
[0044] The user interface can be composed of two parts: the front-end and the back-end. The front-end is responsible for the display of the interface and user interaction, and the back-end is responsible for data processing and business logic. Front-end technologies include HTML, CSS, and JavaScript. Some popular front-end frameworks such as React, Vue.js, and Angular can be used to build complex user interfaces. The back-end can use various programming languages and frameworks such as Node.js, Python's Django or Flask, Java's Spring, etc. The back-end is responsible for processing user requests, accessing the database, and executing business logic. The user interface should include multiple functional modules to meet different user needs.
[0045] Login and registration: Provides user login and registration functions to ensure user identity verification and management. Archive browsing and search: Provides electronic archive browsing and search functions, users can quickly find the required archives based on keywords, dates and other conditions. Archive management: Provides archive addition, modification and deletion functions, users can easily manage electronic archives. User settings: Provides user personal information and preference settings, users can customize the display and operation of the interface.
[0046] API can adopt the RESTful architectural style, based on the HTTP protocol, and operated through standard HTTP verbs (GET, POST, PUT, DELETE). RESTful API is a design style that emphasizes the concept of resources, represents resources through URLs, and operates through HTTP verbs. Each resource is represented by a unique URL, such as ` / api / documents` to represent electronic archive resources. Use HTTP verbs to operate on resources, such as GET requests to obtain resources, POST requests to create resources, PUT requests to update resources, and DELETE requests to delete resources.
[0047] The API should include multiple functional modules to provide comprehensive electronic archive access and management functions. Authentication, provide user authentication API, such as login and registration interface, to ensure the legitimacy of user identity. Archive management, provide CRUD (create, read, update, delete) operation interface for electronic archives, users can manage electronic archives through API. Search and filter, provide archive search and filter functions, users can retrieve archives according to conditions. User settings, provide management interface for user personal information and preferences, users can set personal information and preferences through API.
[0048] Furthermore, the front end is responsible for the display of the interface and user interaction, and communicates with the back end API through HTTP requests. The back end processes the front end requests, accesses the database, executes business logic, and provides data and services through the API. The database stores electronic files and user information and supports CRUD operations.
[0049] Figure 2 A flowchart of a method for storing electronic files in a primary blockchain network provided in an embodiment of the present application. Figure 2 As shown, at step S201, the electronic archive is packaged to generate a blockchain block. Data packaging is to package the pre-processed electronic archive data into a format that can be processed by the blockchain. Assuming that the electronic archive data is D = {d1, d2, ..., dn}, these data need to be packaged into a blockchain block. Assuming that each block contains (m) data records, the packaged block set is: ,in, .
[0050] At step S202, the nodes in the primary blockchain network verify the newly generated block through the consensus mechanism to obtain the target random number that meets the preset conditions. In the blockchain network, the nodes verify and reach a consensus on the newly generated block through the consensus mechanism. Taking proof of work (PoW) as an example, each node needs to find a random number (nonce) that meets specific conditions by calculating the hash value. Specifically, assuming that the hash value of the block is , we need to find a random number (nonce) such that:
[0051] ,in, Represents a string concatenation operation. Difficulty target.
[0052] At step S203, when a qualified block is obtained, the block is broadcast to the entire primary blockchain network for verification by other nodes. After finding a qualified block, the block will be broadcast to the entire network for verification by other nodes. After verification, the block is added to the blockchain. The broadcasted block needs to meet the following verification conditions: .
[0053] At step S204, when the verification of other nodes is passed, the block is added to the primary blockchain network, and the predefined operations are automatically executed through the smart contract. When storing the block, the smart contract will automatically execute the predefined operations. For example, verify the legitimacy of the data, trigger the data storage operation, etc. Assuming that the condition of the smart contract is C and the operation is A, when condition C is met, the smart contract executes operation A.
[0054] Taking the above-mentioned medical record electronic archive management system as an example, the electronic medical record (EMR) data is stored in the blockchain.
[0055] The electronic medical record data is: [{"patient_id": 1, "diagnosis": "cold", "treatment": "rest", "prescription": "vitamin C"}, {"patient_id": 2, "diagnosis": "hypertension", "treatment": "drug treatment", "prescription": "antihypertensive drugs"}]
[0056] Packaged into blocks, where block B_1: {"data": [{"patient_id": 1, "diagnosis": "cold", "treatment": "rest", "prescription": "vitamin C"}, {"patient_id": 2, "diagnosis": "hypertension", "treatment": "drug treatment", "prescription": "antihypertensive drugs"}], "nonce": 0, "previous_hash": "0", "timestamp": "2024-05-25T12:00:00Z"}
[0057] Taking proof of work as an example, the node needs to find a random number (nonce) that meets the conditions, and then broadcast the found block to the entire network for verification by other nodes. The broadcast block is: {"data": [{"patient_id": 1,"diagnosis":"cold","treatment":"rest","prescription":"vitamin C"},{"patient_id": 2,"diagnosis":"hypertension","treatment":"drug treatment","prescription":"antihypertensive drugs"}],"nonce": 123456,"previous_hash":"0","timestamp":"2024-05-25T12:00:00Z","hash":"0000abcd1234..."}
[0058] After the node is verified, the block is added to the blockchain. The smart contract automatically verifies the legitimacy of the data and triggers the storage operation. In one embodiment, the smart contract:
[0059] Condition C: The data format is legal and the patient ID exists.
[0060] Operation A: Store data to the blockchain.
[0061] Execution: if the data format is valid and the patient ID exists: store the data.
[0062] Figure 3 A flow chart of a topology optimization method for a primary blockchain network provided in an embodiment of the present application. It should be noted that in a traditional blockchain network, nodes are usually connected using a full mesh or partial mesh topology. Although this topology is simple, it has some obvious defects: poor network scalability, and as the number of nodes increases, the number of connections that each node needs to maintain will also grow rapidly, leading to network congestion and inefficiency. Low resource utilization, there are large differences in computing power, bandwidth and other resources between different nodes, but the traditional topology cannot make full use of these heterogeneous resources. Single point failure risk, some nodes may become key nodes in the network, and once these nodes fail, it will cause partition failure of the entire network. In order to solve these problems, the present application proposes a blockchain storage solution based on topology optimization, aiming to build an efficient, scalable, and fault-tolerant overlay network to provide better storage and query performance for blockchain.
[0063] like Figure 3 As shown, at step S301, an undirected graph of the primary blockchain network is obtained to calculate the connection cost between nodes in the undirected graph. Specifically, the blockchain network is abstracted into an undirected graph G=(V, E), where V represents a node set and an edge set E represents a potential connection between nodes. Each node All have the following properties: represents the computing power of node i; represents the network bandwidth of node i; represents the geographical location of node i. For any two nodes , defining the connection cost between them for: ,in, represents the geographical distance between nodes i and j, It is a parameter used to weigh the importance of different factors. Preferably, the value range of the three can be 0 to 1. The cost function comprehensively considers the geographical distance, computing power difference and bandwidth difference between nodes, aiming to build an efficient and balanced overlay network topology.
[0064] At step S302, an optimization goal of the undirected graph is constructed to minimize the overall connection cost. The optimization goal is to find an overlay network topology that minimizes the total cost of the entire network while satisfying the constraint that each node is connected to only one incoming link and one outgoing link. The mathematical expression is as follows:
[0065] ,
[0066] Among them, the decision variables Indicates whether there is a link connection between nodes i and j. This is an integer linear programming (ILP) problem that can be solved using various solvers (such as CPLEX, Gurobi, etc.). However, due to the NP difficulty of the problem, the solution process may consume a lot of time and computing resources for large-scale instances. Therefore, this application designs a more efficient heuristic algorithm to approximately solve the optimization problem.
[0067] At step S303, nodes with similar geographical locations are assigned to the same cluster according to the geographical locations of the nodes to reduce the communication delay between nodes. Specifically, the K-means clustering algorithm is first used to divide all nodes into K clusters according to the geographical locations of the nodes. The purpose of this step is to assign nodes with similar geographical locations to the same cluster, thereby reducing the communication delay between nodes. The objective function of the K-means algorithm is: ,in, represents the kth cluster, represents the centroid of the cluster, and the goal is to minimize the sum of the distances from all nodes to the centroid of each cluster. Through iterative calculation, K clusters can be obtained. ,The geographical locations of nodes within each cluster are relatively concentrated.
[0068] At step S304, a greedy heuristic algorithm is used to construct a network topology inside each cluster. Specifically, a greedy heuristic algorithm is used to construct an efficient overlay network topology inside each cluster. The basic idea of the algorithm is: first, select the node with the strongest computing power as the "super node" in the cluster. Then, the other nodes are sorted from small to large according to the cost with the "super node". Next, connect the nodes to the "super node" in turn until all nodes are connected. The specific algorithm is shown in the following python code:
[0069] def build_intra_cluster_topology(cluster):
[0070] # Select the node with the strongest computing power as the "super node"
[0071] super_node = max(cluster, key=lambda x: x.compute_power)
[0072] # Other nodes are sorted in ascending order according to their cost relative to the "super node"
[0073] sorted_nodes = sorted(cluster - {super_node}, key=lambda x: cost(x, super_node))
[0074] # Connect nodes one by one
[0075] topology = {super_node: []}
[0076] for node in sorted_nodes:
[0077] topology[super_node].append(node)
[0078] topology[node] = [super_node]
[0079] Return topology
[0080] At step S305, a minimum spanning tree is constructed to connect super nodes of different clusters to obtain a secondary blockchain network. After the internal topology of each cluster is constructed, it is necessary to connect nodes between different clusters to form a global overlay network topology. The goal of this step is to ensure that there is a path between any two nodes and to minimize the overhead of cross-cluster communication.
[0081] This application uses the Kruskal algorithm to construct a minimum spanning tree (MST) to connect the "super nodes" of different clusters. The algorithm steps are as follows: Construct an edge set 𝐸, which contains the edges between all cluster pairs, and the edge weight is the connection cost between two "super nodes". Sort 𝐸 by edge weight from small to large, starting with the edge with the smallest weight. If adding the edge will not produce a loop, add it to the MST. Repeat the above steps until all clusters are connected. In this way, a global overlay network topology can be obtained, in which there is a path between any two nodes, and the cross-cluster communication overhead is also reduced as much as possible.
[0082] At step S306, when a node joins or leaves, the topology of the secondary blockchain network is iteratively and dynamically maintained. Due to the dynamic joining and leaving of nodes, the network topology needs to be dynamically adjusted and maintained. In one embodiment, the following strategies can be adopted:
[0083] Node joining: The newly joined node is first matched with the existing cluster based on its geographical location and joins the cluster closest to it. If the number of existing nodes in the cluster exceeds a threshold, a new cluster is created.
[0084] Node departure: When a "super node" in a cluster leaves, a node with the next best computing power is selected as the new "super node". If there is only one node left in the entire cluster, the node is merged into the nearest cluster.
[0085] Periodic reconstruction: K-means clustering and topology construction are re-executed at regular intervals to adapt to the dynamic changes of nodes.
[0086] Through the above strategies, an efficient overlay network topology can be dynamically maintained to improve the robustness and adaptability of the blockchain network.
[0087] Furthermore, an embodiment of the present application also provides a management device for storing electronic archives based on topology-optimized blockchain, comprising: a processor, a memory, and a system bus; the processor and the memory are connected via the system bus; the memory is used to store one or more programs, and the one or more programs include instructions, which, when executed by the processor, enable the processor to execute any of the above methods.
[0088] Furthermore, an embodiment of the present application also provides a computer program product, which, when executed on a terminal device, enables the terminal device to execute any of the above methods.
[0089] It can be known from the description of the above implementation mode that those skilled in the art can clearly understand that all or part of the steps in the above-mentioned embodiment method can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product can be stored in a storage medium such as ROM / RAM, a disk, an optical disk, etc., including several instructions for enabling a computer device (which can be a personal computer, a server, or a network communication device such as a media gateway, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0090] It should be noted that the various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description.
[0091] It should also 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 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 device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0092] The above description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A management system for storing electronic archives based on topological optimization blockchain, characterized in that: include: Data collection unit, blockchain storage unit, topology optimization unit and user access unit; among them, The data collection unit is used to collect data and pre-process the data to form an electronic file; The blockchain storage unit is used to store electronic files in the primary blockchain network through a consensus mechanism and smart contracts; The topology optimization unit is used to optimize the configuration of the primary blockchain network according to the topology optimization algorithm, and adjust the structure of the primary blockchain network to the structure of the secondary blockchain network; including: obtaining an undirected graph of the primary blockchain network to calculate the connection cost between nodes in the undirected graph; constructing an optimization target of the undirected graph to minimize the overall connection cost; according to the geographical location of the nodes, nodes with similar geographical locations are assigned to the same cluster to reduce the communication delay between nodes; within each cluster, a greedy heuristic algorithm is used to construct a network topology; a minimum spanning tree is constructed to connect super nodes of different clusters to obtain a secondary blockchain network; when a node joins or leaves, the topology structure of the secondary blockchain network is iteratively and dynamically maintained; Among them, calculating the connection cost between nodes in an undirected graph includes: ,in, represents the connection cost between nodes i and j, Represents the first parameter, represents the geographical distance between nodes i and j, Represents the second parameter, represents the computing power of node i, represents the computing power of node j, represents the network bandwidth of node i, represents the network bandwidth of node j, Represents the third parameter; The user access unit is used to build a user interface and an API to access or manage electronic archives.
2. The management system according to claim 1, characterized in that: in, Collect data and pre-process the data to form electronic files, including: Based on the target collection frequency and target data volume, obtain the collection sequence of the data source; Perform data cleaning operations on the collected sequences, including missing value processing, duplicate value processing, and outlier processing; Perform data conversion and data normalization on the collected sequence after data cleaning to obtain a standard sequence; One or more standard sequences from different data sources are spliced together to form an electronic archive.
3. The management system according to claim 1, characterized in that: in, The electronic archives are stored in the first-level blockchain network through consensus mechanism and smart contracts, including: Packaging electronic files to generate blockchain blocks; The nodes in the primary blockchain network verify the newly generated blocks through a consensus mechanism to obtain the target random number that meets the preset conditions; When a qualified block is obtained, the block is broadcast to the entire primary blockchain network for verification by other nodes; When the verification of other nodes is passed, the block is added to the primary blockchain network, and the predefined operations are automatically executed through the smart contract.
4. The management system according to claim 1, characterized in that: in, Inside each cluster, a greedy heuristic algorithm is used to build the network topology, including: Select the node with the strongest computing power as the super node within the cluster; Sort the other nodes in the cluster in ascending order according to the connection cost to the super node; Connect other nodes to the super node in sequence according to the sorting until all nodes in the cluster are connected.
5. The management system according to claim 1, characterized in that: in, Construct a minimum spanning tree and connect the super nodes of different clusters to obtain a secondary blockchain network, including: Construct an edge set, which includes edges between all cluster pairs; wherein the edge weight is the connection cost between two super nodes; Sort the edge set according to the order of edge weight from small to large; Starting from the edge with the smallest weight, if adding the edge does not create a cycle, it is added to the spanning tree until all clusters are connected.
6. The management system according to claim 1, characterized in that: in, Construct an optimization objective for an undirected graph to minimize the overall connection cost, including: , in, is a decision variable, indicating whether there is a link connection between nodes i and j. represents the connection cost between nodes i and j.
7. A method for managing electronic archives based on topologically optimized blockchain using the management system as described in any one of claims 1 to 6, characterized in that: include: Collect data and pre-process the data to form electronic files; The electronic archives are stored in the first-level blockchain network through consensus mechanism and smart contracts; According to the topology optimization algorithm, the structure of the primary blockchain network is adjusted to the structure of the secondary blockchain network. These include: obtaining an undirected graph of the primary blockchain network to calculate the connection cost between nodes in the undirected graph; constructing an optimization target for the undirected graph to minimize the overall connection cost; assigning nodes with similar geographical locations to the same cluster based on their geographical locations to reduce communication delays between nodes; using a greedy heuristic algorithm to construct the network topology within each cluster; constructing a minimum spanning tree to connect super nodes from different clusters to obtain a secondary blockchain network; and iteratively and dynamically maintaining the topology of the secondary blockchain network when nodes join or leave. Among them, calculating the connection cost between nodes in an undirected graph includes: ,in, represents the connection cost between nodes i and j, Represents the first parameter, represents the geographical distance between nodes i and j, Represents the second parameter, represents the computing power of node i, represents the computing power of node j, represents the network bandwidth of node i, represents the network bandwidth of node j, Represents the third parameter; Build user interfaces and APIs to access and / or manage electronic archives.
8. A management device for electronic archives based on topologically optimized blockchain, characterized in that: include: A processor, a memory, and a system bus; wherein the processor and the memory are connected via the system bus; The memory is used to store one or more programs, wherein the one or more programs include instructions, and when the instructions are executed by the processor, the processor is caused to perform the method of claim 7.
