CN107590189B - Intelligent contract execution method, device, equipment and storage medium - Google Patents

Intelligent contract execution method, device, equipment and storage medium Download PDF

Info

Publication number
CN107590189B
CN107590189B CN201710679724.7A CN201710679724A CN107590189B CN 107590189 B CN107590189 B CN 107590189B CN 201710679724 A CN201710679724 A CN 201710679724A CN 107590189 B CN107590189 B CN 107590189B
Authority
CN
China
Prior art keywords
merchant
node
merchants
current node
list
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710679724.7A
Other languages
Chinese (zh)
Other versions
CN107590189A (en
Inventor
罗捷桓
曲强
张金波
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Institute of Advanced Technology of CAS
Original Assignee
Shenzhen Institute of Advanced Technology of CAS
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 Shenzhen Institute of Advanced Technology of CAS filed Critical Shenzhen Institute of Advanced Technology of CAS
Priority to CN201710679724.7A priority Critical patent/CN107590189B/en
Publication of CN107590189A publication Critical patent/CN107590189A/en
Application granted granted Critical
Publication of CN107590189B publication Critical patent/CN107590189B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention is suitable for the technical field of computers, and provides an intelligent contract execution method, an intelligent contract execution device, intelligent contract execution equipment and a storage medium, wherein the method comprises the following steps: the method comprises the steps of receiving an intelligent contract execution request input by a user, wherein the execution request comprises a search keyword, obtaining a tree-shaped index established for a related business in an intelligent contract in advance, generating a form corresponding to the search keyword in an inverted list of the tree-shaped index, detecting whether the generated form is empty or not, traversing all paths of the tree-shaped index when the generated form is not empty, searching businesses covering the search keyword in traversed nodes, adding the searched businesses covering the search keyword into a contract execution business list, and executing the intelligent contract related to the search keyword for the businesses in the contract execution business list, so that the efficiency of executing the intelligent contract is improved, and meanwhile, the effectiveness and the safety of executing the intelligent contract are improved.

Description

Intelligent contract execution method, device, equipment and storage medium
Technical Field
The invention belongs to the technical field of computers, and particularly relates to an intelligent contract execution method, an intelligent contract execution device, intelligent contract execution equipment and a storage medium.
Background
The intelligent contract is to embed the contract terms into the software and hardware, and to make the contract execute through the agreement and the user interface. In recent years, the rise of the block chain technology creates conditions for intelligent contracts, and the intelligent contracts can support programmable contracts and have the characteristics of decentralization, non-tampering, transparent and traceable processes and the like. The trusted environment on the blockchain has helped the explosion of intelligent contracts. The existing intelligent contract of the block chain is made by the participation of multiple users, the intelligent contract is stored in the block chain network, and when the simple description condition written in advance is satisfied, the program automatically executes the contract. The described intelligent contract execution method is too simple in judgment logic and not suitable for requirements on intelligent contract execution in specific scenes, on one hand, only partial merchants meeting conditions in executed contracts cannot be selected in a self-defined mode according to user preference, on the other hand, network structures formed in merchant cooperation or transaction processes are not considered at all, network constraints of the network structures can guarantee close cooperation among the merchants, and effectiveness and safety of intelligent contract execution can be greatly promoted.
The existing intelligent contract construction and execution rough flow comprises the following steps: multiple users participate in making intelligent contracts together; contracts are diffused through the P2P network and stored in block chains; the blockchain determines when and whether the intelligent contract is executed based on the contract description. For example, if a description of "transaction amount greater than 100 ten thousand" is added to the smart contract, the contract will automatically execute when the transaction amount is greater than 100 ten thousand. The method for executing the contract based on the simple description is not suitable for the complex execution requirement of the intelligent contract under some specific scenes, and the execution condition of the contract can not be measured in multiple dimensions, so that the application of the intelligent contract is greatly limited, and the requirement of a user is difficult to meet.
Disclosure of Invention
The invention aims to provide an intelligent contract execution method, an intelligent contract execution device, equipment and a storage medium, and aims to solve the problems of low contract execution efficiency and low safety caused by low efficiency of searching merchants by the existing intelligent contract execution method.
In one aspect, the present invention provides an intelligent contract execution method, including the following steps:
receiving an intelligent contract execution request input by a user, wherein the execution request comprises a search keyword;
acquiring a tree index established for a related merchant in the intelligent contract in advance, and generating a form corresponding to the search keyword in an inverted list of the tree index;
detecting whether the generated form is empty or not, traversing all paths of the tree index when the generated form is not empty, searching merchants covering the search keyword in nodes accessed by the traversal, and adding the searched merchants covering the search keyword into a contract execution merchant list;
executing intelligent contracts associated with the search keywords for merchants in the contract execution merchant list.
In another aspect, the present invention provides an intelligent contract execution apparatus, including:
the intelligent contract execution system comprises a request receiving unit, a contract execution unit and a contract execution unit, wherein the request receiving unit is used for receiving an intelligent contract execution request input by a user, and the execution request comprises a search keyword;
the form generating unit is used for acquiring a tree index which is established for the related commercial tenant in the intelligent contract in advance, and generating a form corresponding to the search keyword in an inverted list of the tree index;
the merchant searching unit is used for detecting whether the generated form is empty or not, traversing all paths of the tree index when the generated form is not empty, searching merchants covering the search key words in the nodes accessed by the traversal, and adding the searched merchants covering the search key words into a contract execution merchant list; and
and the contract execution unit is used for executing the intelligent contract associated with the search keyword for the merchants in the contract execution merchant list.
In another aspect, the present invention further provides a user device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the steps of the intelligent contract execution method when executing the computer program.
In another aspect, the present invention further provides a computer-readable storage medium, which stores a computer program that, when executed by a processor, implements the steps of the intelligent contract execution method as described.
The method comprises the steps of receiving an intelligent contract execution request input by a user, wherein the execution request comprises a search keyword, obtaining a tree-shaped index established for a related business in an intelligent contract in advance, generating a form corresponding to the search keyword in an inverted list of the tree-shaped index, detecting whether the generated form is empty or not, traversing all paths of the tree-shaped index when the generated form is not empty, searching businesses covering the search keyword in traversed nodes, adding the searched businesses covering the search keyword into a contract execution business list, and executing the intelligent contract related to the search keyword for the businesses in the contract execution business list, so that the effectiveness and the safety of executing the intelligent contract are improved while the execution efficiency of the intelligent contract is improved.
Drawings
FIG. 1 is a flowchart illustrating an implementation of a method for executing an intelligent contract according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an implementation of a method for executing an intelligent contract according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of an intelligent contract execution apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an intelligent contract execution apparatus according to a fourth embodiment of the present invention; and
fig. 5 is a schematic structural diagram of a user equipment according to a fifth embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The following detailed description of specific implementations of the present invention is provided in conjunction with specific embodiments:
the first embodiment is as follows:
fig. 1 shows an implementation flow of an intelligent contract execution method provided in an embodiment of the present invention, and for convenience of description, only parts related to the embodiment of the present invention are shown, which are detailed as follows:
in step S101, an intelligent contract execution request input by a user is received, where the execution request includes a search keyword.
The embodiment of the invention is suitable for a network intelligent contract system, so as to conveniently measure the contract execution conditions through multiple dimensions and realize the purpose of automatically executing the intelligent contract. In the embodiment of the invention, before searching for the merchants capable of executing the intelligent contracts, the user firstly sets a group of search keywords for the intelligent contracts as search keywords for continuous search to screen the merchants meeting the custom contract execution conditions, wherein the search keywords set by the user are contained in the intelligent contract execution request input by the user. For example, the user first enters a search keyword in an input box of the search keyword, and then triggers an intelligent contract execution request.
In step S102, a tree index established for the associated merchant in the intelligent contract in advance is obtained, and a form corresponding to the search keyword is generated in the inverted list of the tree index.
In the embodiment of the invention, all the merchants in the merchant network preset by the user are covered in the tree index, wherein, on one hand, network constraints exist among the merchants in the merchant network, and frequent cooperation or transaction can be ensured among the merchants through the network constraints, so that the connections among the merchants are tighter and have practical and practical significance, and on the other hand, the merchants in the merchant network are associated with the intelligent contract, namely the merchants are the merchants signed with the intelligent contract, so that the accuracy, the effectiveness and the safety of executing the contract are improved. After receiving an intelligent contract execution request input by a user, firstly acquiring a search keyword corresponding to the execution request, then acquiring a tree index established for a related merchant in the intelligent contract in advance, and generating a form corresponding to the search keyword in an inverted list of the tree index.
In step S103, it is detected whether the generated form is empty, and when the generated form is not empty, all paths of the tree index are traversed, merchants covering the search keyword are searched in the traversed nodes, and the searched merchants covering the search keyword are added to the contract execution merchant list.
In the embodiment of the invention, whether a form corresponding to the search keyword in the inverted list of the tree index is empty is firstly detected, namely whether merchants meeting contract execution conditions corresponding to the search keyword exist in the merchants included in the tree index is determined according to the inverted list. If the form corresponding to the search keyword in the inverted list of the tree index is not empty, it indicates that there is a merchant satisfying the contract execution condition corresponding to the search keyword in the merchants included in the tree index, that is, the merchant capable of executing the intelligent contract is searched according to the tree index, and at this moment, the merchant capable of executing the intelligent contract is searched according to the tree index. If the form corresponding to the search keyword in the inverted list of the tree index is empty, it indicates that no merchant satisfying the contract execution condition corresponding to the search keyword exists in merchants included in the tree index, and therefore, no intelligent contract is executed for any merchant temporarily.
Preferably, in the process of traversing all paths of the tree index, when a merchant covering the search key word is searched in the traversed nodes, a branch path of the tree index is selected first, then the search is performed along the path from the root node to the non-root node, if a certain node in the branch path does not satisfy the search condition along the path, the search of the branch path is ended, the searched merchant covering the search key word is added into the contract execution merchant list, and then all branch paths of the tree index are traversed, so that all merchants meeting the contract execution condition included in the tree index are added into the contract execution merchant list, thereby improving the rate of merchant search and the effect of search.
In step S104, the intelligent contracts associated with the search keywords are executed for the merchants in the contract execution merchant list.
In the embodiment of the invention, the intelligent contract can provide contracts such as transaction tax return preference for merchants meeting the conditions for governments, and the association grades the merchants meeting the conditions, and the merchants in the contract execution merchant list are mutually associated and meet the search keyword constraint set by the user, namely, the merchants not only cover all search keywords, but also have cooperation with each other. After obtaining the contract execution merchant list, executing the intelligent contracts associated with the search keywords for the merchants in the contract execution merchant list, thereby improving the effectiveness and the safety of executing the intelligent contracts while improving the execution efficiency of the intelligent contracts.
In the embodiment of the invention, after the user gives the execution condition (such as a group of search keywords), merchants covering all the search keywords are continuously searched in the merchant network with business association relation, and then corresponding contracts are executed for the searched merchants, so that the business association relation among the merchants and the conditions of the merchants are combined, the intelligent contract execution efficiency is improved, and meanwhile, the effectiveness and the safety of executing the intelligent contracts are improved.
Example two:
fig. 2 shows an implementation flow of the intelligent contract execution method provided by the second embodiment of the present invention, and for convenience of description, only the parts related to the second embodiment of the present invention are shown, which are detailed as follows:
in step S201, a merchant network composed of associated merchants in the intelligent contract is obtained, and a core value of the merchant in the merchant network is calculated.
The embodiment of the invention is suitable for a network intelligent contract system, so as to conveniently measure the contract execution conditions through multiple dimensions and realize the purpose of automatically executing the intelligent contract. In the embodiment of the invention, a merchant network consisting of merchants signed with contracts is obtained firstly, and the core values of the merchants signed with the contracts are calculated by using a k-core structure decomposition method.
In step S202, a tree index corresponding to the merchant network is established according to the core value.
In the embodiment of the present invention, merchants in the root node of the layer 1 of the tree-type index can form a core structure of 0, merchants under each node of the layer 2 can form a core structure of 1, and so on, a merchant group under each node in the tree is a part of a merchant group formed under a parent node thereof, and nodes (including leaf nodes) through which a path from each leaf node to the root node passes in the tree form a connected part in the whole merchant transaction network, that is, each merchant under the part has at least one path to another merchant, and each merchant only appears in one tree node. The information in the root node includes an independent merchant (i.e., a merchant which does not cooperate with other merchants), a k value of a k core structure formed by a customer group under the node, an inverted list established according to all merchants under the whole network, and child node information, the information of a non-root node is stored in a node information list, and the node information list includes the merchant forming the k core structure, the k value of the k core structure formed by the customer group under the node, location information, child node information, and parent node information corresponding to the merchant lacking compared with its parent node in the inverted list.
Preferably, when the tree index corresponding to the merchant network is established according to the core value of the merchant, a root node of the tree index is established first, the merchant with the core value of zero is set as the merchant in the root node of the tree index, an inverted list corresponding to the root node is established according to the type of the merchant in the merchant network, then the merchant with the core value of nonzero is divided into different remaining merchant sets according to the relationship of the merchant with the core value of nonzero in the merchant network, finally all the remaining merchant sets are traversed, a corresponding non-root node is established according to the core value of the merchant in the remaining merchant sets, and the merchant in the remaining merchant sets are respectively set as the merchant in the corresponding non-root node of the tree index according to the core value, so that the merchant in the tree index meets network constraints, the dimensionality of a search condition is reduced, and the rate of searching for merchants is improved.
In step S203, an intelligent contract execution request input by a user is received, where the execution request includes a search keyword.
In the embodiment of the invention, before searching for the merchants capable of executing the intelligent contracts, the user firstly sets a group of search keywords for the intelligent contracts as search keywords for continuous search to screen the merchants meeting the custom contract execution conditions, wherein the search keywords set by the user are contained in the intelligent contract execution request input by the user. For example, the user first enters a search keyword in an input box of the search keyword, and then triggers an intelligent contract execution request.
In step S204, a tree index that is established in advance for the associated merchant in the intelligent contract is obtained, and a form corresponding to the search keyword is generated in the inverted table of the tree index.
In the embodiment of the invention, all the merchants in the merchant network preset by the user are covered in the tree index, wherein, on one hand, network constraints exist among the merchants in the merchant network, and frequent cooperation or transaction can be ensured among the merchants through the network constraints, so that the connections among the merchants are tighter and have practical and practical significance, and on the other hand, the merchants in the merchant network are associated with the intelligent contract, namely the merchants are the merchants signed with the intelligent contract, so that the accuracy, the effectiveness and the safety of executing the contract are improved. After receiving an intelligent contract execution request input by a user, firstly acquiring a search keyword corresponding to the execution request, then acquiring a tree index established for a related merchant in the intelligent contract in advance, and generating a form corresponding to the search keyword in an inverted list of the tree index.
In step S205, it is detected whether the generated form is empty, and when the generated form is not empty, one child node is selected from the child nodes of the root node, and the selected child node is set as the current node.
In the embodiment of the invention, whether a form corresponding to the search keyword in the inverted list of the tree index is empty is firstly detected, namely whether merchants meeting contract execution conditions corresponding to the search keyword exist in the merchants included in the tree index is determined according to the inverted list. If the form corresponding to the search keyword in the inverted list of the tree index is not empty, it indicates that there is a merchant satisfying the contract execution condition corresponding to the search keyword in the merchants included in the tree index, that is, the merchant capable of executing the intelligent contract can be searched according to the tree index, at this time, one child node is selected from the child nodes of the root node, and the selected child node is set as the current node, so as to perform merchant search. If the form corresponding to the search keyword in the inverted list of the tree index is empty, it indicates that no merchant meeting the contract execution condition corresponding to the search keyword exists in merchants included in the tree index, and no intelligent contract is executed for any merchant temporarily.
In step S206, the inverted list of the root node is checked according to the node information table of the current node, and it is determined whether the merchant group of the current node covers the search keyword input by the user, and the merchants in the merchant group form a k-core structure, if yes, step S208 is executed, otherwise, step S207 is executed.
In step S207, when the merchant group of the current node does not cover the search keyword input by the user, the sibling node of the current node is set as the current node.
In step S208, when the merchant group of the current node covers the search keyword input by the user, it is determined whether the current node is a leaf node, if yes, step S209 is performed, otherwise, step S210 is performed.
In the embodiment of the invention, the inverted list of the root node is checked according to the node information table of the current node, whether the merchant group of the current node covers the search keyword input by the user is confirmed, namely, the information of the merchants which are lacked in the inverted list compared with the parent node in the current node is checked, only the lacked merchants are concerned whether in the list of the given search keyword, the lacked merchants are in the list of the given search keyword, the merchants are excluded from the corresponding list, the list information of the given search keyword of the user is updated, if the list information is updated and all the search keywords cannot be covered, the merchant group of the current node does not cover the search keyword input by the user, at the moment, the brother node of the current node is set as the current node to search the next branch path, if the list information is updated and all the search keywords can be covered, the merchant group of the current node covers the search keyword input by the user is explained, at this time, whether the current node is a leaf node is determined to determine whether the merchant in the current node merchant group is added into the contract execution merchant list, so that the searching speed and the searching effect are improved.
In step S209, when the current node is a leaf node, the merchants in the current node merchant group are added to the contract execution merchant list, and the sibling node of the current node is set as the current node.
In step S210, when the current node is not a leaf node, a merchant confirmation operation is performed on the current node to confirm whether merchants in the current node merchant group are added to the contract execution merchant list, and a sibling node of the current node is set as the current node.
In the embodiment of the invention, if the current node is a leaf node, the merchants in the current node merchant group are added into the contract execution merchant list, then the brother node of the current node is set as the current node to search the next branch path, if the current node is not the leaf node, the merchant confirmation operation is firstly carried out on the current node to confirm whether the merchants in the current node merchant group are added into the contract execution merchant list, and then the brother node of the current node is set as the current node to search the next branch path.
Preferably, when the merchant confirmation operation is performed on the current node, firstly, the inverted list of the root node is checked according to the node information table of the child node of the current node, then, whether the merchant group of the child node of the current node covers the search keyword input by the user is confirmed, if all the child nodes of the current node do not cover the search keyword input by the user, the merchants in the merchant group of the current node are obtained, the obtained merchants are added into the contract execution merchant list, if one or more child nodes of the current node cover the search keyword input by the user, whether the one or more child nodes are leaf nodes is confirmed, if the one or more child nodes are leaf nodes, the merchants in the merchant group of the one or more child nodes are added into the contract execution merchant list, and if the one or more child nodes are not leaf nodes, the merchant confirmation operation is further performed on the one or more child nodes, and determining whether merchants in the one or more sub-node merchant groups are added into a contract execution merchant list or not, and ending merchant determination operation when the sub-nodes covering the search keywords are leaf nodes or all the sub-nodes do not cover the search keywords, thereby improving the search rate and the search effect.
In step S211, the intelligent contracts associated with the search keywords are executed for the merchants in the contract execution merchant list.
In the embodiment of the invention, the intelligent contract can provide contracts such as transaction tax return preference for merchants meeting the conditions for governments, and the association grades the merchants meeting the conditions, and the merchants in the contract execution merchant list are mutually associated and meet the search keyword constraint set by the user, namely, the merchants not only cover all search keywords, but also have cooperation with each other. After obtaining the contract execution merchant list, executing the intelligent contracts associated with the search keywords for the merchants in the contract execution merchant list, thereby improving the effectiveness and the safety of executing the intelligent contracts while improving the execution efficiency of the intelligent contracts.
Example three:
fig. 3 shows a structure of an intelligent contract execution apparatus provided in a third embodiment of the present invention, and for convenience of explanation, only the parts related to the third embodiment of the present invention are shown, where the parts include:
the request receiving unit 31 is configured to receive an intelligent contract execution request input by a user, where the execution request includes a search keyword.
In the embodiment of the present invention, before searching for a merchant that can execute an intelligent contract, a user first sets a group of search keywords for the intelligent contract as search keywords for continuous search to screen merchants that meet custom contract execution conditions, where the search keywords set by the user are included in the intelligent contract execution request received by the request receiving unit 31. For example, the user first enters a search keyword in an input box of the search keyword, and then triggers an intelligent contract execution request.
The form generating unit 32 is configured to obtain a tree index that is established in advance for an associated merchant in the intelligent contract, and generate a form corresponding to the search keyword in an inverted list of the tree index.
In the embodiment of the invention, all the merchants in the merchant network preset by the user are covered in the tree index, wherein, on one hand, network constraints exist among the merchants in the merchant network, and frequent cooperation or transaction can be ensured among the merchants through the network constraints, so that the connections among the merchants are tighter and have practical and practical significance, and on the other hand, the merchants in the merchant network are associated with the intelligent contract, namely the merchants are the merchants signed with the intelligent contract, so that the accuracy, the effectiveness and the safety of executing the contract are improved. After receiving an intelligent contract execution request input by a user, the form generation unit 32 first obtains a search keyword corresponding to the execution request, then obtains a tree index established in advance for an associated merchant in the intelligent contract, and generates a form corresponding to the search keyword in an inverted list of the tree index.
And the merchant searching unit 33 is configured to detect whether the generated form is empty, traverse all paths of the tree index when the generated form is not empty, search for merchants covering the search keyword in the nodes that are traversed and accessed, and add the merchants covering the search keyword to the contract execution merchant list.
In the embodiment of the invention, whether a form corresponding to the search keyword in the inverted list of the tree index is empty is firstly detected, namely whether merchants meeting contract execution conditions corresponding to the search keyword exist in the merchants included in the tree index is determined according to the inverted list. If the table corresponding to the search keyword in the inverted table of the tree index is not empty, it indicates that there is a merchant satisfying the contract execution condition corresponding to the search keyword in the merchants included in the tree index, that is, the merchant capable of executing the intelligent contract is searched according to the tree index, and at this time, the merchant searching unit 33 starts to search the merchant for executing the intelligent contract according to the tree index. If the form corresponding to the search keyword in the inverted list of the tree index is empty, it indicates that no merchant satisfying the contract execution condition corresponding to the search keyword exists in merchants included in the tree index, and therefore, no intelligent contract is executed for any merchant temporarily.
Preferably, when traversing all paths of the tree index and searching merchants covering the search key words in the traversed nodes, a branch path of the tree index is selected first, then searching is performed along the path from the root node to the non-root node, if a certain node in the branch path does not satisfy the search condition along the path, the search of the branch path is ended, the searched merchants covering the search key words are added into the contract execution merchant list, and then all branch paths of the tree index are traversed, so that all merchants meeting the contract execution condition and included in the tree index are added into the contract execution merchant list, thereby improving the speed of merchant search and the search effect.
And a contract execution unit 34 for executing the intelligent contract associated with the search keyword for the merchant in the contract execution merchant list.
In the embodiment of the invention, the intelligent contract can provide contracts such as transaction tax return preference for merchants meeting the conditions for governments, and the association grades the merchants meeting the conditions, and the merchants in the contract execution merchant list are mutually associated and meet the search keyword constraint set by the user, namely, the merchants not only cover all search keywords, but also have cooperation with each other. After obtaining the contract execution merchant list, the contract execution unit 34 executes the intelligent contracts associated with the search keywords to the merchants in the contract execution merchant list, thereby improving the effectiveness and security of executing the intelligent contracts while improving the intelligent contract execution efficiency.
In the embodiment of the present invention, the request receiving unit 31 receives the intelligent contract execution request input by the user, the execution request includes a search keyword, the form generation unit 32 obtains a tree index previously established for an associated merchant in the intelligent contract, a form corresponding to the search keyword is generated in the inverted list of the tree index, the merchant searching unit 33 detects whether the generated form is empty, traverses all paths of the tree index when the generated form is not empty, searching the merchants covering the search key words in the traversed and accessed nodes, adding the searched merchants covering the search key words into a contract execution merchant list, the contract execution unit 34 executes the smart contract associated with the search keyword to the merchants in the contract execution merchant list, therefore, the efficiency of executing the intelligent contract is improved, and meanwhile, the effectiveness and the safety of executing the intelligent contract are improved.
In the embodiment of the present invention, each unit of the intelligent contract execution apparatus may be implemented by a corresponding hardware or software unit, and each unit may be an independent software or hardware unit, or may be integrated into a software or hardware unit, which is not limited herein.
Example four:
fig. 4 shows a structure of an intelligent contract execution apparatus provided in the fourth embodiment of the present invention, and for convenience of explanation, only the parts related to the embodiment of the present invention are shown, where the parts include:
the core value calculating unit 41 is configured to obtain a merchant network formed by associated merchants in the intelligent contract, and calculate a core value of a merchant in the merchant network.
And an index establishing unit 42, configured to establish a tree index corresponding to the merchant network according to the core value.
In the embodiment of the present invention, the core value calculating unit 41 first obtains the merchant network composed of merchants signed with contracts, calculates the core values of the merchants signed with contracts by using a k-core structure decomposition method, and then the index establishing unit 42 establishes the tree-type index corresponding to the merchant network according to the core values.
In the embodiment of the present invention, merchants in the root node of the layer 1 of the tree-type index can form a core structure of 0, merchants under each node of the layer 2 can form a core structure of 1, and so on, a merchant group under each node in the tree is a part of a merchant group formed under a parent node thereof, and nodes (including leaf nodes) through which a path from each leaf node to the root node passes in the tree form a connected part in the whole merchant transaction network, that is, each merchant under the part has at least one path to another merchant, and each merchant only appears in one tree node. The information in the root node includes an independent merchant (i.e., a merchant which does not cooperate with other merchants), a k value of a k core structure formed by a customer group under the node, an inverted list established according to all merchants under the whole network, and child node information, the information of a non-root node is stored in a node information list, and the node information list includes the merchant forming the k core structure, the k value of the k core structure formed by the customer group under the node, location information, child node information, and parent node information corresponding to the merchant lacking compared with its parent node in the inverted list.
Preferably, when the tree index corresponding to the merchant network is established according to the core value of the merchant, a root node of the tree index is established first, the merchant with the core value of zero is set as the merchant in the root node of the tree index, an inverted list corresponding to the root node is established according to the type of the merchant in the merchant network, then the merchant with the core value of nonzero is divided into different remaining merchant sets according to the relationship of the merchant with the core value of nonzero in the merchant network, finally all the remaining merchant sets are traversed, a corresponding non-root node is established according to the core value of the merchant in the remaining merchant sets, and the merchant in the remaining merchant sets are respectively set as the merchant in the corresponding non-root node of the tree index according to the core value, so that the merchant in the tree index meets network constraints, the dimensionality of a search condition is reduced, and the rate of searching for merchants is improved.
The request receiving unit 43 is configured to receive an intelligent contract execution request input by a user, where the execution request includes a search keyword.
In the embodiment of the present invention, before searching for a merchant that can execute an intelligent contract, a user first sets a group of search keywords for the intelligent contract as search keywords for continuous search to screen merchants that satisfy custom contract execution conditions, where the search keywords set by the user are included in the intelligent contract execution request received by the request receiving unit 43. For example, the user first enters a search keyword in an input box of the search keyword, and then triggers an intelligent contract execution request.
And the form generating unit 44 is configured to obtain a tree index that is established in advance for the associated merchant in the intelligent contract, and generate a form corresponding to the search keyword in an inverted list of the tree index.
In the embodiment of the invention, all the merchants in the merchant network preset by the user are covered in the tree index, wherein, on one hand, network constraints exist among the merchants in the merchant network, and frequent cooperation or transaction can be ensured among the merchants through the network constraints, so that the connections among the merchants are tighter and have practical and practical significance, and on the other hand, the merchants in the merchant network are associated with the intelligent contract, namely the merchants are the merchants signed with the intelligent contract, so that the accuracy, the effectiveness and the safety of executing the contract are improved. After receiving an intelligent contract execution request input by a user, the form generation unit 44 first obtains a search keyword corresponding to the execution request, then obtains a tree index established in advance for an associated merchant in the intelligent contract, and generates a form corresponding to the search keyword in an inverted list of the tree index.
And the merchant searching unit 45 is used for detecting whether the generated form is empty or not, traversing all paths of the tree index when the generated form is not empty, searching merchants covering the search keyword in the traversed nodes, and adding the searched merchants covering the search keyword into the contract execution merchant list.
In the embodiment of the invention, whether a form corresponding to the search keyword in the inverted list of the tree index is empty is firstly detected, namely whether merchants meeting contract execution conditions corresponding to the search keyword exist in the merchants included in the tree index is determined according to the inverted list. If the table corresponding to the search keyword in the inverted table of the tree index is not empty, it indicates that there is a merchant satisfying the contract execution condition corresponding to the search keyword in the merchants included in the tree index, that is, the merchant capable of executing the intelligent contract is searched according to the tree index, and at this time, the merchant searching unit 45 starts to search the merchant capable of executing the intelligent contract according to the tree index. If the form corresponding to the search keyword in the inverted list of the tree index is empty, it indicates that no merchant satisfying the contract execution condition corresponding to the search keyword exists in merchants included in the tree index, and therefore, no intelligent contract is executed for any merchant temporarily.
Preferably, when traversing all paths of the tree index and searching merchants covering the search keyword in the traversed nodes, first selecting a child node from the child nodes of the root node, setting the selected child node as the current node for merchant search, then checking the inverted list of the root node according to the node information table of the current node, and determining whether the merchant group of the current node covers the search keyword input by the user, that is, checking the information of merchants lacking from the parent node in the inverted list of the current node, and only paying attention to whether the lacking merchants are in the list of the given search keyword. And if the list information is updated, all the search keywords can be covered, the business group of the current node covers the search keywords input by the user, at this time, the brother node of the current node is set as the current node to search the next branch path, and if all the search keywords can be covered after the list information is updated, whether the business group of the current node covers the search keywords input by the user is determined, at this time, whether the current node is a leaf node is determined, so as to determine whether the businesses in the business group of the current node are added into a contract execution business list, thereby improving the search rate and the search effect.
If the current node is a leaf node, firstly adding the merchants in the current node merchant group into a contract execution merchant list, then setting brother nodes of the current node as the current node to search a next branch path, if the current node is not a leaf node, firstly carrying out merchant confirmation operation on the current node to confirm whether the merchants in the current node merchant group are added into the contract execution merchant list, and then setting the brother nodes of the current node as the current node to search the next branch path.
Further preferably, when the merchant confirmation operation is performed on the current node, firstly, the inverted list of the root node is checked according to the node information table of the child node of the current node, then, whether the merchant group of the child node of the current node covers the search keyword input by the user is confirmed, if all the child nodes of the current node do not cover the search keyword input by the user, the merchants in the merchant group of the current node are obtained, the obtained merchants are added into the contract execution merchant list, if one or more child nodes of the current node cover the search keyword input by the user, whether the one or more child nodes are leaf nodes is confirmed, if the one or more child nodes are leaf nodes, the merchants in the merchant group of the one or more child nodes are added into the contract execution merchant list, if the one or more child nodes are not leaf nodes, the merchant confirmation operation is further performed on the one or more child nodes, and determining whether merchants in the one or more sub-node merchant groups are added into a contract execution merchant list or not, and ending merchant determination operation when the sub-nodes covering the search keywords are leaf nodes or all the sub-nodes do not cover the search keywords, thereby improving the search rate and the search effect.
And a contract execution unit 46 for executing the intelligent contract associated with the search keyword for the merchant in the contract execution merchant list.
In the embodiment of the invention, the intelligent contract can provide contracts such as transaction tax return preference for merchants meeting the conditions for governments, and the association grades the merchants meeting the conditions, and the merchants in the contract execution merchant list are mutually associated and meet the search keyword constraint set by the user, namely, the merchants not only cover all search keywords, but also have cooperation with each other. After obtaining the contract execution merchant list, the contract execution unit 46 executes the intelligent contracts associated with the search keywords to the merchants in the contract execution merchant list, thereby improving the effectiveness and security of executing the intelligent contracts while improving the intelligent contract execution efficiency.
Therefore, it is preferable that the merchant search unit 45 includes:
a first setting unit 451 for selecting one child node from the child nodes of the root node, and setting the selected child node as a current node;
a first determining unit 452, configured to check the inverted list of the root node according to the node information table of the current node, and determine whether the merchant group of the current node covers a search keyword input by a user, where merchants in the merchant group form a k-core structure;
a second setting unit 453, configured to set a sibling node of the current node as the current node when the merchant group of the current node does not cover the search keyword input by the user;
a second confirming unit 454, configured to confirm whether the current node is a leaf node when the merchant group of the current node covers the search keyword input by the user;
a first list adding unit 455, configured to, when the current node is a leaf node, add a merchant in the current node merchant group into the contract execution merchant list, and set a sibling node of the current node as the current node; and
a second list adding unit 456, configured to, when the current node is not a leaf node, perform a merchant confirmation operation on the current node to confirm whether to add a merchant in the current node merchant group to the contract execution merchant list, and set a sibling node of the current node as the current node.
In the embodiment of the present invention, each unit of the intelligent contract execution apparatus may be implemented by a corresponding hardware or software unit, and each unit may be an independent software or hardware unit, or may be integrated into a software or hardware unit, which is not limited herein.
Example five:
fig. 5 shows a structure of a user equipment according to a fifth embodiment of the present invention, and for convenience of description, only the parts related to the embodiment of the present invention are shown.
The user equipment 5 of an embodiment of the present invention comprises a processor 50, a memory 51 and a computer program 52 stored in the memory 51 and operable on the processor 50. The processor 50 executes the computer program 52 to implement the steps in the above-mentioned embodiments of the intelligent contract execution method, such as steps S101 to S104 shown in fig. 1 and steps S201 to S211 shown in fig. 2. Alternatively, the processor 50, when executing the computer program 52, implements the functions of the units in the above-described device embodiments, such as the functions of the units 31 to 34 shown in fig. 3 and the units 41 to 46 shown in fig. 4.
In the embodiment of the present invention, when the processor 50 executes the computer program 52 to implement the steps in the above-mentioned respective intelligent contract execution method embodiments, an intelligent contract execution request input by a user is received, the execution request comprises search keywords, a tree index established for the related commercial tenant in the intelligent contract in advance is obtained, generating a form corresponding to the search keyword in an inverted list of the tree index, detecting whether the generated form is empty, traversing all paths of the tree index when the generated form is not empty, searching the merchants covering the search key words in the traversed and accessed nodes, adding the searched merchants covering the search key words into a contract execution merchant list, and executing the intelligent contract associated with the search keyword for the merchants in the contract execution merchant list, thereby improving the effectiveness and the safety of executing the intelligent contract while improving the execution efficiency of the intelligent contract.
The user equipment 5 may be a personal computer, a server, or other devices that can execute an intelligent contract, and the steps implemented by the processor 50 in the user equipment 5 when executing the computer program 52 may specifically refer to the description of the method in the first embodiment, which is not described herein again.
Example six:
in an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps in the above-described respective intelligent contract execution method embodiments, for example, steps S101 to S104 shown in fig. 1 and steps S201 to S211 shown in fig. 2. Alternatively, the computer program, when executed by a processor, implements the functions of the units in the device embodiments described above, such as the functions of the units 31 to 34 shown in fig. 3 and the units 41 to 46 shown in fig. 4.
In the embodiment of the invention, an intelligent contract execution request input by a user is received, the execution request comprises a search keyword, a tree index established for a related business in an intelligent contract in advance is obtained, a form corresponding to the search keyword is generated in an inverted list of the tree index, whether the generated form is empty or not is detected, when the generated form is not empty, all paths of the tree index are traversed, businesses covering the search keyword are searched in traversed nodes, the searched businesses covering the search keyword are added into a contract execution business list, and the intelligent contract related to the search keyword is executed for the businesses in the contract execution business list, so that the efficiency of executing the intelligent contract is improved, and meanwhile, the effectiveness and the safety of executing the intelligent contract are improved. The intelligent contract execution method implemented when the computer program is executed by the processor may further refer to the description of the steps in the foregoing method embodiments, and will not be described herein again.
The computer readable storage medium of the embodiments of the present invention may include any entity or device capable of carrying computer program code, a recording medium, such as a ROM/RAM, a magnetic disk, an optical disk, a flash memory, or the like.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. An intelligent contract execution method, characterized in that the method comprises the steps of:
receiving an intelligent contract execution request input by a user, wherein the execution request comprises a search keyword;
acquiring a tree index established for a related merchant in the intelligent contract in advance, and generating a form corresponding to the search keyword in an inverted list of the tree index;
detecting whether the generated form is empty or not, traversing all paths of the tree index when the generated form is not empty, searching merchants covering the search keyword in nodes accessed by the traversal, and adding the searched merchants covering the search keyword into a contract execution merchant list;
executing intelligent contracts associated with the search keywords for merchants in the contract execution merchant list.
2. The method of claim 1, wherein prior to the step of receiving a user-entered smart contract execution request, the method further comprises:
acquiring a merchant network consisting of related merchants in the intelligent contract, and calculating a core value of the merchant in the merchant network;
and establishing a tree index corresponding to the merchant network according to the core value.
3. The method as claimed in claim 2, wherein the step of building the tree index corresponding to the merchant network according to the core value comprises:
establishing a root node of the tree index, setting the commercial tenant with the core value of zero as a commercial tenant in the root node of the tree index, and establishing an inverted list corresponding to the root node according to the type of the commercial tenant in the commercial tenant network;
dividing the merchants with nonzero core values into different remaining merchant sets according to the relationship of the merchants with nonzero core values in the merchant network;
traversing all the residual merchant sets, constructing corresponding non-root nodes according to core values of the merchants in the residual merchant sets, respectively setting the merchants in the residual merchant sets as the merchants in the corresponding non-root nodes of the tree index according to the core values, and establishing a node information table of the non-root nodes according to the merchants in the non-root nodes.
4. The method of claim 1, wherein traversing all paths of the tree index, searching for merchants that cover the search key in the nodes accessed by the traversal, and adding the searched merchants that cover the search key to a list of contract-executing merchants comprises:
selecting a child node from child nodes of the tree index root node, and setting the selected child node as a current node;
checking an inverted list of root nodes according to the node information table of the current node, and determining whether a merchant group of the current node covers the search keyword input by the user, wherein merchants in the merchant group form a k core structure;
when the merchant group of the current node does not cover the search keyword input by the user, setting the brother node of the current node as the current node;
when the merchant group of the current node covers the search keyword input by the user, determining whether the current node is a leaf node;
when the current node is the leaf node, adding the merchants in the current node merchant group into the contract execution merchant list, and setting the brother node of the current node as the current node;
and when the current node is not the leaf node, performing merchant confirmation operation on the current node to confirm whether merchants in the current node merchant group are added into the contract execution merchant list or not, and setting the brother node of the current node as the current node.
5. The method of claim 4, wherein the step of performing a merchant confirmation operation on the current node comprises:
checking the inverted list of the root node according to the node information table of the child node of the current node, and determining whether the merchant group of the child node of the current node covers the search keyword input by the user;
and when all the child nodes of the current node do not cover the search keyword input by the user, acquiring the merchants in the merchant group of the current node, and adding the acquired merchants into the contract execution merchant list.
6. An intelligent contract execution apparatus, comprising:
the intelligent contract execution system comprises a request receiving unit, a contract execution unit and a contract execution unit, wherein the request receiving unit is used for receiving an intelligent contract execution request input by a user, and the execution request comprises a search keyword;
the form generating unit is used for acquiring a tree index which is established for the related commercial tenant in the intelligent contract in advance, and generating a form corresponding to the search keyword in an inverted list of the tree index;
the merchant searching unit is used for detecting whether the generated form is empty or not, traversing all paths of the tree index when the generated form is not empty, searching merchants covering the search key words in the nodes accessed by the traversal, and adding the searched merchants covering the search key words into a contract execution merchant list; and
and the contract execution unit is used for executing the intelligent contract associated with the search keyword for the merchants in the contract execution merchant list.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the core value calculating unit is used for acquiring a merchant network formed by the associated merchants in the intelligent contract and calculating the core value of the merchants in the merchant network; and
and the index establishing unit is used for establishing the tree index corresponding to the merchant network according to the core value.
8. The apparatus of claim 6, wherein the merchant searching unit comprises:
the first setting unit is used for selecting a child node from child nodes of the tree index root node and setting the selected child node as a current node;
a first confirming unit, configured to check an inverted list of a root node according to the node information table of the current node, and confirm whether a merchant group of the current node covers the search keyword input by the user, where merchants in the merchant group form a k-core structure;
the second setting unit is used for setting the brother node of the current node as the current node when the merchant group of the current node does not cover the search keyword input by the user;
a second confirming unit, configured to confirm whether the current node is a leaf node when the merchant group of the current node covers the search keyword input by the user;
a first list adding unit, configured to add, when the current node is the leaf node, a merchant in the current node merchant group into the contract execution merchant list, and set a sibling node of the current node as a current node; and
and a second list adding unit, configured to, when the current node is not the leaf node, perform a merchant confirmation operation on the current node to confirm whether to add a merchant in the current node merchant group to the contract execution merchant list, and set a sibling node of the current node as the current node.
9. User equipment comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor realizes the steps of the method according to any of claims 3 or 5 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN201710679724.7A 2017-08-10 2017-08-10 Intelligent contract execution method, device, equipment and storage medium Active CN107590189B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710679724.7A CN107590189B (en) 2017-08-10 2017-08-10 Intelligent contract execution method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710679724.7A CN107590189B (en) 2017-08-10 2017-08-10 Intelligent contract execution method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN107590189A CN107590189A (en) 2018-01-16
CN107590189B true CN107590189B (en) 2020-05-22

Family

ID=61041597

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710679724.7A Active CN107590189B (en) 2017-08-10 2017-08-10 Intelligent contract execution method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN107590189B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108965399B (en) * 2018-06-25 2022-02-25 百度在线网络技术(北京)有限公司 Intelligent contract execution method, device, equipment and storage medium
CN108898490A (en) * 2018-06-25 2018-11-27 北京奇虎科技有限公司 Execution method, node, system, electronic equipment and the storage medium of intelligent contract
CN112131252A (en) * 2020-08-16 2020-12-25 中信银行股份有限公司 Service processing method and device, electronic equipment and readable storage medium
CN113888173B (en) * 2021-12-07 2022-04-26 深圳前海微众银行股份有限公司 Intelligent contract calling method, device and equipment based on block chain

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104268247A (en) * 2014-09-30 2015-01-07 北京首钢自动化信息技术有限公司 Master data imputation method based on fuzzy analytic hierarchy process
CN106850622A (en) * 2017-02-07 2017-06-13 杭州秘猿科技有限公司 A kind of user identity management method based on license chain

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110213659A1 (en) * 2010-02-26 2011-09-01 Marcus Fontoura System and Method for Automatic Matching of Contracts in an Inverted Index to Impression Opportunities Using Complex Predicates and Confidence Threshold Values

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104268247A (en) * 2014-09-30 2015-01-07 北京首钢自动化信息技术有限公司 Master data imputation method based on fuzzy analytic hierarchy process
CN106850622A (en) * 2017-02-07 2017-06-13 杭州秘猿科技有限公司 A kind of user identity management method based on license chain

Also Published As

Publication number Publication date
CN107590189A (en) 2018-01-16

Similar Documents

Publication Publication Date Title
CN107590189B (en) Intelligent contract execution method, device, equipment and storage medium
CN105893349B (en) Classification tag match mapping method and device
CN107924679A (en) Delayed binding during inputting understanding processing in response selects
CN104765729A (en) Cross-platform micro-blogging community account matching method
CN110874396B (en) Keyword extraction method and device and computer storage medium
CN110162637B (en) Information map construction method, device and equipment
CN109446529A (en) A kind of sensitive word detection method and system based on determining finite automaton
CN110019694A (en) Method, apparatus and computer readable storage medium for knowledge mapping
CN111159420B (en) Entity optimization method based on attribute calculation and knowledge template
CN117235285B (en) Method and device for fusing knowledge graph data
CN103294791A (en) Extensible markup language pattern matching method
CN105843809A (en) Data processing method and device
CN109886030B (en) Privacy minimum exposure method facing service combination
CN111125332B (en) Method, device, equipment and storage medium for calculating TF-IDF value of word
CN102882792B (en) Method for simplifying internet propagation path diagram
CN111127232A (en) Interest circle discovery method, device, server and medium
CN112860811B (en) Method and device for determining data blood relationship, electronic equipment and storage medium
CN113010769A (en) Knowledge graph-based article recommendation method and device, electronic equipment and medium
CN112163430B (en) Method and system for ontology fusion of industrial equipment data facing MES system
CN103870520A (en) Equipment and method for searching information
CN116400956A (en) Code merging information determining method and device, electronic equipment and storage medium
CN107357904B (en) Domain model data management system
CN113987345A (en) Data processing method, device, equipment, storage medium and program product
CN116050351A (en) Structure comparison method, device and equipment of logic expression and storage medium
CN114417071A (en) Node state determination method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant