WO2021027531A1 - 一种区块链交易记录的处理方法及装置 - Google Patents
一种区块链交易记录的处理方法及装置 Download PDFInfo
- Publication number
- WO2021027531A1 WO2021027531A1 PCT/CN2020/104621 CN2020104621W WO2021027531A1 WO 2021027531 A1 WO2021027531 A1 WO 2021027531A1 CN 2020104621 W CN2020104621 W CN 2020104621W WO 2021027531 A1 WO2021027531 A1 WO 2021027531A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transaction
- record
- block height
- status
- state
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2358—Change logging, detection, and notification
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/24—Querying
- G06F16/245—Query processing
- G06F16/2455—Query execution
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/389—Keeping log of transactions for guaranteeing non-repudiation of a transaction
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Definitions
- the embodiments of the present invention relate to the field of financial technology (Fintech), and in particular to a method and device for processing blockchain transaction records.
- Fetech financial technology
- Blockchain technology (BlockChain) is no exception.
- Due to the security and real-time sexual requirements are also higher requirements for blockchain technology.
- the embodiment of the present invention provides a method and device for processing block chain transaction records, which are used to store historical modification records, and realize fast query when querying data on a specified block.
- a method for processing blockchain transaction records is suitable for a blockchain system, and the method includes:
- the blockchain system After the blockchain system confirms that the first transaction takes effect, determine the first state table corresponding to the first transaction; the first state table is only used to record the latest state results of each transaction account;
- the first status result obtained according to the first transaction will be updated to the first status record in the first status table; the first status record is used to record the status of the first transaction account corresponding to the first transaction The latest status results;
- the first modification information corresponding to the first transaction is added to the first historical modification record table, and the first modification information includes The first state result.
- a state table and a historical modification record table are set.
- the historical modification record table is used to store the historical modification record of the transaction account, and the state table and the historical modification record table Independent storage is conducive to storage and maintenance.
- the status table and the history modification record table can be updated respectively according to the first transaction, and after receiving the query request, the history modification record table is queried for the status results at the specified block height.
- the method before the determining the first state table corresponding to the first transaction, the method further includes:
- the determining the first state table corresponding to the first transaction includes:
- the first state table is determined according to the transaction type of the first transaction.
- the status table and the history modification record table corresponding to each transaction type are created, which is equivalent to separating the status tables corresponding to different transaction types through the smart contract corresponding to the transaction type, and Separate the historical modification record tables corresponding to different transaction types, and realize that different transaction types correspond to different tables, which is beneficial to the management of the status table and the historical modification record table.
- the first status record includes the first transaction account and current block height, and the current block height is used to indicate the block height of the block corresponding to the first transaction;
- the first modification information further includes the first transaction account, the current block height, and the historical block height; the historical block height is used to indicate the block height of the block corresponding to the previous transaction of the first transaction account .
- the current block height is set in the status record, and the current block height and the historical block height are set in the modification information.
- the status table and the historical modification record table can be combined, and each item in the record table can be modified according to the history. Modify the current block height and historical block height of the information, and set the historical modification record table to an array structure or a chain structure to facilitate the query of the corresponding status results according to the specified height in the query instruction.
- the first state record further includes a first hash key value; the first hash key value is determined according to the table name of the first state table and the first transaction account;
- the first modification information further includes a second hash key value; the second hash key value is determined according to the table name of the first historical modification record table, the first transaction account, and the current block height of.
- the hash value can ensure global uniqueness and quickly index the data to be queried.
- the method further includes:
- the status result corresponding to the transaction query instruction is determined from the second history modification record table corresponding to the second status table.
- the current block height after receiving the transaction query instruction, the current block height can be determined first from the second state table corresponding to the transaction query instruction, and then if it is determined that the specified block height is less than the current block height, it is determined to correspond from the second state table
- the second historical modification record table of the determines the status result corresponding to the transaction query instruction.
- the determining the status result corresponding to the transaction query instruction from the second history modification record table corresponding to the second status table includes:
- the current block height in the second modification information is the current block height of each modification information in the second transaction account Is close to the specified block height; the closest to the specified block height means that the block height is not greater than the maximum block height value of the specified block height;
- the second status result in the second modification information is determined as the status result corresponding to the transaction query instruction.
- the second modification information corresponding to the second transaction account is determined in the second historical modification record table, and the current block height of the second modification information corresponds to the same state result as the specified block height, that is, the second The current block high school record of the modification information has a modification record, and the current block of the second modification information is as high as the specified block high school, and there is no new modification record.
- the status result corresponding to the specified block height can be determined by determining the second modification information.
- the determining the second modification information corresponding to the second transaction account in the second history modification record table includes:
- the second modification information can be determined from the second historical modification record table in various ways.
- Optional also includes:
- the third status result in the second status record is determined as the status result corresponding to the transaction query instruction.
- the current block height after receiving the transaction query instruction, the current block height can be determined from the second state table corresponding to the transaction query instruction, and if it is determined that the specified block height is not less than the current block height, it can indicate that the current block height is up to The status result of the transaction account is not modified between the specified block heights, that is, the third status result in the second status record is the status result corresponding to the transaction query instruction.
- an embodiment of the present invention also provides a block chain transaction record processing device, which is suitable for a block chain system, and the device includes:
- a processing unit configured to determine a first state table corresponding to the first transaction after the blockchain system confirms that the first transaction takes effect; the first state table is only used to record the latest state results of each transaction account;
- the update unit is configured to update the first status result obtained according to the first transaction to the first status record in the first status table; the first status record is used to record the corresponding information of the first transaction The latest status result of the first trading account;
- the update unit is further configured to add first modification information corresponding to the first transaction to the first historical modification record table after determining that the first state table has a corresponding first historical modification record table,
- the first modification information includes the first state result.
- processing unit is further configured to:
- the processing unit is specifically used for:
- the first state table is determined according to the transaction type of the first transaction.
- the first status record includes the first transaction account and current block height, and the current block height is used to indicate the block height of the block corresponding to the first transaction;
- the first modification information further includes the first transaction account, the current block height, and the historical block height; the historical block height is used to indicate the block height of the block corresponding to the previous transaction of the first transaction account .
- the first state record further includes a first hash key value; the first hash key value is determined according to the table name of the first state table and the first transaction account;
- the first modification information further includes a second hash key value; the second hash key value is determined according to the table name of the first historical modification record table, the first transaction account, and the current block height of.
- processing unit is further configured to:
- the status result corresponding to the transaction query instruction is determined from the second history modification record table corresponding to the second status table.
- processing unit is specifically configured to:
- the current block height in the second modification information is the current block height of each modification information in the second transaction account Is close to the specified block height; the closest to the specified block height means that the block height is not greater than the maximum block height value of the specified block height;
- the second status result in the second modification information is determined as the status result corresponding to the transaction query instruction.
- processing unit is specifically configured to:
- processing unit is further configured to:
- the third status result in the second status record is determined as the status result corresponding to the transaction query instruction.
- an embodiment of the present invention also provides a computing device, including:
- processor memory and communication interface; among them, the processor, memory and communication interface are connected by a bus;
- the processor is configured to read the program in the memory and execute the above-mentioned processing method of blockchain transaction records;
- the memory is used to store one or more executable programs, and can store data used by the processor when performing operations.
- an embodiment of the present invention also provides a non-transitory computer-readable storage medium, which stores computer instructions, which when run on a computer, causes the computer to execute the aforementioned blocks.
- the processing method of chain transaction records are stored in a non-transitory computer-readable storage medium, which stores computer instructions, which when run on a computer, causes the computer to execute the aforementioned blocks.
- an embodiment of the present invention also provides a computer program product containing instructions.
- the computer program product includes a calculation program stored on a non-transitory computer-readable storage medium.
- the computer program includes program instructions. When the program instructions are executed by a computer, the computer executes the above-mentioned blockchain transaction record processing method.
- FIG. 1 is a schematic flowchart of a method for processing blockchain transaction records according to an embodiment of the present invention
- FIG. 2 is a schematic flowchart of a method for querying transaction records according to an embodiment of the present invention
- Figure 3 is a first historical modification record table structure provided by an embodiment of the present invention.
- FIG. 6 is a schematic structural diagram of a processing device for blockchain transaction records according to an embodiment of the present invention.
- FIG. 7 is a schematic structural diagram of a computing device provided by this application.
- the method for processing blockchain transaction records provided in the embodiment of the present invention is applicable to a blockchain system.
- the blockchain system is a P2P (Peer to Peer) network composed of multiple blockchain nodes. Can communicate directly with each other.
- the data generated by a blockchain node can be broadcast to multiple blockchain nodes at the same time, and it can also query and obtain data from any other node.
- the state table is created by a smart contract of the same transaction type.
- the state table is used to record the latest state results of each transaction account of the transaction type.
- the status result of a certain trading account can be saved in the form of status record, that is, the status record is used to record the latest status result of the trading account.
- the state result can be generated by the smart contract, which is equivalent to the state table used to store the "current value" of the state result generated by the smart contract on the blockchain.
- the state table may include each transaction account in the blockchain system and the result of the latest state corresponding to each transaction account. If the first state table is a balance table, the state table includes the latest balance of each transaction account, the table name of the state table can be a balance table (t_Balance), and the table fields include a transaction account (Name) and a balance (Balance).
- the table fields of the state table may also include a hash key value (Key) and a block block height (Blocknum).
- Key hash key value
- Blocknum block block height
- the hash key value is understood as the index value in the state table, which is used to index the state result corresponding to the transaction account.
- the hash key value can be determined according to the table name of the state table and the transaction account.
- the block height is used to indicate that the transaction corresponding to the status result is packaged to the block height of the block. It is understood that after the transaction of the block chain is confirmed, the block chain system packs the transaction into the block and uploads it to the chain. Smart contract The state result of the transaction account is modified according to the transaction and written into the corresponding state table, where the block chain system will write the current block height when the block is on-chain into the corresponding state table together. It should be understood that the block height in the status table may also be referred to as the current block height.
- the present invention provides a state table for characterizing balance.
- the table name of the state table is t_Balance, and the table fields include Key, Blocknum, Name, and Balance, as shown in Table 1.
- the status table includes status records corresponding to each transaction account, and each status record is used to record the latest status result of the corresponding transaction account. For example, in Table 1, Alice's balance is changed to 100 when the block height is 2. For Alice's balance, block height 2 is the current block height when Alice's balance becomes 100.
- the status table can be a balance table or a table corresponding to other transaction types, such as a member table (t_member), an order table (t_order), etc.
- the smart contract when the smart contract creates the state table, it can create a historical modification record table corresponding to the state table at the same time, which is equivalent to that the smart contract corresponding to each transaction type can create the state table and historical modification corresponding to each transaction type. recording sheet.
- the status table is used to record the latest status results of a certain trading account
- the historical modification record table is used to record all historical status results of the trading account. There is only one status record for a trading account in the status table, while the history modification record table For a trading account, if there are N modifications, there are N modification messages, where N is greater than or equal to 1.
- the incoming creation instruction includes whether to generate a history modification record table. For those who do not pay attention to historical data, the historical modification record table may not be generated to reduce storage overhead. If the historical modification record table is specified, two tables are actually generated in the underlying storage.
- a creation record of a status table can be recorded to indicate whether the history modification record table corresponding to the status table is created.
- the creation record can also be stored in the form of a table, as shown in Table 2. It can include the name of the status table and whether to generate a historical modification record table.
- the table name of the historical modification record table can be the table name of the corresponding state table plus the suffix "history".
- the historical modification record table can have one more field than the state table, namely the block height of the previous historical value (Prevblocknum), which is used to record this
- Prevblocknum block height of the previous historical value
- the block height of a state result when it was last changed that is, the current block height when it was last modified, can be related to the previous piece of historical data through the block height of the previous historical value.
- the hash key value in the historical modification record table can be determined according to the table name, transaction account, and current block height of the historical modification record table.
- the present invention provides a historical modification record table for characterizing balance.
- the historical modification record table is named t_Balance_history, and the table fields include Key, Blocknum, Name, Balance, and Prevblocknum.
- Alice in Table 3 is
- Alice's historical modification record table includes each modification information, which is used to record Alice's historical status results.
- Prevblocknum is -1, indicating that this record was inserted when it was newly created.
- FIG. 1 exemplarily shows the flow of a method for processing blockchain transaction records according to an embodiment of the present invention, and the flow may be executed by a processing device for blockchain transaction records.
- the process specifically includes:
- Step 101 After the blockchain system confirms that the first transaction takes effect, determine the first state table corresponding to the first transaction;
- Step 102 Update the first state result obtained according to the first transaction to the first state record in the first state table
- Step 103 After determining that the first state table has a corresponding first historical modification record table, add first modification information corresponding to the first transaction in the first historical modification record table.
- the first state table is used to record the latest state results of each transaction account
- the first state table is a state table of the same transaction type as the first transaction
- the first state table includes state records corresponding to each transaction account. According to the first transaction, the first status record of the first transaction account corresponding to the first transaction in the first status table can be updated, and the first status record is used to record the latest status result of the first transaction account.
- the first status result After the first status result obtained according to the first transaction, the first status result can be updated to the first status record in the first status table, and the first status result can be recorded in the first modification information and then added to The first historical modification record table.
- a first history modification record table corresponding to the first state table that is, before step 101, a first state table with the same transaction type as the first state table is created through a smart contract corresponding to the first state table. History table.
- the transaction type corresponding to the first exchange may be determined, and the first state table corresponding to the transaction type may be determined according to the transaction type.
- the current block height corresponding to the first exchange and the first trading account can be recorded in the first status record together.
- the current block height refers to The block height of the block corresponding to the first transaction.
- the first modification information is added to the first historical modification record table, the current block height, the first transaction account, and the historical block height corresponding to the last modification can be recorded in the first modification information.
- the historical block The high is the block height of the block corresponding to the last transaction before the first transaction of the first transaction account.
- the first state record further includes a first hash key value, the first hash key value is determined according to the table name of the first state table and the first transaction account;
- the first modification information further includes a second hash value Key value: The second hash key value is determined according to the table name of the first historical modification record table, the first transaction account and the current block height.
- the foregoing embodiment elaborates the processing method of the blockchain transaction record, specifically, the status record of the transaction account is updated to the status table, and the modification information of the transaction account is added to the historical modification record table.
- the embodiment of the present invention also provides a method for querying transaction records based on the status table and the history modification record table.
- Step 201 receiving a transaction query instruction
- Step 202 Determine a second state table corresponding to the transaction query instruction according to the transaction type in the transaction query instruction;
- Step 203 Determine the current block height in the second state record corresponding to the second transaction account in the second state table
- Step 204 When the designated block height is less than the current block height in the second status record, determine the status result corresponding to the transaction query instruction from the second history modification record table corresponding to the second status table.
- the transaction query instruction includes the specified block height to be queried and the transaction account.
- the transaction query instruction is "Alice, 15", which represents the result of querying Alice's state when the block height is 15.
- the transaction query instruction is used to obtain the status result of the second transaction account when the specified block is high.
- the current block height of the second state record in the second state table may be determined first, and the current block height of the second state record may be compared with the specified block height. There are two situations:
- Case 1 The specified block height is less than the current block height in the second status record, then the second modification information corresponding to the second transaction account in the second historical modification record table is determined, and the second status result in the second modification information is determined as The status result corresponding to the transaction query instruction.
- Case 2 The specified block height is not less than the current block height in the second status record, the second status record corresponding to the second transaction account is determined from the second status table, and the third status result in the second status record is determined as The status result corresponding to the transaction query instruction.
- the current block height of the second modification information is the current block height of each modification information in the second trading account that is closest to the specified block height, where the closest to the specified block height refers to the maximum block height not greater than the specified block height Block high value.
- the modification information determined to be the block height above 10 is the second modification information.
- the index dichotomy, traversal method, or skip table method can be used to query the second history modification record table to determine the second modification record table corresponding to the second transaction account.
- Modify information The following describes the query of the second historical modification record table by index dichotomy, traversal method, or skip table method.
- the query of the blockchain history can use the binary data query method.
- the binary query method can change the expected traversal times of the query from n Reduce to log(n).
- Each record has an Index.
- Index can also be called a subscript.
- the attribute of the subscript is uniquely self-increasing.
- the history modification record table supports random Retrieve the data of any subscript, and also retrieve the current maximum subscript.
- the structure of the historical modification record table can be shown in Figure 3. Based on the historical modification record table structure shown in Fig. 3, binary search of historical data can be performed.
- a binary search method is adopted. First, query the status table to get the latest subscript and block height of the record of Alice's balance.
- the subscript is 4 and the block height is 21; if the input specified height is greater than the latest modified height, the status table will be returned immediately If the query height is less than the latest modified height, such as 15, it means to find a modified value whose block height is less than the height 15.
- Step 302 If the block height of the queried record is less than or equal to the queried target value (specified height), start the query at the middle of the range of subscript 2 to subscript 4. If the block height of the queried record is greater than For the target value of the query, start the query in the middle of the range of subscript 0 to 2;
- step 302 in this example, if the Blocknum of the record with subscript 2 is found to be 10, which is less than the target value of 15, then in the range from subscript 2 to subscript 4, the record at 2+2/2 rounded to be inquired, namely The record whose subscript is 3;
- the traversal method starts with the latest record in the historical modification record table, and obtains the PrevBlocknum of the record in sequence until it is less than the specified height.
- the structure of the historical modification record table can be shown in Figure 4.
- the traversal method is adopted. First, query the status table to get the latest block height of the record of Alice's balance. In this example, the block height is 21; if the specified height entered is greater than the latest modified height, the current value in the status table is immediately returned; if the height is queried Less than the latest modified height, such as 15, means to find a modified value whose block height is less than the height of 15.
- the complexity of the traversal method depends on the number of times a transaction account’s record has been modified. For example, Alice’s historical modification record has nothing to do with Bob’s, because the transaction account is a different primary key, and the key of the historical modification record table takes the transaction account into account. The primary key and the historical modification records of the two are in the same table, but they do not interfere with each other when querying.
- a set of skip tables can be added on the basis of the traversal query method to improve the query speed.
- an index table is added.
- the index table can be configured with rules, such as adding an index record for every two records, as shown in Figure 5.
- an index record of the skip table is generated at the same time. The rule is that for every two new history records, a new skip table record is added.
- Table 7(a) Take querying Alice's balance as an example.
- the state table is shown in Table 7(a)
- the history table is shown in Table 7(b)
- the jump table is shown in Table 7(c).
- To query the current value of Alice's balance use "Alice" as the Key, and directly query the status table to obtain the current value; if the historical modification record table is not established, the historical modification record cannot be queried; if the historical modification record table is established, you can Query Alice's historical records at a specified block height from the historical modification record table.
- the skip table method is adopted. First, query the status table to get the latest block height of the record of Alice's balance. In this example, the block height is 21; if the specified height entered is greater than the latest modified height, the current value in the status table is immediately returned; if the height is queried Less than the latest modified height, such as 15, means to find a modified value whose block height is less than the height of 15.
- the skip table query method can halve the expected number of traversals of the query, from n to n/2. If higher query efficiency is required, a multi-level skip table can be introduced, and the skip table can be superimposed on the current skip table. Reduce the number of traversals from n to log(n) times.
- a state table and a historical modification record table are set on the blockchain system that supports the storage engine of the table structure.
- the historical modification record table is used to store the historical modification record of the transaction account, and the state table and the historical modification record table Independent storage is conducive to storage and maintenance.
- the status table and the history modification record table can be updated respectively according to the first transaction, and after receiving the query request, the history modification record table is queried for the status results at the specified block height.
- FIG. 6 exemplarily shows the structure of a block chain transaction record processing device provided by an embodiment of the present invention, which can execute the process of the block chain transaction record processing method.
- the device suitable for blockchain systems, includes:
- the processing unit 601 is configured to determine the first state table corresponding to the first transaction after the blockchain system confirms that the first transaction takes effect; the first state table is only used to record the latest state results of each transaction account ;
- the update unit 602 is configured to update the first status result obtained according to the first transaction to the first status record in the first status table; the first status record is used to record the corresponding first transaction The latest status result of the first trading account;
- the updating unit 602 is further configured to: after determining that the first state table has a corresponding first historical modification record table, add first modification information corresponding to the first transaction in the first historical modification record table , The first modification information includes the first state result.
- processing unit 601 is further configured to:
- the processing unit 601 is specifically configured to:
- the first state table is determined according to the transaction type of the first transaction.
- the first status record includes the first transaction account and current block height, and the current block height is used to indicate the block height of the block corresponding to the first transaction;
- the first modification information further includes the first transaction account, the current block height, and the historical block height; the historical block height is used to indicate the block height of the block corresponding to the previous transaction of the first transaction account .
- the first state record further includes a first hash key value; the first hash key value is determined according to the table name of the first state table and the first transaction account;
- the first modification information further includes a second hash key value; the second hash key value is determined according to the table name of the first historical modification record table, the first transaction account, and the current block height of.
- processing unit 601 is further configured to:
- the status result corresponding to the transaction query instruction is determined from the second history modification record table corresponding to the second status table.
- processing unit 601 is specifically configured to:
- the current block height in the second modification information is the current block height of each modification information in the second transaction account Is close to the specified block height; the closest to the specified block height means that the block height is not greater than the maximum block height value of the specified block height;
- the second status result in the second modification information is determined as the status result corresponding to the transaction query instruction.
- processing unit 601 is specifically configured to:
- processing unit 601 is further configured to:
- the third status result in the second status record is determined as the status result corresponding to the transaction query instruction.
- this application also provides a computing device.
- the computing device includes at least one processor 720 for implementing the method in FIG. 1 provided by the embodiment of the application. Any method.
- the computing device 700 may also include at least one memory 730 for storing program instructions and/or data.
- the memory 730 and the processor 720 are coupled.
- the coupling in the embodiments of the present application is an indirect coupling or communication connection between devices, units, or modules, and may be in electrical, mechanical or other forms, and is used for information exchange between devices, units or modules.
- the processor 720 may operate in cooperation with the memory 730.
- the processor 720 may execute program instructions stored in the memory 730. At least one of the at least one memory may be included in the processor.
- the steps of the above method can be completed by hardware integrated logic circuits in the processor or instructions in the form of software.
- the steps of the method disclosed in the embodiments of the present application may be directly embodied as executed and completed by a hardware processor, or executed and completed by a combination of hardware and software modules in the processor.
- the software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
- the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. In order to avoid repetition, it will not be described in detail here.
- the processor in the embodiment of the present application may be an integrated circuit chip with signal processing capability.
- the steps of the foregoing method embodiments may be completed by hardware integrated logic circuits in the processor or instructions in the form of software.
- the above-mentioned processor may be a general-purpose processor, a digital signal processing circuit (digital signal processor, DSP), a dedicated integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field programmable gate array, FPGA) or other Programming logic devices, discrete gates or transistor logic devices, discrete hardware components.
- DSP digital signal processing circuit
- ASIC application specific integrated circuit
- FPGA field programmable gate array
- Programming logic devices discrete gates or transistor logic devices, discrete hardware components.
- the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
- the steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
- the software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
- the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
- the memory in the embodiment of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memory.
- the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electronic Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
- the volatile memory may be random access memory (RAM), which is used as an external cache.
- RAM random access memory
- static random access memory static random access memory
- dynamic RAM dynamic random access memory
- DRAM dynamic random access memory
- SDRAM synchronous dynamic random access memory
- double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
- enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
- serial link DRAM SLDRAM
- direct rambus RAM direct rambus RAM
- the computing device 700 may further include a communication interface 710 for communicating with other devices through a transmission medium, so that the device used in the computing device 700 can communicate with other devices.
- the communication interface may be a transceiver, circuit, bus, module, or other type of communication interface.
- the transceiver when the communication interface is a transceiver, the transceiver may include an independent receiver and an independent transmitter; it may also be a transceiver with integrated transceiver functions, or an interface circuit.
- the computing device 700 may also include a communication line 740.
- the communication interface 710, the processor 720, and the memory 730 may be connected to each other through a communication line 740;
- the communication line 740 may be a peripheral component interconnection standard (peripheral component interconnect, PCI for short) bus or an extended industry standard architecture (extended industry standard architecture) , Referred to as EISA) bus and so on.
- the communication line 740 can be divided into an address bus, a data bus, a control bus, and the like. For ease of presentation, only one thick line is used in FIG. 7, but it does not mean that there is only one bus or one type of bus.
- embodiments of the present invention also provide a non-transitory computer-readable storage medium.
- the non-transitory computer-readable storage medium stores computer instructions. When it runs on a computer, the computer executes the above-mentioned blocks. The processing method of chain transaction records.
- inventions of the present application provide a computer program product.
- the computer program product includes a calculation program stored on a non-transitory computer-readable storage medium.
- the computer program includes program instructions. When executed by a computer, the computer is caused to execute the above-mentioned blockchain transaction record processing method.
- These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
- the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
- These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
- the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Physics & Mathematics (AREA)
- Accounting & Taxation (AREA)
- General Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Finance (AREA)
- Strategic Management (AREA)
- General Business, Economics & Management (AREA)
- Software Systems (AREA)
- Computational Linguistics (AREA)
- Development Economics (AREA)
- Economics (AREA)
- Marketing (AREA)
- Technology Law (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
Description
状态表的表名 | 是否生成历史修改记录表 |
t_Balance | True |
t_member | True |
t_order | False |
Claims (19)
- 一种区块链交易记录的处理方法,其特征在于,所述方法包括:在区块链系统确认第一交易生效后,确定所述第一交易对应的第一状态表;所述第一状态表仅用于记录各交易账户最新的状态结果;将根据所述第一交易得到的第一状态结果,更新至所述第一状态表中的第一状态记录;所述第一状态记录用于记录所述第一交易对应的第一交易账户的最新的状态结果;确定所述第一状态表具有对应的第一历史修改记录表后,在所述第一历史修改记录表中新增所述第一交易对应的第一修改信息,所述第一修改信息中包括所述第一状态结果。
- 如权利要求1所述的方法,其特征在于,在所述确定所述第一交易对应的第一状态表之前,还包括:通过各交易类型对应的智能合约,创建各交易类型对应的状态表和历史修改记录表;所述确定所述第一交易对应的第一状态表,包括:根据所述第一交易的交易类型,确定所述第一状态表。
- 如权利要求1所述的方法,其特征在于,所述第一状态记录包括所述第一交易账户及当前块高,所述当前块高用于指示所述第一交易对应的区块的块高;所述第一修改信息还包括所述第一交易账户、所述当前块高和历史块高;所述历史块高用于指示所述第一交易账户的上一交易对应的区块的块高。
- 如权利要求3所述的方法,其特征在于,所述第一状态记录中还包括第一哈希关键值;所述第一哈希关键值是根据所述第一状态表的表名和所述第一交易账户确定的;所述第一修改信息还包括第二哈希关键值;所述第二哈希关键值是根据所述第一历史修改记录表的表名、所述第一交易账户和所述当前块高确定的。
- 如权利要求3所述的方法,其特征在于,所述方法还包括:接收交易查询指令,所述交易查询指令用于获取第二交易账户在指定块高时的状态结果;根据所述交易查询指令中的交易类型,确定所述交易查询指令对应的第二状态表;确定所述第二状态表中所述第二交易账户对应的第二状态记录中的当前块高;在所述指定块高小于所述第二状态记录中的当前块高时,从所述第二状态表对应的第二历史修改记录表中确定所述交易查询指令对应的状态结果。
- 如权利要求5所述的方法,其特征在于,所述从所述第二状态表对应的第二历史修改记录表中确定所述交易查询指令对应的状态结果,包括:确定所述第二历史修改记录表中所述第二交易账户对应的第二修改信息;所述第二修改信息中的当前块高为所述第二交易账户中各修改信息的当前块高中最接近所述指定块高的;所述最接近所述指定块高是指块高不大于所述指定块高的最大块高值;将所述第二修改信息中的第二状态结果确定为所述交易查询指令对应的状态结果。
- 如权利要求6所述的方法,其特征在于,所述确定所述第二历史修改记录表中所述第二交易账户对应的第二修改信息,包括:通过索引二分法、遍历法或跳表法查询所述第二历史修改记录表,确定所述第二交易账户对应的第二修改信息。
- 如权利要求5所述的方法,其特征在于,还包括:在所述指定块高不小于所述第二状态记录中的当前块高时,从所述第二状态表中确定所述第二交易账户对应的第二状态记录;将所述第二状态记录中的第三状态结果确定为所述交易查询指令对应的状态结果。
- 一种区块链交易记录的处理装置,其特征在于,所述装置包括:处理单元,用于在区块链系统确认第一交易生效后,确定所述第一交易对应的第一状态表;所述第一状态表仅用于记录各交易账户最新的状态结果;更新单元,用于将根据所述第一交易得到的第一状态结果,更新至所述第一状态表中的第一状态记录;所述第一状态记录用于记录所述第一交易对应的第一交易账户的最新的状态结果;所述更新单元,还用于确定所述第一状态表具有对应的第一历史修改记录表后,在所述第一历史修改记录表中新增所述第一交易对应的第一修改信息,所述第一修改信息中包括所述第一状态结果。
- 如权利要求9所述的装置,其特征在于,所述处理单元还用于:在所述确定所述第一交易对应的第一状态表之前,通过各交易类型对应的智能合约,创建各交易类型对应的状态表和历史修改记录表;所述处理单元具体用于:根据所述第一交易的交易类型,确定所述第一状态表。
- 如权利要求9所述的装置,其特征在于,所述第一状态记录包括所述第一交易账户及当前块高,所述当前块高用于指示所述第一交易对应的区块的块高;所述第一修改信息还包括所述第一交易账户、所述当前块高和历史块高;所述历史块高用于指示所述第一交易账户的上一交易对应的区块的块高。
- 如权利要求11所述的装置,其特征在于,所述第一状态记录中还包括第一哈希关键值;所述第一哈希关键值是根据所述第一状态表的表名和所述第一交易账户确定的;所述第一修改信息还包括第二哈希关键值;所述第二哈希关键值是根据所述第一历史修改记录表的表名、所述第一交易账户和所述当前块高确定的。
- 如权利要求11所述的装置,其特征在于,所述处理单元还用于:接收交易查询指令,所述交易查询指令用于获取第二交易账户在指定块高时的状态结果;根据所述交易查询指令中的交易类型,确定所述交易查询指令对应的第二状态表;确定所述第二状态表中所述第二交易账户对应的第二状态记录中的当前块高;在所述指定块高小于所述第二状态记录中的当前块高时,从所述第二状态表对应的第二历史修改记录表中确定所述交易查询指令对应的状态结果。
- 如权利要求13所述的装置,其特征在于,所述处理单元具体用于:确定所述第二历史修改记录表中所述第二交易账户对应的第二修改信息;所述第二修改信息中的当前块高为所述第二交易账户中各修改信息的当前块高中最接近所述指定块高的;所述最接近所述指定块高是指块高不大于所述指定块高的最大块高值;将所述第二修改信息中的第二状态结果确定为所述交易查询指令对应的状态结果。
- 如权利要求14所述的装置,其特征在于,所述处理单元具体用于:通过索引二分法、遍历法或跳表法查询所述第二历史修改记录表,确定所述第二交易账户对应的第二修改信息。
- 如权利要求13所述的装置,其特征在于,所述处理单元还用于:在所述指定块高不小于所述第二状态记录中的当前块高时,从所述第二状态表中确定所述第二交易账户对应的第二状态记录;将所述第二状态记录中的第三状态结果确定为所述交易查询指令对应的状态结果。
- 一种计算设备,其特征在于,包括处理器、存储器、通信接口,其中处理器、存储器与通信接口之间通过总线连接;所述处理器,用于读取所述存储器中的程序,执行权利要求1至8任一所述方法;所述存储器,用于存储一个或多个可执行程序,以及存储所述处理器在执行操作时所使用的数据。
- 一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求1至8任一所述方法。
- 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求1至8任一所述方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910740313.3A CN110471923B (zh) | 2019-08-12 | 2019-08-12 | 一种区块链交易记录的处理方法及装置 |
CN201910740313.3 | 2019-08-12 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2021027531A1 true WO2021027531A1 (zh) | 2021-02-18 |
Family
ID=68511440
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/104621 WO2021027531A1 (zh) | 2019-08-12 | 2020-07-24 | 一种区块链交易记录的处理方法及装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN110471923B (zh) |
WO (1) | WO2021027531A1 (zh) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110471923B (zh) * | 2019-08-12 | 2024-01-16 | 深圳前海微众银行股份有限公司 | 一种区块链交易记录的处理方法及装置 |
CN111161064A (zh) * | 2019-12-12 | 2020-05-15 | 深圳前海微众银行股份有限公司 | 一种区块链交易记录的处理方法及装置 |
CN111415229A (zh) * | 2020-04-21 | 2020-07-14 | 昆明大棒客科技有限公司 | 基于区块链的电子商务交易方法、装置和设备 |
CN113256419B (zh) * | 2021-05-21 | 2022-09-02 | 上海简苏网络科技有限公司 | 一种区块链交易检索方法及系统 |
CN113468224A (zh) * | 2021-09-03 | 2021-10-01 | 支付宝(杭州)信息技术有限公司 | 在区块链中存储及查询状态数据、执行交易的方法及装置 |
CN113505138B (zh) * | 2021-09-06 | 2021-12-21 | 支付宝(杭州)信息技术有限公司 | 区块链系统中状态证明及执行区块的方法及装置 |
CN113961568A (zh) * | 2021-12-22 | 2022-01-21 | 南京金宁汇科技有限公司 | 基于区块链的链式数据结构的区块快速查找方法 |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170140375A1 (en) * | 2015-11-15 | 2017-05-18 | Michael Kunstel | System and Method for Permissioned Distributed Block Chain |
CN106934619A (zh) * | 2017-03-13 | 2017-07-07 | 杭州复杂美科技有限公司 | 一种交易记录的方法及系统 |
CN109063016A (zh) * | 2018-07-11 | 2018-12-21 | 物数(上海)信息科技有限公司 | 区块链数据储存方法、装置、电子设备、存储介质 |
CN109447791A (zh) * | 2018-11-09 | 2019-03-08 | 北京邮电大学 | 一种基于区块链的资金交易方法及装置 |
CN110096522A (zh) * | 2019-05-15 | 2019-08-06 | 西安电子科技大学 | 一种支持关系型检索的区块链数据处理方法、装置及设备 |
CN110471923A (zh) * | 2019-08-12 | 2019-11-19 | 深圳前海微众银行股份有限公司 | 一种区块链交易记录的处理方法及装置 |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10922692B2 (en) * | 2017-04-05 | 2021-02-16 | Samsung Sds Co., Ltd. | Method for calculating confirmation reliability for blockchain based transaction and blockchain network monitoring system for performing the method |
CN108282474B (zh) * | 2018-01-18 | 2020-04-17 | 山东大学 | 基于区块链的数字资产交易一致性的维护方法 |
CN110008233A (zh) * | 2019-03-31 | 2019-07-12 | 杭州复杂美科技有限公司 | 一种信息查询和共识方法、系统、设备及存储介质 |
-
2019
- 2019-08-12 CN CN201910740313.3A patent/CN110471923B/zh active Active
-
2020
- 2020-07-24 WO PCT/CN2020/104621 patent/WO2021027531A1/zh active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170140375A1 (en) * | 2015-11-15 | 2017-05-18 | Michael Kunstel | System and Method for Permissioned Distributed Block Chain |
CN106934619A (zh) * | 2017-03-13 | 2017-07-07 | 杭州复杂美科技有限公司 | 一种交易记录的方法及系统 |
CN109063016A (zh) * | 2018-07-11 | 2018-12-21 | 物数(上海)信息科技有限公司 | 区块链数据储存方法、装置、电子设备、存储介质 |
CN109447791A (zh) * | 2018-11-09 | 2019-03-08 | 北京邮电大学 | 一种基于区块链的资金交易方法及装置 |
CN110096522A (zh) * | 2019-05-15 | 2019-08-06 | 西安电子科技大学 | 一种支持关系型检索的区块链数据处理方法、装置及设备 |
CN110471923A (zh) * | 2019-08-12 | 2019-11-19 | 深圳前海微众银行股份有限公司 | 一种区块链交易记录的处理方法及装置 |
Also Published As
Publication number | Publication date |
---|---|
CN110471923B (zh) | 2024-01-16 |
CN110471923A (zh) | 2019-11-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2021027531A1 (zh) | 一种区块链交易记录的处理方法及装置 | |
WO2021077962A1 (zh) | 一种区块链节点同步的方法及装置 | |
WO2021068728A1 (zh) | 一种区块的状态树的生成和链上数据验证的方法及装置 | |
TWI677228B (zh) | 向區塊鏈系統中寫入事務資料的方法和裝置 | |
TWI679547B (zh) | 區塊鏈業務受理及業務共識方法及裝置 | |
TWI718375B (zh) | 基於區塊鏈的資料處理方法及設備 | |
TWI712976B (zh) | 資產管理系統、方法及裝置、電子設備 | |
WO2018177235A1 (zh) | 一种区块链共识方法及装置 | |
WO2020215925A1 (zh) | 一种基于区块链的事件订阅的方法及装置 | |
CN111898139B (zh) | 数据读写方法及装置、电子设备 | |
CN106649828B (zh) | 一种数据查询方法及系统 | |
WO2016019803A1 (zh) | 基于分布式内存和数据库的数据处理方法、装置和系统 | |
WO2020125233A1 (zh) | 字段更新方法及装置、电子设备 | |
TW201822033A (zh) | 資源處理方法及裝置 | |
WO2020015533A1 (zh) | 交易处理方法、装置及区块链系统 | |
WO2020248982A1 (zh) | 一种区块链中交易处理的方法及装置 | |
TWI716016B (zh) | 分散式資料連接處理方法、裝置、設備及儲存媒體 | |
TW202121268A (zh) | 風險預測和風險預測模型的訓練方法、裝置及電子設備 | |
WO2021115002A1 (zh) | 一种区块链交易记录的处理方法及装置 | |
WO2021057482A1 (zh) | 一种区块链中布隆过滤器的生成方法及装置 | |
WO2021051782A1 (zh) | 区块链的共识方法、装置及设备 | |
CN110555038A (zh) | 一种数据处理系统、方法及装置 | |
WO2021057127A1 (zh) | 一种基于多条业务属性的数据存储方法、装置及设备 | |
CN107153680B (zh) | 一种分布式内存数据库在线扩展节点的方法及系统 | |
WO2020155788A1 (zh) | 一种数据确定方法、装置、设备及介质 |
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: 20851627 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: 20851627 Country of ref document: EP Kind code of ref document: A1 |
|
32PN | Ep: public notification in the ep bulletin as address of the adressee cannot be established |
Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 05.08.2022) |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20851627 Country of ref document: EP Kind code of ref document: A1 |