WO2020156483A1 - 一种区块链状态数据的存储方法、设备和存储介质 - Google Patents

一种区块链状态数据的存储方法、设备和存储介质 Download PDF

Info

Publication number
WO2020156483A1
WO2020156483A1 PCT/CN2020/073985 CN2020073985W WO2020156483A1 WO 2020156483 A1 WO2020156483 A1 WO 2020156483A1 CN 2020073985 W CN2020073985 W CN 2020073985W WO 2020156483 A1 WO2020156483 A1 WO 2020156483A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
account
contract
key value
value
Prior art date
Application number
PCT/CN2020/073985
Other languages
English (en)
French (fr)
Inventor
柳宇航
王志文
吴思进
Original Assignee
杭州复杂美科技有限公司
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 杭州复杂美科技有限公司 filed Critical 杭州复杂美科技有限公司
Publication of WO2020156483A1 publication Critical patent/WO2020156483A1/zh

Links

Images

Classifications

    • 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

Definitions

  • This application relates to the field of blockchain technology, in particular to a storage method, equipment and storage medium of blockchain state data.
  • the storage of state data in the Merkel tree is generally through the storage model based on the account address, and the account address is used as the key to store.
  • This storage method can only store the originally defined account structure data in the Merkel tree.
  • the subsequent native contract data storage needs to be supported by a virtual machine, and the other can store state data with any key value.
  • this storage method will cause too many nodes in the Merkel tree, which will affect the reading of the tree. Write performance.
  • the present invention provides a blockchain state data storage method, including:
  • the leaf nodes of the Merkel tree correspond to the accounts one-to-one, and the account data of each leaf node includes account system data and account contract data.
  • the account contract data includes a number of first key values and first value values.
  • reading the account data of the first leaf node and updating the account data according to the status data includes:
  • updating the account contract data according to the search result includes: deleting the account contract data.
  • the second key value is the account address
  • obtaining account data in the Merkel tree according to the second key value of the state data includes:
  • inserting a second leaf node in the Merkel tree according to the state data includes:
  • the present invention also provides a device including one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to execute the various The state data storage method provided by the embodiment.
  • the present invention also provides a storage medium storing a computer program, which causes a computer to execute the state data storage method provided according to the embodiments of the present invention.
  • the blockchain state data methods, devices, and storage media provided by many embodiments of the present invention limit the number of leaf nodes of the Merkel tree by adding contract data to the account structure and inserting the user account as the basis into the Merkel tree. At the same time, by adding account contract data to the data structure when constructing the data structure, the storage of any data except the account system data is guaranteed.
  • the blockchain state data method, device and storage medium provided by some embodiments of the present invention further implement the storage of account contract data by using the account address as the key value inserted into the Merkel tree, and then updating the contract state data.
  • FIG. 1 is a schematic diagram of the structure of account data provided by an embodiment of the present invention.
  • FIG. 2 is a flowchart of a method for storing blockchain state data according to an embodiment of the present invention.
  • Fig. 3 is a flowchart of a preferred embodiment of the method shown in Fig. 2.
  • Fig. 4 is a flowchart of a preferred embodiment of the method shown in Fig. 2.
  • Fig. 5 is a schematic structural diagram of a device provided by an embodiment of the present invention.
  • FIG. 1 is a schematic diagram of the structure of account data provided by an embodiment of the present invention. As shown in Figure 1, define the account structure as follows:
  • Balance is the amount of the current account
  • Frozen is the frozen amount of the current account
  • Addr is the account address
  • MpKvs is the address where all contracts of the account store contract status data
  • Map is a set of group [k,v] values.
  • the data generated in the above structure is account data 1, including account system data 2 and account contract data 3: data such as current account amount, frozen amount, account address, etc. are account system data, used to store account status Related data: For the suspension of a certain contract, the preservation of a certain contract, the reserved interface and other data other than the account system data are account contract data, and the contract status data of each contract is stored in the form of [k,v]. In addition, there may be several contracts under an account, then the account contract data 3 includes contract status data 31 of the first contract, contract status data 32 of the second contract, contract status data 33 of the third contract, and contract status data of the fourth contract. Contract status data 34,. «
  • FIG. 2 is a flowchart of a method for storing blockchain state data according to an embodiment of the present invention.
  • the present invention provides a blockchain state data storage method, including:
  • the leaf nodes of the Merkel tree correspond to the accounts one-to-one, and the account data of each leaf node includes account system data and account contract data.
  • the account corresponding to the data is obtained according to the state data [key2, value2] to be stored, and it is determined whether the first leaf node A corresponding to the account already exists in the Merkel tree, and if so, the first leaf node A is obtained.
  • the second leaf node B is inserted into the Merkel tree as a new node of the Merkel tree.
  • value1 in account data [key1, value1] includes account system data (such as Balance, Frozen, Addr, etc.) and account contract data represented by map.
  • the key value key2 of the status data is used to identify the account , So the key value of the same account should be the same.
  • the leaf nodes of the Merkel tree correspond to the accounts one-to-one, so the number of leaf nodes in the Merkel tree is mainly related to the number of accounts. Unless the account increases, the number of leaf nodes of the Merkel tree is not Will increase, thereby controlling the number of nodes of the Merkel tree, and the account contract data is stored in the map of the account structure, which flexibly realizes the storage of data representing the state of the contract without relying on virtual machines.
  • the account contract data includes several first key values and first value values.
  • the account includes several types of contracts, and the contract status of each contract is represented by [k, v].
  • Fig. 3 is a flowchart of a preferred embodiment of the method shown in Fig. 2.
  • reading the account data of the first leaf node and updating the account data according to the status data includes:
  • the value1 of the account data stored in the Merkel tree is obtained according to the second key value key2 of the state data [key2, value2] to be stored, and the value1 is generated after serialization according to the data in the above account structure . Then it is further judged whether the contract status data is included in the status data, where the contract status data is used to represent the data of a certain contract status:
  • the state data only includes the contract state data
  • the fourth key value key4 is updated to the third key value key3, and the fourth value value is updated to the third value value in the contract state data (because the key value of the contract state data can be arbitrarily defined, the key value here also needs to be replaced). Further, after the fourth value is found in the account data, the fourth value must be deserialized before the data is updated.
  • the method further includes: replacing the account system data in the account data value1 according to the account system data in value2.
  • the second key value key2 is the account address of the account
  • obtaining the first state data in the Merkel tree according to the second key value of the state data includes:
  • the key2 of the status data in addition to directly using the account address as the key of the status data, can also be set in the form of characters with the account address, or other expressions can be used to represent the account, as long as the key value is
  • the definition form can identify the account, and the key value of the same account should be the same.
  • the first key value of the first contract can be set to any form. If the state data is contract state data, then the key and value values of the state data to be stored should be replaced by the previously stored account in the Merkel tree. The key value and value value of the contract data. If the value of the previously stored account contract data does not include the contract state data of the contract, the contract state data is inserted into the account contract data.
  • updating the account contract data according to the search result in step S112 further includes: S1121, deleting the account contract data.
  • the operation type is added to the state data to be stored, such as the delete operation type, the parameter type to be deleted, the contract name, etc., so that the contract state data of the contract is performed when the state data of the leaf node is updated. Delete to reduce the occupation of account space.
  • each person’s ID number or mobile phone number can be used as the key value of personal user information data. In this way, the supervisory system is greatly Reduce the number of supervised leaf nodes.
  • Fig. 4 is a flowchart of a preferred embodiment of the method shown in Fig. 2. As shown in Figure 4, inserting a second leaf node in the Merkel tree according to the state data in step S11 includes:
  • the above may also be to generate the fifth key value first and then generate the fifth value value, and the order may not be limited by this embodiment.
  • Fig. 5 is a schematic structural diagram of a device provided by an embodiment of the present invention.
  • the present application also provides a device 300, including one or more central processing units (CPU) 01, which can be based on a program stored in a read-only memory (ROM) 02 or The program loaded from the storage portion 08 into the random access memory (RAM) 03 executes various appropriate actions and processing.
  • RAM03 various programs and data required for the operation of the device 00 are also stored.
  • CPU01, ROM02, and RAM03 are connected to each other through a bus 04.
  • An input/output (I/O) interface 05 is also connected to the bus 04.
  • the following components are connected to the I/O interface 05: the input part 06 including keyboard, mouse, etc.; the output part 07 including cathode ray tube (CRT), liquid crystal display (LCD), etc. and speakers, etc.; the storage part including hard disk, etc. 08 ; And the communication part 09 including a network interface card such as a LAN card and a modem.
  • the communication section 09 performs communication processing via a network such as the Internet.
  • the drive 10 is also connected to the I/O interface 05 as required.
  • the state data storage method described in any of the above embodiments can be implemented as a computer software program.
  • the embodiments of the present disclosure include a computer program product, which includes a computer program tangibly embodied on a machine-readable medium, the computer program including program code for executing a state data storage method.
  • the computer program may be downloaded and installed from the network through the communication part 309, and/or installed from the removable medium 311.
  • the present application also provides a computer-readable storage medium.
  • the computer-readable storage medium may be the computer-readable storage medium included in the device of the above-mentioned embodiment; or it may exist alone without being installed.
  • the computer-readable storage medium stores one or more programs, and the program is used by one or more processors to execute the state data storage method described in this application.
  • each block in the flowchart or block diagram can represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logic function Executable instructions.
  • the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown one after another can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the units or modules involved in the embodiments described in the present application can be implemented in software or hardware.
  • the described units or modules may also be arranged in the processor.
  • each of the described units may be a software program arranged in a computer or a mobile smart device, or may be a separately configured hardware device.
  • the names of these units or modules do not constitute a limitation on the units or modules themselves under certain circumstances.

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种区块链状态数据的存储方法、设备和存储介质,该方法包括根据待存储的状态数据判断默克尔树中是否存在对应于状态数据的第一叶子节点(S11):是,则读取第一叶子节点的账户数据,并根据状态数据更新账户数据;否,则根据状态数据在默克尔树中插入第二叶子节点;其中,默克尔树的叶子节点与账户一一对应,各叶子节点的账户数据包括账户系统数据和账户合约数据。以用户账户作为基础插入默克尔树中,限制了默克尔树的叶子节点,同时,通过在构建数据结构时,在数据结构中增加合约状态数据,保证了对任意数据的存储。

Description

一种区块链状态数据的存储方法、设备和存储介质 技术领域
本申请涉及区块链技术领域,具体涉及一种区块链状态数据的存储方法、设备何存储介质。
背景技术
现有技术中,对于默克尔树中状态数据的存储一般通过基于账户地址的存储模型,以账户地址作为key存储,这种存储方式只能将原生定义的账户结构数据保存在默克尔树中,对于后续的原生合约数据存储需要借助虚拟机进行支持,另一种可以将状态数据以任意key值进行存储,然而这种存储方式会导致默克尔树的节点过多,影响树的读写性能。
发明内容
鉴于现有技术中的上述缺陷或不足,期望提供一种灵活的区块链状态数据存储方法、设备和存储介质。
第一方面,本发明提供一种区块链状态数据存储方法,包括:
根据待存储的状态数据判断默克尔树中是否存在对应于状态数据的第一叶子节点:
是,则读取第一叶子节点的账户数据,并根据状态数据更新账户数据;
否,则根据状态数据在默克尔树中插入第二叶子节点;
其中,默克尔树的叶子节点与账户一一对应,各叶子节点的账户数据包括账户系统数据和账户合约数据。
进一步,账户合约数据包括若干第一键值和第一value值。
进一步,读取第一叶子节点的账户数据,并根据状态数据更新账户数据包括:
根据状态数据的第二键值获取默克尔树中账户数据;其中, 第二键值用于标识第一叶子节点的账户;
判断状态数据是否包括合约状态数据:
是,则根据合约状态数据的第三键值查找账户合约数据中与第三键值对应同一合约的第四键值及其对应的第四value值;以及,
根据查找结果更新账户合约数据;
否,则根据状态数据更新账户系统数据。
进一步,根据查找结果更新账户合约数据包括:删除账户合约数据。
进一步,第二键值为账户地址,根据状态数据的第二键值获取默克尔树中账户数据包括:
获取状态数据的账户地址;
根据账户地址获取账户数据。
进一步,根据状态数据在默克尔树中插入第二叶子节点包括:
根据状态数据生成第二账户的账户数据;
将账户数据序列化,生成第五value值;
将第二账户的账户地址作为第五键值;
根据第五键值和第五value值插入第二叶子节点。
第二方面,本发明还提供一种设备,包括一个或多个处理器和存储器,其中存储器包含可由该一个或多个处理器执行的指令以使得该一个或多个处理器执行根据本发明各实施例提供的状态数据存储方法。
第三方面,本发明还提供一种存储有计算机程序的存储介质,该计算机程序使计算机执行根据本发明各实施例提供的状态数据存储方法。
本发明诸多实施例提供的区块链状态数据方法、设备和存储介质通过将账户结构中增加合约数据,以用户账户作为基础插入默克尔树中,限制了默克尔树的叶子节点数量,同时,通过在构建数据结构时,在数据结构中增加账户合约数据,保证了对除账 户系统数据外的任意数据的存储。
本发明一些实施例提供的区块链状态数据方法、设备和存储介质进一步通过将账户地址作为插入默克尔树的键值,再通过对合约状态数据的更新实现账户合约数据的存储。
附图说明
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:
图1为本发明一实施例提供的账户数据的结构示意图。
图2为本发明一实施例提供的一种区块链状态数据的存储方法的流程图。
图3为图2所示方法的一优选实施方式的流程图。
图4为图2所示方法的一优选实施方式的流程图。
图5为本发明一实施例提供的一种设备的结构示意图。
具体实施方式
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与发明相关的部分。
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。
在本发明一实施例的具体实施场景中,
图1为本发明一实施例提供的账户数据的结构示意图。如图1所示,定义账户结构体如下:
Figure PCTCN2020073985-appb-000001
Figure PCTCN2020073985-appb-000002
其中Balance为当前账户的金额,Frozen为当前账户的冻结金额,Addr为账户地址,MpKvs为该账户所有合约存储合约状态数据的地址,Map为一组组[k,v]值。
上述结构体中生成的数据为账户数据1,包括账户系统数据2和账户合约数据3:对于像当前账户的金额,冻结金额,账户地址等这样的数据为账户系统数据,用于存储关于账户状态的相关数据;对于像某合约的暂停,某合约的保存,预留接口等除了账户系统数据以外的数据为账户合约数据,以[k,v]的形式存储各合约的合约状态数据。另外,一个账户下面可能会有若干个合约,那么账户合约数据3中包括第一合约的合约状态数据31,第二合约的合约状态数据32,第三合约的合约状态数据33,第四合约的合约状态数据34,……。
图2为本发明一实施例提供的一种区块链状态数据存储方法的流程图。如图2所示,在本实施例中,本发明提供一种区块链状态数据存储方法,包括:
S11、根据待存储的状态数据判断默克尔树中是否存在对应于状态数据的第一叶子节点:
是,则读取第一叶子节点的账户数据,并根据状态数据更新账户数据;
否,则根据状态数据在默克尔树中插入第二叶子节点;
其中,默克尔树的叶子节点与账户一一对应,各叶子节点的账户数据包括账户系统数据和账户合约数据。
具体地,根据待存储的状态数据[key2,value2]获知该数据对应 的账户,判断默克尔树中是否已经存在与该账户对应的第一叶子节点A,若是,则获取第一叶子节点A在默克尔树中存储该账户的账户数据[key1,value1],并将状态数据[key2,value2]更新账户数据[key1,value1],若否,则将包含状态数据[key2,value2]的第二叶子节点B作为默克尔树的新节点插入默克尔树。其中,账户数据[key1,value1]中的value1中包括账户系统数据(如Balance,Frozen,Addr等)和map表示的账户合约数据,在本实施例中,状态数据的键值key2用于标识账户,所以同一个账户的键值应相同。
在本实施例中,默克尔树的叶子节点与账户一一对应,因此默克尔树中的叶子节点个数主要跟账户数量有关,除非账户增加,否则默克尔树的叶子节点数不会增加,从而控制了默克尔树的节点数量,而账户合约数据存储在账户结构的map中,在不依靠虚拟机的情况下灵活的实现了对于表示合约状态的数据的存储。
进一步优选地,账户合约数据包括若干第一键值和第一value值。具体地,账户中包括若干种合约,每个合约的合约状态均由[k,v]表示。
图3为图2所示方法的一优选实施方式的流程图。如图2所示,在本实施例中,读取第一叶子节点的账户数据,并根据状态数据更新账户数据包括:
S111、根据状态数据的第二键值获取默克尔树中账户数据;其中,第二键值用于标识第一叶子节点的账户;
S112、判断状态数据是否包括合约状态数据:
是,则根据合约状态数据的第三键值查找账户合约数据中与第三键值对应同一合约的第四键值及其对应的第四value值;以及,根据查找结果更新账户合约数据;
否,则根据状态数据更新账户系统数据。
具体地,根据待存储的状态数据[key2,value2]的第二键值key2获取存储在默克尔树中的账户数据的value1,该value1是根据上述账户结构体中的数据序列化后生成的。然后进一步判断状态数据中是否包括合约状态数据,其中合约状态数据用于表示某合约 状态的数据:
若不是合约状态数据,则直接将状态数据的value2替换账户合约数据的value1(由于是账户系统数据,所以同一个账户的key值相同,所以这里key2=key1,只需要替换为最新的value2即可)。
若状态数据中只包括合约状态数据,则根据合约状态数据的第三键值key3查找账户合约数据中与该key3对应的同一合约,获取该合约中的第四键值key4和第四value值,将第四键值key4更新为第三键值key3,第四value值更新为合约状态数据中的第三value值(由于合约状态数据的key值可以任意定义,所以这里key值也需要替换)。进一步,在账户数据中查找获取第四value值后,要对第四value值进行反序列化后再进行数据的更新。
若状态数据中既包括账户系统数据,又包括合约状态数据,则上述步骤更新账户合约数据的基础上,方法还包括:根据value2中的账户系统数据替换账户数据value1中的账户系统数据。
进一步优选地,第二键值key2为账户的账户地址,根据状态数据的第二键值获取默克尔树中第一状态数据包括:
获取待存储的状态数据的所述账户地址;
根据所述账户地址获取所述账户数据。
上述实施例中通过进一步限定待存储的状态数据的键值形式为用账户地址作为key值,可以更加简单方便地直接通过获取账户地址查询状态数据,且通过在结构体中添加合约状态数据,在确保默克尔树中的节点数量只与账户数量有关的同时实现了任意账户数据的存储。
在更多实施例中,状态数据的key2除了可以直接以账户地址作为状态数据的key,还可以设置为带有账户地址字符的形式,还可以是用其他表达方式表示账户,只要该key值的定义形式能标识该账户即可,且同一账户的key值应相同。另外,第一合约的第一键值可以设置为任意形式,若状态数据为合约状态数据,届时还应将待存储的状态数据的键值和value值替换掉默克尔树中以前存储的账户合约数据的键值和value值,若以前存储的账户合约数据 的value值中不包括该合约的合约状态数据,则在账户合约数据中插入该合约状态数据。
进一步优选地,步骤S112中根据查找结果更新账户合约数据还包括:S1121、删除账户合约数据。
具体地,在待存储的状态数据中添加操作类型,如添加删除delete操作类型,还可以添加删除的参数类型,合约名称等,使在更新叶子节点的状态数据时对该合约的合约状态数据进行删除,减少对账户空间的占用。
本发明提供的技术方案还可以应用到监管系统中,在监管系统中,可以将每个人的身份证号,或者手机号码等作为个人用户信息数据的key值,这样,对于监管系统,极大的减少了监管的叶子节点的数量。
图4为图2所示方法的一优选实施方式的流程图。如图4所示,步骤S11中根据状态数据在默克尔树中插入第二叶子节点包括:
根据状态数据生成第二账户的账户数据;
将账户数据序列化,生成第五value值;
将第二账户的账户地址作为第五键值;
根据第五键值和第五value值插入第二叶子节点。
上述还可以是先生成第五键值再生成第五value值,顺序可不受本实施例的限定。
图5为本发明一实施例提供的一种设备的结构示意图。
如图5所示,作为另一方面,本申请还提供了一种设备300,包括一个或多个中央处理单元(CPU)01,其可以根据存储在只读存储器(ROM)02中的程序或者从存储部分08加载到随机访问存储器(RAM)03中的程序而执行各种适当的动作和处理。在RAM03中,还存储有设备00操作所需的各种程序和数据。CPU01、ROM02以及RAM03通过总线04彼此相连。输入/输出(I/O)接口05也连接至总线04。
以下部件连接至I/O接口05:包括键盘、鼠标等的输入部分 06;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分07;包括硬盘等的存储部分08;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分09。通信部分09经由诸如因特网的网络执行通信处理。驱动器10也根据需要连接至I/O接口05。可拆卸介质11,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器10上,以便于从其上读出的计算机程序根据需要被安装入存储部分08。
特别地,根据本公开的实施例,上述任一实施例描述的状态数据存储方法可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括有形地包含在机器可读介质上的计算机程序,所述计算机程序包含用于执行状态数据存储方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分309从网络上被下载和安装,和/或从可拆卸介质311被安装。
作为又一方面,本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例的装置中所包含的计算机可读存储介质;也可以是单独存在,未装配入设备中的计算机可读存储介质。计算机可读存储介质存储有一个或者一个以上程序,该程序被一个或者一个以上的处理器用来执行描述于本申请的状态数据存储方法。
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这根据所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以通过执行规定 的功能或操作的专用的基于硬件的系统来实现,或者可以通过专用硬件与计算机指令的组合来实现。
描述于本申请实施例中所涉及到的单元或模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元或模块也可以设置在处理器中,例如,各所述单元可以是设置在计算机或移动智能设备中的软件程序,也可以是单独配置的硬件装置。其中,这些单元或模块的名称在某种情况下并不构成对该单元或模块本身的限定。
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离本申请构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。

Claims (8)

  1. 一种区块链状态数据的存储方法,其特征在于,包括:
    根据待存储的状态数据判断默克尔树中是否存在对应于所述状态数据的第一叶子节点:
    是,则读取所述第一叶子节点的账户数据,并根据所述状态数据更新所述账户数据;
    否,则根据所述状态数据在所述默克尔树中插入第二叶子节点;
    其中,所述默克尔树的叶子节点与账户一一对应,各所述叶子节点的账户数据包括账户系统数据和账户合约数据。
  2. 根据权利要求1所述的方法,其特征在于,所述账户合约数据包括若干第一键值和第一value值。
  3. 根据权利要求2所述的方法,其特征在于,所述读取所述第一叶子节点的账户数据,并根据所述状态数据更新所述账户数据包括:
    根据所述状态数据的第二键值获取所述默克尔树中所述账户数据;其中,所述第二键值用于标识所述第一叶子节点的账户;
    判断所述状态数据是否包括合约状态数据:
    是,则根据所述合约状态数据的第三键值查找所述账户合约数据中与所述第三键值对应同一合约的第四键值及其对应的第四value值;以及,
    根据查找结果更新所述账户合约数据;
    否,则根据所述状态数据更新所述账户系统数据。
  4. 根据权利要求3所述的方法,其特征在于,所述根据查找结果更新所述账户合约数据包括:
    删除所述账户合约数据。
  5. 根据权利要求3所述的方法,其特征在于,所述第二键值为所述账户地址,所述根据所述状态数据的第二键值获取所述默克尔树中所述账户数据包括:
    获取所述状态数据的所述账户地址;
    根据所述账户地址获取所述账户数据。
  6. 根据权利要求1-5任一项所述的方法,其特征在于,所述根据所述状态数据在所述默克尔树中插入第二叶子节点包括:
    根据所述状态数据生成第二账户的所述账户数据;
    将所述账户数据序列化,生成第五value值;
    将所述第二账户的账户地址作为第五键值;
    根据所述第五键值和所述第五value值插入所述第二叶子节点。
  7. 一种设备,其特征在于,所述设备包括:
    一个或多个处理器;
    存储器,用于存储一个或多个程序,
    当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1-6中任一项所述的方法。
  8. 一种存储有计算机程序的存储介质,其特征在于,该程序被处理器执行时实现如权利要求1-6中任一项所述的方法。
PCT/CN2020/073985 2019-01-31 2020-01-23 一种区块链状态数据的存储方法、设备和存储介质 WO2020156483A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910097365.3A CN109559234B (zh) 2019-01-31 2019-01-31 一种区块链状态数据的存储方法、设备和存储介质
CN201910097365.3 2019-01-31

Publications (1)

Publication Number Publication Date
WO2020156483A1 true WO2020156483A1 (zh) 2020-08-06

Family

ID=65874061

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/073985 WO2020156483A1 (zh) 2019-01-31 2020-01-23 一种区块链状态数据的存储方法、设备和存储介质

Country Status (2)

Country Link
CN (1) CN109559234B (zh)
WO (1) WO2020156483A1 (zh)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109559234B (zh) * 2019-01-31 2020-10-23 杭州复杂美科技有限公司 一种区块链状态数据的存储方法、设备和存储介质
CN110275884B (zh) * 2019-05-31 2020-08-04 阿里巴巴集团控股有限公司 数据存储方法及节点
US11294875B2 (en) 2019-05-31 2022-04-05 Advanced New Technologies Co., Ltd. Data storage on tree nodes
CN110175188B (zh) * 2019-05-31 2021-05-11 杭州复杂美科技有限公司 一种区块链状态数据缓存和查询方法、设备及存储介质
CN110347660B (zh) * 2019-06-28 2020-08-11 阿里巴巴集团控股有限公司 基于区块链的分级存储方法及装置、电子设备
US10789222B2 (en) 2019-06-28 2020-09-29 Alibaba Group Holding Limited Blockchain-based hierarchical data storage
US11036720B2 (en) 2019-06-28 2021-06-15 Advanced New Technologies Co., Ltd. Blockchain-based hierarchical data storage
CN110489420A (zh) * 2019-08-14 2019-11-22 深圳前海微众银行股份有限公司 一种基于区块链的数据处理方法及装置
CN112685791A (zh) * 2019-10-18 2021-04-20 陈小虎 一种去中心化的私有数据的存取与验证方案
CN111488610A (zh) * 2020-04-08 2020-08-04 北京瑞策科技有限公司 基于业务数据区块链的状态数据查询方法及装置
SG11202102371QA (en) * 2020-04-15 2021-04-29 Alipay Hangzhou Inf Tech Co Ltd Distributed blockchain data storage under account model
WO2020143853A2 (en) 2020-04-20 2020-07-16 Alipay (Hangzhou) Information Technology Co., Ltd. Distributed blockchain data storage under account model
CN112380209B (zh) * 2020-10-29 2021-08-20 华东师范大学 一种面向区块链多通道状态数据的聚集结构树方法
CN114331439A (zh) * 2021-12-29 2022-04-12 浙江吉利控股集团有限公司 默克尔树更新方法、系统、设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106874440A (zh) * 2017-02-07 2017-06-20 杭州秘猿科技有限公司 一种基于sql数据库的区块链状态存储方法
CN108197226A (zh) * 2017-12-29 2018-06-22 山大地纬软件股份有限公司 Mptc账户状态树以及mptc区块链快速检索方法
CN108282474A (zh) * 2018-01-18 2018-07-13 山东大学 基于区块链的数字资产交易一致性的维护方法
US20180205552A1 (en) * 2015-06-02 2018-07-19 ALTR Solutions, Inc. Utilizing a tree-structure to segment and distribute files across a series of blockchains
CN108615156A (zh) * 2018-05-09 2018-10-02 上海魅联信息技术有限公司 一种基于区块链的数据结构
CN109559234A (zh) * 2019-01-31 2019-04-02 杭州复杂美科技有限公司 一种区块链状态数据的存储方法、设备和存储介质

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180088927A1 (en) * 2016-09-28 2018-03-29 Intel Corporation ROOT OF TRUST (RoT) APPLICATION FOR INTERNET OF THINGS (IoT) DEVICES
CN109165221A (zh) * 2018-08-16 2019-01-08 北京京东尚科信息技术有限公司 区块链的数据存储方法、装置、区块链节点及存储介质
CN109286685A (zh) * 2018-11-21 2019-01-29 北京蓝石环球区块链科技有限公司 可拓展子链的主链加并行多子链的系统架构

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180205552A1 (en) * 2015-06-02 2018-07-19 ALTR Solutions, Inc. Utilizing a tree-structure to segment and distribute files across a series of blockchains
CN106874440A (zh) * 2017-02-07 2017-06-20 杭州秘猿科技有限公司 一种基于sql数据库的区块链状态存储方法
CN108197226A (zh) * 2017-12-29 2018-06-22 山大地纬软件股份有限公司 Mptc账户状态树以及mptc区块链快速检索方法
CN108282474A (zh) * 2018-01-18 2018-07-13 山东大学 基于区块链的数字资产交易一致性的维护方法
CN108615156A (zh) * 2018-05-09 2018-10-02 上海魅联信息技术有限公司 一种基于区块链的数据结构
CN109559234A (zh) * 2019-01-31 2019-04-02 杭州复杂美科技有限公司 一种区块链状态数据的存储方法、设备和存储介质

Also Published As

Publication number Publication date
CN109559234A (zh) 2019-04-02
CN109559234B (zh) 2020-10-23

Similar Documents

Publication Publication Date Title
WO2020156483A1 (zh) 一种区块链状态数据的存储方法、设备和存储介质
WO2020192316A1 (zh) 数据存储方法、数据回滚方法、设备和存储介质
US11550769B2 (en) Data processing method, apparatus, and system
US8494996B2 (en) Creation and revision of network object graph topology for a network performance management system
WO2019134340A1 (zh) 薪资计算方法、应用服务器及计算机可读存储介质
JP6070936B2 (ja) 情報処理装置、情報処理方法及びプログラム
CN106033439A (zh) 一种分布式事务处理方法及系统
US11775507B2 (en) Methods and apparatuses for reading and updating data structures, and electronic devices
CN111177113B (zh) 数据迁移方法、装置、计算机设备和存储介质
CN109885585B (zh) 支持存储过程、触发器与视图的分布式数据库系统和方法
CN110109983B (zh) 一种操作Redis数据库的方法和装置
WO2022267769A1 (zh) 图数据生成的方法及装置
US7958154B2 (en) Apparatus, system, and method for command manager support for pluggable data formats
CN112528067A (zh) 图数据库的存储方法、读取方法、装置及设备
US8762421B2 (en) Accessing entities of data access layer
US11016830B2 (en) Entity-based service operation for object-based persistence
CN116304079A (zh) 基于时序的图谱数据管理方法、设备和可读存储介质
CN114048219A (zh) 图数据库更新方法及装置
CN111796845B (zh) 数据库升级方法、状态数据查询方法、设备和存储介质
CN115617594A (zh) 用于生成激励信息的方法、装置、存储介质及程序产品
CN112052234B (zh) 业务数据的处理方法和装置、存储介质、电子装置
CA3089289C (en) System and methods for loading objects from hash chains
CN112347794A (zh) 数据翻译方法、装置、设备及计算机存储介质
CN113609130B (zh) 获取网关接入数据的方法、装置、电子设备及存储介质
US11455437B1 (en) Techniques for generating and retrieving change summary data and aggregated model version data for an infrastructure model

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20747606

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20747606

Country of ref document: EP

Kind code of ref document: A1