WO2021057165A1 - 在区块链中并发执行交易的方法和装置 - Google Patents

在区块链中并发执行交易的方法和装置 Download PDF

Info

Publication number
WO2021057165A1
WO2021057165A1 PCT/CN2020/100486 CN2020100486W WO2021057165A1 WO 2021057165 A1 WO2021057165 A1 WO 2021057165A1 CN 2020100486 W CN2020100486 W CN 2020100486W WO 2021057165 A1 WO2021057165 A1 WO 2021057165A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
version
variable
read
write
Prior art date
Application number
PCT/CN2020/100486
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 WO2021057165A1 publication Critical patent/WO2021057165A1/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
    • 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • 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
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • 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

Definitions

  • the embodiments of this specification relate to the field of blockchain technology, and more specifically, to a method and device for concurrently executing multiple transactions in a blockchain.
  • Blockchain technology is built on a peer-to-peer (P2P) network. It uses a chained data structure to verify and store data, uses a distributed node consensus algorithm to generate and update data, and uses cryptography to ensure the security of data transmission and access.
  • a new distributed infrastructure and computing paradigm that uses smart contracts composed of automated script codes to program and manipulate data.
  • Blockchain technology also known as distributed ledger technology, is a decentralized distributed database technology, which is characterized by decentralization, openness and transparency, non-tampering, and trustworthiness. Every piece of data in the blockchain will be broadcast to the blockchain nodes of the entire network, and each full node has a full amount of consistent data.
  • the nodes in the blockchain conduct transactions such as transfers and deposit data by sending transactions.
  • the accounting nodes in the blockchain collect transactions in the blockchain in the transaction pool, execute the transactions, and execute the transactions After that, these transactions are packaged into blocks and spread to the blockchain.
  • the verification node in the blockchain will verify the block sent from the accounting node. After the verification is passed, each node will execute each transaction included in the block when it receives the block. In order to ensure the data consistency of each node, when multiple transactions in the block are executed in each node, the order of submission of the multiple transactions needs to be consistent, so that consistent execution results can be obtained.
  • the accounting node before executing the transaction, the accounting node will number multiple transactions to be executed according to predetermined rules, and execute multiple transactions in sequence in the order of the numbers, that is, submit multiple transactions in turn, and other After receiving the block, the node also executes and submits the multiple transactions in sequence according to the above-mentioned transaction number sequence.
  • the multiple transactions are not necessarily mutually dependent. In the case where there is no dependency between the two transactions, concurrent execution of the two transactions does not affect the final result. And if there are dependencies between two transactions executed concurrently, the concurrent execution will affect the final result.
  • the embodiments of this specification aim to provide a more effective solution for concurrently executing transactions in the blockchain.
  • one aspect of this specification provides a method for concurrently executing multiple transactions in a blockchain, wherein the multiple transactions have a predetermined submission order, including the first transaction, and the method is in the block chain.
  • the shared memory of the first node currently records multiple write versions corresponding to the first variable, and each write version corresponds to the first variable of one transaction pair in the multiple transactions
  • the write version includes the transaction number corresponding to the write operation and the write value of the write operation
  • the method includes: determining whether there is a first write version among the plurality of write versions , The first written version corresponds to the write operation of the previous transaction to the first variable, wherein the previous transaction is a transaction with a transaction number smaller than the first transaction among the plurality of transactions, wherein, The transaction number corresponds to the submission sequence of the transaction; and based on the determination result, the read operation of the first variable in the first transaction is performed.
  • performing a read operation on the first variable in the first transaction includes, in a case where it is determined that the first written version does not exist in the plurality of written versions, reading The initial value of the first variable.
  • performing a read operation on the first variable in the first transaction includes, in a case where it is determined that there is at least one first written version among the plurality of written versions, from The second writing version is determined in the at least one first writing version, and the value of the first variable is read from the written value in the second writing version, wherein the transaction corresponding to the second writing version is the At least one first written version corresponds to at least one transaction with the largest transaction number among at least one transaction.
  • the method further includes: After the variable read operation, in the case that there is no read version corresponding to the first transaction among the plurality of read versions, the first read version corresponding to the first transaction is added to the shared memory, and the first read The version includes the transaction number of the first transaction and the source of the value of the first variable.
  • the method further includes, in the case where the read version corresponding to the first transaction is already included in the plurality of read versions, based on the source of the value of the first variable, comparing the first transaction with the first transaction. The read version corresponding to the transaction is modified accordingly.
  • the source of the first variable value is the transaction number in the read version.
  • the plurality of transactions further includes a second transaction
  • the second transaction includes a write operation to the first variable
  • the transaction number of the second transaction is smaller than the first transaction
  • the transaction number of the second transaction is smaller than that of the first transaction.
  • the writing operation is performed after the first reading version corresponding to the first transaction is added to the variable reading table
  • the method further includes: after performing the writing operation, based on the first reading version, Determine whether the read operation in the first transaction needs to be re-executed; in the case where it is determined that the read operation in the first transaction needs to be re-executed, notify the local to re-execute the reading of the first variable in the first transaction operating.
  • determining whether the read operation in the first transaction needs to be re-executed includes determining whether the source of the value of the first variable in the first read version corresponds to For transactions whose serial number is less than or equal to the second transaction or corresponding to the initial value of the first variable.
  • the write version further includes the number of write operations of the corresponding transaction to the first variable
  • the source of the value of the first variable in the read version includes the read version in the write version.
  • the transaction number and the number of writes, where after the write operation is performed, based on the first read version, determining whether the read operation in the first transaction needs to be re-executed includes, after submitting the second transaction, Determine whether the source of the value of the first variable in the first reading version satisfies any one of the following: corresponding to the initial value of the first variable, the transaction number is less than the transaction number of the second transaction, and the transaction number is equal to the second transaction The transaction number and the writing times are less than the writing times of the writing operation in the second transaction.
  • the written version and the read version corresponding to the second transaction are recorded in the data set of the first variable corresponding to the second transaction
  • the method further includes: After the second transaction, indicate in the data set corresponding to the second transaction: the second transaction has been submitted, and the data set corresponding to the third transaction will be deleted, wherein the third transaction is based on the transaction number before the second transaction A transaction.
  • the method further includes, after performing the write operation, in the case that there is no write version corresponding to the second transaction among the multiple write versions, adding a second transaction to the shared memory. 2. The written version corresponding to the transaction.
  • the method further includes, in a case where the write version corresponding to the second transaction is already included in the plurality of write versions, modifying the write value of the write operation of the second transaction based on The written version corresponding to the second transaction.
  • Another aspect of this specification provides a device for concurrently executing multiple transactions in a blockchain, wherein the multiple transactions have a predetermined submission sequence, including the first transaction, and the device is deployed in the blockchain.
  • the first node a plurality of written versions corresponding to the first variable are currently recorded in the shared memory of the first node, and each written version corresponds to a write operation of one transaction in the plurality of transactions to the first variable
  • the writing version includes the transaction number corresponding to the writing operation and the writing value of the writing operation
  • the device includes: a first determining unit configured to determine whether in the multiple writing versions There is a first written version, and the first written version corresponds to a write operation of a previous transaction to the first variable, wherein the previous transaction is one of the plurality of transactions whose transaction number is less than that of the first transaction A transaction, wherein the transaction number corresponds to the order of submission of the transaction; and the execution unit is configured to execute a read operation of the first variable in the first transaction based on the determination result.
  • the first determining unit is further configured to read the initial value of the first variable when it is determined that the first written version does not exist in the plurality of written versions.
  • the execution unit is further configured to determine a second write version from the at least one first write version in a case where it is determined that there is at least one first write version among the plurality of write versions, And read the value of the first variable from the written value in the second write version, where the transaction corresponding to the second write version is the largest transaction number in the at least one transaction corresponding to the at least one first write version Transactions.
  • the device further includes a first adding unit configured to execute the first After the read operation on the first variable in the transaction, if there is no read version corresponding to the first transaction among the multiple read versions, the first transaction corresponding to the first transaction is added to the shared memory.
  • a read version where the first read version includes the transaction number of the first transaction and the source of the value of the first variable.
  • the device further includes a first modification unit configured to, in a case where the read version corresponding to the first transaction is included in the plurality of read versions, based on the value of the first variable The source of is modified accordingly to the read version corresponding to the first transaction.
  • the plurality of transactions further includes a second transaction
  • the second transaction includes a write operation to the first variable
  • the transaction number of the second transaction is smaller than the first transaction
  • the transaction number of the second transaction is smaller than that of the first transaction.
  • the writing operation is performed after the first reading version corresponding to the first transaction is added to the variable reading table
  • the device further includes: a second determining unit configured to, after the writing operation is performed, Based on the first read version, it is determined whether the read operation in the first transaction needs to be re-executed; the notification unit is configured to notify the local re-execution when it is determined that the read operation in the first transaction needs to be re-executed Perform a read operation on the first variable in the first transaction.
  • the second determining unit is further configured to determine whether the source of the value of the first variable in the first read version corresponds to a transaction whose serial number is less than or equal to the second transaction or corresponds to the first transaction. The initial value of the variable.
  • the write version further includes the number of write operations of the corresponding transaction to the first variable
  • the source of the value of the first variable in the read version includes the read version in the write version.
  • Transaction number and write times wherein the second determining unit is further configured to, after submitting the second transaction, determine whether the source of the value of the first variable in the first read version satisfies any of the following One item: corresponding to the initial value of the first variable, the transaction number is less than the transaction number of the second transaction, the transaction number is equal to the transaction number of the second transaction, and the number of writes is less than the number of writes of the write operation in the second transaction .
  • the written version and the read version corresponding to the second transaction are recorded in the data set of the first variable corresponding to the second transaction
  • the device further includes a marking unit configured to , After submitting the second transaction, indicate in the data set corresponding to the second transaction: the second transaction has been submitted, and the deletion unit is configured to delete the data set corresponding to the third transaction, where The third transaction is the transaction before the second transaction based on the transaction number.
  • the device further includes a second adding unit configured to, after performing the write operation, in the case that there is no written version corresponding to the second transaction among the plurality of written versions, The written version corresponding to the second transaction is added to the shared memory.
  • the device further includes a second modification unit configured to, in a case where the written version corresponding to the second transaction is already included in the plurality of written versions, based on the all the written version of the second transaction.
  • the written value of the write operation modifies the written version corresponding to the second transaction.
  • Another aspect of this specification provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed in a computer, the computer is caused to execute any of the above methods.
  • Another aspect of this specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, any one of the above methods is implemented.
  • the read-write version corresponding to each variable is recorded in the shared memory, and the read-write operation is performed based on the read-write version, so that there is no mutual Dependent multiple transactions can be executed concurrently.
  • transaction conflicts can be avoided based on the read-write version, so as to ensure the consistency of calculation results while speeding up the processing speed and improving Improved processing performance.
  • Fig. 1 shows a schematic diagram of a blockchain system according to an embodiment of the present specification.
  • Fig. 2 shows a schematic diagram of a memory structure in a blockchain node according to an embodiment of the present specification.
  • Fig. 3 shows a flow chart of reading variable k1 in executing transaction n.
  • Fig. 4 schematically shows a flowchart of a method for concurrently executing multiple transactions in a blockchain according to an embodiment of the present specification.
  • Fig. 5 shows a device 5000 for concurrently executing multiple transactions in a blockchain according to an embodiment of the present specification.
  • Fig. 1 shows a schematic diagram of a blockchain system according to an embodiment of the present specification.
  • the system includes multiple nodes (six nodes are schematically shown in the figure) constituting a blockchain, and these nodes are connected in pairs, including node 11, node 12, and node 13, for example.
  • some nodes collect multiple transactions in the blockchain and put them into the transaction pool and compete for the right to keep accounts.
  • the node 11 in the figure becomes a billing node by acquiring the billing right.
  • node 11 becomes an accounting node, it will execute multiple transactions in its transaction pool, package the multiple transactions into blocks and send them to other nodes, for example, to node 12.
  • the node 12 will verify the block and execute multiple transactions in the block in the same way. After a predetermined number of nodes verify the block, that is, a consensus on the block is reached, other nodes in the blockchain (such as node 13) will not need to continue to verify the block, but directly The transactions in this block are executed to update local related data.
  • the multiple transactions may involve the calculation of multiple variables.
  • the order of execution will not affect the final calculation result, and the same variables are involved in the two transactions.
  • the execution order will affect the final calculation result. Therefore, in the embodiments of this specification, in order to ensure that the execution results of multiple transactions by each node are the same, the entry of each variable is recorded in the shared memory of each node. In the variable entry, the variable entry of each transaction is recorded. Read and write operations.
  • Fig. 2 shows a schematic diagram of a memory structure in a blockchain node according to an embodiment of the present specification.
  • the memory of the node includes two levels of buffers: the first level of buffer L1 and the second level of buffer L2.
  • the buffer L1 corresponds only to the thread that executes the transaction.
  • the buffer L1 in Figure 2 is the exclusive buffer for the thread that executes the transaction 3, and it records the reading of the variable by the thread 3 in the process of executing the transaction 3.
  • L1 includes a write table and a read table, where k1W2 and k5W8 are recorded in the write table, indicating that k1 was written for the second time, k5 was written for the eighth time, and k5 was written for the eighth time.
  • the table records k2_7.1 and k3_0, which respectively indicate that the first write of transaction 7 to variable k2 has been read, and the initial value of k3 has been read.
  • the buffer L2 is shared memory, that is, multiple threads executing concurrently can access the buffer L2.
  • the buffer L2 includes entries corresponding to various variables.
  • the entries of variable k1 include TN4P, TN3P, TN2P, and TN1, where TN4P, TN3P, TN2P, and TN1 are data corresponding to each transaction.
  • the right side of L2 in Figure 2 schematically shows the composition of the data set, which includes at least a write version and a read version.
  • the data set may also include a submission flag, which is used to indicate whether the transaction corresponding to the data set is submitted. For example, the initial value of the flag is 0, and the flag is modified to 1 after the corresponding transaction is submitted.
  • a data set corresponding to transaction 3 is added to the entry, and the written version of the data set is, for example, 3W1 ⁇ 12>, where 3 represents transaction 3, and 1 represents the first write , 12 represents the written value.
  • the write version in the data set corresponding to transaction 3 can be modified to 3W2 ⁇ 10>.
  • the read version in the data set can be changed from the default value (such as "-1") to 3R1.2, which means that transaction 3 reads the second write of transaction 1 k1 value.
  • variable entries shown in FIG. 2 are merely illustrative, and are not used to limit the scope of the embodiments of the present specification.
  • only the write version may be included in the variable entry. Therefore, when the read operation in the transaction is performed, the read operation can be performed by judging whether the concurrently executed transaction with the previous number has performed the write operation based on the write version. , And when executing the write operation of the transaction, you can notify all the transactions with the later number, so that all the transactions with the later number that have performed the read operation will re-execute the read operation.
  • only the read version may be included in the variable access table. Therefore, when the read operation in the transaction is performed, it can be directly performed. When the write operation of the transaction is performed, the number later can be judged based on the read version. Whether the transactions executed at the same time perform the read operation, and notify the transaction that performed the read operation to re-execute the read operation after submission.
  • Fig. 3 shows a flow chart of reading variable k1 in executing transaction n.
  • thread n first determines whether k1 is included in the write table of L1, that is, it determines from L1 whether it has written to k1 before, and if it is written, in step 302, it returns the value of k1 in the write table, that is, , The written value is regarded as the read value of k1.
  • step 303 it is determined whether k1 is included in the reading table of L1, that is, it is determined from L1 whether it has read k1 before, if it has been read . Then in step 304, the k1 value in the meter reading is returned, that is, the previous read value is used as the read value of k1. If it is determined that thread 3 has not read k1 before, it is determined in step 305 whether k1 is included in L2, and if it is included, in step 306, it is determined whether there is a data set smaller than n in k1 in FIG. 2 from the entries in k1.
  • step 307 the k1 value of the first determined write version is returned as the read value. If it has not been written, then in step 308, from memory or persistent Read the initial value of k1 in the memory (for example rocksDB) as the read value.
  • thread n executes the write k1 in transaction n, after executing the write, thread n can determine whether there is a read operation that needs to be reread through the read version recorded in L2.
  • the read-write version is not limited to the above-mentioned specific form.
  • R and W are not required in the version, and the number of writes may not be required in the version when a predetermined operation is guaranteed, and so on.
  • the process of concurrently executing transactions according to the embodiments of the present specification will be described in detail.
  • Fig. 4 schematically shows a flow chart of a method for concurrently executing multiple transactions in a blockchain according to an embodiment of the present specification, wherein the multiple transactions have a predetermined submission order, including the first transaction, the The method is executed on the first node in the blockchain, and multiple written versions corresponding to the first variable are currently recorded in the shared memory of the first node, and each written version corresponds to one of the multiple transactions
  • the execution of the write operation of the first variable, the write version includes the transaction number corresponding to the write operation and the write value of the write operation, and the method includes:
  • Step S402 Determine whether there is a first written version among the multiple written versions, the first written version corresponding to the write operation of the first variable by the previous transaction, wherein the previous transaction is the Among the multiple transactions, the transaction number is smaller than the first transaction, wherein the transaction number corresponds to the order of submission of the transaction;
  • Step S404 based on the determination result, execute a read operation on the first variable in the first transaction.
  • step S402 it is determined whether there is a first written version among the multiple written versions, and the first written version corresponds to the write operation of the first variable by the previous transaction, wherein the previous transaction It is a transaction whose transaction number is smaller than the first transaction among the plurality of transactions, wherein the transaction number corresponds to the order of submission of the transaction.
  • this method is executed on a node in the blockchain.
  • the node packs a block, or after the node receives a newly generated block, it will execute and submit multiple related transactions.
  • a block may include thousands of transactions, and these thousands of transactions may involve hundreds of variables. Among them, multiple transactions may access different variables, or multiple transactions may access the same variable.
  • the respective transaction numbers of multiple transactions to be packaged into a block have been determined according to predetermined rules, and the order of the transaction numbers indicates the execution order and submission order of the transactions.
  • the predetermined submission order is reserved for multiple transactions in the block, that is, the serial number sequence of each transaction is taken as the order of submission.
  • the respective submission order is based on the variable entries recorded in each node, so that each transaction without a dependency relationship can be executed concurrently, and each transaction with a dependency relationship can avoid transaction conflicts. Among them, for the sequentially numbered transaction 1 and transaction 2. If the first variable is written in transaction 1 and the first variable is read in transaction 2, transaction 2 depends on the result of transaction 1.
  • the entry of each variable is recorded in the shared memory (ie L2 in Figure 2).
  • the variable k1 in Figure 2 is the first variable, and the variable k1 corresponds to each transaction.
  • the data set may include the written version corresponding to the transaction.
  • the format of the write version is, for example, nW ⁇ xxx>, where n is the transaction number for executing the write, W represents the write, and "xxx" is the write value of the write operation.
  • the specific form of the written version is not limited to this form, as long as it includes the transaction number and the written value.
  • the form of the written version is, for example, nWu ⁇ xxx>, where u represents the number of writes to the variable k1 of transaction n.
  • L2 has a value that can be read. That is, among the multiple writing versions recorded in L2 corresponding to k1, it is determined whether there is a writing version with a transaction number less than n, that is, it is determined whether there is a transaction before transaction n that has written k1.
  • the transaction number corresponds to the submission sequence of the transaction, and the higher the submission sequence, the smaller the transaction number.
  • step S404 based on the determination result, execute the read operation of the first variable in the first transaction.
  • the value of k1 is read from the write version with the largest transaction number among the write versions with a transaction number less than n.
  • the entry corresponding to k1 includes the write version: 1W2 ⁇ 12>, 2W1 ⁇ 10>, and 4W1 ⁇ 23>, where the transaction number is less than n
  • the written version has 1W2 ⁇ 12> and 2W1 ⁇ 10>, and the written value in the write version with the largest transaction number (that is, 10) is taken as the read value of this read.
  • the initial value of the variable k1 is read from the memory or persistent storage (for example, rocksdb) as the read value.
  • the data set in the entry of each variable in the L2 may also include a read version corresponding to the corresponding transaction.
  • the form of the read version is, for example, mRq
  • q is a natural number, which means that transaction m reads the value written in transaction q into k1.
  • the read version is in the form of mRq.p, for example, indicating that transaction m reads the value written by transaction q for the pth time.
  • the read version is in the form of mR0.
  • the data set corresponding to transaction n in the entry of k1 will include nW ⁇ xxx>.
  • the data set corresponding to transaction n in the entry of k1 will include nWu ⁇ xxx>.
  • nWu ⁇ xxx> there is no need to detect the read version immediately after the writing of transaction n.
  • m>n and q ⁇ n indicate that the transaction corresponding to the read version reads the value written by the wrong transaction
  • m>n indicates that the transaction corresponding to the read version reads the correct value
  • the write version 2W1 ⁇ 22> is recorded.
  • the read version corresponding to k1 includes 3R1. 1. It can be determined that transaction 3 reads the first write of transaction 1 to variable k1 ahead of time, so transaction 3 needs to be withdrawn.
  • the write version 2W2 ⁇ 22> is recorded.
  • transaction 2 is submitted, by querying the read version corresponding to k1, it is determined that the read version corresponding to k1 includes 3R2.1, Therefore, it can be determined that transaction 3 has read the first write of transaction 2 to variable k1 ahead of time, so transaction 3 needs to be withdrawn.
  • the local transaction scheduler can be used to re-execute the read operation and related subsequent operations in the first transaction, or if the first transaction is executed
  • the thread of is unchanged, and can be marked in the private storage space of the thread to notify the thread to perform the reread operation.
  • the submission flag in the data set corresponding to the submitted transaction n in the entry corresponding to the variable k1 is modified to 1, and the entry corresponding to the variable k1 can be changed to the submitted transaction n
  • the data set corresponding to -1 is deleted.
  • FIG. 5 shows a device 5000 for concurrently executing multiple transactions in a blockchain according to an embodiment of the present specification, wherein the multiple transactions have a predetermined submission order, including the first transaction, and the device is deployed In the first node in the blockchain, multiple written versions corresponding to the first variable are currently recorded in the shared memory of the first node, and each written version corresponds to a transaction pair in the multiple transactions
  • the execution of the writing operation of the first variable, the writing version including the transaction number corresponding to the writing operation and the writing value of the writing operation, the device has the following units.
  • the first determining unit 501 is configured to determine whether there is a first written version among the multiple written versions, and the first written version corresponds to a write operation to the first variable by a previous transaction, wherein the The previous transaction is a transaction with a transaction number smaller than the first transaction among the plurality of transactions, wherein the transaction number corresponds to the order of transaction submission; and the execution unit 502 is configured to execute the first transaction based on the determination result A read operation on the first variable in a transaction.
  • the first determining unit is further configured to read the initial value of the first variable when it is determined that the first written version does not exist in the plurality of written versions.
  • the execution unit 502 is further configured to determine a second write version from the at least one first write version in a case where it is determined that there is at least one first write version among the plurality of write versions , And read the value of the first variable from the value written in the second writing version, where the transaction corresponding to the second writing version is the transaction number in at least one transaction corresponding to the at least one first writing version The biggest deal.
  • the device further includes a first adding unit 503, configured to: After the read operation of the first variable in a transaction, in the case that there is no read version corresponding to the first transaction among the plurality of read versions, the first transaction corresponding to the first transaction is added to the shared memory.
  • the first reading version the first reading version includes the transaction number of the first transaction and the source of the value of the first variable.
  • the device further includes a first modifying unit 504 configured to, in the case that the read version corresponding to the first transaction is included in the plurality of read versions, the value based on the first variable The source of the value is modified accordingly to the read version corresponding to the first transaction.
  • a first modifying unit 504 configured to, in the case that the read version corresponding to the first transaction is included in the plurality of read versions, the value based on the first variable The source of the value is modified accordingly to the read version corresponding to the first transaction.
  • the plurality of transactions further includes a second transaction
  • the second transaction includes a write operation to the first variable
  • the transaction number of the second transaction is smaller than the first transaction
  • the transaction number of the second transaction is smaller than that of the first transaction.
  • the writing operation is performed after the first reading version corresponding to the first transaction is added to the variable reading table
  • the device further includes: a second determining unit 505, configured to, after performing the writing operation , Based on the first read version, determine whether the read operation in the first transaction needs to be re-executed; the notification unit 506 is configured to notify when it is determined that the read operation in the first transaction needs to be re-executed Re-execute the read operation of the first variable in the first transaction locally.
  • the second determining unit is further configured to determine whether the source of the value of the first variable in the first read version corresponds to a transaction whose serial number is less than or equal to the second transaction or corresponds to the first transaction. The initial value of the variable.
  • the write version further includes the number of write operations of the corresponding transaction to the first variable
  • the source of the value of the first variable in the read version includes the read version in the write version.
  • Transaction number and write times wherein the second determining unit is further configured to, after submitting the second transaction, determine whether the source of the value of the first variable in the first read version satisfies any of the following One item: corresponding to the initial value of the first variable, the transaction number is less than the transaction number of the second transaction, the transaction number is equal to the transaction number of the second transaction, and the number of writes is less than the number of writes of the write operation in the second transaction .
  • the written version and the read version corresponding to the second transaction are recorded in the data set of the first variable corresponding to the second transaction.
  • the device further includes a marking unit 507, which is configured to After submitting the second transaction, it is indicated in the data set corresponding to the second transaction: the second transaction has been submitted, and the deletion unit 508 is configured to delete the data set corresponding to the third transaction, wherein , The third transaction is the transaction before the second transaction according to the transaction number.
  • the device further includes a second adding unit 509 configured to, after performing the writing operation, in the case that there is no writing version corresponding to the second transaction among the plurality of writing versions, The written version corresponding to the second transaction is added to the shared memory.
  • a second adding unit 509 configured to, after performing the writing operation, in the case that there is no writing version corresponding to the second transaction among the plurality of writing versions, The written version corresponding to the second transaction is added to the shared memory.
  • the device further includes a second modification unit 510 configured to, in the case where the written version corresponding to the second transaction is already included in the plurality of written versions, the data based on the second transaction The written value of the write operation modifies the written version corresponding to the second transaction.
  • Another aspect of this specification provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed in a computer, the computer is caused to execute any of the above methods.
  • Another aspect of this specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, any one of the above methods is implemented.
  • the read-write version corresponding to each variable is recorded in the shared memory, and the read-write operation is performed based on the read-write version, so that there is no mutual Dependent multiple transactions can be executed concurrently.
  • transaction conflicts can be avoided based on the read-write version, so as to ensure the consistency of calculation results while speeding up the processing speed and improving Improved processing performance.
  • the steps of the method or algorithm described in combination with the embodiments disclosed in this document can be implemented by hardware, a software module executed by a processor, or a combination of the two.
  • the software module can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or all areas in the technical field. Any other known storage media.

Abstract

本说明书实施例提供了一种在区块链中并发执行多个交易的方法和装置,其中,所述多个交易具有预定的提交顺序,其中包括第一交易,所述方法在区块链中的第一节点执行,所述第一节点的共享内存中当前记录有与第一变量对应的多个写版本,每个写版本对应于所述多个交易中的一个交易对第一变量的写操作的执行,所述写版本中包括与所述写操作对应的交易编号和该写操作的写入值,所述方法包括:确定在所述多个写版本中是否存在第一写版本,所述第一写版本对应于在前交易对所述第一变量的写操作,其中,所述在前交易为所述多个交易中交易编号小于所述第一交易的交易,其中,所述交易编号对应于交易的提交顺序;以及基于所述确定结果,执行第一交易中的对所述第一变量的读操作。

Description

在区块链中并发执行交易的方法和装置 技术领域
本说明书实施例涉及区块链技术领域,更具体地,涉及一种在区块链中并发执行多个交易的方法和装置。
背景技术
区块链技术是构建在点对点(P2P)网络上,利用链式数据结构来验证与存储数据,利用分布式节点共识算法来生成和更新数据,利用密码学的方式保证数据传输和访问的安全,利用由自动化脚本代码组成的智能合约来编程和操作数据的一种全新的分布式基础架构与计算范式。区块链技术也被称之为分布式账本技术,是一种去中心化的分布式数据库技术,其特点是去中心化、公开透明、不可篡改、可信任。区块链的每笔数据,都会广播到全网的区块链节点,每个全节点都有全量的、一致的数据。区块链中的节点通过发送交易而进行转账、存入数据等业务,区块链中的记账节点在交易池中收集区块链中的交易,执行所述交易,并在执行所述交易之后,将这些交易打包到区块中并扩散到区块链中。区块链中的验证节点会对从记账节点发出的区块进行验证,在验证通过之后,每个节点在接收到该区块时,都会执行该区块中包括的每个交易。为了保证各个节点的数据一致性,各个节点中在执行区块中的多个交易时,对该多个交易的提交顺序需要是一致的,这样才能得到一致的执行结果。因此,在现有技术中,记账节点在执行交易之前会按照预定规则对将要执行的多个交易进行编号,并按照编号的顺序依次执行多个交易,也即依次提交多个交易,并且其它节点在接收到该区块之后,也是按照上述交易编号顺序依次执行并提交所述多个交易。然而,所述多个交易并不一定都是相互依赖的,在两个交易之间不存在依赖性的情况中,并发执行这两个交易并不影响最终的结果。而如果并发执行的两个交易存在依赖性,则该并发执行将影响到最终的结果。
因此,需要一种更有效的在区块链中并发执行多个交易的方法。
发明内容
本说明书实施例旨在提供一种更有效的在区块链中并发执行交易的方案。
为实现上述目的,本说明书一个方面提供一种在区块链中并发执行多个交易的方法,其中,所述多个交易具有预定的提交顺序,其中包括第一交易,所述方法在区块链 中的第一节点执行,所述第一节点的共享内存中当前记录有与第一变量对应的多个写版本,每个写版本对应于所述多个交易中的一个交易对第一变量的写操作的执行,所述写版本中包括与所述写操作对应的交易编号和该写操作的写入值,所述方法包括:确定在所述多个写版本中是否存在第一写版本,所述第一写版本对应于在前交易对所述第一变量的写操作,其中,所述在前交易为所述多个交易中交易编号小于所述第一交易的交易,其中,所述交易编号对应于交易的提交顺序;以及基于所述确定结果,执行第一交易中的对所述第一变量的读操作。
在一个实施例中,基于所述确定结果,执行第一交易中的对所述第一变量的读操作包括,在确定所述多个写版本中不存在第一写版本的情况中,读取所述第一变量的初始值。
在一个实施例中,基于所述确定结果,执行第一交易中的对所述第一变量的读操作包括,在确定所述多个写版本中存在至少一个第一写版本的情况中,从所述至少一个第一写版本中确定第二写版本,并从第二写版本中的写入值读取所述第一变量的值,其中,所述第二写版本对应的交易为所述至少一个第一写版本对应的至少一个交易中交易编号最大的交易。
在一个实施例中,其中,所述第一节点的共享内存中当前还记录有与第一变量对应的多个读版本,所述方法还包括,在执行第一交易中的对所述第一变量的读操作之后,在所述多个读版本中没有与第一交易对应的读版本的情况中,在所述共享内存中增加与第一交易对应的第一读版本,所述第一读版本包括第一交易的交易编号和所述第一变量的值的来源。
在一个实施例中,所述方法还包括,在所述多个读版本中已经包括与第一交易对应的读版本的情况中,基于所述第一变量的值的来源,对该与第一交易对应的读版本相应地修改。
在一个实施例中,所述第一变量值的来源为所读取的写版本中的交易编号。
在一个实施例中,所述多个交易中还包括第二交易,所述第二交易中包括对所述第一变量的写操作,所述第二交易的交易编号小于第一交易,在所述写操作执行于在所述变量读取表中增加与第一交易对应的第一读版本之后情况中,所述方法还包括:在执行所述写操作之后,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行;在确定第一交易中的所述读操作需要重新执行的情况中,通知本地重新执行第一 交易中的对所述第一变量的读操作。
在一个实施例中,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行包括,确定所述第一读版本中的所述第一变量的值的来源是否对应于编号小于等于第二交易的交易或者对应于第一变量初始值。
在一个实施例中,所述写版本中还包括对应的交易对第一变量的写操作的写入次数,所述读版本中的第一变量的值的来源包括所读取的写版本中的交易编号和写入次数,其中,在执行所述写操作之后,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行包括,在提交所述第二交易之后,确定所述第一读版本中的所述第一变量的值的来源是否满足以下任一项:对应于第一变量初始值、交易编号小于第二交易的交易编号、交易编号等于第二交易的交易编号且写入次数小于所述第二交易中的所述写操作的写入次数。
在一个实施例中,在所述共享内存中,在第一变量的与第二交易对应的数据集中记录与第二交易对应的写版本和读版本,所述方法还包括,在提交所述第二交易之后,在与第二交易对应的数据集中标明:所述第二交易已提交,并将与第三交易对应的数据集删除,其中,所述第三交易依据交易编号为第二交易前一个交易。
在一个实施例中,所述方法还包括,在执行所述写操作之后,在所述多个写版本中没有与第二交易对应的写版本的情况中,在所述共享内存中增加与第二交易对应的写版本。
在一个实施例中,所述方法还包括,在所述多个写版本中已经包括与第二交易对应的写版本的情况中,基于所述第二交易的所述写操作的写入值修改与第二交易对应的写版本。
本说明书另一方面提供一种在区块链中并发执行多个交易的装置,其中,所述多个交易具有预定的提交顺序,其中包括第一交易,所述装置部署在区块链中的第一节点中,所述第一节点的共享内存中当前记录有与第一变量对应的多个写版本,每个写版本对应于所述多个交易中的一个交易对第一变量的写操作的执行,所述写版本中包括与所述写操作对应的交易编号和该写操作的写入值,所述装置包括:第一确定单元,配置为,确定在所述多个写版本中是否存在第一写版本,所述第一写版本对应于在前交易对所述第一变量的写操作,其中,所述在前交易为所述多个交易中交易编号小于所述第一交易的交易,其中,所述交易编号对应于交易的提交顺序;以及执行单元,配置为,基于所 述确定结果,执行第一交易中的对所述第一变量的读操作。
在一个实施例中,所述第一确定单元还配置为,在确定所述多个写版本中不存在第一写版本的情况中,读取所述第一变量的初始值。
在一个实施例中,所述执行单元还配置为,在确定所述多个写版本中存在至少一个第一写版本的情况中,从所述至少一个第一写版本中确定第二写版本,并从第二写版本中的写入值读取所述第一变量的值,其中,所述第二写版本对应的交易为所述至少一个第一写版本对应的至少一个交易中交易编号最大的交易。
在一个实施例中,其中,所述第一节点的共享内存中当前还记录有与第一变量对应的多个读版本,所述装置还包括,第一增加单元,配置为,在执行第一交易中的对所述第一变量的读操作之后,在所述多个读版本中没有与第一交易对应的读版本的情况中,在所述共享内存中增加与第一交易对应的第一读版本,所述第一读版本包括第一交易的交易编号和所述第一变量的值的来源。
在一个实施例中,所述装置还包括,第一修改单元,配置为,在所述多个读版本中已经包括与第一交易对应的读版本的情况中,基于所述第一变量的值的来源,对该与第一交易对应的读版本相应地修改。
在一个实施例中,所述多个交易中还包括第二交易,所述第二交易中包括对所述第一变量的写操作,所述第二交易的交易编号小于第一交易,在所述写操作执行于在所述变量读取表中增加与第一交易对应的第一读版本之后情况中,所述装置还包括:第二确定单元,配置为,在执行所述写操作之后,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行;通知单元,配置为,在确定第一交易中的所述读操作需要重新执行的情况中,通知本地重新执行第一交易中的对所述第一变量的读操作。
在一个实施例中,所述第二确定单元还配置为,确定所述第一读版本中的所述第一变量的值的来源是否对应于编号小于等于第二交易的交易或者对应于第一变量初始值。
在一个实施例中,所述写版本中还包括对应的交易对第一变量的写操作的写入次数,所述读版本中的第一变量的值的来源包括所读取的写版本中的交易编号和写入次数,其中,所述第二确定单元还配置为,在提交所述第二交易之后,确定所述第一读版本中的所述第一变量的值的来源是否满足以下任一项:对应于第一变量初始值、交易编号小于第二交易的交易编号、交易编号等于第二交易的交易编号且写入次数小于所述第二交 易中的所述写操作的写入次数。
在一个实施例中,在所述共享内存中,在第一变量的与第二交易对应的数据集中记录与第二交易对应的写版本和读版本,所述装置还包括,标明单元,配置为,在提交所述第二交易之后,在与第二交易对应的数据集中标明:所述第二交易已提交,以及删除单元,配置为,将与第三交易对应的数据集删除,其中,所述第三交易依据交易编号为第二交易前一个交易。
在一个实施例中,所述装置还包括,第二增加单元,配置为,在执行所述写操作之后,在所述多个写版本中没有与第二交易对应的写版本的情况中,在所述共享内存中增加与第二交易对应的写版本。
在一个实施例中,所述装置还包括,第二修改单元,配置为,在所述多个写版本中已经包括与第二交易对应的写版本的情况中,基于所述第二交易的所述写操作的写入值修改与第二交易对应的写版本。
本说明书另一方面提供一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行上述任一项方法。
本说明书另一方面提供一种计算设备,包括存储器和处理器,其特征在于,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现上述任一项方法。
通过根据本说明书实施例的在区块链中并发执行交易的方案,通过在共享内存中记录与各个变量对应的读写版本,并基于所述读写版本进行读写操作,从而使得对于没有相互依赖性的多个交易,可并发执行这些交易,对于具有相互依赖性的多个交易,可基于所述读写版本避免交易冲突,从而在保证计算结果一致性的同时,加快了处理速度,提高了处理性能。
附图说明
通过结合附图描述本说明书实施例,可以使得本说明书实施例更加清楚。
图1示出根据本说明书实施例的区块链系统示意图。
图2示出根据本说明书实施例的区块链节点中的内存结构示意图。
图3示出执行交易n中对变量k1的读取流程图。
图4示意示出根据本说明书一个实施例的一种在区块链中并发执行多个交易的方 法流程图。
图5示出根据本说明书一个实施例的一种在区块链中并发执行多个交易的装置5000。
具体实施方式
下面将结合附图描述本说明书实施例。
图1示出根据本说明书实施例的区块链系统示意图。如图1所示,所述系统中包括构成区块链的多个节点(图中示意示出6个节点),这些节点两两相连,其中例如包括节点11、节点12和节点13。如本领域技术人员所知,在区块链中,一些节点会收集区块链中的多个交易放入交易池中并竞争记账权。例如图中的节点11通过获取记账权而成为记账节点。节点11在成为记账节点之后会执行其交易池中的多个交易,并将该多个交易打包成区块发送给其它节点,例如发送给节点12。节点12将会对该区块进行验证,并同样地执行该区块中的多个交易。在预定数目个节点对该区块进行验证之后,也即对该区块达到了共识,区块链中的其它节点(例如节点13)将不需要继续对该区块进行验证,而是直接对该区块中的交易进行执行,以更新本地的相关数据。
所述多个交易中可能涉及到对多个变量的计算,在两个交易中不涉及相同的变量的情况中,其执行顺序并不会影响最终的计算结果,而在两个交易中涉及相同的变量的情况中,其执行顺序将会影响最终的计算结果。因此,在本说明书实施例中,为了保证各个节点对多个交易的执行结果是相同的,在各个节点的共享内存中记录各个变量的条目,在变量的条目中,记录了各个交易对该变量的读写操作。
图2示出根据本说明书实施例的区块链节点中的内存结构示意图。如图2所示,在该节点的内存中,包括两级缓冲区:第一级缓冲区L1和第二级缓冲区L2。其中,缓冲区L1仅与执行交易的线程相对应,例如,图2中的缓冲区L1为执行交易3的线程独享的缓冲区,其中记录线程3在执行交易3的过程中对变量的读写记录,其中L1中的T3表示交易3。例如,如图2中所示,L1包括写表和读表,其中写表中记录了k1W2和k5W8,分别表示对k1进行了第2次写入,对k5进行了第8次写入,读表中记录了k2_7.1和k3_0,分别表示读取了交易7对变量k2的第1次写入,读取了k3的初始值。
缓冲区L2为共享内存,即并发执行的多个线程都可以访问该缓冲区L2。如图2中所示,缓冲区L2中包括与各个变量对应的条目,例如变量k1的条目中包括TN4P、 TN3P、TN2P、TN1,其中,TN4P、TN3P、TN2P、TN1为与各个交易对应的数据集,例如,TN4P与交易4对应,TN3P与交易3对应,其中TN4P中的P表示交易4还未提交,TN1表示交易1已提交。图2中L2右侧示意示出了数据集的构成,其中至少包括写版本和读版本。所述数据集中还可以包括提交标记,用于指示该数据集对应的交易是否提交,例如该标记的初始值为0,在相应的交易提交之后,将该标记修改为1。
例如,上述线程3在对k1进行第1次写入之后,在所述k1条目中还没有与交易3对应的数据集的情况中(即在该写入之前没有执行过交易3中的对k1的读取或写入),则该条目中增加一个与交易3对应的数据集,并且该数据集中的写版本例如为3W1<12>,其中,3表示交易3,1表示第1次写入,12表示该写入的值。而在线程3对k1进行第2次写入时,则可将该与交易3对应的数据集中的写版本修改为3W2<10>。当线程3对k1首次进行读取之后,可将该数据集中的读版本从默认值(例如“-1”)修改为3R1.2,表示交易3读取了交易1的第2次写入的k1值。
可以理解,图2所示的变量条目仅仅是示意性的,并不用于限制本说明书实施例的范围。在一个实施例中,在变量条目中可仅包括写版本,从而,在执行交易中的读操作时,可通过基于写版本判断编号在前的并发执行的交易是否执行了写操作来进行读操作,而在执行交易的写操作时,可对编号在后的交易都进行通知,以使得编号在后的执行过读操作的交易都重新执行读操作。在一个实施例中,在变量访问表中可仅包括读版本,从而,在执行交易中的读操作时,可直接进行,在执行交易的写操作时,可通过基于读版本判断编号在后的同时执行的交易是否执行了读操作,并在提交之后通知执行了读操作的交易重新执行读操作。
图3示出执行交易n中对变量k1的读取流程图。通过如上所述设置的缓冲区L1和L2,例如,交易n对应的线程n在将要读取k1时,通过图3所示的读取流程图进行读取。在步骤301,线程n首先确定L1的写表中是否包括k1,即,从L1中确定其之前有没有对k1进行写入,如果写入,则在步骤302,返回写表中k1值,即,将该写入值作为k1的读取值,如果没有写入,在步骤303,确定L1的读表中是否包括k1,即,从L1中确定其之前有没有读取k1,如果读取过,则在步骤304,返回读表中的k1值,即将该之前的读取值作为k1的读取值。如果确定线程3之前没有读取k1,则在步骤305确定L2中是否包括k1,如果包括,则在步骤306,从k1中的条目对图2中的k1的各个数据集依次确定是否存在小于n的交易对变量k1的写版本,如果存在,在步骤307,将第一个确定的所述写版本的k1值返回作为读取值,如果没有写入过,则在步骤308, 从内存或持久存储器(例如rocksDB)中读取k1的初始值作为读取值。
线程n在执行交易n中的写入k1的情况中,在执行该写入之后,线程n可通过L2中记录的读版本,确定是否存在需要重读的读操作。
可以理解,上文中的描述只是示意性地,而不是用于限制本说明书实施例的范围。例如,所述读写版本不限于为上述具体形式,例如,所述版本中不需要R、W,在保证预定操作的情况中,所述版本中可以不需要写入次数,等等。下文将详细描述根据本说明书实施例的并发执行交易的过程。
图4示意示出根据本说明书一个实施例的一种在区块链中并发执行多个交易的方法流程图,其中,所述多个交易具有预定的提交顺序,其中包括第一交易,所述方法在区块链中的第一节点执行,所述第一节点的共享内存中当前记录有与第一变量对应的多个写版本,每个写版本对应于所述多个交易中的一个交易对第一变量的写操作的执行,所述写版本中包括与所述写操作对应的交易编号和该写操作的写入值,所述方法包括:
步骤S402,确定在所述多个写版本中是否存在第一写版本,所述第一写版本对应于在前交易对所述第一变量的写操作,其中,所述在前交易为所述多个交易中交易编号小于所述第一交易的交易,其中,所述交易编号对应于交易的提交顺序;以及
步骤S404,基于所述确定结果,执行第一交易中的对所述第一变量的读操作。
首先,在步骤S402,确定在所述多个写版本中是否存在第一写版本,所述第一写版本对应于在前交易对所述第一变量的写操作,其中,所述在前交易为所述多个交易中交易编号小于所述第一交易的交易,其中,所述交易编号对应于交易的提交顺序。
如上文中参考图1中所述,该方法在区块链中的一个节点执行。该节点在打包区块时,或者该节点在接收到新生成的区块之后,都会对相关的多个交易进行执行提交。例如,一个区块中可包括几千笔交易,而这几千笔交易可能涉及几百个变量,其中,多个交易可能访问不同的变量,或者,多个交易可能访问相同的变量。在现有技术中,在记账节点中,已经根据预定规则确定了将打包到一个区块中的多个交易各自的交易编号,该交易编号的顺序指示了交易的执行顺序和提交顺序。在本说明书实施例中,为了使得最后的计算结果与现有技术中的串行计算结果相同,对区块中的多个交易保留预定好的提交顺序,即,以各个交易的编号顺序作为其各自的提交顺序,同时,基于各个节点中记录的变量条目,使得没有依赖关系的各个交易可并发执行,并使得具有依赖关系的各个交易避免交易冲突,其中,对于先后编号的交易1和交易2,如果在交易1中对第一 变量进行写入,在交易2中对第一变量进行读取,则交易2依赖于交易1的结果。
如上述参考图2所述,在共享内存中(即图2中的L2)中记录了各个变量的条目,例如图2中的变量k1为所述第一变量,变量k1的与各个交易对应的数据集中可能会包括与该交易对应的写版本。在一个实施例中,该写版本的形式例如为nW<xxx>,其中,n为执行该写入的交易编号,W表示写入,“xxx”为该写入操作的写入值。可以理解,所述写版本的具体形式不限于该形式,只要其中包括交易编号和写入值即可。在一个实施例中,所述写版本的形式例如为nWu<xxx>,其中u表示交易n对变量k1的写入次数。
如上述参考图3的描述,当交易n将要读取k1时,当在L1中没有读取到k1的值之后,将确定L2是否有可以读取的值。即,在L2中记录的与k1对应的多个写版本中,确定有没有交易编号小于n的写版本,也即,确定有没有交易n之前的交易已经对k1进行了写操作。所述交易编号对应于交易的提交顺序,提交顺序越靠前,交易编号越小。
在步骤S404,基于所述确定结果,执行第一交易中的对所述第一变量的读操作。
在确定存在交易编号小于n的写版本的情况中,从交易编号小于n的写版本中交易编号最大的写版本中读取k1的值。例如,参考图2,当进行交易3中对k1的读取时,如果与k1对应条目中包括写版本:1W2<12>、2W1<10>和4W1<23>,其中,交易编号小于n的写版本有1W2<12>和2W1<10>,取其中交易编号最大的写版本中的写入值(即10)作为该次读取的读取值。在与k1对应的条目中没有交易编号小于3的写版本的情况中,则从内存中或者持久存储器(例如rocksdb)中读取变量k1的初始值作为读取值。
在所述L2中的各个变量的条目中的数据集中还可以包括与相应交易对应的读版本。在一个实施例中,针对变量k1,所述读版本的形式例如为mRq,q为自然数,表示交易m读取了交易q写入k1的值。在一个实施例中,针对变量k1,所述读版本的形式例如为mRq.p,表示交易m读取了交易q第p次写入的值。当从内存中或者持久存储器(例如rocksdb)中读取变量k1的初始值作为读取值的情况中,所述读版本的形式为mR0。
例如,在进行交易3对变量k1的读取之后,如果在k1的条目中还没有与交易3对应的数据集,则在该条目增加该数据集,并在其中记录读版本,例如3R2.1、3R0或3R2;如果在k1的条目中已经包括了与交易3对应的数据集,但是其中没有读版本,则在其中添加读版本;如在k1的条目中已经包括了与交易3对应的数据集,并在数据集中已经包括了读版本,则根据最新的读取修改原有的读版本。
在一个实施例中,当交易n对变量k1进行一次写入之后,在k1的条目中与交易n对应的数据集中将包括nW<xxx>。为了避免在交易n之后的交易对变量k1的误读,可在交易n进行所述写入之后,立即检测与k1对应的读版本中是否存在mRq,其中m>n且q≤n,即,检测是否存在一个交易n后面的交易m超前读了交易n的本次写入之前的k1值,其中,交易n的本次写入之前的k1值包括:k1的初始值(即,q=0)、小于交易n的交易的写入值(即,q<n)、以及交易n在本次写入之前写入的k1值(即q=n)。如果存在上述mRq,则需要回撤该读版本相应的交易。
在一个实施例中,当交易n对变量k1进行一次写入之后,在k1的条目中与交易n对应的数据集中将包括nWu<xxx>。在该情况中,不需要在交易n进行所述写入之后立即检测读版本。例如,可以在提交交易n之后,在与变量k1对应的多个读版本中检测是否存在mRq.p,其中m>n且q<n,或者,m>n、q=n且p<u。在该情况中,通过写入次数p可确定读版本对应的读取值是否是该次写入的写入值。其中,m>n且q<n表示该读版本对应的交易读取了错误的交易写入的值,m>n、q=n且p<u表示该读版本对应的交易读取了正确的交易写入的值,但是该写入值后来又被再次更新。如果存在上述mRq.p,则需要回撤该读版本相应的交易。
例如,交易2对变量k1进行第1次写入之后,记录写版本2W1<22>,例如,在交易2提交之后,通过查询与k1对应的读版本,确定与k1对应的读版本包括3R1.1,从而可确定交易3超前读取了交易1对变量k1的第1次写入,因此需要回撤交易3。
例如,交易2对变量k1进行第2次写入之后,记录写版本2W2<22>,在交易2提交之后,通过查询与k1对应的读版本,确定与k1对应的读版本包括3R2.1,从而可确定交易3超前读取了交易2对变量k1的第1次写入,因此需要回撤交易3。
在上述确定需要回撤该读版本相应的交易的情况中,例如,可通过本地的交易调度器以重新进行第一交易中的所述读操作及相关的后续操作,或者,如果执行第一交易的线程不变,可在该线程的私有存储空间中进行标记,以通知该线程进行重读操作。
上述交易n在提交之后,将与变量k1对应的条目中的与已提交的交易n对应的数据集中的提交标记修改为1,并可将与变量k1对应的条目中的与已提交的交易n-1对应的数据集删除。
图5示出根据本说明书一个实施例的一种在区块链中并发执行多个交易的装置5000,其中,所述多个交易具有预定的提交顺序,其中包括第一交易,所述装置部署在 区块链中的第一节点中,所述第一节点的共享内存中当前记录有与第一变量对应的多个写版本,每个写版本对应于所述多个交易中的一个交易对第一变量的写操作的执行,所述写版本中包括与所述写操作对应的交易编号和该写操作的写入值,所述装置以下单元。
第一确定单元501,配置为,确定在所述多个写版本中是否存在第一写版本,所述第一写版本对应于在前交易对所述第一变量的写操作,其中,所述在前交易为所述多个交易中交易编号小于所述第一交易的交易,其中,所述交易编号对应于交易的提交顺序;以及执行单元502,配置为,基于所述确定结果,执行第一交易中的对所述第一变量的读操作。
在一个实施例中,所述第一确定单元还配置为,在确定所述多个写版本中不存在第一写版本的情况中,读取所述第一变量的初始值。
在一个实施例中,所述执行单元502还配置为,在确定所述多个写版本中存在至少一个第一写版本的情况中,从所述至少一个第一写版本中确定第二写版本,并从第二写版本中的写入值读取所述第一变量的值,其中,所述第二写版本对应的交易为所述至少一个第一写版本对应的至少一个交易中交易编号最大的交易。
在一个实施例中,其中,所述第一节点的共享内存中当前还记录有与第一变量对应的多个读版本,所述装置还包括,第一增加单元503,配置为,在执行第一交易中的对所述第一变量的读操作之后,在所述多个读版本中没有与第一交易对应的读版本的情况中,在所述共享内存中增加与第一交易对应的第一读版本,所述第一读版本包括第一交易的交易编号和所述第一变量的值的来源。
在一个实施例中,所述装置还包括,第一修改单元504,配置为,在所述多个读版本中已经包括与第一交易对应的读版本的情况中,基于所述第一变量的值的来源,对该与第一交易对应的读版本相应地修改。
在一个实施例中,所述多个交易中还包括第二交易,所述第二交易中包括对所述第一变量的写操作,所述第二交易的交易编号小于第一交易,在所述写操作执行于在所述变量读取表中增加与第一交易对应的第一读版本之后情况中,所述装置还包括:第二确定单元505,配置为,在执行所述写操作之后,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行;通知单元506,配置为,在确定第一交易中的所述读操作需要重新执行的情况中,通知本地重新执行第一交易中的对所述第一变量的读操作。
在一个实施例中,所述第二确定单元还配置为,确定所述第一读版本中的所述第一变量的值的来源是否对应于编号小于等于第二交易的交易或者对应于第一变量初始值。
在一个实施例中,所述写版本中还包括对应的交易对第一变量的写操作的写入次数,所述读版本中的第一变量的值的来源包括所读取的写版本中的交易编号和写入次数,其中,所述第二确定单元还配置为,在提交所述第二交易之后,确定所述第一读版本中的所述第一变量的值的来源是否满足以下任一项:对应于第一变量初始值、交易编号小于第二交易的交易编号、交易编号等于第二交易的交易编号且写入次数小于所述第二交易中的所述写操作的写入次数。
在一个实施例中,在所述共享内存中,在第一变量的与第二交易对应的数据集中记录与第二交易对应的写版本和读版本,所述装置还包括,标明单元507,配置为,在提交所述第二交易之后,在与第二交易对应的数据集中标明:所述第二交易已提交,以及删除单元508,配置为,将与第三交易对应的数据集删除,其中,所述第三交易依据交易编号为第二交易前一个交易。
在一个实施例中,所述装置还包括,第二增加单元509,配置为,在执行所述写操作之后,在所述多个写版本中没有与第二交易对应的写版本的情况中,在所述共享内存中增加与第二交易对应的写版本。
在一个实施例中,所述装置还包括,第二修改单元510,配置为,在所述多个写版本中已经包括与第二交易对应的写版本的情况中,基于所述第二交易的所述写操作的写入值修改与第二交易对应的写版本。
本说明书另一方面提供一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行上述任一项方法。
本说明书另一方面提供一种计算设备,包括存储器和处理器,其特征在于,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现上述任一项方法。
通过根据本说明书实施例的在区块链中并发执行交易的方案,通过在共享内存中记录与各个变量对应的读写版本,并基于所述读写版本进行读写操作,从而使得对于没有相互依赖性的多个交易,可并发执行这些交易,对于具有相互依赖性的多个交易,可基于所述读写版本避免交易冲突,从而在保证计算结果一致性的同时,加快了处理速度,提高了处理性能。
需要理解,本文中的“第一”,“第二”等描述,仅仅为了描述的简单而对相似概念进行区分,并不具有其他限定作用。
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可,每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于系统实施例而言,由于其基本相似于方法实施例,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
本领域普通技术人员应该还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执轨道,取决于技术方案的特定应用和设计约束条件。本领域普通技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。
结合本文中所公开的实施例描述的方法或算法的步骤可以用硬件、处理器执轨道的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。
以上所述的具体实施方式,对本发明的目的、技术方案和有益效果进行了进一步详细说明,所应理解的是,以上所述仅为本发明的具体实施方式而已,并不用于限定本发明的保护范围,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。

Claims (26)

  1. 一种在区块链中并发执行多个交易的方法,其中,所述多个交易具有预定的提交顺序,其中包括第一交易,所述方法在区块链中的第一节点执行,所述第一节点的共享内存中当前记录有与第一变量对应的多个写版本,每个写版本对应于所述多个交易中的一个交易对第一变量的写操作的执行,所述写版本中包括与所述写操作对应的交易编号和该写操作的写入值,所述方法包括:
    确定在所述多个写版本中是否存在第一写版本,所述第一写版本对应于在前交易对所述第一变量的写操作,其中,所述在前交易为所述多个交易中交易编号小于所述第一交易的交易,其中,所述交易编号对应于交易的提交顺序;以及
    基于所述确定结果,执行第一交易中的对所述第一变量的读操作。
  2. 根据权利要求1所述的方法,其中,基于所述确定结果,执行第一交易中的对所述第一变量的读操作包括,在确定所述多个写版本中不存在第一写版本的情况中,读取所述第一变量的初始值。
  3. 根据权利要求1所述的方法,其中,基于所述确定结果,执行第一交易中的对所述第一变量的读操作包括,在确定所述多个写版本中存在至少一个第一写版本的情况中,从所述至少一个第一写版本中确定第二写版本,并从第二写版本中的写入值读取所述第一变量的值,其中,所述第二写版本对应的交易为所述至少一个第一写版本对应的至少一个交易中交易编号最大的交易。
  4. 根据权利要求1所述的方法,其中,所述第一节点的共享内存中当前还记录有与第一变量对应的多个读版本,所述方法还包括,在执行第一交易中的对所述第一变量的读操作之后,在所述多个读版本中没有与第一交易对应的读版本的情况中,在所述共享内存中增加与第一交易对应的第一读版本,所述第一读版本包括第一交易的交易编号和所述第一变量的值的来源。
  5. 根据权利要求4所述的方法,还包括,在所述多个读版本中已经包括与第一交易对应的读版本的情况中,基于所述第一变量的值的来源,对该与第一交易对应的读版本相应地修改。
  6. 根据权利要求4所述的方法,其中,所述第一变量值的来源为所读取的写版本中的交易编号。
  7. 根据权利要求4所述的方法,其中,所述多个交易中还包括第二交易,所述第二交易中包括对所述第一变量的写操作,所述第二交易的交易编号小于第一交易,在所述写操作执行于在所述变量读取表中增加与第一交易对应的第一读版本之后情况中,所 述方法还包括:
    在执行所述写操作之后,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行;
    在确定第一交易中的所述读操作需要重新执行的情况中,通知本地重新执行第一交易中的对所述第一变量的读操作。
  8. 根据权利要求7所述的方法,其中,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行包括,确定所述第一读版本中的所述第一变量的值的来源是否对应于编号小于等于第二交易的交易或者对应于第一变量初始值。
  9. 根据权利要求7所述的方法,其中,所述写版本中还包括对应的交易对第一变量的写操作的写入次数,所述读版本中的第一变量的值的来源包括所读取的写版本中的交易编号和写入次数,其中,在执行所述写操作之后,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行包括,在提交所述第二交易之后,确定所述第一读版本中的所述第一变量的值的来源是否满足以下任一项:对应于第一变量初始值、交易编号小于第二交易的交易编号、交易编号等于第二交易的交易编号且写入次数小于所述第二交易中的所述写操作的写入次数。
  10. 根据权利要求9所述的方法,其中,在所述共享内存中,在第一变量的与第二交易对应的数据集中记录与第二交易对应的写版本和读版本,所述方法还包括,在提交所述第二交易之后,在与第二交易对应的数据集中标明:所述第二交易已提交,并将与第三交易对应的数据集删除,其中,所述第三交易依据交易编号为第二交易前一个交易。
  11. 根据权利要求7所述的方法,还包括,在执行所述写操作之后,在所述多个写版本中没有与第二交易对应的写版本的情况中,在所述共享内存中增加与第二交易对应的写版本。
  12. 根据权利要求11所述的方法,还包括,在所述多个写版本中已经包括与第二交易对应的写版本的情况中,基于所述第二交易的所述写操作的写入值修改与第二交易对应的写版本。
  13. 一种在区块链中并发执行多个交易的装置,其中,所述多个交易具有预定的提交顺序,其中包括第一交易,所述装置部署在区块链中的第一节点中,所述第一节点的共享内存中当前记录有与第一变量对应的多个写版本,每个写版本对应于所述多个交易中的一个交易对第一变量的写操作的执行,所述写版本中包括与所述写操作对应的交易编号和该写操作的写入值,所述装置包括:
    第一确定单元,配置为,确定在所述多个写版本中是否存在第一写版本,所述第一 写版本对应于在前交易对所述第一变量的写操作,其中,所述在前交易为所述多个交易中交易编号小于所述第一交易的交易,其中,所述交易编号对应于交易的提交顺序;以及
    执行单元,配置为,基于所述确定结果,执行第一交易中的对所述第一变量的读操作。
  14. 根据权利要求13所述的装置,其中,所述第一确定单元还配置为,在确定所述多个写版本中不存在第一写版本的情况中,读取所述第一变量的初始值。
  15. 根据权利要求13所述的装置,其中,所述执行单元还配置为,在确定所述多个写版本中存在至少一个第一写版本的情况中,从所述至少一个第一写版本中确定第二写版本,并从第二写版本中的写入值读取所述第一变量的值,其中,所述第二写版本对应的交易为所述至少一个第一写版本对应的至少一个交易中交易编号最大的交易。
  16. 根据权利要求13所述的装置,其中,所述第一节点的共享内存中当前还记录有与第一变量对应的多个读版本,所述装置还包括,第一增加单元,配置为,在执行第一交易中的对所述第一变量的读操作之后,在所述多个读版本中没有与第一交易对应的读版本的情况中,在所述共享内存中增加与第一交易对应的第一读版本,所述第一读版本包括第一交易的交易编号和所述第一变量的值的来源。
  17. 根据权利要求16所述的装置,还包括,第一修改单元,配置为,在所述多个读版本中已经包括与第一交易对应的读版本的情况中,基于所述第一变量的值的来源,对该与第一交易对应的读版本相应地修改。
  18. 根据权利要求13所述的装置,其中,所述第一变量值的来源为所读取的写版本中的交易编号。
  19. 根据权利要求13所述的装置,其中,所述多个交易中还包括第二交易,所述第二交易中包括对所述第一变量的写操作,所述第二交易的交易编号小于第一交易,在所述写操作执行于在所述变量读取表中增加与第一交易对应的第一读版本之后情况中,所述装置还包括:
    第二确定单元,配置为,在执行所述写操作之后,基于所述第一读版本,确定第一交易中的所述读操作是否需要重新执行;
    通知单元,配置为,在确定第一交易中的所述读操作需要重新执行的情况中,通知本地重新执行第一交易中的对所述第一变量的读操作。
  20. 根据权利要求19所述的装置,其中,所述第二确定单元还配置为,确定所述第一读版本中的所述第一变量的值的来源是否对应于编号小于等于第二交易的交易或 者对应于第一变量初始值。
  21. 根据权利要求19所述的装置,其中,所述写版本中还包括对应的交易对第一变量的写操作的写入次数,所述读版本中的第一变量的值的来源包括所读取的写版本中的交易编号和写入次数,其中,所述第二确定单元还配置为,在提交所述第二交易之后,确定所述第一读版本中的所述第一变量的值的来源是否满足以下任一项:对应于第一变量初始值、交易编号小于第二交易的交易编号、交易编号等于第二交易的交易编号且写入次数小于所述第二交易中的所述写操作的写入次数。
  22. 根据权利要求21所述的装置,其中,在所述共享内存中,在第一变量的与第二交易对应的数据集中记录与第二交易对应的写版本和读版本,所述装置还包括,标明单元,配置为,在提交所述第二交易之后,在与第二交易对应的数据集中标明:所述第二交易已提交,以及删除单元,配置为,将与第三交易对应的数据集删除,其中,所述第三交易依据交易编号为第二交易前一个交易。
  23. 根据权利要求19所述的装置,还包括,第二增加单元,配置为,在执行所述写操作之后,在所述多个写版本中没有与第二交易对应的写版本的情况中,在所述共享内存中增加与第二交易对应的写版本。
  24. 根据权利要求23所述的装置,还包括,第二修改单元,配置为,在所述多个写版本中已经包括与第二交易对应的写版本的情况中,基于所述第二交易的所述写操作的写入值修改与第二交易对应的写版本。
  25. 一种计算机可读存储介质,其上存储有计算机程序,当所述计算机程序在计算机中执行时,令计算机执行权利要求1-12中任一项的所述的方法。
  26. 一种计算设备,包括存储器和处理器,其特征在于,所述存储器中存储有可执行代码,所述处理器执行所述可执行代码时,实现权利要求1-12中任一项所述的方法。
PCT/CN2020/100486 2019-09-25 2020-07-06 在区块链中并发执行交易的方法和装置 WO2021057165A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910913970.3A CN112561695B (zh) 2019-09-25 2019-09-25 在区块链中并发执行交易的方法和装置
CN201910913970.3 2019-09-25

Publications (1)

Publication Number Publication Date
WO2021057165A1 true WO2021057165A1 (zh) 2021-04-01

Family

ID=75029476

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/100486 WO2021057165A1 (zh) 2019-09-25 2020-07-06 在区块链中并发执行交易的方法和装置

Country Status (2)

Country Link
CN (1) CN112561695B (zh)
WO (1) WO2021057165A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170364701A1 (en) * 2015-06-02 2017-12-21 ALTR Solutions, Inc. Storing differentials of files in a distributed blockchain
CN108876370A (zh) * 2018-06-12 2018-11-23 北京航空航天大学 一种异构多链架构下跨区块链共享开放数据的体系架构
CN109190410A (zh) * 2018-09-26 2019-01-11 华中科技大学 一种云存储环境下的基于区块链的日志行为审计方法
CN109426949A (zh) * 2017-08-29 2019-03-05 华为技术有限公司 一种跨链交易方法及装置

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109493223B (zh) * 2018-11-07 2021-12-21 联动优势科技有限公司 一种记账方法及装置
CN109508337A (zh) * 2018-11-12 2019-03-22 杭州秘猿科技有限公司 一种交易并行执行方法、装置、电子设备及系统
CN110135985B (zh) * 2019-04-04 2021-07-27 杭州抖音科技有限公司 一种区块链上交易的并行执行方法及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170364701A1 (en) * 2015-06-02 2017-12-21 ALTR Solutions, Inc. Storing differentials of files in a distributed blockchain
CN109426949A (zh) * 2017-08-29 2019-03-05 华为技术有限公司 一种跨链交易方法及装置
CN108876370A (zh) * 2018-06-12 2018-11-23 北京航空航天大学 一种异构多链架构下跨区块链共享开放数据的体系架构
CN109190410A (zh) * 2018-09-26 2019-01-11 华中科技大学 一种云存储环境下的基于区块链的日志行为审计方法

Also Published As

Publication number Publication date
CN112561695A (zh) 2021-03-26
CN112561695B (zh) 2021-07-23

Similar Documents

Publication Publication Date Title
TWI730690B (zh) 在區塊鏈中同時執行交易的方法和裝置及電腦可讀儲存媒體與計算設備
US7801855B2 (en) Method and apparatus for merging log entries in a database management system
US9990391B1 (en) Transactional messages in journal-based storage systems
WO2021036258A1 (zh) 在区块链中并发执行交易的方法和装置
US10108658B1 (en) Deferred assignments in journal-based storage systems
WO2021036260A1 (zh) 在区块链中并发执行交易的方法和装置
WO2020220251A1 (zh) 区块链系统数据处理方法和区块的生成方法
US20210311916A1 (en) Blockchain-based hierarchical data storage
CN111125040A (zh) 管理重做日志的方法、装置及存储介质
CN109446211A (zh) 一种一致性校验方法及装置
WO2021036259A1 (zh) 在区块链中并发执行交易的方法和装置
WO2021129005A1 (zh) 一种区块链状态变更交易追溯的方法及装置
CN110706108B (zh) 在区块链中并发执行交易的方法和装置
WO2021057165A1 (zh) 在区块链中并发执行交易的方法和装置
WO2023078097A1 (zh) 一种区块链攻击拦截方法及装置
WO2024000897A1 (zh) 一种基于区块链的数字资产合成方法及装置
CN112783954B (zh) 数据访问方法、装置及服务器
EP3951611A1 (en) Block verification method, apparatus and device
CN114356768A (zh) 通过占位符减少交易读写冲突的方法与装置
CN113327167B (zh) 一种区块链数据处理方法
US11983168B2 (en) Block verification method, apparatus and device
CN116450316A (zh) 交易并行处理的方法、装置、电子设备和存储介质
CN111352845A (zh) 一种测试序列场景生成方法及装置
CN114416023A (zh) 用于先执行后共识的区块链上的随机数生成方法和装置
CN115952235A (zh) 基于AMTs的区块链可验证存储方法

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: 20867232

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: 20867232

Country of ref document: EP

Kind code of ref document: A1