CN111695991A - Contract processing method and device based on block, block chain node and storage medium - Google Patents

Contract processing method and device based on block, block chain node and storage medium Download PDF

Info

Publication number
CN111695991A
CN111695991A CN201910192618.5A CN201910192618A CN111695991A CN 111695991 A CN111695991 A CN 111695991A CN 201910192618 A CN201910192618 A CN 201910192618A CN 111695991 A CN111695991 A CN 111695991A
Authority
CN
China
Prior art keywords
contract
block
consensus
execution result
execution
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.)
Granted
Application number
CN201910192618.5A
Other languages
Chinese (zh)
Other versions
CN111695991B (en
Inventor
邵珠光
孙海波
张伟
黄海泉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Wodong Tianjun Information 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 Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Wodong Tianjun Information Technology Co Ltd
Priority to CN201910192618.5A priority Critical patent/CN111695991B/en
Publication of CN111695991A publication Critical patent/CN111695991A/en
Application granted granted Critical
Publication of CN111695991B publication Critical patent/CN111695991B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention provides a block-based contract processing method and device, a block link point and a storage medium. The method of the embodiment of the invention comprises the steps of adjusting the block structure, adding contract execution result information in a block header, acquiring a consensus contract when performing block packing operation, judging whether a current block meets the execution condition of the consensus contract, executing the consensus contract if the current block meets the execution condition of the consensus contract, and adding the execution result of the consensus contract into the block header of the current block to realize the block-level-based consensus contract, so that in the process of generating the block by packing, the corresponding block-level-based data processing can be completed through the execution of the consensus contract, the query result can be obtained by subsequently querying data in the latest block, all blocks do not need to be traversed, and the performance and the efficiency of a block chain node are not influenced.

Description

Contract processing method and device based on block, block chain node and storage medium
Technical Field
The embodiment of the invention relates to the technical field of block chains, in particular to a block-based contract processing method and device, a block link point and a storage medium.
Background
With the development of blockchain technology, the technology of the current blockchain is not only used for storing data, but also supports intelligent contracts (a programmable program) so that people can process the data through the intelligent contracts before the blockchain is actually stored.
The intelligent contract for the current blockchain is defined at the transaction level, i.e., the various programmatic processes that initiate the transaction. If data processing based on the block level is needed, all blocks need to be traversed to obtain information of each block, and then comprehensive data processing is carried out on the information of each block to obtain a processing result. For example, if all transaction totals that have expired for the current tile need to be reviewed, all tiles need to be traversed, transaction data in each tile is obtained, the number of transactions in each tile is calculated, and then summed.
However, since the transaction amount is very large and the number of blocks in the block chain is large, traversing all the blocks to read the information of each block will seriously affect the read-write performance of the node of the block chain and the processing efficiency of the data of the block chain nodes.
Disclosure of Invention
The embodiment of the invention provides a block-based contract processing method and device, block chain nodes and a storage medium, which are used for solving the problems that in the prior art, in the block-level-based data processing, due to the fact that the transaction quantity is very large and the number of blocks in a block chain is large, the information of each block is read by traversing all blocks, the read-write performance of the block chain nodes is seriously influenced, and the processing efficiency of the block chain node data is influenced.
One aspect of the embodiments of the present invention is to provide a block-based contract processing method, including:
acquiring a consensus contract when the block packing operation is executed;
judging whether the current block meets the execution condition of the consensus contract or not;
if the current block meets the execution condition of the consensus contract, executing the consensus contract to obtain an execution result;
adding an execution result of the consensus contract into a block header of the current block.
Another aspect of an embodiment of the present invention is to provide a contract processing apparatus for a block, including:
an actuator module to:
acquiring a consensus contract when the block packing operation is executed;
judging whether the current block meets the execution condition of the consensus contract or not;
if the current block meets the execution condition of the consensus contract, executing the consensus contract to obtain an execution result;
adding an execution result of the consensus contract into a block header of the current block.
It is another aspect of an embodiment of the present invention to provide a block link point, including:
a memory, a processor, and a computer program stored on the memory and executable on the processor,
the processor implements the block-based contract processing method when running the computer program.
It is another aspect of the embodiments of the present invention to provide a computer-readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the block-based contract processing method described above.
The block-based contract processing method and device, the block link points and the storage medium provided by the embodiment of the invention can adjust the block structure, adding contract execution result information in the block header, acquiring a consensus contract when performing block packing operation, judging whether the current block meets the execution condition of the consensus contract, if the current block meets the execution condition of the consensus contract, executing the consensus contract, adding the execution result of the consensus contract into the block header of the current block, realizing the consensus contract based on the block level, therefore, in the process of generating the blocks in a packaging mode, the corresponding data processing based on the block hierarchy can be completed through the execution of the consensus contract, the query result can be obtained only by querying the data in the latest block, all the blocks do not need to be traversed, and the performance and the efficiency of the block chain nodes cannot be affected.
Drawings
FIG. 1 is a flowchart of a block-based contract processing method according to an embodiment of the present invention;
fig. 2 is a schematic diagram of a block head structure according to an embodiment of the present invention;
FIG. 3 is a flowchart of a second block-based contract processing method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a block-based contract processing apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of a blockchain node according to a fifth embodiment of the present invention.
With the above figures, certain embodiments of the invention have been illustrated and described in more detail below. The drawings and written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with embodiments of the invention. Rather, they are merely examples of apparatus and methods consistent with certain aspects of embodiments of the invention, as detailed in the following claims.
The terms "first", "second", etc. referred to in the embodiments of the present invention are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. In the description of the following examples, "plurality" means two or more unless specifically limited otherwise.
The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
Example one
FIG. 1 is a flowchart of a block-based contract processing method according to an embodiment of the present invention; fig. 2 is a schematic block head structure according to an embodiment of the invention. The embodiment of the invention provides a block-based contract processing method aiming at the problems that in the prior art, when the transaction quantity is very large and the quantity of blocks in a block chain is large, the information of each block is read by traversing all the blocks, the reading and writing performance of the nodes of the block chain is seriously influenced, and the processing efficiency of the data of the nodes of the block chain is influenced.
The method in this embodiment is applied to a node, typically a common node, in a block link node for performing a block packing operation. In other embodiments, the method may also be applied to other devices, and the embodiment takes the consensus node as an example for schematic illustration.
As shown in fig. 1, the method comprises the following specific steps:
step S101, acquiring a consensus contract when the block packing operation is executed.
Wherein, the consensus contract refers to an intelligent contract passing through a consensus block layer.
In this embodiment, a developer may develop and generate a consensus contract by processing data of a block level that needs to be executed. For example, the consensus contract may perform the function of calculating the total number of all transactions that have been up to the current block; when the current block is generated, the total transaction amount of all transactions ending at the current block can be obtained only by summing the transaction total amount recorded in the previous block and the transaction amount of the current block, and the process is simple and quick without traversing all blocks.
When the consensus contract is executed by the consensus node, the function of data processing of the block level corresponding to the consensus contract can be realized, and the execution result is the processing result of the data processing of the corresponding block level.
The consensus node acquires one or more consensus contracts which are already known when the block packaging operation is executed. If there are multiple consensus contracts, the following steps S102-S104 are performed for each consensus contract, respectively, each consensus contract is executed to obtain an execution result, and the execution result is added to the block header of the current block.
In addition, if the block hash value in the block structure is a hash value of the entire block, it is necessary to complete the processing of executing the consensus contract and adding the execution result to the block header of the current block before calculating the block hash value.
Step S102, judging whether the current block meets the execution condition of the consensus contract.
Before each consensus contract is executed, the consensus node first judges whether the current block meets the execution condition of the consensus contract.
For each consensus contract, if the current block meets the execution condition of the consensus contract, the steps S103-S104 are performed. If the current block does not meet the execution condition of the consensus contract, the consensus contract does not need to be executed.
Step S103, if the current block meets the execution condition of the consensus contract, executing the consensus contract.
And step S104, adding the execution result of the consensus contract into the block header of the current block.
In this embodiment, the block structure is adjusted, and contract execution result information is added to the block header. The contract execution result information includes at least: contract identification information and execution results.
The contract identification information is used for uniquely identifying a consensus contract, has uniqueness, can be used as a unique identifier of the consensus contract, and can also be used for uniquely identifying an execution result of the consensus contract. The contract identification information may be any information that can be used to uniquely identify a consensus contract, and the embodiment is not specifically limited herein. For example, the contract identification information may include a contract name and/or contract version information.
In addition, the execution results of different consensus contracts can have different structures, and the structures corresponding to the execution results can be determined through contract identification information. The execution result of the consensus contract may be a result set, and the specific structure of the execution result may be set by a technician according to the function and the need of the consensus contract, which is not specifically limited herein.
Further, the contract execution result information in the block header of the block structure may include the execution results of zero, one, or more consensus contracts.
For example, the structure of the adjusted block header is as shown in fig. 2, and the block header may include original attribute information of the block header and contract execution result information of the consensus contract. The block header shown in fig. 2 includes contract execution result information corresponding to 3 consensus contracts, and the block header includes a formula contract result set formed by execution results of a plurality of consensus contracts. The contract execution result information includes contract identification information combined by the contract name and the contract version number, and an execution result.
In fig. 2, the contract execution result information is schematically illustrated as being preceded by other attribute information of the block header, and the position of the contract execution result information is not particularly limited.
The embodiment of the invention adjusts the block structure, adds the contract execution result information in the block head, acquires the consensus contract when performing the block packing operation, judges whether the current block meets the execution condition of the consensus contract, executes the consensus contract if the current block meets the execution condition of the consensus contract, and adds the execution result of the consensus contract into the block head of the current block to realize the block-level-based consensus contract, so that the block-level-based data processing can be completed through the execution of the consensus contract in the process of packing and generating the block, the query result can be obtained by subsequently querying the data in the latest block, all blocks do not need to be traversed, and the performance and the efficiency of the block chain node are not influenced.
Example two
Fig. 3 is a flowchart of a block-based contract processing method according to a second embodiment of the present invention. On the basis of the first embodiment, in this embodiment, when performing the block packing operation, acquiring the consensus contract includes: when the block packing operation is executed, the loaded consensus contract is obtained. Correspondingly, when the block packing operation is executed, before the obtaining of the consensus contract, the method further comprises the following steps: analyzing the new consensus contract after consensus and judging whether the new consensus contract has grammar errors or not; and if the new consensus contract has no grammar error, loading the new consensus contract.
As shown in fig. 3, the method comprises the following specific steps:
step S201, parsing the new consensus contract after consensus, and determining whether the new consensus contract has a syntax error.
Wherein, the consensus contract refers to an intelligent contract passing through a consensus block layer.
In this embodiment, a developer may develop and generate a consensus contract by processing data of a block level that needs to be executed. For example, the consensus contract may perform the function of calculating the total number of all transactions that have been up to the current block; when the current block is generated, the total transaction amount of all transactions ending at the current block can be obtained only by summing the transaction total amount recorded in the previous block and the transaction amount of the current block, and the process is simple and quick without traversing all blocks.
In this embodiment, the consensus node may complete the function of block-based contract processing through the following four program modules: the system comprises an adapter module, a resolver module, a loader module and an actuator module.
The adapter module is used for exposing the variable or interface of the blockchain, so that the corresponding variable or interface can be provided for developers to use. For example: at least the following variables or interfaces may be provided: $ blockHeight $ current chunk height, $ { blockHash } current chunk Hash value (chunk Hash), $ { txCount } current chunk transaction number, etc.
The common agreement is essentially a program code for realizing corresponding functions, and the analyzer module is used for analyzing and compiling the code of the common agreement provided by a developer to ensure that the common agreement has no syntax errors.
Specifically, the new consensus contract that is identified is analyzed to determine whether the new consensus contract has a syntax error. If the new consensus contract has a grammatical error, the consensus contract will not be loaded.
Optionally, before parsing the new consensus contract that is identified, a new consensus contract may be obtained; and carrying out consensus processing on the new consensus contract according to a consensus algorithm to obtain a consensus contract.
In particular, the new consensus contract may be a consensus contract submitted by an open staff. The consensus is performed by all consensus nodes while performing the block packing operation after the consensus is achieved by all consensus nodes.
The consensus algorithm may be set by a technician according to actual needs, and the embodiment is not specifically limited herein. The process of performing consensus processing on the new consensus contract according to the consensus algorithm is consistent with the existing consensus processing, and is not described herein again in this embodiment.
In addition, the consensus contract is developed by developers, the patent does not limit the development language, but the contract itself includes but is not limited to the following parts: contract identification information, contract execution conditions, and contract execution programs. The contract execution program may call a variable or interface of the blockchain.
And step S202, if the new consensus contract has no grammar error, loading the new consensus contract.
And on the basis that the consensus contract has no error, the loader module is used for loading the parsed consensus contract to the loader module.
Step S203, when the block packing operation is performed, the loaded consensus contract is obtained.
When the consensus contract is executed by the consensus node, the function of data processing of the block level corresponding to the consensus contract can be realized, and the execution result is the processing result of the data processing of the corresponding block level.
The consensus node obtains the loaded one or more consensus contracts from the loader module when performing the block packing operation.
If a plurality of consensus contracts are acquired, each consensus contract is respectively used as a target contract, and the following steps S203-S206 are performed on the target contract, so that all the loaded consensus contracts are traversed.
In addition, if the block hash value in the block structure is a hash value of the entire block, it is necessary to complete the processing of executing the consensus contract and adding the execution result to the block header of the current block before calculating the block hash value.
Step S204, judging whether the current block meets the execution condition of the consensus contract.
One of the main functions of the actuator module is: and judging whether the current block meets the execution condition of the consensus contract.
Before each consensus contract is executed, a contract execution condition interface is called first to judge whether the current block meets the execution condition of the consensus contract. And if the current block is determined to meet the execution condition of the consensus contract, calling a contract execution interface to execute the consensus contract. And if the current block is determined not to meet the execution condition of the consensus contract, not executing the consensus contract.
Step S205, if the current block meets the execution condition of the consensus contract, executing the consensus contract.
Another major function of the actuator module is: and when the current block is determined to meet the execution condition of the consensus contract, executing the consensus contract, and adding the execution result to the block header of the current block.
Step S206, add the execution result of the consensus contract to the block header of the current block.
In this embodiment, the block structure is adjusted, and contract execution result information is added to the block header. The contract execution result information includes at least: contract identification information and execution results.
The contract identification information is used for uniquely identifying a consensus contract, has uniqueness, can be used as a unique identifier of the consensus contract, and can also be used for uniquely identifying an execution result of the consensus contract. The contract identification information may be any information that can be used to uniquely identify a consensus contract, and the embodiment is not specifically limited herein. For example, the contract identification information may include a contract name and/or contract version information.
In addition, the execution results of different consensus contracts can have different structures, and the structures corresponding to the execution results can be determined through contract identification information. The execution result of the consensus contract may be a result set, and the specific structure of the execution result may be set by a technician according to the function and the need of the consensus contract, which is not specifically limited herein.
Further, the contract execution result information in the block header of the block structure may include the execution results of zero, one, or more consensus contracts.
For example, the structure of the adjusted block header is as shown in fig. 2, and the block header may include original attribute information of the block header and contract execution result information of the consensus contract. The block header shown in fig. 2 includes contract execution result information corresponding to 3 consensus contracts, and the block header includes a formula contract result set formed by execution results of a plurality of consensus contracts. The contract execution result information includes contract identification information combined by the contract name and the contract version number, and an execution result.
In fig. 2, the contract execution result information is schematically illustrated as being preceded by other attribute information of the block header, and the position of the contract execution result information is not particularly limited.
In this step, the execution result is written in the contract execution result information of the block header of the current block, so that the execution result can be written in a specified position (position where the contract execution result information is located) of the block header.
The embodiment of the invention adjusts the block structure, adds the contract execution result information in the block head, acquires the consensus contract when executing the block packing operation, judges whether the current block meets the execution condition of the consensus contract, if the current block meets the execution condition of the consensus contract, executes the consensus contract, adds the execution result of the consensus contract into the block head of the current block, realizes the consensus contract based on the block hierarchy, thereby completing the corresponding data processing based on the block hierarchy by executing the consensus contract in the process of packing and generating the block, obtaining the query result by subsequently querying the data in the latest block without traversing all the blocks and influencing the performance and efficiency of the block chain node; and the consensus contract can realize smooth upgrading, different data processing based on the block hierarchy can be realized by upgrading the consensus contract, and the repeated adjustment of the block structure is not needed.
EXAMPLE III
The third embodiment of the invention provides a block-based contract processing device. The block-based contract processing device provided by the embodiment of the invention can execute the processing flow provided by the block-based contract processing method embodiment. In this embodiment, the block-based contract processing apparatus includes an executor module.
Specifically, the actuator module is configured to:
acquiring a consensus contract when the block packing operation is executed; judging whether the current block meets the execution condition of the consensus contract or not; if the current block meets the execution condition of the consensus contract, executing the consensus contract to obtain an execution result; adding the execution result of the consensus contract into the block header of the current block.
The apparatus provided in the embodiment of the present invention may be specifically configured to execute the method embodiment provided in the first embodiment, and specific functions are not described herein again.
The embodiment of the invention adjusts the block structure, adds the contract execution result information in the block head, acquires the consensus contract when performing the block packing operation, judges whether the current block meets the execution condition of the consensus contract, executes the consensus contract if the current block meets the execution condition of the consensus contract, and adds the execution result of the consensus contract into the block head of the current block to realize the block-level-based consensus contract, so that the block-level-based data processing can be completed through the execution of the consensus contract in the process of packing and generating the block, the query result can be obtained by subsequently querying the data in the latest block, all blocks do not need to be traversed, and the performance and the efficiency of the block chain node are not influenced.
Example four
Fig. 4 is a schematic structural diagram of a block-based contract processing apparatus according to a fourth embodiment of the present invention. On the basis of the third embodiment, in this embodiment, in the block structure of the block chain, the block header includes contract execution result information, and the contract execution result information at least includes: contract identification information and execution results.
Wherein, the contract execution result information in the block header of the block structure comprises the execution results of zero, one or a plurality of consensus contracts.
Optionally, the actuator module is further configured to:
and writing the execution result into the contract execution result information of the block header of the current block.
Optionally, the actuator module is further configured to:
when the block packing operation is executed, the loaded consensus contract is obtained.
Alternatively, as shown in fig. 4, the block-based contract processing apparatus 30 may include: an executor module 301, a loader module 302, and an parser module 303.
The parser module 303 is used to: and analyzing the new consensus contract after consensus to judge whether the new consensus contract has grammar errors.
The loader module 302 is to: and if the new consensus contract has no grammar error, loading the new consensus contract.
Optionally, as shown in fig. 4, the block-based contract processing apparatus 30 may further include: a consensus module 304.
The consensus module 304 is configured to:
acquiring a new consensus contract; and carrying out consensus processing on the new consensus contract according to a consensus algorithm.
The apparatus provided in the embodiment of the present invention may be specifically configured to execute the method embodiment provided in the second embodiment, and specific functions are not described herein again.
The embodiment of the invention adjusts the block structure, adds the contract execution result information in the block head, acquires the consensus contract when executing the block packing operation, judges whether the current block meets the execution condition of the consensus contract, if the current block meets the execution condition of the consensus contract, executes the consensus contract, adds the execution result of the consensus contract into the block head of the current block, realizes the consensus contract based on the block hierarchy, thereby completing the corresponding data processing based on the block hierarchy by executing the consensus contract in the process of packing and generating the block, obtaining the query result by subsequently querying the data in the latest block without traversing all the blocks and influencing the performance and efficiency of the block chain node; and the consensus contract can realize smooth upgrading, different data processing based on the block hierarchy can be realized by upgrading the consensus contract, and the repeated adjustment of the block structure is not needed.
EXAMPLE five
Fig. 5 is a schematic structural diagram of a blockchain node according to a fifth embodiment of the present invention. As shown in fig. 5, the blockchain node 50 includes: a processor 501, a memory 502, and computer programs stored on the memory 502 and executable by the processor 501.
The processor 501, when executing a computer program stored on the memory 502, implements the block-based contract processing method provided by any of the above-described method embodiments.
The embodiment of the invention adjusts the block structure, adds the contract execution result information in the block head, acquires the consensus contract when performing the block packing operation, judges whether the current block meets the execution condition of the consensus contract, executes the consensus contract if the current block meets the execution condition of the consensus contract, and adds the execution result of the consensus contract into the block head of the current block to realize the block-level-based consensus contract, so that the block-level-based data processing can be completed through the execution of the consensus contract in the process of packing and generating the block, the query result can be obtained by subsequently querying the data in the latest block, all blocks do not need to be traversed, and the performance and the efficiency of the block chain node are not influenced.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method for processing a block-based contract according to any of the above-mentioned method embodiments is implemented.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
Other embodiments of the invention will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the invention and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the invention being indicated by the following claims.
It will be understood that the invention is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the invention is limited only by the appended claims.

Claims (16)

1. A method for block-based contract processing, comprising:
acquiring a consensus contract when the block packing operation is executed;
judging whether the current block meets the execution condition of the consensus contract or not;
if the current block meets the execution condition of the consensus contract, executing the consensus contract to obtain an execution result;
adding an execution result of the consensus contract into a block header of the current block.
2. The method according to claim 1, wherein in the block structure of the block chain, the block header includes contract execution result information, and the contract execution result information at least includes: contract identification information and execution results.
3. The method of claim 2, wherein the contract execution result information in a block header of the block structure comprises execution results of zero, one, or multiple consensus contracts.
4. The method of claim 2, wherein adding the execution result of the consensus contract to a block header of a current block comprises:
and writing the execution result into contract execution result information of the block head of the current block.
5. The method according to any one of claims 1-4, wherein the obtaining a consensus contract when performing a block packing operation comprises:
when the block packing operation is executed, the loaded consensus contract is obtained.
6. The method of claim 5, wherein before obtaining the consensus contract when performing the block packing operation, further comprising:
analyzing the new consensus contract after consensus and judging whether the new consensus contract has grammar errors or not;
and if the new consensus contract has no grammar error, loading the new consensus contract.
7. The method of claim 6, wherein before parsing the consensus new consensus contract to determine whether the new consensus contract has a syntax error, further comprising:
acquiring a new consensus contract;
and carrying out consensus processing on the new consensus contract according to a consensus algorithm.
8. A block-based contract processing apparatus, comprising:
an actuator module to:
acquiring a consensus contract when the block packing operation is executed;
judging whether the current block meets the execution condition of the consensus contract or not;
if the current block meets the execution condition of the consensus contract, executing the consensus contract to obtain an execution result;
adding an execution result of the consensus contract into a block header of the current block.
9. The apparatus according to claim 8, wherein in the block structure of the block chain, the block header includes contract execution result information, and the contract execution result information at least includes: contract identification information and execution results.
10. The apparatus of claim 9, wherein the contract execution result information in a block header of the block structure comprises execution results of zero, one, or multiple consensus contracts.
11. The apparatus of claim 9, wherein the actuator module is further configured to:
and writing the execution result into contract execution result information of the block head of the current block.
12. The apparatus of any of claims 8-11, wherein the actuator module is further configured to:
when the block packing operation is executed, the loaded consensus contract is obtained.
13. The apparatus of claim 12, wherein the apparatus further comprises: a loader module and a parser module,
the parser module is configured to: analyzing the new consensus contract after consensus and judging whether the new consensus contract has grammar errors or not;
the loader module is to: and if the new consensus contract has no grammar error, loading the new consensus contract.
14. The apparatus of claim 13, wherein the apparatus further comprises: a consensus module to:
acquiring a new consensus contract;
and carrying out consensus processing on the new consensus contract according to a consensus algorithm.
15. A block link point, comprising:
a memory, a processor, and a computer program stored on the memory and executable on the processor,
the processor, when executing the computer program, implements the method of any of claims 1-7.
16. A computer-readable storage medium, in which a computer program is stored,
the computer program, when executed by a processor, implementing the method of any one of claims 1-7.
CN201910192618.5A 2019-03-14 2019-03-14 Block-based contract processing method and device, block chain node and storage medium Active CN111695991B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910192618.5A CN111695991B (en) 2019-03-14 2019-03-14 Block-based contract processing method and device, block chain node and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910192618.5A CN111695991B (en) 2019-03-14 2019-03-14 Block-based contract processing method and device, block chain node and storage medium

Publications (2)

Publication Number Publication Date
CN111695991A true CN111695991A (en) 2020-09-22
CN111695991B CN111695991B (en) 2024-02-06

Family

ID=72474967

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910192618.5A Active CN111695991B (en) 2019-03-14 2019-03-14 Block-based contract processing method and device, block chain node and storage medium

Country Status (1)

Country Link
CN (1) CN111695991B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108365993A (en) * 2018-03-09 2018-08-03 深圳前海微众银行股份有限公司 Block chain link point dynamic altering method, system and computer readable storage medium
CN108595535A (en) * 2018-03-30 2018-09-28 李欣宇 Knowledge Q-A system and method based on the double-chain block chain of same root
CN108961052A (en) * 2018-06-25 2018-12-07 百度在线网络技术(北京)有限公司 Verification method, storage method, device, equipment and the medium of block chain data
CN108960797A (en) * 2018-07-18 2018-12-07 百度在线网络技术(北京)有限公司 Block generates and verification method, device, equipment and storage medium
CN109033814A (en) * 2018-07-18 2018-12-18 百度在线网络技术(北京)有限公司 intelligent contract triggering method, device, equipment and storage medium
WO2018236479A1 (en) * 2017-06-22 2018-12-27 Mastercard International Incorporated Method and system for indexing consumer enrollment using blockchain
CN109117097A (en) * 2018-09-05 2019-01-01 深圳正品创想科技有限公司 A kind of date storage method and system based on block chain
CN109241359A (en) * 2018-08-18 2019-01-18 深圳市网心科技有限公司 Block chain node device, block catenary system, block data processing system and method
CN109256813A (en) * 2018-11-28 2019-01-22 杨胜杰 A kind of distribution type electric energy stocking system and operation method based on block chain
CN109345388A (en) * 2018-09-20 2019-02-15 百度在线网络技术(北京)有限公司 Block chain intelligence contract verification method, device and storage medium
CN109395392A (en) * 2018-09-29 2019-03-01 杭州复杂美科技有限公司 Predict guessing game dispositions method and method for gaming, equipment and storage medium

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018236479A1 (en) * 2017-06-22 2018-12-27 Mastercard International Incorporated Method and system for indexing consumer enrollment using blockchain
CN108365993A (en) * 2018-03-09 2018-08-03 深圳前海微众银行股份有限公司 Block chain link point dynamic altering method, system and computer readable storage medium
CN108595535A (en) * 2018-03-30 2018-09-28 李欣宇 Knowledge Q-A system and method based on the double-chain block chain of same root
CN108961052A (en) * 2018-06-25 2018-12-07 百度在线网络技术(北京)有限公司 Verification method, storage method, device, equipment and the medium of block chain data
CN108960797A (en) * 2018-07-18 2018-12-07 百度在线网络技术(北京)有限公司 Block generates and verification method, device, equipment and storage medium
CN109033814A (en) * 2018-07-18 2018-12-18 百度在线网络技术(北京)有限公司 intelligent contract triggering method, device, equipment and storage medium
CN109241359A (en) * 2018-08-18 2019-01-18 深圳市网心科技有限公司 Block chain node device, block catenary system, block data processing system and method
CN109117097A (en) * 2018-09-05 2019-01-01 深圳正品创想科技有限公司 A kind of date storage method and system based on block chain
CN109345388A (en) * 2018-09-20 2019-02-15 百度在线网络技术(北京)有限公司 Block chain intelligence contract verification method, device and storage medium
CN109395392A (en) * 2018-09-29 2019-03-01 杭州复杂美科技有限公司 Predict guessing game dispositions method and method for gaming, equipment and storage medium
CN109256813A (en) * 2018-11-28 2019-01-22 杨胜杰 A kind of distribution type electric energy stocking system and operation method based on block chain

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘敖迪;杜学绘;王娜;李少卓;: "区块链技术及其在信息安全领域的研究进展", no. 07 *

Also Published As

Publication number Publication date
CN111695991B (en) 2024-02-06

Similar Documents

Publication Publication Date Title
US8479052B2 (en) Exposing application performance counters for .NET applications through code instrumentation
US8938729B2 (en) Two pass automated application instrumentation
JP2020510925A (en) Method and apparatus for performing a test using a test case
US9632916B2 (en) Method and apparatus to semantically connect independent build and test processes
CN110941528B (en) Log buried point setting method, device and system based on fault
WO2020155735A1 (en) Rule update method and apparatus for rule engine system, and computer device
CN106909510A (en) A kind of method and server for obtaining test case
CN111158741B (en) Method and device for monitoring dependency relationship change of service module on third party class library
CN109032631A (en) Application program service packs acquisition methods, device, computer equipment and storage medium
CN110968437A (en) Method, device, equipment and medium for parallel execution of single contract based on Java intelligent contract
CN103186463B (en) Determine the method and system of the test specification of software
CN111679852B (en) Detection method and device for conflict dependency library
CN111240987A (en) Migration program detection method and device, electronic equipment and computer readable storage medium
CN111695991B (en) Block-based contract processing method and device, block chain node and storage medium
US9396239B2 (en) Compiling method, storage medium and compiling apparatus
CN114706586A (en) Code compiling method, code running method, code compiling device, code running device, computer equipment and storage medium
US11100131B2 (en) Simulation of a synchronization of records
US9369352B1 (en) Method of capturing server and operating system metrics for virtual to physical topology reporting
Habibi et al. Generating test as a web service (TaaWS) through a method-based attribute grammar
Algestam et al. Using components to increase maintainability in a large telecommunication system
CN112860284B (en) SP upgrade package generation method and device for equipment remote upgrade and computer equipment
KR101737575B1 (en) Method and device for verifying data based on sql sentences generated automatically
CN116775040B (en) Pile inserting method for realizing code vaccine and application testing method based on code vaccine
CN109308256A (en) A kind of java dynamically analyzing of program method, equipment and storage medium
CN107632934B (en) Function copying method and device in C-sharp

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