CN113706146A - Processing method, device and system for executing batch transaction based on block chain - Google Patents

Processing method, device and system for executing batch transaction based on block chain Download PDF

Info

Publication number
CN113706146A
CN113706146A CN202110892853.0A CN202110892853A CN113706146A CN 113706146 A CN113706146 A CN 113706146A CN 202110892853 A CN202110892853 A CN 202110892853A CN 113706146 A CN113706146 A CN 113706146A
Authority
CN
China
Prior art keywords
transaction
batch
contract
address
transactions
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.)
Pending
Application number
CN202110892853.0A
Other languages
Chinese (zh)
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/CN113706146A/en
Publication of CN113706146A publication Critical patent/CN113706146A/en
Pending legal-status Critical Current

Links

Images

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 performing batch transactions based on a blockchain, the scheme including: the target user terminal uses the address of the intelligent contract of batch transaction as a contract address and splices transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the transactions are merged to create a batch transaction; after the batch transaction is signed, the batch transaction is sent to a block chain node for verification, after the verification is passed and the consensus packaging is carried out, the batch transaction intelligent contract corresponding to the contract address is called to analyze batch transaction parameters and carry out format verification on each transaction in sequence, and if all verification is correct, the transaction sub-contracts corresponding to the sub-contract address of each transaction are called in sequence to process the corresponding transaction. Therefore, only one signature and signature verification is needed when 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 transaction based on block chain
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method, an apparatus, and a system for performing batch transactions based on blockchains.
Background
The blockchain is a decentralized and innovative solution for solving the multi-party trust problem by using a distributed book technology, and is a leading-edge technology of the current society.
When a user has a transaction to be processed, the user generally needs to send the transaction signature to a node on a block chain for processing. When facing a plurality of transactions to be processed, each transaction needs to be signed respectively and then sent to the blockchain node in sequence, so that the transaction data received by the blockchain is saturated, and the blockchain is easy to be in a tense transaction processing process all the time.
In view of the above, it is desirable to find a better processing scheme for multiple transactions to solve the above-mentioned problems.
Disclosure of Invention
An object of one or more embodiments of the present specification is to provide a processing method, apparatus and system for performing batch transactions based on a blockchain, so as to improve transaction processing efficiency and at the same time, alleviate processing pressure of blockchain transactions.
To solve the above technical problem, 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, which is applied to a processing system comprising a target user terminal and a blockchain network, wherein at least a batch transaction intelligent contract is 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 block chain node in the block chain network for verification; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the consensus is packaged, other block chain nodes obtain contract addresses by analyzing the batch transactions, and call the intelligent batch transaction contracts based on the contract addresses to verify each transaction corresponding to the batch transaction parameters;
if the verification is successful, the other block chain nodes call corresponding transaction subcontracts to process the transaction based on the transaction subcontract address of each transaction;
if the verification fails, the process ends.
In a second aspect, a processing method for performing batch transactions based on a blockchain is provided, and is applied to a target user terminal, where the method includes:
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 block chain node in a block chain network for verification so as to facilitate processing of the batch transaction after the verification is passed;
wherein batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction of the plurality of transactions, and a contract address of the batch transaction is an 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, which is applied to blockchain nodes on a blockchain network, wherein at least a batch transaction intelligent contract is 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 obtained after the target user terminal creates and signs based on a plurality of transactions to be submitted; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the agreement is packaged, acquiring a contract address by analyzing the batch transaction, and calling the intelligent contract for the batch transaction based on the contract address to verify each transaction corresponding to the batch transaction parameters;
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 batch transactions based on blockchain is provided, including: the system comprises a target user terminal and a block chain network, wherein the block chain network comprises a plurality of block chain nodes, and at least a batch transaction intelligent contract is deployed on the block chain network; wherein the content of the first and second substances,
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 block chain node in the block chain network for verification; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the consensus is packaged, other block chain nodes obtain contract addresses by analyzing the batch transactions, and call the intelligent batch transaction contracts based on the contract addresses to verify each transaction corresponding to the batch transaction parameters;
if the verification is successful, the other block chain nodes call corresponding transaction subcontracts to process the transaction based on the transaction subcontract address of each transaction;
if the verification fails, the process ends.
In a fifth aspect, a target user terminal for performing batch transactions based on a blockchain is provided, including:
the system comprises a creating module, a signing module and a processing module, wherein the creating 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 block chain node in a block chain network for verification so as to facilitate the processing of the batch transaction after the verification is passed;
wherein batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction of the plurality of transactions, and a contract address of the batch transaction is an 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 batch transactions based on a blockchain is provided, where at least a batch transaction intelligent contract is deployed on the blockchain network; the block link point includes:
the receiving module is used for receiving batch transactions sent by the target user terminal, wherein the batch transactions are obtained after the target user terminal creates and signs based on a plurality of transactions to be submitted; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
the first execution module obtains a contract address by analyzing the batch transaction after the verification module verifies and agrees and packages the received batch transaction, and calls the intelligent contract of the batch transaction based on the contract address to verify each transaction corresponding to the batch transaction parameters;
the second execution module calls the corresponding transaction sub-contract to process the transaction based on the transaction sub-contract address of each transaction when the verification is successful; and the number of the first and second groups,
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 that, 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 provided, which stores one or more programs that, 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.
As can be seen from the technical solutions provided by one or more embodiments of the present specification, the target user terminal may use the address of the intelligent contract for batch transaction as a contract address, and perform splicing processing on transaction parameters of multiple transactions to be submitted to obtain batch transaction parameters, so as to merge multiple transactions to create one batch transaction; after the batch transaction is signed, the signature is sent to a block chain node for verification, after the verification is passed and the consensus is packaged, the intelligent batch transaction contract corresponding to the contract address is called to analyze batch transaction parameters so as to sequentially verify the format of each transaction, and if all the verification is correct, the transaction sub-contracts corresponding to the transaction sub-contract addresses of each transaction can be sequentially and respectively called to process the corresponding transactions. Therefore, only one signature and verification is needed when the transaction is processed, the volume of the data of the batch transaction is smaller than that of the data of a plurality of transactions, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved.
Drawings
In order to more clearly illustrate one or more embodiments or prior art solutions of the present specification, reference will now be made briefly to the attached drawings, which are needed in the description of one or more embodiments or prior art, and it should be apparent that the drawings in the description below are only some of the embodiments described in the specification, and that other drawings may be obtained by those skilled in the art without inventive exercise.
Fig. 1 is a block chain based processing system architecture scenario diagram for performing batch transactions according to an embodiment of the present disclosure.
Fig. 2 is a schematic diagram illustrating a step of a processing method for performing batch transactions based on a blockchain according to an embodiment of the present disclosure.
Fig. 3 is a second step schematic diagram of a processing method for performing batch transactions based on a blockchain according to an embodiment of the present disclosure.
Fig. 4 is a third step schematic diagram of a processing method for performing batch transactions based on a blockchain according to an embodiment of the present disclosure.
Fig. 5 is a schematic structural diagram of a processing system for performing batch transactions based on a blockchain according to an embodiment of the present disclosure.
Fig. 6 is a schematic structural diagram of a target user terminal that performs batch transactions based on a blockchain according to an embodiment of the present disclosure.
Fig. 7 is a schematic structural diagram of a blockchain node for performing batch transactions based on blockchains according to an embodiment of the present disclosure.
Fig. 8 is a schematic structural diagram of an electronic device provided in an embodiment of the present specification.
Detailed Description
In order to make the technical solutions in the present specification better understood, the technical solutions in one or more embodiments of the present specification will be clearly and completely described below with reference to the accompanying drawings in one or more embodiments of the present specification, and it is obvious that the one or more embodiments described are only a part of the embodiments of the present specification, and not all embodiments. All other embodiments that can be derived by a person skilled in the art from one or more of the embodiments described herein without making any inventive step shall fall within the scope of protection of this document.
The block chain is generally composed of a plurality of blocks, time stamps corresponding to the creation time of the block are recorded in the blocks, and all the blocks form a time-ordered data chain according to the time stamps recorded in the blocks. The real data generated by the physical world can be constructed into a standard transaction (transaction) format supported by a block chain, and is issued to the block chain, the node equipment in the block chain performs consensus processing on the received transaction, and after the consensus is achieved, the node equipment serving as an accounting node in the block chain packs the transaction into a block, and the block chain performs persistent evidence storage.
A tuple (tuple) is a basic concept in a relational database, where a relation is a table, and each row (i.e., each record in the database) in the table is a tuple and each column is an attribute. In a two-dimensional table, tuples are also referred to as rows.
A method signature is composed of the name of the method and a list of parameters (the order and type of the parameters of the method).
In view of the problems mentioned in the background, the processing performance of the prior blockchain system for processing transactions is generally weaker than that of the conventional system, and a batch transaction processing scheme is proposed to improve the transaction processing capability. At the beginning of transaction processing, a batch transaction intelligence contract may be deployed over a blockchain network. Thus, the target user terminal can use the address of the intelligent contract for batch transaction as a contract address and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the transactions are merged to create one batch transaction; after the batch transaction is signed, the signature is sent to a block chain node for verification, after the verification is passed and the consensus is packaged, the intelligent batch transaction contract corresponding to the contract address is called to analyze batch transaction parameters so as to sequentially verify the format of each transaction, and if all the verification is correct, the transaction sub-contracts corresponding to the transaction sub-contract addresses of each transaction can be sequentially and respectively called to process the corresponding transactions. Therefore, only one signature and verification is needed when the transaction is processed, the volume of the data of the batch transaction is smaller than that of the data of a plurality of transactions, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, for the case of operating according to the transaction times, the batch transaction scheme can also save the transaction cost of the user.
Referring to fig. 1, a block chain based processing system architecture scenario for performing batch transactions according to an embodiment of the present disclosure is shown. In this scenario, the target user terminal 102, which may be a hardware electronic device or a software client, 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, except that each blockchain node 106 is provided with a blockchain module to collectively maintain the blockchain network 104 through deployed intelligent contracts. In this specification, the blockchain node 106 is deployed with not only transaction execution-related intelligent contracts (i.e., one or more transaction sub-contracts) but also batch transaction intelligent contracts to implement batch processing of multiple transactions.
Example one
Referring to fig. 2, a schematic step diagram of a processing method for performing batch transactions based on a blockchain according to an embodiment of the present disclosure is provided, where the processing method 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 intelligent contract is deployed on the blockchain network; the intelligent contract for batch transaction is provided with a method for batch transaction, and the method can have one and 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 block chain node in the block chain network for verification; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data.
It should be understood that the embodiments of the present specification do not limit the number of multiple transactions to be submitted, as long as the upper limit of the transaction transmission data size is not exceeded. The multiple transactions to be submitted may be multiple transactions submitted by the user at one time, or multiple transactions submitted by the user in multiple times and cached.
Optionally, when the target user terminal creates a batch transaction based on multiple transactions to be submitted, the target user terminal may respectively determine a data structure of each transaction, and sequentially concatenate the determined multiple data structures to obtain batch transaction parameters; and using the address of the batch transaction intelligent contract as a contract address to create a batch transaction.
In other words, the target user terminal determines batch transaction parameters and contract addresses for one batch transaction to be created based on the transaction parameters for each of a plurality of transactions to be submitted. It should be understood that the transaction format of the batch transaction is different from the transaction format of a normal single transaction.
A common single transaction contains two parameters: a target contract address and method data. The target contract address is the transaction sub-contract address corresponding to a single transaction, the method data is essentially a combination of a method signature and method parameters, and the method signature is a combination of a method name and a parameter list (sequence and type of method parameters). In the embodiments of the present specification, both the target contract address and the method data may be understood as character strings, where the target contract address is a fixed length and the method data is a variable length, that is, the length is not fixed.
The batch transaction also contains two parameters: a target contract address and batch transaction parameters. The target contract address is the address of the intelligent contract for batch transaction, and the batch transaction parameters are spliced together by a data structure of a plurality of transactions. The data structure of each transaction can be determined based on transaction parameters of the transaction, and specifically, 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 better format of batch transaction parameters, and can also be simple data head-to-tail splicing instead of the tuple structure. It should be understood that the subcontract address for each transaction, as well as the determined data length, are fixed lengths and the method data is variable lengths.
That is, when a user needs to send batch transactions, the data length of the method signature + method parameter of a single sub-transaction is calculated first, and then the three parameters of the target contract address, the data length, the method signature + method parameter are spliced together 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 block chain nodes on a block chain for verification.
For example, assuming that the batch transaction is composed 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 the method signature + method parameter in transactions 1-3 are d1, d2 and d3, respectively, the format of the batch transaction is: batch transaction intelligent contract address: ID; batch transaction parameters: id 1; d 1; 1, a parameter; id 2; d 2; a parameter 2; id 3; d 3; and 3, parameters. It should be appreciated that when forming a batch transaction, the strings in the batch transaction parameters may be directly concatenated end-to-end, without the need for separators or the like. Furthermore, considering that the method signature + method parameter in the transaction is not a fixed length, the data length of the method signature + method parameter of each transaction needs to be calculated in advance, and the data length with the fixed length is added to the batch transaction parameter so as to extract the contract address and the method signature + method parameter of each transaction accurately in the following process.
Therefore, the embodiment of the specification can create a batch transaction by splicing the data structures of the multiple transactions, so that the multiple transactions do not need to be signed respectively, the batch transaction is only signed, and the complexity of signature processing is reduced.
Step 204: after the verification is passed and the consensus is packaged, other block chain nodes obtain contract addresses by analyzing the batch transactions, and call the intelligent batch transaction contracts based on the contract addresses to verify each transaction corresponding to the batch transaction parameters; if the verification is successful, step 206 is performed, otherwise, the process ends.
When the block chain nodes receive batch contract transactions, the transaction is verified in the transaction pool without difference from common transactions, and the signature and the transaction format are verified to be correct. After the consensus and packaging transaction, the transaction execution modules of other block chain nodes have no difference with the ordinary transaction in processing, and the transaction is processed by an executor. In the scheme, only the signature of batch transaction needs to be checked, and the signature of each transaction does not need to be checked, so that the workload of signature checking is reduced, and the verification processing efficiency is greatly improved.
Then, other block chain link points analyze the batch transaction to obtain a contract address; and then calling a method in the intelligent contract for batch transaction based on the contract address to realize the processing of batch transaction. Specifically, the intelligent contracts for batch transaction are called based on the contract addresses to acquire the subcontract addresses and the data length of the first transaction from batch transaction parameters, and the method data of the first transaction are acquired according to the acquired data length; acquiring the subcontract address and method data of each subsequent transaction in turn according to the mode; if the subcontract addresses and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct; otherwise, processing error report and terminating the batch transaction.
Still taking the batch transaction as an example, after receiving the batch transaction, according to the format of the batch transaction: batch transaction intelligent contract address: ID; batch transaction parameters: id 1; d 1; 1, a parameter; id 2; d 2; a parameter 2; id 3; d 3; and 3, extracting the ID from the parameter, calling a method in the intelligent batch transaction contract corresponding to the ID based on the ID, and sequentially verifying the format of each transaction from the batch transaction parameter, wherein each transaction is actually accurately extracted. Because the target contract address is of fixed length, the sub-contract address of the first transaction can be extracted from the batch transaction parameter according to the set fixed length, and meanwhile, the parameter of the data length is also of fixed length, so that the data length (parameter) of the first transaction can be extracted from the batch transaction parameter according to the set length value of the data length; then, extracting a method signature + method parameter of a matching length from batch transaction parameters according to the extracted data length; in this way, the data structure for the first transaction is obtained. The data structure for each transaction is then extracted from the remaining parameters in the manner described above. If the data structures of all transactions are successfully acquired, the data structures of the batch transactions can be determined to be correctly verified, otherwise, error reporting processing is required, and the batch transactions are terminated.
Step 206: the other block nodes invoke the corresponding transaction subcontracts to process the transaction based on the transaction subcontract address of each transaction.
When processing each transaction, the address of the transaction subcontract, the method signature and the method parameter are used for processing the subcontract, and Gas fee and the like required by the transaction are transmitted simultaneously. Gas may be understood, among other things, as computing and/or storage resources needed to support transaction execution. And processing each transaction in a sequential processing mode, finishing batch transaction processing when all transactions are finally processed, and recording the completion of all transaction processing in an event mode.
An implementable solution, after the at least one blockchain node obtains a contract address by parsing the batch transaction and before the batch transaction intelligent contract is invoked based on the contract address to verify each transaction corresponding to the batch transaction parameters, the method further comprising:
judging whether the batch transactions carry method marks representing dependence relations among transactions or not; if the intelligent contract is carried, the at least one block chain node calls a first transaction method matched with the method mark from the intelligent contracts for batch transaction, calls 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 be processed, and rolls back transaction data, namely rolls back the processing state of each previous transaction; otherwise, the at least one block chain node calls a second trading method from the intelligent batch trading contract, calls a corresponding trading sub-contract to process the trade based on the trading sub-contract address of each trade, and skips the trade and continues to execute the next trade when any trade fails to be processed.
That is to say, two sets of methods are deployed in advance in the intelligent batch transaction contract, one set of methods is executed for batch transactions composed of a plurality of transactions with dependency relationships, and the other set of methods is executed for batch transactions composed of a plurality of transactions without dependency relationships. The multiple transactions having the dependency relationship may refer to that the multiple transactions have a timing, causal, or state dependency relationship, and may be embodied in specific transaction association.
After the block link points acquire contract addresses based on the received batch transactions, the intelligent batch transaction contracts to be called are determined. And then, judging whether the batch transactions carry method marks representing the dependency relationship among the 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 transaction processing fails. Otherwise, the second transaction method can be called to process the batch transaction, and when the transaction processing fails, the transaction is skipped to continue to execute the next transaction. Specifically, the batch transactions may carry a method flag 1 representing that there is a dependency relationship between the transactions, or the batch transactions may carry a method flag 0 representing that there is no dependency relationship between the transactions. For another example, the batch transaction may carry a method tag 1 that characterizes the dependency relationship between the transactions, or the batch transaction may not carry any method tag. The first transaction method may correspond to method flag 1, and the second transaction method may correspond to method flag 0 or no flag.
Further, when a second transaction method is called to process each transaction and transaction processing fails in batch transaction without dependency relationship, the transaction 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 transaction execution are insufficient, terminating the batch transaction, and recording the transaction which is successfully processed in the intelligent contract for batch transaction in a contract event mode. Therefore, query can be facilitated, so that only incomplete transactions can be reprocessed next time, repeated processing of all transactions is avoided, and processing resources and expenses are saved.
When the first transaction method is called to process each transaction and the conditions of transaction processing failure/insufficient calculation and/or storage resources required by transaction execution are generated, the batch transaction is terminated, the processing states of all sub-transactions in the current batch transaction cannot be submitted to a block chain state, and only the commission charge of transaction processing 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 an intelligent contract for the batch transaction; and/or; the target user terminal can also obtain the processing result of the corresponding transaction by monitoring the contract events on the sub-contracts corresponding to each transaction. That is, after each transaction is processed, the processing result is recorded on the sub-contract corresponding to the transaction in a contract time manner, so that a subsequent target user terminal can remotely monitor to obtain the processing result. Similarly, all transaction completion conditions can be recorded on the intelligent contract for batch transaction by means of contract events: and all successful processing, partial failure processing and the like are carried out, so that the subsequent target user terminal can remotely monitor and acquire the processing result.
By the embodiment of the specification, the target user terminal can use the address of the intelligent contract for batch transaction as a contract address and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the transactions are merged to create one batch transaction; after the batch transaction is signed, the signature is sent to a block chain node for verification, after the verification is passed and the consensus is packaged, the intelligent batch transaction contract corresponding to the contract address is called to analyze batch transaction parameters so as to sequentially verify the format of each transaction, and if all the verification is correct, the transaction sub-contracts corresponding to the transaction sub-contract addresses of each transaction can be sequentially and respectively called to process the corresponding transactions. Therefore, only one signature and verification is needed when the transaction is processed, the volume of the data of the batch transaction is smaller than that of the data of a plurality of transactions, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, for the case of operating according to the transaction times, the batch transaction scheme can also save the transaction cost of the user. Meanwhile, the batch transaction mode can also facilitate the user to process a plurality of transactions with sequence dependence or transaction requirements. The batch transaction is not different from the original common transaction, the block chain does not need to be additionally transformed, and the batch transaction can be realized only by adding a batch transaction intelligent contract.
Example two
Referring to fig. 3, a schematic diagram of steps of a processing method for performing batch transactions based on a blockchain according to an embodiment of the present disclosure is provided, where 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: sending the signed batch transaction to at least one block chain node in a block chain network for verification so as to facilitate processing of the batch transaction after the verification is passed;
wherein batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction of the plurality of transactions, and a contract address of the batch transaction is an 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 a plurality of transactions to be submitted specifically includes:
respectively determining a data structure of each transaction, and sequentially splicing the determined data structures to obtain batch transaction parameters; and using the address of the batch transaction intelligent contract as a contract address to create a batch transaction.
In a specific implementation manner of the embodiment of the present specification, the determining the data structure of each transaction respectively specifically includes:
the target user terminal performs, for each transaction respectively: determining 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 another specific implementation manner of the embodiment of the present specification, after the batch transaction is ended, the method further includes:
acquiring a processing result of batch transaction by monitoring contract events on intelligent contracts of batch transaction; and/or, acquiring a processing result of the corresponding transaction by monitoring contract events on the sub-contract corresponding to each transaction.
It should be understood that the cooperative operation between the block chain link point and the target user terminal on the block chain constitutes the processing scheme for performing batch transaction based on the block chain, and therefore, in the second embodiment, only the target user terminal is protected, and most of the content only relates to the operation of the target user terminal, and the method operation and the technical effect performed by using the corresponding block chain link point as the execution main body can be referred to the first embodiment, which is not described herein again.
EXAMPLE III
Referring to fig. 4, a schematic step diagram of a processing method for performing batch transactions based on a blockchain according to an embodiment of the present disclosure is shown, where the method is applied to a blockchain node on a blockchain network, and at least a batch transaction intelligent contract is deployed on the blockchain; the method may comprise the steps of:
step 402: at least one block chain node receives batch transactions sent by a target user terminal, wherein the batch transactions are obtained after the target user terminal creates and signs based on a plurality of transactions to be submitted; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
step 404: after the verification is passed and the consensus is packaged, other block chain nodes obtain contract addresses by analyzing the batch transactions, and call the intelligent batch transaction contracts based on the contract addresses to verify each transaction corresponding to the batch transaction parameters; if the verification is successful, executing step 406, otherwise, ending the process;
step 406: the other block nodes invoke the corresponding transaction subcontracts to process each transaction based on the transaction subcontract address of the transaction.
Optionally, as an embodiment, invoking the intelligent batch transaction contract based on the contract address to verify each transaction corresponding to the batch transaction parameter specifically includes:
calling the intelligent batch transaction contract based on the contract address to acquire a subcontract address and a data length of the first transaction from batch transaction parameters, and acquiring method data of the first transaction according to the acquired data length; acquiring the subcontract address and method data of each subsequent transaction in turn according to the mode; if the subcontract addresses and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct; otherwise, processing error report and terminating the batch transaction.
In a specific implementation manner of the embodiment of this specification, after obtaining a contract address by parsing the batch transaction and before invoking the intelligent batch transaction contract based on the contract address to verify each transaction corresponding to the batch transaction parameters, the method further includes:
judging whether the batch transactions carry method marks representing dependence relations among transactions or not; if the intelligent contract is carried, calling a first transaction method matched with the method mark from the intelligent contract for batch transaction, calling a corresponding transaction sub-contract to process the transaction based on the transaction sub-contract address of each transaction, and terminating the batch transaction and rolling back transaction data when any transaction fails to be processed; otherwise, the at least one block chain node calls a second trading method from the intelligent batch trading contract, calls a corresponding trading sub-contract to process the trade based on the trading sub-contract address of each trade, and skips the trade and continues to execute the next trade when any trade fails to be processed.
In another specific implementation manner of the embodiment of the present specification, when a second transaction method is invoked to process each transaction and a transaction processing failure occurs, the transaction that is processed in failure is recorded in a manner of a contract event; or in the transaction processing process, when the calculation and/or storage resources required by supporting transaction execution are insufficient, terminating the batch transaction, and recording the transaction which is successfully processed in the intelligent contract for batch transaction in a contract event mode.
It should be understood that the cooperative operation between the block chain node and the target user terminal on the block chain constitutes the processing scheme for performing batch transaction based on the block chain, and therefore, in the third embodiment, only the block chain node is protected and most of the content only relates to the operation of the block chain node, and the method operation and the technical effect performed by the target user terminal corresponding to the block chain node as the execution main body can be referred to the first embodiment, which is not described herein again.
Example four
Referring to fig. 5, a schematic structural diagram of a processing system for performing batch transactions based on a blockchain according to an embodiment of the present disclosure is provided, where the processing system may include: a target user terminal 502 and a blockchain network 504, wherein the blockchain network 504 comprises a plurality of blockchain nodes 506, and at least a batch transaction intelligent contract is deployed on the blockchain network 504; wherein the content of the first and second substances,
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; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the consensus is packaged, the other block chain nodes 506 acquire contract addresses by analyzing the batch transactions, and call the intelligent batch transaction contracts based on the contract addresses to verify each transaction corresponding to the batch transaction parameters;
if the verification is successful, the other block link nodes 506 call the corresponding transaction subcontracts to process the transaction based on the transaction subcontract 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 an 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 multiple transactions to be submitted, the target user terminal is specifically configured to determine a data structure of each transaction respectively, and sequentially concatenate the determined multiple data structures to obtain batch transaction parameters; and using the address of the batch transaction intelligent contract as a contract address to create a batch transaction.
In a specific implementation manner of the embodiment of this specification, when the target user terminal determines the data structure of each transaction, it is specifically configured to perform, for each transaction: determining 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 another specific implementation manner of the embodiment of this specification, when the at least one block chain node invokes the batch transaction intelligent contract based on the contract address to verify each transaction corresponding to the batch transaction parameter, the at least one block chain node is specifically configured to: calling the intelligent batch transaction contract based on the contract address to acquire a subcontract address and a data length of the first transaction from batch transaction parameters, and acquiring method data of the first transaction according to the acquired data length; acquiring the subcontract address and method data of each subsequent transaction in turn according to the mode; if the subcontract addresses and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct; otherwise, processing error report and terminating the batch transaction.
In another specific implementation manner of the embodiment of this specification, after the at least one blockchain node obtains a contract address by parsing the batch transaction, and before invoking the batch transaction intelligent contract based on the contract address to verify each transaction corresponding to the batch transaction parameters, the method is further configured to: judging whether the batch transactions carry method marks representing dependence relations among transactions or not; if the intelligent contract is carried, the at least one block chain node calls a first transaction method matched with the method mark from the intelligent contracts for batch transaction, calls a corresponding transaction sub-contract to process the transaction based on the transaction sub-contract address of each transaction, and terminates the batch transaction and rolls back transaction data when any transaction fails to be processed; otherwise, the at least one block chain node calls a second trading method from the intelligent batch trading contract, calls a corresponding trading sub-contract to process the trade based on the trading sub-contract address of each trade, and skips the trade and continues to execute the next trade when any trade fails to be processed.
In another specific implementation manner of the embodiment of the present specification, when a second transaction method is invoked to process each transaction and a transaction processing failure occurs, the transaction that is processed in failure is recorded in a manner of a contract event; or in the transaction processing process, when the calculation and/or storage resources required by supporting transaction execution are insufficient, terminating the batch transaction, and recording the transaction which is successfully processed in the intelligent contract for batch transaction in a contract event mode.
In another specific implementation manner of the embodiment of the present specification, 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 an intelligent contract for the batch transaction; and/or, acquiring a processing result of the corresponding transaction by monitoring contract events on the sub-contract corresponding to each transaction.
By the embodiment of the specification, the target user terminal can use the address of the intelligent contract for batch transaction as a contract address and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the transactions are merged to create one batch transaction; after the batch transaction is signed, the signature is sent to a block chain node for verification, after the verification is passed and the consensus is packaged, the intelligent batch transaction contract corresponding to the contract address is called to analyze batch transaction parameters so as to sequentially verify the format of each transaction, and if all the verification is correct, the transaction sub-contracts corresponding to the transaction sub-contract addresses of each transaction can be sequentially and respectively called to process the corresponding transactions. Therefore, only one signature and verification is needed when the transaction is processed, the volume of the data of the batch transaction is smaller than that of the data of a plurality of transactions, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, for the case of operating according to the transaction times, the batch transaction scheme can also save the transaction cost of the user.
EXAMPLE five
Referring to fig. 6, for the target user terminal for performing batch transactions based on a blockchain according to an embodiment of the present disclosure, the target user terminal 600 may include:
a creating module 602, which creates a batch transaction based on a plurality of transactions to be submitted, and signs the batch transaction;
the sending module 604 is configured to send the signed batch transaction to at least one blockchain node in a blockchain network for verification, so that the batch transaction is processed after the verification is passed;
wherein batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction of the plurality of transactions, and a contract address of the batch transaction is an 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 a data structure of each transaction, and sequentially splicing the determined data structures to obtain batch transaction parameters; and using the address of the batch transaction intelligent contract as a contract address to create a batch transaction.
In a specific implementation manner of the embodiment of the present specification, when the creating module 602 determines the data structure of each transaction, it is specifically configured to: for each transaction, performing: determining 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 another specific implementation manner of the embodiment of this specification, the target user terminal further includes: the monitoring module is used for monitoring contract events on intelligent contracts of batch transactions after the batch transactions are finished so as to obtain processing results of the batch transactions; and/or, acquiring a processing result of the corresponding transaction by monitoring contract events on the sub-contract corresponding to each transaction.
EXAMPLE six
Referring to fig. 7, a blockchain node for performing batch transactions based on a blockchain provided in an embodiment of the present specification is shown, where at least a batch transaction intelligent contract is deployed on the blockchain network; each blockchain node 700 may include: basic modules required for processing the blockchain service, such as a packaging module, a consensus module, a verification module, an execution module, and the like, further include a receiving module 702 for receiving transactions (including batch transactions or common single transactions), and an execution module, wherein the execution module may be further divided into a first execution module 704 for invoking a batch transaction intelligent contract and a second execution module 706 for invoking a transaction sub-contract according to different invoking contracts;
a receiving module 702, configured to receive a batch transaction sent by a target user terminal, where the batch transaction is obtained after the target user terminal creates and signs based on multiple transactions to be submitted; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an 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 used for acquiring a contract address by analyzing the batch transaction after the verification module verifies and agrees and packages the received batch transaction, and calling the intelligent batch transaction contract based on the contract address to verify each transaction corresponding to the batch transaction parameters;
a second execution module 706, which invokes a corresponding transaction sub-contract to process each transaction based on the transaction sub-contract address of 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 based on the contract address to verify each transaction corresponding to the batch transaction parameter, the first execution module is specifically configured to: calling the intelligent batch transaction contract based on the contract address to acquire a subcontract address and a data length of the first transaction from batch transaction parameters, and acquiring method data of the first transaction according to the acquired data length; acquiring the subcontract address and method data of each subsequent transaction in turn according to the mode; if the subcontract addresses and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct; otherwise, processing error report and terminating the batch transaction.
In a specific implementation manner of the embodiment of this specification, after the first execution module 704 obtains the contract address by parsing the batch transaction, and before the batch transaction intelligent contract is invoked to verify each transaction corresponding to the batch transaction parameters based on the contract address, the method is further configured to: judging whether the batch transactions carry method marks representing dependence relations among transactions or not; if the intelligent contract is carried, calling a first transaction method matched with the method mark from the intelligent contract for batch transaction, calling a corresponding transaction sub-contract to process the transaction based on the transaction sub-contract address of each transaction, and terminating the batch transaction and rolling back transaction data when any transaction fails to be processed; otherwise, the at least one block chain node calls a second trading method from the intelligent batch trading contract, calls a corresponding trading sub-contract to process the trade based on the trading sub-contract address of each trade, and skips the trade and continues to execute the next trade when any trade fails to be processed.
In another specific implementation manner of the embodiment of this specification, the blockchain node further includes: the event recording module is used for recording the transaction which fails to be processed in a contract event mode when the second transaction method is called to process each transaction and the transaction processing fails; or in the transaction processing process, when the calculation and/or storage resources required by supporting transaction execution are insufficient, terminating the batch transaction, and recording the transaction which is successfully processed in the intelligent contract for batch transaction in a contract event mode.
It should be understood that the fifth embodiment and the sixth embodiment are respectively part of the fourth embodiment, and therefore details of specific device modules and functional effects can be understood with reference to the contents of the first embodiment and the fourth embodiment, which are not described herein again.
EXAMPLE seven
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present specification. Referring to fig. 8, at a hardware level, the electronic device includes a processor, and optionally further includes 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, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 8, but that does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads a corresponding computer program from the non-volatile memory into the memory and then runs the computer program, and forms a processing device (i.e. a target user terminal or a blockchain node) for performing batch transaction based on the blockchain on a logic level. The processor is used for executing the program 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;
sending the signed batch transaction to at least one block chain node in a block chain network for verification so as to facilitate processing of the batch transaction after the verification is passed;
wherein batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction of the plurality of transactions, and a contract address of the batch transaction is an address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data. Or;
receiving batch transactions sent by a target user terminal, wherein the batch transactions are obtained after the target user terminal creates and signs based on a plurality of transactions to be submitted; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the agreement is packaged, acquiring a contract address by analyzing the batch transaction, and calling the intelligent contract for the batch transaction based on the contract address to verify each transaction corresponding to the batch transaction parameters;
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 apparatuses disclosed in the embodiments of fig. 2-7 in the present specification can be applied to 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 instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The methods, steps, and logic blocks disclosed in one or more embodiments of the present specification 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 hardware, in a software module executed by a hardware decoding processor, or in a combination of the hardware and software modules executed by a hardware decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may further execute the methods in fig. 2 to 4, and implement the functions of the corresponding apparatuses in the embodiments shown in fig. 2 to 4, which are not described herein again in this specification.
Of course, besides the software implementation, the electronic device of the embodiment of the present disclosure does not exclude other implementations, such as a logic device or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or a logic device.
By the embodiment of the specification, the target user terminal can use the address of the intelligent contract for batch transaction as a contract address and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the transactions are merged to create one batch transaction; after the batch transaction is signed, the signature is sent to a block chain node for verification, after the verification is passed and the consensus is packaged, the intelligent batch transaction contract corresponding to the contract address is called to analyze batch transaction parameters so as to sequentially verify the format of each transaction, and if all the verification is correct, the transaction sub-contracts corresponding to the transaction sub-contract addresses of each transaction can be sequentially and respectively called to process the corresponding transactions. Therefore, only one signature and verification is needed when the transaction is processed, the volume of the data of the batch transaction is smaller than that of the data of a plurality of transactions, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, for the case of operating according to the transaction times, the batch transaction scheme can also save the transaction cost of the user.
Example eight
Embodiments of the present specification also propose 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, are capable of causing the portable electronic device to perform the method of the embodiments shown in 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;
sending the signed batch transaction to at least one block chain node in a block chain network for verification so as to facilitate processing of the batch transaction after the verification is passed;
wherein batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction of the plurality of transactions, and a contract address of the batch transaction is an address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data. Or;
receiving batch transactions sent by a target user terminal, wherein the batch transactions are obtained after the target user terminal creates and signs based on a plurality of transactions to be submitted; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the agreement is packaged, acquiring a contract address by analyzing the batch transaction, and calling the intelligent contract for the batch transaction based on the contract address to verify each transaction corresponding to the batch transaction parameters;
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.
By the embodiment of the specification, the target user terminal can use the address of the intelligent contract for batch transaction as a contract address and splice transaction parameters of a plurality of transactions to be submitted to obtain batch transaction parameters, so that the transactions are merged to create one batch transaction; after the batch transaction is signed, the signature is sent to a block chain node for verification, after the verification is passed and the consensus is packaged, the intelligent batch transaction contract corresponding to the contract address is called to analyze batch transaction parameters so as to sequentially verify the format of each transaction, and if all the verification is correct, the transaction sub-contracts corresponding to the transaction sub-contract addresses of each transaction can be sequentially and respectively called to process the corresponding transactions. Therefore, only one signature and verification is needed when the transaction is processed, the volume of the data of the batch transaction is smaller than that of the data of a plurality of transactions, the processing capacity of block chain tension is greatly relieved, and the transaction processing efficiency is improved. In addition, for the case of operating according to the transaction times, the batch transaction scheme can also save the transaction cost of the user.
In short, the above description is only a preferred embodiment of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.
The system, apparatus, module or unit illustrated in one or more of the above embodiments may be implemented by a computer chip or an entity, or by an article of manufacture with a certain functionality. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, 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 computer storage media 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 that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
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 an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may 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 may also be possible or may be advantageous.

Claims (14)

1. A processing method for executing batch transaction based on a block chain is applied to a processing system comprising a target user terminal and a block chain network, wherein at least a batch transaction intelligent contract is deployed on the block chain 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 block chain node in the block chain network for verification; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the consensus is packaged, other block chain nodes obtain contract addresses by analyzing the batch transactions, and call the intelligent batch transaction contracts based on the contract addresses to verify each transaction corresponding to the batch transaction parameters;
if the verification is successful, other block chain nodes call corresponding transaction subcontracts to process the transaction based on the transaction subcontract address of each transaction;
if the verification fails, the process ends.
2. The method of claim 1, wherein the target ue creates a batch transaction based on a plurality of transactions to be submitted, and the method further comprises:
the target user terminal respectively determines a data structure of each transaction and sequentially splices the determined data structures to obtain batch transaction parameters; and the number of the first and second groups,
and taking the address of the intelligent contract of the batch transaction as a contract address to create a batch transaction.
3. The method according to claim 2, wherein the target ue determines the data structure of each transaction, and comprises:
the target user terminal performs, for each transaction respectively:
determining 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.
4. The method according to claim 3, wherein the at least one blockchain node invokes the intelligent batch transaction contract based on the contract address to verify each transaction corresponding to the batch transaction parameters, and specifically includes:
the at least one block chain node calls the intelligent batch transaction contract based on the contract address to acquire a subcontract address and a data length of the first transaction from batch transaction parameters, and acquires method data of the first transaction according to the acquired data length; acquiring the subcontract address and method data of each subsequent transaction in turn according to the mode;
if the subcontract addresses and the method data of all the transactions are successfully acquired, determining that the format verification of each transaction is correct;
otherwise, processing error report and terminating the batch transaction.
5. The method of claim 1, wherein after the at least one blockchain node obtains a contract address by parsing the batch transaction and before the batch transaction intelligent contract is invoked based on the contract address to verify each transaction corresponding to the batch transaction parameters, the method further comprises:
judging whether the batch transactions carry method marks representing dependence relations among transactions or not;
if the intelligent contract is carried, the other block chain nodes call a first transaction method matched with the method mark from the intelligent contracts for batch transaction, call corresponding transaction sub-contracts to process the transaction based on the transaction sub-contract address of each transaction, terminate the batch transaction and roll back transaction data when any transaction fails to be processed;
otherwise, the at least one block chain node calls a second trading method from the intelligent batch trading contract, calls a corresponding trading sub-contract to process the trade based on the trading sub-contract address of each trade, and skips the trade and continues to execute the next trade when any trade fails to be processed.
6. The processing method for executing batch transactions based on blockchain as claimed in claim 5, wherein when the second transaction method is called to process each transaction and a transaction processing failure occurs, the transaction processing failure is recorded by means of contract events; alternatively, the first and second electrodes may be,
in the transaction processing process, when the calculation and/or storage resources required by supporting transaction execution are insufficient, the batch transaction is terminated, and the transaction which is successfully processed is recorded in the intelligent contract for batch transaction in a contract event mode.
7. The method of claim 6, wherein after the batch transaction is completed, the method further comprises:
the target user terminal acquires a processing result of batch transaction by monitoring contract events on the intelligent contracts of the batch transaction; and/or
And the target user terminal monitors contract events on sub-contracts corresponding to each transaction to obtain a processing result of the corresponding transaction.
8. A processing method for executing batch transaction based on block chain 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;
sending the signed batch transaction to at least one block chain node in a block chain network for verification so as to facilitate processing of the batch transaction after the verification is passed;
wherein batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction of the plurality of transactions, and a contract address of the batch transaction is an address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data.
9. A processing method for executing batch transaction based on a block chain is applied to a block chain node on a block chain network, and at least a batch transaction intelligent contract is deployed on the block chain network; the method comprises the following steps:
receiving batch transactions sent by a target user terminal, wherein the batch transactions are obtained after the target user terminal creates and signs based on a plurality of transactions to be submitted; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the agreement is packaged, acquiring a contract address by analyzing the batch transaction, and calling the intelligent contract for the batch transaction based on the contract address to verify each transaction corresponding to the batch transaction parameters;
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.
10. A processing system for performing batch transactions based on blockchain, comprising: the system comprises a target user terminal and a block chain network, wherein the block chain network comprises a plurality of block chain nodes, and at least a batch transaction intelligent contract is deployed on the block chain network; wherein the content of the first and second substances,
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 block chain node in the block chain network for verification; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
after the verification is passed and the consensus is packaged, other block chain nodes obtain contract addresses by analyzing the batch transactions, and call the intelligent batch transaction contracts based on the contract addresses to verify each transaction corresponding to the batch transaction parameters;
if the verification is successful, the other block chain nodes call corresponding transaction subcontracts to process the transaction based on the transaction subcontract address of each transaction;
if the verification fails, the process ends.
11. A target user terminal for performing batch transactions based on blockchain, comprising:
the system comprises a creating module, a signing module and a processing module, wherein the creating 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 block chain node in a block chain network for verification so as to facilitate the processing of the batch transaction after the verification is passed;
wherein batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction of the plurality of transactions, and a contract address of the batch transaction is an address of a batch transaction intelligent contract deployed on the blockchain network; the transaction parameters include: transaction subcontract address and method data.
12. A blockchain node for executing batch transaction based on blockchain, wherein at least a batch transaction intelligent contract is deployed on the blockchain network; the block link point includes:
the receiving module is used for receiving batch transactions sent by the target user terminal, wherein the batch transactions are obtained after the target user terminal creates and signs based on a plurality of transactions to be submitted; batch transaction parameters of the batch transaction are determined based on transaction parameters of each transaction in the plurality of transactions, and a contract address of the batch transaction is an address of the intelligent contract of the batch transaction; wherein the transaction parameters include: transaction subcontract address and method data;
the first execution module obtains a contract address by analyzing the batch transaction after the verification module verifies and agrees and packages the received batch transaction, and calls the intelligent contract of the batch transaction based on the contract address to verify each transaction corresponding to the batch transaction parameters;
the second execution module calls the corresponding transaction sub-contract to process the transaction based on the transaction sub-contract address of each transaction when the verification is successful; and the number of the first and second groups,
the process ends when the authentication fails.
13. An electronic device, comprising:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to perform the steps of the method of claim 8 or 9.
14. 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 8 or 9.
CN202110892853.0A 2021-08-04 2021-08-04 Processing method, device and system for executing batch transaction based on block chain Pending CN113706146A (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (1)

Publication Number Publication Date
CN113706146A true CN113706146A (en) 2021-11-26

Family

ID=78651559

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110892853.0A Pending CN113706146A (en) 2021-08-04 2021-08-04 Processing method, device and system for executing batch transaction based on block chain

Country Status (1)

Country Link
CN (1) CN113706146A (en)

Cited By (1)

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

Citations (5)

* 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
CN110264348A (en) * 2019-05-07 2019-09-20 北京奇艺世纪科技有限公司 A kind of processing method, device and the storage medium of cochain of trading
CN111177258A (en) * 2019-12-13 2020-05-19 浙商银行股份有限公司 Adaptive configuration transaction packaging method based on block chain platform
US20200379980A1 (en) * 2019-06-03 2020-12-03 Samsung Sds Co., Ltd. Blockchain-based computing system and method for managing transaction thereof
CN112232823A (en) * 2020-12-10 2021-01-15 腾讯科技(深圳)有限公司 Transaction processing method, device, medium and electronic equipment of block chain system

Patent Citations (5)

* 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
CN110264348A (en) * 2019-05-07 2019-09-20 北京奇艺世纪科技有限公司 A kind of processing method, device and the storage medium of cochain of trading
US20200379980A1 (en) * 2019-06-03 2020-12-03 Samsung Sds Co., Ltd. Blockchain-based computing system and method for managing transaction thereof
CN111177258A (en) * 2019-12-13 2020-05-19 浙商银行股份有限公司 Adaptive configuration transaction packaging method based on block chain platform
CN112232823A (en) * 2020-12-10 2021-01-15 腾讯科技(深圳)有限公司 Transaction processing method, device, medium and electronic equipment of block chain system

Cited By (1)

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

Similar Documents

Publication Publication Date Title
CN110659988B (en) Parallel processing method and device for block chain consensus and execution and electronic equipment
CN108765159B (en) Block chain-based uplink and state processing method and device and interconnection system
CN108846749B (en) Partitioned transaction execution system and method based on block chain technology
CN111461887B (en) Block chain consensus processing method and device and electronic equipment
CN109299015B (en) Software testing method, device and system
CN110020859B (en) Parallel execution block chain consensus method and device and electronic equipment
CN111143087A (en) Interface calling method and device, storage medium and server
CN111698244B (en) Method and device for rapidly participating in consensus of newly added nodes and electronic equipment
CN110780870A (en) Service execution method, device, equipment and storage medium
CN111369358A (en) Block chain consensus method and device and electronic equipment
CN110648125B (en) Packaging transaction method and device, electronic equipment and storage medium
CN112037061A (en) Processing method and device for transactions in block chain, electronic equipment and storage medium
WO2021082661A1 (en) Webpage screenshot capturing method, apparatus and device
CN111461886B (en) Management method and device for system configuration independent of intelligent contracts on block chains
CN111553652A (en) Service processing method and device
CN113706146A (en) Processing method, device and system for executing batch transaction based on block chain
CN109345081B (en) Data acquisition method and device and electronic equipment
CN110851207B (en) State transition management method and device, electronic equipment and storage medium
CN111709748A (en) Transaction execution method and device with service attribute and electronic equipment
CN111597020A (en) Application Programming Interface (API) debugging method and debugging terminal
CN108710658B (en) Data record storage method and device
CN110750271B (en) Service aggregation, method and device for executing aggregated service and electronic equipment
CN115203050A (en) Method and device for determining dependency relationship of services
CN115118625A (en) Data verification method and device
CN110599139B (en) Block output method and device in block chain consensus algorithm

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