CN111429140B - Method and device for realizing atomicity of multi-level intelligent contract stack - Google Patents
Method and device for realizing atomicity of multi-level intelligent contract stack Download PDFInfo
- Publication number
- CN111429140B CN111429140B CN202010233754.7A CN202010233754A CN111429140B CN 111429140 B CN111429140 B CN 111429140B CN 202010233754 A CN202010233754 A CN 202010233754A CN 111429140 B CN111429140 B CN 111429140B
- Authority
- CN
- China
- Prior art keywords
- data area
- intelligent contract
- executed
- transaction
- address
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q20/00—Payment architectures, schemes or protocols
- G06Q20/38—Payment protocols; Details thereof
- G06Q20/389—Keeping log of transactions for guaranteeing non-repudiation of a transaction
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2365—Ensuring data consistency and integrity
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/46—Multiprogramming arrangements
- G06F9/466—Transaction processing
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- General Engineering & Computer Science (AREA)
- Accounting & Taxation (AREA)
- Software Systems (AREA)
- General Business, Economics & Management (AREA)
- Finance (AREA)
- Computer Security & Cryptography (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Strategic Management (AREA)
- Memory System Of A Hierarchy Structure (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The method comprises the steps of sequentially calling and executing at least one second intelligent contract associated with a first intelligent contract in a later layer according to a calling sequence in the execution process of the first intelligent contract in the previous layer of the multi-layer intelligent contract stack; in each calling execution process, a corresponding second transaction container is established for a second intelligent contract, and the address of a cache data area in a first transaction container corresponding to a first intelligent contract is saved as the address of a commit data area in the second transaction container; according to the mode, intelligent contracts in each layer of a multi-layer intelligent contract stack are called and executed layer by layer until all the intelligent contracts are successfully called and executed, so that the atomicity of the multi-layer intelligent contract stack is realized, and the time and the resource expenditure are greatly saved; and if the calling and the execution of one of the intelligent contracts fail, all the transaction containers corresponding to the intelligent contracts which are successfully executed are discarded.
Description
Technical Field
The application relates to the technical field of block chaining, in particular to a technology for realizing atomicity of a multi-level intelligent contract stack.
Background
The transaction container is a container for ensuring that batch operations can be executed atomically, that is, a plurality of operations are packed together for batch execution, and the batch operations are either completely executed successfully or completely executed unsuccessfully, so that no partial success condition exists. This plays an important role in each application scenario within the blockchain.
In conventional operation, the transactional method is implemented by committing together if the batch operation is all successfully executed. If a certain operation fails to be executed, the successful operations are executed one by one until all the operations which are executed successfully are rolled back, and the data is restored to the original state before any operation is not executed.
However, this method has many problems, when the batch execution fails, the successful operations are rolled back one by one, and the calculation resources are consumed first, and the time consumption is long; moreover, it cannot be guaranteed that rollback is completely successful, that is, a rollback failure of an operation may also occur during the rollback process. This problem is particularly important in block chains where multiple intelligent contracts need to be coordinated.
Therefore, how to quickly, energy-saving and flexibly implement atomicity of a multi-level intelligent contract stack becomes one of the technical problems that the technical personnel in the field need to solve urgently.
Disclosure of Invention
The application aims to provide a method and a device for realizing atomicity of a multi-level intelligent contract stack.
According to one aspect of the application, a method of implementing atomicity for a multi-level intelligent contract stack is provided, wherein the method comprises the steps of:
a, in the execution process of a first intelligent contract at the previous layer of a multi-level intelligent contract stack, sequentially calling and executing at least one second intelligent contract associated with the first intelligent contract in the next layer according to a calling sequence;
b, in each calling execution process, creating a corresponding second transaction container for the second intelligent contract, and storing the address of a cache data area in a first transaction container corresponding to the first intelligent contract as the address of a commit data area in the second transaction container, wherein each transaction container comprises the address of the cache data area and the address of the commit data area, and the cache data area and the commit data area store the address corresponding to the data;
c, calling and executing the intelligent contracts in each layer of the multi-layer intelligent contract stack layer by layer according to the mode in the step a and the step b until all the intelligent contracts are successfully called and executed, so as to realize the atomicity of the multi-layer intelligent contract stack.
According to another aspect of the present application, there is also provided an apparatus for implementing atomicity for a multi-level intelligent contract stack, wherein the apparatus comprises:
the executing device is used for sequentially calling and executing at least one second intelligent contract related to a first intelligent contract in a later layer according to the calling sequence in the executing process of the first intelligent contract in the previous layer of the multi-layer intelligent contract stack;
a creating device, configured to create a corresponding second transaction container for the second intelligent contract in each call execution process, and store an address of a cache data area in a first transaction container corresponding to the first intelligent contract as an address of a commit data area in the second transaction container, where each transaction container includes the address of the cache data area and the address of the commit data area, and the cache data area and the commit data area store addresses corresponding to data;
and the calling device is used for calling the executing device and the creating device to execute the intelligent contracts in each layer of the multi-layer intelligent contract stack layer by layer until all the intelligent contracts are called and executed successfully so as to realize the atomicity of the multi-layer intelligent contract stack.
According to yet another aspect of the application, there is also provided a computer readable storage medium storing computer code which, when executed, performs a method as in any one of the preceding claims.
According to yet another aspect of the application, there is also provided a computer program product, which when executed by a computer device, performs the method of any of the preceding claims.
According to yet another aspect of the present application, there is also provided a computer apparatus, including:
one or more processors;
a memory for storing one or more computer programs;
the one or more computer programs, when executed by the one or more processors, cause the one or more processors to implement the method of any preceding claim.
Compared with the prior art, the method and the device have the advantages that in the execution process of the first intelligent contract of the previous layer of the multi-level intelligent contract stack, at least one second intelligent contract related to the first intelligent contract in the next layer is sequentially called and executed according to the calling sequence; in each calling execution process, creating a corresponding second transaction container for the second intelligent contract, and saving an address of a cache data area in a first transaction container corresponding to the first intelligent contract as an address of a commit data area in the second transaction container, wherein each transaction container comprises the address of the cache data area and the address of the commit data area, and the cache data area and the commit data area store the address corresponding to the data; and calling and executing the intelligent contracts in each layer of the multi-layer intelligent contract stack layer by layer according to the mode until all the intelligent contracts are successfully called and executed, so as to realize the atomicity of the multi-layer intelligent contract stack and greatly save time and resource expenses.
Further, according to the application, after the second intelligent contract is called and executed successfully, the address of the commit data area in the second transaction container is replaced with the address of the cache data area in the second transaction container, and the cache data area becomes a new commit data area in the second transaction container; updating the cache data area in the first transaction container according to the new submitted data area of the second transaction container to become a new cache data area; when the first intelligent contract is successfully executed, replacing the address of the submission data area in the first transaction container with the address of the new cache data area in the first transaction container, wherein the new cache data area becomes the new submission data area in the first transaction container; and regressing the multi-level intelligent contract stack layer by layer according to the mode until the first intelligent contract is successfully executed, and regressing the call stack layer by layer to finish all atomicity. When all the transaction containers are successfully executed, only simple replacement of data area addresses is needed to complete atomicity submission. If one of the intelligent contracts fails to be executed, all the transaction containers corresponding to the intelligent contracts which are successfully executed are discarded, and the initial state of the data before the first intelligent contract is executed is returned, so that the method is simple and quick, and can ensure that rollback is successful.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 illustrates a block diagram of an exemplary computer system/server 12 suitable for use in implementing embodiments of the present application;
FIG. 2 illustrates a flow diagram of a method of implementing atomicity for a multi-level intelligent contract stack, in accordance with an aspect of the subject application;
FIG. 3 illustrates a diagram of implementing the atomicity of a multi-level intelligent contract stack, in accordance with a preferred embodiment of the present application;
FIG. 4 is a diagram illustrating the atomicity of an implementation of a multi-level intelligent contract stack, according to another preferred embodiment of the present application;
FIG. 5 is a diagram illustrating the atomicity of an implementation of a multi-level intelligent contract stack, according to yet another preferred embodiment of the present application;
FIG. 6 is a schematic diagram illustrating a batch execution of multiple transactions in accordance with a preferred embodiment of the present application;
FIG. 7 is a schematic diagram illustrating a batch execution of multiple transactions in accordance with another preferred embodiment of the present application;
FIG. 8 is a schematic diagram illustrating a batch execution of multiple transactions in accordance with yet another preferred embodiment of the present application;
FIG. 9 illustrates a schematic diagram of an apparatus that implements atomicity for a multi-level intelligent contract stack, in accordance with another aspect of the subject application.
The same or similar reference numbers in the drawings identify the same or similar elements.
Detailed Description
Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations as a sequential process, many of the operations can be performed in parallel, concurrently, or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
The term "computer device" or "computer" in this context refers to an intelligent electronic device that can execute predetermined processes such as numerical calculation and/or logic calculation by running predetermined programs or instructions, and may include a processor and a memory, wherein the processor executes a pre-stored instruction stored in the memory to execute the predetermined processes, or the predetermined processes are executed by hardware such as ASIC, FPGA, DSP, or a combination thereof. Computer devices include, but are not limited to, servers, personal computers, laptops, tablets, smart phones, and the like.
The computer equipment comprises user equipment and network equipment. Wherein the user equipment includes but is not limited to computers, smart phones, PDAs, etc.; the network device includes, but is not limited to, a single network server, a server group consisting of a plurality of network servers, or a Cloud Computing (Cloud Computing) based Cloud consisting of a large number of computers or network servers, wherein Cloud Computing is one of distributed Computing, a super virtual computer consisting of a collection of loosely coupled computers. The computer equipment can be independently operated to realize the application, and can also be accessed into a network to realize the application through the interactive operation with other computer equipment in the network. The network in which the computer device is located includes, but is not limited to, the internet, a wide area network, a metropolitan area network, a local area network, a VPN network, and the like.
It should be noted that the user equipment, the network device, the network, etc. are only examples, and other existing or future computer devices or networks may also be included in the scope of the present application, if applicable, and are included by reference.
The methods discussed below, some of which are illustrated by flow diagrams, may be implemented by hardware, software, firmware, middleware, microcode, hardware description languages, or any combination thereof. When implemented in software, firmware, middleware or microcode, the program code or code segments to perform the necessary tasks may be stored in a machine or computer readable medium such as a storage medium. The processor(s) may perform the necessary tasks.
Specific structural and functional details disclosed herein are merely representative and are provided for purposes of describing example embodiments of the present application. This application may, however, be embodied in many alternate forms and should not be construed as limited to only the embodiments set forth herein.
It will be understood that, although the terms first, second, etc. may be used herein to describe various elements, these elements should not be limited by these terms. These terms are only used to distinguish one element from another. For example, a first element may be termed a second element, and, similarly, a second element may be termed a first element, without departing from the scope of example embodiments. As used herein, the term "and/or" includes any and all combinations of one or more of the associated listed items.
It will be understood that when an element is referred to as being "connected" or "coupled" to another element, it can be directly connected or coupled to the other element or intervening elements may be present. In contrast, when an element is referred to as being "directly connected" or "directly coupled" to another element, there are no intervening elements present. Other words used to describe the relationship between elements (e.g., "between" versus "directly between", "adjacent" versus "directly adjacent to", etc.) should be interpreted in a similar manner.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of example embodiments. As used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It will be further understood that the terms "comprises" and/or "comprising," when used herein, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be noted that, in some alternative implementations, the functions/acts noted may occur out of the order noted in the figures. For example, two figures shown in succession may, in fact, be executed substantially concurrently, or the figures may sometimes be executed in the reverse order, depending upon the functionality/acts involved.
The present application is described in further detail below with reference to the attached figures.
FIG. 1 illustrates a block diagram of an exemplary computer system/server 12 suitable for use in implementing embodiments of the present application. The computer system/server 12 shown in FIG. 1 is only one example and should not be taken to limit the scope of use or the functionality of embodiments of the present application.
As shown in FIG. 1, computer system/server 12 is in the form of a general purpose computing device. The components of computer system/server 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Computer system/server 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer system/server 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory 32. The computer system/server 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 1, and commonly referred to as a "hard drive"). Although not shown in FIG. 1, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the application.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally perform the functions and/or methodologies of the embodiments described herein.
The computer system/server 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with the computer system/server 12, and/or with any devices (e.g., network card, modem, etc.) that enable the computer system/server 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the computer system/server 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN) and/or a public network, such as the Internet) via the network adapter 20. As shown, network adapter 20 communicates with the other modules of computer system/server 12 via bus 18. It should be appreciated that although not shown in FIG. 1, other hardware and/or software modules may be used in conjunction with the computer system/server 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the memory 28.
For example, the memory 28 stores therein computer programs for performing the functions and processes of the present application, and the atomicity of the multi-level intelligent contract stack in the block chain is realized when the processing unit 16 executes the corresponding computer programs.
The specific means/steps of implementing the atomicity of the multi-level intelligent contract stack in a blockchain of the present application will be described in detail below.
FIG. 2 illustrates a schematic diagram of implementing atomicity for a multi-level intelligent contract stack, according to an aspect of the subject application. The method comprises the following steps:
s201: in the execution process of a first intelligent contract of a previous layer of a multi-layer intelligent contract stack, sequentially calling and executing at least one second intelligent contract associated with the first intelligent contract in a next layer according to a calling sequence;
s202: in each calling execution process, creating a corresponding second transaction container for the second intelligent contract, and saving an address of a cache data area in a first transaction container corresponding to the first intelligent contract as an address of a commit data area in the second transaction container, wherein each transaction container comprises the address of the cache data area and the address of the commit data area, and the cache data area and the commit data area store the address corresponding to the data;
s203: and calling and executing the intelligent contracts in each layer of the multi-layer intelligent contract stack layer by layer according to the mode in the step S201 and the step S202 until all the intelligent contracts are called and executed successfully so as to realize the atomicity of the multi-layer intelligent contract stack.
In a blockchain system, a situation of multi-level intelligent contract joint debugging may occur, for example, an intelligent contract a needs to call an executing intelligent contract B in the executing process, the intelligent contract B needs to call an executing intelligent contract C in the executing process, and so on. A more complex situation, for example, an intelligent contract a needs to call an executing intelligent contract B in the executing process, the intelligent contract B needs to call an executing intelligent contract C and an intelligent contract D in the executing process respectively, and the intelligent contract C and the intelligent contract D have other intelligent contracts which need to be called and executed in sequence in the executing process, so that a multi-level intelligent contract stack is formed. In the calling execution process of the multi-level intelligent contract stack, the execution of each level of intelligent contract needs to ensure atomicity, and the execution of each intelligent contract is a part of the atomicity of the last called intelligent contract to form the atomic call stack of the multi-level intelligent contract. Due to the complex execution model, it presents a great challenge to transactional execution.
Here, atomicity of a transaction means that a program included in the transaction is a logical work unit of a database, and the data modification operation performed by the program is either completely performed or not performed at all. This property is called atomicity. The atomicity of a transaction requires that if a transaction is considered a program, it is either completely executed, or is completely executed, i.e., the sequence of manipulations of the transaction is either applied to the database completely or does not affect the database at all.
If the user completes the updates to the database within a transaction, all updates must be visible to the outside world, or none at all. The former is the transaction committed and the latter is the transaction undo (or aborted). A DBMS (database management system) must ensure that all manipulations done by successfully committed transactions are fully reflected within the database, while failed transactions have no impact at all on the database.
To better illustrate the present embodiment, the intelligent contract at the first level is referred to as intelligent contract a, the corresponding transaction container thereof is referred to as transaction container a, the intelligent contract at the second level is referred to as intelligent contract B, the corresponding transaction container thereof is referred to as transaction container B, the intelligent contract at the third level is referred to as intelligent contract C, the corresponding transaction container thereof is referred to as transaction container C, the intelligent contract at the fourth level is referred to as intelligent contract D, and the corresponding transaction container thereof is referred to as transaction container D. Of course, there may be other numbers of intelligent contracts in actual use, and this application is not so limited and is incorporated by reference herein.
Specifically, the intelligent contract B is called and executed in the execution process of the intelligent contract A, and a corresponding transaction container B is created for the intelligent contract B; then, the address of the cache data area in the transaction container A corresponding to the intelligent contract A is saved as the address of the commit data area in the transaction container B, that is, the commit data area of the transaction container B and the cache data area of the transaction container A are the same; then, executing the intelligent contract B, calling and executing the intelligent contract C in the executing process of the intelligent contract B, and creating a corresponding transaction container C for the intelligent contract C; saving the address of the cache data area in the transaction container B as the address of the commit data area in the transaction container C, namely the commit data area of the transaction container C and the cache data area of the transaction container B are the same; then, calling an executing intelligent contract D in the executing process of the intelligent contract C, and creating a corresponding transaction container D for the intelligent contract D; and saving the address of the cache data area in the transaction container C as the address of the commit data area in the transaction container D, namely the commit data area of the transaction container D and the cache data area of the transaction container C are the same.
In the execution process of a first intelligent contract at a previous layer of a multi-layer intelligent contract stack, sequentially calling at least one second intelligent contract associated with the first intelligent contract in the next layer according to the calling sequence, and creating a corresponding second transaction container for the second intelligent contract; and in each calling process, saving the address of the cache data area in the first transaction container corresponding to the first intelligent contract as the address of the commit data area in the second transaction container.
In each call execution process, a transaction container is created for the intelligent contract to be called and executed, each transaction container includes an address of a cache data area and an address of a commit data area, that is, each transaction container corresponds to one cache data area and one commit data area, and each cache data area and each commit data area store addresses corresponding to data. And for the initial one, it itself has a corresponding transaction container.
A more complex embodiment may be shown in fig. 4, for example, as a multi-level intelligent contract stack shown in fig. 4, taking an intelligent contract B as a first intelligent contract of a previous layer, and then an intelligent contract C and an intelligent contract E are second intelligent contracts associated with the first intelligent contract B in a subsequent layer, and this embodiment sequentially calls and executes two intelligent contracts in the subsequent layer according to a call order, however, since the execution intelligent contract D needs to be called in the execution process of the intelligent contract C, a specific call situation of the multi-level intelligent contract stack shown in fig. 4 may be: calling and executing an intelligent contract B in the executing process of the intelligent contract A, and creating a corresponding transaction container B for the intelligent contract B; then, executing a part of the intelligent contract B, calling and executing the intelligent contract C in the executing process of the intelligent contract B, and creating a corresponding transaction container C for the intelligent contract C; then, calling an execution intelligent contract D in the execution process of the intelligent contract C, and creating a corresponding transaction container D for the intelligent contract D; when the intelligent contract D is successfully executed, the intelligent contract C contains the result of the atomic execution of the intelligent contract D, and the rest part of the intelligent contract C is continuously executed on the basis; similarly, the intelligent contract B continues to execute the rest part on the basis of the atomic execution result of the intelligent contract C, and when the intelligent contract B executes the rest part, the intelligent contract B needs to call the intelligent contract E to create a corresponding transaction container for the intelligent contract E; when the intelligent contract E is successfully executed, the intelligent contract B also contains the result of the atomic execution of the intelligent contract E, and the rest part of the intelligent contract B is continuously executed on the basis; finally, the intelligent contract A continues to execute the rest part on the basis of the atomic execution result of the intelligent contract B, thereby completing the execution of each intelligent contract in the multi-level intelligent contract stack. The intelligent contracts in each layer of the multi-layer intelligent contract stack are called and executed layer by layer in the mode until all the intelligent contracts are called and executed successfully, and the atomicity of the multi-layer intelligent contract stack is realized.
In this case, in the execution process of a first intelligent contract at a previous layer of a multi-level intelligent contract stack, this embodiment sequentially calls at least one second intelligent contract associated with the first intelligent contract in a subsequent layer in execution according to a call order, where when a plurality of second intelligent contracts associated with the first intelligent contract at the previous layer in the subsequent layer are included, the call order means that, in the plurality of second intelligent contracts, after a current second intelligent contract and an intelligent contract associated with each subsequent layer have been successfully called and executed, the subsequent second intelligent contract is called.
A more complex embodiment may be seen in fig. 5, which differs from fig. 4 in that, as shown in fig. 5 for a multi-level intelligent contract stack, two intelligent contracts, intelligent contract D and intelligent contract F, are associated at the next level of intelligent contract C. Calling an execution intelligent contract D in the execution process of the intelligent contract C, and creating a corresponding transaction container D for the intelligent contract D; when the intelligent contract D is successfully executed, the intelligent contract C contains the result of the atomic execution of the intelligent contract D, and the rest part of the intelligent contract C is continuously executed on the basis; when the intelligent contract C executes the rest part, the intelligent contract C also needs to call and execute an intelligent contract F, and a corresponding transaction container is established for the intelligent contract F; when the intelligent contract F is successfully executed, the intelligent contract C also contains the result of the atomic execution of the intelligent contract F, and the rest part of the intelligent contract C is continuously executed on the basis; similarly, the intelligent contract B continues to execute the remaining part on the basis of the atomic execution result of the intelligent contract C, and when the intelligent contract B executes the remaining part, the intelligent contract B needs to call the execution intelligent contract E to create a corresponding transaction container for the intelligent contract E; when the intelligent contract E is successfully executed, the intelligent contract B also contains the result of the atomic execution of the intelligent contract E, and the rest part of the intelligent contract B is continuously executed on the basis; finally, the intelligent contract A continues to execute the rest part on the basis of the atomic execution result of the intelligent contract B, thereby completing the calling execution of each intelligent contract in the multi-level intelligent contract stack.
It should be understood by those skilled in the art that the above structure of the multi-level intelligent contract stack is only an example and should not be considered as a limitation of the present application, and in practical applications, the multi-level intelligent contract stack may be in various structures, and a typical structure is, for example, a tree structure. Calling the intelligent contract associated with the intelligent contract in the next layer in the execution process according to the calling sequence in the execution process of the intelligent contract of each layer, creating a corresponding transaction container for the intelligent contract called to execute when calling is executed, and storing the address of a cache data area in the transaction container of the intelligent contract as a caller as the address of a commit data area in a second transaction container of the intelligent contract as the callee; and calling and executing the intelligent contracts in each layer of the multi-layer intelligent contract stack layer by layer in the mode until all the intelligent contracts are successfully called and executed so as to realize the atomicity of the multi-layer intelligent contract stack.
In a preferred embodiment, the first intelligent contract invoking execution of the second intelligent contract further comprises the steps of:
s204: when the second intelligent contract is called and successfully executed, replacing the address of the commit data area in the second transaction container with the address of the cache data area in the second transaction container, wherein the cache data area becomes a new commit data area in the second transaction container;
s205: updating the cache data area in the first transaction container according to the new submitted data area of the second transaction container to become a new cache data area;
s206: when the first intelligent contract is successfully executed, replacing the address of the submission data area in the first transaction container with the address of the new cache data area in the first transaction container, wherein the new cache data area becomes the new submission data area in the first transaction container;
wherein the step S203 further includes: and (4) regressing the multi-level intelligent contract stack layer by layer according to the modes in the step S204, the step S205 and the step S206 until the first intelligent contract is successfully executed.
Still taking the aforementioned block chain with intelligent contract a, intelligent contract B, intelligent contract C and intelligent contract D level four intelligent contract joint as an example, as shown in fig. 3, when the intelligent contract D is invoked to be executed successfully, in step S204, the address of the commit data area in the transaction container D is replaced with the address of the cache data area in the transaction container D, which becomes a new commit data area in the transaction container, which means that the cache data area of the transaction container C has been changed by the intelligent contract D, which already contains the result of the atomic execution of the intelligent contract D, and thereafter, the intelligent contract C continues to execute the rest of the intelligent contract C on the basis of containing the result of the atomic direct of the intelligent contract D; in step S205, the cache data area in the transaction container C is updated according to the new commit data area of the transaction container D, and becomes a new cache data area; in step S206, after the intelligent contract C is successfully executed, the address of the commit data area in the transaction container C is replaced with the address of the new cache data area in the transaction container C, and the new cache data area becomes the new commit data area in the transaction container C; and then, sequentially executing each intelligent contract according to the modes in the step S204, the step S205 and the step S206 until the intelligent contract A is successfully executed, and performing layer-by-layer regression on the call stack according to the steps until the intelligent contract A is successfully executed, so that all atomicity is completed.
The way of layer-by-layer regression call stack of the multi-level intelligent contract stack shown in fig. 4 and 5 is similar to the foregoing description, and therefore, the description is omitted here and is included herein by way of reference.
In a preferred embodiment, if one of the intelligent contracts in the multi-level intelligent contract stack is invoked and executed unsuccessfully, all transaction containers corresponding to the intelligent contracts that have been invoked and executed successfully are discarded, and the initial state of data before the initial intelligent contract is executed is returned.
Still taking the aforementioned block chain with the intelligent contract a, the intelligent contract B, the intelligent contract C, and the intelligent contract D in the four-level intelligent contract joint debugging as an example, in the process of executing or invoking the four-level intelligent contracts level by level, when any one of the intelligent contracts is invoked and executed unsuccessfully, the embodiment discards all the transaction containers corresponding to the intelligent contracts that have been invoked and executed successfully, and returns to the initial state of the data before the intelligent contract a is executed.
In a preferred embodiment, the multi-level intelligent contract stack belongs to one of the transactions to be executed in batches, wherein for the transactions to be executed in batches, the method comprises the following steps:
s207: recording all account addresses corresponding to the transactions to be executed in batches to a commit data area of a third transaction container corresponding to the transactions to be executed in batches, and copying the account addresses in the commit data area to a cache data area of the third transaction container;
s208: when the transactions to be executed in batch are executed in batch, executing one transaction, backing up account data related to the transaction to obtain a backup account, and writing modified data into the backup account;
s209: and replacing the address of the backup account with the address of the account corresponding to the transaction in the cache data area of the third transaction container.
Specifically, the scheme of the transaction container proposed in this embodiment transfers the transactional property of the batch operation to the processed data. Taking account transactions of blockchains as an example, whether the content of the transaction is to modify account permissions, transfer accounts, write logs or the like, the purpose to be achieved by the final transaction is to modify certain data in the accounts being transacted. Operations on the blockchain are collectively referred to herein as transactions. The transaction container consists of two data areas: a cache data area and a commit data area. Only the addresses of two data areas are recorded in the transaction container, instead of placing two data areas in the container. The addresses of the data items are recorded in the two data areas, but not the data itself. The data area is directly accessible by the data area address, and likewise, the data is directly accessible by the data address. This may provide more flexibility to the container, enabling it to also provide transactional for layered data and contract stacks.
For a transaction comprising a plurality of transactions to be executed in bulk, wherein a partial transaction may be a multi-level intelligent contract stack, and a partial transaction may be a normal transaction to be executed, as shown in fig. 6, wherein transactions 1 to 7 are transactions to be executed in bulk, transactions 1, 2, 4, 5 and 7 are normal transactions to be executed, and transactions 3 and 6 are multi-level intelligent contract stacks. The transactions 1, 2, 4, 5, and 7, the intelligent contracts a and O, and the intelligent contracts a and O, have a corresponding transaction container, which is referred to herein as a third transaction container, and the third transaction container also includes the address of the cache data area and the address of the commit data area, that is, the third transaction container has a corresponding cache data area and a commit data area, and the cache data area and the commit data area store the addresses corresponding to the data.
For the transactions to be executed in batches, such as the transactions 1, 2, 4, 5, and 7 shown in fig. 6, in step S207, this embodiment records all account addresses corresponding to the transactions to be executed in the commit data area of the third transaction container, for example, records all account addresses (non-accounts) related to a batch of transactions that need to be executed atomically in the commit data area, and simultaneously copies all account addresses in the commit data area to the cache data area of the third transaction container, so that the same account addresses are stored in the two data areas, namely, the commit data area and the cache data area, and point to the same account. Because the addresses of the accounts are copied instead of the accounts, time and resource expenses can be greatly saved.
In step S208, when the batch transaction is executed, when a certain transaction is executed, the account data related to the transaction is backed up, a backup account is obtained, and the modified data is written in the backup account instead of the original account.
In step S209, the address of the account corresponding to the transaction in the cache data area of the third transaction container is replaced with the address of the backup account.
In a preferred embodiment, if all the transactions to be executed in batch are successfully executed, the address of the commit data area of the third transaction container is replaced with the address of the cache data area of the third transaction container, the cache data area of the third transaction container becomes a new commit data area, and the original commit data area is discarded;
and if one transaction in the transactions to be executed in batch fails to be executed, giving up execution of the rest transactions, and discarding the cache data area of the third transaction container.
Specifically, after all the transactions to be executed in batch are successfully executed, the address of the commit data area is replaced with the address of the cache data area in the third transaction container, that is, the cache data area becomes a new commit data area, and the original commit data area can be directly discarded, so that a successful transactional commit is completed. When the next batch transaction needs to be executed atomically, a new cache data area is copied from the commit data area of the third transaction container, because the copied data are the addresses of the accounts, but not the accounts, the time and resource expenses can be greatly saved.
If any transaction fails to be executed in the transaction execution process, the execution of the rest transactions is abandoned, and the cache data area of the third transaction container is directly discarded.
The transaction container provided by the embodiment can complete atomicity submission only by simply replacing the data area address when all execution succeeds. When the execution fails, the rollback can be completed only by discarding the cache data area, so that the rollback method is simple and quick, and can ensure that the rollback is successful to a certain extent.
Those skilled in the art will appreciate that the multi-level intelligent contract stack shown in fig. 6 may also be a multi-level intelligent contract stack of other structures, such as the multi-level intelligent contract stacks shown in fig. 7 and 8, and that the transaction to be executed in batch shown in fig. 6 may also be a single intelligent contract, and the specific configuration of the transaction to be executed in batch is not limited in this application.
The process of executing multiple transactions in batches as shown in FIG. 7 is described in detail below in one embodiment.
Firstly, a transaction container a is created for the multiple transactions to be executed in batch, and the transaction container a includes an address addrCacheA of a cache data area and an address addrSubA of a commit data area, that is, the transaction container a corresponds to one cache data area CacheA and one commit data area SubA. Those skilled in the art should understand that the english acronyms in the embodiment are only used to better describe the embodiment and should not be construed as limiting the application.
Then, for each transaction, all account addresses involved in the transactions are recorded in the commit data area SubA of the transaction container a, for example, for fig. 7, for transactions 1, 2, 4, 5, and 7, and the intelligent contract a and the intelligent contract O, a common transaction container a is created, all account addresses involved in the transactions and the intelligent contract a and the intelligent contract O are recorded in the commit data area SubA of the transaction container a, and the account addresses in the commit data area SubA are copied to the cache data area CacheA, so that the same account addresses are stored in the two data areas, namely, the commit data area SubA and the cache data area CacheA, and point to the same account.
When the transaction 1 is executed, the account data corresponding to the transaction 1 is backed up to obtain a Backup account Backup1, and modified data is written in the Backup account Backup 1; the address addr Backup1 of the Backup account is used to replace the address of the corresponding account in the cache data area CacheA, that is, the account address related to the transaction 1 in the cache data area CacheA points to the Backup account Backup 1.
When transaction 2 is executed, similarly, the account data corresponding to the transaction 2 is backed up to obtain a Backup account Backup2, and modified data is written in the Backup account Backup 2; the address addr Backup2 of the Backup account is used to replace the address of the corresponding account in the cache data area CacheA, that is, the account address related to the transaction 2 in the cache data area CacheA points to the Backup account Backup 2.
When executing transaction 3, the transaction 3 is a multi-level intelligent contract stack, the intelligent contract a is executed first, an executing intelligent contract B needs to be called when executing the intelligent contract a, a corresponding transaction container B is created for the intelligent contract B, the transaction container B also includes an address addrCacheB of a cache data area and an address addrSubB of a commit data area, that is, the transaction container B corresponds to a cache data area CacheB and a commit data area SubB; and saving the address of the cache data area in the transaction container A corresponding to the intelligent contract A as the address of the commit data area in the transaction container B, namely, the address of the commit data area in the transaction container B is also addrCacheA, namely, the commit data area of the transaction container B and the cache data area of the transaction container A are the same and are both CacheA.
Then, executing a part of the intelligent contract B, calling and executing the intelligent contract C in the execution process of the intelligent contract B, and creating a corresponding transaction container C for the intelligent contract C, wherein the transaction container C also comprises an address addrCacheC of a cache data area and an address addrsubcc of a commit data area, namely, the transaction container C corresponds to one cache data area CacheC and one commit data area subcc; and saving the address of the cache data area in the transaction container B corresponding to the intelligent contract B as the address of the commit data area in the transaction container C.
Then, calling and executing the intelligent contract D in the execution process of the intelligent contract C, and creating a corresponding transaction container D for the intelligent contract D, where the transaction container D also includes an address addrCacheD of a cache data area and an address addrSubD of a commit data area, that is, the transaction container D corresponds to one cache data area CacheD and one commit data area SubD; and saving the address of the cache data area in the transaction container C corresponding to the intelligent contract C as the address of the commit data area in the transaction container D.
When the intelligent contract D is executed, the account data corresponding to the intelligent contract D is backed up to obtain a backup account backup D, and modified data is written in the backup account backup D; and replacing the address addrBackupD of the backup account with the address of the corresponding account in the cache data area CacheD. Each intelligent contract may also include a plurality of transactions that need to be executed atomically in bulk, and the data modified in each transaction needs to be backed up to facilitate rollback when a transaction fails to execute successfully.
When the intelligent contract D is completely executed successfully, replacing the address addrSubD of the commit data area in the transaction container D with the address addrCacheD of the cache data area in the transaction container D, wherein the cache data area CacheD becomes a new commit data area SubD in the transaction container D, which means that the cache data area CacheC of the transaction container C has been changed by the intelligent contract D and already contains the atomic execution result of the intelligent contract D, namely, the cache data area CacheC in the transaction container C is updated according to the new commit data area of the transaction container D and becomes a new cache data area; after that, the intelligent contract C continues to execute the rest of the intelligent contract C on the basis of the atomic direct result of the intelligent contract D.
Similarly, the intelligent contract B continues to execute the rest part on the basis of the atomic execution result of the intelligent contract C, and when the intelligent contract B executes the rest part, the intelligent contract B needs to call the intelligent contract E to create a corresponding transaction container E for the intelligent contract E; the transaction container E also includes an address addrCacheE of a cache data area and an address addrSubE of a commit data area, that is, the transaction container E corresponds to one cache data area CacheE and one commit data area SubE; and saving the address of the cache data area in the transaction container B corresponding to the intelligent contract B as the address of the commit data area in the transaction container E.
When the intelligent contract E is successfully executed, the intelligent contract B also contains the atomic execution result of the intelligent contract E, namely, the cache data area in the transaction container B is updated according to the new submitted data area of the transaction container E and becomes a new cache data area; on the basis of which the rest of the intelligent contract B continues to be executed.
Finally, the intelligent contract A continues to execute the rest part on the basis of containing the atomic execution result of the intelligent contract B, and the cache data area in the transaction container A is updated according to the new submitted data area of the transaction container B to become a new cache data area; thereby completing the call execution of each intelligent contract in the multi-level intelligent contract stack.
The subsequent transactions 4 to 7 are executed according to a similar process as described above, and when all transactions 1 to 7 are successfully executed, the address addrsucba of the commit data area in the transaction container a is replaced with the address addrCacheA of the cache data area, that is, the cache data area becomes a new commit data area SubA, the address addrBackupA of the backup account is stored in the new commit data area, and the original commit data area can be directly discarded.
If one of the transactions 1 to 7 fails to execute, the remaining transactions are abandoned, and the cache data area of the third transaction container is discarded.
FIG. 9 illustrates a schematic diagram of an apparatus that implements atomicity for a multi-level intelligent contract stack, in accordance with another aspect of the subject application.
The apparatus 1 comprises an executing means 901, a creating means 902 and a calling means 903.
The executing device 901 sequentially calls at least one second intelligent contract associated with a first intelligent contract in a next layer according to a calling sequence in the executing process of the first intelligent contract in the previous layer of the multi-layer intelligent contract stack;
the creating device 902 creates a corresponding second transaction container for the second intelligent contract in each call execution process, and saves an address of a cache data area in a first transaction container corresponding to the first intelligent contract as an address of a commit data area in the second transaction container, where each transaction container includes the address of the cache data area and the address of the commit data area, and the cache data area and the commit data area store addresses corresponding to data;
the invoking means 903 invokes the executing means 901 and the creating means 902 to invoke layer by layer to execute the intelligent contracts in each layer of the multi-layer intelligent contract stack until all the intelligent contracts are invoked and executed successfully to realize the atomicity of the multi-layer intelligent contract stack.
In a preferred embodiment, the executing apparatus 901 further includes:
first replacing means (not shown) for replacing the address of the commit data area in the second transaction container with the address of the cache data area in the second transaction container after the second intelligent contract is invoked and executed successfully, wherein the cache data area becomes a new commit data area in the second transaction container;
updating means (not shown) for updating the cache data area in the first transaction container to be a new cache data area according to the new commit data area of the second transaction container;
second replacing means (not shown) for replacing the address of the commit data area in the first transaction container with the address of the new cache data area in the first transaction container, which becomes the new commit data area in the first transaction container, after the first intelligent contract is successfully executed;
the calling device 903 calls the first replacing device, the updating device and the second replacing device to return the multi-level intelligent contract stack layer by layer until the first intelligent contract is successfully executed.
In a preferred embodiment, the multi-level intelligent contract stack belongs to one of the transactions to be executed in batches, wherein for the transaction to be executed in batches, the apparatus 1 further includes:
recording means (not shown) for recording all account addresses corresponding to the transactions to be executed in batches to a commit data area of a third transaction container corresponding to the transactions to be executed in batches, and copying the account addresses in the commit data area to a cache data area of the third transaction container;
a backup device (not shown) for executing one transaction when the transactions to be executed in batch are executed in batch, backing up account data related to the transaction, obtaining a backup account, and writing modified data in the backup account;
third replacing means (not shown) for replacing the address of the backup account with the account address corresponding to the transaction in the cache data area of the third transaction container.
In a preferred embodiment, the device 1 further comprises:
a fourth replacing device (not shown) configured to replace, if all the transactions to be executed in batch are successfully executed, the address of the commit data area of the third transaction container with the address of the cache data area of the third transaction container, where the cache data area of the third transaction container becomes a new commit data area, and discard the original commit data area;
and a second discarding device (not shown) configured to, if execution of a certain transaction fails in the transactions to be executed in batch, abandon execution of the remaining transactions, and discard the cache data area of the third transaction container.
The transaction container provided by the embodiment can complete atomicity submission only by simply replacing the data area address when all execution succeeds. When the execution fails, the rollback can be completed only by discarding the cache data area, so that the rollback method is simple and quick, and can ensure that the rollback is successful to a certain extent.
The software programs of the present application may be executed by a processor to perform the steps or functions described above. Likewise, the software programs (including associated data structures) of the present application may be stored in a computer readable recording medium, such as RAM memory, magnetic or optical drive or diskette and the like. Additionally, some of the steps or functionality of the present application may be implemented in hardware, for example, as circuitry that cooperates with the processor to perform various functions or steps.
In addition, some of the present application may be implemented as a computer program product, such as computer program instructions, which when executed by a computer, may invoke or provide methods and/or techniques in accordance with the present application through the operation of the computer. Program instructions which invoke the methods of the present application may be stored on a fixed or removable recording medium and/or transmitted via a data stream on a broadcast or other signal-bearing medium and/or stored within a working memory of a computer device operating in accordance with the program instructions. An embodiment according to the present application comprises an apparatus comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the apparatus to perform a method and/or a solution according to the aforementioned embodiments of the present application.
It will be evident to those skilled in the art that the present application is not limited to the details of the foregoing illustrative embodiments, and that the present application may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the application being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned. Furthermore, it is obvious that the word "comprising" does not exclude other elements or steps, and the singular does not exclude the plural. A plurality of units or means recited in the system claims may also be implemented by one unit or means in software or hardware. The terms first, second, etc. are used to denote names, but not any particular order.
Claims (6)
1. A method of implementing atomicity for a multi-level intelligent contract stack, wherein the method comprises the steps of:
a, in the execution process of a first intelligent contract at the previous layer of a multi-level intelligent contract stack, sequentially calling and executing at least one second intelligent contract associated with the first intelligent contract in the next layer according to a calling sequence;
b, in each calling execution process, creating a corresponding second transaction container for the second intelligent contract, and storing the address of a cache data area in a first transaction container corresponding to the first intelligent contract as the address of a commit data area in the second transaction container, wherein each transaction container comprises the address of the cache data area and the address of the commit data area, and the cache data area and the commit data area store the address corresponding to the data;
c, calling and executing the intelligent contracts in each layer of the multi-layer intelligent contract stack layer by layer according to the mode in the step a and the step b until all the intelligent contracts are successfully called and executed so as to realize the atomicity of the multi-layer intelligent contract stack, wherein if one intelligent contract in the multi-layer intelligent contract stack is unsuccessfully called and executed, all transaction containers corresponding to the intelligent contract which is successfully called and executed are discarded, and a data initial state before the first intelligent contract is executed is returned;
or, the multi-level intelligent contract stack belongs to one of the transactions to be executed in batches, and for the transactions to be executed in batches, the method further includes:
recording all account addresses corresponding to the transactions to be executed in batches to a commit data area of a third transaction container corresponding to the transactions to be executed in batches, and copying the account addresses in the commit data area to a cache data area of the third transaction container; when the transactions to be executed in batch are executed in batch, executing one transaction, backing up account data related to the transaction to obtain a backup account, and writing modified data into the backup account; replacing the address of the backup account with the address of the account corresponding to the transaction in the cache data area of the third transaction container;
if all the transactions to be executed in batch are successfully executed, replacing the address of the committed data area of the third transaction container with the address of the cache data area of the third transaction container, wherein the cache data area of the third transaction container becomes a new committed data area, and discarding the original committed data area; and if one transaction in the transactions to be executed in batch fails to be executed, giving up execution of the rest transactions, and discarding the cache data area of the third transaction container.
2. The method of claim 1, wherein the first intelligent contract invoking execution of the second intelligent contract further comprises:
x, after the second intelligent contract is called and successfully executed, replacing the address of the commit data area in the second transaction container with the address of the cache data area in the second transaction container, wherein the cache data area becomes a new commit data area in the second transaction container;
y the cache data area in the first transaction container is updated according to the new commit data area of the second transaction container to become a new cache data area;
z, after the first intelligent contract is successfully executed, replacing the address of the commit data area in the first transaction container with the address of the new cache data area in the first transaction container, wherein the new cache data area becomes the new commit data area in the first transaction container;
wherein, the step c of invoking and executing the multi-level intelligent contract stack layer by layer comprises:
and (4) regressing the multi-level intelligent contract stack layer by layer according to the modes in the step x, the step y and the step z until the first intelligent contract is successfully executed.
3. An apparatus for implementing atomicity for a multi-level intelligent contract stack, wherein the apparatus comprises:
the executing device is used for sequentially calling and executing at least one second intelligent contract related to a first intelligent contract in a later layer according to the calling sequence in the executing process of the first intelligent contract in the previous layer of the multi-layer intelligent contract stack;
a creating device, configured to create a corresponding second transaction container for the second intelligent contract in each call execution process, and store an address of a cache data area in a first transaction container corresponding to the first intelligent contract as an address of a commit data area in the second transaction container, where each transaction container includes the address of the cache data area and the address of the commit data area, and the cache data area and the commit data area store addresses corresponding to data;
calling means for calling the executing means and the creating means to execute the intelligent contracts in each layer of the multi-layer intelligent contract stack layer by layer until all the intelligent contracts are called and executed successfully, so as to implement atomicity of the multi-layer intelligent contract stack;
the first discarding device is used for discarding all transaction containers corresponding to the intelligent contracts which are successfully called and executed if one intelligent contract in the multi-level intelligent contract stack is failed to be called and executed, and returning to the initial state of data before the first intelligent contract is executed;
or, the multi-level intelligent contract stack belongs to one of the transactions to be executed in batches, and for the transactions to be executed in batches, the apparatus further includes:
the recording device is used for recording all account addresses corresponding to the transactions to be executed in batches to a commit data area of a third transaction container corresponding to the transactions to be executed in batches, and copying the account addresses in the commit data area to a cache data area of the third transaction container;
the backup device is used for executing one transaction when the transactions to be executed in batches are executed in batches, backing up the account data related to the transaction to obtain a backup account, and writing modified data into the backup account;
the third replacing device is used for replacing the address of the backup account with the account address corresponding to the transaction in the cache data area of the third transaction container;
a fourth replacing device, configured to replace, if all of the transactions to be executed in batch are successfully executed, the address of the commit data area of the third transaction container with the address of the cache data area of the third transaction container, where the cache data area of the third transaction container becomes a new commit data area, and the original commit data area is discarded;
and the second discarding device is used for giving up executing the rest transactions and discarding the cache data area of the third transaction container if one transaction in the transactions to be executed in batch fails to be executed.
4. The apparatus of claim 3, wherein the performing means further comprises:
a first replacing device, configured to replace, after the second intelligent contract is invoked and executed successfully, an address of a commit data area in the second transaction container with an address of a cache data area in the second transaction container, where the cache data area becomes a new commit data area in the second transaction container;
updating means for updating the cache data area in the first transaction container to a new cache data area according to the new commit data area of the second transaction container;
second replacing means for replacing an address of the commit data area in the first transaction container with an address of the new cache data area in the first transaction container after the first intelligent contract is successfully executed, the new cache data area becoming a new commit data area in the first transaction container;
wherein the calling device is configured to:
and calling the first replacing device, the updating device and the second replacing device to regress the multi-level intelligent contract stack layer by layer until the first intelligent contract is successfully executed.
5. A computer readable storage medium storing computer code which, when executed, performs the method of claim 1 or 2.
6. A computer device, the computer device comprising:
one or more processors;
a memory for storing one or more computer programs;
the one or more computer programs, when executed by the one or more processors, cause the one or more processors to implement the method of claim 1 or 2.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010233754.7A CN111429140B (en) | 2020-03-30 | 2020-03-30 | Method and device for realizing atomicity of multi-level intelligent contract stack |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010233754.7A CN111429140B (en) | 2020-03-30 | 2020-03-30 | Method and device for realizing atomicity of multi-level intelligent contract stack |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111429140A CN111429140A (en) | 2020-07-17 |
CN111429140B true CN111429140B (en) | 2021-01-12 |
Family
ID=71551607
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010233754.7A Active CN111429140B (en) | 2020-03-30 | 2020-03-30 | Method and device for realizing atomicity of multi-level intelligent contract stack |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111429140B (en) |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112700250B (en) * | 2021-01-08 | 2024-04-23 | 北京金山云网络技术有限公司 | Identity authentication method, device and system in financial scene |
CN113259478B (en) * | 2021-06-17 | 2021-11-02 | 支付宝(杭州)信息技术有限公司 | Method and device for executing transaction in blockchain system and blockchain system |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8782323B2 (en) * | 2009-10-30 | 2014-07-15 | International Business Machines Corporation | Data storage management using a distributed cache scheme |
CN109151031B (en) * | 2018-08-28 | 2022-08-26 | 北京奇虎科技有限公司 | Contract processing method and device based on block chain |
CN110933120A (en) * | 2018-09-19 | 2020-03-27 | 阿里巴巴集团控股有限公司 | Computing method, device and system based on hybrid cloud |
-
2020
- 2020-03-30 CN CN202010233754.7A patent/CN111429140B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN111429140A (en) | 2020-07-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US5923833A (en) | Restart and recovery of OMG-compliant transaction systems | |
US8544022B2 (en) | Transactional memory preemption mechanism | |
US9389905B2 (en) | System and method for supporting read-only optimization in a transactional middleware environment | |
US5151987A (en) | Recovery objects in an object oriented computing environment | |
US9798792B2 (en) | Replication for on-line hot-standby database | |
CN112860670B (en) | Data migration method, data migration device, electronic equipment and computer storage medium | |
US9229789B2 (en) | Transparent user mode scheduling on traditional threading systems | |
US20100217945A1 (en) | Fast context save in transactional memory | |
US8108880B2 (en) | Method and system for enabling state save and debug operations for co-routines in an event-driven environment | |
US9128881B2 (en) | Recovery for long running multithreaded processes | |
CN114925084A (en) | Distributed transaction processing method, system, device and readable storage medium | |
US20060184569A1 (en) | Data processing systems and methods | |
WO2023082537A1 (en) | Network operating system design method based on mimetic database | |
CN101154185A (en) | Software Runtime Execution Recovery and Replay Method | |
CN111429140B (en) | Method and device for realizing atomicity of multi-level intelligent contract stack | |
CN114253713B (en) | Asynchronous batch processing method and system based on reactor | |
CN110083488B (en) | GPGPU-oriented fine-grained low-overhead fault-tolerant system | |
US8688946B2 (en) | Selecting an auxiliary storage medium for writing data of real storage pages | |
CN101872299A (en) | Conflict prediction realization method and conflict prediction processing device transaction memory | |
CN1117166A (en) | Backtracking logic for dual-executor processors | |
US8738873B2 (en) | Interfacing with a point-in-time copy service architecture | |
US20140149697A1 (en) | Memory Pre-Allocation For Cleanup and Rollback Operations | |
CN112559496A (en) | Distributed database transaction atomicity realization method and device | |
CN112579298B (en) | Balanced control method and device for host coupling body | |
US20110126061A1 (en) | Comprehensive application programming interfaces for handling logical volume manager |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |