System for improving blockchain state database performance using state trie node, and mining method therefor

The use of state trie nodes in the blockchain state database, where the hash value of changed nodes is stored only if it matches the block number, addresses the performance issues of the existing database, resulting in improved transaction synchronization and system efficiency.

WO2024181796A1PCT designated stage expired Publication Date: 2024-09-06SEOUL NATIONAL UNIVERSITY R&DB FOUNDATION
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
PCT/KR2024/002571
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-28
Filing Date
2024-02-28
Publication Date
2024-09-06

AI Technical Summary

Technical Problem

The large size of the blockchain state database, which stores state data using the Merkle Patricia Trie data structure, leads to significant performance degradation when reading or storing tri nodes due to random key value access, particularly during transactions and verification processes.

Method used

A mining method and system that utilize state trie nodes to generate a second block based on a first block and a transaction, where the hash value of changed nodes is used to store the second node in the blockchain state database only if the prefix of the hash value matches the block number, improving transaction synchronization speed by optimizing node storage and retrieval.

Benefits of technology

This approach enhances the performance of the blockchain state database by improving transaction synchronization speed and reducing data storage overhead, thereby improving overall system efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure KR2024002571_06092024_PF_FP
    Figure KR2024002571_06092024_PF_FP
Patent Text Reader

Abstract

One embodiment of the present invention provides a mining method for improving blockchain state database performance using a state trie node. The method is a mining method performed by node devices connected to a blockchain network, and comprises the steps in which: a specific node device obtains a transaction including a first block including a first block number and a first trie node regarding specific state data of the blockchain network, and state change data for changing the state of a specific account; the specific node device generates a second block including a second trie node and a second block number generated on the basis of the transaction and the first trie node; and if, among one or more second nodes included in the second trie node, the hash value of a second node corresponding to a state path, which is the path to a specific root node from a specific leaf node corresponding to the specific account, satisfies a preset criterion such that the prefix of the hash value is the same as the second block number, the specific node device stores the second node corresponding to the state path in a blockchain state trie and database.
Need to check novelty before this filing date? Find Prior Art

Description

A system for improving the performance of a blockchain state database using state trie nodes and a mining method thereof.

[0001] The present invention relates to a system for improving the performance of a blockchain state database using a state trie node and a mining method thereof, and more particularly, to a system for improving the performance of a blockchain state database using a state trie node and a mining method thereof, which generates a second block based on a first block and a new transaction, and stores the second node changed in the first block in a blockchain state database when a hash value of a second node changed in the first block among one or more second nodes included in a second trie node of the second block satisfies a preset criterion such that a prefix of the hash value is identical to a block number of the second block.

[0002] Blockchain is a technology that collects data into blocks and links them together to create a chain in a peer-to-peer (P2P) manner. More specifically, blockchain is a technology in which servers are operated by users and data is stored in a distributed manner, preventing attackers from arbitrarily modifying the data. Furthermore, blockchain uses hash functions and digital signatures to ensure data integrity and reliability. Blockchain is currently being used in various ways, including smart contracts, cryptocurrencies, and personal information authentication.

[0003] Account-based blockchains like Ethereum store state data, which stores account data, in their blockchain state database using the Merkle Patricia Trie data structure. The trie data structure of an account-based blockchain includes leaf nodes, where accounts are stored, intermediate nodes containing path data that identifies the path to the account address, and a root node.

[0004] When a transaction is executed for a specific block in an account-based blockchain, a new block is created with the nodes of the trie node corresponding to the account being changed by the transaction. More specifically, the new block includes a newly created trie node, which includes the leaf node for the account being changed by the transaction in the specific block, and the intermediate and root nodes of the specific block corresponding to the path of the changed account. The trie node of the new block calculates hash values ​​for each node in the order of the newly created leaf node, intermediate node, and root node. The hash values ​​of each node in the trie node serve as pointers to the trie node. The newly created nodes in the new block are stored in the blockchain state database using their respective hash values ​​as keys. Since the nodes that are not changed in the new block are stored in the state database, the account status can be tracked by accessing the trie node of the specific block preceding the new block.

[0005] In blockchains with this architecture, the blockchain state database, where state data is stored, is so large that it accounts for the majority of the entire blockchain data. Consequently, when reading a trie node from the blockchain state database or storing a new trie node to perform transactions and verification for a specific block, the state database must be accessed using a random key value (a hash value), resulting in significant performance degradation on the devices performing the transaction and verification.

[0006] The present invention is intended to solve the above-mentioned problem, and provides a system for improving the performance of a blockchain state database using a state trie node and a mining method thereof, in which a second block is generated based on a first block and a transaction, and a second node changed in the first block is stored in a blockchain state database when a hash value of one or more second nodes included in a second trie node of the second block satisfies a preset criterion such that the prefix of the hash value is identical to the block number of the second block.

[0007] The technical problems to be solved by the present invention are not limited to the technical problems described above, and other technical problems of the present invention can be derived from the following description.

[0008] As a technical means for solving the above-described technical problem, according to one aspect of the present invention, a mining method for improving the performance of a blockchain state database using a state trie node is provided. The method is a mining method performed by node devices connected to a blockchain network, comprising: a step in which a specific node device obtains a first block including a first trie node regarding a first block number and specific state data of the blockchain network and a transaction including state change data for changing the state of a specific account; a step in which the specific node device generates a second block including a second trie node and a second block number generated based on the transaction and the first trie node; and a step in which the specific node device stores the second node corresponding to the state path in a blockchain state trie and a database if a hash value of a second node corresponding to a state path, which is a path from a specific leaf node corresponding to the specific account to a specific root node among one or more second nodes included in the second trie node, satisfies a preset criterion such that a prefix of the hash value is identical to the second block number.

[0009] In addition, as a technical means for solving the above-described technical problem, according to another aspect of the present invention, a system for improving the performance of a blockchain state database using a state tree is provided. The system comprises at least one processor and a memory electrically connected to the processor and storing at least one code to be executed by the processor, wherein the memory stores code that, when executed through the processor, causes the processor to obtain a first block including a first trie node regarding a first block number and specific state data of the blockchain network and a transaction including state change data for changing the state of a specific account, generate a second block including a second trie node and a second block number generated based on the transaction and the first trie node, and, if a hash value of a second node corresponding to a state path, which is a path from a specific leaf node corresponding to the specific account to a specific root node among one or more second nodes included in the second trie node, satisfies a preset criterion such that a prefix of the hash value is identical to the second block number, cause the second node corresponding to the state path to be stored in a blockchain state tree and a database.

[0010] According to the above-described problem solving means of the present invention, the transaction synchronization speed can be improved by making the prefix of the hash value for each of the nodes changed in the previous block among one or more nodes included in the trie node of the newly generated block the same as the block number of the newly generated block.

[0011] FIG. 1 is a diagram showing a system for improving the performance of a blockchain state database using a state tree node according to one embodiment of the present invention and node devices communicating with a blockchain network.

[0012] FIG. 2 is a block diagram illustrating the configuration of a blockchain state database performance improvement system using the state tree node illustrated in FIG. 1.

[0013] FIG. 3 is a diagram illustrating an example of performing a proof-of-work consensus algorithm through a blockchain state database performance improvement system using the state tree node illustrated in FIG. 1.

[0014] Figure 4 is a diagram showing an example of a blockchain state database.

[0015] FIG. 5 is a diagram showing an example of a new trie node of a block created by performing a proof-of-work algorithm on a blockchain state database through a conventional blockchain mining system.

[0016] Figure 6 is a diagram showing an example of how newly created nodes of multiple blocks generated through a tri-node proof-of-work consensus algorithm are stored in a blockchain state database.

[0017] FIG. 7 is a flowchart illustrating a method for improving the performance of a blockchain state database using a state tree node according to another embodiment of the present invention.

[0018] FIGS. 8 to 11 are flowcharts illustrating detailed steps included in the method for improving the performance of a blockchain state database using the state tree node illustrated in FIG. 7.

[0019] Hereinafter, the present invention will be described in detail with reference to the attached drawings. However, the present invention can be implemented in various different forms and is not limited to the embodiments described herein. In addition, the attached drawings are only intended to facilitate understanding of the embodiments disclosed in this specification, and the technical ideas disclosed in this specification are not limited by the attached drawings. All terms, including technical and scientific terms, used herein should be interpreted as having meanings generally understood by a person of ordinary skill in the technical field to which the present invention pertains. Terms defined in the dictionary should be interpreted as having additional meanings consistent with the related technical literature and the presently disclosed content, and shall not be interpreted in an extremely ideal or restrictive sense unless otherwise defined.

[0020] In order to clearly explain the present invention in the drawings, parts irrelevant to the description have been omitted, and the size, shape, and appearance of each component shown in the drawings may be modified in various ways. Identical / similar parts throughout the specification are given identical / similar drawing reference numerals.

[0021] The suffixes "module" and "part" used in the following description for components are given or used interchangeably solely for the convenience of writing the specification, and do not in themselves have distinct meanings or roles. In addition, when describing the embodiments disclosed in this specification, if a detailed description of a related known technology is judged to obscure the gist of the embodiments disclosed in this specification, the detailed description thereof has been omitted.

[0022] Throughout the specification, when a part is said to be "connected (connected, in contact with, or coupled)" to another part, this includes not only cases where it is "directly connected (connected, in contact with, or coupled)" but also cases where it is "indirectly connected (connected, in contact with, or coupled)" with another member in between. Furthermore, when a part is said to "include (have or provide)" a certain component, this does not mean that it excludes other components, but rather that it may "include (have or provide)" other components, unless otherwise specifically stated.

[0023] As used herein, ordinal terms such as "first," "second," etc., are used solely to distinguish one component from another and do not limit the order or relationship of the components. For example, the first component of the present invention may be referred to as the "second component," and similarly, the second component may also be referred to as the "first component." As used herein, singular expressions should be construed to include plural expressions, unless explicitly stated otherwise.

[0024] The communication module described below may include a device including hardware and software necessary for transmitting and receiving signals such as control signals or data signals through wired or wireless connections with other network devices. In addition, the memory may store at least one of information and data input to the communication module, information and data necessary for functions performed by the processor, and data generated according to the execution of the processor. The memory should be interpreted as a general term for non-volatile storage devices that continue to retain stored information even when no power is supplied and volatile storage devices that require power to retain stored information. In addition to volatile storage devices that require power to retain stored information, the memory may include magnetic storage media or flash storage media, but the scope of the present invention is not limited thereto. The processor may include various types of devices that control and process data. The processor may mean a data processing device built into hardware that has a physically structured circuit to perform a function expressed by code or instructions included in a program. In one example, the processor may be implemented in the form of a microprocessor, a central processing unit (CPU), a processor core, a multiprocessor, an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), etc., but the scope of the present invention is not limited thereto.

[0025] FIG. 1 is a diagram showing a system for improving the performance of a blockchain state database using a state tree node according to one embodiment of the present invention (hereinafter referred to as “blockchain system (100)”) and node devices (200, 300) being connected to a blockchain network for communication.

[0026] Referring to FIG. 1, a blockchain system (100) may be interconnected with a blockchain network via a wired or wireless communication network, and may be interconnected with node devices (200, 300) via the blockchain network. When a transaction is received via the blockchain network, the blockchain system (100) and node devices (200, 300) connected to the blockchain network may create a new block to process the transaction. For example, each blockchain system (100) and node devices (200, 300) may be a node constituting the blockchain network, and may be a system and device for processing transactions and creating new blocks to form a blockchain. That is, the blockchain system (100) and node devices (200, 300) connected to the blockchain network may create a new block associated with the received transaction. Here, the new block may be created to include information on previously processed transactions, information on newly received transactions, etc. For example, a new block may refer to a current block that is configured to be linked to a previous block that includes information about pre-processed transactions, etc. The blockchain system (100) may be formed as a cloud computing server such as SaaS (Software as a Service), PaaS (Platform as a Service), or IaaS (Infrastructure as a Service). The blockchain system (100) may be another node device. The configuration, function, and operation of the blockchain system (100) described below may also be performed in the same manner by the node devices (200, 300). The node devices (200, 300) may refer to all types of handheld-based wireless communication devices, such as, for example, a notebook computer, desktop computer, laptop computer equipped with a web browser, a wireless communication device that ensures portability and mobility, or a smartphone, a tablet PC including a touchpad, etc.A communications network can be implemented as a wired network such as a Local Area Network (LAN), a Wide Area Network (WAN), or a Value Added Network (VAN), or any type of wireless network such as a mobile radio communication network or a satellite communication network.

[0027] The node devices (200, 300) may be a client node device (200) and a mining node device (300).

[0028] The client node device (200) includes a communication module, a memory, an input / output module, and a processor. The communication module of the client node device (200) can transmit and receive information with a blockchain network. The memory of the client node device (200) stores a blockchain program. The name of the blockchain program is set for convenience of explanation, and the name itself does not limit the function of the program. The memory of the client node device (200) may be configured to store at least one of data input to the communication module of the client node device (200), data required for a function performed by the processor of the client node device (200), and data generated according to the execution of the processor of the client node device (200). The input / output module of the client node device (200) may receive information, data, etc. transmitted to the client node device (200) from the outside, or output information, data, etc. held by the client node device (200) to the outside. For example, the input / output module of the client's node device (200) may include a display, a touchpad, a speaker, and a microphone.

[0029] The processor of the client's node device (200) is configured to execute a blockchain program stored in memory to perform the following functions and procedures.

[0030] The processor of the client's node device (200) can generate a transaction and transmit the generated transaction to the blockchain network. The processor of the client's node device (200) can transmit a request for proof of a block generated by the transaction to the blockchain network.

[0031] The mining node device (300) includes a communication module, a memory, an input / output module, and a processor. The communication module of the mining node device (300) can transmit and receive information with a blockchain network. The memory of the mining node device (300) stores a blockchain mining program. The name of the blockchain mining program is set for convenience of explanation, and the name itself does not limit the function of the program. The memory of the mining node device (300) may be configured to store at least one of data input to the communication module of the mining node device (300), data required for a function performed by the processor of the mining node device (300), and data generated according to the execution of the processor of the mining node device (300). The input / output module of the mining node device (300) may receive information, data, etc. transmitted to the mining node device (300) from the outside, or output information, data, etc. held by the mining node device (300) to the outside. For example, the input / output module of the mining node device (300) may include a display, a touchpad, a speaker, a microphone, etc.

[0032] The processor of the mining node device (300) is configured to execute a blockchain program stored in memory to perform the following functions and procedures.

[0033] The processor of the mining node device (300) receives information about a new block generated by a transaction. The new block includes state data and a block, and the state data is stored in a trie node including one or more nodes. The processor of the mining full node device (300) derives a nonce value such that the hash value of each of one or more nodes included in the newly generated trie node, which is different from the trie node of the previous block, satisfies a preset standard. The processor of the mining node device (300) transmits the nonce value for the newly generated block to the blockchain network and receives a reward.

[0034] FIG. 2 is a block diagram illustrating the configuration of a blockchain system (100), and FIG. 3 is a diagram illustrating an example of performing a proof-of-work consensus algorithm through a blockchain state database performance improvement system (100) using a state tree node.

[0035] Referring to FIGS. 2 and 3 together, the blockchain system (100) includes at least one processor (130) and memory (140), and may further include a communication module (110) and a database (120).

[0036] The communication module (110) can transmit and receive data necessary to manage a blockchain based on a tri-node proof-of-work consensus algorithm by transmitting and receiving information with an external device or server.

[0037] The database (120) may be a place where data required to manage a blockchain based on a tri-node proof-of-work consensus algorithm is stored. The database (120) may be built in a portion of memory (140) or implemented as separate hardware.

[0038] The processor (130) performs operations according to the code stored in the memory (140).

[0039] The memory (140) is electrically connected to the processor (130) and stores at least one code to be executed by the processor (130). The memory (140) stores code that, when executed by the processor (130), causes the processor (130) to perform the following functions and procedures.

[0040] The memory (140) stores a first block (400) including a first trie node (430) regarding a first block number (410) and specific state data of a blockchain network, and code that causes a transaction to be acquired. The transaction may correspond to data and information for changing or updating the state of a trie node included in a tree structure. The tree structure may be a Merkle Patricia Trie data structure. The transaction includes state change data. The state change data is data for changing the state of a specific account. The state change data includes the address of the specific account and the number of transactions. The transaction may be acquired from the blockchain mempool. The transaction is a new transaction not included in the first block.

[0041] The memory (140) stores code that causes the creation of a second block (500) including a second trie node (530) and a second block number (510) generated based on a transaction and a first trie node (430). The memory (140) performs a transaction to create a second block (500) and stores a transaction list including one or more transactions performed with the second trie node (530) in the second block (500). The memory (140) can create a second trie node (530) generated by changing a transaction based on the first trie node (430) of the first block. More specifically, the memory (140) stores code that causes the search for a first node corresponding to a state path, which is a path from a specific leaf node corresponding to a specific account to be changed through state change data of a transaction, to a specific root node among the first nodes included in the first trie node (430) of the first block (400). Among the first nodes included in the first trie node (430), a first node corresponding to a state path may be a plurality of first nodes. The memory (140) stores code that causes a second node corresponding to the state path to be created based on the first node corresponding to the state path using state change data and the state path. More specifically, the memory (140) stores code that causes the first node corresponding to the state path to create account information of a leaf node corresponding to a specific account to be changed in the state change data of a transaction based on the state change data. The memory (140) stores code that causes a leaf node for a specific account to be created according to the state path based on the state change data if there is no leaf node corresponding to the specific account to be changed in the state change data in the first node corresponding to the state path. The memory (140) stores code that causes a sibling node to be searched for for the second node corresponding to the state path.A sibling node of a second node corresponding to a state path is a node having the same parent node as the second node corresponding to the state path. More specifically, the memory (140) stores code that causes the memory to search for a modified sibling node among the sibling nodes of the second node corresponding to the state path. For example, the sibling node of the leaf node (537) is the leaf node (437), and the sibling nodes of the intermediate node (535) are the leaf node (435) and the leaf node (534). The memory (140) stores code that causes the memory to generate a second trie node (530) by associating the searched sibling node with the second node corresponding to the state path.

[0042] For example, if the state path is path data for a leaf node (436) including hash (a1) and a leaf node (438) including hash (a3), the path data for the leaf node (436) is ' / 2 / 9' and the path data for the leaf node (438) is ' / b / 6 / 1', so the first node is a root node (431) including hash A, an intermediate node (432) including hash B, a leaf node (436), an intermediate node (433) including hash C, an intermediate node (434) including hash D, and a leaf node (438). Among the second nodes, the leaf nodes (534, 538) are generated by the state change data of the transaction based on the first nodes. If the status change data of the transaction is data for the account of a specific leaf node (537) and the status path is '2 / a / 5 / b', which is the path data of a specific leaf node (537), then since there is no leaf node corresponding to the specific leaf node (537) among the 1 nodes, a second trie node in which the specific leaf node (537) is created can be created based on the first nodes.

[0043] The first nodes (431 to 439) included in the first block (400) and the second nodes (435, 437, 439, 531 to 538) included in the second block include at least one of a root node (431, 531), an intermediate node (432, 433, 434, 532, 533, 535, 536), and a leaf node (435, 436, 437, 438, 439, 537, 538). The root node is associated with the intermediate node as a child node, or with the leaf node as a child node. For example, the child nodes of the root node (431) whose hash value is hash A are the intermediate node (432) whose hash value is hash B, and the intermediate node (433) whose hash value is hash C. An intermediate node is associated with other intermediate nodes as child nodes, or with leaf nodes as child nodes. For example, the child nodes of an intermediate node (532) whose hash value is hash F are a leaf node (435) whose hash value is hash(a0), a leaf node (534) whose hash value is hash(a1), and an intermediate node (535) whose hash value is hashG. The root node and the intermediate nodes include path data for the child nodes, a nonce field into which a nonce value is input, and a hash value. For example, the root node (431) whose hash value is Hash A includes path data such as {2: hash B, b: hash C} and a nonce field. The leaf nodes include account information including an account (Account, 541), an address (Address, 543), a balance (Balance, 544), and the number of transactions (545), and a nonce field (546) into which a nonce value is input, and a hash value. The hash value of a leaf node is stored in a field (codeHash) that stores the hash value of the code if the account is a smart contract. If the account is a smart contract, the leaf node also includes a field (storageRoot) that stores the storage tree. The hash value of an intermediate node is calculated based on the hash value of each of its child nodes, as well as the nonce value entered in the nonce field of the intermediate node, based on the path data of the intermediate node.The hash value of the root node is calculated based on the hash value of each of the child nodes associated with the root node's path data and the nonce value entered in the nonce field of the root node. The hash value of a leaf node is calculated based on the account information of the leaf node and the nonce value entered in the nonce field of the leaf node.

[0044] The memory (140) stores a code that causes the second node corresponding to the state path to be stored in the blockchain state tree and the database when the hash value of the second node corresponding to the state path included in the transaction among one or more second nodes included in the second trie node (530) satisfies a preset criterion. The second block number (510) of the second block (500) has a greater value than the first block number (410) of the first block (400). The preset criterion is a criterion that the prefix of the hash value of the second node corresponding to the state path is the same as the second block number (510) of the second block (500). The preset criterion may further include a criterion that the hash value of the second node corresponding to the state path has a smaller hash value than a hash value that satisfies a preset difficulty. The hash value of the second node corresponding to the state path may be derived by generating a nonce value for the second node corresponding to the state path and based on the nonce value and the second node corresponding to the state path. More specifically, the memory (140) may generate a nonce value for the second node corresponding to the state path and insert the nonce value into the nonce field of the second node corresponding to the state path to derive the hash value. The blockchain state database may be partially implemented in the database (120).

[0045] More specifically, the memory (140) stores a code that causes the memory to derive a hash value of a second node corresponding to a state path and determine whether the hash value satisfies a preset criterion. The memory (140) stores a code that causes the memory to generate a nonce value for a first leaf node, which is a leaf node included in the second node corresponding to the state path, and determine whether the hash value of the first leaf node derived based on the nonce value and the account information of the first leaf node satisfies the preset criterion. The first leaf node may be a plurality of leaf nodes (534, 537, 538), and the hash value of the first leaf node is a hash value for each of the plurality of leaf nodes (534, 537, 538). The memory (140) stores code that causes the memory (140) to generate a nonce value for the first parent node associated with the first leaf node when the hash value of the first leaf node satisfies a preset criterion, and to determine whether the hash value of the first parent node derived based on the nonce value and the hash value of each of one or more child nodes associated with the first parent node satisfies the preset criterion. If the hash value of the first parent node satisfies the preset criterion and there exists a second parent node associated with the first parent node, the memory (140) stores code that causes the memory (140) to generate a nonce value for the second parent node, and to determine whether the hash value of the second parent node derived based on the nonce value and the hash value of each of one or more child nodes associated with the second parent node satisfies the preset criterion. The first parent node and the second parent node are intermediate nodes included in the second node or root nodes included in the second nodes. If the first parent node or the second parent node is a root node included in the second node, the memory (140) stores a code that causes the hash value of the state root included in the block header of the second block (500) to be derived based on the hash value of the root node included in the second nodes if the hash value of the root node included in the second nodes satisfies a preset criterion.

[0046] The memory (140) stores code that causes the hash value of the second node that satisfies a preset criterion to be set as a key for the second node, and if the second node is a root node or an intermediate node, to set path data for a child node of the second node as a value for the key, and if the second node is a leaf node, to set account information included in the second node as a value for the key and store it in the blockchain state database.

[0047] Figure 4 is a diagram showing an example of a blockchain state database.

[0048] Referring to FIG. 4, the blockchain state database (600) includes a memory area (610) and a disk area (620). The blockchain state database may be a LevelDB.

[0049] The memory area (610) can divide the entire spatial area into a plurality of cell areas having a fixed size and store spatial data objects in the memory area (610) defined in the memory. Here, the entire spatial area may correspond to the entire area where spatial data can be located as a spatial area that is the target of a spatial query. In addition, the memory area (610) may correspond to a specific area of ​​the memory as an area where index information regarding spatial data objects is stored. The memory area (610) can divide the entire spatial area into 2n cell areas having a fixed size and store spatial data objects by distributing them in each cell area. The memory area (610) can be implemented as a MemTable. When a second block (500) including a second trie node (530) including a second node changed in the first trie node (430) of the first block (400) by a transaction is created in the memory area (610), the second node of the second block (500) is stored in the memory area (610). More specifically, in the memory area (610), the hash values ​​of the second nodes are stored as keys, and path data or account information for child nodes included in the second nodes are stored as values ​​for the keys of each of the second nodes.

[0050] The disk area (620) includes a multi-level index area (L0 to Lk-1). When the amount of data stored in the memory area (610) exceeds the available range of the memory, the data stored in the memory area (610) is flushed to the multi-level index area (L0 to Lk-1), and the flushed data is converted into a string table and the string table is stored. The string table may be an SSTable. The key-value of a node is stored in the string table. If the multi-level index area has k (k-level), the number of string tables in a specific index area (Li) may be a multiple of the previous index area (Li-1). The multiple may be 10 times. When the number of string tables in the first index area (L0) reaches a threshold value, the string table in the first index area (L0) is compressed and stored in the second index area (L1). The compression process is a process of merging and sorting the string tables of the first index area (L0) and the second index area (L1), dividing them into new string tables, and storing the new string tables in the second index area (L1). When the number of string tables in the second index area (L1) reaches a threshold, the string tables in the second index area (L1) are compressed and stored in the third index area (L2). This process is repeated up to the last index area (Lk-1) of the multi-layer index areas (L0 to Lk-1). Since the compression process of the multi-layer index area is composed of a memory load / storage process through sorting, it accounts for the largest overhead in the blockchain state database (600). The tri-node proof-of-work consensus algorithm of the present invention can reduce the overhead for sorting in the compression process because it makes the hash values ​​of the newly generated nodes included in the tri-node of the newly generated block by the transaction become the newly generated block number.Even if the blockchain state database (600) accelerates data storage (Write) performance through the memory area (610), data storage performance may deteriorate due to the compression process of the disk area (620). The process of reading data from the multi-layer index area (L0 to Lk-1) of the disk area (620) is a process of searching for data by searching for a key in order from the first index area (L0) to the last index area (Lk-1).

[0051] FIG. 5 is a diagram showing an example of a new trie node of a block generated by performing a proof-of-work algorithm on a blockchain state database (600) through a conventional blockchain mining system being stored, (a) of FIG. 5 is a diagram showing an example of a trie node filled with newly generated nodes of multiple blocks, (b) of FIG. 5 is a diagram showing nodes generated by performing a proof-of-work consensus algorithm through a conventional blockchain mining system being stored in a memory area (610), and (c) of FIG. 5 is a diagram showing a process of arranging nodes stored in a memory area (610) according to a data structure.

[0052] Referring to (a) to (c) of FIG. 5, the a0 block, the a1 block, and the a2 block generated by the conventional blockchain mining system through the proof-of-work consensus algorithm each include newly generated nodes (710, 720, 730). The newly generated nodes (710) of the a0 block, the newly generated nodes (720) of the a1 block, and the newly generated nodes (730) of the a2 block have random hash values. When the hash values ​​of the newly generated nodes (710, 720, 730) are stored as keys in the memory area (610), they are randomly stored by the random hash values. The newly generated nodes (710, 720, 730) stored in the memory area are converted into a string table and stored in the first index area (L0) of the disk area (620). When the first index area (L0) is full, the string tables of the newly created nodes (710, 720, 730) are compressed and distributed into multiple string tables, and the multiple string tables are stored in the second index area (L1).

[0053] FIG. 6 is a diagram showing an example of storing newly created nodes of multiple blocks generated through a tri-node proof-of-work consensus algorithm in a blockchain state database (600), (a) of FIG. 6 is a diagram showing an example of a tri-node filled with newly created nodes of multiple blocks, (b) of FIG. 6 is a diagram showing that nodes generated through a tri-node proof-of-work consensus algorithm are stored in a memory area (610), and (c) of FIG. 6 is a diagram showing a process of arranging nodes stored in a memory area (610) according to a data structure.

[0054] Referring to (a) to (c) of FIG. 6, the a0 block, the a1 block, and the a2 block generated through the tri-node proof-of-work consensus algorithm each include newly generated nodes (810, 820, 830). The hash values ​​of the newly generated nodes (810) of the a0 block, the newly generated nodes (820) of the a1 block, and the newly generated nodes (830) of the a2 block each have a prefix of the corresponding hash value that is identical to the number of each block. When the hash values ​​of the newly generated nodes (810, 820, 830) are stored as keys in the memory area (610), they are sequentially sorted and stored by hash value. For example, since the hash values ​​of the newly created nodes (810) of the a0 block have a prefix of 0x0a0, the hash values ​​of the newly created nodes (820) of the a1 block have a prefix of 0x0a1, and the hash values ​​of the newly created nodes (830) of the a2 block have a prefix of 0x0a2, they are sorted in ascending order of block creation and stored in the memory area (610). The newly created nodes (810, 820, 830) stored in the memory area are converted into a string table and stored in the first index area (L0) of the disk area (620). When the first index area (L0) is full, the string tables of the newly created nodes (810, 820, 830) are compressed and stored in the second index area (L1). Since the newly created nodes (810, 820, 830) stored in the memory area (610) are sorted by hash values, the sorting process of the compression process for storing them in the disk area can be minimized. Therefore, by simplifying the compression process, the transaction synchronization speed to the blockchain state database (600) can be improved, and the data storage and reading speed can be improved. Since the newly created nodes (810, 820, 830) are sorted by hash values, the string table of the first index area (L0) has little overlap with other string tables in range, so that false positives are unlikely to occur.A false positive means that the key is within the string table range but does not exist in that string table. Moreover, the string table ranges of other index areas (L1 to Lk-1) are mostly isolated, so false positives rarely occur.

[0055] FIG. 7 is a flowchart illustrating a method for improving performance of a blockchain state database using a state tree node according to another embodiment of the present invention, and FIGS. 8 to 11 are flowcharts illustrating detailed steps included in the steps of the method for improving performance of a blockchain state database using a state tree node. Hereinafter, a method for improving performance of a blockchain state database using a state tree node will be described with reference to FIGS. 7 to 11. Each step of the method for improving performance of a blockchain state database using a state tree node, which will be described below, can be performed by the system (100) for improving performance of a blockchain state database using a state tree node, which has been described above with reference to FIGS. 1 to 6. Therefore, the contents of the embodiments of the present invention described above with reference to FIGS. 1 to 6 can be equally applied to the embodiments described below, and any descriptions that overlap with the above descriptions will be omitted below. The steps described below do not necessarily have to be performed in order, the order of the steps can be set in various ways, and the steps can be performed almost simultaneously.

[0056] Referring to FIG. 7, a mining method for improving the performance of a blockchain state database using a state tree node is a mining method performed by node devices connected to a blockchain network, and includes a transaction acquisition step (S1100), a block generation step (S1200), and a hash value derivation and storage step (S1300).

[0057] The transaction acquisition step (S1100) is a step in which a specific node device acquires a transaction including a first block including a first trie node regarding a first block number and specific state data of a blockchain network and state change data for changing the state of a specific account.

[0058] The block generation step (S1200) is a step in which a specific node device generates a second block including a second trie node and a second block number generated based on a transaction and a first trie node.

[0059] The hash value derivation and storage step (S1300) is a step in which, if a specific node device satisfies a preset criterion that the hash value of a second node corresponding to a state path from a specific leaf node corresponding to a specific account to be changed through state change data among one or more second nodes included in a second trie node to a specific root node, the prefix of the corresponding hash value is identical to the second block number, and the second node corresponding to the state path of the transaction is stored in the blockchain state trie and the database. The hash value of the second node corresponding to the state path is derived by the specific node device generating a nonce value for the second node corresponding to the state path and based on the nonce value and the second node corresponding to the state path.

[0060] Referring to FIG. 8, the block generation step (S1200) includes a node search step (S1210), a node generation step (S1220), a sibling node search step (S1230), and a trie node generation step (S1240).

[0061] The node search step (S1210) is a step in which a specific node device searches for a first node corresponding to a state path among the first nodes included in the first trie node. The node creation step (S1220) is a step in which a specific node device creates a second node corresponding to a state path based on the first node corresponding to the state path using state change data and the state path. The sibling node search step (S1230) is a step in which a specific node device searches for a sibling node for the second node corresponding to the state path. The trie node creation step (S1240) is a step in which a specific node device creates a second trie node by associating the searched sibling node with the second node corresponding to the state path. The sibling node searched in the second trie node is a second node that does not correspond to the state path of the transaction.

[0062] Referring to FIG. 9, the node creation step (S1220) includes a leaf node creation step (S1221) and a leaf node addition step (S1222).

[0063] The leaf node creation step (S1221) is a step in which a specific node device creates account information of a leaf node corresponding to a specific account in a first node corresponding to a state path based on state change data. The leaf node addition step (S1222) is a step in which, if there is no leaf node corresponding to a specific account in the first node corresponding to the state path, a leaf node for a specific account is created along the state path based on state change data.

[0064] Referring to FIG. 10, the hash value derivation step (S1300) includes a hash value derivation step (S1310) for each node and a node information storage step (S1320).

[0065] The step of deriving a hash value for each node (S1310) is a step in which a specific node device derives a hash value for a second node corresponding to a state path and determines whether the hash value satisfies a preset criterion.

[0066] The node information storage step (S1320) is a step in which a specific node device sets a hash value that satisfies a preset standard as a key for a second node, sets path data for a child node of the second node as a value for the key if the second node is a root node or an intermediate node, and sets account information included in the second node as a value for the key if the second node is a leaf node, and stores the same in the blockchain state database.

[0067] Referring to Fig. 11, the hash value derivation step (S1310) of each node includes a hash value determination step (S1311) of a leaf node, a hash value determination step (S1312) of a first parent node, a hash value determination step (S1313) of a second parent node, and a state root hash value derivation step (S1314).

[0068] The step of determining the hash value of a leaf node (S1311) is a step in which a specific node device generates a nonce value for the first leaf node included in the second node corresponding to the state path, and determines whether the hash value of the first leaf node derived based on the nonce value and the account information of the first leaf node satisfies a preset standard.

[0069] The step of determining the hash value of the first parent node (S1312) is a step in which, if the hash value of the first leaf node satisfies a preset criterion, a specific node device generates a nonce value for the first parent node associated with the first leaf node, and determines whether the hash value of the first parent node derived based on the nonce value and the hash value of each of one or more child nodes associated with the first parent node satisfies the preset criterion.

[0070] The step of determining the hash value of the second parent node (S1313) is a step in which, if the hash value of the first parent node satisfies the preset criteria and there is a second parent node associated with the first parent node, a specific node device generates a nonce value for the second parent node, and determines whether the hash value of the second parent node derived based on the nonce value and the hash value of each of one or more child nodes associated with the second parent node satisfies the preset criteria.

[0071] The state root hash value derivation step (S1314) is a step performed when the first parent node and the second parent node are intermediate nodes included in the second node or root nodes included in the second node, and the first parent node or the second parent node is a root node included in the second node. The state root hash value derivation step (S1314) is a step of deriving a hash value for the state root included in the block header of the second block based on the hash value of the root node included in the second node, if the hash value of the root node included in the second node satisfies a preset criterion.

[0072] The method for improving the performance of a blockchain state database using a state tree node according to the embodiments of the present invention described so far can also be implemented in the form of a recording medium including computer-executable instructions, such as program modules executed by a computer. The computer-readable medium may be any available medium that can be accessed by a computer, and includes both volatile and nonvolatile media, removable and non-removable media. In addition, the computer-readable medium may include a computer storage medium. The computer storage medium includes both volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storing information, such as computer-readable instructions, data structures, program modules, or other data.

[0073] Those skilled in the art will appreciate that the present invention can be easily modified into other specific forms without changing the technical spirit or essential characteristics of the present invention based on the above description. Therefore, it should be understood that the embodiments described above are illustrative in all respects and not restrictive. The scope of the present invention is indicated by the following claims, and all changes or modifications derived from the meaning and scope of the claims and their equivalents should be interpreted as being included in the scope of the present invention. The scope of the present application is indicated by the following claims rather than the detailed description above, and all changes or modifications derived from the meaning and scope of the claims and their equivalents should be interpreted as being included in the scope of the present application.

[0074] The form for carrying out the invention is the same as the best form for carrying out the invention described above.

[0075] The present invention is a technology for generating a second block based on a first block and a new transaction, storing a second node changed in the first block in a blockchain state database when a hash value for a second node changed in the first block among one or more second nodes included in a second trie node of the second block satisfies a preset criterion such that the prefix of the hash value is identical to the block number of the second block, and thus has industrial applicability because it can be used in the blockchain industry.

[0076] [Explanation of symbols]

[0077] 100: A blockchain state database performance improvement system using state trie nodes.

[0078] 110: Communication Module 120: Database

[0079] 130: Processor 140: Memory

[0080] 200: Client's node device 300: Mining node device

[0081] 400: Block 1

[0082] 500: Block 2

[0083] 600: Blockchain State Database

[0084] 610: Memory area 620: Disk area

Claims

1. A mining method performed by node devices connected to a blockchain network, a) A step in which a specific node device obtains a first block including a first trie node regarding a first block number and specific state data of the blockchain network and a transaction including state change data for changing the state of a specific account; b) a step in which the specific node device generates a second block including a second trie node and a second block number generated based on the transaction and the first trie node; and c) A method for improving the performance of a blockchain state database using a state trie node, comprising the step of storing the second node corresponding to the state path in a blockchain state trie and a database, if the specific node device satisfies a preset criterion that the hash value of the second node corresponding to the state path, which is a path from a specific leaf node corresponding to the specific account to a specific root node among one or more second nodes included in the second trie node, has the prefix of the hash value identical to the second block number.

2. In paragraph 1, A method for improving the performance of a blockchain state database using a state trie node, wherein the hash value is derived by the specific node device generating a nonce value for the second node corresponding to the state path and based on the nonce value and the second node corresponding to the state path.

3. In paragraph 2, The first node included in the first block and the second node included in the second block include at least one of a root node, an intermediate node, and a leaf node, The root node is associated with the intermediate node as a child node, or with the leaf node as a child node, The above intermediate node is associated with another intermediate node as a child node, or is associated with the above leaf node as a child node, The root node and the intermediate node include path data for child nodes, a nonce field into which the nonce value is input, and a hash value, The above leaf node includes account information including account, address, balance and number of transactions, a nonce field where the nonce value is entered and a hash value, The hash value of the intermediate node is calculated based on the hash value of each of one or more child nodes associated with the path data of the intermediate node and the nonce value entered in the nonce field of the intermediate node. The hash value of the root node is calculated based on the hash value of each of one or more child nodes associated with the path data of the root node and the nonce value entered in the nonce field of the root node, and The hash value of the above leaf node is calculated based on the account information and the nonce value entered in the nonce field of the above leaf node, and The above status change data includes the address and number of transactions of the specific account. A mining method for improving blockchain state database performance using state trie nodes.

4. In paragraph 3, b-1) A step of the specific node device searching for a first node corresponding to the state path among the first nodes included in the first trie node; b-2) A step in which the specific node device generates the second node corresponding to the state path based on the first node corresponding to the state path using the state change data and the state path; b-3) a step of searching for a sibling node for the second node corresponding to the state path by the specific node device; and b-4) A method for improving the performance of a blockchain state database using a state trie node, comprising a step of generating the second trie node by associating the searched sibling node with the second node corresponding to the state path, by the specific node device.

5. In paragraph 4, Step b-2) above, A method for improving performance of a blockchain state database using a state tree node, comprising: generating, by the specific node device, account information of a leaf node corresponding to the specific account in the first node corresponding to the state path based on the state change data; or, if there is no leaf node corresponding to the specific account in the first node corresponding to the state path, generating a leaf node for the specific account according to the state path based on the state change data.

6. In paragraph 3, Step c) above, c-1) A step in which the specific node device derives the hash value and determines whether the hash value satisfies a preset standard; c-2) A method for improving performance of a blockchain state database using a state tree node, comprising the step of: setting the hash value satisfying the preset criteria as a key for the second node, setting path data for a child node of the second node as a value for the key when the second node is a root node or an intermediate node, and setting account information included in the second node as a value for the key when the second node is a leaf node, and storing the same in the blockchain state database.

7. In paragraph 6, Step c-1) above, A step of generating a nonce value for a first leaf node included in a second node corresponding to the state path, and determining whether a hash value of the first leaf node derived based on the nonce value and the account information of the first leaf node satisfies the preset criterion; A step of generating a nonce value for a first parent node associated with the first leaf node when the hash value of the first leaf node satisfies the preset criterion, and determining whether the hash value of the first parent node derived based on the nonce value and the hash value of each of one or more child nodes associated with the first parent node satisfies the preset criterion; and A method for improving performance of a blockchain state database using a state tree node, comprising the step of generating a nonce value for a second parent node when the hash value of the first parent node satisfies the preset criterion and a second parent node associated with the first parent node exists, and determining whether a hash value of the second parent node derived based on the nonce value and the hash value of each of one or more child nodes associated with the second parent node satisfies the preset criterion.

8. In paragraph 7, The first parent node and the second parent node are intermediate nodes included in the second node or root nodes included in the second node, A method for improving the performance of a blockchain state database using a state trie node, further comprising a step of deriving a hash value for a state root included in a block header of the second block based on the hash value of the root node included in the second node, if the first parent node or the second parent node is a root node included in the second node and the hash value of the root node included in the second node satisfies the preset criterion.

9. In paragraph 1, A method for improving the performance of a blockchain state database using a state trie node, wherein the second block number has a value greater than the first block number.

10. In paragraph 1, The above-mentioned criteria are: A method for improving the performance of a blockchain state database using a state trie node, further comprising a criterion for ensuring that the above hash value has a smaller hash value than a hash value satisfying a preset difficulty level.

11. At least one processor; and A memory electrically connected to the processor and storing at least one code to be executed by the processor, The above memory, when executed through the processor, causes the processor to: Obtain a first block including a first trie node regarding a first block number and specific state data of the blockchain network and a transaction including state change data for changing the state of a specific account; Generating a second block including a second trie node and a second block number generated based on the above transaction and the first trie node, and, A system for improving the performance of a blockchain state database using a state trie, wherein a code is stored that causes the second node corresponding to the state path to be stored in a blockchain state trie and a database, when a hash value of a second node corresponding to a state path, which is a path from a specific leaf node corresponding to the specific account to a specific root node among one or more second nodes included in the second trie node, satisfies a preset criterion that the prefix of the hash value is identical to the second block number.

12. In paragraph 11, A system for improving the performance of a blockchain state database using a state trie node, wherein the above hash value is derived by generating a nonce value for a second node corresponding to the state path and based on the nonce value and the second node corresponding to the state path.

13. In paragraph 12, The first node included in the first block and the second node included in the second block include at least one of a root node, an intermediate node, and a leaf node, The root node is associated with the intermediate node as a child node, or with the leaf node as a child node, The above intermediate node is associated with another intermediate node as a child node, or is associated with the above leaf node as a child node, The root node and the intermediate node include path data for child nodes, a nonce field into which the nonce value is input, and a hash value, The above leaf node includes account information including account, address, balance and number of transactions, a nonce field where the nonce value is entered and a hash value, The hash value of the intermediate node is calculated based on the hash value of each of one or more child nodes associated with the path data of the intermediate node and the nonce value entered in the nonce field of the intermediate node. The hash value of the root node is calculated based on the hash value of each of one or more child nodes associated with the path data of the root node and the nonce value entered in the nonce field of the root node, and The hash value of the above leaf node is calculated based on the account information and the nonce value entered in the nonce field of the above leaf node, and A system for improving the performance of a blockchain state database using a state tree, wherein the above state change data includes the address and number of transactions of a specific account.

14. In paragraph 13, The above memory causes the processor to: Search for a first node corresponding to the state path among the first nodes included in the first trie node, Using the above state change data and the above state path, the second node corresponding to the state path is generated based on the first node corresponding to the state path, Search for a sibling node for the second node corresponding to the above state path, and A system for improving the performance of a blockchain state database using a state trie, storing code that causes the second trie node to be created by associating the searched sibling node with the second node corresponding to the state path.

15. In paragraph 13, The above memory causes the processor to: Derive the above hash value, determine whether the above hash value satisfies a preset standard, and A system for improving the performance of a blockchain state database using a state tree, which stores code that causes the hash value satisfying the above-described preset criteria to be set as a key for the second node, and, if the second node is a root node or an intermediate node, to set path data for a child node of the second node as a value for the key, and, if the second node is a leaf node, to set account information included in the second node as a value for the key, and to store the code in the blockchain state database.

16. In paragraph 15, The above memory causes the processor to: Generate a nonce value for the first leaf node included in the second node corresponding to the above state path, and determine whether the hash value of the first leaf node derived based on the nonce value and the account information of the first leaf node satisfies the above preset criterion, If the hash value of the first leaf node satisfies the preset criterion, a nonce value for the first parent node associated with the first leaf node is generated, and a hash value of the first parent node derived based on the nonce value and the hash value of each of one or more child nodes associated with the first parent node is determined to satisfy the preset criterion, and A system for improving the performance of a blockchain state database using a state tree, wherein a code is stored that causes a hash value of the second parent node to be generated when the hash value of the first parent node satisfies the preset criterion and a second parent node associated with the first parent node exists, and determines whether the hash value of the second parent node derived based on the nonce value and the hash value of each of one or more child nodes associated with the second parent node satisfies the preset criterion.

17. In paragraph 16, The first parent node and the second parent node are intermediate nodes included in the second node or root nodes included in the second node, A system for improving the performance of a blockchain state database using a state tree, storing a code that causes a hash value for a state root included in a block header of the second block to be derived based on the hash value of the root node included in the second node when the first parent node or the second parent node is a root node included in the second node and the hash value of the root node included in the second node satisfies the preset criterion.

18. In paragraph 11, A system for improving the performance of a blockchain state database using a state tree, wherein the second block number has a value greater than the first block number.

19. In paragraph 11, The above-mentioned criteria are: A system for improving the performance of a blockchain state database using a state try, further comprising a criterion for ensuring that the above hash value has a smaller hash value than a hash value that satisfies a preset difficulty level.

Citation Information

Patent Citations

  • METHOD AND SYSTEM FOR MINING BLOCKCHAIN ​​TRANSACTIONS PROVIDED BY VALIDATOR NODES

    JP2020523677A

  • Method and Apparatus for Secure Symbiosis Mining

    JP2022551874A

  • Block mining methods and apparatus

    KR1020160106570A

  • System scaffold

    KR102276051B1