WO2023231342A1 - Procédé et appareil pour exécuter automatiquement un contrat sur la base d'un état variable - Google Patents

Procédé et appareil pour exécuter automatiquement un contrat sur la base d'un état variable Download PDF

Info

Publication number
WO2023231342A1
WO2023231342A1 PCT/CN2022/135342 CN2022135342W WO2023231342A1 WO 2023231342 A1 WO2023231342 A1 WO 2023231342A1 CN 2022135342 W CN2022135342 W CN 2022135342W WO 2023231342 A1 WO2023231342 A1 WO 2023231342A1
Authority
WO
WIPO (PCT)
Prior art keywords
callback
contract
variable
list
transaction
Prior art date
Application number
PCT/CN2022/135342
Other languages
English (en)
Chinese (zh)
Inventor
刘晓建
Original Assignee
蚂蚁区块链科技(上海)有限公司
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 蚂蚁区块链科技(上海)有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2023231342A1 publication Critical patent/WO2023231342A1/fr

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • G06F9/4484Executing subprograms
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4498Finite state machines
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/604Tools and structures for managing or administering access control systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6245Protecting personal data, e.g. for financial or medical purposes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/549Remote execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2141Access rights, e.g. capability lists, access control lists, access tables, access matrices
    • 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
    • G06Q10/00Administration; Management
    • G06Q10/10Office automation; Time management
    • G06Q10/107Computer-aided management of electronic mailing [e-mailing]
    • 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

Definitions

  • the embodiments of this specification belong to the field of blockchain technology, and particularly relate to a method and device for automatically executing a contract based on variable status.
  • Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • data blocks are combined into a chained data structure in a chronological manner and are cryptographically guaranteed to be an untamperable and unforgeable distributed ledger. Due to the characteristics of blockchain, such as decentralization, non-tamperable information, and autonomy, blockchain has also received more and more attention and applications.
  • the blockchain can be understood as a distributed state machine: all nodes start from the same creation state, sequentially run the transactions in the consensus block, and drive the status of each node to follow the same operation sequence (add, delete, modify) Continuously changing to achieve the same state of all nodes after executing transactions in the same numbered block, we call this state the world state.
  • the world state records various information, such as account balance, smart contract bytecode, customized data of each smart contract, chain configuration parameters, etc.
  • the world state represents the current state, that is, the current value of each recorded state data.
  • One or more embodiments of this specification describe a method and device for automatically executing a contract based on variable status.
  • a method for automatically executing a contract based on the state of a variable includes: determining that the state of the first variable of the target type has changed based on the execution result of the target transaction, wherein the above target transaction calls the first contract; Determine whether a callback list for the above-mentioned first variable is included in the contract state of the above-mentioned first contract, wherein the callback items in the above-mentioned callback list include callback contract information and callback parameters; in response to determining that a callback for the above-mentioned first variable is included list, execute the callback contract based on the callback parameters of the callback items in the above callback list.
  • a device for automatically executing a contract based on the state of a variable includes: a first determination unit configured to determine a change in the state of the first variable of the target type based on the execution result of the target transaction, wherein the above-mentioned The target transaction calls the first contract; the second determination unit is configured to determine whether the callback list for the above-mentioned first variable is included in the contract state of the above-mentioned first contract, wherein the callback items in the above-mentioned callback list include the information of the callback contract and callback parameters; the execution unit is configured to execute the callback contract based on the callback parameters of the callback items in the above-mentioned callback list in response to determining that the callback list contains the above-mentioned first variable.
  • a computer-readable storage medium is provided, with a computer program stored thereon.
  • the computer program When the above-mentioned computer program is executed in a computer, the computer is caused to perform the method described in any implementation manner in the first aspect.
  • a blockchain node including a memory and a processor, characterized in that executable code is stored in the memory, and when the processor executes the executable code, the implementation is as in the first aspect Either implementation describes the method.
  • the type of the variable that will affect the execution of the preset operation after the state changes can be declared as a target type, where the target type
  • the first variable can be defined through the first contract.
  • the node of the blockchain can first determine that the state of the first variable of the target type has changed based on the execution result of the target transaction, and then determine whether a callback list for the first variable is included in the contract state of the first contract.
  • Callback items include callback contract information and callback parameters.
  • the callback contract is executed based on the callback parameters of the callback item in the callback list, and the preset operation can be performed based on the callback contract, thus achieving timely perception of the target type in the world state.
  • the state change of the variable and automatically perform the preset operation based on the change of the state of the variable of the target type.
  • Figure 1 shows a blockchain architecture diagram in one embodiment
  • Figure 2 shows a schematic diagram of an application scenario in which embodiments of this specification can be applied
  • Figure 3 shows a schematic flowchart of a method for automatically executing a contract based on variable status according to one embodiment
  • Figure 4 shows a schematic flow chart of an example of registering a callback item for the first variable
  • Figure 5 shows a schematic flow chart of an example of a first variable logout callback item
  • Figure 6 shows a schematic block diagram of a device for automatically executing a contract based on variable states according to one embodiment.
  • FIG. 1 shows a blockchain architecture diagram in an embodiment.
  • the blockchain 100 includes, for example, 6 nodes.
  • the connections between nodes schematically represent P2P (Peer to Peer, point-to-point) connections.
  • P2P Peer to Peer, point-to-point
  • These nodes can store the entire ledger, that is, store the status of all blocks and all accounts.
  • each node in the blockchain can generate the same state in the blockchain by executing the same transaction, and each node in the blockchain can store the same state database.
  • FIG. 1 shows that the blockchain includes 6 nodes, the embodiments of this description are not limited to this, and may include other numbers of nodes.
  • the nodes included in the blockchain can meet Byzantine Fault Tolerance (BFT) requirements.
  • BFT Byzantine Fault Tolerance
  • the mentioned Byzantine fault tolerance requirements can be understood as meaning that Byzantine nodes can exist within the blockchain, but the blockchain does not reflect Byzantine behavior externally.
  • some Byzantine fault-tolerant algorithms require the number of nodes to be greater than 3f+1, where f is the number of Byzantine nodes, such as the Practical Byzantine Fault Tolerance algorithm PBFT (Practical Byzantine Fault Tolerance).
  • Transactions in the blockchain field can refer to task units that are executed and recorded in the blockchain. Transactions usually include sending fields (From), receiving fields (To) and data fields (Data). Among them, when the transaction is a transfer transaction, the From field represents the account address that initiated the transaction (that is, initiated a transfer task to another account), the To field represents the account address that received the transaction (that is, received the transfer), and the Data field Include transfer amount.
  • the From field indicates the account address that initiated the transaction
  • the To field indicates the account address of the contract called by the exchange
  • the Data field includes the function name in the calling contract and the corresponding Data such as the incoming parameters of the function are used to obtain the code of the function from the blockchain and execute the code of the function when the transaction is executed.
  • Smart contracts on the blockchain are contracts that can be triggered and executed by transactions on the blockchain system.
  • Smart contracts can be defined in the form of code. Calling a smart contract in Ethereum is to initiate a transaction pointing to the smart contract address, allowing each node in the Ethereum network to run the smart contract code in a distributed manner.
  • smart contracts can also be set by the system in the genesis block. This type of contract is generally called a creation contract.
  • some blockchain data structures, parameters, properties and methods can be set in the genesis contract.
  • accounts with system administrator rights can create system-level contracts or modify system-level contracts (referred to as system contracts). Among them, the system contract can be used to add data structures for different business data in the blockchain.
  • Bob sends a transaction containing information about creating a smart contract (i.e., deploying the contract) to the blockchain as shown in Figure 1.
  • the data field of the transaction includes the code of the contract to be created (such as bytecode or machine code), the to field of the transaction is empty to indicate that the transaction is used to deploy the contract.
  • the contract address "0x6f8ae93" of the contract is determined.
  • Each node adds the contract account corresponding to the contract address of the smart contract in the state database, allocates the state storage corresponding to the contract account, and stores The contract code is saved in the state storage of the contract, so the contract is created successfully.
  • each node in the blockchain can execute the transaction respectively, thereby executing the contract respectively, and update the status database based on the execution of the contract.
  • the data authorization adding function of the workflow contract corresponding to privacy computing also needs to check whether the required data access authorization has been obtained after adding authorization based on the transaction, and when the authorization meets the requirements Then, take the initiative as the workflow initiator to start the workflow contract during the execution of this transaction.
  • This solution requires writing the logic of automatically starting the workflow contract according to the authorization addition status into the contract body, which is not flexible enough and cannot cope with unexpected functional requirements during contract development.
  • the blockchain supports querying the authorization status obtained by the workflow contract through transactions.
  • the workflow initiator regularly calls the query interface externally. After determining that the workflow contract has obtained sufficient authorization, a transaction is sent to start the workflow.
  • This solution requires external polling to query the authorization status periodically through transactions, which lacks real-time performance and also causes high energy consumption in computing.
  • embodiments of this specification provide a method for automatically executing a contract based on the state of variables, thereby realizing timely perception of state changes of variables in the world state and automatically executing preset operations based on changes in variable state.
  • FIG. 2 shows a schematic diagram of an application scenario in which the embodiments of this specification can be applied.
  • This application scenario can be a scenario of privacy computing based on the blockchain.
  • the corresponding privacy calculation can be started. That is to say, the value of variable N1 used to represent the amount of authorized data will affect the execution of the corresponding operations of privacy calculation after change. Therefore, when defining variable N1 through contract C1, declare the type of variable N1 as the target type, and The information of variable N1 is stored in the contract state of contract C1. As an example, you could allow the user to query the state of a variable of a target type in the world state.
  • the node of the blockchain can receive the transaction Tx1 sent by the caller B to register the callback item.
  • the transaction Tx1 can call the contract C1.
  • the transaction Tx1 can include the variable name of the variable N1, the callback parameters of the callback contract and the information of the callback contract (such as , the contract address of the callback contract).
  • the callback contract can be used to determine whether the variable N1 at the current moment exceeds the preset quantity threshold.
  • the workflow contract used for privacy calculations is called to perform related privacy calculation operations.
  • the node of the blockchain can execute transaction Tx1 and add a callback item to the callback list preset for variable N1.
  • the callback item can include the information of the callback contract, the account of caller B and the callback parameters of the callback contract.
  • the callback list corresponding to variable N1 can be stored in the contract state of contract C1.
  • data owner A can send a target transaction for uploading authorization information to the node of the blockchain, and the target transaction can call contract C1.
  • the nodes of the blockchain can receive and execute the target transaction sent by the data owner A, and determine the change in the state of the target type variable N1 based on the execution result of the target transaction.
  • the node of the blockchain can determine whether the callback list for variable N1 is included in the contract status of contract C1.
  • the callback items in the callback list can include callback contract information and callback parameters. If the contract status of contract C1 includes a callback list for variable N1, the callback contract is executed based on the callback parameters of the callback items in the callback list.
  • the callback contract can determine whether the value of variable N1 at the current moment exceeds the preset quantity threshold. If it exceeds, the workflow contract used for privacy calculation will be called to perform related privacy calculation operations. This achieves timely perception of changes in variable N1, and automatically calls the workflow contract corresponding to privacy computing based on changes in the world state of variable N1 to perform privacy computing operations.
  • This method does not need to specify the actions that need to be performed after the world state of variable N1 changes in the contract body of the workflow contract corresponding to the privacy calculation. Instead, the caller B can customize it by registering a callback item, which is flexible. In addition, this method does not require external polling to query the value of variable N1 periodically through transactions, thus saving energy consumption.
  • FIG. 3 shows a schematic flowchart of a method for automatically executing a contract based on variable status according to one embodiment. It can be understood that this method can be performed by nodes of the blockchain, and the nodes of the blockchain can be implemented by any device, equipment, equipment cluster, etc. with computing and processing capabilities.
  • the method of automatically executing a contract based on variable status can include the following steps:
  • Step 301 Determine a change in the state of the first variable of the target type based on the execution result of the target transaction.
  • the node of the blockchain can receive and execute the target transaction sent by the user. After executing the target transaction, the node of the blockchain can determine the state of the first variable of the target type based on the execution result of the target transaction. changes happened. That is to say, the execution result of the target transaction will change the state of the first variable of the target type in the world state.
  • the first variable of the target type can be defined in advance through the first contract.
  • the type of the first variable can be declared as the target type, and the information of the first variable ( For example, variable values, variable names, attributes, etc.) are stored in the contract state of the first contract.
  • the above target transaction can call the first contract to change the variable value of the first variable recorded in the contract state of the first contract.
  • the user can register a callback item for the first variable in the callback list preset for the first variable, where the callback list for the first variable can be stored In the contract state of the first contract.
  • the user can be the caller who calls the callback contract.
  • the node of the blockchain can automatically execute the callback contract based on the state of the first variable in the current world state. For example, when it is determined that the state of the first variable in the contract state of the first contract changes after a transaction is executed, The callback items in the callback list pre-registered by the user for the first variable can be called.
  • Figure 4 shows a schematic flow chart of an example of registering a callback item for the first variable.
  • the callback item can be registered for the first variable in the following way:
  • the caller of the callback contract can send the first transaction for registering the callback item to the blockchain.
  • the first transaction may include the variable name of the first variable, information about the callback contract, and callback parameters of the callback contract.
  • the information of the callback contract can include the code of the callback contract, the address of the callback contract, etc.
  • the callback parameters can refer to the parameters used when calling the callback contract.
  • the caller can set the callback parameters of the callback contract according to actual business needs, and define the corresponding business logic in the callback contract, that is, define the operations to be performed corresponding to the state change of the first variable. For example, in the business scenario of privacy computing, assuming that the first variable is the amount of data access authorization in privacy computing, the callback contract can be used to determine whether the amount of data access authorization at the current moment exceeds the preset quantity threshold.
  • the preset workflow contract is called, which can be used to perform privacy calculation-related operations.
  • the contract address of the workflow contract corresponding to privacy calculation can be defined in the callback contract, as well as the business logic of the corresponding workflow contract that calls privacy calculation.
  • the business logic can be to call privacy when the amount of authorized data exceeds the preset value.
  • the calculated corresponding workflow contract can be defined in the callback contract.
  • the business logic can be that when the account balance is less than the preset value, a mailbox corresponding to the account will be sent. Automatically send emails with preset content.
  • the node of the blockchain can receive the first transaction sent by the caller for registering the callback item, and the first transaction can call the first contract.
  • the node of the blockchain can execute the first transaction and add a callback item to the callback list preset for the first variable.
  • the node of the blockchain can execute the first transaction, call the first contract, and add a callback item to the callback list preset for the first variable.
  • the callback item can include the information of the callback contract, the caller Account, callback parameters of the callback contract, etc.
  • the callback list for the first variable can be stored in the contract state of the first contract. It can be understood that when a caller registers a callback item for the first variable, the callback list will be set for the first variable. If no callback item is registered by the caller for the first variable, or the callback item registered for the first variable is then unregistered, the callback list does not need to be set for the first variable.
  • the caller can set a callback item for the first variable according to actual business needs, and define the operations to be performed for the state change of the first variable in the callback contract included in the callback item.
  • This method customizes the operation to be performed when the state of the first variable changes by registering a callback item without modifying other existing contracts related to the business, so it is flexible.
  • Figure 5 shows a schematic flow chart of an example of a first variable logout callback item.
  • the caller can also unregister the callback item registered for the first variable in the following way:
  • the caller of the callback contract can send a second transaction for canceling the callback item to the blockchain.
  • the second transaction may include the caller's account and the variable name of the first variable.
  • the node of the blockchain can receive the second transaction sent by the caller to cancel the callback item, and the second transaction can call the first contract.
  • the node of the blockchain can execute the second transaction and delete the callback item containing the caller's account from the callback list corresponding to the first variable.
  • the node of the blockchain can execute the second transaction to call the first contract, and delete the callback item containing the caller's account from the callback list corresponding to the first variable.
  • the node of the blockchain can search the callback list for the first variable in the contract state of the first contract based on the variable name of the first variable included in the second transaction, and then delete the callback list containing The callback item for the caller's account.
  • the caller can delete the callback items previously set for the first variable according to actual business needs, thereby realizing flexible setting of callback items.
  • Step 302 Determine whether the contract state of the first contract contains a callback list for the first variable.
  • the node of the blockchain can determine whether the callback list for the first variable is included in the contract state of the first contract.
  • the callback list can include callback items
  • the callback items can include callback contract information, callback parameters, etc.
  • Step 303 In response to determining that the callback list for the first variable is included, execute the callback contract based on the callback parameters of the callback items in the callback list.
  • the node of the blockchain determines that the contract state of the first contract contains a callback list for the first variable, the node of the blockchain can execute based on the callback parameters of the callback items in the callback list.
  • Callback contract the callback list for the first variable may include one or more callback items. For example, it may include one callback item registered by one caller, or may include multiple callback items registered by multiple callers.
  • executing the callback contract based on the callback parameters of the callback item in the callback list in step 303 can be performed as follows: after the target transaction is executed, based on the callback parameters of the callback item in the callback list, execute The callback contract corresponding to the callback contract information included in the callback item.
  • the callback contract corresponding to the callback item contained in the callback list of the first variable can be executed immediately after the execution of the target transaction is completed.
  • the above-mentioned target transaction may be a transaction in a target block
  • the target block may be a consensus block
  • the target block may include one or more transactions.
  • the callback contract can be executed as follows:
  • the nodes of the blockchain can determine whether the multiple transactions contained in the target block at the current moment have been completed.
  • variable name of the first variable can be added to the preset to-be-called list.
  • the callback item of the callback list of the corresponding variable is Determine the corresponding callback contract and callback parameters, and call the corresponding callback contract through the determined callback parameters.
  • the node of the blockchain can determine whether the multiple transactions in the target block at the current moment have been completed. If multiple transactions in the target block are not all executed, the variable name of the first variable can be added to the preset to-be-called list.
  • the to-be-called list can include one or more variables of the target type. variable name. If multiple transactions in the target block are executed, then after adding the variable name of the first variable to the to-be-called list, the corresponding callback contract can be executed based on the variable name of at least one variable included in the to-be-called list.
  • the node of the blockchain can query the callback list of the first variable from the contract status of the first contract based on the variable name of the first variable, and then determine the corresponding callback item from the callback list of the first variable. callback contract and callback parameters, and call the corresponding callback contract through the determined callback parameters.
  • the callback contract can be executed after multiple transactions in the target block have been executed, thereby increasing the flexibility of callback contract execution.
  • the nodes of the blockchain can also sort the callback items corresponding to the variable names contained in the to-be-called list.
  • the node of the blockchain can first obtain the callback items in the callback list of the variable corresponding to the variable name in the to-be-called list, and then sort the obtained call items in various ways, such as random ordering.
  • the nodes of the blockchain can execute each callback item in the order according to the sorting result. Specifically, for a certain callback item, the corresponding callback item can be called based on the callback parameter of the callback item. Callback contract.
  • the callback items in the callback list of the target type variable can also include the callback priority in addition to the callback contract information, callback parameters, etc.
  • the callback priority can be set by the caller when registering the callback item.
  • the caller can set the fee that it is willing to pay for executing the callback contract when registering the callback item. The higher the fee, the higher the priority.
  • the nodes of the blockchain can determine the priority of callback items based on the level of payment.
  • the above-mentioned sorting of the callback items corresponding to the variable names contained in the to-be-called list can be performed as follows: According to the callback priority of the callback items corresponding to each variable name in the to-be-called list, each variable name included in the to-be-called list is sorted The corresponding callback items are sorted. For example, you can sort callbacks from high to low priority. In this implementation, the execution order of the callback items corresponding to the variable names in the to-be-called list can be controlled based on the callback priority of the callback item.
  • the hash can be calculated based on the callback contract of the callback item corresponding to each variable name in the to-be-called list, the callback party account, and the block number of the target block where the target transaction is located. It can be understood that in practice, the information used to calculate the hash can also be determined according to actual needs, and is not limited to the use of callback contracts, callback party accounts and block numbers.
  • the hash can be calculated using the callback contract and the callback party account. For another example, you can also use the callback contract, the callback party account and the registration time of the callback item to calculate the hash and so on.
  • the callback items corresponding to the variable names contained in the to-be-called list are sorted. For example, you can sort the hash calculation results from large to small or from small to large.
  • the execution order of the callback items corresponding to the variable names in the to-be-called list can be determined based on hash calculation.
  • the type of the first variable that will affect the execution of the preset operation after the state changes can be declared as the target type, where the first variable of the target type can Defined by the first contract.
  • the node of the blockchain can first determine that the state of the first variable of the target type has changed based on the execution result of the target transaction, and then determine whether a callback list for the first variable is included in the contract state of the first contract.
  • Callback items include callback contract information and callback parameters.
  • the callback contract is executed based on the callback parameters of the callback item in the callback list, and the preset operation can be performed based on the callback contract, thus achieving timely perception of the target type in the world state.
  • the state change of the variable and automatically perform the preset operation based on the change of the state of the variable of the target type.
  • an apparatus for automatically executing a contract based on the state of a variable is provided.
  • the above-mentioned device for automatically executing contracts based on variable states can be deployed on the nodes of the blockchain.
  • the nodes of the blockchain can be implemented by any device, equipment, equipment cluster, etc. with computing and processing capabilities.
  • Figure 6 shows a schematic block diagram of a device for automatically executing a contract based on variable states according to one embodiment.
  • the device 600 for automatically executing a contract based on variable status includes: a first determination unit 601 configured to determine that the status of the first variable of the target type has changed based on the execution result of the target transaction, wherein the above target transaction calls The first contract; the second determination unit 602 is configured to determine whether the callback list for the above-mentioned first variable is included in the contract state of the above-mentioned first contract, wherein the callback items in the above-mentioned callback list include callback contract information and callback parameters. ;
  • the execution unit 603 is configured to execute the callback contract based on the callback parameters of the callback items in the above-mentioned callback list in response to determining that the callback list contains the above-mentioned first variable.
  • the above-mentioned device 600 further includes: a first receiving unit (not shown in the figure) configured to receive the first transaction sent by the caller for registering a callback item, the above-mentioned first transaction A transaction calls the above-mentioned first contract, wherein the above-mentioned first transaction includes the variable name of the above-mentioned first variable, the callback parameters of the callback contract, and the information of the callback contract; an adding unit (not shown in the figure) is configured to execute the above-mentioned first contract.
  • the above-mentioned callback item includes the above-mentioned callback contract information, the above-mentioned caller's account and the above-mentioned callback parameters.
  • the above-mentioned device 600 further includes: a second receiving unit (not shown in the figure) configured to receive the second transaction sent by the above-mentioned caller for canceling the callback item, the above-mentioned The second transaction calls the above-mentioned first contract, wherein the above-mentioned second transaction includes the variable name of the above-mentioned first variable; the deletion unit (not shown in the figure) is configured to execute the above-mentioned second transaction.
  • the callback items containing the above caller's account are deleted from the callback list.
  • the above-mentioned execution unit 603 is further configured to: after the execution of the above-mentioned target transaction is completed, execute the callback contract based on the callback parameters of the callback item in the above-mentioned callback list.
  • the above-mentioned target transaction is a transaction in the target block
  • the above-mentioned execution unit 603 includes: a variable name adding module (not shown in the figure) configured to respond to determining the current moment If the transaction contained in the above-mentioned target block has not been completed, the variable name of the above-mentioned first variable is added to the preset to-be-called list; the contract calling module (not shown in the figure) is configured to respond to determining the above-mentioned target at the current moment.
  • the corresponding callback is determined from the callback items of the callback list of the corresponding variable based on the variable name contained in the above-mentioned to-be-called list. contract and callback parameters, and call the corresponding callback contract through the determined callback parameters.
  • the above-mentioned device 600 further includes: a sorting module (not shown in the figure) configured to sort the callback items corresponding to the variable names included in the above-mentioned to-be-called list.
  • a sorting module (not shown in the figure) configured to sort the callback items corresponding to the variable names included in the above-mentioned to-be-called list.
  • the callback item also includes a callback priority
  • the above-mentioned sorting module is further configured to: according to the callback priority of the callback item corresponding to each variable name in the to-be-called list, the above-mentioned to-be-called The callback items corresponding to each variable name contained in the list are sorted.
  • the above-mentioned sorting module is further configured to: based on the callback contract of the callback item corresponding to each variable name in the to-be-called list, the callback party account, and the target block in which the target transaction is located. Block number, calculate the hash; according to the hash calculation result, sort the callback items corresponding to the variable names contained in the above to-be-called list.
  • the above-mentioned first variable is the data access authorization amount in privacy calculation
  • the above-mentioned callback contract is used to determine whether the data access authorization amount at the current moment exceeds a preset quantity threshold.
  • the preset workflow contract is called, where the above workflow contract is used to perform operations related to privacy calculations.
  • a computer-readable storage medium is also provided, on which a computer program is stored.
  • the computer is caused to execute the method described in FIG. 3 .
  • a blockchain node including a memory and a processor, characterized in that executable code is stored in the memory, and when the processor executes the executable code, Figure 3 is implemented. method described.
  • PLD Programmable Logic Device
  • FPGA Field Programmable Gate Array
  • HDL Hardware Description Language
  • HDL High-Speed Integrated Circuit Hardware Description Language
  • ABEL Advanced Boolean Expression Language
  • AHDL Altera Hardware Description Language
  • HDCal Joint CHDL
  • JHDL Java Hardware Description Language
  • Lava Lava
  • Lola MyHDL
  • PALASM RHDL
  • Verilog Verilog
  • the controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (eg, software or firmware) executable by the (micro)processor. , logic gates, switches, Application Specific Integrated Circuit (ASIC), programmable logic controllers and embedded microcontrollers.
  • controllers include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, For Microchip PIC18F26K20 and Silicone Labs C8051F320, the memory controller can also be implemented as part of the memory's control logic.
  • the controller in addition to implementing the controller in the form of pure computer-readable program code, the controller can be completely programmed with logic gates, switches, application-specific integrated circuits, programmable logic controllers and embedded logic by logically programming the method steps. Microcontroller, etc. to achieve the same function. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the means for implementing various functions can be considered as structures within hardware components as well as software modules implementing the methods.
  • the systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions.
  • a typical implementation device is a server system.
  • the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, or a personal digital assistant. , media player, navigation device, email device, game console, tablet, wearable device, or a combination of any of these devices.
  • the functions are divided into various modules and described separately.
  • the functions of each module can be implemented in the same or multiple software and/or hardware, or the modules that implement the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. .
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined or integrated. to another system, or some features can be ignored, or not implemented.
  • the coupling or direct coupling or communication connection between each other shown or discussed may be through some interfaces, and the indirect coupling or communication connection of the devices or units may be in electrical, mechanical or other forms.
  • These computer program instructions may also be stored in a computer-readable memory that causes a computer or other programmable data processing apparatus to operate in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction means, the instructions
  • the device implements the functions specified in a process or processes of the flowchart and/or a block or blocks of the block diagram.
  • These computer program instructions may also be loaded onto a computer or other programmable data processing device, causing a series of operating steps to be performed on the computer or other programmable device to produce computer-implemented processing, thereby executing on the computer or other programmable device.
  • Instructions provide steps for implementing the functions specified in a process or processes of a flowchart diagram and/or a block or blocks of a block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information.
  • Information may be computer-readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), and read-only memory.
  • PRAM phase change memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • RAM random access memory
  • read-only memory read-only memory
  • ROM read-only memory
  • EEPROM electrically erasable programmable read-only memory
  • flash memory or other memory technology
  • compact disc read-only memory CD-ROM
  • DVD digital versatile disc
  • Magnetic tape magnetic tape storage, graphene storage or other magnetic storage devices or any other non-transmission medium can be used to store information that can be accessed by a computing device.
  • computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment that combines software and hardware aspects. Furthermore, one or more embodiments of the present description may employ a computer program implemented on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein. Product form.
  • computer-usable storage media including, but not limited to, disk storage, CD-ROM, optical storage, etc.
  • program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types.
  • program modules may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

Les modes de réalisation de la présente invention concernent un procédé et un appareil pour exécuter automatiquement un contrat sur la base d'un état variable. Un mode de réalisation particulier du procédé consiste à : déterminer, en fonction d'un résultat d'exécution d'une transaction cible, que l'état d'une première variable d'un type cible est changé, la transaction cible faisant appel à un premier contrat ; déterminer si des états de contrat du premier contrat comprennent une liste de rappel pour la première variable, des éléments de rappel dans la liste de rappel impliquant des informations concernant un contrat de rappel, et des paramètres de rappel ; et en réponse à la détermination du fait que la liste de rappel pour la première variable est incluse, exécuter le contrat de rappel sur la base des paramètres de rappel, qui sont compris dans les éléments de rappel dans la liste de rappel.
PCT/CN2022/135342 2022-05-30 2022-11-30 Procédé et appareil pour exécuter automatiquement un contrat sur la base d'un état variable WO2023231342A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210600436.9A CN114968422A (zh) 2022-05-30 2022-05-30 基于变量状态自动执行合约的方法和装置
CN202210600436.9 2022-05-30

Publications (1)

Publication Number Publication Date
WO2023231342A1 true WO2023231342A1 (fr) 2023-12-07

Family

ID=82958417

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135342 WO2023231342A1 (fr) 2022-05-30 2022-11-30 Procédé et appareil pour exécuter automatiquement un contrat sur la base d'un état variable

Country Status (2)

Country Link
CN (1) CN114968422A (fr)
WO (1) WO2023231342A1 (fr)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114968422A (zh) * 2022-05-30 2022-08-30 蚂蚁区块链科技(上海)有限公司 基于变量状态自动执行合约的方法和装置

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180068359A1 (en) * 2016-08-04 2018-03-08 Elixsys Group LLC Systems and methods for using smart contracts to control the trade, supply, manufacture, and distribution of commodities
CN110929229A (zh) * 2019-11-26 2020-03-27 中国石油大学(华东) 一种基于区块链的office文档可信性验证方法及系统
CN112819621A (zh) * 2021-01-22 2021-05-18 支付宝(杭州)信息技术有限公司 一种智能合约资损测试方法及系统
CN114968422A (zh) * 2022-05-30 2022-08-30 蚂蚁区块链科技(上海)有限公司 基于变量状态自动执行合约的方法和装置

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180068359A1 (en) * 2016-08-04 2018-03-08 Elixsys Group LLC Systems and methods for using smart contracts to control the trade, supply, manufacture, and distribution of commodities
CN110929229A (zh) * 2019-11-26 2020-03-27 中国石油大学(华东) 一种基于区块链的office文档可信性验证方法及系统
CN112819621A (zh) * 2021-01-22 2021-05-18 支付宝(杭州)信息技术有限公司 一种智能合约资损测试方法及系统
CN114968422A (zh) * 2022-05-30 2022-08-30 蚂蚁区块链科技(上海)有限公司 基于变量状态自动执行合约的方法和装置

Also Published As

Publication number Publication date
CN114968422A (zh) 2022-08-30

Similar Documents

Publication Publication Date Title
JP6912583B2 (ja) サービス処理方法および装置
CA3048739C (fr) Procede et equipement de traitement de donnees bases sur une chaine de blocs
EP3547129A1 (fr) Procédé et dispositif de consensus de chaîne de blocs
JP2020512610A (ja) ブロックチェーンサービス受付けおよびコンセンサス方法およびデバイス
TWI694700B (zh) 資料處理方法和裝置、用戶端
TWI679581B (zh) 任務執行的方法及裝置
US20130007773A1 (en) Systems, methods, apparatuses, and computer program products for facilitating integration of third party technology with a database
CN114827165B (zh) 对多个交易进行分组的方法和区块链节点
TW201944314A (zh) 配置支付流程、執行支付流程的方法、裝置及設備
WO2023160083A1 (fr) Procédé d'exécution de transactions, blockchain, nœud maître et nœud esclave
TWI697223B (zh) 資料處理方法
JP2014528116A (ja) ポータブルコンピューティングデバイスにおける分散リソース管理
WO2023160085A1 (fr) Procédé d'exécution de transaction, chaîne de blocs, nœud maître et nœud esclave
WO2020199709A1 (fr) Procédé et système de rafraîchissement de mémoire cache en cascade, et dispositif
WO2023231342A1 (fr) Procédé et appareil pour exécuter automatiquement un contrat sur la base d'un état variable
WO2020119307A1 (fr) Procédé et appareil de planification de tâche basés sur un tns
WO2024051270A1 (fr) Procédé d'exécution de tâches, appareil, support de stockage et dispositif électronique
CN108427737A (zh) 一种数据清理方法、设备及计算机可读介质
WO2024001025A1 (fr) Procédé de nettoyage de données en mémoire cache de pré-exécution et nœud de chaîne de blocs
CN111459573B (zh) 一种智能合约执行环境的启动方法以及装置
WO2023240933A1 (fr) Procédé et appareil de déploiement d'application distribuée sur la base d'une chaîne de blocs
WO2024001032A1 (fr) Procédé d'exécution d'une transaction dans un système de chaîne de blocs, et système et nœuds de chaîne de blocs
WO2023185041A1 (fr) Procédé et appareil de traitement de données, dispositif électronique, et support de stockage
CN116032756A (zh) 基于区块链更新应用程序的配置信息的方法和区块链节点
TW202008153A (zh) 資料處理方法和裝置、伺服器

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22944643

Country of ref document: EP

Kind code of ref document: A1