WO2022252995A1 - Procédé et appareil de déploiement de contrat intelligent - Google Patents

Procédé et appareil de déploiement de contrat intelligent Download PDF

Info

Publication number
WO2022252995A1
WO2022252995A1 PCT/CN2022/093802 CN2022093802W WO2022252995A1 WO 2022252995 A1 WO2022252995 A1 WO 2022252995A1 CN 2022093802 W CN2022093802 W CN 2022093802W WO 2022252995 A1 WO2022252995 A1 WO 2022252995A1
Authority
WO
WIPO (PCT)
Prior art keywords
task
blockchain
node
code
contract
Prior art date
Application number
PCT/CN2022/093802
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 WO2022252995A1 publication Critical patent/WO2022252995A1/fr

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • the embodiment of this specification relates to the field of blockchain technology, and in particular to a method and device for smart contract deployment.
  • Blockchain technology is built on top of transmission networks such as peer-to-peer networks.
  • Nodes in the blockchain network use chained data structures to verify and store data, and use distributed node consensus algorithms to generate and update data.
  • some nodes sometimes need to implement small-scale transactions to prevent other nodes from obtaining these transactions and their related data. Therefore, a blockchain subnet can be further established on the basis of the blockchain main network.
  • Smart contracts corresponding to specific businesses can be deployed in the blockchain main network or blockchain subnet.
  • the contract code of smart contracts is usually written by users or technicians through manual programming. Therefore, the standardization of smart contract codes is low, which is not conducive to the generation and execution of smart contracts, and limits the deployment and execution efficiency of smart contracts. .
  • one or more embodiments of this specification provide a smart contract deployment method and device.
  • a smart contract deployment method including: obtaining the task code generated by using the workflow description language to describe the workflow; Compile the task code to generate a contract code representing the workflow; send a blockchain transaction for deploying the contract code to the blockchain network to deploy the corresponding task code in the blockchain network
  • the smart contract is used to assign tasks to be executed to the node members participating in the blockchain network according to the business logic defined by each task node in the workflow when called.
  • a smart contract deployment method is proposed, which is applied to the blockchain nodes in the blockchain network, including: responding to the received blockchain deployment contract code transaction, deploying the corresponding smart contract in the blockchain network; the contract code is generated by compiling the task code by the compiler, and the task code is generated by describing the workflow in the workflow description language; in response to The received block chain transaction calling the smart contract assigns tasks to be executed to the node members participating in the block chain network according to the business logic defined by each task node in the workflow.
  • a smart contract deployment device including: a code acquisition unit that acquires the task code generated by describing the workflow using a workflow description language; a code compilation unit , so that the task code is compiled by the compiler to generate the contract code used to represent the workflow; the transaction deployment unit is used to send the blockchain transaction used to deploy the contract code to the blockchain network to Deploy the corresponding smart contract in the blockchain network, and the smart contract is used to report to the node members participating in the blockchain network according to the business logic defined by each task node in the workflow when called Assign pending tasks.
  • a smart contract deployment device which is applied to a blockchain node in a blockchain network, including: a contract deployment unit that responds to the received deployment contract The blockchain transaction of the code, deploy the corresponding smart contract in the blockchain network; the contract code is generated by compiling the task code by the compiler, and the task code describes the workflow by the workflow description language and generate; the contract invoking unit responds to the block chain transaction of calling the smart contract received, according to the business logic defined by each task node in the workflow, to the node members participating in the block chain network Assign pending tasks.
  • an electronic device including: a processor; a memory for storing processor-executable instructions; wherein, the processor executes the executable instructions To realize the method described in the first aspect or the second aspect.
  • a computer-readable storage medium on which computer instructions are stored, and when the instructions are executed by a processor, the method described in the first aspect or the second aspect is implemented. A step of.
  • Fig. 1 is a schematic diagram of creating a smart contract provided by an exemplary embodiment.
  • Fig. 2 is a schematic diagram of invoking a smart contract provided by an exemplary embodiment.
  • Fig. 3 is a schematic diagram of creating and invoking a smart contract provided by an exemplary embodiment.
  • Fig. 4 is a schematic diagram of building a blockchain subnet based on the blockchain main network provided by an exemplary embodiment.
  • Fig. 5 is a flowchart of a smart contract deployment method provided by an exemplary embodiment.
  • Fig. 6 is a flowchart of another smart contract deployment method provided by an exemplary embodiment.
  • Fig. 7 is a flowchart of another smart contract deployment method provided by an exemplary embodiment.
  • Fig. 8 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • Fig. 9 is a block diagram of a smart contract deployment device provided by an exemplary embodiment.
  • Fig. 10 is a block diagram of another smart contract deployment device provided by an exemplary embodiment.
  • the steps of the corresponding methods are not necessarily performed in the order shown and described in this specification.
  • the method may include more or less steps than those described in this specification.
  • a single step described in this specification may be decomposed into multiple steps for description in other embodiments; multiple steps described in this specification may also be combined into a single step in other embodiments describe.
  • Blockchains are generally divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain.
  • the public chain has the highest degree of decentralization.
  • the public chain is represented by Bitcoin and Ethereum. Participants who join the public chain can read the data records on the chain, participate in transactions, and compete for the bookkeeping rights of new blocks. Moreover, each participant (ie node) can freely join and exit the network and perform related operations.
  • the private chain the write permission of the network is controlled by an organization or institution, and the data read permission is regulated by the organization.
  • the private chain can be a weakly centralized system with strict restrictions and few participating nodes.
  • the alliance chain is a blockchain between the public chain and the private chain, which can realize "partial decentralization".
  • Each node in the consortium chain usually has a corresponding entity or organization; participants join the network through authorization and form an alliance of stakeholders to jointly maintain the operation of the blockchain.
  • Smart contracts on the blockchain are contracts that can be triggered by transactions on the blockchain system. Smart contracts can be defined in the form of code.
  • EVM Ethereum Virtual Machine
  • bytecode virtual machine code
  • the EVM of node 1 can execute the transaction and generate a corresponding contract instance.
  • "0x6f8ae93" in Figure 1 represents the address of this contract, the data field of the transaction can store bytecode, and the to field of the transaction is empty.
  • the contract is successfully created and can be called in the subsequent process.
  • a contract account corresponding to the smart contract appears on the blockchain and has a specific address, and the contract code will be saved in the contract account.
  • the behavior of smart contracts is controlled by the contract code.
  • the smart contract makes a virtual account containing contract code and account storage (Storage) generated on the blockchain.
  • the EVM of a certain node can execute this transaction and generate a corresponding contract instance.
  • the from field of the transaction in Figure 2 is the address of the account of the transaction initiator (ie Bob), the "0x6f8ae93" in the to field represents the address of the called smart contract, and the value field is the value of Ethereum in Ethereum.
  • the method and parameters of calling the smart contract are saved in the data field of the transaction.
  • the value of balance may change.
  • a client can view the current value of balance through a certain blockchain node (such as node 6 in Figure 2).
  • Smart contracts are independently executed by each node in the blockchain network in a prescribed manner, and all execution records and data are stored on the blockchain, so when the transaction is completed, the blockchain will store data that cannot be tampered with and will not be tampered with. Lost transaction credentials.
  • FIG. 3 The schematic diagram of creating a smart contract and calling a smart contract is shown in Figure 3.
  • Calling a smart contract in Ethereum is to initiate a transaction pointing to the address of the smart contract, and the code of the smart contract is distributed and runs in the virtual machine of each node in the Ethereum network.
  • smart contracts can also be set by the system in the genesis block. This type of contract is generally called a genesis contract. Generally, some blockchain network data structures, parameters, properties and methods can be set in the genesis contract. In addition, accounts with system administrator privileges can create system-level contracts or modify system-level contracts (referred to as system contracts). In addition to the EVM in Ethereum, different blockchain networks may also use various virtual machines, which are not limited here.
  • Contract execution results can be expressed as events in receipts.
  • the message mechanism can implement message delivery through events in the receipt to trigger blockchain nodes to perform corresponding processing.
  • the structure of an event can be, for example:
  • Blockchain nodes can listen to the topic of the event to perform preset processing when listening to a predefined topic, or read relevant content from the data field of the corresponding event, and can execute preset based on the read content deal with.
  • the monitoring code can be embedded in the blockchain platform code running on the blockchain node, so that the monitoring code can monitor the transaction content of the blockchain transaction, the contract status of the smart contract, the receipt generated by the contract, etc. or multiple types of data, and send the monitored data to a predefined listener.
  • the monitoring code is deployed in the blockchain platform code instead of the listener's client, this implementation based on the monitoring code is relatively more active than the event mechanism.
  • the above monitoring code can be added to the blockchain platform code by the developers of the blockchain platform during the development process, or can be embedded by the monitoring party based on its own needs, which is not limited in this manual.
  • a consensus mechanism of transaction granularity can be implemented between blockchain nodes. For example, after a node (such as a unique node) obtains a blockchain transaction, if the blockchain transaction is recognized by other nodes, Each node that approves the blockchain transaction can add the blockchain transaction to the latest block maintained by itself, and finally can ensure that each node generates the same latest block.
  • the consensus mechanism is a mechanism for blockchain nodes to reach a consensus on block information (or block data) in the entire network, which can ensure that the latest block is accurately added to the blockchain.
  • the current mainstream consensus mechanisms include: Proof of Work (POW), Proof of Stake (POS), Delegated Proof of Stake (DPOS), Practical Byzantine Fault Tolerance (PBFT) ) algorithm, HoneyBadgerBFT algorithm, etc.
  • all blockchain nodes in the blockchain network will maintain the same block data, which cannot meet the special needs of some nodes.
  • all consortium members that is, node members in the consortium
  • all consortium members can form a blockchain network, and all consortium members have corresponding blockchain nodes in the blockchain network, and can pass the corresponding zone Block chain nodes obtain all transactions and related data that occur on the block chain network.
  • there may be some alliance members who want to complete some transactions that require confidentiality. These alliance members hope that these transactions can be stored on the blockchain or take advantage of other advantages of blockchain technology, and can avoid other transactions. affiliate members see these transactions and related data.
  • the establishment method is similar to the above-mentioned blockchain network that includes all alliance members, but building a new blockchain network from scratch requires a lot of resources, and regardless of The establishment process of the blockchain network or the configuration process after completion is very time-consuming.
  • the needs among alliance members are often temporary or have a certain timeliness, so that the newly built blockchain network will soon lose the meaning of existence due to the disappearance of demand, thus further increasing the chain construction cost of the above-mentioned blockchain network .
  • the needs of alliance members often change, and the alliance members corresponding to each demand are often different. Therefore, whenever the alliance members change, it may be necessary to form a new blockchain network, resulting in resource and time constraints. A lot of waste.
  • the established blockchain network can be used as the blockchain main network, and a blockchain subnet can be formed on the basis of the blockchain main network.
  • the consortium members can build the required blockchain subnet based on their own needs while already participating in the blockchain main network. Since the blockchain subnet is established on the basis of the blockchain main network, the construction process of the blockchain subnet is compared to the completely independent establishment of a blockchain network, the resources consumed and the time required, etc. Both are greatly reduced, and the flexibility is extremely high.
  • each main network node in the blockchain main network obtains a transaction for establishing a blockchain subnet, and the transaction includes the configuration information of the blockchain subnet , the configuration information includes identity information of node members. Then, each main network node in the blockchain main network respectively executes the transaction; wherein, when the first main network node belongs to the node member indicated by the configuration information, the node device of the first main network node is deployed A genesis block containing the configuration information is generated based on the transaction and a first subnetwork node belonging to the blockchain subnetwork is started.
  • the transaction of establishing a blockchain subnet can be initiated by the administrator of the blockchain main network, that is, only the administrator is allowed to establish a blockchain subnet on the basis of the blockchain main network, and avoid opening the establishment authority of the blockchain subnet to Normal users to prevent security issues caused by this.
  • ordinary users of the blockchain main network can also be allowed to initiate the above-mentioned transaction of establishing a blockchain subnet to meet the networking needs of ordinary users, so that ordinary users can still initiate transactions when the administrator is inconvenient. It is possible to quickly form a blockchain subnet.
  • the blockchain main network is subnet0
  • the blockchain nodes contained in subnet0 are nodeA, nodeB, nodeC, nodeD, and nodeE.
  • nodeA, nodeB, nodeC and nodeD want to form a blockchain subnet: if nodeA is an administrator and only allows the administrator to initiate a transaction to form a blockchain subnet, then nodeA can initiate the above-mentioned transaction to form a blockchain subnet to subnet0; If nodeE is an administrator and only allows the administrator to initiate the transaction of establishing a blockchain subnet, then nodeA ⁇ nodeD needs to make a request to nodeE, so that nodeE initiates the above transaction of establishing a blockchain subnet to subnet0; if nodeE is an administrator but allows Ordinary users initiate a transaction to establish a blockchain subnet, then nodeA ⁇ nodeE can initiate the above transaction to subnet0 to establish a blockchain subnet.
  • the blockchain node that initiates the transaction to form a blockchain subnet does not necessarily participate in the established blockchain subnet.
  • nodeE can initiate the above-mentioned transaction of establishing a blockchain subnet to subnet0, and not necessarily nodeA ⁇ nodeD initiate the transaction of establishing a blockchain subnet.
  • a blockchain subnet When a blockchain subnet is established on the basis of the blockchain main network, it is easy to understand that there will be a logical hierarchical relationship between the blockchain subnet and the blockchain main network. For example, when building a blockchain subnet subnet1 on subnet0 shown in Figure 4, it can be considered that subnet0 is in the first layer, subnet1 is in the second layer, subnet0 is the parent network of subnet1, and subnet1 is the subnet of subnet0. And the blockchain subnet can also form a corresponding blockchain subnet. For example, another blockchain subnet subnet3 can be further established on the basis of subnet1 in Figure 4. At this time, it can be considered that the subnet is in the third layer, and subnet1 is the corresponding subnet3.
  • subnet3 is the subnet of subnet1, and subnet3 is the grandson of subnet0. Similarly, subnet3 can still build a new blockchain subnet based on it, so that this multi-level tree can be formed between blockchain networks
  • any blockchain network is managed by its corresponding parent network, that is, it is managed by the blockchain network that forms any blockchain network.
  • the network is managed by the blockchain network corresponding to its parent node, and as a special case, when the blockchain main network is the underlying blockchain network, the blockchain main network is managed by the blockchain main network itself.
  • the blockchain main network in this specification can be the underlying blockchain network.
  • the underlying blockchain network refers to a blockchain subnet that is not established on the basis of other blockchain networks. Therefore, in addition to the blockchain main network There is no other blockchain network that can manage the blockchain main network.
  • subnet0 in Figure 4 can be considered as the blockchain main network of the underlying blockchain network type, and subnet0 manages subnet0 itself.
  • the blockchain main network The network can also be a subnet of other blockchain networks, and this specification does not make any restrictions on this.
  • the above-mentioned blockchain network tree system realizes layer-by-layer management through the parent node management of corresponding child nodes, which reduces the management pressure of the blockchain main network and avoids exposing the subnet information of the upper network to the lower network. In order to realize the secret management of the network at all levels.
  • the consensus nodes in the blockchain main network will conduct a consensus, and after the consensus is passed, each main network node will execute the transaction to complete the block The formation of the chain subnet.
  • the consensus process depends on the adopted consensus mechanism, such as any consensus mechanism mentioned above, which is not limited in this description.
  • the configuration information can be used to configure the established blockchain subnet so that the established blockchain subnet meets the networking requirements. For example, by including the identity information of node members in the configuration information, it is possible to specify which blockchain nodes are included in the established blockchain subnet.
  • the identity information of the node members may include the public key of the node, or other information that can represent the identity of the node such as the node ID, which is not limited in this description.
  • each blockchain node has one or more sets of corresponding public-private key pairs.
  • the blockchain node holds the private key and the public key is public and uniquely corresponds to the private key. Therefore, it can be passed
  • the public key is used to represent the identity of the corresponding blockchain node. Therefore, for blockchain nodes that want to be node members of the blockchain subnet, the public keys of these blockchain nodes can be added to the above-mentioned transaction of forming the blockchain subnet as the identity information of the above-mentioned node members.
  • the first main network node may be a blockchain node on the blockchain main network that is a node member indicated by the configuration information.
  • the first subnet node needs to be generated by the node device used to deploy the first main network node, And the first subnet node becomes a node member in the blockchain subnet.
  • the first main network node and the first subnet node correspond to the same blockchain member, for example, in the alliance chain scenario, they correspond to the same alliance chain member, but the first main network node
  • the node belongs to the blockchain subnet, so that the blockchain members can participate in the transactions of the blockchain main network and the blockchain subnet respectively; and, since the blockchain main network and the blockchain subnet belong to two independent Blockchain network, so that the blocks generated by the first main network node and the blocks generated by the first subnet node are respectively stored in different storages on the node device (the storage used can be a database, for example), realizing the first
  • the storage used by the main network node and the first subnet node is isolated from each other, so the data generated by the blockchain subnet will only be synchronized among the node members of the blockchain subnet, so that only those who participate in the blockchain main
  • the blockchain members of the network cannot obtain the data generated on the blockchain subnet, which realizes the data isolation between the blockchain main network and the blockchain subnet, and satisfies the requirements
  • the first main network node and the first subnet node are logically divided blockchain nodes, and from the perspective of physical equipment, it is equivalent to deploying the first main network node and the first subnet node
  • the node devices participate in the blockchain main network and the blockchain subnet at the same time. Since the blockchain main network and the blockchain subnet are independent of each other, the identity systems of the two blockchain networks are also independent of each other, so even if the first main network node and the first subnet node can use exactly the same public key, the two should still be considered as different blockchain nodes. For example, in FIG.
  • nodeA in subnet0 is equivalent to the first main network node, and the node device deploying the nodeA generates nodeA1 belonging to subnet1, and the nodeA1 is equivalent to the first subnet node. It can be seen that since the identity systems are independent of each other, even if the public key used by the first subnet node is different from that of the first main network node, it will not affect the implementation of the scheme in this specification.
  • the node members of the blockchain subnet are not necessarily only part of the node members of the blockchain main network.
  • the node members of the blockchain subnet can be completely consistent with the node members of the blockchain main network.
  • all blockchain members can obtain the data on the blockchain main network and the blockchain subnet, but The data generated by the blockchain main network and the blockchain subnet can still be isolated from each other.
  • the two types of The business data generated by the business are isolated from each other.
  • the configuration information may also include at least one of the following: the network identifier of the blockchain subnet, the identity information of the administrator of the blockchain subnet, the The attribute configuration of the code, etc., is not limited in this manual.
  • the network identifier is used to uniquely represent the blockchain subnet, so the network identifier of the blockchain subnet should be distinguished from the blockchain main network and other blockchain subnets formed on the blockchain main network.
  • the identity information of the administrator of the blockchain subnet can be, for example, the public key of the node member who is the administrator; the administrators of the blockchain main network and the blockchain subnet can be the same or different.
  • One of the advantages of building a blockchain subnet through the blockchain mainnet is that since the first mainnet node has already been deployed on the node device that generates the first subnetwork node, the area used by the first mainnet node can be The block chain platform code is reused on the first subnet node, which eliminates the repeated deployment of the block chain platform code and greatly improves the efficiency of the block chain subnet.
  • the first subnet node can reuse the attribute configuration adopted on the first main network node; if the configuration information includes the attribute configuration for the blockchain platform code attribute configuration, the first subnetwork node can adopt the attribute configuration, so that the attribute configuration adopted by the first subnetwork node is not limited to the attribute configuration of the first main network node, and has nothing to do with the first main network node.
  • the attribute configuration for the blockchain platform code can include at least one of the following: code version number, whether consensus is required, consensus algorithm type, block size, etc., which are not limited in this specification.
  • Transactions that form blockchain subnets include transactions that call contracts.
  • the transaction can specify the address of the called smart contract, the method called and the parameters passed in.
  • the invoked contract can be the aforementioned genesis contract or system contract
  • the invoked method can be a method for building a blockchain subnet
  • the incoming parameters can include the above-mentioned configuration information.
  • the transaction may contain the following information:
  • the from field is the information of the initiator of the transaction.
  • Administrator indicates that the initiator is an administrator; the to field is the address of the called smart contract.
  • the smart contract can be a Subnet contract, and the to field is specifically the Subnet The address of the contract; the method field is the calling method.
  • the method used to build a blockchain subnet in the Subnet contract can be AddSubnet(string), and string is the parameter in the AddSubnet() method.
  • genesis is used to represent the The value of the parameter, the genesis is specifically the aforementioned configuration information.
  • nodeA ⁇ nodeE Take nodes nodeA ⁇ nodeE on Subnet0 executing a transaction calling the AddSubnet() method in the Subnet contract as an example. After the transaction passes the consensus, nodeA ⁇ nodeE respectively execute the AddSubnet() method and pass in the configuration information to obtain the corresponding execution results.
  • the execution result of the contract may include the configuration information, and the execution result may be included in the above-mentioned receipt, which may include an event related to the execution of the AddSubnet() method, that is, a networking event.
  • the topic of networking events can contain predefined networking event identifiers to distinguish them from other events.
  • the content of the topic is the keyword subnet, and this keyword is different from the topic in the event generated by other methods.
  • nodeA ⁇ nodeE can determine to monitor the event related to the execution of the AddSubnet() method, that is, the networking event, when the topic containing the keyword subnet is monitored.
  • the event in the receipt is as follows:
  • the content of the data field may include, for example:
  • subnet1 is the network identifier of the blockchain subnet you want to create.
  • Each blockchain node in the blockchain main network can record the network identifiers of all blockchain subnets that have been created on the blockchain main network, or other information related to these blockchain subnets, such information can be maintained in In the above-mentioned Subnet contract, it may specifically correspond to the values of one or more contract states included in the Subnet contract.
  • nodeA ⁇ nodeE can determine whether the above-mentioned subnet1 already exists according to the recorded network identifiers of all blockchain subnets that have been created; if it does not exist, it means that subnet1 is a new blockchain subnet that needs to be created currently, and if it exists, it means that subnet1 already exists.
  • a predefined new network identifier which indicates that the corresponding networking event is used to form a new blockchain subnet.
  • the above subnet1 can be replaced with newsubnet, which is a predefined new network identifier.
  • nodeA ⁇ nodeE recognizes that the data field contains newsubnet, they can determine that the event containing this newsubnet is a networking event, and a new one needs to be created.
  • Blockchain subnet When nodeA ⁇ nodeE recognizes that the data field contains newsubnet, they can determine that the event containing this newsubnet is a networking event, and a new one needs to be created.
  • the above data field also includes identity information of each node member and so on.
  • the node device deploying the first main network node can monitor the generated receipt, and when the networking event is monitored and the content of the networking event indicates that the first main network node belongs to the node member, the deployment second A node device of a main network node obtains the configuration information or the genesis block included in the networking event.
  • nodeA ⁇ nodeE will further identify the identity information of the node members contained in the data field in order to determine their own processing methods when they determine that subnet1 is a blockchain subnet that needs to be newly established.
  • nodeA ⁇ nodeD will find that the data field contains their own identity information such as their public key, IP address, and port number. Assume that nodeA ⁇ nodeD are deployed on node devices 1 ⁇ 4 respectively.
  • nodeA and node device 1 will Trigger node device 1, so that node device 1 obtains configuration information from the data field based on the above-mentioned message mechanism and generates a genesis block containing the configuration information, and node device 1 will deploy nodeA1 locally, and then nodeA1 will load the generated genesis block , thus forming a node member in subnet1; similarly, nodeB will trigger node device 2 to generate nodeB1, nodeC will trigger node device 3 to generate nodeC1, and nodeD will trigger node device 4 to generate nodeD1.
  • nodeE will find that the identity information contained in the data field does not match itself, assuming that nodeE is deployed on node device 5, then the node device 5 will not generate a genesis block based on the configuration information in the data field, nor will it generate subnet1 nodes in .
  • the data field may contain identity information generated in advance for nodeA1-nodeD1, which is different from the identity information of nodeA-nodeD. Still taking nodeA as an example, if nodeA finds the identity information of nodeA1 in the data field, then nodeA will trigger node device 1 to generate a genesis block, deploy nodeA1, and nodeA1 will load the genesis block; nodeB ⁇ nodeD are processed in a similar way , which will not be repeated here.
  • the execution result of the contract can include the genesis block.
  • the corresponding node devices 1-4 can directly obtain the genesis block from the data field through the message mechanism without generating it by themselves, which can improve the deployment efficiency of nodeA1-nodeD1.
  • the transaction of establishing a blockchain subnet may not be a transaction that calls a smart contract, so that a blockchain network that does not support smart contracts can also implement the technical solution of this specification, so that on the basis of the blockchain main network Quickly create a blockchain subnet.
  • a group of network transaction type identifiers can be pre-defined, and when the transaction contains the network transaction type identifier, it indicates that the transaction is used to form a new blockchain subnet, that is, the transaction is a transaction to form a blockchain subnet.
  • the blockchain platform code can contain relevant processing logic for building a blockchain subnet, so that when the first main network node running the blockchain platform code executes a transaction, if it finds that the transaction contains the above-mentioned networking transaction type identification, and the first main network node belongs to the node member indicated by the configuration information in the transaction, based on the above processing logic, the node device deploying the first main network node can be triggered to generate a genesis block containing the configuration information and start the first A subnetwork node, the first subnetwork node loads the genesis block to form a blockchain node in the blockchain subnetwork.
  • the node device pulls up a process and creates an instance in the process, and the instance runs the blockchain platform code, which is equivalent to deploying a blockchain node on the node device.
  • the node device creates the first instance in the above process, and the first instance runs the blockchain platform code to form.
  • the node device creates a second instance different from the first instance in the above process, and the second instance runs the blockchain platform code to form.
  • each blockchain node deployed on any node device involved in the embodiments of this specification is a different blockchain instance running on any node device, and each blockchain node deployed on any node device The blocks generated by the nodes are respectively stored in different storages (such as databases) on any node device, and the storages used by each blockchain node deployed by any node device are isolated from each other.
  • a blockchain subnet can be created on the blockchain mainnet.
  • subnet0 originally included nodeA ⁇ nodeE
  • subnet1 can be built on the basis of subnet0.
  • This subnet1 includes nodeA1 ⁇ nodeD1, and nodeA and nodeA1, nodeB and nodeB1, nodeC and nodeC1, nodeD and nodeD1 are respectively deployed in on the same node device.
  • subnet2 or more blockchain subnets can also be established on subnet0, where subnet2 includes nodeA2, nodeB2, nodeC2 and nodeE2, and nodeA and nodeA1, nodeA2, nodeB and nodeB1, nodeB2, nodeC and nodeC1, nodeD and nodeD1, nodeE and nodeE2 are respectively deployed on the same node device. And, you can use subnet1, subnet2, etc.
  • smart contracts can be deployed on it, and the contract code of the smart contract runs in a distributed manner to form the blockchain In the virtual machines of each blockchain node of the network.
  • the contract code of smart contracts is usually written by users or technicians through manual programming. Therefore, the standardization of smart contract codes is low, which is not conducive to the generation and execution of smart contracts, and limits the deployment and execution efficiency of smart contracts. .
  • this specification proposes a smart contract deployment method. Allows users to describe the workflow of a specific business using a workflow description language (Workflow Description Language), thereby generating task code written in this language, and compiling the task code through an automated compiler to directly generate Smart contracts that can be used for deployment, so as to describe the workflow through a unified standardized workflow description language, which improves the standardization of the generated contract code; and allows users to write task code using this language compared to directly writing contract code , and use the compiler to automatically generate the contract code according to the task code, which effectively ensures the generation efficiency of the standardized smart contract and also helps to ensure the execution efficiency of the contract.
  • the method will be described in detail below in conjunction with the examples.
  • FIG. 5 is a flowchart of a smart contract deployment method provided by an exemplary embodiment. As shown in FIG. 5 , the method may include the following steps: Step 502 , the user determines the workflow corresponding to the service.
  • the determined workflow may include multiple tasks to be performed, and the logical relationship between each task to be performed corresponds to the business logic of a specific business.
  • the tasks may be executed sequentially according to the serial order of time.
  • the first task to be executed requires the execution result of the second task to be executed as an input parameter, and the first The execution task needs to be executed after the execution of the second task to be executed is completed.
  • the tasks may be executed simultaneously in parallel order in time, for example, there is no data discrepancy between the first task to be executed and the second task to be executed
  • the second task to be executed can be executed while the first task to be executed is executed; of course, the second task to be executed can also be executed after the first task to be executed is completed, or the second task to be executed can be executed
  • the first to-be-executed task is executed after completion, and the embodiment of this specification does not limit the specific timing relationship of each to-be-executed task in the workflow.
  • Step 504 the user uses the workflow description language to write the task code describing the workflow.
  • the user can directly use the workflow description language to write task codes according to the workflow.
  • the above-mentioned task codes can be written using workflow description languages such as open source OpenWDL.
  • the task codes can also be written using BPMN language (Business Process Model and Notation, business process modeling and labeling).
  • BPMN language Business Process Model and Notation, business process modeling and labeling
  • Step 506 the blockchain platform invokes the compiler to generate a smart contract according to the task code.
  • Users can write the above task code in the client corresponding to the blockchain node, so that after the writing is completed, the client can automatically upload the task code to the blockchain platform to generate the contract code.
  • users can also write task codes in offline devices, and upload the completed task codes to the blockchain platform to generate contract codes.
  • users can also write task codes in offline devices, and generate contract codes on the client with the completed task codes, and then deploy the contract codes to the blockchain platform through the client to complete the deployment of smart contracts. No longer.
  • users can use text editors or code writing software with code debugging functions to write the above task codes, which is not limited in this manual.
  • a compiler can be deployed in the blockchain platform, and the compiler can be used to generate contract code written in a high-level language or directly generate bytecode according to the task code written in the workflow description language.
  • the compiler described in the embodiments of this manual is developed by the inventor himself Compiler for generating contract code written in C++ language based on task code written in OpenWDL language.
  • the blockchain platform can call the compiler to generate the contract code according to the task code, thereby generating a smart contract.
  • the task code is written by the user for the workflow through the workflow description language, and the workflow often only focuses on the logical flow and overall framework of the business, so the task code does not contain specific business implementation methods.
  • the above-mentioned compiler can generate the contract code according to the relevant processing logic to realize the specific business in the blockchain scenario, such as expanding the underlying functions during the compilation process, etc., to ensure the normal operation of the contract code .
  • the contract code generated by the compiler can include “access database A1”, “request D1 from database A1”, “receive encrypted data returned by database A1 Dog's data D1”, “decrypt and verify the received data D1” and other specific implementation processes.
  • the above implementation processes do not require the user to write in the task code, so the user only needs to pay attention to the business logic, and the compiler generates the contract code that specifically implements the business logic during the compilation process.
  • Step 508 the platform deploys the smart contract to the blockchain network.
  • the blockchain platform can initiate a blockchain transaction for deploying the contract code, so that each blockchain node in the blockchain network can execute the transaction in their respective nodes
  • the corresponding smart contract is deployed (that is, the contract code is used as the contract content of the smart contract).
  • the contract code generated by the above method contains the business logic of the aforementioned workflow, so when the final deployed smart contract is executed, it can realize the tasks to be executed of the aforementioned workflow, thereby completing the specific business specified by the user.
  • Fig. 6 is a flow chart of another smart contract deployment method provided by an exemplary embodiment, which can be applied to blockchain node instances (that is, blockchain nodes), blockchain nodes corresponding Blockchain platform, etc., the following uses the blockchain platform as an example to illustrate.
  • the method may include the following steps:
  • Step 602 acquiring the task code generated by describing the workflow using the workflow description language.
  • the blockchain platform can receive the task code obtained by the user to describe the workflow using the workflow description language (that is, written in the workflow description language), and the task code can be used to describe the tasks contained in the workflow.
  • the above task codes can be manually written by the user, or, in order to reduce the user's code writing workload and further reduce the user's threshold for deploying contract codes, the blockchain platform can provide users with predefined task templates, so that users can The task template can be configured by dragging, pulling, and dropping in the task interface displayed on the terminal.
  • the configuration parameters for the task template can also be entered in the parameter configuration interface of the task template.
  • the blockchain platform can automatically generate task codes based on configuration information such as the connection relationship between the above task templates, the timing relationship, and the configuration parameters of each task template. It can be seen that users only need to configure simple parameters for predefined task templates according to specific businesses, and the blockchain platform can automatically generate task codes, thereby realizing one-click generation of task codes, and even one-click generation and deployment of smart contracts , greatly reducing the user's contract deployment threshold and improving deployment efficiency.
  • step 604 the task code is compiled by a compiler to generate a contract code for representing the workflow.
  • a compiler in the form of a functional plug-in can be deployed in the blockchain platform, so the platform can use the compiler to compile the task code to obtain the contract code.
  • the blockchain platform can compile the above task codes into contract codes written in high-level languages such as C++, Java, and Python.
  • the contract code written in the above-mentioned high-level language needs to be further compiled into bytecode before it can be executed. Therefore, in order to speed up the execution of the smart contract and reduce the compilation time in the execution process, the block The chain platform can also directly compile the task code into bytecode and use the bytecode as the contract code.
  • the blockchain platform can also compile the task code into a high-level language Code, and then further compile the code written in the high-level language into bytecode, and use the bytecode as the contract code.
  • the blockchain platform can provide the code written in the above-mentioned high-level language to the user (for example, send it to the client for display), so that the user can modify or adjust the task code by viewing the code, and improve the flexibility of generating smart contracts. sex.
  • Step 606 sending a block chain transaction for deploying the contract code to the block chain network, so as to deploy the corresponding smart contract in the block chain network, and the smart contract is used to be called according to the
  • the business logic defined by each task node in the workflow assigns tasks to be executed to the node members participating in the blockchain network.
  • each blockchain node device where each blockchain node in the network is located belong to the corresponding blockchain members.
  • subnet0 is a consortium chain
  • each blockchain node nodeA, nodeB, nodeC, nodeD, and nodeE in subnet0 can correspond to different consortium chain members respectively.
  • the blockchain platform can send a blockchain transaction for deploying the contract code to the blockchain network, so that each blockchain node in the blockchain network can execute the transaction (of course, if necessary At this time, the transaction can be consensused first, and then executed separately when the consensus is passed), so as to deploy the smart contract containing the above contract code to the blockchain network.
  • the smart contract can be invoked according to the business logic defined by each task node in the workflow Assign tasks to be executed to the node members participating in the blockchain network, so as to complete the execution of the tasks to be executed through the execution of smart contracts, so as to realize the specific business corresponding to the business logic.
  • the blockchain platform can compile the contract code into bytecode and then deploy the bytecode to reduce the waiting time for smart contract execution.
  • the blockchain platform can also deploy contract code written in a high-level language in the blockchain network, and start compiling the contract code into bytecode immediately after the deployment is completed. Therefore, the execution efficiency of smart contracts is guaranteed by pre-compiling before execution.
  • this solution allows users to use a workflow description language to describe the workflow of a specific business, thereby generating task code written in this language, and compiling the task code through an automated compiler to directly generate a contract that can be used for deployment Code, so as to describe the workflow through a unified and standardized workflow description language, which improves the standardization of the generated contract code; and compared with writing contract code directly, users are allowed to use this language to write task code and use the compiler
  • the contract code is automatically generated according to the task code, which effectively improves the generation efficiency of the standardized smart contract, thus helping to ensure the execution efficiency of the contract.
  • this specification proposes another smart contract deployment method, which is applied to the blockchain nodes in the blockchain network. The method will be described in detail below in conjunction with FIG. 7 .
  • Step 702 in response to the received blockchain transaction for deploying the contract code, deploy the corresponding smart contract in the blockchain network; the contract code is generated by compiling the task code by the compiler, and the task code Generated by describing the workflow in the workflow description language.
  • Step 704 in response to the received blockchain transaction calling the smart contract, assign tasks to be executed to node members participating in the blockchain network according to the business logic defined by each task node in the workflow.
  • the smart contracts deployed in the blockchain network can be invoked and executed by blockchain transactions issued by any blockchain node.
  • the task code is generated by describing the workflow by the workflow description language
  • the contract code is generated by compiling the task code by the compiler, so the smart contract defines the workflow corresponding to each task to be executed, Wherein, there are corresponding task nodes for each task to be executed.
  • the process of executing the smart contract is the process of sequentially executing each task to be executed defined in the workflow.
  • the execution of the task to be executed makes the working status of the smart contract transition between each task node according to the preset order of the workflow.
  • the deployed smart contracts above can be invoked by blockchain exchanges.
  • the block chain node can respond to the first transaction of calling the smart contract, and the processing progress of the workflow is before the first task node and the input parameters provided by the first transaction make the execution of the first task node
  • a task assignment event including the first task to be executed corresponding to the first task node is generated.
  • the above-mentioned first transaction is used to trigger the execution of the first task to be executed in the smart contract.
  • the smart contract can generate a task assignment event corresponding to the first task to be executed.
  • the task dispatching center of the blockchain platform obtains it, and assigns the first task to be executed to the corresponding executor for processing according to the event.
  • the execution condition of the above-mentioned first task node may be that the data format of the input parameter provided by the first transaction meets the requirements.
  • the task defined by the workflow in the smart contract may be called "contract task".
  • the first transaction pushes the workflow to start executing contract task A, that is, the first task node is the task node A corresponding to contract task A, then the first
  • the input parameters provided by a transaction can be the event type type in the form of a string (String), and the parameter args in the form of bytes (Bytes). Therefore, the block chain node can determine that the input parameters provided by the first transaction meet the execution conditions when judging that the above-mentioned event type and the data format of the parameters conform to the specified format of the called method.
  • the execution condition is met as a trigger condition for the blockchain node to generate a task assignment event corresponding to the task node A.
  • the provided parameter ev can be
  • the execution condition of the above-mentioned first task node may also be: the input parameter provided by the first transaction is the second pending task corresponding to the second task node before the first task node in the workflow.
  • the execution result of the execution task For example, when the first task to be executed is contract task B, and the second task to be executed is contract task A on which contract task B depends, the first task node is the task node B corresponding to contract task B.
  • the execution result of contract task A can be used as the input parameter of contract task B, so when the input parameter provided by the first transaction is the execution result of contract task A (that is, it indicates that contract task A has been executed at the current moment), the corresponding The block chain node instance can determine that the input parameters provided by the first transaction meet the execution conditions. It can be seen that if the processing progress of the workflow at the current moment is ahead of the task node B, then the execution condition being satisfied can be used as a trigger condition for the node device to generate a task assignment event corresponding to the task node B.
  • the execution condition of the first task node can also include the above two at the same time, that is, the execution condition can be "the input parameter provided by the first transaction is provided by the second task node before the first task node in the workflow.”
  • the execution result of the corresponding second to-be-executed task, and the data format of the execution result meets the requirements", so as to achieve stricter management on the input parameters of any task in the workflow.
  • the block chain platform code is deployed in the node device described in this specification, and the block chain node instance is formed locally when the node device runs the platform code, thereby forming a block in the node device
  • the node device can also be deployed with a blockchain business code, and the node device will form a business instance locally during the process of running the business code.
  • the blockchain node instance can be used to generate the above-mentioned task allocation event, and the business instance can be used to monitor the task allocation event and determine that the blockchain member to which the node device belongs is the executor of the first task to be executed Next, participate in the execution of the first task to be executed.
  • the blockchain node that executes the smart contract can generate the above task assignment event, and the business instance in the node device where any blockchain node in the blockchain network is located can determine its location based on the event after listening to the event. Whether the blockchain member to which the node device belongs is the executor of the first task to be executed, and then participate in the execution of the first task to be executed if it is determined to be yes; of course, in the case of no, the event can be directly discarded .
  • the blockchain node instance can include the identity information of the blockchain member of the assigned object in the task assignment event, so that the business instance deployed in the node device where any blockchain node of the blockchain network is located It can be determined that the first contract task included in the task assignment event is assigned to the first node when the task assignment event is monitored and the blockchain member to which the node device belongs is determined to be the executor of the first task to be executed The first block chain member to which the device belongs, that is, it is determined that the service instance deployed in the node device where it is located executes the first contract task.
  • the above-mentioned identity information can be the member identification of the block chain member, or the device identification of the node device (in the case that only one block chain node in the block chain network is deployed in one node device), it can also be The node public key of the blockchain node corresponding to the blockchain member or the summary of the node public key, etc., are not limited in this manual.
  • any blockchain node can determine whether its corresponding blockchain node member is the executor of the first task to be executed in the above-mentioned manner. The following embodiments do not Let me repeat.
  • the service instances corresponding to each executor may respectively execute the first to-be-executed task.
  • the above-mentioned first task to be executed may also include multiple subtasks, and at this time, the service instances corresponding to each executing party may also respectively execute the above-mentioned multiple subtasks.
  • the above-mentioned first task to be performed may be in the form of various tasks such as private computing, file system access, and database access, so that the business instance may also perform the first task to be performed in various ways.
  • the service instance can call the computing resources deployed locally on the node device to execute the first task to be executed, for example, the service instance in the node device 1 can call the task unit managed by the task unit container 11 deployed locally on the node device 1 to execute the contract task A (At this point, contract task A is the first task to be executed).
  • the service instance may also call computing resources deployed outside the node device to execute the first task to be executed, for example, the service instance in the node device 2 may call the task unit managed by the task unit container 21 locally deployed on the node device 2 and The off-chain computing resources deployed in other devices than the node device 2 cooperate to execute the contract task C (at this time, the contract task C is the first task to be executed).
  • the business instance in node device 1 can also call multiple computing resources deployed locally on the node device to execute contract task A, or the business instance in node device 2 can also only call off-chain computing resources to execute contract task C. The description does not limit this.
  • appropriate computing resources can be flexibly selected to execute the first task to be executed according to actual task requirements such as task type, computing resource consumption, and time-consuming requirements, so as to realize more flexible program practice and expand the scope of the method described in this specification. Applicable scene.
  • any node device can pull up multiple processes respectively, and run the above-mentioned blockchain platform code and blockchain respectively in different processes.
  • Task code so that the blockchain node instance and the business instance are deployed in different processes.
  • data transmission can be realized through cross-process interaction between the blockchain node instance and the business instance. In this way, it is ensured that blockchain node instances and business instances generate as little interference as possible during operation, and fault isolation between different instances is realized.
  • the node device can also deploy the above-mentioned blockchain node instance and business instance in the same process. This is not limiting.
  • any blockchain node in the blockchain network can determine whether its corresponding blockchain node member is the first task to be executed after listening to the task assignment event for the first task to be executed executor, and then in the case of determining that its corresponding block chain node member is the executor of the first task to be executed, it can create a subnetwork node instance in the node device where it is located, and communicate with other members of the first task to be executed The subnetwork node instance created by the executor forms a blockchain subnetwork. Furthermore, blockchain nodes can submit subnetwork transactions on the established blockchain subnetwork, so that their corresponding blockchain node members can execute the first task to be executed—each subnetwork node in the blockchain subnetwork will execute The transaction is thus executed by the blockchain subnetwork.
  • nodeA, nodeB, nodeC, nodeD, and nodeE can respectively determine their own Whether it is the executor of the task to be executed corresponding to the event: If nodeA, nodeB, nodeC, and nodeD respectively determine themselves to be the executor of the task to be executed, they can create subnetwork node instances nodeA1, nodeB1, nodeC1, and nodeD1 respectively, and Set up a block chain subnet subnet1 containing the above subnet node instances, and then execute the tasks to be executed corresponding to the above task assignment events in the subnet1.
  • each executor of the task to be executed corresponding to the task assignment event can build a blockchain subnet accordingly, and through each blockchain The mutual cooperation of nodes in this subnetwork completes the execution of tasks to be executed.
  • the blockchain network at this time is equivalent to the blockchain main network, and the network composed of each blockchain node is the blockchain subnet.
  • the network ensures that the relevant data in the execution process of the blockchain node corresponding to the task assignment event will not be known by other irrelevant nodes in the blockchain main network, effectively ensuring the small-scale privacy of the data.
  • the execution results of the above-mentioned relevant data and tasks can be stored in the identity of the data corresponding to the blockchain subnet, without being confused with the data of the blockchain main network, which further ensures the security and privacy of the data.
  • Step 1 Pull data from the database of the store SSS and process it, and then output the result of this step as the output result of this step and save it on the blockchain.
  • Step 2 Build a blockchain subnet, and the participants of the blockchain subnet will agree on the results of the previous step.
  • the above two steps may correspond to two tasks to be executed with dependencies (ie, MYTASK1 and MYTASK2 described below).
  • the task code written in OpenWDL language can be as follows:
  • the above-mentioned subnet transactions may include blockchain transactions for invoking smart contracts.
  • the first task to be executed is the task MYTASK1 corresponding to the first step
  • the subnet transaction initiated in the subnet can be a blockchain transaction that calls the contract code corresponding to the part of the task MYTASK1 in the smart contract, so that Each node in the subnet can execute this part of the contract code to complete the execution of the task MYTASK1.
  • the subnetwork nodes corresponding to the executor of the first task to be executed in the blockchain subnetwork may all be consensus nodes. At this time, the subnetwork transactions are executed by each subnetwork node after passing the consensus of the blockchain subnetwork. In this way, the reliability of the executed subnet transactions is guaranteed through consensus.
  • the subnetwork nodes corresponding to the executor of the first task to be executed in the blockchain subnetwork may also be non-consensus nodes. After the consensus of the blockchain subnetwork, different subtasks can be performed by each subnetwork node. It can be seen that the sub-network transactions at this time do not need to go through consensus, so each sub-network node can execute their own sub-network transactions synchronously, which helps to improve the execution efficiency of blockchain transactions.
  • the block chain subnet established in response to the task assignment event can be disbanded after the block chain transaction corresponding to the task assignment event is responded to (that is, after the execution of the first task to be executed is completed), so that The established blockchain subnetwork is constructed along with the execution of the blockchain transaction, and disbanded with the execution of the transaction, thus realizing the temporary establishment of the blockchain subnetwork.
  • the life cycle of the blockchain subnet is the same as the life cycle of the corresponding blockchain transaction, which avoids the possible reduction in efficiency caused by the simultaneous maintenance of too many blockchain network network information by blockchain nodes.
  • the first task to be executed may include multiple subtasks, and the executor of each subtask may execute each subtask in a preset order, and the preset order may be the execution order defined in the workflow, so that Ensure that the execution sequence of each subtask corresponds to the workflow, and further ensure that the first task to be executed gets a correct execution result.
  • the smart contracts deployed in the blockchain network can be executed multiple times, so if the blockchain subnet is rebuilt every time the smart contract is executed, it will inevitably reduce the utilization rate of the blockchain subnet and cause the response of blockchain transactions Prolonged.
  • the blockchain subnetwork can be pre-established after the smart contract is deployed (before the smart contract is executed), that is, after any blockchain node deploys the smart contract, it will be based on the task-related information recorded in the contract ( The executor of each task to be executed) establishes a blockchain subnet corresponding to each task to be executed.
  • the network node instance of the blockchain network and the subnetwork node instance of the blockchain subnet managed by the blockchain network are deployed on the node device corresponding to the blockchain node, so that the subnetwork node instance listens to the task assignment event And when it is determined that the corresponding subnetwork node member is the executor of the first task to be executed, the subnetwork transaction can be submitted on the blockchain subnet, so that the subnetwork node member corresponding to itself can participate in the execution of the first task to be executed.
  • the blockchain node instance when the processing progress of the workflow at the current moment is ahead of the first task node and the input provided by the first transaction satisfies the execution conditions of the first task node, the blockchain node instance also The processing progress of the workflow can be updated after the first task node, thereby promoting the state transition of the workflow state corresponding to the smart contract.
  • the block chain node after executing the first task to be executed, can return the execution result of the task to the first task node through the task callback method in the smart contract. Therefore, when the first transaction calls the task callback method in the smart contract, it indicates that the input parameter provided by the first transaction is the execution result of the second task to be executed; wherein, after the task callback method is called, it can be automatically triggered to advance Workflow method.
  • the above scheme allows users to use the workflow description language to describe the workflow of a specific business, thereby generating task codes written in this language, and compiling the task codes through an automated compiler to directly generate deployment-ready contract code.
  • the workflow is described through a unified standardized workflow description language, which improves the standardization of the generated contract code; and compared with directly writing contract code, users are allowed to use this language to write task code, and use the compiler to compile task code according to the task code.
  • the contract code is automatically generated, effectively ensuring the generation and execution efficiency of standardized smart contracts.
  • Fig. 8 is a schematic structural diagram of a device provided by an exemplary embodiment.
  • the device includes a processor 802 , an internal bus 804 , a network interface 806 , a memory 808 and a non-volatile memory 810 , and of course may also include hardware required by other services.
  • the processor 802 reads a corresponding computer program from the non-volatile memory 810 into the memory 808 and executes it.
  • one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each A logic unit, which can also be a hardware or logic device.
  • Fig. 9 is a block diagram of a smart contract deployment device provided by an exemplary embodiment.
  • the device can be applied to the device shown in FIG. 8 to realize the technical solution of this specification.
  • the smart contract deployment device may include: a code acquisition unit 901, which acquires the task code generated by describing the workflow using a workflow description language; a code compilation unit 902, which compiles the task code through a compiler, Generate the contract code used to characterize the workflow; the transaction deployment unit 903 sends the blockchain transaction used to deploy the contract code to the blockchain network to deploy the corresponding intelligent A contract, the smart contract is used to assign tasks to be executed to the node members participating in the blockchain network according to the business logic defined by each task node in the workflow when called.
  • the code obtaining unit 901 is further configured to: receive the task code sent by the client; or generate the task code according to configuration information provided by the client for a predefined task template.
  • the code compiling unit 902 is also used for one of the following: compiling the task code into a contract code written in a high-level language; compiling the task code into bytecode, and compiling the bytecode
  • the contract code first compile the task code into a code written in a high-level language, then further compile the code written in the high-level language into a bytecode, and use the bytecode as the contract code.
  • the transaction deployment unit 903 is further configured to: compile the contract code into bytecode when the contract code is written in a high-level language, and deploy the bytecode in the blockchain network section code; or, in the case that the contract code is written in a high-level language, deploy the contract code written in the high-level language in the block chain network, and immediately start converting the contract code to Compiled to bytecode.
  • FIG. 10 is a block diagram of another smart contract deployment device provided by an exemplary embodiment.
  • the device can be applied to the device shown in FIG. 8 to realize the technical solution of this specification.
  • the smart contract deployment device is applied to the blockchain nodes in the blockchain network, and may include: the contract deployment unit 1001, which responds to the received blockchain transaction of deploying the contract code, in the blockchain network Deploy the corresponding smart contract; the contract code is generated by compiling the task code by the compiler, and the task code is generated by describing the workflow in the workflow description language; the contract calling unit 1002 makes the response to the received Invoke the block chain transaction of the smart contract, assign tasks to be executed to the node members participating in the block chain network according to the business logic defined by each task node in the workflow.
  • an event generating unit 1003 which makes the processing progress of the workflow be ahead of the first task node and the input parameters provided by the first transaction satisfy the execution condition of the first task node , generating a task assignment event including the first task to be executed corresponding to the first task node.
  • the execution condition includes at least one of the following: the data format of the input parameter provided by the first transaction meets the requirements; the input parameter provided by the first transaction is the first task node before the first task node in the workflow.
  • a block chain node instance and a service instance are deployed on the node device corresponding to the block chain node, the block chain node instance is used to generate the task assignment event, and the service instance is used to monitor Participate in the execution of the first to-be-executed task when the task assignment event occurs and the block chain member to which the node device belongs is determined to be the executor of the first to-be-executed task.
  • a task contains multiple subtasks.
  • the service instance corresponding to any executor executes any task, including: the service instance invokes a local computing resource deployed on the node device where it is located to execute any task; and/or, the service instance invokes The computing resource deployed outside the node device where it is located executes any of the above tasks.
  • the blockchain node instance and the service instance deployed in any node device are in different processes.
  • the node device corresponding to the blockchain node is deployed with a network node instance of the blockchain network and a subnet node instance of the blockchain subnet managed by the blockchain network, the subnet
  • the network node instance listens to the task allocation event and determines that its corresponding subnetwork node member is the executor of the first task to be executed, it submits a subnetwork transaction on the blockchain subnetwork, so that The corresponding subnetwork node members participate in executing the first task to be executed.
  • the subnet creation unit 1004 so that when the task allocation event is monitored and the block chain node member corresponding to itself is determined to be the executor of the first task to be executed, in its own Create a subnet node instance in the node device, and form a block chain subnet with the subnet node instances created by other executors of the first to-be-executed task; the transaction submission unit 1005 makes the established block chain subnet Submit a subnetwork transaction, so that the first task to be executed is executed by its corresponding block chain node member.
  • the subnet transaction includes a transaction for invoking the smart contract.
  • the corresponding subnet nodes of the executor of the first to-be-executed task in the blockchain subnet are all consensus nodes, and after the subnet transaction passes the consensus of the blockchain subnet, it is accepted by each Subnetwork nodes are executed separately.
  • the first to-be-executed task includes a plurality of sub-tasks
  • the sub-network nodes corresponding to the executor of the first to-be-executed task in the blockchain sub-network are all non-consensus nodes, and the sub-network transaction Without going through the consensus of the blockchain subnetwork, each subnetwork node performs different subtasks respectively.
  • any blockchain node determines that its corresponding blockchain node member is the executor of the first to-be-executed task, including: the task assignment event includes the The identity information of the blockchain node members; or, the task content of the first task to be executed matches the task allocation conditions corresponding to the blockchain node members corresponding to any of the blockchain nodes.
  • the executor of each subtask executes each subtask according to the execution sequence defined in the workflow.
  • it also includes: a progress updating unit 1006, so that when the processing progress of the workflow is before the first task node and the input parameters provided by the first transaction satisfy the execution condition of the first task node , the block chain node instance updates the processing progress of the workflow after the first task node.
  • any executor of the to-be-executed task is further configured to: call a task callback method in the smart contract, and return the execution result of the to-be-executed task to the smart contract.
  • a typical implementing device is a computer.
  • the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or Combinations of any of these devices.
  • the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied 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.
  • 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 particular tasks or implement particular abstract data types.
  • the present description may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions
  • the device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
  • a computer includes one or more processors (CPUs), input/output interfaces, network interfaces and memory.
  • Memory may include non-permanent storage in computer-readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or 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 including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic cassettes, disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by computing devices.
  • computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
  • first, second, third, etc. may be used in one or more embodiments of the present specification to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of one or more embodiments of this specification, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, the word “if” as used herein may be interpreted as “at” or "when” or "in response to a determination.”

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (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)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Sont prévus dans un ou plusieurs modes de réalisation de la présente description un procédé et un appareil de déploiement de contrat intelligent. Le procédé consiste à : acquérir un code de tâche généré au moyen de la description d'un flux de travaux en utilisant un langage de description de flux de travaux ; compiler le code de tâche au moyen d'un compilateur, de façon à générer un code de contrat pour représenter le flux de travaux ; et envoyer, à un réseau de chaîne de blocs, une transaction de chaîne de blocs pour déployer le code de contrat, de manière à déployer un contrat intelligent correspondant dans le réseau de chaîne de blocs, le contrat intelligent étant utilisé pour attribuer, lorsqu'il est appelé et selon une logique de service définie par chaque nœud de tâche dans le flux de travaux, une tâche à exécuter sur un élément de nœud qui participe au réseau de chaîne de blocs.
PCT/CN2022/093802 2021-06-02 2022-05-19 Procédé et appareil de déploiement de contrat intelligent WO2022252995A1 (fr)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110611555.XA CN113067900B (zh) 2021-06-02 2021-06-02 智能合约的部署方法及装置
CN202110611555.X 2021-06-02

Publications (1)

Publication Number Publication Date
WO2022252995A1 true WO2022252995A1 (fr) 2022-12-08

Family

ID=76568499

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/093802 WO2022252995A1 (fr) 2021-06-02 2022-05-19 Procédé et appareil de déploiement de contrat intelligent

Country Status (2)

Country Link
CN (1) CN113067900B (fr)
WO (1) WO2022252995A1 (fr)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116737348A (zh) * 2023-08-14 2023-09-12 腾讯科技(深圳)有限公司 一种多方任务的处理方法、装置及计算机设备、存储介质

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113067900B (zh) * 2021-06-02 2021-09-24 支付宝(杭州)信息技术有限公司 智能合约的部署方法及装置
CN114527712A (zh) * 2021-11-22 2022-05-24 广东嘉腾机器人自动化有限公司 Agv任务修改方法及修改系统
CN114726858A (zh) * 2022-03-31 2022-07-08 蚂蚁区块链科技(上海)有限公司 一种数据处理方法、装置、电子设备和存储介质
CN115759955B (zh) * 2022-10-20 2023-08-04 福建师范大学 一种基于区块链的业务流程执行引擎

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104246702A (zh) * 2012-07-16 2014-12-24 惠普发展公司,有限责任合伙企业 工作流编译
CN109359957A (zh) * 2018-09-17 2019-02-19 中国银联股份有限公司 一种安全多方计算的方法及相关装置
US20190205884A1 (en) * 2017-12-28 2019-07-04 International Business Machines Corporation Converting processes into multiple blockchain smart contracts
CN111027936A (zh) * 2019-12-10 2020-04-17 杭州趣链科技有限公司 一种联盟网络中基于智能合约的工作流实现方法、设备及介质
US10659219B1 (en) * 2019-08-23 2020-05-19 Capital One Services, Llc Workflow management via distributed ledgers and smart contracts
CN111612615A (zh) * 2019-02-26 2020-09-01 傲为信息技术(江苏)有限公司 基于公链的区块链子链创建方法及系统
CN111770113A (zh) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 一种执行智能合约的方法、区块链节点和节点设备
CN111768187A (zh) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 一种部署智能合约的方法、区块链节点和存储介质
US20200327498A1 (en) * 2016-03-21 2020-10-15 National Ict Australia Limited Business Process Execution on a Blockchain Platform
US20200409940A1 (en) * 2019-06-27 2020-12-31 Advanced New Technologies Co., Ltd. Implementing a blockchain-based workflow
CN113067900A (zh) * 2021-06-02 2021-07-02 支付宝(杭州)信息技术有限公司 智能合约的部署方法及装置
US20210342329A1 (en) * 2020-05-04 2021-11-04 Salesforce.Com, Inc. System or method to run distributed validation of workflows across a network in a shared distributed ledger in multi-tenant cloud environment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107147735B (zh) * 2017-05-12 2020-08-11 北京博晨技术有限公司 一种基于分层结构的分布式账本系统
CN108647946A (zh) * 2018-05-16 2018-10-12 深圳市网心科技有限公司 智能合约处理方法及系统、监听设备及存储介质
US20210073913A1 (en) * 2019-09-06 2021-03-11 Bosonic, Inc. System and method of providing a block chain-based recordation process
CN111930487B (zh) * 2020-08-28 2024-05-24 北京百度网讯科技有限公司 作业流调度方法、装置、电子设备及存储介质

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104246702A (zh) * 2012-07-16 2014-12-24 惠普发展公司,有限责任合伙企业 工作流编译
US20200327498A1 (en) * 2016-03-21 2020-10-15 National Ict Australia Limited Business Process Execution on a Blockchain Platform
US20190205884A1 (en) * 2017-12-28 2019-07-04 International Business Machines Corporation Converting processes into multiple blockchain smart contracts
CN109359957A (zh) * 2018-09-17 2019-02-19 中国银联股份有限公司 一种安全多方计算的方法及相关装置
CN111612615A (zh) * 2019-02-26 2020-09-01 傲为信息技术(江苏)有限公司 基于公链的区块链子链创建方法及系统
US20200409940A1 (en) * 2019-06-27 2020-12-31 Advanced New Technologies Co., Ltd. Implementing a blockchain-based workflow
US10659219B1 (en) * 2019-08-23 2020-05-19 Capital One Services, Llc Workflow management via distributed ledgers and smart contracts
CN111027936A (zh) * 2019-12-10 2020-04-17 杭州趣链科技有限公司 一种联盟网络中基于智能合约的工作流实现方法、设备及介质
US20210342329A1 (en) * 2020-05-04 2021-11-04 Salesforce.Com, Inc. System or method to run distributed validation of workflows across a network in a shared distributed ledger in multi-tenant cloud environment
CN111770113A (zh) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 一种执行智能合约的方法、区块链节点和节点设备
CN111768187A (zh) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 一种部署智能合约的方法、区块链节点和存储介质
CN113067900A (zh) * 2021-06-02 2021-07-02 支付宝(杭州)信息技术有限公司 智能合约的部署方法及装置

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
GAO YE: "Research on Smart Contract Optimization Method of Business Process Based on Blockchain", CHINESE DOCTORAL DISSERTATIONS FULL-TEXT DATABASE (ELECTRONIC JOURNAL), 31 January 2020 (2020-01-31), XP093010178 *
ZHOU SHUAI: "Design and Implementation of Blockchain Network Management", CHINESE DOCTORAL DISSERTATIONS FULL-TEXT DATABASE (ELECTRONIC JOURNAL), 31 July 2020 (2020-07-31), XP093010174 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116737348A (zh) * 2023-08-14 2023-09-12 腾讯科技(深圳)有限公司 一种多方任务的处理方法、装置及计算机设备、存储介质
CN116737348B (zh) * 2023-08-14 2024-01-02 腾讯科技(深圳)有限公司 一种多方任务的处理方法、装置及计算机设备、存储介质

Also Published As

Publication number Publication date
CN113067900A (zh) 2021-07-02
CN113067900B (zh) 2021-09-24

Similar Documents

Publication Publication Date Title
WO2022252995A1 (fr) Procédé et appareil de déploiement de contrat intelligent
CN113098983B (zh) 基于智能合约的任务执行方法及装置
CN113067904B (zh) 组建区块链子网的方法和区块链系统
CN113067902B (zh) 区块链消息的传输方法及装置
CN113098982B (zh) 区块链消息的传输方法及装置
CN113067897B (zh) 跨链交互方法及装置
CN113067895B (zh) 组建区块链子网的方法和区块链系统
CN113067901B (zh) 区块链子网的创建方法
WO2023040502A1 (fr) Enregistrement de service d'utilisateur
WO2022252996A1 (fr) Procédé de planification de service de calcul pour un contrat de flux de service
CN113067914B (zh) 一种分配子网标识的方法、装置、电子设备和存储介质
CN113259457B (zh) 区块链子网的信息同步方法及装置
CN113326290B (zh) 跨网查询控制方法
CN113259464B (zh) 组建区块链子网的方法和区块链系统
CN114363162A (zh) 区块链日志的生成方法及装置、电子设备、存储介质
WO2023207076A1 (fr) Procédé et appareil pour établir un sous-réseau de chaîne de blocs
WO2022252993A1 (fr) Procédé d'exécution de service basé sur un service de calcul hors chaîne
CN113259462B (zh) 区块链消息的分发方法及装置
CN113259119B (zh) 区块链消息的分发方法及装置
CN113259466B (zh) 区块链子网运行状态的控制方法和区块链系统
CN114710492A (zh) 直连通道的建立方法及装置
CN113259459A (zh) 区块链子网运行状态的控制方法和区块链系统
CN114363349B (zh) 区块链子网的启动方法及装置
CN113098984B (zh) 基于注册机制形成多层区块链系统的方法和区块链系统
CN114297171A (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: 22815042

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22815042

Country of ref document: EP

Kind code of ref document: A1