WO2020224353A1 - Method and device for publishing smart contracts in block chain - Google Patents

Method and device for publishing smart contracts in block chain Download PDF

Info

Publication number
WO2020224353A1
WO2020224353A1 PCT/CN2020/081871 CN2020081871W WO2020224353A1 WO 2020224353 A1 WO2020224353 A1 WO 2020224353A1 CN 2020081871 W CN2020081871 W CN 2020081871W WO 2020224353 A1 WO2020224353 A1 WO 2020224353A1
Authority
WO
WIPO (PCT)
Prior art keywords
smart contract
dependency
dependency tree
smart
node
Prior art date
Application number
PCT/CN2020/081871
Other languages
French (fr)
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 WO2020224353A1 publication Critical patent/WO2020224353A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/72Code refactoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing

Definitions

  • the present invention relates to the field of financial technology (Fintech), in particular to a method and device for issuing smart contracts in a blockchain.
  • Smart contract is a computer protocol designed to spread, verify, or execute a contract in an information-based way.
  • the execution process is consensus and confirmation on the blockchain in the form of transactions.
  • Smart contracts allow trusted transactions without a third party, which are traceable and irreversible.
  • a smart contract is a piece of code that runs on the blockchain and needs to be published on the blockchain before it can run.
  • An application project of the existing blockchain sets up multiple modules according to functions, and each module is divided into several data structures according to functions. All functions are implemented by smart contracts and run on the blockchain.
  • This application provides a method and device for issuing smart contracts in a blockchain to improve the efficiency and accuracy of smart contract issuance.
  • An embodiment of the present invention provides a method for issuing smart contracts in a blockchain, including:
  • N dependency trees are established, and one node of the dependency tree corresponds to a smart contract; N ⁇ 1;
  • the smart contracts corresponding to each node are issued in sequence.
  • the method before the traversing the smart contracts to be released and determining the dependencies between the smart contracts to be released, the method further includes:
  • the address parameter is used to indicate the smart contract called by the smart contract
  • the address parameter is standardized to determine the smart contract corresponding to the address parameter.
  • successively publishing the smart contract corresponding to each node includes:
  • the method further includes:
  • the nodes in the dependency tree are updated.
  • the embodiment of the present invention also provides a device for issuing smart contracts in the blockchain, including:
  • the obtaining unit is used to obtain the smart contract to be released
  • the determining unit is configured to traverse the smart contract to be released and determine the dependency relationship between the smart contract to be released;
  • the establishment unit is configured to establish N dependency trees according to the dependency relationship, and one node of the dependency tree corresponds to a smart contract; N ⁇ 1;
  • the publishing unit is used for publishing the smart contract corresponding to each node in sequence from the leaf node of the dependent tree to the root node of the dependent tree for any dependent tree.
  • the determining unit is further configured to:
  • the address parameter is used to indicate the smart contract called by the smart contract
  • the address parameter is standardized to determine the smart contract corresponding to the address parameter.
  • the publishing unit is specifically configured to:
  • the acquiring unit is further configured to receive a smart contract change request
  • the establishment unit is also used to update the nodes in the dependency tree according to the smart contract change request.
  • the embodiment of the present invention also provides an electronic device, including:
  • At least one processor and,
  • a memory communicatively connected with the at least one processor; wherein,
  • the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the smart contract in the blockchain as described above. Publishing method.
  • the embodiment of the present invention also provides a non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to make the computer execute the above-mentioned blockchain How to release smart contracts.
  • the embodiment of the present invention also provides a computer program product containing instructions, which when running on a computer, causes the computer to execute the method for issuing smart contracts in the above-mentioned blockchain.
  • the smart contract to be released is acquired, all smart contracts to be released are traversed, and the dependency relationship between the smart contracts is determined.
  • the dependency relationship build N dependency trees, where one node of the dependency tree corresponds to a smart contract, N ⁇ 1.
  • the smart contract corresponding to each node is issued in turn. Therefore, by building a dependency tree to release smart contracts, the tree is traversed to automatically and efficiently release smart contracts, without manually sorting out the release sequence, and without worrying about confusion, and improving the accuracy of smart contract release.
  • FIG. 1 is a schematic structural diagram of a blockchain application project provided by an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of a method for issuing smart contracts in a blockchain according to an embodiment of the present invention
  • 3a to 3f are schematic diagrams of the structure of the dependency tree establishment process provided by the embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of the issuance process of a smart contract provided by a specific embodiment of the present invention.
  • FIG. 5 is a schematic flowchart of the issuance process after the update of the smart contract according to the second embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a device for issuing smart contracts in a blockchain according to an embodiment of the present invention.
  • FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
  • Blockchain A chain composed of a series of blocks. In addition to recording the data of the block, each block also records the Hash value of the previous block. In this way, a chain is formed.
  • a block consists of a block header and a block body.
  • the block header definition includes important fields such as the block height h, the hash value prevHash of the previous block, and the block body mainly stores transaction data.
  • Smart contract A piece of code that can be run on the blockchain. The execution process of the smart contract will be agreed and confirmed on the blockchain in the form of transactions.
  • Consensus An algorithm in which each node of the blockchain agrees on the correctness of a transaction.
  • web3j A collection of libraries that uses HTTP (Hyper Text Transfer Protocol) or IPC (Inter-Process Communication) to connect with local or remote Ethereum nodes.
  • HTTP Hyper Text Transfer Protocol
  • IPC Inter-Process Communication
  • WeIdentiy A set of distributed multi-center technical solutions that can carry the trusted mapping between the actual identity of the entity object (person or thing) and the identity on the chain, and realize the secure access authorization and data exchange between entity objects.
  • Solidity A high-level language for smart contracts that runs on the Ethereum Virtual Machine (EVM).
  • EVM Ethereum Virtual Machine
  • java An object-oriented programming language for writing desktop applications, web applications, distributed systems, and embedded system applications.
  • a blockchain application project is divided into three modules according to functions, namely module A, module B, and module C.
  • Each module is divided into multiple data structures according to functions.
  • module A is divided into three data structures A1, A2, and A3
  • module B is divided into three data structures B1, B2, and B3
  • module C is divided into three data structures C1, C2, and C2.
  • C3 has three data structures, all of which are implemented using smart contracts, run on the blockchain, and are denoted as smart contract A1, smart contract B1, etc.
  • Step 1 Press module A, module B, and module C to release. Assume that module A is released, starting from smart contract A1, checking the parameters in the construction method of smart contract A1, passing in the parameters, and calling the web3j interface to publish. If the parameters of smart contract A1 include other smart contracts, for example, the parameters of smart contract A1 include the address parameters of smart contract A2 and smart contract B3, then you need to publish smart contract A2 and smart contract B3 first, and then Release smart contract A1.
  • Step 2 After each smart contract checks the parameters in the construction method according to step 1, write the release code for release until all modules are released.
  • Step 3 Finally, save the address of the smart contract to complete the release.
  • an embodiment of the present invention provides a method for issuing smart contracts in a blockchain.
  • the method for issuing smart contracts in a blockchain provided by the embodiment of the present invention includes The following steps:
  • Step 201 Obtain a smart contract to be released.
  • Step 202 Traverse the smart contract to be released, and determine the dependency relationship between the smart contract to be released.
  • the address parameters in the smart contract are dynamically identified, and the dependency relationship is determined according to the address parameters. For example, if the construction method of smart contract A1 includes the address parameter of smart contract A2, it is considered that smart contract A1 depends on smart contract A2.
  • Step 203 Establish N dependency trees according to the dependency relationship, and one node of the dependency tree corresponds to one smart contract; N ⁇ 1.
  • each group of smart contracts with dependencies will form a dependency tree with a root node and multiple leaf nodes. If there is no dependency relationship between any two smart contracts, the two smart contracts are located on two dependency trees respectively. In addition, every dependency tree has a root node, but not every dependency tree has leaf nodes. For example, if smart contract C1 does not rely on any other smart contracts, and no other smart contracts rely on smart contract C1, smart contract C1 alone forms a dependency tree, which has only a root node, corresponding to smart contract C1, without leaves node.
  • Step 204 For any dependency tree, from the leaf node of the dependency tree to the root node of the dependency tree, the smart contracts corresponding to each node are issued in sequence.
  • each leaf node of the built dependency tree corresponds to a smart contract object.
  • each smart contract can be converted into a java class. If in the construction method, it is constructed by matching the parameter name and the smart contract, so when it is released, the corresponding smart contract can be found by reflection and released dynamically.
  • the smart contract to be released is acquired, all smart contracts to be released are traversed, and the dependency relationship between the smart contracts is determined.
  • the dependency relationship build N dependency trees, where one node of the dependency tree corresponds to a smart contract, N ⁇ 1.
  • the smart contract corresponding to each node is issued in turn. Therefore, by building a dependency tree to release smart contracts, the tree is traversed to automatically and efficiently release smart contracts, without manually sorting out the release sequence, and without worrying about confusion, and improving the accuracy of smart contract release.
  • the method further includes:
  • the address parameter is used to indicate the smart contract called by the smart contract
  • the address parameter is standardized to determine the smart contract corresponding to the address parameter.
  • the construction method of the smart contract includes the address parameters of the smart contract called by the smart contract.
  • a section of the construction method of smart contract A1 is shown in the following code 1:
  • CptController is the smart contract name of smart contract A1
  • cptDataAddress is the address of smart contract A2
  • weIdContractAddress is the address of smart contract B1.
  • the construction method of smart contract A1 includes the address parameters of smart contract A2 and the address parameters of smart contract B1, then smart contract A1 calls smart contract A2 and smart contract B1.
  • smart contract A2 and smart contract B1 need to be released first, and after the addresses of smart contract A2 and smart contract B1 are determined, smart contract A1 is released.
  • smart contract A1 calls smart contract A2 and smart contract B1, and smart contract A2 and smart contract
  • the address parameters of B1 are standardized. There are two cases of standardization here. You can directly write the address parameters of the standardized smart contract during the construction of the smart contract A1; or, if the smart contract A1 is referenced, standardize the address parameters in the smart contract A1.
  • the standardization of address parameters can be to directly use the identifier of the smart contract as the address parameter, or to uniformly name the addresses of all smart contracts.
  • a dependency tree is established according to the dependency relationship.
  • sub-dependency trees can be established separately for different modules, and then multiple sub-dependency trees can be combined to form the final dependency tree; it is also possible to directly traverse the smart contracts in all modules and directly establish the dependency tree.
  • each module is traversed separately, and a sub-dependency tree of each smart contract is established for a module.
  • A1 depends on A2 and A3, and A3 depends on B1, B3, and C2
  • B1 depends on B2 and C2
  • the sub-dependency tree shown in Figure 3b is obtained.
  • the smart contract in module C the following dependencies exist.
  • the dependency tree 301 includes a root node and leaf nodes, and the dependency tree 302 only includes a root node.
  • the embodiment of the present invention directly traverses and publishes the dependency tree.
  • the step of publishing the smart contract corresponding to each node in turn from the leaf node of the dependency tree to the root node of the dependency tree includes:
  • the leaf nodes include A2, B2, B3, C2, and C3, and then the smart contracts A2, B2, B3, C2, and C3 are first issued.
  • the nodes A2, B2, B3, C2, and C3 in the dependency tree 301 are removed to obtain the dependency tree structure as shown in FIG. 3e.
  • its leaf node is C2, and since C2 has been released, C2 can be removed directly to obtain the dependency tree structure shown in Fig. 3f.
  • release B1, and remove B1 after the release is successful.
  • Republish A3, and remove A3 after successful publishing Finally, the root node A1 is left, and the root node A1 is released.
  • the root node can be used as the identifier of the dependency tree and saved. For example, for the dependency tree in Figure 3d, the root node A1 and the root node C1 are finally saved.
  • the method further includes:
  • the nodes in the dependency tree are updated.
  • the smart contracts in the module are added or deleted, or the dependencies between the smart contracts change, there is no need to rewrite the release code, only the nodes in the dependency tree need to be changed accordingly. For example, if a smart contract is deleted, the corresponding node in the dependency tree will be removed; if a smart contract is added, a node will be added to the corresponding position in the dependency tree; if the dependency relationship in the smart contract changes, the corresponding node in the dependency tree will be changed accordingly Arrow position and/or pointing. After that, execute the new dependency tree. This simplifies the release process of smart contracts and improves release efficiency.
  • Step 401 Obtain the smart contract to be released.
  • Step 402 Identify the address parameter called by the smart contract.
  • Step 403 Replace the address parameter with the smart contract name corresponding to the address parameter.
  • Step 404 Determine the dependencies among all smart contracts to be released.
  • Step 405 Establish N dependency trees according to the dependency relationship.
  • a node of the dependency tree corresponds to a smart contract.
  • Step 406 Publish the smart contract corresponding to the leaf node of the dependency tree.
  • Step 407 Remove the leaf nodes that successfully publish the smart contract from the dependency tree.
  • Step 408 Determine whether there is only a root node in the dependency tree, if yes, execute step 409; otherwise, execute step 406.
  • Step 409 Publish the smart contract corresponding to the root node, and save the root node.
  • the second embodiment is the release process after the smart contract is updated.
  • the steps are shown in Figure 5, including:
  • Step 501 Receive a smart contract change request.
  • Step 502 Obtain the corresponding dependency tree according to the smart contract change request, and update the nodes in the dependency tree.
  • Step 503 Publish the smart contract corresponding to the leaf node of the dependency tree.
  • Step 504 Remove the leaf nodes that successfully publish the smart contract from the dependency tree.
  • Step 505 Determine whether there is only a root node in the dependency tree, if yes, go to step 506, otherwise go to step 503.
  • Step 506 Publish the smart contract corresponding to the root node, and save the root node.
  • the embodiment of the present invention also provides a device for issuing smart contracts in a blockchain, as shown in FIG. 6, including:
  • the obtaining unit 601 is used to obtain the smart contract to be released;
  • the determining unit 602 is configured to traverse the smart contract to be released and determine the dependency relationship between the smart contract to be released;
  • the establishment unit 603 is configured to establish N dependency trees according to the dependency relationship, and one node of the dependency tree corresponds to a smart contract; N ⁇ 1;
  • the issuing unit 604 is configured to, for any dependency tree, start from the leaf node of the dependency tree to the root node of the dependency tree, and sequentially release the smart contract corresponding to each node.
  • the determining unit 602 is further configured to:
  • the address parameter is used to indicate the smart contract called by the smart contract
  • the address parameter is standardized to determine the smart contract corresponding to the address parameter.
  • the publishing unit 604 is specifically configured to:
  • the obtaining unit 601 is further configured to receive a smart contract change request
  • the establishing unit 603 is further configured to update the nodes in the dependency tree according to the smart contract change request.
  • the present invention also provides an electronic device, as shown in FIG. 7, including:
  • It includes a processor 701, a memory 702, a transceiver 703, and a bus interface 704, wherein the processor 701, the memory 702 and the transceiver 703 are connected through the bus interface 704;
  • the processor 701 is configured to read the program in the memory 702 and execute the method for issuing smart contracts in the above-mentioned blockchain; the method includes:
  • N dependency trees are established, and one node of the dependency tree corresponds to a smart contract; N ⁇ 1;
  • the smart contracts corresponding to each node are issued in sequence.
  • the processor 701 may be a central processing unit (central processing unit, CPU for short), a network processor (NP for short), or a combination of CPU and NP. It can also be a hardware chip.
  • the aforementioned hardware chip may be an application-specific integrated circuit (ASIC for short), a programmable logic device (PLD for short), or a combination thereof.
  • ASIC application-specific integrated circuit
  • PLD programmable logic device
  • the above-mentioned PLD can be a complex programmable logic device (complex programmable logic device, CPLD), a field-programmable gate array (FPGA), a generic array logic (generic array logic, GAL), or any of them combination.
  • the memory 702 is configured to store one or more executable programs, and can store data used by the processor 701 when performing operations.
  • the program may include program code, and the program code includes computer operation instructions.
  • the memory 702 may include a volatile memory (volatile memory), such as random-access memory (random-access memory, RAM for short); the memory 702 may also include a non-volatile memory (non-volatile memory), such as flash memory ( flash memory), hard disk drive (HDD for short) or solid-state drive (SSD for short); the memory 702 may also include a combination of the foregoing types of memories.
  • the memory 702 stores the following elements, executable modules or data structures, or their subsets, or their extended sets:
  • Operating instructions including various operating instructions, used to implement various operations.
  • Operating system including various system programs, used to implement various basic services and process hardware-based tasks.
  • the bus interface 704 may be a wired communication access port, a wireless bus interface or a combination thereof, where the wired bus interface may be, for example, an Ethernet interface.
  • the Ethernet interface can be an optical interface, an electrical interface or a combination thereof.
  • the wireless bus interface may be a WLAN interface.
  • the embodiments of the present invention also provide a non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to make the computer execute the above The method of issuing smart contracts in the blockchain.
  • the embodiment of the present invention also provides a computer program product containing instructions, which when running on a computer, causes the computer to execute the method for issuing smart contracts in the blockchain.
  • These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device.
  • the device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
  • These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment.
  • the instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

A method and device for publishing smart contracts in a block chain, used for improving the publishing efficiency and accuracy of the smart contracts. The method comprises: obtaining smart contracts to be published (201); traversing said smart contracts, and determining a dependency relationship between said smart contracts (202); establishing N dependency trees according to the dependency relationship, wherein one node of each dependency tree corresponds to one smart contract and N≥1 (203); and for any dependency tree, starting from a leaf node of the dependency tree to a root node of the dependency tree, publishing the smart contract corresponding to each node in sequence (204).

Description

一种区块链中智能合约的发布方法及装置Method and device for issuing smart contracts in blockchain
相关申请的交叉引用Cross references to related applications
本申请要求在2019年05月07日提交中国专利局、申请号为201910373705.0、申请名称为“一种区块链中智能合约的发布方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201910373705.0, and the application name is "a method and device for issuing smart contracts in the blockchain" on May 7, 2019. The entire content of the application is approved The reference is incorporated in this application.
技术领域Technical field
本发明涉及金融科技(Fintech)领域,尤其涉及一种区块链中智能合约的发布方法及装置。The present invention relates to the field of financial technology (Fintech), in particular to a method and device for issuing smart contracts in a blockchain.
背景技术Background technique
随着计算机技术的发展,越来越多的技术应用在金融领域,传统金融业正在逐步向金融科技(Finteh)转变,区块链(Block chain)技术也不例外,但由于金融行业的安全性、实时性要求,也对技术提出的更高的要求。With the development of computer technology, more and more technologies are applied in the financial field. The traditional financial industry is gradually changing to Finteh. Blockchain technology is no exception, but due to the security of the financial industry , Real-time requirements, but also higher requirements for technology.
智能合约(Smart contract)是一种旨在以信息化方式传播、验证或执行合同的计算机协议,其执行过程以交易的形式在区块链上共识、确认。智能合约允许在没有第三方的情况下进行可信交易,这些交易可追踪且不可逆转。Smart contract (Smart contract) is a computer protocol designed to spread, verify, or execute a contract in an information-based way. The execution process is consensus and confirmation on the blockchain in the form of transactions. Smart contracts allow trusted transactions without a third party, which are traceable and irreversible.
智能合约为一种运行在区块链上的代码片段,需要发布到区块链上,才能运行。现有区块链的一个应用项目根据功能设置多个模块,每个模块根据功能又会划分为几个数据结构,所有功能均利用智能合约实现,运行在区块链上。A smart contract is a piece of code that runs on the blockchain and needs to be published on the blockchain before it can run. An application project of the existing blockchain sets up multiple modules according to functions, and each module is divided into several data structures according to functions. All functions are implemented by smart contracts and run on the blockchain.
目前对于每个智能合约的发布都需要单独写发布代码,如果智能合约有更新,之前写的发布代码需要重新编写,并重新整理智能合约之间的依赖关系,耗时耗力。At present, for the release of each smart contract, a separate release code needs to be written. If the smart contract is updated, the previously written release code needs to be rewritten, and the dependencies between the smart contracts need to be rearranged, which is time-consuming and labor-intensive.
发明内容Summary of the invention
本申请提供一种区块链中智能合约的发布方法及装置,用以提高智能合约的发布效率和准确率。This application provides a method and device for issuing smart contracts in a blockchain to improve the efficiency and accuracy of smart contract issuance.
本发明实施例提供的一种区块链中智能合约的发布方法,包括:An embodiment of the present invention provides a method for issuing smart contracts in a blockchain, including:
获取待发布的智能合约;Obtain the smart contract to be released;
遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系;Traverse the smart contracts to be released, and determine the dependencies between the smart contracts to be released;
依据所述依赖关系,建立N个依赖树,所述依赖树的一个节点对应一个智能合约;N≥1;According to the dependency relationship, N dependency trees are established, and one node of the dependency tree corresponds to a smart contract; N≥1;
针对任一依赖树,从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约。For any dependency tree, starting from the leaf nodes of the dependency tree and ending with the root node of the dependency tree, the smart contracts corresponding to each node are issued in sequence.
一种可选的实施例中,所述遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系之前,还包括:In an optional embodiment, before the traversing the smart contracts to be released and determining the dependencies between the smart contracts to be released, the method further includes:
针对任一智能合约,执行以下步骤:For any smart contract, perform the following steps:
识别所述智能合约调用的地址参数;所述地址参数用于指示所述智能合约调用的智能合约;Identifying the address parameter called by the smart contract; the address parameter is used to indicate the smart contract called by the smart contract;
将所述地址参数标准化,以确定所述地址参数对应的智能合约。The address parameter is standardized to determine the smart contract corresponding to the address parameter.
一种可选的实施例中,所述从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约,包括:In an optional embodiment, starting from the leaf node of the dependency tree to the root node of the dependency tree, successively publishing the smart contract corresponding to each node includes:
对所述依赖树的叶子节点对应的智能合约进行发布;Publish the smart contract corresponding to the leaf node of the dependency tree;
将智能合约发布成功的叶子节点从所述依赖树中移除;Remove the leaf nodes that successfully publish the smart contract from the dependency tree;
重复对所述依赖树的叶子节点对应的智能合约进行发布的步骤,直至所述依赖树中只存在根节点;Repeat the step of publishing the smart contract corresponding to the leaf node of the dependency tree until only the root node exists in the dependency tree;
对所述根节点对应的智能合约进行发布。Publish the smart contract corresponding to the root node.
一种可选的实施例中,所述依据所述依赖关系,建立N个依赖树之后,还包括:In an optional embodiment, after establishing N dependency trees according to the dependency relationship, the method further includes:
接收智能合约变更请求;Receive smart contract change request;
根据所述智能合约变更请求,更新依赖树中的节点。According to the smart contract change request, the nodes in the dependency tree are updated.
本发明实施例还提供一种区块链中智能合约的发布装置,包括:The embodiment of the present invention also provides a device for issuing smart contracts in the blockchain, including:
获取单元,用于获取待发布的智能合约;The obtaining unit is used to obtain the smart contract to be released;
确定单元,用于遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系;The determining unit is configured to traverse the smart contract to be released and determine the dependency relationship between the smart contract to be released;
建立单元,用于依据所述依赖关系,建立N个依赖树,所述依赖树的一个节点对应一个智能合约;N≥1;The establishment unit is configured to establish N dependency trees according to the dependency relationship, and one node of the dependency tree corresponds to a smart contract; N≥1;
发布单元,用于针对任一依赖树,从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约。The publishing unit is used for publishing the smart contract corresponding to each node in sequence from the leaf node of the dependent tree to the root node of the dependent tree for any dependent tree.
一种可选的实施例中,所述确定单元,还用于:In an optional embodiment, the determining unit is further configured to:
针对任一智能合约,执行以下步骤:For any smart contract, perform the following steps:
识别所述智能合约调用的地址参数;所述地址参数用于指示所述智能合约调用的智能合约;Identifying the address parameter called by the smart contract; the address parameter is used to indicate the smart contract called by the smart contract;
将所述地址参数标准化,以确定所述地址参数对应的智能合约。The address parameter is standardized to determine the smart contract corresponding to the address parameter.
一种可选的实施例中,所述发布单元,具体用于:In an optional embodiment, the publishing unit is specifically configured to:
对所述依赖树的叶子节点对应的智能合约进行发布;Publish the smart contract corresponding to the leaf node of the dependency tree;
将智能合约发布成功的叶子节点从所述依赖树中移除;Remove the leaf nodes that successfully publish the smart contract from the dependency tree;
重复对所述依赖树的叶子节点对应的智能合约进行发布的步骤,直至所述依赖树中只存在根节点;Repeat the step of publishing the smart contract corresponding to the leaf node of the dependency tree until only the root node exists in the dependency tree;
对所述根节点对应的智能合约进行发布。Publish the smart contract corresponding to the root node.
一种可选的实施例中,所述获取单元,还用于接收智能合约变更请求;In an optional embodiment, the acquiring unit is further configured to receive a smart contract change request;
所述建立单元,还用于根据所述智能合约变更请求,更新依赖树中的节点。The establishment unit is also used to update the nodes in the dependency tree according to the smart contract change request.
本发明实施例还提供一种电子设备,包括:The embodiment of the present invention also provides an electronic device, including:
至少一个处理器;以及,At least one processor; and,
与所述至少一个处理器通信连接的存储器;其中,A memory communicatively connected with the at least one processor; wherein,
所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所 述至少一个处理器执行,以使所述至少一个处理器能够执行如上所述的区块链中智能合约的发布方法。The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the smart contract in the blockchain as described above. Publishing method.
本发明实施例还提供一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行如上所述的区块链中智能合约的发布方法。The embodiment of the present invention also provides a non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to make the computer execute the above-mentioned blockchain How to release smart contracts.
本发明实施例还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述区块链中智能合约的发布方法。The embodiment of the present invention also provides a computer program product containing instructions, which when running on a computer, causes the computer to execute the method for issuing smart contracts in the above-mentioned blockchain.
本发明实施例中,获取待发布的智能合约,遍历所有待发布的智能合约,确定智能合约之间的依赖关系。依据依赖关系,建立N个依赖树,其中依赖树的一个节点对应一个智能合约,N≥1。针对任一依赖树,从该依赖树的叶子节点开始,直至该依赖树的根节点,依次发布各节点对应的智能合约。从而,通过构建依赖树发布智能合约,以树的遍历来自动和高效的发布智能合约,不需要人工整理发布顺序,不担心错乱,提高了智能合约发布准确率。此外,若有智能合约更新或智能合约之间的依赖关系变更,无需重复编写代码,只需改变依赖树中的节点或者节点顺序,重新构造一个新的依赖树,并重新执行一次发布遍历依赖树即可,从而极大的简化了智能合约的发布流程,提高了发布效率。In the embodiment of the present invention, the smart contract to be released is acquired, all smart contracts to be released are traversed, and the dependency relationship between the smart contracts is determined. According to the dependency relationship, build N dependency trees, where one node of the dependency tree corresponds to a smart contract, N≥1. For any dependency tree, from the leaf node of the dependency tree to the root node of the dependency tree, the smart contract corresponding to each node is issued in turn. Therefore, by building a dependency tree to release smart contracts, the tree is traversed to automatically and efficiently release smart contracts, without manually sorting out the release sequence, and without worrying about confusion, and improving the accuracy of smart contract release. In addition, if there is a smart contract update or a dependency change between smart contracts, there is no need to rewrite the code, just change the nodes in the dependency tree or the order of the nodes, reconstruct a new dependency tree, and re-execute the release to traverse the dependency tree That is, it greatly simplifies the release process of smart contracts and improves release efficiency.
附图说明Description of the drawings
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly describe the technical solutions in the embodiments of the present invention, the following will briefly introduce the drawings needed in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings may be obtained from these drawings without creative labor.
图1为本发明实施例提供的一种区块链的应用项目的结构示意图;FIG. 1 is a schematic structural diagram of a blockchain application project provided by an embodiment of the present invention;
图2为本发明实施例提供的一种区块链中智能合约的发布方法的流程示意图;2 is a schematic flowchart of a method for issuing smart contracts in a blockchain according to an embodiment of the present invention;
图3a-图3f为本发明实施例提供的依赖树建立过程中的结构示意图;3a to 3f are schematic diagrams of the structure of the dependency tree establishment process provided by the embodiment of the present invention;
图4为本发明具体实施例一提供的智能合约的发布过程的流程示意图;FIG. 4 is a schematic flowchart of the issuance process of a smart contract provided by a specific embodiment of the present invention;
图5为本发明具体实施例二提供的智能合约更新后的发布过程的流程示意图;FIG. 5 is a schematic flowchart of the issuance process after the update of the smart contract according to the second embodiment of the present invention;
图6为本发明实施例提供的一种区块链中智能合约的发布装置的结构示意图;6 is a schematic structural diagram of a device for issuing smart contracts in a blockchain according to an embodiment of the present invention;
图7为本发明实施例提供的电子设备的结构示意图。FIG. 7 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention.
具体实施方式Detailed ways
为了使本发明的目的、技术方案和优点更加清楚,下面将结合附图对本发明作进一步地详细描述,显然,所描述的实施例仅仅是本发明一部份实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments. . Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
为了便于理解,下面对本发明实施例中可能涉及的名词进行定义和解释。For ease of understanding, the following defines and explains the terms that may be involved in the embodiments of the present invention.
区块链:是由一系列区块组成的一条链,每个块上除了记录本块的数据还会记录上一块的Hash(哈希)值,通过这种方式组成一条链。区块链的核心理念有两个,一个是密码学技术,另一个是去中心化思想,基于这两个理念做到区块链上的历史信息无法被篡改。一个区块由块头和块体组成,其中块头定义包括该区块高度h,上一个区块的Hash值prevHash等重要字段,而块体主要存储交易数据。Blockchain: A chain composed of a series of blocks. In addition to recording the data of the block, each block also records the Hash value of the previous block. In this way, a chain is formed. There are two core concepts of the blockchain, one is cryptography and the other is decentralization. Based on these two concepts, the historical information on the blockchain cannot be tampered with. A block consists of a block header and a block body. The block header definition includes important fields such as the block height h, the hash value prevHash of the previous block, and the block body mainly stores transaction data.
智能合约:一种可以运行在区块链上的代码片段,智能合约的执行过程会以交易的形式在区块链上共识、确认。Smart contract: A piece of code that can be run on the blockchain. The execution process of the smart contract will be agreed and confirmed on the blockchain in the form of transactions.
共识:一种区块链各节点对某个交易的正确性达成一致的算法。Consensus: An algorithm in which each node of the blockchain agrees on the correctness of a transaction.
web3j:使用HTTP(超文本传输协议,Hyper Text Transfer Protocol)或IPC(进程间通信,Inter-Process Communication)连接与本地或远程以太坊节点交互的库集合。web3j: A collection of libraries that uses HTTP (Hyper Text Transfer Protocol) or IPC (Inter-Process Communication) to connect with local or remote Ethereum nodes.
WeIdentiy:一套分布式多中心的技术解决方案,可承载实体对象(人或 者物)的现实身份与链上身份的可信映射、以及实现实体对象之间安全的访问授权与数据交换。WeIdentiy: A set of distributed multi-center technical solutions that can carry the trusted mapping between the actual identity of the entity object (person or thing) and the identity on the chain, and realize the secure access authorization and data exchange between entity objects.
Solidity:一种智能合约高级语言,运行在以太坊虚拟机(EVM)之上。Solidity: A high-level language for smart contracts that runs on the Ethereum Virtual Machine (EVM).
java:一门面向对象的编程语言,用以编写桌面应用程序、Web应用程序、分布式***和嵌入式***应用程序等。java: An object-oriented programming language for writing desktop applications, web applications, distributed systems, and embedded system applications.
如图1所示,本发明实施例所适用的一种应用场景中,一个区块链的应用项目根据功能分成三个模块,分别为模块A、模块B和模块C。每个模块又根据功能分成多个数据结构,例如,模块A分成了A1、A2、A3三个数据结构,模块B分成了B1、B2、B3三个数据结构,模块C分成了C1、C2、C3三个数据结构,所有这些数据结构均分别利用智能合约实现,运行在区块链上,记为智能合约A1、智能合约B1等。As shown in FIG. 1, in an application scenario to which the embodiment of the present invention is applicable, a blockchain application project is divided into three modules according to functions, namely module A, module B, and module C. Each module is divided into multiple data structures according to functions. For example, module A is divided into three data structures A1, A2, and A3, module B is divided into three data structures B1, B2, and B3, and module C is divided into three data structures C1, C2, and C2. C3 has three data structures, all of which are implemented using smart contracts, run on the blockchain, and are denoted as smart contract A1, smart contract B1, etc.
现有技术中,Solidity编写的智能合约的发布方式是通过调用web3j的接口发布。针对如图1的应用场景,通用的发布过程如下:In the prior art, the smart contract written by Solidity is released by calling the web3j interface. For the application scenario shown in Figure 1, the general release process is as follows:
步骤一:按模块A、模块B、模块C分别进行发布。假设发布模块A,从智能合约A1开始,检查智能合约A1的构造方法中的参数,传入参数,调用web3j的接口发布。如果智能合约A1的参数中包含了其他的智能合约,例如智能合约A1的参数中包含有智能合约A2和智能合约B3的地址参数,那么就需要按先发布智能合约A2和智能合约B3,然后再发布智能合约A1。Step 1: Press module A, module B, and module C to release. Assume that module A is released, starting from smart contract A1, checking the parameters in the construction method of smart contract A1, passing in the parameters, and calling the web3j interface to publish. If the parameters of smart contract A1 include other smart contracts, for example, the parameters of smart contract A1 include the address parameters of smart contract A2 and smart contract B3, then you need to publish smart contract A2 and smart contract B3 first, and then Release smart contract A1.
步骤二:每个智能合约按照步骤一检查构造方法中的参数之后,编写发布代码进行发布,直至所有模块均发布完成。Step 2: After each smart contract checks the parameters in the construction method according to step 1, write the release code for release until all modules are released.
步骤三:最后将智能合约的地址保存下来,即完成发布。Step 3: Finally, save the address of the smart contract to complete the release.
如果后续遇到智能合约的更新或者依赖关系的变化,需要重新调整发布代码,并且按照上述步骤重新发布。If you encounter updates to smart contracts or changes in dependencies in the future, you need to re-adjust the release code and re-release according to the above steps.
为了解决上述现有技术中的问题,本发明实施例提供了一种区块链中智能合约的发布方法,如图2所示,本发明实施例提供的区块链中智能合约的发布方法包括以下步骤:In order to solve the above-mentioned problems in the prior art, an embodiment of the present invention provides a method for issuing smart contracts in a blockchain. As shown in FIG. 2, the method for issuing smart contracts in a blockchain provided by the embodiment of the present invention includes The following steps:
步骤201、获取待发布的智能合约。Step 201: Obtain a smart contract to be released.
步骤202、遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系。Step 202: Traverse the smart contract to be released, and determine the dependency relationship between the smart contract to be released.
具体遍历过程中,按每个智能合约的构造方法,动态识别智能合约中的地址参数,并根据地址参数确定依赖关系。例如智能合约A1的构造方法中包含智能合约A2的地址参数,则认为智能合约A1依赖智能合约A2。In the specific traversal process, according to the construction method of each smart contract, the address parameters in the smart contract are dynamically identified, and the dependency relationship is determined according to the address parameters. For example, if the construction method of smart contract A1 includes the address parameter of smart contract A2, it is considered that smart contract A1 depends on smart contract A2.
步骤203、依据所述依赖关系,建立N个依赖树,所述依赖树的一个节点对应一个智能合约;N≥1。Step 203: Establish N dependency trees according to the dependency relationship, and one node of the dependency tree corresponds to one smart contract; N≥1.
上述步骤根据智能合约之间的依赖关系,动态构建了多组树形结构的依赖关系,每一组具有依赖关系的智能合约将形成有一个根节点和多个叶子节点的依赖树。若任两个智能合约之间不存在依赖关系,则这两个智能合约分别位于两个依赖树上。此外,每个依赖树都具有一个根节点,但不是每棵依赖树都具有叶子节点。例如,若智能合约C1没有依赖任何其它智能合约,也没有别的智能合约依赖智能合约C1,则智能合约C1单独形成一个依赖树,该依赖树只具有根节点,对应于智能合约C1,没有叶子节点。The above steps dynamically construct multiple sets of tree-structured dependencies based on the dependencies between smart contracts, and each group of smart contracts with dependencies will form a dependency tree with a root node and multiple leaf nodes. If there is no dependency relationship between any two smart contracts, the two smart contracts are located on two dependency trees respectively. In addition, every dependency tree has a root node, but not every dependency tree has leaf nodes. For example, if smart contract C1 does not rely on any other smart contracts, and no other smart contracts rely on smart contract C1, smart contract C1 alone forms a dependency tree, which has only a root node, corresponding to smart contract C1, without leaves node.
步骤204、针对任一依赖树,从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约。Step 204: For any dependency tree, from the leaf node of the dependency tree to the root node of the dependency tree, the smart contracts corresponding to each node are issued in sequence.
具体来说,动态构造完依赖树之后,所构建的依赖树的每个叶子节点都对应于一个智能合约对象。假设采用web3j的java版本来进行智能合约发布,那么每个智能合约都可以转换成一个java类。若在构造方法里是通过参数名和智能合约匹配的方式构造,因此,在发布的时候然后可以以反射的方式找到对应的智能合约,动态的发布。Specifically, after the dependency tree is dynamically constructed, each leaf node of the built dependency tree corresponds to a smart contract object. Assuming that the java version of web3j is used for smart contract publishing, then each smart contract can be converted into a java class. If in the construction method, it is constructed by matching the parameter name and the smart contract, so when it is released, the corresponding smart contract can be found by reflection and released dynamically.
本发明实施例中,获取待发布的智能合约,遍历所有待发布的智能合约,确定智能合约之间的依赖关系。依据依赖关系,建立N个依赖树,其中依赖树的一个节点对应一个智能合约,N≥1。针对任一依赖树,从该依赖树的叶子节点开始,直至该依赖树的根节点,依次发布各节点对应的智能合约。从而,通过构建依赖树发布智能合约,以树的遍历来自动和高效的发布智能合约,不需要人工整理发布顺序,不担心错乱,提高了智能合约发布准确率。此外, 若有智能合约更新或智能合约之间的依赖关系变更,无需重复编写代码,只需改变依赖树中的节点或者节点顺序,重新构造一个新的依赖树,并重新执行一次发布遍历依赖树即可,从而极大的简化了智能合约的发布流程,提高了发布效率。In the embodiment of the present invention, the smart contract to be released is acquired, all smart contracts to be released are traversed, and the dependency relationship between the smart contracts is determined. According to the dependency relationship, build N dependency trees, where one node of the dependency tree corresponds to a smart contract, N≥1. For any dependency tree, from the leaf node of the dependency tree to the root node of the dependency tree, the smart contract corresponding to each node is issued in turn. Therefore, by building a dependency tree to release smart contracts, the tree is traversed to automatically and efficiently release smart contracts, without manually sorting out the release sequence, and without worrying about confusion, and improving the accuracy of smart contract release. In addition, if there is a smart contract update or a dependency change between smart contracts, there is no need to rewrite the code, just change the nodes in the dependency tree or the order of the nodes, reconstruct a new dependency tree, and re-execute the release to traverse the dependency tree That is, it greatly simplifies the release process of smart contracts and improves release efficiency.
为了保证有效建立智能合约之间的依赖关系,所述遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系之前,还包括:In order to ensure that the dependency relationship between smart contracts is effectively established, before the traversing the smart contract to be released and determining the dependency relationship between the smart contracts to be released, the method further includes:
针对任一智能合约,执行以下步骤:For any smart contract, perform the following steps:
识别所述智能合约调用的地址参数;所述地址参数用于指示所述智能合约调用的智能合约;Identifying the address parameter called by the smart contract; the address parameter is used to indicate the smart contract called by the smart contract;
将所述地址参数标准化,以确定所述地址参数对应的智能合约。The address parameter is standardized to determine the smart contract corresponding to the address parameter.
具体来说,智能合约的构造方法中包含该智能合约调用的智能合约的地址参数。举例来说,智能合约A1的构造方法的一段内容如下代码1所示:Specifically, the construction method of the smart contract includes the address parameters of the smart contract called by the smart contract. For example, a section of the construction method of smart contract A1 is shown in the following code 1:
Figure PCTCN2020081871-appb-000001
Figure PCTCN2020081871-appb-000001
其中,CptController为智能合约A1的智能合约名,cptDataAddress为智能合约A2的地址,weIdContractAddress为智能合约B1的地址。智能合约A1的构造方法中包含智能合约A2的地址参数以及智能合约B1的地址参数,则智能合约A1调用智能合约A2以及智能合约B1。则在现有技术中,需先发布智能合约A2以及智能合约B1,确定智能合约A2与智能合约B1的地址后,再发布智能合约A1。而本发明实施例中,无需先发布智能合约A2与智能合约B1,而是从智能合约A1的构造方法中确定智能合约A1调用了智能合约A2以及智能合约B1,并将智能合约A2以及智能合约B1的地址参数标准化。这里的标准化可以有两种情况,可以在智能合约A1构造的过程中,直接将标准化的智能合约的地址参数写入;或者,若是引用智能合约A1,则将智能合约A1中的地址参数标准化。这里,地址参数标准化可以是直接将智能合约的 标识作为地址参数,或者将所有智能合约的地址统一命名格式。例如,将上述代码中智能合约A1、智能合约A2、智能合约B1分别命名为A1、A2和B1,再将智能合约A1引用的地址参数分别改为A2和B1,则上述代码1可改写成如下代码2的形式:Among them, CptController is the smart contract name of smart contract A1, cptDataAddress is the address of smart contract A2, and weIdContractAddress is the address of smart contract B1. The construction method of smart contract A1 includes the address parameters of smart contract A2 and the address parameters of smart contract B1, then smart contract A1 calls smart contract A2 and smart contract B1. In the prior art, smart contract A2 and smart contract B1 need to be released first, and after the addresses of smart contract A2 and smart contract B1 are determined, smart contract A1 is released. However, in the embodiment of the present invention, there is no need to publish smart contract A2 and smart contract B1 first. Instead, it is determined from the construction method of smart contract A1 that smart contract A1 calls smart contract A2 and smart contract B1, and smart contract A2 and smart contract The address parameters of B1 are standardized. There are two cases of standardization here. You can directly write the address parameters of the standardized smart contract during the construction of the smart contract A1; or, if the smart contract A1 is referenced, standardize the address parameters in the smart contract A1. Here, the standardization of address parameters can be to directly use the identifier of the smart contract as the address parameter, or to uniformly name the addresses of all smart contracts. For example, if smart contract A1, smart contract A2, and smart contract B1 in the above code are named A1, A2, and B1, respectively, and then the address parameters referenced by smart contract A1 are changed to A2 and B1, the above code 1 can be rewritten as follows The form of code 2:
Figure PCTCN2020081871-appb-000002
Figure PCTCN2020081871-appb-000002
这里是将智能合约的标识作为地址参数来引用。或者,也可以为每个智能合约的地址设置统一格式的标识,例如,将智能合约A2的地址设置标识为Aeee,将智能合约B2的地址设置标识为Beee,则上述代码1可以改写成如下代码3的形式:Here is to reference the smart contract's identifier as an address parameter. Or, you can set a uniform format for the address of each smart contract. For example, if the address setting of smart contract A2 is marked as Aeee, and the address setting of smart contract B2 is marked as Beee, the above code 1 can be rewritten as the following code Form of 3:
Figure PCTCN2020081871-appb-000003
Figure PCTCN2020081871-appb-000003
当然,也可以利用其它方式将地址参数标准化,这里不做限制。Of course, other methods can also be used to standardize the address parameters, and there is no restriction here.
根据智能合约调用的地址参数确定智能合约之间的依赖关系之后,根据依赖关系建立依赖树。After determining the dependency relationship between smart contracts according to the address parameters called by the smart contract, a dependency tree is established according to the dependency relationship.
一种具体的构建过程中,可以针对不同的模块分别建立子依赖树,再将多个子依赖树结合形成最终的依赖树;也可以直接遍历所有模块中智能合约,直接建立依赖树。In a specific construction process, sub-dependency trees can be established separately for different modules, and then multiple sub-dependency trees can be combined to form the final dependency tree; it is also possible to directly traverse the smart contracts in all modules and directly establish the dependency tree.
下面举例来说明,为了便于描述,举例中的智能合约A1用A1表示,其它描述类似。一种具体的示例中,分别遍历每一个模块,针对一个模块建立每个智能合约的子依赖树。对于图1模块A中的智能合约,若存在以下依赖关系,A1依赖于A2和A3,且A3依赖于B1、B3和C2,则利用节点代表智能合约,利用箭头代表智能合约之间的依赖关系,得到如图3a所示的子依赖 树。对于模块B中的智能合约,存在以下依赖关系,B1依赖于B2和C2,则得到如图3b所示的子依赖树。对于模块C中的智能合约,存在以下依赖关系,C2依赖于C3,则得到如图3c的子依赖树。最后,将图3a至图3c中的子依赖树结合,形成如图3d所示的两棵依赖树301和依赖树302。其中,依赖树301包含有根节点和叶子节点,依赖树302只包含根节点。The following is an example to illustrate. For ease of description, the smart contract A1 in the example is represented by A1, and other descriptions are similar. In a specific example, each module is traversed separately, and a sub-dependency tree of each smart contract is established for a module. For the smart contract in module A in Figure 1, if the following dependencies exist, A1 depends on A2 and A3, and A3 depends on B1, B3, and C2, then use nodes to represent smart contracts, and arrows to represent dependencies between smart contracts , Get the sub-dependency tree shown in Figure 3a. For the smart contract in module B, the following dependencies exist. B1 depends on B2 and C2, and the sub-dependency tree shown in Figure 3b is obtained. For the smart contract in module C, the following dependencies exist. C2 depends on C3, and the sub-dependency tree shown in Figure 3c is obtained. Finally, the sub-dependency trees in Figs. 3a to 3c are combined to form two dependency trees 301 and dependency trees 302 as shown in Fig. 3d. Among them, the dependency tree 301 includes a root node and leaf nodes, and the dependency tree 302 only includes a root node.
针对上述得到的依赖树,本发明实施例直接对依赖树进行遍历和发布。所述从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约,包括:For the dependency tree obtained above, the embodiment of the present invention directly traverses and publishes the dependency tree. The step of publishing the smart contract corresponding to each node in turn from the leaf node of the dependency tree to the root node of the dependency tree includes:
对所述依赖树的叶子节点对应的智能合约进行发布;Publish the smart contract corresponding to the leaf node of the dependency tree;
将智能合约发布成功的叶子节点从所述依赖树中移除;Remove the leaf nodes that successfully publish the smart contract from the dependency tree;
重复对所述依赖树的叶子节点对应的智能合约进行发布的步骤,直至所述依赖树中只存在根节点;Repeat the step of publishing the smart contract corresponding to the leaf node of the dependency tree until only the root node exists in the dependency tree;
对所述根节点对应的智能合约进行发布。Publish the smart contract corresponding to the root node.
以发布图3d中的依赖树301为例进行说明。对于依赖树301而言,叶子节点包括A2、B2、B3、C2和C3,则首先对智能合约A2、B2、B3、C2和C3进行发布。发布完成后,将依赖树301中的节点A2、B2、B3、C2和C3移除,得到如图3e所示的依赖树结构。对于图3e中的依赖树,其叶子节点为C2,又由于C2已发布,所以可以直接将C2移除,得到如图3f所示的依赖树结构。对于图3f中的依赖树继续处理,发布B1,并在发布成功后将B1移除。再发布A3,并在发布成功后将A3移除。最后剩下根节点A1,并将根节点A1进行发布。Take the release of the dependency tree 301 in FIG. 3d as an example for description. For the dependency tree 301, the leaf nodes include A2, B2, B3, C2, and C3, and then the smart contracts A2, B2, B3, C2, and C3 are first issued. After the release is completed, the nodes A2, B2, B3, C2, and C3 in the dependency tree 301 are removed to obtain the dependency tree structure as shown in FIG. 3e. For the dependency tree in Fig. 3e, its leaf node is C2, and since C2 has been released, C2 can be removed directly to obtain the dependency tree structure shown in Fig. 3f. Continue processing for the dependency tree in Figure 3f, release B1, and remove B1 after the release is successful. Republish A3, and remove A3 after successful publishing. Finally, the root node A1 is left, and the root node A1 is released.
特殊地,对于依赖树302,由于只包含根节点,因此,只需将根节点对应的智能合约C1进行发布即可。In particular, for the dependency tree 302, since only the root node is included, it is only necessary to publish the smart contract C1 corresponding to the root node.
最后,可以将根节点作为依赖树的标识,进行保存。例如,对于图3d中的依赖树,最终保存根节点A1和根节点C1。Finally, the root node can be used as the identifier of the dependency tree and saved. For example, for the dependency tree in Figure 3d, the root node A1 and the root node C1 are finally saved.
本发明实施例中,每次发布智能合约,均构造依赖树,并对依赖树进行调用发布。若智能合约有更新和增减,也无需重新编写智能合约的发布代码。 所述依据所述依赖关系,建立N个依赖树之后,还包括:In the embodiment of the present invention, every time a smart contract is released, a dependency tree is constructed, and the dependency tree is invoked and released. If there are updates and additions to the smart contract, there is no need to rewrite the release code of the smart contract. After establishing N dependency trees based on the dependency relationship, the method further includes:
接收智能合约变更请求;Receive smart contract change request;
根据所述智能合约变更请求,更新依赖树中的节点。According to the smart contract change request, the nodes in the dependency tree are updated.
具体实施过程中,当模块中的智能合约有增加或删减,或者智能合约之间的依赖关系改变时,无需重新编写发布代码,只需要将依赖树中的节点进行相应变更。例如,若删除智能合约,则将依赖树中对应的节点移除;若增加智能合约,则将依赖树中对应位置增加节点;若智能合约中的依赖关系发生改变,则相应改变依赖树中的箭头位置和/或指向。之后,再执行新的依赖树即可。从而简化了智能合约的发布流程,提高了发布效率。In the specific implementation process, when the smart contracts in the module are added or deleted, or the dependencies between the smart contracts change, there is no need to rewrite the release code, only the nodes in the dependency tree need to be changed accordingly. For example, if a smart contract is deleted, the corresponding node in the dependency tree will be removed; if a smart contract is added, a node will be added to the corresponding position in the dependency tree; if the dependency relationship in the smart contract changes, the corresponding node in the dependency tree will be changed accordingly Arrow position and/or pointing. After that, execute the new dependency tree. This simplifies the release process of smart contracts and improves release efficiency.
为了更清楚地理解本发明,下面以具体实施例对上述流程进行详细描述,具体实施例一为智能合约的发布过程,步骤如图4所示,包括:In order to understand the present invention more clearly, the above process will be described in detail with specific embodiments below. Specific embodiment one is the issuance process of a smart contract. The steps are shown in Figure 4 and include:
步骤401:获取待发布的智能合约。Step 401: Obtain the smart contract to be released.
步骤402:识别智能合约调用的地址参数。Step 402: Identify the address parameter called by the smart contract.
步骤403:利用地址参数对应的智能合约名替换地址参数。Step 403: Replace the address parameter with the smart contract name corresponding to the address parameter.
步骤404:确定所有待发布的智能合约之间的依赖关系。Step 404: Determine the dependencies among all smart contracts to be released.
步骤405:依据依赖关系,建立N个依赖树。依赖树的一个节点对应一个智能合约。Step 405: Establish N dependency trees according to the dependency relationship. A node of the dependency tree corresponds to a smart contract.
步骤406:对依赖树的叶子节点对应的智能合约进行发布。Step 406: Publish the smart contract corresponding to the leaf node of the dependency tree.
步骤407:将智能合约发布成功的叶子节点从依赖树中移除。Step 407: Remove the leaf nodes that successfully publish the smart contract from the dependency tree.
步骤408:判断依赖树中是否只存在根节点,若是,则执行步骤409,否则执行步骤406。Step 408: Determine whether there is only a root node in the dependency tree, if yes, execute step 409; otherwise, execute step 406.
步骤409:对根节点对应的智能合约进行发布,并将该根节点进行保存。Step 409: Publish the smart contract corresponding to the root node, and save the root node.
具体实施例二为智能合约更新后的发布过程,步骤如图5所示,包括:The second embodiment is the release process after the smart contract is updated. The steps are shown in Figure 5, including:
步骤501:接收智能合约变更请求。Step 501: Receive a smart contract change request.
步骤502:根据智能合约变更请求,获取对应的依赖树,并更新依赖树中的节点。Step 502: Obtain the corresponding dependency tree according to the smart contract change request, and update the nodes in the dependency tree.
步骤503:对依赖树的叶子节点对应的智能合约进行发布。Step 503: Publish the smart contract corresponding to the leaf node of the dependency tree.
步骤504:将智能合约发布成功的叶子节点从依赖树中移除。Step 504: Remove the leaf nodes that successfully publish the smart contract from the dependency tree.
步骤505:判断依赖树中是否只存在根节点,若是,则执行步骤506,否则执行步骤503。Step 505: Determine whether there is only a root node in the dependency tree, if yes, go to step 506, otherwise go to step 503.
步骤506:对根节点对应的智能合约进行发布,并将该根节点进行保存。Step 506: Publish the smart contract corresponding to the root node, and save the root node.
本发明实施例还提供了一种区块链中智能合约的发布装置,如图6所示,包括:The embodiment of the present invention also provides a device for issuing smart contracts in a blockchain, as shown in FIG. 6, including:
获取单元601,用于获取待发布的智能合约;The obtaining unit 601 is used to obtain the smart contract to be released;
确定单元602,用于遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系;The determining unit 602 is configured to traverse the smart contract to be released and determine the dependency relationship between the smart contract to be released;
建立单元603,用于依据所述依赖关系,建立N个依赖树,所述依赖树的一个节点对应一个智能合约;N≥1;The establishment unit 603 is configured to establish N dependency trees according to the dependency relationship, and one node of the dependency tree corresponds to a smart contract; N≥1;
发布单元604,用于针对任一依赖树,从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约。The issuing unit 604 is configured to, for any dependency tree, start from the leaf node of the dependency tree to the root node of the dependency tree, and sequentially release the smart contract corresponding to each node.
可选的,所述确定单元602,还用于:Optionally, the determining unit 602 is further configured to:
针对任一智能合约,执行以下步骤:For any smart contract, perform the following steps:
识别所述智能合约调用的地址参数;所述地址参数用于指示所述智能合约调用的智能合约;Identifying the address parameter called by the smart contract; the address parameter is used to indicate the smart contract called by the smart contract;
将所述地址参数标准化,以确定所述地址参数对应的智能合约。The address parameter is standardized to determine the smart contract corresponding to the address parameter.
可选的,所述发布单元604,具体用于:Optionally, the publishing unit 604 is specifically configured to:
对所述依赖树的叶子节点对应的智能合约进行发布;Publish the smart contract corresponding to the leaf node of the dependency tree;
将智能合约发布成功的叶子节点从所述依赖树中移除;Remove the leaf nodes that successfully publish the smart contract from the dependency tree;
重复对所述依赖树的叶子节点对应的智能合约进行发布的步骤,直至所述依赖树中只存在根节点;Repeat the step of publishing the smart contract corresponding to the leaf node of the dependency tree until only the root node exists in the dependency tree;
对所述根节点对应的智能合约进行发布。Publish the smart contract corresponding to the root node.
可选的,所述获取单元601,还用于接收智能合约变更请求;Optionally, the obtaining unit 601 is further configured to receive a smart contract change request;
所述建立单元603,还用于根据所述智能合约变更请求,更新依赖树中的节点。The establishing unit 603 is further configured to update the nodes in the dependency tree according to the smart contract change request.
基于相同的原理,本发明还提供一种电子设备,如图7所示,包括:Based on the same principle, the present invention also provides an electronic device, as shown in FIG. 7, including:
包括处理器701、存储器702、收发机703、总线接口704,其中处理器701、存储器702与收发机703之间通过总线接口704连接;It includes a processor 701, a memory 702, a transceiver 703, and a bus interface 704, wherein the processor 701, the memory 702 and the transceiver 703 are connected through the bus interface 704;
所述处理器701,用于读取所述存储器702中的程序,执行上述区块链中智能合约的发布方法;所述方法,包括:The processor 701 is configured to read the program in the memory 702 and execute the method for issuing smart contracts in the above-mentioned blockchain; the method includes:
获取待发布的智能合约;Obtain the smart contract to be released;
遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系;Traverse the smart contracts to be released, and determine the dependencies between the smart contracts to be released;
依据所述依赖关系,建立N个依赖树,所述依赖树的一个节点对应一个智能合约;N≥1;According to the dependency relationship, N dependency trees are established, and one node of the dependency tree corresponds to a smart contract; N≥1;
针对任一依赖树,从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约。For any dependency tree, starting from the leaf nodes of the dependency tree and ending with the root node of the dependency tree, the smart contracts corresponding to each node are issued in sequence.
所述处理器701可以是中央处理器(central processing unit,简称CPU),网络处理器(network processor,简称NP)或者CPU和NP的组合。还可以是硬件芯片。上述硬件芯片可以是专用集成电路(application-specific integrated circuit,简称ASIC),可编程逻辑器件(programmable logic device,简称PLD)或其组合。上述PLD可以是复杂可编程逻辑器件(complex programmable logic device,简称CPLD),现场可编程逻辑门阵列(field-programmable gate array,简称FPGA),通用阵列逻辑(generic array logic,简称GAL)或其任意组合。The processor 701 may be a central processing unit (central processing unit, CPU for short), a network processor (NP for short), or a combination of CPU and NP. It can also be a hardware chip. The aforementioned hardware chip may be an application-specific integrated circuit (ASIC for short), a programmable logic device (PLD for short), or a combination thereof. The above-mentioned PLD can be a complex programmable logic device (complex programmable logic device, CPLD), a field-programmable gate array (FPGA), a generic array logic (generic array logic, GAL), or any of them combination.
所述存储器702,用于存储一个或多个可执行程序,可以存储所述处理器701在执行操作时所使用的数据。The memory 702 is configured to store one or more executable programs, and can store data used by the processor 701 when performing operations.
具体地,程序可以包括程序代码,程序代码包括计算机操作指令。存储器702可以包括易失性存储器(volatile memory),例如随机存取存储器(random-access memory,简称RAM);存储器702也可以包括非易失性存储器(non-volatile memory),例如快闪存储器(flash memory),硬盘(hard disk drive,简称HDD)或固态硬盘(solid-state drive,简称SSD);存储器702还可以包括上述种类的存储器的组合。Specifically, the program may include program code, and the program code includes computer operation instructions. The memory 702 may include a volatile memory (volatile memory), such as random-access memory (random-access memory, RAM for short); the memory 702 may also include a non-volatile memory (non-volatile memory), such as flash memory ( flash memory), hard disk drive (HDD for short) or solid-state drive (SSD for short); the memory 702 may also include a combination of the foregoing types of memories.
存储器702存储了如下的元素,可执行模块或者数据结构,或者它们的子集,或者它们的扩展集:The memory 702 stores the following elements, executable modules or data structures, or their subsets, or their extended sets:
操作指令:包括各种操作指令,用于实现各种操作。Operating instructions: including various operating instructions, used to implement various operations.
操作***:包括各种***程序,用于实现各种基础业务以及处理基于硬件的任务。Operating system: including various system programs, used to implement various basic services and process hardware-based tasks.
总线接口704可以为有线通信接入口,无线总线接口或其组合,其中,有线总线接口例如可以为以太网接口。以太网接口可以是光接口,电接口或其组合。无线总线接口可以为WLAN接口。The bus interface 704 may be a wired communication access port, a wireless bus interface or a combination thereof, where the wired bus interface may be, for example, an Ethernet interface. The Ethernet interface can be an optical interface, an electrical interface or a combination thereof. The wireless bus interface may be a WLAN interface.
基于相同的原理,本发明实施例还提供一种非暂态计算机可读存储介质,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行如上所述的区块链中智能合约的发布方法。Based on the same principle, the embodiments of the present invention also provide a non-transitory computer-readable storage medium, the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to make the computer execute the above The method of issuing smart contracts in the blockchain.
基于相同的原理,本发明实施例还提供一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述区块链中智能合约的发布方法。Based on the same principle, the embodiment of the present invention also provides a computer program product containing instructions, which when running on a computer, causes the computer to execute the method for issuing smart contracts in the blockchain.
本发明是参照根据本发明实施例的方法、设备(***)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowcharts and/or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and/or block in the flowchart and/or block diagram, and the combination of processes and/or blocks in the flowchart and/or block diagram can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing equipment to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing equipment are generated It is a device that realizes the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing equipment to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including the instruction device. The device implements the functions specified in one process or multiple processes in the flowchart and/or one block or multiple blocks in the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的 处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded on a computer or other programmable data processing equipment, so that a series of operation steps are executed on the computer or other programmable equipment to produce computer-implemented processing, so as to execute on the computer or other programmable equipment. The instructions provide steps for implementing functions specified in a flow or multiple flows in the flowchart and/or a block or multiple blocks in the block diagram.
尽管已描述了本发明的优选实施例,但本领域内的技术人员一旦得知了基本创造性概念,则可对这些实施例作出另外的变更和修改。所以,所附权利要求意欲解释为包括优选实施例以及落入本发明范围的所有变更和修改。Although the preferred embodiments of the present invention have been described, those skilled in the art can make additional changes and modifications to these embodiments once they learn the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present invention.
显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。这样,倘若本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包括这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. In this way, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalent technologies, the present invention is also intended to include these modifications and variations.

Claims (11)

  1. 一种区块链中智能合约的发布方法,其特征在于,包括:A method for issuing smart contracts in a blockchain, which is characterized in that it includes:
    获取待发布的智能合约;Obtain the smart contract to be released;
    遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系;Traverse the smart contracts to be released, and determine the dependencies between the smart contracts to be released;
    依据所述依赖关系,建立N个依赖树,所述依赖树的一个节点对应一个智能合约;N≥1;According to the dependency relationship, N dependency trees are established, and one node of the dependency tree corresponds to a smart contract; N≥1;
    针对任一依赖树,从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约。For any dependency tree, starting from the leaf nodes of the dependency tree and ending with the root node of the dependency tree, the smart contracts corresponding to each node are issued in sequence.
  2. 如权利要求1所述的方法,其特征在于,所述遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系之前,还包括:The method according to claim 1, wherein before traversing the smart contract to be released and determining the dependency relationship between the smart contract to be released, the method further comprises:
    针对任一智能合约,执行以下步骤:For any smart contract, perform the following steps:
    识别所述智能合约调用的地址参数;所述地址参数用于指示所述智能合约调用的智能合约;Identifying the address parameter called by the smart contract; the address parameter is used to indicate the smart contract called by the smart contract;
    将所述地址参数标准化,以确定所述地址参数对应的智能合约。The address parameter is standardized to determine the smart contract corresponding to the address parameter.
  3. 如权利要求1所述的方法,其特征在于,所述从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约,包括:The method according to claim 1, wherein, starting from the leaf node of the dependency tree to the root node of the dependency tree, successively publishing the smart contract corresponding to each node comprises:
    对所述依赖树的叶子节点对应的智能合约进行发布;Publish the smart contract corresponding to the leaf node of the dependency tree;
    将智能合约发布成功的叶子节点从所述依赖树中移除;Remove the leaf nodes that successfully publish the smart contract from the dependency tree;
    重复对所述依赖树的叶子节点对应的智能合约进行发布的步骤,直至所述依赖树中只存在根节点;Repeat the step of publishing the smart contract corresponding to the leaf node of the dependency tree until only the root node exists in the dependency tree;
    对所述根节点对应的智能合约进行发布。Publish the smart contract corresponding to the root node.
  4. 如权利要求1所述的方法,其特征在于,所述依据所述依赖关系,建立N个依赖树之后,还包括:The method according to claim 1, wherein after establishing N dependency trees according to the dependency relationship, the method further comprises:
    接收智能合约变更请求;Receive smart contract change request;
    根据所述智能合约变更请求,更新依赖树中的节点。According to the smart contract change request, the nodes in the dependency tree are updated.
  5. 一种区块链中智能合约的发布装置,其特征在于,包括:A device for issuing smart contracts in a blockchain, which is characterized in that it includes:
    获取单元,用于获取待发布的智能合约;The obtaining unit is used to obtain the smart contract to be released;
    确定单元,用于遍历所述待发布的智能合约,确定所述待发布的智能合约之间的依赖关系;The determining unit is configured to traverse the smart contract to be released and determine the dependency relationship between the smart contract to be released;
    建立单元,用于依据所述依赖关系,建立N个依赖树,所述依赖树的一个节点对应一个智能合约;N≥1;The establishment unit is configured to establish N dependency trees according to the dependency relationship, and one node of the dependency tree corresponds to a smart contract; N≥1;
    发布单元,用于针对任一依赖树,从所述依赖树的叶子节点开始,直至所述依赖树的根节点,依次发布各节点所对应的智能合约。The publishing unit is used for publishing the smart contract corresponding to each node in sequence from the leaf node of the dependent tree to the root node of the dependent tree for any dependent tree.
  6. 如权利要求5所述的装置,其特征在于,所述确定单元,还用于:The device according to claim 5, wherein the determining unit is further configured to:
    针对任一智能合约,执行以下步骤:For any smart contract, perform the following steps:
    识别所述智能合约调用的地址参数;所述地址参数用于指示所述智能合约调用的智能合约;Identifying the address parameter called by the smart contract; the address parameter is used to indicate the smart contract called by the smart contract;
    将所述地址参数标准化,以确定所述地址参数对应的智能合约。The address parameter is standardized to determine the smart contract corresponding to the address parameter.
  7. 如权利要求5所述的装置,其特征在于,所述发布单元,具体用于:The device according to claim 5, wherein the publishing unit is specifically configured to:
    对所述依赖树的叶子节点对应的智能合约进行发布;Publish the smart contract corresponding to the leaf node of the dependency tree;
    将智能合约发布成功的叶子节点从所述依赖树中移除;Remove the leaf nodes that successfully publish the smart contract from the dependency tree;
    重复对所述依赖树的叶子节点对应的智能合约进行发布的步骤,直至所述依赖树中只存在根节点;Repeat the step of publishing the smart contract corresponding to the leaf node of the dependency tree until only the root node exists in the dependency tree;
    对所述根节点对应的智能合约进行发布。Publish the smart contract corresponding to the root node.
  8. 如权利要求5所述的装置,其特征在于,The device of claim 5, wherein:
    所述获取单元,还用于接收智能合约变更请求;The acquiring unit is also used to receive a smart contract change request;
    所述建立单元,还用于根据所述智能合约变更请求,更新依赖树中的节点。The establishment unit is also used to update the nodes in the dependency tree according to the smart contract change request.
  9. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    至少一个处理器;以及,At least one processor; and,
    与所述至少一个处理器通信连接的存储器;其中,A memory communicatively connected with the at least one processor; wherein,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行权利要求1-4任一所述的方法。The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the method according to any one of claims 1 to 4 .
  10. 一种非暂态计算机可读存储介质,其特征在于,所述非暂态计算机可读存储介质存储计算机指令,所述计算机指令用于使所述计算机执行权利要求1~4任一所述方法。A non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to make the computer execute the method described in any one of claims 1 to 4 .
  11. 一种计算机程序产品,其特征在于,所述计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,所述计算机程序包括程序指令,当所述程序指令被计算机执行时,使所述计算机执行权利要求1~4任一所述方法。A computer program product, characterized in that, the computer program product includes a calculation program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, and when the program instructions are executed by a computer, The computer executes the method described in any one of claims 1 to 4.
PCT/CN2020/081871 2019-05-07 2020-03-27 Method and device for publishing smart contracts in block chain WO2020224353A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910373705.0 2019-05-07
CN201910373705.0A CN110175844A (en) 2019-05-07 2019-05-07 The dissemination method and device of intelligent contract in a kind of block chain

Publications (1)

Publication Number Publication Date
WO2020224353A1 true WO2020224353A1 (en) 2020-11-12

Family

ID=67691389

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/081871 WO2020224353A1 (en) 2019-05-07 2020-03-27 Method and device for publishing smart contracts in block chain

Country Status (2)

Country Link
CN (1) CN110175844A (en)
WO (1) WO2020224353A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110175844A (en) * 2019-05-07 2019-08-27 深圳前海微众银行股份有限公司 The dissemination method and device of intelligent contract in a kind of block chain
CN110989992B (en) * 2019-10-30 2023-10-31 无线生活(北京)信息技术有限公司 Resource processing method and device
CN111488357A (en) * 2020-04-08 2020-08-04 北京瑞策科技有限公司 Method and device for realizing digital account of service data block chain

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145521A (en) * 2017-04-10 2017-09-08 杭州趣链科技有限公司 A kind of data migration method towards block chain multistage intelligent contract
CN108595157A (en) * 2018-04-28 2018-09-28 百度在线网络技术(北京)有限公司 Processing method, device, equipment and the storage medium of block chain data
CN109684189A (en) * 2017-10-18 2019-04-26 富士通株式会社 The logic verification method and device and computer storage medium of block chain intelligence contract
CN110175844A (en) * 2019-05-07 2019-08-27 深圳前海微众银行股份有限公司 The dissemination method and device of intelligent contract in a kind of block chain
CN110555700A (en) * 2019-09-04 2019-12-10 腾讯科技(深圳)有限公司 block chain intelligent contract execution method and device and computer readable storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10447478B2 (en) * 2016-06-06 2019-10-15 Microsoft Technology Licensing, Llc Cryptographic applications for a blockchain system
CN108537543B (en) * 2018-03-30 2023-07-28 百度在线网络技术(北京)有限公司 Parallel processing method, device, equipment and storage medium for blockchain data
JP7012730B2 (en) * 2018-12-28 2022-01-28 アドバンスド ニュー テクノロジーズ カンパニー リミテッド Parallel execution of transactions in a blockchain network based on a smart contract whitelist

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107145521A (en) * 2017-04-10 2017-09-08 杭州趣链科技有限公司 A kind of data migration method towards block chain multistage intelligent contract
CN109684189A (en) * 2017-10-18 2019-04-26 富士通株式会社 The logic verification method and device and computer storage medium of block chain intelligence contract
CN108595157A (en) * 2018-04-28 2018-09-28 百度在线网络技术(北京)有限公司 Processing method, device, equipment and the storage medium of block chain data
CN110175844A (en) * 2019-05-07 2019-08-27 深圳前海微众银行股份有限公司 The dissemination method and device of intelligent contract in a kind of block chain
CN110555700A (en) * 2019-09-04 2019-12-10 腾讯科技(深圳)有限公司 block chain intelligent contract execution method and device and computer readable storage medium

Also Published As

Publication number Publication date
CN110175844A (en) 2019-08-27

Similar Documents

Publication Publication Date Title
TWI677228B (en) Method and apparatus for writing transaction data into a blockchain system
WO2020224353A1 (en) Method and device for publishing smart contracts in block chain
US10868675B2 (en) Automated management of endpoints
JP2020519983A (en) System and method for parallel processing blockchain transactions
JP5940560B2 (en) Managing changes to a collection of data
US10795654B2 (en) Mechanisms for declarative expression of data types for data storage
US20210049715A1 (en) Blockchain-based data procesing method, apparatus, and electronic device
TWI742659B (en) Block chain-based method and device for obtaining evidence of infringement, electronic equipment, and storage media
US10452433B2 (en) Event-driven multi-tenant computer-management platform
CN111324577B (en) Yml file reading and writing method and device
KR102220246B1 (en) Data generation
CN110377209B (en) Method and device for realizing visual flow configuration through dragging
KR20200046947A (en) Method for sharing information based on anchoring and anchoring apparatus supporting the same
WO2015070674A1 (en) Method and system for manipulating data
WO2021027530A1 (en) Data processing method and device based on block chain
WO2021139778A1 (en) System scheduling workflow generation method, system, apparatus, and computer readable storage medium
TWI727639B (en) Method and device for tracing block chain transactions
CN109145055A (en) A kind of method of data synchronization and system based on Flink
EP4357883A1 (en) Data verification method and apparatus, device and storage medium
Cook et al. Read-uncommitted transactions for smart contract performance
CN110727664A (en) Method and device for executing target operation on public cloud data
CN111475692A (en) Processing method and device of block chain data and storage medium
WO2023184052A1 (en) Data processing method, blockchain node and blockchain system
US8601481B2 (en) Workflow validation and execution
WO2021129005A1 (en) Blockchain state change-based transaction tracking method and device

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: 20802772

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: 20802772

Country of ref document: EP

Kind code of ref document: A1