WO2022188528A1 - Transaction fee payment method based on parallel execution, and device and storage medium - Google Patents
Transaction fee payment method based on parallel execution, and device and storage medium Download PDFInfo
- Publication number
- WO2022188528A1 WO2022188528A1 PCT/CN2021/143839 CN2021143839W WO2022188528A1 WO 2022188528 A1 WO2022188528 A1 WO 2022188528A1 CN 2021143839 W CN2021143839 W CN 2021143839W WO 2022188528 A1 WO2022188528 A1 WO 2022188528A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- transaction
- transactions
- balance
- executed
- class
- Prior art date
Links
- 238000000034 method Methods 0.000 title claims abstract description 30
- 239000003999 initiator Substances 0.000 claims abstract description 30
- 238000004590 computer program Methods 0.000 claims description 9
- 230000007246 mechanism Effects 0.000 abstract description 11
- 230000001133 acceleration Effects 0.000 abstract description 6
- 238000010586 diagram Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 230000009286 beneficial effect Effects 0.000 description 3
- 239000003795 chemical substances by application Substances 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 238000012546 transfer Methods 0.000 description 3
- 238000012545 processing Methods 0.000 description 2
- 230000008901 benefit Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 230000007123 defense Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000000670 limiting effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Classifications
-
- 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/08—Payment architectures
- G06Q20/10—Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
- G06Q20/102—Bill distribution or payments
-
- 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/40—Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
- G06Q20/405—Establishing or using transaction specific rules
-
- 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 invention relates to the field of information technology, and in particular, to a transaction fee payment method, device and storage medium based on parallel execution.
- Nodes in the blockchain conduct transfers, deposit data and other services by sending transactions.
- the accounting nodes in the blockchain collect transactions in the blockchain in the transaction pool, and then execute the transaction. These transactions are packaged into blocks and diffused into the blockchain.
- a certain transaction fee needs to be charged, which can effectively prevent the defense against massive transactions from attacking the blockchain system.
- the payment of transaction fees needs to be redesigned. To prevent the wrong execution of transactions due to parallel execution, for example, when the account balance is not enough to pay the transaction fee, the transaction that could not be packaged due to the parallel execution is finally executed.
- the payment of transaction fees is unified in the coins contract.
- the same initiator initiates multiple contract transactions, such as in an agency environment, there are multiple transaction fees that need to be paid from the initiator's The account is deducted, but when the blockchain system uses the parallel transaction mechanism to execute, the transaction execution is no longer executed in the transaction order, and the original transaction fee payment mechanism may cause the transaction to be unable to execute in parallel.
- the present invention provides a transaction fee payment method, device and storage medium based on parallel execution, which can accelerate the parallel execution of transactions for the same transaction initiator.
- a transaction fee payment method based on parallel execution comprising:
- the second-class transactions are divided into pre-order transactions, intermediate transactions and post-order transactions according to their execution sequence relationship with the first-class transactions, and the pre-order transactions are the second-class transactions whose transaction execution order precedes all the first-class transactions.
- the intermediate transaction is a second-class transaction in which the transaction execution order is between two first-class transactions, and the post-sequence transaction is a second-class transaction whose transaction execution order is after all the first-class transactions;
- the transaction fee payment methods include:
- Pre-order transaction When executing a pre-order transaction, the values of previous, current and balance of all types of transactions need to deduct the transaction fee of the pre-order transaction as the new previous, current and balance;
- Centering transaction When executing a centering transaction, first obtain the value of the balance of a class of transactions adjacent to the centering transaction to be executed before the centering transaction to be executed, as the previous centering transaction to be executed, and subtract the value of the above balance from the value of the centering transaction to be executed.
- the data after the transaction fee is used as the new current and balance of the to-be-executed centering transaction; then the updated balance value of the to-be-executed centering transaction is used as the transaction sequence after the to-be-executed centering transaction is adjacent to the to-be-executed centering transaction.
- the previous value of a type of transaction, and then the value of current and balance of this type of transaction minus the transaction fee for executing the intermediate transaction is taken as its new current and balance;
- Post-sequence transaction When executing a post-sequence transaction, obtain the value of the balance of a type of transaction adjacent to the post-sequence transaction to be executed as the previous of the post-sequence transaction to be executed, and use the current and balance of the post-sequence transaction to be executed. Modified to a value obtained by subtracting the transaction fee of the post-sequence transaction to be executed from the balance of a type of transaction adjacent to the post-sequence transaction to be executed.
- the new current value of all types of transactions in the pre-order transaction is greater than 0, otherwise, the pre-order transaction is not packaged.
- the new current and balance of the to-be-executed intermediate transaction of the intermediate transaction are both greater than 0, and the new current and balance of a class of transactions adjacent to the to-be-executed intermediate transaction whose transaction order is after the pending intermediate transaction are also greater than 0, otherwise the pending centering transaction is not packaged.
- a computer device one or more processors
- memory for storing one or more programs
- the one or more processors When the one or more programs are executed by the one or more processors, the one or more processors are caused to perform the method according to any one of the first aspect and the preferred embodiments thereof.
- a storage medium storing a computer program, when the program is executed by a processor, implements the method according to any one of the first aspect and its preferred solutions.
- the parallel acceleration of the transaction can be used in a more relaxed environment, especially when the transaction is sent by the transaction sending proxy mechanism, the transaction can still be carried out for the same transaction initiator. Beneficial effect of accelerated parallel execution of transactions.
- FIG. 1 is a schematic diagram of a transaction initiator list according to Embodiment 1 of the present invention.
- FIG. 2 is a schematic diagram of a transaction information table of from_0 in Embodiment 1 of the present invention.
- FIG. 3 is a schematic structural diagram of a device provided in Embodiment 2.
- FIG. 3 is a schematic structural diagram of a device provided in Embodiment 2.
- a transaction fee payment method based on parallel execution comprising:
- the second-class transactions are divided into pre-order transactions, intermediate transactions and post-order transactions according to their execution sequence relationship with the first-class transactions, and the pre-order transactions are the second-class transactions whose transaction execution order precedes all the first-class transactions.
- the intermediate transaction is a second-class transaction in which the transaction execution order is between two first-class transactions, and the post-sequence transaction is a second-class transaction whose transaction execution order is after all the first-class transactions;
- the transaction fee payment methods include:
- Pre-order transaction When executing a pre-order transaction, the values of previous, current and balance of all types of transactions need to be deducted from the transaction fees of the pre-order transaction as new previous, current and balance. The current values are all greater than 0, otherwise the pre-order transaction will not be packaged;
- Centering transaction When executing a centering transaction, first obtain the value of the balance of a class of transactions adjacent to the centering transaction to be executed before the centering transaction to be executed, as the previous centering transaction to be executed, and subtract the value of the above balance from the value of the centering transaction to be executed.
- the data after the transaction fee is used as the new current and balance of the to-be-executed centering transaction; then the updated balance value of the to-be-executed centering transaction is used as the transaction sequence after the to-be-executed centering transaction is adjacent to the to-be-executed centering transaction.
- the previous value of a type of transaction, and then the value of current and balance of this type of transaction minus the transaction fee for executing the intermediate transaction is taken as its new current and balance; wherein, the new current and balance of the intermediate transaction to be executed and balance are both greater than 0, and the new current and balance of a class of transactions adjacent to the to-be-executed centering transaction after the to-be-executed centering transaction are also greater than 0, otherwise the pending to-be-executed centering transaction will not be packaged
- Post-sequence transaction When executing a post-sequence transaction, obtain the value of the balance of a type of transaction adjacent to the post-sequence transaction to be executed as the previous of the post-sequence transaction to be executed, and use the current and balance of the post-sequence transaction to be executed. Modified to a value obtained by subtracting the transaction fee of the post-sequence transaction to be executed from the balance of a type of transaction adjacent to the post-sequence transaction to be executed.
- the solution provided by this embodiment has the advantage that parallel acceleration of transactions can be used in a more relaxed environment, especially when transactions are sent using the transaction sending proxy mechanism, transactions can still be performed for the same transaction initiator.
- the beneficial effect of parallel execution acceleration is the beneficial effect of parallel execution acceleration.
- the transaction fee can be directly deducted when executing the coins contract transaction according to the existing technical means, which is not limited in this solution.
- the existing technical means which is not limited in this solution.
- the existing account balance of all coins transactions after the pre-order transaction i.e. current, must be greater than the transaction fee of the pre-order transaction to ensure the execution of the pre-order transaction.
- the previous of the centering transaction is the account balance of the previous coins transaction, namely balance, and the modification of the account balance in the centering transaction is only the transaction fee, then the current and balance of the centering transaction are both modified to the previous coins transaction.
- the account balance can be subtracted from the transaction fee of the centering transaction, and the previous coins transaction after the centering transaction should use the account balance of the centering transaction, that is, the balance of the centering transaction is used, and the current and balance of the coins transaction after the centering transaction are the same. It is also necessary to deduct the transaction fee of the intermediate transaction, so that the transaction fee of the intermediate transaction is actually settled in the address account.
- the intermediate transaction actually modifies the account balance due to the transaction fee, but the second-class transaction does not directly modify the account balance. , so it is reflected in the coins after it, then the coins transaction after the center transaction will reflect the transaction fee, while the previous coins transaction will not be affected.
- the subsequent transaction it is also a second-class transaction.
- the second-class transaction only the transaction fee is recorded in the coin transaction, that is to say, only the transaction fee changes the account balance, so the previous uses the account balance of the previous coins transaction, and its The transaction process is only to deduct the transaction fee, then its current and balance can use the account balance of the last coins transaction minus the transaction fee, so that the transaction fee is included in the account.
- the transaction fees of all second-class transactions are analyzed in the executor. If the account balance is insufficient, the second-class transactions will be removed. When the transaction needs to be executed in parallel, there is no need to consider the insufficient transaction fee. This is especially suitable for In the agent scenario, when there is a transaction agent, the account of the agent will become the transaction initiator many times. If the existing transaction fee payment mechanism is used, parallel transactions cannot be implemented at all, and the settlement of transaction fees will affect the parallel transactions. The transaction fee settlement performed by the method can accelerate the parallel execution of transactions performed by the same transaction initiator.
- the transaction initiator from_0 initiated a total of 6 transactions.
- the indexes of these 6 transactions are 0, 1, 3, 4, 5, and 15 respectively.
- the index of 0 is the token transaction
- the index of 1, 3, and 5 is the transaction.
- the index of 4 is the privacy transaction
- the index of 15 is the trade transaction
- the transaction information table of from_0 is constructed.
- other contract transactions related to from_0 have the same account modification address as the coins contract transaction.
- Only the transfer transaction of coins will change the balance of the account, including the transfer initiator and receiver.
- the order of other contract transactions in the block includes three cases before, in the middle and after all coins transactions.
- the specific implementation mechanism is as follows:
- the token transaction has an index of 0, and the transaction execution order in the blockchain is before the coins whose index is 1. Therefore, the receipt of the token transaction does not need to be modified.
- the previous, current and balance values in the three coins contracts need to be subtracted from the transaction fee with tx being 0. At the same time, it is judged that the value of current after subtraction must be greater than or equal to 0. It is denied that the account balance is insufficient and the transaction cannot be packaged.
- the privacy transaction has an index of 4.
- the transaction execution order in the blockchain is after the coins with index 3 and before the transaction with index 5. Therefore,
- the trade transaction shown in Figure 2 has an index of 15, and the transaction execution order in the blockchain is after coins with an index of 5, so replace the previous with the balance with an index of 5, and both current and balance are Modified to balance-txfee.
- the pre-order transaction, intermediate transaction and post-sequence transaction described in this plan are the basic transaction mechanisms when only the transaction is implemented, and the modification of the pre-order transaction described in this plan is not inherited to the intermediary transaction. , the same is true for other situations, it is only to describe the basic transaction mechanism, and there will be partial overlap and various combinations of various types of second-class transactions in the specific implementation, which does not affect the method of this scheme. Realization, no matter what form of combination, the basic transaction mechanism of each of the two types of transactions is the transaction mechanism disclosed in this solution, and other technical solutions formed by any combination of the above technical features or their equivalent features are all of this solution. within the scope of protection.
- a computer device comprising: one or more processors; a memory for storing one or more programs that, when executed by the one or more processors, cause all The one or more processors execute the method described in Embodiment 1.
- a storage medium storing a computer program when the program is executed by a processor, implements the method described in Embodiment 1 above.
- FIG. 3 is a schematic structural diagram of a device provided in this embodiment.
- the present application also provides a device 500 including one or more central processing units (CPUs) 501 , which can operate according to a program stored in a read only memory (ROM) 502 or Various appropriate actions and processes are executed from the program loaded into the random access memory (RAM) 503 from the storage section 508 .
- ROM read only memory
- RAM random access memory
- various programs and data necessary for the operation of the device 500 are also stored.
- the CPU 501 , the ROM 502 , and the RAM 503 are connected to each other through a bus 504 .
- An input/output (I/O) interface 505 is also connected to bus 504 .
- the following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc. ; and a communication section 509 including a network interface card such as a LAN card, a modem, and the like.
- the communication section 509 performs communication processing via a network such as the Internet.
- the driver 510 is also connected to the I/O interface 505 as necessary.
- a removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 510 as needed so that a computer program read therefrom is installed into the storage section 508 as needed.
- Embodiment 1 can be implemented as a computer software program.
- embodiments disclosed herein include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing program code for performing the method described in any of the above-described embodiments.
- the computer program may be downloaded and installed from the network via the communication portion 509 and/or installed from the removable medium 511 .
- the present application also provides a computer-readable storage medium.
- the computer-readable storage medium may be a computer-readable storage medium included in the apparatus of the foregoing embodiment; A computer-readable storage medium in a device.
- the computer-readable storage medium stores one or more programs that are used by one or more processors to perform the methods described herein.
- each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions.
- the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved.
- each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by dedicated hardware-based systems that perform the specified functions or operations , or can be implemented by a combination of dedicated hardware and computer instructions.
- the units or modules involved in the embodiments of the present application may be implemented in a software manner, and may also be implemented in a hardware manner.
- the described units or modules may also be provided in the processor, for example, each of the units may be a software program provided in a computer or a mobile smart device, or may be a separately configured hardware device. Wherein, the names of these units or modules do not constitute limitations on the units or modules themselves under certain circumstances.
Landscapes
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Finance (AREA)
- Engineering & Computer Science (AREA)
- Development Economics (AREA)
- Strategic Management (AREA)
- Physics & Mathematics (AREA)
- General Business, Economics & Management (AREA)
- General Physics & Mathematics (AREA)
- Economics (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Marketing (AREA)
- Technology Law (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
A transaction fee payment method based on parallel execution, and a device and a storage medium, which belong to the technical field of computers and by means of which parallel execution acceleration of transactions can be performed for the same transaction initiator, such that transaction parallel acceleration can be used in a more relaxed environment, especially when transactions are sent by means of a transaction sending proxy mechanism, and parallel execution acceleration of the transactions can still be performed for the same transaction initiator.
Description
本发明涉及信息技术领域,尤其涉及一种基于并行执行的交易费支付方法、设备及储存介质。The invention relates to the field of information technology, and in particular, to a transaction fee payment method, device and storage medium based on parallel execution.
区块链中的节点通过发送交易而进行转账、存入数据等业务,区块链中的记账节点在交易池中收集区块链中的交易,然后执行交易,并在执行交易之后,将这些交易打包到区块中并扩散到区块链中。目前公链***中,为了防止恶意用户进行攻击,需要收取一定的交易费,这样就可以有效防止防御巨量交易攻击区块链***,然而在交易进行并行执行时交易费的支付需要重新设计,防止由于并行执行而造成交易的错误执行,例如账户余额不足以支付交易费时,由于并行执行的缘故而导致原本不能被打包的交易最终被执行。Nodes in the blockchain conduct transfers, deposit data and other services by sending transactions. The accounting nodes in the blockchain collect transactions in the blockchain in the transaction pool, and then execute the transaction. These transactions are packaged into blocks and diffused into the blockchain. In the current public chain system, in order to prevent malicious users from attacking, a certain transaction fee needs to be charged, which can effectively prevent the defense against massive transactions from attacking the blockchain system. However, when transactions are executed in parallel, the payment of transaction fees needs to be redesigned. To prevent the wrong execution of transactions due to parallel execution, for example, when the account balance is not enough to pay the transaction fee, the transaction that could not be packaged due to the parallel execution is finally executed.
在chain33区块链账户模型和交易执行模型中,交易费的的支付统一在coins合约进行,当同一发起方发起多笔合约交易时例如代理环境下,存在多笔交易费需要从该发起方的账户中进行扣除,但是当区块链***采用并行交易机制进行执行时,交易执行不再按照交易顺序进行执行,此时原来的交易费支付机制可能会导致交易无法并行执行。In the chain33 blockchain account model and transaction execution model, the payment of transaction fees is unified in the coins contract. When the same initiator initiates multiple contract transactions, such as in an agency environment, there are multiple transaction fees that need to be paid from the initiator's The account is deducted, but when the blockchain system uses the parallel transaction mechanism to execute, the transaction execution is no longer executed in the transaction order, and the original transaction fee payment mechanism may cause the transaction to be unable to execute in parallel.
综上所述,目前亟需一种基于并行执行的交易费支付方法,使得其不影响相同交易发起方的情况下,也能为不同类型的交易进行并行加速执行。To sum up, there is an urgent need for a transaction fee payment method based on parallel execution, which enables parallel accelerated execution of different types of transactions without affecting the same transaction initiator.
发明内容SUMMARY OF THE INVENTION
一、发明目的1. Purpose of the Invention
针对上述技术问题,本发明提供一种基于并行执行的交易费支付方法、设备及储存介质,能够为相同的交易发起方进行交易的并行执行加速。In view of the above technical problems, the present invention provides a transaction fee payment method, device and storage medium based on parallel execution, which can accelerate the parallel execution of transactions for the same transaction initiator.
二、技术方案2. Technical solutions
为解决上述技术问题,本发明所提供的技术方案如下:For solving the above-mentioned technical problems, the technical solutions provided by the present invention are as follows:
第一方面,一种基于并行执行的交易费支付方法,包括:In a first aspect, a transaction fee payment method based on parallel execution, comprising:
解析区块中所有待执行交易的发起方,获取发起方列表;依据所述发起方列表为每个发起方构建交易信息表,所述交易信息表包括其对应的发起方发起的所有待执行交易的交易信息;其中,所述交易信息包括Tx-index、type、previous、 current和balance;所述待执行交易包括一类交易和二类交易,所述一类交易为coins合约交易,所述二类交易为除coins交易外的其他类型合约交易;Analyze all initiators of transactions to be executed in the block, and obtain a list of initiators; build a transaction information table for each initiator according to the initiator list, and the transaction information table includes all transactions to be executed initiated by its corresponding initiator The transaction information; wherein, the transaction information includes Tx-index, type, previous, current and balance; the to-be-executed transaction includes a first-class transaction and a second-class transaction, and the first-class transaction is a coins contract transaction, and the second-class transaction is a coins contract transaction. Class transactions are other types of contract transactions except for coins transactions;
所述二类交易依据其与一类交易的执行顺序关系分为前序交易、居中交易和后序交易,所述前序交易为交易执行顺序在所有一类交易之前的二类交易,所述居中交易为交易执行顺序在两个一类交易之间的二类交易,所述后序交易为交易执行顺序在所有一类交易之后的二类交易;The second-class transactions are divided into pre-order transactions, intermediate transactions and post-order transactions according to their execution sequence relationship with the first-class transactions, and the pre-order transactions are the second-class transactions whose transaction execution order precedes all the first-class transactions. The intermediate transaction is a second-class transaction in which the transaction execution order is between two first-class transactions, and the post-sequence transaction is a second-class transaction whose transaction execution order is after all the first-class transactions;
所述交易费支付方法包括:The transaction fee payment methods include:
前序交易:执行前序交易时,所有一类交易的previous、current和balance的值均需要扣除所述前序交易的交易费作为新的previous、current和balance;Pre-order transaction: When executing a pre-order transaction, the values of previous, current and balance of all types of transactions need to deduct the transaction fee of the pre-order transaction as the new previous, current and balance;
居中交易:执行居中交易时,首先获取排序在待执行居中交易之前的与待执行居中交易相邻的一类交易的balance的值作为所述待执行居中交易的previous,采用上述balance的值减去交易费后的数据作为所述待执行居中交易新的current和balance;然后采用所述待执行居中交易更新后balance的值作为交易顺序在所述待执行居中交易之后的与待执行居中交易相邻的一类交易的previous的值,再将该一类交易的current和balance的值减去所述执行居中交易的交易费作为其新的current和balance;Centering transaction: When executing a centering transaction, first obtain the value of the balance of a class of transactions adjacent to the centering transaction to be executed before the centering transaction to be executed, as the previous centering transaction to be executed, and subtract the value of the above balance from the value of the centering transaction to be executed. The data after the transaction fee is used as the new current and balance of the to-be-executed centering transaction; then the updated balance value of the to-be-executed centering transaction is used as the transaction sequence after the to-be-executed centering transaction is adjacent to the to-be-executed centering transaction The previous value of a type of transaction, and then the value of current and balance of this type of transaction minus the transaction fee for executing the intermediate transaction is taken as its new current and balance;
后序交易:执行后序交易时,获取与待执行后序交易相邻的一类交易的balance的值作为所述待执行后序交易的previous,将所述待执行后序交易的current和balance修改为与待执行后序交易相邻的一类交易的balance减去所述待执行后序交易的交易费后的值。Post-sequence transaction: When executing a post-sequence transaction, obtain the value of the balance of a type of transaction adjacent to the post-sequence transaction to be executed as the previous of the post-sequence transaction to be executed, and use the current and balance of the post-sequence transaction to be executed. Modified to a value obtained by subtracting the transaction fee of the post-sequence transaction to be executed from the balance of a type of transaction adjacent to the post-sequence transaction to be executed.
作为优选,前序交易所有一类交易新的current值均大于0,否则不打包所述前序交易。Preferably, the new current value of all types of transactions in the pre-order transaction is greater than 0, otherwise, the pre-order transaction is not packaged.
作为优选,居中交易所述待执行居中交易新的current和balance均大于0,且交易顺序在所述待执行居中交易之后的与待执行居中交易相邻的一类交易新的current和balance也大于0,否则不打包所述待执行居中交易。Preferably, the new current and balance of the to-be-executed intermediate transaction of the intermediate transaction are both greater than 0, and the new current and balance of a class of transactions adjacent to the to-be-executed intermediate transaction whose transaction order is after the pending intermediate transaction are also greater than 0, otherwise the pending centering transaction is not packaged.
第二方面,一种计算机设备,一个或多个处理器;In a second aspect, a computer device, one or more processors;
存储器,用于存储一个或多个程序,memory for storing one or more programs,
当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如第一方面及其优选方案任意一项所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to perform the method according to any one of the first aspect and the preferred embodiments thereof.
第三方面,一种存储有计算机程序的存储介质,该程序被处理器执行时实现如第一方面及其优选方案任意一项所述的方法。In a third aspect, a storage medium storing a computer program, when the program is executed by a processor, implements the method according to any one of the first aspect and its preferred solutions.
采用本发明提供的技术方案,与现有技术相比,具有使得交易并行加速可以在更宽松的环境中使用,尤其是当使用交易发送代理机制发送交易时,仍然能够为相同的交易发起方进行交易的并行执行加速的有益效果。Using the technical solution provided by the present invention, compared with the prior art, the parallel acceleration of the transaction can be used in a more relaxed environment, especially when the transaction is sent by the transaction sending proxy mechanism, the transaction can still be carried out for the same transaction initiator. Beneficial effect of accelerated parallel execution of transactions.
图1为本发明实施例1的交易发起方列表示意图;1 is a schematic diagram of a transaction initiator list according to Embodiment 1 of the present invention;
图2为本发明实施例1中from_0的交易信息表示意图;2 is a schematic diagram of a transaction information table of from_0 in Embodiment 1 of the present invention;
图3为实施例2提供的一种设备的结构示意图。FIG. 3 is a schematic structural diagram of a device provided in Embodiment 2. FIG.
为进一步了解本发明的内容,结合附图及实施例对本发明作详细描述。In order to further understand the content of the present invention, the present invention will be described in detail with reference to the accompanying drawings and embodiments.
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与发明相关的部分。The present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for the convenience of description, only the parts related to the invention are shown in the drawings.
本发明中所述的第一、第二等词语,是为了描述本发明的技术方案方便而设置,并没有特定的限定作用,均为泛指,对本发明的技术方案不构成限定作用。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。The terms "first" and "second" mentioned in the present invention are provided for the convenience of describing the technical solutions of the present invention, and have no specific limiting effect. It should be noted that the embodiments in the present application and the features of the embodiments may be combined with each other in the case of no conflict. The present application will be described in detail below with reference to the accompanying drawings and in conjunction with the embodiments.
实施例1Example 1
一种基于并行执行的交易费支付方法,包括:A transaction fee payment method based on parallel execution, comprising:
解析区块中所有待执行交易的发起方,获取发起方列表;依据所述发起方列表为每个发起方构建交易信息表,所述交易信息表包括其对应的发起方发起的所有待执行交易的交易信息;其中,所述交易信息包括Tx-index、type、previous、current和balance;所述待执行交易包括一类交易和二类交易,所述一类交易为coins合约交易,所述二类交易为除coins交易外的其他类型合约交易;Analyze all initiators of transactions to be executed in the block, and obtain a list of initiators; build a transaction information table for each initiator according to the initiator list, and the transaction information table includes all transactions to be executed initiated by its corresponding initiator The transaction information; wherein, the transaction information includes Tx-index, type, previous, current and balance; the to-be-executed transaction includes a first-class transaction and a second-class transaction, the first-class transaction is a coins contract transaction, and the second-class transaction Class transactions are other types of contract transactions except for coins transactions;
所述二类交易依据其与一类交易的执行顺序关系分为前序交易、居中交易和后序交易,所述前序交易为交易执行顺序在所有一类交易之前的二类交易,所述居中交易为交易执行顺序在两个一类交易之间的二类交易,所述后序交易为交易 执行顺序在所有一类交易之后的二类交易;The second-class transactions are divided into pre-order transactions, intermediate transactions and post-order transactions according to their execution sequence relationship with the first-class transactions, and the pre-order transactions are the second-class transactions whose transaction execution order precedes all the first-class transactions. The intermediate transaction is a second-class transaction in which the transaction execution order is between two first-class transactions, and the post-sequence transaction is a second-class transaction whose transaction execution order is after all the first-class transactions;
所述交易费支付方法包括:The transaction fee payment methods include:
前序交易:执行前序交易时,所有一类交易的previous、current和balance的值均需要扣除所述前序交易的交易费作为新的previous、current和balance,其中,所有一类交易新的current值均大于0,否则不打包所述前序交易;Pre-order transaction: When executing a pre-order transaction, the values of previous, current and balance of all types of transactions need to be deducted from the transaction fees of the pre-order transaction as new previous, current and balance. The current values are all greater than 0, otherwise the pre-order transaction will not be packaged;
居中交易:执行居中交易时,首先获取排序在待执行居中交易之前的与待执行居中交易相邻的一类交易的balance的值作为所述待执行居中交易的previous,采用上述balance的值减去交易费后的数据作为所述待执行居中交易新的current和balance;然后采用所述待执行居中交易更新后balance的值作为交易顺序在所述待执行居中交易之后的与待执行居中交易相邻的一类交易的previous的值,再将该一类交易的current和balance的值减去所述执行居中交易的交易费作为其新的current和balance;其中,所述待执行居中交易新的current和balance均大于0,且交易顺序在所述待执行居中交易之后的与待执行居中交易相邻的一类交易新的current和balance也大于0,否则不打包所述待执行居中交易Centering transaction: When executing a centering transaction, first obtain the value of the balance of a class of transactions adjacent to the centering transaction to be executed before the centering transaction to be executed, as the previous centering transaction to be executed, and subtract the value of the above balance from the value of the centering transaction to be executed. The data after the transaction fee is used as the new current and balance of the to-be-executed centering transaction; then the updated balance value of the to-be-executed centering transaction is used as the transaction sequence after the to-be-executed centering transaction is adjacent to the to-be-executed centering transaction The previous value of a type of transaction, and then the value of current and balance of this type of transaction minus the transaction fee for executing the intermediate transaction is taken as its new current and balance; wherein, the new current and balance of the intermediate transaction to be executed and balance are both greater than 0, and the new current and balance of a class of transactions adjacent to the to-be-executed centering transaction after the to-be-executed centering transaction are also greater than 0, otherwise the pending to-be-executed centering transaction will not be packaged
后序交易:执行后序交易时,获取与待执行后序交易相邻的一类交易的balance的值作为所述待执行后序交易的previous,将所述待执行后序交易的current和balance修改为与待执行后序交易相邻的一类交易的balance减去所述待执行后序交易的交易费后的值。Post-sequence transaction: When executing a post-sequence transaction, obtain the value of the balance of a type of transaction adjacent to the post-sequence transaction to be executed as the previous of the post-sequence transaction to be executed, and use the current and balance of the post-sequence transaction to be executed. Modified to a value obtained by subtracting the transaction fee of the post-sequence transaction to be executed from the balance of a type of transaction adjacent to the post-sequence transaction to be executed.
与现有技术相比,本实施例所提供的方案具有使得交易并行加速可以在更宽松的环境中使用,尤其是当使用交易发送代理机制发送交易时,仍然能够为相同的交易发起方进行交易的并行执行加速的有益效果。Compared with the prior art, the solution provided by this embodiment has the advantage that parallel acceleration of transactions can be used in a more relaxed environment, especially when transactions are sent using the transaction sending proxy mechanism, transactions can still be performed for the same transaction initiator. The beneficial effect of parallel execution acceleration.
上述技术方案中,由于coins合约交易本身能够修改交易地址的余额故其交易费可按现有技术手段直接在执行coins合约交易时直接扣除,本方案中不做限定,对于非coins合约交易,其交易费需要通过coins合约进行结算,因此,当交易为前序交易时,前序交易之后的所有coins交易的账户现有余额即current均要大于前序交易的交易费,以保证前序交易执行时的交易费不会缺少,若存在coins交易的账户现有余额小于交易费的情况,那么该前序交易将被移除。当在执行居中交易时,居中交易的previous为上一coins交易的账户结余即 balance,而居中交易对于账户余额的修改仅为交易费,则居中交易的current和balance均修改为上一coins交易的账户结余减去居中交易的交易费即可,而在居中交易之后的coins交易的previous则要沿用居中交易的账户结余,即采用居中交易的balance,且居中交易之后的coins交易的current和balance同样也需要减去居中交易的交易费,如此才将居中交易的交易费实际结算于地址账户中,居中交易因其交易费的产生实际上修改了账户的余额,但二类交易不直接修改账户余额,故而在其之后的coins中体现,那么居中交易之后的coins交易将交易费体现,而之前的coins交易则不受影响。对于后序交易,同样其为二类交易,二类交易仅有交易费记入coin交易中,也就是说仅有交易费改变账户的余额,故其previous沿用上一coins交易的账户余额,其交易过程仅仅是扣除交易费,则其current和balance采用上一coins交易的账户余额减去交易费即可,如此即将其交易费计入账中。采用此方法后,所有二类交易的交易费均在执行器得到解析,若账户余额不足会将二类交易进行去除,那么当交易需要并行执行时就无需再考虑交易费不足的情况,特别适用于代理场景,存在交易代理时,代理方的账户会多次成为交易发起方,若按现有的交易费支付机制,根本无法实行并行交易,交易费的结算会对交易并行造成影响,而采用本方法进行交易费结算能够为相同的交易发起方进行交易的并行执行加速。In the above technical solution, since the coins contract transaction itself can modify the balance of the transaction address, the transaction fee can be directly deducted when executing the coins contract transaction according to the existing technical means, which is not limited in this solution. For non-coins contract transactions, its The transaction fee needs to be settled through the coins contract. Therefore, when the transaction is a pre-order transaction, the existing account balance of all coins transactions after the pre-order transaction, i.e. current, must be greater than the transaction fee of the pre-order transaction to ensure the execution of the pre-order transaction. There will be no shortage of transaction fees at the time of the transaction. If there is a situation where the existing balance of the coin transaction account is less than the transaction fee, the previous transaction will be removed. When performing a centering transaction, the previous of the centering transaction is the account balance of the previous coins transaction, namely balance, and the modification of the account balance in the centering transaction is only the transaction fee, then the current and balance of the centering transaction are both modified to the previous coins transaction. The account balance can be subtracted from the transaction fee of the centering transaction, and the previous coins transaction after the centering transaction should use the account balance of the centering transaction, that is, the balance of the centering transaction is used, and the current and balance of the coins transaction after the centering transaction are the same. It is also necessary to deduct the transaction fee of the intermediate transaction, so that the transaction fee of the intermediate transaction is actually settled in the address account. The intermediate transaction actually modifies the account balance due to the transaction fee, but the second-class transaction does not directly modify the account balance. , so it is reflected in the coins after it, then the coins transaction after the center transaction will reflect the transaction fee, while the previous coins transaction will not be affected. For the subsequent transaction, it is also a second-class transaction. For the second-class transaction, only the transaction fee is recorded in the coin transaction, that is to say, only the transaction fee changes the account balance, so the previous uses the account balance of the previous coins transaction, and its The transaction process is only to deduct the transaction fee, then its current and balance can use the account balance of the last coins transaction minus the transaction fee, so that the transaction fee is included in the account. After this method is adopted, the transaction fees of all second-class transactions are analyzed in the executor. If the account balance is insufficient, the second-class transactions will be removed. When the transaction needs to be executed in parallel, there is no need to consider the insufficient transaction fee. This is especially suitable for In the agent scenario, when there is a transaction agent, the account of the agent will become the transaction initiator many times. If the existing transaction fee payment mechanism is used, parallel transactions cannot be implemented at all, and the settlement of transaction fees will affect the parallel transactions. The transaction fee settlement performed by the method can accelerate the parallel execution of transactions performed by the same transaction initiator.
本实施例中,解析区块中的所有交易发起方,获取交易发起方列表,如图1所示,from_0、from_1.......from_n,n<=Tx总数(交易总数),因为有可能同一个发起人发送了多笔交易。In this embodiment, all transaction initiators in the block are parsed, and a list of transaction initiators is obtained. As shown in Figure 1, from_0, from_1....from_n, n<= the total number of Tx (the total number of transactions), because It is possible that the same originator sent multiple transactions.
例如交易发起方from_0共发起6笔交易,这6笔交易的index分别为0、1、3、4、5、15,其中,index为0的是token交易,index为1,3,5的交易为coins合约交易,index为4的是privacy交易,index为15的是trade交易,构建from_0的交易信息表,如图2所示,from_0相关的其他合约交易与coins合约交易具有相同的账户修改地址,只有coins的转账交易会改变账户的余额,包括转账发起方和接收方,其他合约交易在区块中的顺序包括在所有coins交易之前,居中和之后3情况,具体的实现机制如下:For example, the transaction initiator from_0 initiated a total of 6 transactions. The indexes of these 6 transactions are 0, 1, 3, 4, 5, and 15 respectively. Among them, the index of 0 is the token transaction, and the index of 1, 3, and 5 is the transaction. For the coins contract transaction, the index of 4 is the privacy transaction, the index of 15 is the trade transaction, and the transaction information table of from_0 is constructed. As shown in Figure 2, other contract transactions related to from_0 have the same account modification address as the coins contract transaction. , Only the transfer transaction of coins will change the balance of the account, including the transfer initiator and receiver. The order of other contract transactions in the block includes three cases before, in the middle and after all coins transactions. The specific implementation mechanism is as follows:
1.前序交易1. Pre-order transaction
如图2中所示的token交易,其index为0,在区块链中的交易执行顺序在 index为1的coins之前,故而,token交易的回执不用修改,而index为1,3,5的三笔coins合约中的previous和current及balance值都需要减掉tx为0的交易费,并同时判断减掉之后的current的值必须大于等于0,否认账户余额不足,该笔交易不能被打包。As shown in Figure 2, the token transaction has an index of 0, and the transaction execution order in the blockchain is before the coins whose index is 1. Therefore, the receipt of the token transaction does not need to be modified. The previous, current and balance values in the three coins contracts need to be subtracted from the transaction fee with tx being 0. At the same time, it is judged that the value of current after subtraction must be greater than or equal to 0. It is denied that the account balance is insufficient and the transaction cannot be packaged.
2.居中交易2. Centering transactions
如图2中所示的privacy交易,其index为4,在区块链中的交易执行顺序在index为3的coins之后,在index为5的交易之前,故而,As shown in Figure 2, the privacy transaction has an index of 4. The transaction execution order in the blockchain is after the coins with index 3 and before the transaction with index 5. Therefore,
coins交易1和3的回执不用修改;The receipts of coins transactions 1 and 3 do not need to be modified;
index为4的privacy交易的previous由替换index为3的balance替换,且current和balance都修改为balance-txfee;The previous of the privacy transaction with index 4 is replaced by the balance with index 3, and both current and balance are modified to balance-txfee;
而index为5的coins交易,其previous由privacy交易的balance代替,而current及balance值都需要减掉交易privacy的交易费;For the coins transaction with index 5, its previous is replaced by the balance of the privacy transaction, and the current and balance values need to be subtracted from the transaction fee of the transaction privacy;
其中的修改过程中发生balance不足以支付交易费时,则将该笔交易剔除,不将其进行打包。When the balance is not enough to pay the transaction fee during the modification process, the transaction will be eliminated and not packaged.
3.后序交易3. Post-order transactions
如图2中所示的trade交易,其index为15,在区块链中的交易执行顺序在在index为5的coins之后,于是将previous替换为index为5的balance替换,且current和balance都修改为balance-txfee。The trade transaction shown in Figure 2 has an index of 15, and the transaction execution order in the blockchain is after coins with an index of 5, so replace the previous with the balance with an index of 5, and both current and balance are Modified to balance-txfee.
此处需要说明的是,本方案中所阐述的前序交易、居中交易和后序交易均为仅实施该交易时的基础交易机制,本方案描述中的前序交易修改并不继承至居中交易,其他情况也同理,仅仅是描述基本的交易机制,而具体实施中各个类型的二类交易的时候会存在部分的重合,且会存在多种形式的组合,这并不影响本方案方法的实现,无论哪种形式的组合情况其各中二类交易的基础交易机制均为本方案所公开的交易机制,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案均为本方案的保护范围内。It should be noted here that the pre-order transaction, intermediate transaction and post-sequence transaction described in this plan are the basic transaction mechanisms when only the transaction is implemented, and the modification of the pre-order transaction described in this plan is not inherited to the intermediary transaction. , the same is true for other situations, it is only to describe the basic transaction mechanism, and there will be partial overlap and various combinations of various types of second-class transactions in the specific implementation, which does not affect the method of this scheme. Realization, no matter what form of combination, the basic transaction mechanism of each of the two types of transactions is the transaction mechanism disclosed in this solution, and other technical solutions formed by any combination of the above technical features or their equivalent features are all of this solution. within the scope of protection.
实施例2Example 2
一种计算机设备,所述设备包括:一个或多个处理器;存储器,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如实施例1所述的方法。A computer device comprising: one or more processors; a memory for storing one or more programs that, when executed by the one or more processors, cause all The one or more processors execute the method described in Embodiment 1.
一种存储有计算机程序的存储介质,该程序被处理器执行时实现如以上实施例1所述的方法。A storage medium storing a computer program, when the program is executed by a processor, implements the method described in Embodiment 1 above.
图3为本实施例提供的一种设备的结构示意图。FIG. 3 is a schematic structural diagram of a device provided in this embodiment.
如图3所示,作为另一方面,本申请还提供了一种设备500,包括一个或多个中央处理单元(CPU)501,其可以根据存储在只读存储器(ROM)502中的程序或者从存储部分508加载到随机访问存储器(RAM)503中的程序而执行各种适当的动作和处理。在RAM503中,还存储有设备500操作所需的各种程序和数据。CPU501、ROM502以及RAM503通过总线504彼此相连。输入/输出(I/O)接口505也连接至总线504。As shown in FIG. 3 , as another aspect, the present application also provides a device 500 including one or more central processing units (CPUs) 501 , which can operate according to a program stored in a read only memory (ROM) 502 or Various appropriate actions and processes are executed from the program loaded into the random access memory (RAM) 503 from the storage section 508 . In the RAM 503, various programs and data necessary for the operation of the device 500 are also stored. The CPU 501 , the ROM 502 , and the RAM 503 are connected to each other through a bus 504 . An input/output (I/O) interface 505 is also connected to bus 504 .
以下部件连接至I/O接口505:包括键盘、鼠标等的输入部分506;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分507;包括硬盘等的存储部分508;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分509。通信部分509经由诸如因特网的网络执行通信处理驱动器510也根据需要连接至I/O接口505。可拆卸介质511,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器510上,以便于从其上读出的计算机程序根据需要被安装入存储部分508。The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc. ; and a communication section 509 including a network interface card such as a LAN card, a modem, and the like. The communication section 509 performs communication processing via a network such as the Internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is mounted on the drive 510 as needed so that a computer program read therefrom is installed into the storage section 508 as needed.
特别地,根据本申请公开的实施例,上述实施例1所描述的方法可以被实现为计算机软件程序。例如,本申请公开的实施例包括一种计算机程序产品,其包括有形地包含在机器可读介质上的计算机程序,所述计算机程序包含用于执行上述任一实施例描述的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分509从网络上被下载和安装,和/或从可拆卸介质511被安装。In particular, according to the embodiments disclosed in the present application, the method described in Embodiment 1 above can be implemented as a computer software program. For example, embodiments disclosed herein include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing program code for performing the method described in any of the above-described embodiments. In such an embodiment, the computer program may be downloaded and installed from the network via the communication portion 509 and/or installed from the removable medium 511 .
作为又一方面,本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例的装置中所包含的计算机可读存储介质;也可以是单独存在,未装配入设备中的计算机可读存储介质。计算机可读存储介质存储有一个或者一个以上程序,该程序被一个或者一个以上的处理器用来执行描述于本申请的方法。As yet another aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium may be a computer-readable storage medium included in the apparatus of the foregoing embodiment; A computer-readable storage medium in a device. The computer-readable storage medium stores one or more programs that are used by one or more processors to perform the methods described herein.
附图中的流程图和框图,图示了按照本发明各种实施例的***、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代 码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这根据所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以通过执行规定的功能或操作的专用的基于硬件的***来实现,或者可以通过专用硬件与计算机指令的组合来实现。The flowchart and block diagrams in the Figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code that contains one or more logical functions for implementing the specified functions executable instructions. It should also be noted that, in some alternative implementations, the functions noted in the blocks may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations, can be implemented by dedicated hardware-based systems that perform the specified functions or operations , or can be implemented by a combination of dedicated hardware and computer instructions.
描述于本申请实施例中所涉及到的单元或模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元或模块也可以设置在处理器中,例如,各所述单元可以是设置在计算机或移动智能设备中的软件程序,也可以是单独配置的硬件装置。其中,这些单元或模块的名称在某种情况下并不构成对该单元或模块本身的限定。The units or modules involved in the embodiments of the present application may be implemented in a software manner, and may also be implemented in a hardware manner. The described units or modules may also be provided in the processor, for example, each of the units may be a software program provided in a computer or a mobile smart device, or may be a separately configured hardware device. Wherein, the names of these units or modules do not constitute limitations on the units or modules themselves under certain circumstances.
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离本申请构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the present application and an illustration of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in the present application is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, and should also cover, without departing from the concept of the present application, the above-mentioned technical features or Other technical solutions formed by any combination of its equivalent features. For example, a technical solution is formed by replacing the above-mentioned features with the technical features disclosed in this application (but not limited to) with similar functions.
Claims (5)
- 一种基于并行执行的交易费支付方法,其特征在于,解析区块中所有待执行交易的发起方,获取发起方列表;依据所述发起方列表为每个发起方构建交易信息表,所述交易信息表包括其对应的发起方发起的所有待执行交易的交易信息;其中,所述交易信息包括Tx-index、type、previous、current和balance;所述待执行交易包括一类交易和二类交易,所述一类交易为coins合约交易,所述二类交易为除coins交易外的其他类型合约交易;A transaction fee payment method based on parallel execution, characterized in that, analyzing all initiators of transactions to be executed in a block, and obtaining a list of initiators; constructing a transaction information table for each initiator according to the initiator list, and the The transaction information table includes transaction information of all pending transactions initiated by its corresponding initiator; wherein, the transaction information includes Tx-index, type, previous, current, and balance; the pending transactions include first-class transactions and second-class transactions Transaction, the first type of transaction is the coins contract transaction, and the second type of transaction is the other type of contract transaction except the coins transaction;所述二类交易依据其与一类交易的执行顺序关系分为前序交易、居中交易和后序交易,所述前序交易为交易执行顺序在所有一类交易之前的二类交易,所述居中交易为交易执行顺序在两个一类交易之间的二类交易,所述后序交易为交易执行顺序在所有一类交易之后的二类交易;The second-class transactions are divided into pre-order transactions, intermediate transactions and post-order transactions according to their execution sequence relationship with the first-class transactions, and the pre-order transactions are the second-class transactions whose transaction execution order precedes all the first-class transactions. The intermediate transaction is a second-class transaction in which the transaction execution order is between two first-class transactions, and the post-sequence transaction is a second-class transaction whose transaction execution order is after all the first-class transactions;所述交易费支付方法包括:The transaction fee payment methods include:前序交易:执行前序交易时,所有一类交易的previous、current和balance的值均需要扣除所述前序交易的交易费作为新的previous、current和balance;居中交易:执行居中交易时,首先获取排序在待执行居中交易之前的与待执行居中交易相邻的一类交易的balance的值作为所述待执行居中交易的previous,采用上述balance的值减去交易费后的数据作为所述待执行居中交易新的current和balance;然后采用所述待执行居中交易更新后balance的值作为交易顺序在所述待执行居中交易之后的与待执行居中交易相邻的一类交易的previous的值,再将该一类交易的current和balance的值减去所述待执行居中交易的交易费作为其新的current和balance;Pre-order transaction: When executing a pre-order transaction, the values of previous, current and balance of all types of transactions need to deduct the transaction fee of the pre-order transaction as the new previous, current and balance; First, obtain the value of the balance of a class of transactions adjacent to the centering transaction to be performed that is sorted before the centering transaction to be performed, as the previous centering transaction to be performed, and use the value of the balance minus the transaction fee as the data. The new current and balance of the centering transaction to be performed; then the value of balance after the centering transaction to be performed is updated as the previous value of a class of transactions adjacent to the centering transaction to be performed after the centering transaction to be performed in the transaction order , and then subtract the transaction fee of the intermediate transaction to be executed from the value of current and balance of this type of transaction as its new current and balance;后序交易:执行后序交易时,获取与待执行后序交易相邻的一类交易的balance的值作为所述待执行后序交易的previous,将所述待执行后序交易的current和balance修改为与待执行后序交易相邻的一类交易的balance减去所述待执行后序交易的交易费后的值。Post-sequence transaction: When executing a post-sequence transaction, obtain the value of the balance of a type of transaction adjacent to the post-sequence transaction to be executed as the previous of the post-sequence transaction to be executed, and use the current and balance of the post-sequence transaction to be executed. Modified to a value obtained by subtracting the transaction fee of the post-sequence transaction to be executed from the balance of a type of transaction adjacent to the post-sequence transaction to be executed.
- 根据权利要求1所述的一种基于并行执行的交易费支付方法,其特征在于,前序交易所有一类交易新的current值均大于0,否则不打包所述前序交易。A transaction fee payment method based on parallel execution according to claim 1, wherein the new current value of all types of transactions in the pre-order transaction is greater than 0, otherwise the pre-order transaction is not packaged.
- 根据权利要求1或2所述的一种基于并行执行的交易费支付方法,其特征在于,居中交易所述待执行居中交易新的current和balance均大于0,且交易顺序在所述待执行居中交易之后的与待执行居中交易相邻的一类交易新的 current和balance也大于0,否则不打包所述待执行居中交易。A transaction fee payment method based on parallel execution according to claim 1 or 2, wherein the new current and balance of the to-be-executed intermediate transaction of the intermediate transaction are both greater than 0, and the transaction order is in the to-be-executed intermediate transaction. The new current and balance of a class of transactions adjacent to the to-be-executed centering transaction after the transaction are also greater than 0, otherwise the to-be-executed centering transaction is not packaged.
- 一种计算机设备,其特征在于,一个或多个处理器;A computer device characterized by one or more processors;存储器,用于存储一个或多个程序,memory for storing one or more programs,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1-3中任一项所述的方法。The one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-3.
- 一种存储有计算机程序的存储介质,其特征在于,该程序被处理器执行时实现如权利要求1-3中任一项所述的方法。A storage medium storing a computer program, characterized in that, when the program is executed by a processor, the method according to any one of claims 1-3 is implemented.
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110264571.6 | 2021-03-11 | ||
CN202110264571.6A CN112950185B (en) | 2021-03-11 | 2021-03-11 | Transaction fee payment method, device and storage medium based on parallel execution |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2022188528A1 true WO2022188528A1 (en) | 2022-09-15 |
Family
ID=76229463
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2021/143839 WO2022188528A1 (en) | 2021-03-11 | 2021-12-31 | Transaction fee payment method based on parallel execution, and device and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN112950185B (en) |
WO (1) | WO2022188528A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112950185B (en) * | 2021-03-11 | 2023-10-20 | 杭州复杂美科技有限公司 | Transaction fee payment method, device and storage medium based on parallel execution |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070131761A1 (en) * | 2005-12-09 | 2007-06-14 | Mastercard International Incorporated | Techniques for co-existence of multiple stored value applications on a single payment device managing a shared balance |
CN109784930A (en) * | 2019-02-18 | 2019-05-21 | 深圳市网心科技有限公司 | A kind of processing method, device, electronic equipment and the medium of block chain transaction data |
CN110599166A (en) * | 2019-09-09 | 2019-12-20 | 深圳前海微众银行股份有限公司 | Method and device for acquiring transaction dependency relationship in block chain |
CN111095325A (en) * | 2019-04-12 | 2020-05-01 | 阿里巴巴集团控股有限公司 | Parallel execution of transactions in a distributed ledger system |
CN112150163A (en) * | 2020-11-26 | 2020-12-29 | 北京微芯区块链与边缘计算研究院 | Block chain contract transaction parallel execution method and device |
CN112950185A (en) * | 2021-03-11 | 2021-06-11 | 杭州复杂美科技有限公司 | Transaction fee payment method, device and storage medium based on parallel execution |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019203735A1 (en) * | 2018-04-19 | 2019-10-24 | Vechain Foundation Limited | Transaction processing |
CN109636384A (en) * | 2018-10-26 | 2019-04-16 | 阿里巴巴集团控股有限公司 | A kind of parallelization executes the method, apparatus and system of block chain transaction |
CN111292192A (en) * | 2020-02-18 | 2020-06-16 | 杭州复杂美科技有限公司 | Transaction parallel execution method, device and storage medium |
CN111339108A (en) * | 2020-02-18 | 2020-06-26 | 杭州复杂美科技有限公司 | Transaction parallel execution method, device and storage medium |
CN111858773B (en) * | 2020-07-30 | 2023-11-28 | 杭州复杂美科技有限公司 | Transaction packaging method, device and storage medium |
-
2021
- 2021-03-11 CN CN202110264571.6A patent/CN112950185B/en active Active
- 2021-12-31 WO PCT/CN2021/143839 patent/WO2022188528A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20070131761A1 (en) * | 2005-12-09 | 2007-06-14 | Mastercard International Incorporated | Techniques for co-existence of multiple stored value applications on a single payment device managing a shared balance |
CN109784930A (en) * | 2019-02-18 | 2019-05-21 | 深圳市网心科技有限公司 | A kind of processing method, device, electronic equipment and the medium of block chain transaction data |
CN111095325A (en) * | 2019-04-12 | 2020-05-01 | 阿里巴巴集团控股有限公司 | Parallel execution of transactions in a distributed ledger system |
CN110599166A (en) * | 2019-09-09 | 2019-12-20 | 深圳前海微众银行股份有限公司 | Method and device for acquiring transaction dependency relationship in block chain |
CN112150163A (en) * | 2020-11-26 | 2020-12-29 | 北京微芯区块链与边缘计算研究院 | Block chain contract transaction parallel execution method and device |
CN112950185A (en) * | 2021-03-11 | 2021-06-11 | 杭州复杂美科技有限公司 | Transaction fee payment method, device and storage medium based on parallel execution |
Also Published As
Publication number | Publication date |
---|---|
CN112950185B (en) | 2023-10-20 |
CN112950185A (en) | 2021-06-11 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103677771B (en) | Processing method and device for concurrent transactions | |
WO2020088130A1 (en) | Blockchain-based property execution method and system | |
US8892468B1 (en) | Customer refunds by a merchant agent | |
WO2022262527A1 (en) | Digital currency-based payment method, platform, terminal, and payment system | |
CN112132674A (en) | Transaction processing method and device | |
CN111047310A (en) | Method and device for realizing distribution and transfer of digital assets and online financing | |
WO2022188528A1 (en) | Transaction fee payment method based on parallel execution, and device and storage medium | |
CN115187378A (en) | Loan automatic repayment method, system, computer equipment and storage medium | |
CN111008895B (en) | Internet finance repayment method, device, equipment and storage medium | |
KR20120124396A (en) | Concurrent execution of request processing and analytics of requests | |
US11216813B1 (en) | Business-to-business netting | |
CN109508949A (en) | A kind of credit Methods of initial evaluation of sci-tech and device | |
CN109829815B (en) | Method, apparatus and storage medium for collecting agent | |
CN116029825B (en) | Block chain transaction method, device and system, electronic equipment and storage medium | |
WO2020063180A1 (en) | Transaction processing method and device, electronic device and computer-readable storage medium | |
KR101500832B1 (en) | Withholding agency method and system performing the same | |
US11763359B2 (en) | Invoice numbering | |
CN112634006A (en) | Account checking processing method and device, electronic equipment and storage medium | |
WO2022110404A1 (en) | Resource transfer method and apparatus, and device and storage medium | |
CN108717622A (en) | Loaning bill refund treating method and apparatus | |
CN116468432B (en) | Order processing method, device, equipment and medium | |
KR102236887B1 (en) | A method and apparatus of transferring funds including fees and grant | |
CN112669020B (en) | Transaction application processing method, device and storage medium | |
CN113269627A (en) | Accounting processing method and device | |
US20230334500A1 (en) | Risk reserves |
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: 21929990 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: 21929990 Country of ref document: EP Kind code of ref document: A1 |