CN114564539B - Dynamic building method and system of block chain world state for account liveness perception - Google Patents

Dynamic building method and system of block chain world state for account liveness perception Download PDF

Info

Publication number
CN114564539B
CN114564539B CN202210197505.6A CN202210197505A CN114564539B CN 114564539 B CN114564539 B CN 114564539B CN 202210197505 A CN202210197505 A CN 202210197505A CN 114564539 B CN114564539 B CN 114564539B
Authority
CN
China
Prior art keywords
account
state
active
branch
world
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210197505.6A
Other languages
Chinese (zh)
Other versions
CN114564539A (en
Inventor
赵永光
窦雅明
郑永清
孔兰菊
郭伟
崔立真
李庆忠
钱进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shandong University
Original Assignee
Shandong University
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shandong University filed Critical Shandong University
Priority to CN202210197505.6A priority Critical patent/CN114564539B/en
Publication of CN114564539A publication Critical patent/CN114564539A/en
Application granted granted Critical
Publication of CN114564539B publication Critical patent/CN114564539B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The invention discloses a dynamic building method and a dynamic building system of a block chain world state sensed by account activity, wherein the dynamic building method comprises the following steps: calculating the activity of the accounts with changed states in the block, dividing the active accounts and the inactive accounts, and constructing an active account table; an active account state table is established according to the account with the changed state and the state of the account; receiving the transaction executed in the current block, and dividing the account number property of the account with the changed state in the transaction according to the active account table so as to construct a world state tree; updating the active account state table according to the account with the changed state in the transaction and the latest state of the account, judging whether the account properties of the target account in the current block and the previous block are converted, adopting a corresponding branch conversion strategy according to the conversion of the account properties, and updating the world state tree according to the branch conversion strategy. The problems of storage space increase and query and update efficiency reduction caused by exponential growth of the state data of the ether workshop are solved.

Description

Dynamic building method and system of block chain world state of account liveness perception
Technical Field
The invention relates to the technical field of block chain state organization, in particular to a dynamic block chain world state construction method and system based on account activity perception.
Background
The statements in this section merely provide background information related to the present disclosure and may not necessarily constitute prior art.
Blockchains are a distributed, decentralized computing and storage architecture. In the Ethernet workshop, the transaction is the information data unit based on the Ethernet workshop, and the essence of the system operation is to process the transaction and update the whole network state. The full etherhouse state refers to the current state of all accounts, e.g., balances, and all smart contracts deployed and run in the etherhouse virtual machine. In the ether workshop, all nodes have an account-based indexed data structure MPT. The MPT treats accounts as leaf nodes and generates parent nodes with common prefixes. The intermediate node consists of an expansion node and a branch node, and is stored in a levelDB database through a hash mark of a node value.
As transactions increase, the state data accumulation of the blockchain grows exponentially, and the world state tree that needs to be maintained becomes larger and larger. In a real ether house, different accounts have different performances in activity level, and they conform to Zipfian distribution. The state of a large number of accounts with low holding rate and few issued transactions is also maintained in the world state tree, and each time the state of an account changes, the hash value of the changed branch needs to be calculated again, and in the worst case, the hash operation needs to be carried out 40 times when the state of one account is modified. The number of accounts with low activity degree in the world state tree is increased along with the accumulation of time, the state of the active accounts is updated in the state tree, meanwhile, the state of the inactive accounts is maintained for a long time, the number of intermediate nodes required to be maintained is increased, the required storage space is increased continuously, and the efficiency of searching the world state is low. Meanwhile, the overlarge storage requirement and retrieval overhead bring difficult challenges to the nodes with insufficient resources, and the possibility that the nodes participate in consensus and actively correspond to the requirements of other nodes is reduced.
In order to solve the problems caused by the accumulation of state data, a part of solutions are based on the reduction of uplink data, and a lightning network only uplink the final state of each account by transferring a plurality of transactions among several accounts offline, so that the plurality of transfer transactions are combined into one transaction, the data needing to be uplink is reduced, and the purpose of relieving the storage pressure is achieved; there are also researchers proposing a status rent to reduce the status of the uplink, which means that the user's rent is proportional to the size and time of the data stored in the block chain. However, this solution can only achieve the problem of suppressing the state capacity expansion, and does not improve the performance.
Another partial solution combines MPT trees with other index structures, starting from the improvement of lookup efficiency. The HyperLEdger adopts a Bucket tree structure fusing a Merkle tree and a Hash barrel, but the HyperLEdger is physically realized by a K-V database, and the data has the privacy security problem. The FISCO BCOS divides the world state into an account state MPTState which is consistent with the Ether house and stored by using an MPT tree; and an account state storegetstate stored using a distributed table structure, which does not store history information, is a method of improving query efficiency at the expense of trace-back efficiency.
The scheme solves the problems caused by the accumulation of the world states from the aspects of reducing the storage amount and improving the query efficiency, and does not make breakthrough from the aspect of the activity degree of the account. The influence of accounts with different activity degrees on an Ethernet workshop network in the prior Ethernet workshop is different, the state of the active account is frequently changed, the account with lower activity is rarely changed, if the organization mode of MPT is continuously used, not only a plurality of intermediate nodes are required to be stored, but also additional expense is caused during retrieval.
Disclosure of Invention
In order to solve the problems, the invention provides a method and a system for dynamically constructing a block chain world state with account liveness perception, which are used for solving the problems of storage space increase and query and update efficiency reduction caused by exponential growth of state data of an ether house by considering the influence of different activity degrees of accounts aiming at the problem of exponential growth of world state accumulation.
In order to achieve the purpose, the invention adopts the following technical scheme:
in a first aspect, the present invention provides a dynamic building method of a blockchain world state of account liveness awareness, including:
calculating the activity of the accounts with changed states in the block, dividing the active accounts and the inactive accounts according to an activity threshold value, and constructing an active account table by the active accounts; an active account state table is established according to the account with the changed state and the state of the account;
receiving a transaction executed in a current block, dividing an account number property of an account with changed state in the transaction according to an active account table, and respectively constructing an MPT branch and an active branch according to the account number property so as to construct a world state tree;
updating an active account state table according to the account with the changed state in the transaction and the latest state of the account, judging whether the account properties of the target account in the current block and the previous block are converted according to the updated active account state table, and when the conversion occurs, adopting a corresponding branch conversion strategy according to the conversion of the account properties, and updating the world state tree according to the branch conversion strategy.
As an alternative embodiment, the process of building the world state tree includes: according to the account number property, performing insertion operation on the active account, constructing a state root of the active account in the active branch, performing insertion operation on the inactive account in an MPT mode, constructing a state root of the inactive account in the MPT branch, and performing hash operation on the state root of the active account and the state root of the inactive account to obtain a world state root so as to construct a world state tree.
As an alternative embodiment, the process of updating the world state tree includes: when the account property is converted, judging whether the account property is converted into an active account or not; if so, updating the state of the target account in the active branch, not modifying the MPT branch, and storing the current latest state of the target account in an active account state table; if not, updating the state of the target account in the MPT branch.
As an alternative embodiment, the process of determining whether the account property translates to an active account includes: if the account's state in the previous block is not stored in the active account state table and is stored in the active account table, then the account property is converted from an inactive account to an active account.
As an alternative embodiment, the process of updating the world state tree further comprises: at the end of each epoch, the state of all accounts is changed in the MPT branch.
As an alternative embodiment, the dynamic building method of the block chain world state further includes verifying the authenticity of the world state tree, and specifically includes: judging whether the account to be verified is an active account in the target block or not; if yes, in the active account branch, merging the account to be verified with the hash values of the adjacent brother nodes in sequence to reconstruct the state root of the MPT branch and the state root of the active account branch respectively; if not, in the MPT branch, sequentially combining the account to be verified with the hash values of the adjacent brother nodes to reconstruct the state root of the MPT branch;
reconstructing a world state root according to different account properties, comparing the world state root with the world state root of a world state tree, if the world state root is consistent with the world state root of the world state tree, successfully verifying the consistency, and otherwise, failing to verify the consistency;
if the number of consistent world state roots exceeds a threshold, the authenticity verification is successful, otherwise the authenticity verification fails.
As an alternative embodiment, the process of calculating liveness for accounts with changed status within a block includes:
Figure GDA0003873540200000051
wherein, the nonce blocki The nonce value for the account in the current block, nonce block i-1 Num is the total number of accounts whose status has changed in the block for the nonce value of the account in the previous block.
In a second aspect, the present invention provides a system for dynamically building a blockchain world state based on account liveness awareness, including:
the activity degree calculation module is configured to calculate activity degrees of accounts with changed states in the blocks, divide the active accounts and the inactive accounts according to an activity degree threshold value, and establish an active account table through the active accounts; an active account state table is established according to the account with the changed state and the state of the account;
the state tree building module is configured to receive the transaction executed in the current block, divide the account number property of the account with changed state in the transaction according to the active account number table, and respectively build MPT branches and active branches according to the account number property so as to build a world state tree;
and the state tree updating module is configured to update the active account state table according to the account with the changed state in the transaction and the latest state of the account, judge whether the account properties of the target account in the current block and the previous block are converted according to the updated active account state table, adopt a corresponding branch conversion strategy according to the conversion of the account properties when the conversion is carried out, and update the world state tree according to the branch conversion strategy.
In a third aspect, the present invention provides an electronic device comprising a memory and a processor, and computer instructions stored on the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method of the first aspect is performed.
In a fourth aspect, the present invention provides a computer readable storage medium for storing computer instructions which, when executed by a processor, perform the method of the first aspect.
Compared with the prior art, the invention has the following beneficial effects:
according to the dynamic building method and system for the block chain world state of account activity perception, provided by the invention, through analyzing different activity degrees of the ether house accounts, the problems that the world state data accumulation is exponentially increased along with the increase of transactions, so that the repeated access of a large number of paths, the storage cost and the time cost are large, the storage space is increased, and the query and update efficiency is reduced are solved.
The dynamic block chain world state construction method and system for account activity perception provided by the invention adopt a branch conversion strategy, and can ensure that corresponding accounts are in branches of different world state trees due to corresponding changes of an active account table caused by the fact that the activity of the accounts is in a dynamic change process.
According to the dynamic block chain world state construction method and system based on account activity perception, provided by the invention, the verification problems of authenticity and consistency of world states under different scenes are comprehensively considered, different verification schemes are provided for different scenes, and the state verification requirements of a block chain are fully met.
Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification, illustrate exemplary embodiments of the invention and together with the description serve to explain the invention and not to limit the invention.
Fig. 1 is a schematic view of dynamic construction of a blockchain world state based on account liveness awareness according to embodiment 1 of the present invention;
fig. 2 is a flowchart of a method for determining an active account according to embodiment 1 of the present invention;
fig. 3 is a flowchart of a method for constructing a world state tree according to embodiment 1 of the present invention;
FIG. 4 is a flowchart of a method for branch transformation of a world state tree according to embodiment 1 of the present invention;
fig. 5 is a flowchart of a method for world state authenticity verification provided in embodiment 1 of the present invention;
fig. 6 is a flowchart of a method for verifying consistency of world states according to embodiment 1 of the present invention.
Detailed Description
The invention is further explained by the following embodiments in conjunction with the drawings.
It is to be understood that the following detailed description is exemplary and is intended to provide further explanation of the invention as claimed. Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs.
It is noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of exemplary embodiments according to the invention. As used herein, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise, and it should be understood that the terms "comprises" and "comprising", and any variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The embodiments and features of the embodiments of the present invention may be combined with each other without conflict.
Example 1
As shown in fig. 1, the present embodiment provides a method for dynamically constructing a blockchain world state based on account liveness awareness, including:
calculating the activity of the accounts with changed states in the block, dividing the active accounts and the inactive accounts according to an activity threshold value, and constructing an active account table by the active accounts; an active account state table is established according to the account with the changed state and the state of the account;
receiving a transaction executed in a current block, dividing an account number property of an account with changed state in the transaction according to an active account table, and respectively constructing an MPT branch and an active branch according to the account number property so as to construct a world state tree;
updating an active account state table according to the account with the changed state in the transaction and the latest state of the account, judging whether the account properties of the target account in the current block and the previous block are converted according to the updated active account state table, and when the conversion occurs, adopting a corresponding branch conversion strategy according to the conversion of the account properties, and updating the world state tree according to the branch conversion strategy.
Specifically, as shown in fig. 2, the process of calculating liveness for accounts with changed status in the block includes:
s11: calculating the activity of the account with the changed state in each block according to the following formula:
Figure GDA0003873540200000081
wherein, the nonce blocki The nonce value for the account in the current block, nonce block i-1 The nonce value of the account in the previous block, num is the total number of accounts whose status has changed in the block;
s12: dividing an active account and an inactive account according to an activity threshold value, and constructing an active account table by the active account; in the embodiment, an account with the activity degree accounting for 10% of the total number of the accounts is selected as an active account, so that an active account table is constructed;
s13: judging whether the current epoch ending time is the current epoch ending time; if yes, executing step S14, otherwise executing step S15;
s14: the activity of all accounts needs to be attenuated;
s15: the liveness of all accounts remains unchanged.
As shown in fig. 3, the process of building the world state tree includes:
s21: in the state conversion process, acquiring the transaction executed in the current block of the block chain, and dividing the account with changed state in the transaction according to the current active account table;
s22: updating the account with changed state in the transaction to the latest state according to the final state after the transaction in the current block is executed, wherein the account includes the contents of nonce, balance, activity and the like; updating an active account state table according to the account with the changed state in the transaction and the latest state of the account; storing the latest state of the active account in the current block in an active account state table by taking the account coding address and the block ID as keys and the latest state as value, and simultaneously maintaining the historical state of the active account;
s23: after the accounts with changed states in the blocks are grouped according to the properties of the account numbers, serialization is respectively carried out, insertion operation is carried out on the active accounts related to the blocks, the state root Activity _ root of the active accounts of the current blocks is generated, the inactive accounts are inserted in an MPT mode, the state root MPT _ root of the inactive accounts is generated, and MPT branches and active branches are respectively constructed;
s24: performing hash operation on the State root of the active account and the State root of the inactive account to obtain a world State root _ root; thereby constructing a world state tree.
As shown in fig. 4, the process of updating the world state tree includes:
s31: comparing the active account state table, judging whether the account properties of the target account in the current block and the previous block are converted, if so, executing a step S32, otherwise, executing a step S33;
s32: judging whether the account property is converted into an active account, if so, executing a step S34, otherwise, executing a step S35;
further, if the status of the account in the previous block is not stored in the active account status table and is stored in the active account table, the account property is converted from the inactive account to the active account;
s33: the flow is finished, and no branch conversion occurs;
s34: updating the state of the account in an active branch of a world state tree, not modifying the MPT branch, and storing the current latest state of the account in an active account state table by taking an account coding address and a block ID as keys and the latest state as value;
s35: updating the state of the account in the MPT branch of the world state tree;
s36: judging whether the current epoch end time is present, if so, executing a step S47, otherwise, executing a step S48;
s37: the state of all accounts is changed in the MPT branch of the world state tree;
s38: the world state tree remains unchanged.
In this embodiment, the world state root is stored in the block header, and at the end of each epoch the liveness of all accounts will decay, so there are only MPT branches in this block.
In this embodiment, the method further includes verifying the authenticity of the world state tree, as shown in fig. 5, specifically including:
s41: the full node judges whether the account to be verified is an active account in the target block, if so, step S42 is executed, otherwise, step S43 is executed;
s42: in the active account branch, the account to be verified is combined with the hash values of the adjacent sibling nodes in sequence to reconstruct the state root Activity _ root of the active branch of the target block h And the State root of the MPT Branch MPT _ root h
S43: in the MPT branch, the account to be verified is combined with the adjacent brother node hash values in sequence to reconstruct the state root MPT _ root of the MPT branch of the target block h
S44: returning the reconstructed state root and the state of the account to be verified to the light node;
s45: the light node calculates the received state roots from the same whole node to reconstruct the world state heel, and judges whether the number of the consistent world state roots exceeds a threshold value, the embodiment is set to be 2/3, if yes, step S46 is executed, otherwise, step S47 is executed;
s46: the verification is successful, the content of the target block is proved to be not tampered, and the authenticity of the state of the account to be verified can be ensured;
s47: and if the verification fails, the data is considered to be attacked, and the data is discarded.
In this embodiment, the method further includes verifying consistency of the world state tree, as shown in fig. 6, specifically including:
s51: the node respectively regenerates the account with the changed account state into the state root MPT _ root of the MPT branch h And the active account branch's state root Activity _ root h
S52: reconstructing a world State _ root of a current block h
S53: judging whether the requirement of the consensus algorithm is met, namely the reconstructed world state root is consistent with the state root of the node to be verified, if so, executing a step S54, otherwise, executing a step S55;
s54: the world state is successfully verified, and the data is submitted to a persistent database;
s55: and the world state check fails and consensus is repeated.
Example 2
The embodiment provides a system for dynamically constructing a blockchain world state based on account liveness perception, which comprises:
the activity degree calculation module is configured to calculate activity degrees of accounts with changed states in the blocks, divide the active accounts and the inactive accounts according to an activity degree threshold value, and establish an active account table by the active accounts; an active account state table is established according to the account with the changed state and the state of the account;
the state tree building module is configured to receive the transaction executed in the current block, divide the account number property of the account with changed state in the transaction according to the active account number table, and respectively build MPT branches and active branches according to the account number property so as to build a world state tree;
and the state tree updating module is configured to update the active account state table according to the account with the changed state in the transaction and the latest state of the account, judge whether the account properties of the target account in the current block and the previous block are converted according to the updated active account state table, adopt a corresponding branch conversion strategy according to the conversion of the account properties when the conversion is carried out, and update the world state tree according to the branch conversion strategy.
It should be noted that the modules correspond to the steps described in embodiment 1, and the modules are the same as the corresponding steps in the implementation examples and application scenarios, but are not limited to the disclosure in embodiment 1. It should be noted that the modules described above as part of a system may be implemented in a computer system such as a set of computer-executable instructions.
In this embodiment, the system further includes a communication module, configured to perform interactive communication with other nodes in the ethernet workshop network, and support the whole node to receive all data of the block from the ethernet workshop network and load the data into the local memory, so as to perform preprocessing on the data in the block.
In this embodiment, the system further includes a state verification module configured to verify authenticity and consistency of the world state tree, and the specific verification method adopts the method described in embodiment 1, which is not described herein again.
In further embodiments, there is also provided:
an electronic device comprising a memory and a processor and computer instructions stored on the memory and executed on the processor, the computer instructions when executed by the processor performing the method of embodiment 1. For brevity, no further description is provided herein.
It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general purpose processors, digital signal processors DSP, application specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and so on. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory may include both read-only memory and random access memory, and may provide instructions and data to the processor, and a portion of the memory may also include non-volatile random access memory. For example, the memory may also store device type information.
A computer readable storage medium storing computer instructions which, when executed by a processor, perform the method of embodiment 1.
The method in embodiment 1 may be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules in the processor. The software modules may be located in ram, flash, rom, prom, or eprom, registers, among other storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor. To avoid repetition, it is not described in detail here.
Those of ordinary skill in the art will appreciate that the various illustrative elements, i.e., algorithm steps, described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
Although the embodiments of the present invention have been described with reference to the accompanying drawings, it is not intended to limit the scope of the present invention, and it should be understood by those skilled in the art that various modifications and variations can be made without inventive efforts by those skilled in the art based on the technical solution of the present invention.

Claims (8)

1. The dynamic building method of the block chain world state perceived by account activity is characterized by comprising the following steps:
calculating the activity of the accounts with changed states in the blocks, dividing active accounts and inactive accounts according to an activity threshold value, and constructing an active account table by the active accounts; an active account state table is established according to the account with the changed state and the state of the account;
receiving a transaction executed in a current block, dividing an account number property of an account with changed state in the transaction according to an active account table, and respectively constructing an MPT branch and an active branch according to the account number property so as to construct a world state tree;
the process of constructing the world state tree comprises the following steps: according to the account number property, performing insertion operation on an active account, constructing a state root of the active account in an active branch, performing insertion operation on an inactive account in an MPT mode, constructing a state root of the inactive account in the MPT branch, performing hash operation on the state root of the active account and the state root of the inactive account to obtain a world state root, and constructing a world state tree;
updating an active account state table according to the account with the changed state in the transaction and the latest state of the account, judging whether the account properties of the target account in the current block and the previous block are converted according to the updated active account state table, and when the conversion occurs, adopting a corresponding branch conversion strategy according to the conversion of the account properties, and updating the world state tree according to the branch conversion strategy;
the process of updating the world state tree comprises the following steps: when the account property is converted, judging whether the account property is converted into an active account; if yes, updating the state of the target account in the active branch, not modifying the MPT branch, and storing the current latest state of the target account in an active account state table; if not, updating the state of the target account in the MPT branch.
2. The method of claim 1, wherein determining whether the account property is converted to an active account comprises: if the account status of the previous block is not stored in the active account status table and is stored in the active account table, the account property is converted from an inactive account to an active account.
3. The account liveness-aware blockchain world state dynamic construction method of claim 1, wherein the process of updating the world state tree further comprises: at the end of each epoch, the state of all accounts is changed in the MPT branch.
4. The method for dynamically building a blockchain world state based on account liveness awareness according to claim 1, wherein the method for dynamically building a blockchain world state further comprises verifying the authenticity of the world state tree, and specifically comprises: judging whether the account to be verified is an active account in the target block or not; if yes, in the active account branch, merging the account to be verified with the hash values of the adjacent brother nodes in sequence to reconstruct the state root of the MPT branch and the state root of the active account branch respectively; if not, in the MPT branch, combining the account to be verified with the hash values of the adjacent brother nodes in sequence to reconstruct the state root of the MPT branch;
reconstructing a world state root according to different account properties, comparing the world state root with the world state root of a world state tree, if the world state root is consistent with the world state root of the world state tree, successfully verifying the consistency, and otherwise, failing to verify the consistency;
if the number of consistent world state roots exceeds a threshold, the authenticity verification is successful, otherwise the authenticity verification fails.
5. The method for dynamically building account liveness-aware blockchain world state according to claim 1, wherein the process of calculating liveness for accounts with changed state within a block includes:
Figure FDA0003873540190000021
wherein, the nonce blocki The nonce value for the account in the current block, nonce blocki-1 Num is the total number of accounts whose status has changed in the previous block, which is the nonce value of the account in the previous block.
6. The system for dynamically constructing the block chain world state by sensing the account activity is characterized by comprising the following steps:
the activity degree calculation module is configured to calculate activity degrees of accounts with changed states in the blocks, divide the active accounts and the inactive accounts according to an activity degree threshold value, and establish an active account table through the active accounts; an active account state table is established according to the account with the changed state and the state of the account;
the state tree building module is configured to receive the transaction executed in the current block, divide the account number property of the account with changed state in the transaction according to the active account number table, and respectively build MPT branches and active branches according to the account number property so as to build a world state tree;
the process of constructing the world state tree comprises the following steps: according to the account number property, performing insertion operation on an active account, constructing a state root of the active account in an active branch, performing insertion operation on an inactive account in an MPT mode, constructing a state root of the inactive account in the MPT branch, performing hash operation on the state root of the active account and the state root of the inactive account to obtain a world state root, and constructing a world state tree;
the state tree updating module is configured to update an active account state table according to the account with the changed state in the transaction and the latest state of the account, judge whether the account properties of the target account in the current block and the previous block are converted according to the updated active account state table, adopt a corresponding branch conversion strategy according to the conversion of the account properties when the conversion is carried out, and update the world state tree according to the branch conversion strategy;
the process of updating the world state tree comprises the following steps: when the account property is converted, judging whether the account property is converted into an active account; if so, updating the state of the target account in the active branch, not modifying the MPT branch, and storing the current latest state of the target account in an active account state table; if not, updating the state of the target account in the MPT branch.
7. An electronic device comprising a memory and a processor and computer instructions stored on the memory and executed on the processor, the computer instructions when executed by the processor performing the method of any of claims 1-5.
8. A computer-readable storage medium storing computer instructions which, when executed by a processor, perform the method of any one of claims 1 to 5.
CN202210197505.6A 2022-03-01 2022-03-01 Dynamic building method and system of block chain world state for account liveness perception Active CN114564539B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210197505.6A CN114564539B (en) 2022-03-01 2022-03-01 Dynamic building method and system of block chain world state for account liveness perception

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210197505.6A CN114564539B (en) 2022-03-01 2022-03-01 Dynamic building method and system of block chain world state for account liveness perception

Publications (2)

Publication Number Publication Date
CN114564539A CN114564539A (en) 2022-05-31
CN114564539B true CN114564539B (en) 2022-11-25

Family

ID=81716709

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210197505.6A Active CN114564539B (en) 2022-03-01 2022-03-01 Dynamic building method and system of block chain world state for account liveness perception

Country Status (1)

Country Link
CN (1) CN114564539B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282474A (en) * 2018-01-18 2018-07-13 山东大学 The maintaining method of digital asset trade identity based on block chain
US10761948B1 (en) * 2019-07-13 2020-09-01 Alibaba Group Holding Limited Method, apparatus, and electronic device for restoring state data of blockchain
CN113254450A (en) * 2021-05-28 2021-08-13 山大地纬软件股份有限公司 Method and system for storing account state of incremental MPT (message passing through) tree based on block chain
CN113329031A (en) * 2019-10-10 2021-08-31 深圳前海微众银行股份有限公司 Method and device for generating state tree of block
CN113362062A (en) * 2021-05-21 2021-09-07 山东大学 Block chain transaction sorting method, storage medium and equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110471795B (en) * 2019-07-31 2020-10-02 阿里巴巴集团控股有限公司 Block chain state data recovery method and device and electronic equipment
WO2020143852A2 (en) * 2020-04-15 2020-07-16 Alipay (Hangzhou) Information Technology Co., Ltd. Distributed blockchain data storage under account model

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108282474A (en) * 2018-01-18 2018-07-13 山东大学 The maintaining method of digital asset trade identity based on block chain
US10761948B1 (en) * 2019-07-13 2020-09-01 Alibaba Group Holding Limited Method, apparatus, and electronic device for restoring state data of blockchain
CN113329031A (en) * 2019-10-10 2021-08-31 深圳前海微众银行股份有限公司 Method and device for generating state tree of block
CN113362062A (en) * 2021-05-21 2021-09-07 山东大学 Block chain transaction sorting method, storage medium and equipment
CN113254450A (en) * 2021-05-28 2021-08-13 山大地纬软件股份有限公司 Method and system for storing account state of incremental MPT (message passing through) tree based on block chain

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
A Blockchain-Based Authentication and Service Provision Scheme for Intemet of Things;Meijuan Chen;《 2020 IEEE Globecom Workshops (GC Wkshps》;20210305;全文 *
一种支持区块链交易溯源的混合索引机制;尤瑶;《计算机集成制造系统》;20190430;第25卷(第4期);全文 *
面向时空数据的区块链研究综述;傅易文晋;《计算机工程》;20200331;第46卷(第3期);全文 *

Also Published As

Publication number Publication date
CN114564539A (en) 2022-05-31

Similar Documents

Publication Publication Date Title
CN110602148B (en) Method and device for generating state tree of block and verifying data on chain
CN110688377B (en) Method and device for updating state Merck tree
WO2021032138A1 (en) Consensus method and device based on blockchain system, and system
CN111008201B (en) Method and apparatus for parallel modification and reading of state trees
CN109410043B (en) Block chain information efficient storage method and device based on hierarchical tree structure
CN110473030B (en) Block chain-based electronic bill number claiming method and device and electronic equipment
CN103810244A (en) Distributed data storage system expansion method based on data distribution
WO2020015668A1 (en) Block chain storage method and node of block chain
CN106095589A (en) Partition allocation method, device and system
CN113259478B (en) Method and device for executing transaction in blockchain system and blockchain system
CN110008206A (en) A kind of data processing method and device based on block catenary system
CN110599166A (en) Method and device for acquiring transaction dependency relationship in block chain
CN114564539B (en) Dynamic building method and system of block chain world state for account liveness perception
CN114117489A (en) Block chain state data processing method
CN113157450A (en) Method and apparatus for performing blocks in a blockchain system
CN111177262A (en) Block chain consensus method, related device and system
CN110692078B (en) Transaction data processing method, device and storage medium based on blockchain
CN105049475B (en) The data efficient storage optimization method and system of extensive community
CN114791788B (en) Data storage method and device based on block chain
CN113254538B (en) Method for executing transaction in block chain and block chain link point
CN114095436A (en) Processing method, storage medium and computer system for block chain transaction
KR102218297B1 (en) Verifiable pruning system of ledger
CN113672686B (en) Block data distribution and storage method and system
CN117407467B (en) Block chain code storage system combining bloom filter and DHT
CN113793148B (en) Block synchronization method, device, node and storage medium of alliance chain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant