Nothing Special   »   [go: up one dir, main page]

CN113706146B - Processing method, device and system for executing batch transactions based on blockchain - Google Patents

Processing method, device and system for executing batch transactions based on blockchain Download PDF

Info

Publication number
CN113706146B
CN113706146B CN202110892853.0A CN202110892853A CN113706146B CN 113706146 B CN113706146 B CN 113706146B CN 202110892853 A CN202110892853 A CN 202110892853A CN 113706146 B CN113706146 B CN 113706146B
Authority
CN
China
Prior art keywords
transaction
batch
contract
transactions
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110892853.0A
Other languages
Chinese (zh)
Other versions
CN113706146A (en
Inventor
王晓亮
张亚宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Rivtower Technology Co Ltd
Original Assignee
Hangzhou Rivtower Technology Co Ltd
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 Hangzhou Rivtower Technology Co Ltd filed Critical Hangzhou Rivtower Technology Co Ltd
Priority to CN202110892853.0A priority Critical patent/CN113706146B/en
Publication of CN113706146A publication Critical patent/CN113706146A/en
Application granted granted Critical
Publication of CN113706146B publication Critical patent/CN113706146B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3825Use of electronic signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

One or more embodiments of the present specification disclose a processing method, apparatus and system for executing batch transactions based on blockchain, where the scheme includes: the target user terminal uses the address of the intelligent contract for batch transaction as the contract address, and splices transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the plurality of transactions are combined and created into one batch transaction; after signing the batch transaction, the batch transaction signature is sent to a blockchain node for verification, after verification passes and consensus packaging is carried out, batch transaction parameters are analyzed by calling batch transaction intelligent contracts corresponding to contract addresses, format verification is carried out on each transaction in sequence, and if all verification is correct, transaction subcontracts corresponding to subcontract addresses of each transaction are called in sequence to process corresponding transactions. Therefore, only one signature and signature verification are needed when the transaction is processed, the volume of data of batch transaction is smaller than that of a plurality of transaction data, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved.

Description

Processing method, device and system for executing batch transactions based on blockchain
Technical Field
The present document relates to the field of blockchain technologies, and in particular, to a processing method, device, and system for executing batch transactions based on blockchains.
Background
Blockchain is a solution for solving the decentralized innovation of the multiparty trust problem by using the distributed ledger wall technology, and is the leading edge technology of the current society.
When a user has a transaction to be processed, the transaction is generally signed and then sent to nodes on the blockchain for processing. When facing a plurality of transactions to be processed, each transaction needs to be signed respectively and then sequentially sent to the blockchain node, so that the transaction data received by the blockchain is saturated, and the blockchain is easily caused to be in a tension transaction processing process all the time.
In view of the foregoing, it is desirable to find a better processing scheme for multiple transactions.
Disclosure of Invention
It is an object of one or more embodiments of the present disclosure to provide a processing method, apparatus and system for executing batch transactions based on blockchain, so as to improve transaction processing efficiency, and at the same time, alleviate blockchain transaction processing pressure.
To solve the above technical problems, one or more embodiments of the present specification are implemented as follows:
in a first aspect, a processing method for executing batch transactions based on a blockchain is provided, and the processing method is applied to a processing system including a target user terminal and a blockchain network, wherein at least batch transaction intelligent contracts are deployed on the blockchain network; the method comprises the following steps:
The target user terminal creates a batch transaction based on a plurality of transactions to be submitted, signs the batch transaction, and sends the signed batch transaction to at least one blockchain node in the blockchain network for verification; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
After verification is passed and consensus packaging is carried out, other blockchain nodes acquire contract addresses through analyzing the batch transaction, and call the batch transaction intelligent contracts to verify each transaction corresponding to the batch transaction parameters based on the contract addresses;
If the verification is successful, the other block link points call corresponding transaction sub-contracts to process the transaction based on the transaction sub-contract address of each transaction;
if the verification fails, the process ends.
In a second aspect, a processing method for executing batch transactions based on a blockchain is provided, and the processing method is applied to a target user terminal, and the method comprises the following steps:
Creating a batch transaction based on a plurality of transactions to be submitted, and signing the batch transaction;
the signed batch transaction is sent to at least one blockchain node in the blockchain network for verification, so that the batch transaction can be processed after verification is passed;
the method comprises the steps of determining a batch transaction parameter of the batch transaction based on the transaction parameter of each transaction in the plurality of transactions, wherein the contract address of the batch transaction is the address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data.
In a third aspect, a processing method for executing batch transactions based on a blockchain is provided, and the processing method is applied to blockchain nodes on a blockchain network, wherein at least batch transaction intelligent contracts are deployed on the blockchain network; the method comprises the following steps:
Receiving batch transactions sent by a target user terminal, wherein the batch transactions are created and signed by the target user terminal based on a plurality of transactions to be submitted; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after verification is passed and consensus packaging is carried out, a contract address is obtained through analyzing the batch transaction, and each transaction corresponding to the batch transaction parameters is verified by calling the batch transaction intelligent contract based on the contract address;
if the verification is successful, calling a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction;
if the verification fails, the process ends.
In a fourth aspect, a processing system for performing bulk transactions based on a blockchain is provided, comprising: the system comprises a target user terminal and a blockchain network, wherein the blockchain network comprises a plurality of blockchain nodes, and at least batch transaction intelligent contracts are deployed on the blockchain network; wherein,
The target user terminal creates a batch transaction based on a plurality of transactions to be submitted, signs the batch transaction, and sends the signed batch transaction to at least one blockchain node in the blockchain network for verification; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
After verification is passed and consensus packaging is carried out, other blockchain nodes acquire contract addresses through analyzing the batch transaction, and call the batch transaction intelligent contracts to verify each transaction corresponding to the batch transaction parameters based on the contract addresses;
If the verification is successful, the other block link points call corresponding transaction sub-contracts to process the transaction based on the transaction sub-contract address of each transaction;
if the verification fails, the process ends.
In a fifth aspect, a target user terminal for performing bulk transactions based on a blockchain is provided, including:
the system comprises a creation module, a verification module and a verification module, wherein the creation module creates a batch transaction based on a plurality of transactions to be submitted and signs the batch transaction;
The sending module is used for sending the signed batch transaction to at least one blockchain node in the blockchain network for verification so as to process the batch transaction after the verification is passed;
the method comprises the steps of determining a batch transaction parameter of the batch transaction based on the transaction parameter of each transaction in the plurality of transactions, wherein the contract address of the batch transaction is the address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data.
In a sixth aspect, a blockchain node for performing bulk transactions based on a blockchain is provided, wherein at least a bulk transaction smart contract is deployed on the blockchain network; the block link points include:
the receiving module is used for receiving batch transactions sent by the target user terminal, wherein the batch transactions are created and signed by the target user terminal based on a plurality of transactions to be submitted; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
The first execution module is used for acquiring a contract address through analyzing the batch transaction after the verification module verifies the received batch transaction, and calling the batch transaction intelligent contract to verify each transaction corresponding to the batch transaction parameter based on the contract address;
The second execution module is used for calling a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction when verification is successful; and
The process ends when the authentication fails.
In a seventh aspect, an electronic device is provided, including:
A processor; and
A memory arranged to store computer executable instructions which, when executed, cause the processor to perform the steps of the method of the second or third aspect.
In an eighth aspect, a computer readable storage medium is presented, the computer readable storage medium storing one or more programs, which when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform the steps of the method of the second or third aspect.
According to the technical scheme provided by one or more embodiments of the present disclosure, the target user terminal may use the address of the intelligent contract for batch transaction as the contract address, and perform the splicing processing on the transaction parameters of the plurality of transactions to be submitted to obtain batch transaction parameters, so as to combine the plurality of transactions to create one batch transaction; after signing the batch transaction, sending the batch transaction signature to a blockchain node for verification, after the verification passes and the consensus packaging is carried out, calling a batch transaction intelligent contract corresponding to a contract address to analyze batch transaction parameters so as to sequentially carry out format verification on each transaction, and if all the verification is correct, sequentially calling a transaction sub-contract corresponding to a transaction sub-contract address of each transaction to process the corresponding transaction. Therefore, when the transaction is processed, only one signature and verification are needed, the volume of data of batch transaction is smaller than that of a plurality of transaction data, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved.
Drawings
For a clearer description of one or more embodiments of the present description or of the solutions of the prior art, reference will be made below to the accompanying drawings which are used in the description of one or more embodiments or of the prior art, it being apparent that the drawings in the description below are only some of the embodiments described in the description, from which, without inventive faculty, other drawings can also be obtained for a person skilled in the art.
FIG. 1 is a schematic diagram of a processing system architecture for performing bulk transactions based on blockchain as provided by embodiments of the present description.
FIG. 2 is a schematic diagram showing steps of a processing method for executing batch transactions based on a blockchain according to an embodiment of the present disclosure.
FIG. 3 is a second step diagram of a processing method for executing batch transactions based on blockchain according to the embodiment of the present disclosure.
FIG. 4 is a third step of a processing method for executing batch transactions based on blockchain according to the embodiment of the present disclosure.
FIG. 5 is a schematic block chain based processing system for executing batch transactions according to an embodiment of the present disclosure.
Fig. 6 is a schematic structural diagram of a target user terminal for performing batch transactions based on blockchain according to an embodiment of the present disclosure.
FIG. 7 is a block chain node architecture diagram for performing batch transactions based on a block chain, according to one embodiment of the present disclosure.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
In order that those skilled in the art will better understand the technical solutions in this specification, a clear and complete description of the technical solutions in one or more embodiments of this specification will be provided below with reference to the accompanying drawings in one or more embodiments of this specification, and it is apparent that the one or more embodiments described are only a part of embodiments of this specification, not all embodiments. All other embodiments, which can be made by one or more embodiments of the present disclosure without inventive faculty, are intended to be within the scope of the present disclosure.
A blockchain is typically made up of several blocks in which time stamps corresponding to the time of creation of the block are recorded, respectively, all of which constitute a temporally ordered chain of data strictly in accordance with the time stamps recorded in the block. For real data generated in the physical world, the real data can be constructed into a standard transaction (transaction) format supported by a blockchain, the standard transaction (transaction) format is issued to the blockchain, node equipment in the blockchain performs consensus processing on received transactions, and after the consensus is achieved, node equipment serving as an accounting node in the blockchain packages the transactions into blocks, and lasting certification is performed in the blockchain.
Tuple (tuple) is the basic concept in a relational database, a relation is a table, each row in the table (i.e., each record in the database) is a tuple, and each column is an attribute. In a two-dimensional table, tuples are also called rows.
The method signature is composed of a method name and a list of parameters (order and type of parameters of the method).
In view of the problems mentioned in the background art, the processing performance of the existing blockchain system for processing transactions is generally weaker than that of the conventional system, and in order to improve the transaction processing capability, a batch transaction processing scheme is proposed. At the beginning of transaction processing, bulk transaction intelligence contracts may be deployed on a blockchain network. In this way, the target user terminal can use the address of the intelligent contract for batch transaction as the contract address, and splice the transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the plurality of transactions are combined and created into one batch transaction; after signing the batch transaction, sending the batch transaction signature to a blockchain node for verification, after the verification passes and the consensus packaging is carried out, calling a batch transaction intelligent contract corresponding to a contract address to analyze batch transaction parameters so as to sequentially carry out format verification on each transaction, and if all the verification is correct, sequentially calling a transaction sub-contract corresponding to a transaction sub-contract address of each transaction to process the corresponding transaction. Therefore, when the transaction is processed, only one signature and verification are needed, the volume of data of batch transaction is smaller than that of a plurality of transaction data, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, the batch transaction scheme can save the transaction cost of the user for the situation of operating according to the transaction times.
Referring to FIG. 1, a schematic diagram of a processing system architecture for performing batch transactions based on blockchains is provided in accordance with an embodiment of the present disclosure. In this scenario, the target user terminal 102 may be a hardware electronic device or a software client that may communicate with at least one blockchain node 106 in the blockchain network 104. Similarly, the blockchain nodes 106 may also be hardware electronics or software clients, with the difference that each blockchain node 106 is provided with blockchain modules to collectively maintain the blockchain network 104 through deployed intelligent contracts. In this specification, not only transaction execution-related smart contracts (i.e., one or more transaction sub-contracts) but also bulk transaction smart contracts are deployed in the blockchain node 106 to enable bulk processing of multiple transactions.
Example 1
Referring to fig. 2, a schematic step diagram of a processing method for executing batch transactions based on a blockchain according to an embodiment of the present disclosure is applied to a processing system including a target user terminal and a blockchain network, where the blockchain network includes a plurality of blockchain nodes, and at least a batch transaction smart contract is deployed on the blockchain network; wherein, the method for batch transaction is provided in the intelligent batch transaction contract, and the method can have and has only one parameter, and the parameter type is bytes.
The processing method may include the steps of:
Step 202: the target user terminal creates a batch transaction based on a plurality of transactions to be submitted, signs the batch transaction, and sends the signed batch transaction to at least one blockchain node in the blockchain network for verification; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data.
It should be appreciated that the present description embodiments do not limit the number of transactions to be submitted, so long as the upper limit of the transaction transmission data size is not exceeded. The plurality of transactions to be submitted can be a plurality of transactions submitted by the user at one time or a plurality of transactions cached by the user submitted in multiple times.
Optionally, when creating a batch transaction based on a plurality of transactions to be submitted, the target user terminal may determine a data structure of each transaction respectively, and sequentially splice the determined plurality of data structures to obtain batch transaction parameters; and using the address of the intelligent contract for batch transaction as a contract address to create a batch transaction.
In other words, the target user terminal determines the bulk transaction parameters and the contract address of one bulk transaction to be created based on the transaction parameters of each of the plurality of transactions to be submitted. It should be appreciated that the transaction format of the bulk transaction is different from the transaction format of a common single transaction.
A common single transaction contains two parameters: target contract address and method data. Where the target contract address, i.e., the transaction sub-contract address corresponding to a single transaction, the method data is essentially a combination of method signatures and method parameters, and the method signatures are a combination of method names and parameter lists (order and type of method parameters). In the embodiment of the present specification, both the target contract address and the method data are understood as character strings, wherein the target contract address is a fixed length, and the method data is a variable length, i.e., the length is not fixed.
Batch transactions also contain two parameters: target contract address and bulk transaction parameters. The target contract address is the address of a batch transaction intelligent contract, and batch transaction parameters are spliced together by a data structure of a plurality of transactions. And the data structure of each transaction may be determined based on the transaction parameters of the transaction, in particular, the target user terminal determines the data length of the method data of the current transaction; and splicing the subcontract address, the data length and the method data corresponding to the current transaction to form a tuple structure. In fact, the tuple structure is only a format of a preferred batch transaction parameter, and the tuple structure can be simply spliced end to end. It will be appreciated that the subcontract address and the determined data length of each transaction are fixed lengths and the method data is variable length.
That is, when a user needs to send a batch transaction, firstly, calculating the data length of the method signature+the method parameter of the single sub-transaction, and then splicing the three parameters of the target contract address, the data length, the method signature+the method parameter to form a tuple structure: tuple (target contract address, data length, method signature+method parameters). And finally, signing the batch transaction, and sending the signed batch transaction to one or more blockchain nodes on the blockchain for verification.
For example, assuming that a batch transaction consists of transaction 1 (id 1; parameter 1), transaction 2 (id 2; parameter 2) and transaction 3 (id 3; parameter 3), and the data lengths of method signature+method parameters in transaction 1-transaction 3 are d1, d2 and d3, respectively, the format of the batch transaction is: bulk transaction smart contract address: an ID; batch transaction parameters: id1; d1; parameter 1; id2; d2; parameter 2; id3; d3; parameter 3. It should be appreciated that in forming a batch transaction, the strings in the batch transaction parameters may be directly spliced end to end without the need for separators or the like. And considering that the method signature and the method parameter in the transaction are not fixed in length, it is necessary to calculate the data length of the method signature and the method parameter of each transaction in advance and add the data length of the fixed length to the batch transaction parameters so as to accurately extract the contract address and the method signature and the method parameter of each transaction.
Therefore, in the embodiment of the specification, a batch of transactions can be created by splicing the data structures of the transactions, so that the transactions do not need to be signed respectively, only the batch of transactions are signed, and the complexity of signature processing is reduced.
Step 204: after verification is passed and consensus packaging is carried out, other blockchain nodes acquire contract addresses through analyzing the batch transaction, and call the batch transaction intelligent contracts to verify each transaction corresponding to the batch transaction parameters based on the contract addresses; if the verification is successful, step 206 is performed, otherwise the process ends.
When the blockchain node receives batch contract transactions, the blockchain node has no difference with common transactions when verifying the transactions in a transaction pool, and the signature and the transaction format of the blockchain node are verified to be correct. After the consensus packaging transaction, the transaction execution modules of other blockchain nodes are also indistinguishable from the common transaction in processing, and all the transactions are handed to an executor for processing. In the scheme of the application, only the signature of batch transactions is required to be checked, and each transaction is not required to be checked, so that the workload of checking the signature is reduced, and the verification processing efficiency is greatly improved.
Then, other block chain link points analyze the batch transaction to obtain contract addresses; a method in the bulk transaction intelligent contract is then invoked based on the contract address to effect processing of the bulk transaction. Specifically, calling the batch transaction intelligent contract based on the contract address to acquire a subcontract address and a data length of a first transaction from batch transaction parameters, and acquiring method data of the first transaction according to the acquired data length; sequentially acquiring subcontract addresses and method data of each subsequent transaction according to the mode; if the subcontract address and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct; otherwise, processing the error report and terminating the batch transaction.
Still taking the above-mentioned batch transaction as an example, after receiving the batch transaction, according to the format of the batch transaction: bulk transaction smart contract address: an ID; batch transaction parameters: id1; d1; parameter 1; id2; d2; parameter 2; id3; d3; and 3, extracting the ID from the parameters, calling a method in the batch transaction intelligent contract corresponding to the ID based on the ID, and sequentially verifying the format of each transaction from the batch transaction parameters, namely accurately extracting each transaction. Because the target contract address is of a fixed length, the subcontract address of the first transaction can be extracted from the batch transaction parameters according to the set fixed length, and meanwhile, one parameter, namely the data length, is also of a fixed length, so that the data length (parameter) of the first transaction can be extracted from the batch transaction parameters according to the set length value of the data length; then, extracting a method signature and a method parameter of the matching length from the batch transaction parameters according to the extracted data length; in this way, a data structure of the first transaction is obtained. And extracting the data structure of each transaction from the remaining parameters in the manner described above. If the data structures of all the transactions are successfully obtained, the verification of the data structures of the batch transactions can be determined to be correct, otherwise, error reporting processing is needed, and the batch transactions are terminated.
Step 206: the other block link points call corresponding transaction sub-contracts to process each transaction based on the transaction sub-contract address of the transaction.
When each transaction is processed, the address of the transaction subcontracting is used, the method signature and the method parameters are used for processing the subcontracting, and Gas fees and the like required by the transaction are transmitted. Gas, among other things, may be understood as the computational and/or memory resources required to support the execution of transactions. And processing all the transactions in a sequential processing mode, and finally finishing batch transaction processing when all the transactions are processed, and recording that all the transaction processing is finished in an event mode.
An implementable solution, after the at least one blockchain node obtains a contract address by parsing the bulk transaction and before invoking the bulk transaction intelligent contract to verify each transaction corresponding to the bulk transaction parameter based on the contract address, the method further comprises:
Judging whether the batch transactions carry method marks representing the dependency relationship between the transactions or not; if the transaction is carried, the at least one blockchain node invokes a first transaction method matched with the method mark from the batch transaction intelligent contract, invokes a corresponding transaction sub-contract to process the transaction based on the transaction sub-contract address of each transaction, and terminates the batch transaction when any transaction fails to process, rolls back transaction data, namely rolls back the processing state of each transaction before; otherwise, the at least one blockchain node calls a second transaction method from the batch transaction intelligent contracts, calls a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction fails to process.
That is, two sets of methods are pre-deployed in the bulk transaction smart contract, one set is executed for a bulk transaction composed of a plurality of transactions having a dependency relationship, and the other set is executed for a bulk transaction composed of a plurality of transactions having no dependency relationship. The multiple transactions with the dependency relationship may refer to that the multiple transactions have time sequence, cause and effect or state dependency relationship, and may be embodied on specific transaction association, which in the embodiment of the present specification mainly refers to that the multiple transactions have time sequence dependency relationship.
After the block link point obtains the contract address based on the received batch transaction, the batch transaction smart contract to be invoked is determined. And judging whether a method mark representing the dependency relationship between the transactions is carried in the batch transactions, if so, calling a first transaction method corresponding to the method mark to process the batch transactions, and immediately terminating the batch transactions and rolling back when the transaction processing fails. Otherwise, the second transaction method can be called to process the batch of transactions, and when the transaction processing fails, the next transaction is skipped to continue to be executed. Specifically, the batch transaction can carry a method mark 1 which represents that the transactions have a dependency relationship, or carry a method mark 0 which represents that the transactions have no dependency relationship. For another example, the batch transaction may carry method tags 1 that characterize the dependency between transactions, or the batch transaction may not carry any method tags. The first transaction method can correspond to the method mark 1, and the second transaction method can correspond to the method mark 0 or no mark.
Further, when the second transaction method is called to process each transaction and the transaction processing fails aiming at the batch transaction without the dependency relationship, the transaction with processing failure can be recorded in a contract event mode; or in the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the batch transaction intelligent contract in a contract event mode. In this way, the inquiry can be facilitated, so that the outstanding transactions can be reprocessed only next time, and all transactions are prevented from being reprocessed, thereby saving processing resources and cost.
When the first transaction method is called to process each transaction and the situation that the transaction processing fails/calculation and/or storage resources needed by supporting the transaction execution are insufficient is caused, the batch transaction is terminated, the processing states of all sub-transactions in the current batch transaction are not submitted to the blockchain state, and only the transaction processing commission is deducted.
Optionally, after the batch transaction is finished, the target user terminal may further obtain a processing result of the batch transaction by monitoring a contract event on the batch transaction smart contract; and/or; the target user terminal can also acquire the processing result of the corresponding transaction by monitoring the contract-on event of the sub-contract corresponding to each transaction. That is, after each transaction is completed, the processing result is recorded on the sub-contract corresponding to the transaction in a contract time manner, so that the subsequent target user terminal can remotely monitor to acquire the processing result. Similarly, all transaction completion conditions can be recorded on the batch transaction intelligent contract in a contract event mode: and (3) all successful processing, partial failure processing and the like so that the subsequent target user terminal can remotely monitor and acquire the processing result.
According to the embodiment of the specification, the target user terminal can use the address of the intelligent contract for batch transaction as the contract address, and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the plurality of transactions are combined and created into one batch transaction; after signing the batch transaction, sending the batch transaction signature to a blockchain node for verification, after the verification passes and the consensus packaging is carried out, calling a batch transaction intelligent contract corresponding to a contract address to analyze batch transaction parameters so as to sequentially carry out format verification on each transaction, and if all the verification is correct, sequentially calling a transaction sub-contract corresponding to a transaction sub-contract address of each transaction to process the corresponding transaction. Therefore, when the transaction is processed, only one signature and verification are needed, the volume of data of batch transaction is smaller than that of a plurality of transaction data, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, the batch transaction scheme can save the transaction cost of the user for the situation of operating according to the transaction times. And meanwhile, the batch transaction mode can also enable a user to conveniently process a plurality of transactions with order dependence or transaction requirements. The batch transaction is not different from the original common transaction, the blockchain does not need to be additionally transformed, and the batch transaction can be realized only by adding the intelligent contract of the batch transaction.
Example two
Referring to fig. 3, which is a schematic diagram illustrating steps of a processing method for executing batch transactions based on blockchain according to an embodiment of the present disclosure, the method is applied to a target user terminal, and may include the following steps:
Step 302: creating a batch transaction based on a plurality of transactions to be submitted, and signing the batch transaction;
step 304: the signed batch transaction is sent to at least one blockchain node in the blockchain network for verification, so that the batch transaction can be processed after verification is passed;
the method comprises the steps of determining a batch transaction parameter of the batch transaction based on the transaction parameter of each transaction in the plurality of transactions, wherein the contract address of the batch transaction is the address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data.
Optionally, as an embodiment, creating a batch transaction based on the plurality of transactions to be submitted specifically includes:
respectively determining the data structure of each transaction, and sequentially splicing the determined data structures to obtain batch transaction parameters; and using the address of the intelligent contract for batch transaction as a contract address to create a batch transaction.
In a specific implementation manner of the embodiment of the present disclosure, determining a data structure of each transaction separately specifically includes:
the target user terminal performs for each transaction: determining the data length of method data of the current transaction; and splicing the subcontract address, the data length and the method data corresponding to the current transaction to form a tuple structure.
In yet another specific implementation of an embodiment of the present disclosure, after the batch transaction is completed, the method further includes:
Acquiring a processing result of batch transaction by monitoring contract events on the intelligent batch transaction contract; and/or, obtaining the processing result of the corresponding transaction by monitoring the contract event on the sub-contract corresponding to each transaction.
It should be understood that, the cooperative operation between the blockchain node and the target user terminal on the blockchain constitutes a processing scheme for executing batch transactions based on the blockchain according to the present application, so in the second embodiment, only the target user terminal is protected and the content mostly only relates to the operation of the target user terminal, and the method operation and the technical effect executed by the blockchain node corresponding to the operation of the target user terminal as the execution body are all shown in the first embodiment and are not described herein.
Example III
Referring to fig. 4, a schematic step diagram of a processing method for executing batch transactions based on a blockchain according to an embodiment of the present disclosure is provided, where the method is applied to a blockchain node on a blockchain network, and at least a batch transaction smart contract is deployed on the blockchain; the method may comprise the steps of:
Step 402: at least one block link point receives batch transactions sent by a target user terminal, wherein the batch transactions are created and signed by the target user terminal based on a plurality of transactions to be submitted; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
Step 404: after verification is passed and consensus packaging is carried out, other blockchain nodes acquire contract addresses through analyzing the batch transaction, and call the batch transaction intelligent contracts to verify each transaction corresponding to the batch transaction parameters based on the contract addresses; if the verification is successful, executing step 406, otherwise, ending the process;
step 406: other block link points invoke corresponding transaction sub-contracts to process each transaction based on the transaction sub-contract address of the transaction.
Optionally, as an embodiment, the step of calling the batch transaction intelligent contract to verify each transaction corresponding to the batch transaction parameter based on the contract address specifically includes:
Invoking the batch transaction intelligent contract based on the contract address to acquire a subcontract address and a data length of a first transaction from batch transaction parameters, and acquiring method data of the first transaction according to the acquired data length; sequentially acquiring subcontract addresses and method data of each subsequent transaction according to the mode; if the subcontract address and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct; otherwise, processing the error report and terminating the batch transaction.
In a specific implementation manner of the embodiment of the present disclosure, after the contract address is obtained by parsing the batch transaction, and before each transaction corresponding to the batch transaction parameter is verified by calling the batch transaction smart contract based on the contract address, the method further includes:
Judging whether the batch transactions carry method marks representing the dependency relationship between the transactions or not; if the transaction is carried, a first transaction method matched with the method mark is called from the batch transaction intelligent contracts, a corresponding transaction sub contract is called based on the transaction sub contract address of each transaction to process the transaction, and when any transaction processing fails, the batch transaction is terminated, and transaction data are rolled back; otherwise, the at least one blockchain node calls a second transaction method from the batch transaction intelligent contracts, calls a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction fails to process.
In still another specific implementation manner of the embodiment of the present disclosure, when the second transaction method is invoked to process each transaction and a transaction processing failure occurs, recording the transaction with the processing failure by means of a contract event; or in the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the batch transaction intelligent contract in a contract event mode.
It should be understood that, the cooperative operation between the blockchain node and the target user terminal on the blockchain constitutes a processing scheme for executing batch transactions based on the blockchain according to the present application, so in the third embodiment, only the blockchain node is protected and the content mostly only relates to the operation of the blockchain node, and the method operation and the technical effect executed by the corresponding target user terminal as the execution body can be shown in the first embodiment, which is not described herein.
Example IV
Referring to fig. 5, which is a schematic structural diagram of a processing system for executing batch transactions based on blockchain according to an embodiment of the present disclosure, the processing system may include: a target user terminal 502 and a blockchain network 504, wherein the blockchain network 504 includes a plurality of blockchain nodes 506, and at least a batch transaction intelligent contract is deployed on the blockchain network 504; wherein,
The target user terminal 502 creates a batch transaction based on a plurality of transactions to be submitted, signs the batch transaction, and sends the signed batch transaction to at least one blockchain node 506 in the blockchain network 504 for verification; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
After verification is passed and consensus packaging is performed, other blockchain nodes 506 acquire contract addresses through analyzing the batch transactions, and call the batch transaction intelligent contracts to verify each transaction corresponding to the batch transaction parameters based on the contract addresses;
If the verification is successful, the other blockchain node 506 invokes the corresponding transaction sub-contract to process the transaction based on the transaction sub-contract address of each transaction;
if the verification fails, the process ends.
In fact, one or more transaction sub-contracts related to each transaction are also deployed on the blockchain network, so that when the execution module of the blockchain executes a certain transaction, a method of the corresponding transaction sub-contract is called.
Optionally, as an embodiment, when the target user terminal creates a batch transaction based on a plurality of transactions to be submitted, the target user terminal is specifically configured to determine a data structure of each transaction respectively, and splice the determined plurality of data structures in turn to obtain batch transaction parameters; and using the address of the intelligent contract for batch transaction as a contract address to create a batch transaction.
In a specific implementation manner of the embodiments of the present disclosure, when the target user terminal determines the data structure of each transaction, the method is specifically configured to perform, for each transaction, respectively: determining the data length of method data of the current transaction; and splicing the subcontract address, the data length and the method data corresponding to the current transaction to form a tuple structure.
In still another specific implementation manner of the embodiment of the present disclosure, when the at least one block link point invokes the batch transaction intelligent contract to verify each transaction corresponding to the batch transaction parameter based on the contract address, the block link point is specifically configured to: invoking the batch transaction intelligent contract based on the contract address to acquire a subcontract address and a data length of a first transaction from batch transaction parameters, and acquiring method data of the first transaction according to the acquired data length; sequentially acquiring subcontract addresses and method data of each subsequent transaction according to the mode; if the subcontract address and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct; otherwise, processing the error report and terminating the batch transaction.
In yet another specific implementation manner of the embodiment of the present disclosure, after the at least one blockchain node obtains a contract address by parsing the batch transaction, and before invoking the batch transaction smart contract to verify each transaction corresponding to the batch transaction parameter based on the contract address, the method is further used for: judging whether the batch transactions carry method marks representing the dependency relationship between the transactions or not; if the transaction is carried, the at least one blockchain node invokes a first transaction method matched with the method mark from the batch transaction intelligent contract, invokes a corresponding transaction sub-contract to process the transaction based on the transaction sub-contract address of each transaction, and terminates the batch transaction when any transaction processing fails, and rolls back transaction data; otherwise, the at least one blockchain node calls a second transaction method from the batch transaction intelligent contracts, calls a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction fails to process.
In still another specific implementation manner of the embodiment of the present disclosure, when the second transaction method is invoked to process each transaction and a transaction processing failure occurs, recording the transaction with the processing failure by means of a contract event; or in the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the batch transaction intelligent contract in a contract event mode.
In still another specific implementation manner of the embodiment of the present disclosure, after the batch transaction is ended, the target user terminal is further configured to obtain a processing result of the batch transaction by monitoring a contract event on the intelligent contract for the batch transaction; and/or, obtaining the processing result of the corresponding transaction by monitoring the contract event on the sub-contract corresponding to each transaction.
According to the embodiment of the specification, the target user terminal can use the address of the intelligent contract for batch transaction as the contract address, and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the plurality of transactions are combined and created into one batch transaction; after signing the batch transaction, sending the batch transaction signature to a blockchain node for verification, after the verification passes and the consensus packaging is carried out, calling a batch transaction intelligent contract corresponding to a contract address to analyze batch transaction parameters so as to sequentially carry out format verification on each transaction, and if all the verification is correct, sequentially calling a transaction sub-contract corresponding to a transaction sub-contract address of each transaction to process the corresponding transaction. Therefore, when the transaction is processed, only one signature and verification are needed, the volume of data of batch transaction is smaller than that of a plurality of transaction data, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, the batch transaction scheme can save the transaction cost of the user for the situation of operating according to the transaction times.
Example five
Referring to fig. 6, for providing a target user terminal for performing batch transactions based on blockchain according to embodiments of the present disclosure, the target user terminal 600 may include:
a creation module 602 that creates a batch of transactions based on a plurality of transactions to be submitted and signs the batch of transactions;
A sending module 604, configured to send the signed batch transaction to at least one blockchain node in the blockchain network for verification, so as to process the batch transaction after the verification is passed;
the method comprises the steps of determining a batch transaction parameter of the batch transaction based on the transaction parameter of each transaction in the plurality of transactions, wherein the contract address of the batch transaction is the address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data.
Optionally, as an embodiment, when the creating module 602 creates a batch transaction based on a plurality of transactions to be submitted, the creating module is specifically configured to: respectively determining the data structure of each transaction, and sequentially splicing the determined data structures to obtain batch transaction parameters; and using the address of the intelligent contract for batch transaction as a contract address to create a batch transaction.
In a specific implementation manner of the embodiment of the present disclosure, when the creation module 602 determines the data structure of each transaction separately, the creation module is specifically configured to: for each transaction, respectively: determining the data length of method data of the current transaction; and splicing the subcontract address, the data length and the method data corresponding to the current transaction to form a tuple structure.
In another specific implementation manner of the embodiments of the present specification, the target user terminal further includes: the monitoring module is used for acquiring a processing result of the batch transaction by monitoring contract-on events of the batch transaction intelligent contract after the batch transaction is finished; and/or, obtaining the processing result of the corresponding transaction by monitoring the contract event on the sub-contract corresponding to each transaction.
Example six
Referring to fig. 7, a blockchain node for performing a batch transaction based on a blockchain according to an embodiment of the present disclosure is shown, where at least a batch transaction smart contract is deployed on the blockchain network; each blockchain node 700 may include: basic modules required for processing blockchain services, such as a packaging module, a consensus module, a verification module, an execution module, and the like, and further comprises a receiving module 702 for receiving transactions (including batch transactions or common single transactions), and an execution module, wherein the execution module can be further divided into a first execution module 704 when a batch transaction smart contract is called and a second execution module 706 when a transaction sub-contract is called according to different calling contracts;
The receiving module 702 receives batch transactions sent by the target user terminal, wherein the batch transactions are created and signed by the target user terminal based on a plurality of transactions to be submitted; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
The first execution module 704 is configured to obtain a contract address by analyzing the batch transaction after the verification module verifies the received batch transaction, and to invoke the batch transaction intelligent contract to verify each transaction corresponding to the batch transaction parameter based on the contract address;
a second execution module 706, which invokes a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction when the verification is successful; and ending the process when the verification fails.
Optionally, as an embodiment, when the first execution module 704 invokes the batch transaction intelligent contract to verify each transaction corresponding to the batch transaction parameter based on the contract address, the method is specifically used for: invoking the batch transaction intelligent contract based on the contract address to acquire a subcontract address and a data length of a first transaction from batch transaction parameters, and acquiring method data of the first transaction according to the acquired data length; sequentially acquiring subcontract addresses and method data of each subsequent transaction according to the mode; if the subcontract address and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct; otherwise, processing the error report and terminating the batch transaction.
In a specific implementation manner of this embodiment of the present disclosure, after the first execution module 704 obtains a contract address by resolving the batch transaction, and before invoking the batch transaction smart contract to verify each transaction corresponding to the batch transaction parameter based on the contract address, the method is further used for: judging whether the batch transactions carry method marks representing the dependency relationship between the transactions or not; if the transaction is carried, a first transaction method matched with the method mark is called from the batch transaction intelligent contract, a corresponding transaction sub-contract is called based on the transaction sub-contract address of each transaction to process the transaction, and when any transaction fails to be processed, batch transaction is terminated and transaction data are rolled back; otherwise, the at least one blockchain node calls a second transaction method from the batch transaction intelligent contracts, calls a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction fails to process.
In yet another specific implementation of an embodiment of the present disclosure, the blockchain node further includes: the event recording module is used for recording the transaction which is failed to be processed in a contract event mode when the second transaction method is called to process each transaction and the transaction processing failure occurs; or in the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the batch transaction intelligent contract in a contract event mode.
It should be understood that the fifth embodiment and the sixth embodiment are part of the fourth embodiment, respectively, and thus specific device module details and functional effects can be understood with reference to the first embodiment and the fourth embodiment, which are not described herein again.
Example seven
Fig. 8 is a schematic structural view of an electronic device according to an embodiment of the present specification. Referring to fig. 8, at the hardware level, the electronic device includes a processor, and optionally an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory (non-volatile Memory), such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, network interface, and memory may be interconnected by an internal bus, which may be an ISA (Industry Standard Architecture ) bus, a PCI (PERIPHERAL COMPONENT INTERCONNECT, peripheral component interconnect standard) bus, or EISA (Extended Industry Standard Architecture ) bus, among others. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 8, but not only one bus or type of bus.
And the memory is used for storing programs. In particular, the program may include program code including computer-operating instructions. The memory may include memory and non-volatile storage and provide instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs to form a processing device (i.e., a target user terminal or a blockchain node) on a logic level that performs batch transactions based on the blockchain. The processor is used for executing the programs stored in the memory and is specifically used for executing the following operations:
Creating a batch transaction based on a plurality of transactions to be submitted, and signing the batch transaction;
the signed batch transaction is sent to at least one blockchain node in the blockchain network for verification, so that the batch transaction can be processed after verification is passed;
The method comprises the steps of determining a batch transaction parameter of the batch transaction based on the transaction parameter of each transaction in the plurality of transactions, wherein the contract address of the batch transaction is the address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data. Or alternatively;
Receiving batch transactions sent by a target user terminal, wherein the batch transactions are created and signed by the target user terminal based on a plurality of transactions to be submitted; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after verification is passed and consensus packaging is carried out, a contract address is obtained through analyzing the batch transaction, and each transaction corresponding to the batch transaction parameters is verified by calling the batch transaction intelligent contract based on the contract address;
if the verification is successful, calling a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction;
if the verification fails, the process ends.
The methods performed by the apparatus disclosed in the embodiments of fig. 2-7 of the present specification may be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or by instructions in the form of software. The processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU), a network processor (Network Processor, NP), etc.; but may also be a digital signal Processor (DIGITAL SIGNAL Processor, DSP), application SPECIFIC INTEGRATED Circuit (ASIC), field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components. The methods, steps, and logic blocks disclosed in one or more embodiments of the present description may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with one or more embodiments of the present disclosure may be embodied directly in a hardware decoding processor or in a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in a memory, and the processor reads the information in the memory and, in combination with its hardware, performs the steps of the above method.
The electronic device may also execute the methods of fig. 2-4 and implement the functions of the embodiments of the corresponding devices shown in fig. 2-4, which are not described herein.
Of course, in addition to the software implementation, the electronic device of the embodiments of the present disclosure does not exclude other implementations, such as a logic device or a combination of software and hardware, that is, the execution subject of the following processing flow is not limited to each logic unit, but may also be hardware or a logic device.
According to the embodiment of the specification, the target user terminal can use the address of the intelligent contract for batch transaction as the contract address, and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the plurality of transactions are combined and created into one batch transaction; after signing the batch transaction, sending the batch transaction signature to a blockchain node for verification, after the verification passes and the consensus packaging is carried out, calling a batch transaction intelligent contract corresponding to a contract address to analyze batch transaction parameters so as to sequentially carry out format verification on each transaction, and if all the verification is correct, sequentially calling a transaction sub-contract corresponding to a transaction sub-contract address of each transaction to process the corresponding transaction. Therefore, when the transaction is processed, only one signature and verification are needed, the volume of data of batch transaction is smaller than that of a plurality of transaction data, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, the batch transaction scheme can save the transaction cost of the user for the situation of operating according to the transaction times.
Example eight
The present description also proposes a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, enable the portable electronic device to perform the method of the embodiments of fig. 2-4, and in particular to perform the method of:
Creating a batch transaction based on a plurality of transactions to be submitted, and signing the batch transaction;
the signed batch transaction is sent to at least one blockchain node in the blockchain network for verification, so that the batch transaction can be processed after verification is passed;
The method comprises the steps of determining a batch transaction parameter of the batch transaction based on the transaction parameter of each transaction in the plurality of transactions, wherein the contract address of the batch transaction is the address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data. Or alternatively;
Receiving batch transactions sent by a target user terminal, wherein the batch transactions are created and signed by the target user terminal based on a plurality of transactions to be submitted; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after verification is passed and consensus packaging is carried out, a contract address is obtained through analyzing the batch transaction, and each transaction corresponding to the batch transaction parameters is verified by calling the batch transaction intelligent contract based on the contract address;
if the verification is successful, calling a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction;
if the verification fails, the process ends.
According to the embodiment of the specification, the target user terminal can use the address of the intelligent contract for batch transaction as the contract address, and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the plurality of transactions are combined and created into one batch transaction; after signing the batch transaction, sending the batch transaction signature to a blockchain node for verification, after the verification passes and the consensus packaging is carried out, calling a batch transaction intelligent contract corresponding to a contract address to analyze batch transaction parameters so as to sequentially carry out format verification on each transaction, and if all the verification is correct, sequentially calling a transaction sub-contract corresponding to a transaction sub-contract address of each transaction to process the corresponding transaction. Therefore, when the transaction is processed, only one signature and verification are needed, the volume of data of batch transaction is smaller than that of a plurality of transaction data, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, the batch transaction scheme can save the transaction cost of the user for the situation of operating according to the transaction times.
In summary, the foregoing description is only a preferred embodiment of the present invention and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present specification should be included in the protection scope of the present specification.
The systems, devices, modules, or units illustrated in one or more of the embodiments described above may be implemented in particular by a computer chip or entity, or by a product having some function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing describes specific embodiments of the present disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.

Claims (13)

1. A processing method for executing batch transaction based on a blockchain is applied to a processing system comprising a target user terminal and a blockchain network, wherein at least batch transaction intelligent contracts are deployed on the blockchain network; the method comprises the following steps:
The target user terminal creates a batch transaction based on a plurality of transactions to be submitted, signs the batch transaction, and sends the signed batch transaction to at least one blockchain node in the blockchain network for verification; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
After verification is passed and consensus packaging is carried out, other blockchain nodes acquire contract addresses through analyzing the batch transaction, and call the batch transaction intelligent contracts to verify each transaction corresponding to the batch transaction parameters based on the contract addresses;
If the verification is successful, the other blockchain nodes call corresponding transaction sub-contracts to process the transaction based on the transaction sub-contract address of each transaction;
If the verification fails, ending the process; wherein,
After the at least one blockchain node obtains a contract address by resolving the bulk transaction and before invoking the bulk transaction intelligence contract to verify each transaction corresponding to the bulk transaction parameters based on the contract address, the method further comprises:
Judging whether the batch transactions carry method marks representing the dependency relationship between the transactions or not;
if the transaction is not carried, the at least one blockchain node invokes a second transaction method from the batch transaction intelligent contracts, invokes a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction processing fails;
When each transaction is processed by calling the second transaction method and the transaction processing failure occurs, recording the transaction which is processed failure in a contract event mode; or alternatively
In the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the batch transaction intelligent contract in a contract event mode.
2. The blockchain-based processing method for executing batch transactions according to claim 1, wherein the target user terminal creates a batch transaction based on a plurality of transactions to be submitted, specifically comprising:
the target user terminal respectively determines the data structure of each transaction, and sequentially splices the determined data structures to obtain batch transaction parameters; and
And taking the address of the intelligent contract for batch transaction as a contract address to create a batch transaction.
3. The processing method for executing batch transactions based on blockchain as in claim 2, wherein the target user terminal determines the data structure of each transaction respectively, specifically comprising:
The target user terminal performs for each transaction:
Determining the data length of method data of the current transaction;
And splicing the subcontract address, the data length and the method data corresponding to the current transaction to form a tuple structure.
4. The processing method for executing batch transactions based on blockchain as in claim 3, wherein the at least one blockchain link point invokes the batch transaction smart contract to verify each transaction corresponding to the batch transaction parameters based on the contract address, specifically comprising:
The at least one block link point calls the batch transaction intelligent contract based on the contract address to acquire a subcontract address and a data length of a first transaction from batch transaction parameters, and acquires method data of the first transaction according to the acquired data length; sequentially acquiring subcontract addresses and method data of each subsequent transaction according to the mode;
If the subcontract address and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct;
otherwise, processing the error report and terminating the batch transaction.
5. The blockchain-based processing method of claim 1, after the at least one blockchain node obtains a contract address by parsing the bulk transaction and before invoking the bulk transaction smart contract to verify each transaction corresponding to the bulk transaction parameter based on the contract address, the method further comprising:
and if the transaction is carried, the other blockchain nodes call a first transaction method matched with the method mark from the batch transaction intelligent contract, call corresponding transaction subcontract based on the transaction subcontract address of each transaction to process the transaction, terminate the batch transaction when any transaction processing fails, and roll back transaction data.
6. The method of claim 1, further comprising, after the batch transaction is completed:
the target user terminal monitors contract-on events of the intelligent contract for batch transaction to obtain a processing result of batch transaction; and/or
And the target user terminal acquires the processing result of the corresponding transaction by monitoring the contract-on event of the sub-contract corresponding to each transaction.
7. A processing method for executing batch transactions based on a blockchain, which is applied to a target user terminal, the method comprising:
Creating a batch transaction based on a plurality of transactions to be submitted, and signing the batch transaction;
Sending the signed batch transaction to at least one blockchain node in a blockchain network for verification, so that the at least one blockchain node judges whether the batch transaction carries a method mark representing a dependency relationship between transactions or not; if the transaction is not carried, the at least one blockchain node invokes a second transaction method from the batch transaction intelligent contracts, invokes a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction processing fails; when each transaction is processed by calling the second transaction method and the transaction processing failure occurs, recording the transaction which is processed failure in a contract event mode; or in the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, terminating the batch transaction, and recording the transaction successfully processed in the batch transaction intelligent contract in a contract event mode so as to process the batch transaction after verification is passed;
the method comprises the steps of determining a batch transaction parameter of the batch transaction based on the transaction parameter of each transaction in the plurality of transactions, wherein the contract address of the batch transaction is the address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data.
8. A processing method for executing batch transaction based on a blockchain is applied to blockchain nodes on a blockchain network, wherein at least batch transaction intelligent contracts are deployed on the blockchain network; the method comprises the following steps:
Receiving batch transactions sent by a target user terminal, wherein the batch transactions are created and signed by the target user terminal based on a plurality of transactions to be submitted; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after verification is passed and consensus packaging is carried out, a contract address is obtained through analyzing the batch transaction, and each transaction corresponding to the batch transaction parameters is verified by calling the batch transaction intelligent contract based on the contract address;
if the verification is successful, calling a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction;
If the verification fails, ending the process; wherein,
After the obtaining the contract address by parsing the batch transaction and before the verifying each transaction corresponding to the batch transaction parameter based on the contract address invoking the batch transaction smart contract, the method further comprises:
Judging whether the batch transactions carry method marks representing the dependency relationship between the transactions or not;
If the transaction is not carried, at least one blockchain node calls a second transaction method from the batch transaction intelligent contracts, calls a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction fails to be processed;
When each transaction is processed by calling the second transaction method and the transaction processing failure occurs, recording the transaction which is processed failure in a contract event mode; or alternatively
In the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the batch transaction intelligent contract in a contract event mode.
9. A processing system for performing bulk transactions based on a blockchain, comprising: the system comprises a target user terminal and a blockchain network, wherein the blockchain network comprises a plurality of blockchain nodes, and at least batch transaction intelligent contracts are deployed on the blockchain network; wherein,
The target user terminal creates a batch transaction based on a plurality of transactions to be submitted, signs the batch transaction, and sends the signed batch transaction to at least one blockchain node in the blockchain network for verification; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
After verification is passed and consensus packaging is carried out, other blockchain nodes acquire contract addresses through analyzing the batch transaction, and call the batch transaction intelligent contracts to verify each transaction corresponding to the batch transaction parameters based on the contract addresses;
If the verification is successful, the other block link points call corresponding transaction sub-contracts to process the transaction based on the transaction sub-contract address of each transaction;
If the verification fails, ending the process; wherein,
After at least one blockchain node obtains a contract address by analyzing the batch transaction, and before each transaction corresponding to the batch transaction parameter is verified by calling the batch transaction intelligent contract based on the contract address, the blockchain node is further used for: judging whether the batch transactions carry method marks representing the dependency relationship between the transactions or not;
If the transaction is not carried, at least one blockchain node calls a second transaction method from the batch transaction intelligent contracts, calls a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction fails to be processed;
When each transaction is processed by calling the second transaction method and the transaction processing failure occurs, recording the transaction which is processed failure in a contract event mode; or alternatively
In the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the batch transaction intelligent contract in a contract event mode.
10. A target user terminal for performing bulk transactions based on a blockchain, comprising:
the system comprises a creation module, a verification module and a verification module, wherein the creation module creates a batch transaction based on a plurality of transactions to be submitted and signs the batch transaction;
The sending module is used for sending the signed batch transactions to at least one blockchain node in the blockchain network for verification, so that the at least one blockchain node judges whether the batch transactions carry a method mark representing the dependency relationship between the transactions or not; if the transaction is not carried, the at least one blockchain node invokes a second transaction method from the batch transaction intelligent contracts, invokes a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction processing fails; when each transaction is processed by calling the second transaction method and the transaction processing failure occurs, recording the transaction which is processed failure in a contract event mode; or in the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, terminating the batch transaction, and recording the transaction successfully processed in the batch transaction intelligent contract in a contract event mode so as to process the batch transaction after verification is passed;
the method comprises the steps of determining a batch transaction parameter of the batch transaction based on the transaction parameter of each transaction in the plurality of transactions, wherein the contract address of the batch transaction is the address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data.
11. A blockchain node for executing batch transactions based on a blockchain, wherein at least a batch transaction smart contract is deployed on a blockchain network; the block link points include:
the receiving module is used for receiving batch transactions sent by the target user terminal, wherein the batch transactions are created and signed by the target user terminal based on a plurality of transactions to be submitted; the batch transaction parameters of the batch transaction are determined based on the transaction parameters of each transaction in the plurality of transactions, and the contract address of the batch transaction is the address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
The first execution module is used for acquiring a contract address through analyzing the batch transaction after the verification module verifies the received batch transaction, and calling the batch transaction intelligent contract to verify each transaction corresponding to the batch transaction parameter based on the contract address;
The second execution module is used for calling a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction when verification is successful; and
Ending the process when the verification fails; wherein,
The first execution module is used for judging whether the batch transactions carry method marks representing the dependency relationship between the transactions or not; if the transaction is not carried, at least one blockchain node calls a second transaction method from the batch transaction intelligent contracts, calls a corresponding transaction sub-contract based on the transaction sub-contract address of each transaction to process the transaction, and skips the transaction to continue to execute the next transaction when any transaction fails to be processed; when each transaction is processed by calling the second transaction method and the transaction processing failure occurs, recording the transaction which is processed failure in a contract event mode; or in the transaction processing process, when the calculation and/or storage resources required by supporting the transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the batch transaction intelligent contract in a contract event mode.
12. An electronic device, comprising:
A processor; and
A memory arranged to store computer executable instructions which, when executed, cause the processor to perform the steps of the method of claim 7 or 8.
13. A computer readable storage medium storing one or more programs, which when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform the steps of the method of claim 7 or 8.
CN202110892853.0A 2021-08-04 2021-08-04 Processing method, device and system for executing batch transactions based on blockchain Active CN113706146B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110892853.0A CN113706146B (en) 2021-08-04 2021-08-04 Processing method, device and system for executing batch transactions based on blockchain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110892853.0A CN113706146B (en) 2021-08-04 2021-08-04 Processing method, device and system for executing batch transactions based on blockchain

Publications (2)

Publication Number Publication Date
CN113706146A CN113706146A (en) 2021-11-26
CN113706146B true CN113706146B (en) 2024-07-30

Family

ID=78651559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110892853.0A Active CN113706146B (en) 2021-08-04 2021-08-04 Processing method, device and system for executing batch transactions based on blockchain

Country Status (1)

Country Link
CN (1) CN113706146B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115037813B (en) * 2022-06-08 2024-08-23 北京知帆科技有限公司 Block chain data analysis method and device and electronic equipment

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110033363A (en) * 2018-12-14 2019-07-19 阿里巴巴集团控股有限公司 Event-handling method and device, electronic equipment based on block chain

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110264348B (en) * 2019-05-07 2021-08-20 北京奇艺世纪科技有限公司 Processing method, device and storage medium for transaction uplink
KR20200139034A (en) * 2019-06-03 2020-12-11 삼성에스디에스 주식회사 Blockchain based computing system and method for managing transaction thereof
CN111177258B (en) * 2019-12-13 2021-05-18 浙商银行股份有限公司 Adaptive configuration transaction packaging method based on block chain platform
CN112232823B (en) * 2020-12-10 2021-04-23 腾讯科技(深圳)有限公司 Transaction processing method, device, medium and electronic equipment of block chain system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110033363A (en) * 2018-12-14 2019-07-19 阿里巴巴集团控股有限公司 Event-handling method and device, electronic equipment based on block chain

Also Published As

Publication number Publication date
CN113706146A (en) 2021-11-26

Similar Documents

Publication Publication Date Title
US11626972B2 (en) Data processing method and apparatus
CN110033244B (en) Intelligent contract execution method and device based on block chain and electronic equipment
CN110659988B (en) Parallel processing method and device for block chain consensus and execution and electronic equipment
CN107040585B (en) Service checking method and device
CN113840012B (en) Block chain-based screen recording evidence obtaining method and system and electronic equipment
CN108846749B (en) Partitioned transaction execution system and method based on block chain technology
CN112037061A (en) Processing method and device for transactions in block chain, electronic equipment and storage medium
CN108765159B (en) Block chain-based uplink and state processing method and device and interconnection system
CN109299015B (en) Software testing method, device and system
CN111369358B (en) Block chain consensus method and device and electronic equipment
CN110780870A (en) Service execution method, device, equipment and storage medium
CN112506671A (en) Transaction processing method and device in block chain and electronic equipment
CN110648136A (en) Consensus and transaction synchronous parallel processing method and device and electronic equipment
CN111553652B (en) Service processing method and device
CN110659905A (en) Transaction verification method, device, terminal equipment and storage medium
CN110648125B (en) Packaging transaction method and device, electronic equipment and storage medium
CN110992188A (en) Transaction processing method, device and equipment
CN113706146B (en) Processing method, device and system for executing batch transactions based on blockchain
CN112887436B (en) Consensus method, consensus node and block chain system of pipeline mode
CN111709748B (en) Transaction execution method and device with business attribute and electronic equipment
CN108710658B (en) Data record storage method and device
CN112149951B (en) Risk control method, apparatus, computer device and storage medium
CN112907198B (en) Service state circulation maintenance method and device and electronic equipment
CN110599139B (en) Block output method and device in block chain consensus algorithm
CN112351085A (en) Network resource safety sharing method

Legal Events

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