CN114422535A - Method and device for deploying contracts in block chain, computer equipment and storage medium - Google Patents
Method and device for deploying contracts in block chain, computer equipment and storage medium Download PDFInfo
- Publication number
- CN114422535A CN114422535A CN202210056362.7A CN202210056362A CN114422535A CN 114422535 A CN114422535 A CN 114422535A CN 202210056362 A CN202210056362 A CN 202210056362A CN 114422535 A CN114422535 A CN 114422535A
- Authority
- CN
- China
- Prior art keywords
- contract
- target
- blockchain network
- deployed
- node
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 73
- 238000004590 computer program Methods 0.000 claims description 11
- 238000012545 processing Methods 0.000 claims description 10
- 230000000977 initiatory effect Effects 0.000 claims description 8
- 239000003795 chemical substances by application Substances 0.000 description 31
- 230000006870 function Effects 0.000 description 14
- 238000010586 diagram Methods 0.000 description 6
- 238000004891 communication Methods 0.000 description 4
- 238000001514 detection method Methods 0.000 description 3
- 238000013459 approach Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 230000005236 sound signal Effects 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000001815 facial effect Effects 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/10—Network architectures or network communication protocols for network security for controlling access to devices or network resources
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Computing Systems (AREA)
- General Engineering & Computer Science (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Telephonic Communication Services (AREA)
Abstract
The embodiment of the application discloses a method and a device for deploying contracts in a block chain, computer equipment and a storage medium. The method comprises the following steps: receiving a contract deployment request of a target user node in a blockchain network, wherein the contract deployment request is used for indicating that at least one target to be deployed by the target user node is deployed in the blockchain network; acquiring a proxy contract deployed by an administrator node of the blockchain network, wherein the proxy contract is used for deploying a target contract in the blockchain network according to a contract deployment request; acquiring a time threshold value of contract deployment in a block chain network in a proxy contract; acquiring the times to be deployed of contract deployment of a target user node in a block chain network at present based on the number of target contracts; determining a number of deployments for contract deployments in the blockchain network based on the proxy contract; and if the sum of the deployment times of the to-be-deployed times and the deployed times does not exceed the time threshold, deploying the target contract in the block chain network through the agent contract.
Description
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method and an apparatus for deploying contracts in a blockchain, a computer device, and a storage medium.
Background
The block chain such as the alliance chain cannot control contract deployment of users in the block chain network, any user with contract deployment authority can freely deploy contracts in the block chain network, contract deployment times of the user in the block chain network cannot be well controlled, a plurality of contracts with the same function may exist in the block chain, and the contracts of the chain can be disordered and too many invalid contracts can be caused.
Disclosure of Invention
Embodiments of the present application provide a method and an apparatus for deploying contracts in a blockchain, a computer device, and a storage medium, which can control the times of deploying contracts by a user node in a blockchain network, and avoid confusion and excessive invalid contracts in the blockchain network.
The embodiment of the present application provides a method for deploying contracts in a blockchain, which is applied to a blockchain network having a plurality of user nodes, where the user nodes include an administrator node, and the method includes:
receiving a contract deployment request of a target user node in the blockchain network, wherein the contract deployment request is used for indicating that at least one target to be deployed by the target user node is deployed in the blockchain network;
obtaining a proxy contract deployed by an administrator node of the blockchain network, the proxy contract being used to deploy the target contract in the blockchain network according to the contract deployment request;
acquiring a number threshold of contract deployment in the block chain network in the agent contract;
acquiring the number of times to be deployed of contract deployment of the target user node in the block chain network at present based on the number of the target contracts;
determining a number of deployed contracts in the blockchain network based on the proxy contracts;
and if the sum of the deployment times of the to-be-deployed times and the deployed times does not exceed the time threshold, deploying the target contract in the block chain network through the proxy contract.
Correspondingly, an embodiment of the present application further provides a contract deployment apparatus, which is applied to a blockchain network having a plurality of user nodes, where the user nodes include an administrator node, and the contract deployment apparatus includes:
a receiving unit, configured to receive a contract deployment request of a target user node in the blockchain network, where the contract deployment request is used to indicate that at least one target contract to be deployed by the target user node is deployed in the blockchain network;
a contract acquisition unit configured to acquire a proxy contract deployed by an administrator node of the blockchain network, the proxy contract being configured to deploy the target contract in the blockchain network according to the contract deployment request;
a number threshold acquisition unit, configured to acquire, in the proxy contract, a number threshold for contract deployment in the blockchain network;
a to-be-deployed frequency acquiring unit, configured to acquire, based on the number of the target contracts, a to-be-deployed frequency at which the target user node currently performs contract deployment in the block chain network;
a deployed number obtaining unit configured to determine, based on the proxy contract, a deployed number of times contract deployment is performed in the blockchain network;
and the deployment unit is used for deploying the target contract in the blockchain network through the proxy contract if the sum of the deployment times of the to-be-deployed times and the deployed times does not exceed the time threshold.
Optionally, the contract obtaining unit is further configured to:
determining the administrator node among a plurality of the user nodes included in the blockchain network;
receiving, by the administrator node, a contract first-time deployment request for contract deployment of the user node in the blockchain network for the first time;
deploying, by the administrator node, the proxy contract in the blockchain network based on the contract first deployment request.
Optionally, the number threshold includes a first number threshold, and the number threshold obtaining unit is further configured to:
receiving, by the administrator node, first nonce limitation information sent by the target user node, where the first nonce limitation information includes the first nonce threshold for contract deployment of the target user node in the blockchain network;
setting, by the administrator node, the first time threshold in the proxy contract;
acquiring the first time threshold value of contract deployment of the target user node in the block chain network in the proxy contract.
Optionally, the contract deployment request includes a target node identifier of the target user node in the blockchain network, where the deployed number is a first deployed number, and the deployed number obtaining unit is further configured to:
acquiring the first deployed times of contract deployment of the target user node in the blockchain network in the proxy contract based on the target node identification.
Optionally, the time threshold includes a first time threshold for contract deployment of the target user node in the blockchain network, and the apparatus is further configured to:
if the sum of the to-be-deployed times and the first deployed times exceeds the first time threshold, determining a time difference between the sum of the first deployed times and the first time threshold through the administrator node;
initiating a number increase transaction by the administrator node, the number increase transaction comprising the number difference;
and performing uplink processing on the times increment transaction to trigger the block chain network to sum the first time threshold value and the time difference value in the proxy contract according to the times increment transaction to obtain an updated first time threshold value.
Optionally, the deployment unit is further configured to:
acquiring the sum of the first deployed times and the first deployed times of the to-be-deployed times;
updating the first deployed number to the first deployed number sum in the proxy contract based on the target node identification.
Optionally, the contract deployment request includes an identifier of a candidate node where the target contract can be deployed, and the deployment unit is further configured to:
acquiring a target node identifier of the target user node in the block chain network according to the contract deployment request;
if the target node identification belongs to the candidate node identification, a method for deploying contracts in a block chain corresponding to the target contract is created in the agent contract through the manager node;
invoking, by the target user node, a method of deploying contracts in the blockchain in the proxy contract;
deploying the target contract in the blockchain network based on the method of deploying contracts in the blockchain.
Optionally, the number threshold includes a second number threshold, and the number threshold obtaining unit is further configured to:
setting a second time threshold value of contract deployment of deployable user nodes in the blockchain network within preset time in the agent contract through the administrator node, wherein the deployable user nodes comprise user nodes with contract deployment authority in the blockchain network in a plurality of user nodes;
obtaining the second time threshold value of contract deployment of the deployable user node in the blockchain network in the proxy contract.
Optionally, the deployed number is a second deployed number, and the deployed number obtaining unit is further configured to:
acquiring the second deployed times of contract deployment of the deployable user node in the blockchain network within the preset time based on the agent contract.
Optionally, the receiving unit is further configured to:
if the target user node does not have the contract deployment authority for contract deployment in the blockchain network, initiating a node addition transaction through the administrator node, wherein the node addition transaction is used for enabling the target user node to have the contract deployment authority;
and performing uplink processing on the node addition transaction to trigger the blockchain network to set the contract deployment permission for the target user node according to the node addition transaction.
Optionally, the contract deployment request includes an invoking node identifier of an invoking user node that can invoke the target contract in the blockchain network, and the deployment unit is further configured to:
and feeding back target contract addresses of the target contracts in the block chain network to the calling user nodes according to the calling node identifications so as to enable the calling user nodes to call the target contracts according to the target contract addresses, wherein one target contract corresponds to one target contract address.
Optionally, the contract deployment request includes a maximum number of invocations of the target contract, and the apparatus is further configured to:
receiving a contract calling request sent by a target calling user node, wherein the contract calling request comprises a target calling node identifier of the target calling user node and the number of times to be called of the target contract;
if the calling node identification comprises the target calling node identification, acquiring the called times of the target contract in the proxy contract;
calculating the current calling times and the calling times sum of the called times;
and if the sum of the calling times is less than or equal to the maximum calling times, the target calling user node calls the target contract.
Optionally, the receiving unit is further configured to:
if the number of the target user nodes is multiple, receiving a contract deployment request of at least one target user node in the block chain network, wherein the contract deployment request comprises a private key of each target user node and a node identifier in the block chain network;
the deployed number obtaining unit is further configured to:
determining the deployed times of contract deployment of each target user node in the block chain network based on the agent contract;
the deployment unit is further configured to:
and if the sum of the deployed times corresponding to the target user nodes and the deployed times of the to-be-deployed times does not exceed the time threshold, deploying the target contract on the basis of the private key of each target user node in the block chain network and the node identification through the proxy contract.
Similarly, an embodiment of the present application further provides a computer device, including:
a memory for storing a computer program;
a processor for deploying the steps of any of the methods of contracts in executing the blockchain.
Furthermore, an embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of any one of the methods for deploying contracts in a blockchain.
The embodiment of the application provides a method, a device, computer equipment and a storage medium for deploying contracts in a block chain, wherein a user node in the block chain network cannot directly deploy contracts in the block chain network, when a target user node wants to deploy a target contract in a blockchain network, the deployed times of contract deployment in the blockchain network and the to-be-deployed times of contract deployment, which the target user node wants to currently perform, need to be judged through a proxy contract, and the target contract can be further deployed through the proxy contract only if the deployed times of contract deployment in the blockchain network and the to-be-deployed times of contract deployment which the target user node wants to currently perform do not exceed a threshold value of times of contract deployment in the blockchain network, therefore, the times of contract deployment of the user node in the block chain network are limited, a plurality of block chain contracts with the same function in the block chain network can be effectively reduced, and the confusion and the excessive invalid contracts in the block chain network are avoided.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings to be recalled in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
FIG. 1 is a system diagram of a contract deployment apparatus provided by an embodiment of the present application;
fig. 2 is a schematic flowchart of a method for deploying contracts in a blockchain according to an embodiment of the present application;
fig. 3 is another schematic flow chart of a method for deploying contracts in a blockchain according to an embodiment of the present application;
FIG. 4 is a schematic structural diagram of a contract deployment apparatus provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the described embodiments are merely exemplary of the invention, and not restrictive of the full scope of the invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the application provides a method and a device for deploying contracts in a block chain, computer equipment and a storage medium. Specifically, the contract deployment of the embodiment of the present application may be executed by a computer device, where the computer device may be a terminal or a server or other devices. The terminal may be a terminal device such as a smart phone, a tablet Computer, a notebook Computer, a touch screen, a game machine, a Personal Computer (PC), a Personal Digital Assistant (PDA), and the like, and may further include a client, which may be a game application client, a browser client carrying a game program, or an instant messaging client, and the like. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, content distribution network service, big data and an artificial intelligence platform.
Referring to fig. 1, fig. 1 is a schematic system diagram of a contract deployment device according to an embodiment of the present application. The system is a blockchain network system, and can comprise a plurality of terminals as user nodes, wherein one terminal is an administrator node, the blockchain network is used for receiving a contract deployment request of a target user node in the blockchain network, and the contract deployment request comprises at least one target contract to be deployed by the target user node; obtaining a proxy contract deployed by an administrator node, the proxy contract being for deploying a target contract in a blockchain network according to a contract deployment request; acquiring a time threshold value of contract deployment in a block chain network in a proxy contract; acquiring the times to be deployed of contract deployment of a target user node in a block chain network at present based on the number of target contracts; determining a number of deployments for contract deployments in the blockchain network based on the proxy contract; and if the sum of the deployment times of the to-be-deployed times and the deployed times does not exceed the time threshold, deploying the target contract in the block chain network through the agent contract.
The following are detailed below. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments.
The present embodiment will be described from the perspective of a contract deployment apparatus, which may be specifically integrated in a terminal device, where the terminal device may include a smart phone, a notebook computer, a tablet computer, a personal computer, and other devices.
The method for deploying contracts in a blockchain provided by the embodiment of the present application may be executed by a processor of a terminal, as shown in fig. 2, a specific flow of the method for deploying contracts in a blockchain mainly includes steps 201 to 206, which are described in detail as follows:
In the embodiment of the application, the contract is a protocol defined in a digital form, including providing, verifying and executing the protocol in the digital form, and is a contract which replaces the legal language record terms with a computer language and is automatically executed by a program. The contract may be considered a digitized version of a traditional contract, running on a blockchain network, automatically executed by a program. Wherein the target contract is a contract to be deployed by the target user node in the blockchain network. Further, the proxy contract mentioned in step 202 includes the deployed number of times each user node has deployed a contract in the blockchain network and the total number of times the contract can be deployed in the blockchain network, and a proxy transaction method for each contract deployed in the blockchain network, the proxy contract being generated by deployment in the blockchain network by the administrator node.
In this embodiment of the present application, when a target user node wants to enable an agreement made with other user nodes to be valid, the target user node may deploy a contract recording the agreement in a blockchain network, so that user nodes of both parties of the agreement may execute the agreement.
In this embodiment of the present application, the target user node may be one of the user nodes included in the blockchain network, and after the blockchain network receives a contract deployment request of the target user node, it needs to determine whether the target user node has a right to perform contract deployment in the blockchain network. And if so, further judging the contract deployment times.
In the embodiment of the application, if a target user node which wants to perform contract deployment does not have the authority of contract deployment in a blockchain network, in order to enable the target user node to deploy a target user in the blockchain network, a node addition transaction can be initiated through an administrator node, so that a target user identifier can deploy a target contract in the blockchain network. In this case, after the step 201 "receiving a contract deployment request of a target user node in a blockchain network", the method may further include:
if the target user node does not have the contract deployment authority for contract deployment in the block chain network, initiating node increase transaction through the administrator node, wherein the node increase transaction is used for enabling the target user node to have the contract deployment authority;
and performing uplink processing on the node addition transaction so as to trigger the block chain network to set contract deployment permission for the target user node according to the node addition transaction.
In this embodiment of the application, when the target user node may perform contract deployment in the blockchain network, the target user node may directly have a right to perform contract deployment in the blockchain network, and then may continue to perform contract deployment in the blockchain network.
In addition, the target user node may still not have contract deployment authority, but may simply deploy the target contract in the blockchain network without authority to deploy other contracts in the blockchain network.
In the embodiment of the present application, the contract deployment request may include a contract identification (contract name, contract number, etc.) and contract specific content (i.e., code for deploying the contract) of a target contract to be deployed by a target user node in the blockchain network.
In this embodiment of the present application, one or more target user nodes for contract deployment may be provided, and if there are more target user nodes, the step 201 of "receiving a contract deployment request of a target user node in a blockchain network" may be: and if the number of the target user nodes is multiple, receiving a contract deployment request of at least one target user node in the blockchain network, wherein the contract deployment request comprises a private key of each target user node in the blockchain network and a node identifier. At this time, step 205 "determining the number of deployments for contract deployment in the blockchain network based on the proxy contract" may be: determining the deployed times of contract deployment on each target user node in the blockchain network based on the agent contract, and in step 206, "if the sum of the to-be-deployed times and the deployed times of the deployed times does not exceed the time threshold, deploying the target contract in the blockchain network by the agent contract" may be: and if the sum of the deployed times and the deployed times to be deployed which correspond to each target user node does not exceed the time threshold value, deploying the target contract on the basis of the private key of each target user node in the block chain network and the node identification through the proxy contract.
In this embodiment of the present application, before acquiring the agent contract, it is necessary to deploy the agent contract in the blockchain network by an administrator node, where the administrator node may be one of the user nodes, or may be independent from the user node, that is, before the step 202 "acquiring the agent contract deployed by the administrator node", the method further includes:
determining an administrator node among a plurality of user nodes included in a blockchain network;
receiving a contract first-time deployment request of a user node for first-time contract deployment in a block chain network through an administrator node;
agent contracts are deployed in a blockchain network by an administrator node based on a contract first deployment request.
In the embodiment of the present application, the determination method of the administrator node is not limited, and the administrator node may be one user node designated in the blockchain network by a related technical person, or may be a user node elected by a predetermined rule (e.g., multi-sign authority management, network resource optimization, etc.). The number of administrator nodes may also be unlimited and may be one or more.
In the embodiment of the present application, the contract first-time deployment request is a contract deployment request sent when one of all the user nodes in the blockchain network performs contract deployment for the first time, and after the administrator node receives the contract deployment request, the agent contract is deployed in the blockchain network. In order to limit the number of times of contract deployment, a threshold value of the number of times of contract deployment in the blockchain network may be set in the proxy contract, and the number of deployed times of contract deployment in the blockchain network may be recorded in real time. In addition, in order to enable the user node to perform contract deployment in the blockchain network through the proxy contract, a method for performing contract deployment may be set in the proxy contract.
In the embodiment of the application, in order to reduce the deployment of the proxy contracts and reduce the resource occupation of the proxy contracts, only one proxy contract may be provided in the blockchain network, and all the user nodes performing contract deployment may obtain the times threshold and the deployed times through one proxy contract and call a contract deployment method in one proxy contract to perform contract deployment.
In the embodiment of the present application, in order to avoid frequent use of the agent contract, each user node performing contract deployment may also correspond to one agent contract, that is, when each user node performs contract deployment in the blockchain network for the first time, the agent contract corresponding to the user node is deployed in the blockchain network through the administrator node, and when each user node deploys a contract in the blockchain network, the number of times is determined through the corresponding agent contract and a contract deployment method is invoked.
In an embodiment of the present application, the administrator node may also deploy a proxy contract each time the user node performs contract deployment in the blockchain network.
In this embodiment of the present application, a maximum number of times that each user node can perform contract deployment in the blockchain network, that is, a first time threshold value, may be set in the proxy contract, and when the time threshold value is the first time threshold value, before the step 203 "obtaining the threshold value of times of contract deployment in the blockchain network in the proxy contract," the method may further include: receiving first-time limit information sent by a target user node through an administrator node, wherein the first-time limit information comprises a first-time threshold value for contract deployment of the target user node in a block chain network; the first time threshold is set in the proxy contract by the administrator node. In this case, the step 203 "obtaining the threshold of the number of times of contract deployment in the blockchain network in the proxy contract" includes: and acquiring a first time threshold value of contract deployment of the target user node in the blockchain network in the proxy contract.
In this embodiment of the present application, the first-time threshold for contract deployment of each user node in the blockchain network may be determined by the user node itself, and then the first-time limit information is sent to the administrator node, so that the administrator node obtains the first-time threshold.
In the embodiment of the present application, in order to better manage the contract deployment times of each user node in the blockchain network, the first time threshold of each user node may be uniformly set. The first time threshold corresponding to each user node may be the same or different.
In the embodiment of the present application, a total number of times that all user nodes can perform contract deployment in the blockchain network within a preset time (for example, one day), that is, a second time threshold value, may be set in the proxy contract, so as to avoid more contracts being deployed in the blockchain network. When the time threshold is the second time threshold, before "obtaining the threshold of times of contract deployment in the blockchain network in the agent contract" in step 203, the method may further include: and setting a second time threshold value of contract deployment of the deployable user nodes in the blockchain network in a preset time in the agent contract by the manager node, wherein the deployable user nodes comprise user nodes with contract deployment authority in the blockchain network in a plurality of user nodes. At this time, the step 203 "obtaining the threshold of the number of times of contract deployment in the blockchain network in the proxy contract" may be: and acquiring a second times threshold value of contract deployment of the deployable user nodes in the blockchain network in the proxy contract.
And 204, acquiring the times to be deployed of contract deployment of the target user node in the block chain network at present based on the number of the target contracts.
In the embodiment of the application, as the user node deploys one target contract at a time, that is, the number of the target contracts is the same as the number of times of to-be-deployed of the target user node about to perform contract deployment in the block chain network, the number of the target contracts can be determined according to the contract deployment request, and then the number of the target contracts is the number of times of to-be-deployed of the target user node.
In this embodiment of the application, the contract deployment request includes a target node identifier of the target user node in the blockchain network, and when the time threshold is the first time threshold, the deployed times are first deployed times that the target user node has deployed the contract in the blockchain network, where the step 205 "determining deployed times for contract deployment in the blockchain network based on the proxy contract" may be to obtain, in the proxy contract, the first deployed times for contract deployment in the blockchain network by the target user node based on the target node identifier.
In this embodiment of the application, when the time threshold is the second time threshold, the deployed times may be second deployed times in which contracts have been deployed in the blockchain network within a preset time, and at this time, in step 205, "determining deployed times for contract deployment in the blockchain network based on the proxy contract" may be second deployed times for contract deployment in the blockchain network within the preset time by obtaining the deployable user nodes based on the proxy contract.
And step 206, if the sum of the times to be deployed and the deployed times does not exceed the time threshold, deploying the target contract in the block chain network through the proxy contract.
In this embodiment of the application, if the sum of the to-be-deployed times and the deployed times does not exceed the time threshold, the deployed times of the target user node performing contract deployment in the blockchain network does not exceed the maximum times that the target user node can perform contract deployment in the blockchain network, and the to-be-deployed times of the target user node performing contract deployment at the current time does not exceed the times that the target user node can also perform contract deployment in the blockchain network, which indicates that the target user node can also deploy the target contract in the blockchain network.
In this embodiment of the application, when the deployed times are the first deployed times, and the time threshold is the first time threshold for the target user node to perform contract deployment in the blockchain network, if the sum of the to-be-deployed times and the first deployed times of the first deployed times exceeds the first time threshold, it indicates that the target user node cannot currently deploy the target contract in the blockchain network. At this time, in order to avoid that some important contracts of the target user node cannot be deployed in the blockchain network, the administrator node may increase the maximum number of times that the target user node can perform contract deployment in the blockchain network, that is, the administrator node may increase the originally set first time threshold value in the proxy contract. In order to enable the target user node to currently deploy the target contract and control the number of times that the target user node deploys the contract in the blockchain network, the first time threshold may be changed to a minimum value that allows the target user node to deploy the target contract, which may specifically be:
if the sum of the to-be-deployed times and the first deployed times exceeds a first time threshold, determining a time difference between the sum of the first deployed times and the first time threshold through an administrator node;
initiating a number increase transaction through the administrator node, the number increase transaction comprising a number difference;
and performing uplink processing on the number-of-times-increasing transaction to trigger the block chain network to sum the first time threshold value and the difference value of the number of times in the proxy contract according to the number-of-times-increasing transaction to obtain an updated first time threshold value.
In this embodiment of the present application, in order to accurately record, in real time, the deployed times of contract deployment performed by a target user node in a blockchain network, after the target user node deploys a target contract in the blockchain network, it indicates that the deployed times of contract deployment performed by the target user node in the blockchain network change, and the deployed times need to be updated, where the specific method may be:
acquiring the sum of the first deployed times and the first deployed times of the to-be-deployed times;
the first deployed number is updated in the proxy contract to a first deployed number sum based on the target node identification.
In this embodiment of the present application, the contract deployment request includes candidate node identifications of deployable target contracts, and the "deploying the target contract in the blockchain network by the proxy contract" in step 206 may be:
acquiring a target node identifier of a target user node in a block chain network according to a contract deployment request;
if the target node identification belongs to the candidate node identification, a contract deployment method corresponding to the target contract is created in the agent contract through the administrator node;
calling a contract deployment method in the proxy contract through the target user node;
target contracts are deployed in a blockchain network based on a contract deployment approach.
In this embodiment of the present application, after a target contract is deployed in a blockchain network, a user node having a right to invoke the target contract may invoke the target contract to complete a series of functions, and the user node having the right to invoke the target contract needs to obtain a contract address of the target contract in the blockchain network, and therefore, after the target contract is deployed, a contract address of the target contract needs to be sent to the user node having the right to invoke the target contract, where a specific contract deployment request includes an invoking node identifier of the invoking user node that can invoke the target contract in the blockchain network, and the foregoing step 206 "deploy the target contract in the blockchain network through a proxy contract" may further include: and feeding back a target contract address of the target contract in the block chain network to the calling user node according to the calling node identification so as to enable the calling user node to call the target contract according to the target contract address, wherein one target contract corresponds to one target contract address.
In this embodiment of the present application, in order to avoid that a user node having an authority to invoke a target contract makes multiple useless invocations, so that network resources are wasted, the invocation times of each user node having the authority to invoke the target contract may be limited, that is, the contract deployment request may include the maximum invocable times of the target contract, specifically:
receiving a contract calling request sent by a target calling user node, wherein the contract calling request comprises a target calling node identifier of the target calling user node and the number of times to be called for a target contract;
if the calling node identification comprises a target calling node identification, acquiring the called times of a target contract in the proxy contract;
calculating the sum of the current calling times and the calling times of the called times;
and if the sum of the calling times is less than or equal to the maximum calling times, realizing that the target calling user node calls the target contract.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
According to the method for deploying the contracts in the blockchain, the user nodes in the blockchain network cannot directly deploy the contracts in the blockchain network, when the target user nodes want to deploy the target contracts in the blockchain network, the deployed times of the contracts in the blockchain network and the times to be deployed of the target user nodes, which want to perform the contracts deployment currently, need to be judged through the proxy contracts, and the times of the contracts deployment of the user nodes in the blockchain network can be further deployed through the proxy contracts without exceeding the threshold value of the times of the contracts deployment in the blockchain network, so that the times of the contracts deployment of the user nodes in the blockchain network are limited, multiple blockchain contracts with the same functions in the blockchain network can be effectively reduced, and the contracts confusion and the invalid contracts in the blockchain network are avoided from being too many.
Referring to fig. 3, fig. 3 is another schematic flow chart of a method for deploying contracts in a blockchain according to an embodiment of the present disclosure. The specific process of the method can be as follows:
determining an administrator node in the user nodes of the blockchain network, wherein the administrator node deploys the agent contract in the blockchain network, the agent contract records a first time threshold value of contracts which can be deployed by the user nodes for contract deployment and a first deployed time of the deployed contracts in the blockchain network, when a contract deployment request of a user is received, determining that a target user node can perform contract deployment in the blockchain network according to a first time threshold, a first deployed time and a to-be-deployed time for currently performing contract deployment, the contract deployment method corresponding to the target contract 1 and the contract deployment method corresponding to the target contract n are deployed in the proxy contract, the user node invokes the contract deployment method corresponding to the target contract 1 in the proxy contract to deploy the user contract 1 in the blockchain network, and invokes the contract deployment method corresponding to the target contract n in the proxy contract to deploy the user contract n in the blockchain network.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
According to the method for deploying the contracts in the blockchain, the user nodes in the blockchain network cannot directly deploy the contracts in the blockchain network, when the target user nodes want to deploy the target contracts in the blockchain network, the deployed times of the contracts in the blockchain network and the times to be deployed of the target user nodes, which want to perform the contracts deployment currently, need to be judged through the proxy contracts, and the times of the contracts deployment of the user nodes in the blockchain network can be further deployed through the proxy contracts without exceeding the threshold value of the times of the contracts deployment in the blockchain network, so that the times of the contracts deployment of the user nodes in the blockchain network are limited, multiple blockchain contracts with the same functions in the blockchain network can be effectively reduced, and the contracts confusion and the invalid contracts in the blockchain network are avoided from being too many.
In order to better implement the method for deploying contracts in the blockchain in the embodiments of the present application, an embodiment of the present application further provides a contract deploying apparatus. Referring to fig. 4, fig. 4 is a schematic structural diagram of a contract deployment device according to an embodiment of the present application. The contract deployment device is applied to a blockchain network with a plurality of user nodes, wherein the user nodes comprise administrator nodes and can comprise a receiving unit 401, a contract acquisition unit 402, a number threshold acquisition unit 403, a to-be-deployed number acquisition unit 404, a deployed number acquisition unit 405 and a deployment unit 406.
The receiving unit 401 is configured to receive a contract deployment request of a target user node in a blockchain network, where the contract deployment request is used to indicate that at least one target contract to be deployed by the target user node is to be deployed in the blockchain network;
a contract acquisition unit 402 configured to acquire a proxy contract deployed by an administrator node of the blockchain network, the proxy contract being configured to deploy a target contract in the blockchain network according to a contract deployment request;
a number threshold obtaining unit 403, configured to obtain, in the proxy contract, a number threshold for contract deployment in the blockchain network;
a to-be-deployed number obtaining unit 404, configured to obtain, based on the number of the target contract, a to-be-deployed number of times that the target user node performs contract deployment in the block chain network currently;
a deployed number acquisition unit 405 configured to determine, based on the proxy contract, a deployed number of times contract deployment is performed in the blockchain network;
and the deploying unit 406 is configured to deploy, if the sum of the to-be-deployed times and the deployed times does not exceed the time threshold, a target contract in the blockchain network through the proxy contract.
Optionally, the contract obtaining unit 402 is further configured to:
determining an administrator node among a plurality of user nodes included in a blockchain network;
receiving a contract first-time deployment request of a user node for first-time contract deployment in a block chain network through an administrator node;
agent contracts are deployed in a blockchain network by an administrator node based on a contract first deployment request.
Optionally, the number threshold includes a first number threshold, and the number threshold obtaining unit 403 is further configured to:
receiving first-time limit information sent by a target user node through an administrator node, wherein the first-time limit information comprises a first-time threshold value for contract deployment of the target user node in a block chain network;
setting a first time threshold in a proxy contract by an administrator node;
and acquiring a first time threshold value of contract deployment of the target user node in the blockchain network in the proxy contract.
Optionally, the contract deployment request includes a target node identifier of the target user node in the blockchain network, where the deployed number is a first deployed number, and the deployed number obtaining unit 405 is further configured to:
and acquiring the first deployed times of contract deployment of the target user node in the blockchain network in the proxy contract based on the target node identification.
Optionally, the time threshold includes a first time threshold for contract deployment of the target user node in the blockchain network, and the apparatus is further configured to:
if the sum of the to-be-deployed times and the first deployed times exceeds a first time threshold, determining a time difference between the sum of the first deployed times and the first time threshold through an administrator node;
initiating a number increase transaction through the administrator node, the number increase transaction comprising a number difference;
and performing uplink processing on the number-of-times-increasing transaction to trigger the block chain network to sum the first time threshold value and the difference value of the number of times in the proxy contract according to the number-of-times-increasing transaction to obtain an updated first time threshold value.
Optionally, the deployment unit 406 is further configured to:
acquiring the sum of the first deployed times and the first deployed times of the to-be-deployed times;
the first deployed number is updated in the proxy contract to a first deployed number sum based on the target node identification.
Optionally, the contract deployment request includes a candidate node identifier of the deployable target contract, and the deployment unit 406 is further configured to:
acquiring a target node identifier of a target user node in a block chain network according to a contract deployment request;
if the target node identification belongs to the candidate node identification, a contract deployment method corresponding to the target contract is created in the agent contract through the administrator node;
calling a contract deployment method in the proxy contract through the target user node;
target contracts are deployed in a blockchain network based on a contract deployment approach.
Optionally, the number threshold includes a second number threshold, and the number threshold obtaining unit 403 is further configured to:
setting a second time threshold value for contract deployment of deployable user nodes in the blockchain network within preset time in the agent contract through the administrator node, wherein the deployable user nodes comprise user nodes with contract deployment authority in the blockchain network in a plurality of user nodes;
and acquiring a second times threshold value of contract deployment of the deployable user nodes in the blockchain network in the proxy contract.
Optionally, the deployed number is a second deployed number, and the deployed number obtaining unit 405 is further configured to:
and acquiring a second deployed number of times of contract deployment of the deployable user node in the blockchain network within a preset time based on the agent contract.
Optionally, the receiving unit 401 is further configured to:
if the target user node does not have the contract deployment authority for contract deployment in the block chain network, initiating node increase transaction through the administrator node, wherein the node increase transaction is used for enabling the target user node to have the contract deployment authority;
and performing uplink processing on the node addition transaction so as to trigger the block chain network to set contract deployment permission for the target user node according to the node addition transaction.
Optionally, the contract deployment request includes an identification of a calling node of a calling user node that can call the target contract in the blockchain network, and the deployment unit 406 is further configured to:
and feeding back a target contract address of the target contract in the block chain network to the calling user node according to the calling node identification so as to enable the calling user node to call the target contract according to the target contract address, wherein one target contract corresponds to one target contract address.
Optionally, the contract deployment request includes a maximum number of invocations of the target contract, and the apparatus is further configured to:
receiving a contract calling request sent by a target calling user node, wherein the contract calling request comprises a target calling node identifier of the target calling user node and the number of times to be called for a target contract;
if the calling node identification comprises a target calling node identification, acquiring the called times of a target contract in the proxy contract;
calculating the sum of the current calling times and the calling times of the called times;
and if the sum of the calling times is less than or equal to the maximum calling times, realizing that the target calling user node calls the target contract.
Optionally, the receiving unit 401 is further configured to:
if a plurality of target user nodes are available, receiving a contract deployment request of at least one target user node in the blockchain network, wherein the contract deployment request comprises a private key of each target user node in the blockchain network and a node identifier;
the deployed number of times acquisition unit 405 is further configured to:
determining the deployed times of contract deployment of each target user node in the blockchain network based on the agent contract;
and if the sum of the deployed times and the deployed times to be deployed which correspond to each target user node does not exceed the time threshold value, deploying the target contract on the basis of the private key of each target user node in the block chain network and the node identification through the proxy contract.
All the above technical solutions can be combined arbitrarily to form the optional embodiments of the present application, and are not described herein again.
According to the contract deployment device provided by the embodiment of the application, the user node in the blockchain network cannot directly deploy the contract in the blockchain network, when the target user node wants to deploy the target contract in the blockchain network, the deployed times of the contract deployment in the blockchain network and the to-be-deployed times of the contract deployment currently wanted by the target user node need to be judged through the proxy contract, and the times of the contract deployment in the blockchain network by the user node can be further deployed through the proxy contract without exceeding the threshold value of the times of the contract deployment in the blockchain network, so that the times of the contract deployment in the blockchain network by the user node are limited, a plurality of blockchain contracts with the same functions in the blockchain network can be effectively reduced, and the confusion and excessive invalid contracts in the blockchain network are avoided.
Correspondingly, the embodiment of the application also provides a computer device, which can be a terminal, and the terminal can be a terminal device such as a smart phone, a tablet computer, a notebook computer, a touch screen, a game machine, a personal computer, a personal digital assistant and the like. As shown in fig. 5, fig. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application. The computer apparatus 500 includes a processor 501 having one or more processing cores, a memory 502 having one or more computer-readable storage media, and a computer program stored on the memory 502 and executable on the processor. The processor 501 is electrically connected to the memory 502. Those skilled in the art will appreciate that the computer device configurations illustrated in the figures are not meant to be limiting of computer devices and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The processor 501 is a control center of the computer device 500, connects various parts of the entire computer device 500 using various interfaces and lines, performs various functions of the computer device 500 and processes data by running or loading software programs and/or modules stored in the memory 502, and calling data stored in the memory 502, thereby monitoring the computer device 500 as a whole.
In this embodiment of the application, the processor 501 in the computer device 500 loads instructions corresponding to processes of one or more applications into the memory 502, and the processor 501 runs the applications stored in the memory 502, so as to implement various functions as follows:
receiving a contract deployment request of a target user node in the blockchain network, wherein the contract deployment request is used for indicating that at least one target contract to be deployed by the target user node is deployed in the blockchain network;
acquiring a proxy contract deployed by an administrator node of the blockchain network, wherein the proxy contract is used for deploying a target contract in the blockchain network according to a contract deployment request;
acquiring a time threshold value of contract deployment in a block chain network in a proxy contract;
acquiring the times to be deployed of contract deployment of a target user node in a block chain network at present based on the number of target contracts;
determining a number of deployments for contract deployments in the blockchain network based on the proxy contract;
and if the sum of the deployment times of the to-be-deployed times and the deployed times does not exceed the time threshold, deploying the target contract in the block chain network through the agent contract.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Optionally, as shown in fig. 5, the computer device 500 further includes: touch-sensitive display screen 503, radio frequency circuit 504, audio circuit 505, input unit 506 and power 507. The processor 501 is electrically connected to the touch display screen 503, the radio frequency circuit 504, the audio circuit 505, the input unit 506, and the power supply 507, respectively. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 5 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components.
The touch display screen 503 can be used for displaying a graphical user interface and receiving an operation instruction generated by a user acting on the graphical user interface. The touch display screen 503 may include a display panel and a touch panel. The display panel may be used, among other things, to display information entered by or provided to a user and various graphical user interfaces of the computer device, which may be made up of graphics, text, icons, video, and any combination thereof. Alternatively, the Display panel may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like. The touch panel can be used for collecting touch operations of a user on or near the touch panel (such as operations of the user on or near the touch panel by cashing a finger, a stylus pen and any other suitable object or accessory), and generating corresponding operation instructions, and the operation instructions execute corresponding programs. Alternatively, the touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 501, and can receive and execute commands sent by the processor 501. The touch panel may overlay the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel transmits the touch operation to the processor 501 to determine the type of the touch event, and then the processor 501 provides a corresponding visual output on the display panel according to the type of the touch event. In the embodiment of the present application, the touch panel and the display panel may be integrated into the touch display screen 503 to implement input and output functions. However, in some embodiments, the touch panel and the touch panel can be implemented as two separate components to perform the input and output functions. That is, the touch display 503 can also be used as a part of the input unit 506 to implement an input function.
The rf circuit 504 may be used for transceiving rf signals to establish wireless communication with a network device or other computer device via wireless communication, and for transceiving signals with the network device or other computer device.
The input unit 506 may be used to receive input numbers, character information, or user characteristic information (e.g., fingerprint, iris, facial information, etc.), and generate keyboard, mouse, joystick, optical, or trackball signal inputs related to user settings and function control.
The power supply 507 is used to power the various components of the computer device 500. Optionally, the power supply 507 may be logically connected to the processor 501 through a power management system, so as to implement functions of managing charging, discharging, power consumption management, and the like through the power management system. The power supply 507 may also include any component including one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown in fig. 5, the computer device 500 may further include a camera, a sensor, a wireless fidelity module, a bluetooth module, etc., which are not described in detail herein.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
As can be seen from the above, in the computer device provided in this embodiment, a user node in the blockchain network cannot directly deploy a contract in the blockchain network, and when a target user node wants to deploy a target contract in the blockchain network, it is necessary to judge, by a proxy contract, how many times contract deployment have been performed in the blockchain network and how many times to be deployed for the target user node currently wants to perform contract deployment, and the number of times to be deployed for the target user node in the blockchain network does not exceed a threshold of times that contract deployment can be performed in the blockchain network, and then the target contract can be further deployed by the proxy contract, so that the number of times that the user node performs contract deployment in the blockchain network is limited, and multiple block chain contracts with the same function in the blockchain network can be effectively reduced, and contract confusion and excessive invalid contracts in the blockchain network are avoided.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer-readable storage medium, in which a plurality of computer programs are stored, where the computer programs can be loaded by a processor to execute the steps in any method for deploying contracts in a blockchain provided by the embodiments of the present application. For example, the computer program may perform the steps of:
receiving a contract deployment request of a target user node in the blockchain network, wherein the contract deployment request is used for indicating that at least one target contract to be deployed by the target user node is deployed in the blockchain network;
acquiring a proxy contract deployed by an administrator node of the blockchain network, wherein the proxy contract is used for deploying a target contract in the blockchain network according to a contract deployment request;
acquiring a time threshold value of contract deployment in a block chain network in a proxy contract;
acquiring the times to be deployed of contract deployment of a target user node in a block chain network at present based on the number of target contracts;
determining a number of deployments for contract deployments in the blockchain network based on the proxy contract;
and if the sum of the deployment times of the to-be-deployed times and the deployed times does not exceed the time threshold, deploying the target contract in the block chain network through the agent contract.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein.
Wherein the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Since the computer program stored in the storage medium may execute the steps in the method for deploying contracts in any blockchain provided in the embodiment of the present application, beneficial effects that can be achieved by the method for deploying contracts in any blockchain provided in the embodiment of the present application can be achieved, for details, see the foregoing embodiments, and are not described herein again.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The method, the apparatus, the computer device, and the storage medium for deploying contracts in a blockchain provided in the embodiments of the present application are described in detail above, and a specific example is applied in the description to explain the principle and the implementation of the present invention, and the description of the above embodiments is only used to help understanding the technical solution and the core idea of the present invention; those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (16)
1. A method for deploying contracts in blockchains, the method being applied to a blockchain network having a plurality of user nodes, the method comprising:
receiving a contract deployment request of a target user node in the blockchain network, wherein the contract deployment request is used for indicating that at least one target to be deployed by the target user node is deployed in the blockchain network;
obtaining a proxy contract deployed by an administrator node of the blockchain network, the proxy contract being used to deploy the target contract in the blockchain network according to the contract deployment request;
acquiring a number threshold of contract deployment in the block chain network in the agent contract;
acquiring the number of times to be deployed of contract deployment of the target user node in the block chain network at present based on the number of the target contracts;
determining a number of deployed contracts in the blockchain network based on the proxy contracts;
and if the sum of the deployment times of the to-be-deployed times and the deployed times does not exceed the time threshold, deploying the target contract in the block chain network through the proxy contract.
2. The method of claim 1, wherein prior to obtaining the proxy contract deployed by the administrator node of the blockchain network, further comprising:
determining the administrator node among a plurality of the user nodes included in the blockchain network;
receiving, by the administrator node, a contract first-time deployment request for contract deployment of the user node in the blockchain network for the first time;
deploying, by the administrator node, the proxy contract in the blockchain network based on the contract first deployment request.
3. The method of claim 1, wherein the time threshold comprises a first time threshold, and wherein prior to obtaining the threshold of times contracts are deployed in the blockchain network in the proxy contract, further comprising:
receiving, by the administrator node, first nonce limitation information sent by the target user node, where the first nonce limitation information includes the first nonce threshold for contract deployment of the target user node in the blockchain network;
setting, by the administrator node, the first time threshold in the proxy contract;
the acquiring, in the proxy contract, a threshold of the number of times of contract deployment in the blockchain network includes:
acquiring the first time threshold value of contract deployment of the target user node in the block chain network in the proxy contract.
4. The method of claim 1, wherein the contract deployment request includes a target node identification of the target user node in the blockchain network, the number of deployments being a first number of deployments, and wherein determining the number of deployments for contract deployments in the blockchain network based on the proxy contract comprises:
acquiring the first deployed times of contract deployment of the target user node in the blockchain network in the proxy contract based on the target node identification.
5. The method of claim 4, wherein the time threshold is a first time threshold for contract deployment by the target user node in the blockchain network, and wherein the method further comprises:
if the sum of the to-be-deployed times and the first deployed times exceeds the first time threshold, determining a time difference between the sum of the first deployed times and the first time threshold through the administrator node;
initiating a number increase transaction by the administrator node, the number increase transaction comprising the number difference;
and performing uplink processing on the times increment transaction to trigger the block chain network to sum the first time threshold value and the time difference value in the proxy contract according to the times increment transaction to obtain an updated first time threshold value.
6. The method of claim 4, wherein after the deploying the target contract in the blockchain network by the proxy contract, further comprises:
acquiring the sum of the first deployed times and the first deployed times of the to-be-deployed times;
updating the first deployed number to the first deployed number sum in the proxy contract based on the target node identification.
7. The method of claim 1, wherein the contract deployment request includes an identification of candidate nodes at which the target contract may be deployed, and wherein deploying the target contract in the blockchain network via the proxy contract comprises:
acquiring a target node identifier of the target user node in the block chain network according to the contract deployment request;
if the target node identification belongs to the candidate node identification, a contract deployment method corresponding to the target contract is created in the agent contract through the manager node;
invoking, by the target user node, the contract deployment method in the proxy contract;
deploying the target contract in the blockchain network based on the contract deployment method.
8. The method of claim 1, wherein the time threshold is a second time threshold, and wherein before obtaining the threshold of times of contract deployments in the blockchain network in the proxy contracts, the method further comprises:
setting a second time threshold value of contract deployment of deployable user nodes in the blockchain network within preset time in the agent contract through the administrator node, wherein the deployable user nodes comprise user nodes with contract deployment authority in the blockchain network in a plurality of user nodes;
the acquiring, in the proxy contract, a threshold of the number of times of contract deployment in the blockchain network includes:
obtaining the second time threshold value of contract deployment of the deployable user node in the blockchain network in the proxy contract.
9. The method of claim 8, wherein the number of deployments is a second number of deployments, and wherein determining the number of deployments for contract deployments in the blockchain network based on the proxy contract comprises:
acquiring the second deployed times of contract deployment of the deployable user node in the blockchain network within the preset time based on the agent contract.
10. The method of claim 1, wherein the receiving a contract deployment request by a target user node in the blockchain network further comprises:
if the target user node does not have the contract deployment authority for contract deployment in the blockchain network, initiating a node addition transaction through the administrator node, wherein the node addition transaction is used for enabling the target user node to have the contract deployment authority;
and performing uplink processing on the node addition transaction to trigger the blockchain network to set the contract deployment permission for the target user node according to the node addition transaction.
11. The method of claim 1, wherein the contract deployment request includes a calling node identification of a calling user node in the blockchain network that can call the target contract, and wherein after deploying the target contract in the blockchain network by the proxy contract, further comprising:
and feeding back target contract addresses of the target contracts in the block chain network to the calling user nodes according to the calling node identifications so as to enable the calling user nodes to call the target contracts according to the target contract addresses, wherein one target contract corresponds to one target contract address.
12. The method of claim 11, wherein the contract deployment request includes a maximum number of invocations of the target contract, the method further comprising:
receiving a contract calling request sent by a target calling user node, wherein the contract calling request comprises a target calling node identifier of the target calling user node and the number of times to be called of the target contract;
if the calling node identification comprises the target calling node identification, acquiring the called times of the target contract in the proxy contract;
calculating the current calling times and the calling times sum of the called times;
and if the sum of the calling times is less than or equal to the maximum calling times, the target calling user node calls the target contract.
13. The method of claim 1, wherein receiving a contract deployment request of a target user node in the blockchain network comprises:
if the number of the target user nodes is multiple, receiving a contract deployment request of at least one target user node in the blockchain network, wherein the contract deployment request comprises a private key of each target user node in the blockchain network and a node identifier;
the determining a number of deployed times for contract deployment in the blockchain network based on the proxy contract comprises:
determining the deployed times of contract deployment of each target user node in the block chain network based on the agent contract;
if the sum of the number of deployments to be deployed and the number of deployments already deployed does not exceed the number threshold, deploying the target contract in the blockchain network through the proxy contract, including:
and if the sum of the deployed times corresponding to the target user nodes and the deployed times of the to-be-deployed times does not exceed the time threshold, deploying the target contract on the basis of the private key of each target user node in the block chain network and the node identification through the proxy contract.
14. A contract deployment apparatus for use in a blockchain network having a plurality of customer nodes, the apparatus comprising:
a receiving unit, configured to receive a contract deployment request of a target user node in the blockchain network, where the contract deployment request is used to indicate that at least one target contract to be deployed by the target user node is deployed in the blockchain network;
a contract acquisition unit configured to acquire a proxy contract deployed by an administrator node of the blockchain network, the proxy contract being configured to deploy the target contract in the blockchain network according to the contract deployment request;
a number threshold acquisition unit, configured to acquire, in the proxy contract, a number threshold for contract deployment in the blockchain network;
a to-be-deployed frequency acquiring unit, configured to acquire, based on the number of the target contracts, a to-be-deployed frequency at which the target user node currently performs contract deployment in the block chain network;
a deployed number obtaining unit configured to determine, based on the proxy contract, a deployed number of times contract deployment is performed in the blockchain network;
and the deployment unit is used for deploying the target contract in the blockchain network through the proxy contract if the sum of the deployment times of the to-be-deployed times and the deployed times does not exceed the time threshold.
15. A computer device, comprising:
a memory for storing a computer program;
a processor for implementing the steps in a method for deploying contracts in a blockchain as claimed in any one of claims 1 to 13 when executing the computer program.
16. A computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the steps in a method for deploying contracts in a blockchain as claimed in any one of claims 1 to 13.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210056362.7A CN114422535B (en) | 2022-01-18 | 2022-01-18 | Method, apparatus, computer device and storage medium for distributing contracts in blockchain |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210056362.7A CN114422535B (en) | 2022-01-18 | 2022-01-18 | Method, apparatus, computer device and storage medium for distributing contracts in blockchain |
Publications (2)
Publication Number | Publication Date |
---|---|
CN114422535A true CN114422535A (en) | 2022-04-29 |
CN114422535B CN114422535B (en) | 2024-04-09 |
Family
ID=81274389
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210056362.7A Active CN114422535B (en) | 2022-01-18 | 2022-01-18 | Method, apparatus, computer device and storage medium for distributing contracts in blockchain |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114422535B (en) |
Citations (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107392619A (en) * | 2017-07-31 | 2017-11-24 | 众安信息技术服务有限公司 | Intelligent contract processing method and processing device |
CN108009823A (en) * | 2017-11-03 | 2018-05-08 | 厦门快商通信息技术有限公司 | The distributed call method and system for calculating power resource based on block chain intelligence contract |
US20190355025A1 (en) * | 2018-05-17 | 2019-11-21 | Alibaba Group Holding Limited | Blockchain-based resource value evaluation methods and apparatus |
CN110599179A (en) * | 2019-09-25 | 2019-12-20 | 腾讯科技(深圳)有限公司 | Risk control method based on block chain system and related equipment |
CN110602133A (en) * | 2019-09-20 | 2019-12-20 | 腾讯科技(深圳)有限公司 | Intelligent contract processing method, block chain management device and storage medium |
CN110908786A (en) * | 2019-11-19 | 2020-03-24 | 腾讯科技(深圳)有限公司 | Intelligent contract calling method, device and medium |
CN111062060A (en) * | 2019-11-28 | 2020-04-24 | 杭州趣链科技有限公司 | Voting proposal life cycle management method based on intelligent contract |
CN111160911A (en) * | 2019-12-31 | 2020-05-15 | 杭州趣链科技有限公司 | Intelligent contract calling frequency control method facing block chain |
CN111161006A (en) * | 2018-11-08 | 2020-05-15 | 北京京东尚科信息技术有限公司 | Block chain credit service method, system and storage medium |
CN111240772A (en) * | 2020-01-22 | 2020-06-05 | 腾讯科技(深圳)有限公司 | Data processing method and device based on block chain and storage medium |
CN111628997A (en) * | 2020-05-26 | 2020-09-04 | 中国联合网络通信集团有限公司 | Attack prevention method and device |
CN112613043A (en) * | 2020-12-30 | 2021-04-06 | 杭州趣链科技有限公司 | Intelligent contract vulnerability detection method based on intelligent contract calling network |
CN113037817A (en) * | 2020-08-31 | 2021-06-25 | 支付宝(杭州)信息技术有限公司 | Method and device for starting intelligent contract, electronic equipment and storage medium |
CN113242230A (en) * | 2021-05-07 | 2021-08-10 | 中国科学技术大学 | Multi-level authentication and access control system and method based on intelligent contracts |
CN113379420A (en) * | 2021-06-25 | 2021-09-10 | 远光软件股份有限公司 | Block chain execution intelligent contract method, computer equipment and block chain system |
CN113408746A (en) * | 2021-06-22 | 2021-09-17 | 深圳大学 | Block chain-based distributed federal learning method and device and terminal equipment |
US20210318897A1 (en) * | 2020-08-31 | 2021-10-14 | Alipay (Hangzhou) Information Technology Co., Ltd. | Methods, blockchain nodes, and node devices for executing smart contract |
US20210326864A1 (en) * | 2020-08-31 | 2021-10-21 | Alipay (Hangzhou) Information Technology Co., Ltd. | Methods, blockchain nodes, and storage media for executing smart contract |
-
2022
- 2022-01-18 CN CN202210056362.7A patent/CN114422535B/en active Active
Patent Citations (18)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107392619A (en) * | 2017-07-31 | 2017-11-24 | 众安信息技术服务有限公司 | Intelligent contract processing method and processing device |
CN108009823A (en) * | 2017-11-03 | 2018-05-08 | 厦门快商通信息技术有限公司 | The distributed call method and system for calculating power resource based on block chain intelligence contract |
US20190355025A1 (en) * | 2018-05-17 | 2019-11-21 | Alibaba Group Holding Limited | Blockchain-based resource value evaluation methods and apparatus |
CN111161006A (en) * | 2018-11-08 | 2020-05-15 | 北京京东尚科信息技术有限公司 | Block chain credit service method, system and storage medium |
CN110602133A (en) * | 2019-09-20 | 2019-12-20 | 腾讯科技(深圳)有限公司 | Intelligent contract processing method, block chain management device and storage medium |
CN110599179A (en) * | 2019-09-25 | 2019-12-20 | 腾讯科技(深圳)有限公司 | Risk control method based on block chain system and related equipment |
CN110908786A (en) * | 2019-11-19 | 2020-03-24 | 腾讯科技(深圳)有限公司 | Intelligent contract calling method, device and medium |
CN111062060A (en) * | 2019-11-28 | 2020-04-24 | 杭州趣链科技有限公司 | Voting proposal life cycle management method based on intelligent contract |
CN111160911A (en) * | 2019-12-31 | 2020-05-15 | 杭州趣链科技有限公司 | Intelligent contract calling frequency control method facing block chain |
CN111240772A (en) * | 2020-01-22 | 2020-06-05 | 腾讯科技(深圳)有限公司 | Data processing method and device based on block chain and storage medium |
CN111628997A (en) * | 2020-05-26 | 2020-09-04 | 中国联合网络通信集团有限公司 | Attack prevention method and device |
US20210318897A1 (en) * | 2020-08-31 | 2021-10-14 | Alipay (Hangzhou) Information Technology Co., Ltd. | Methods, blockchain nodes, and node devices for executing smart contract |
CN113037817A (en) * | 2020-08-31 | 2021-06-25 | 支付宝(杭州)信息技术有限公司 | Method and device for starting intelligent contract, electronic equipment and storage medium |
US20210326864A1 (en) * | 2020-08-31 | 2021-10-21 | Alipay (Hangzhou) Information Technology Co., Ltd. | Methods, blockchain nodes, and storage media for executing smart contract |
CN112613043A (en) * | 2020-12-30 | 2021-04-06 | 杭州趣链科技有限公司 | Intelligent contract vulnerability detection method based on intelligent contract calling network |
CN113242230A (en) * | 2021-05-07 | 2021-08-10 | 中国科学技术大学 | Multi-level authentication and access control system and method based on intelligent contracts |
CN113408746A (en) * | 2021-06-22 | 2021-09-17 | 深圳大学 | Block chain-based distributed federal learning method and device and terminal equipment |
CN113379420A (en) * | 2021-06-25 | 2021-09-10 | 远光软件股份有限公司 | Block chain execution intelligent contract method, computer equipment and block chain system |
Non-Patent Citations (2)
Title |
---|
滕志军;张力;郭力文;吕金玲;: "基于密集度的虚拟力节点部署算法", 传感技术学报, no. 07 * |
黄豪杰;吴晓晓;李刚强;: "基于区块链智能合约的物联网恶意节点检测和定位", 物联网学报, no. 02 * |
Also Published As
Publication number | Publication date |
---|---|
CN114422535B (en) | 2024-04-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110368676A (en) | Control method, device, storage medium and the electronic equipment of touch information | |
CN113034189A (en) | Attribution method, attribution device, computer equipment and storage medium | |
CN113506100B (en) | Alliance chain data processing method, device, computer equipment and storage medium | |
CN111723163A (en) | Information processing method, device and system | |
CN111359210A (en) | Data processing method and device, electronic equipment and storage medium | |
CN115801717A (en) | Welcome language selection method, device, medium and equipment for chat tool | |
CN115589432A (en) | Message push management method, device, medium and equipment | |
CN113342776B (en) | Transaction information migration method, device, equipment and medium based on intelligent contract | |
CN114422535A (en) | Method and device for deploying contracts in block chain, computer equipment and storage medium | |
CN114327087A (en) | Input event processing method and device, electronic equipment and storage medium | |
CN114428691A (en) | Application calling method and device, electronic equipment and computer-readable storage medium | |
CN113890753A (en) | Digital identity management method, device, system, computer equipment and storage medium | |
CN112138397A (en) | Trigger management method and device, computer equipment and storage medium | |
WO2019000473A1 (en) | Coefficient calculation method, component calling method, device, medium, server, and terminal | |
CN113360883B (en) | Intelligent contract processing method and device, computer equipment and storage medium | |
CN114844911B (en) | Data storage method, device, electronic equipment and computer readable storage medium | |
CN113806801A (en) | Transaction information chaining method, device, computer equipment and storage medium | |
CN115858652A (en) | Data conversion method and device, computer equipment and storage medium | |
CN117519778A (en) | System configuration method, device, computer equipment and storage medium | |
CN115599820A (en) | Batch data processing method, device, medium and equipment | |
CN114849241A (en) | Information processing method and device, computer equipment and storage medium | |
CN116384998A (en) | DID contract management method, DID contract management device, electronic equipment and readable storage medium | |
CN115952194A (en) | Business data caching method and device, computer equipment and storage medium | |
CN115794915A (en) | Data calling method and device, computer equipment and storage medium | |
CN115658264A (en) | Event execution method and device, electronic 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 |