WO2024016984A1 - Smart contract deployment method and apparatus, device, medium, and product - Google Patents

Smart contract deployment method and apparatus, device, medium, and product Download PDF

Info

Publication number
WO2024016984A1
WO2024016984A1 PCT/CN2023/103599 CN2023103599W WO2024016984A1 WO 2024016984 A1 WO2024016984 A1 WO 2024016984A1 CN 2023103599 W CN2023103599 W CN 2023103599W WO 2024016984 A1 WO2024016984 A1 WO 2024016984A1
Authority
WO
WIPO (PCT)
Prior art keywords
smart contract
target container
container
verification
target
Prior art date
Application number
PCT/CN2023/103599
Other languages
French (fr)
Chinese (zh)
Inventor
罗锦旭
Original Assignee
深圳前海环融联易信息科技服务有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳前海环融联易信息科技服务有限公司 filed Critical 深圳前海环融联易信息科技服务有限公司
Publication of WO2024016984A1 publication Critical patent/WO2024016984A1/en

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/44Program or device authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • G06F8/658Incremental updates; Differential updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects

Definitions

  • This application relates to the field of alliance chains, and in particular to a smart contract deployment method and system, and computer storage media.
  • the alliance chain is only for members of a specific group and limited third parties. Multiple pre-selected nodes are designated internally as bookkeepers. The generation of each block is jointly decided by all pre-selected nodes. Other access nodes can participate in transactions. However, it does not involve the accounting process, and other third parties can conduct limited inquiries through the open API of the blockchain.
  • the inventor of this application discovered during research that the alliance chain smart contracts are written offline and deployed to the blockchain nodes controlled by themselves, and then debugged based on the smart contract logs. With this deployment and debugging method, smart contracts can only be debugged based on entity blockchain nodes, which is a time-consuming, labor-intensive and inefficient process.
  • the purpose of this application is to provide a smart contract deployment method, system, and computer storage medium to at least solve the problem of low efficiency in the deployment of existing alliance chains.
  • this application provides a smart contract deployment method, including:
  • the first smart contract is diffused in the main chain network.
  • embodiments of the present application also provide a smart contract deployment device, including:
  • the generation module is used to generate the first smart contract to be deployed based on the preset blockchain integrated development environment
  • a deployment module configured to generate a target container for running the first smart contract, and deploy the first smart contract into the target container
  • An issuance module used to issue the identity certificate of the target container according to the preset node certificate
  • the processing module is used to call the preset container orchestrator to connect the target container to the main chain network for identity verification;
  • An execution module configured to diffuse the first smart contract in the main chain network after the identity verification of the target container passes.
  • embodiments of the present application also provide a computer device, including a memory and a processor.
  • Computer readable instructions are stored in the memory.
  • the computer readable instructions When the computer readable instructions are executed by the processor, the computer readable instructions cause the computer readable instructions to be executed by the processor.
  • the processor performs the following steps:
  • the first smart contract is diffused in the main chain network.
  • embodiments of the present application also provide a storage medium storing computer-readable instructions.
  • the computer-readable instructions When executed by one or more processors, they cause one or more processors to perform the following steps:
  • the first smart contract is diffused in the main chain network.
  • the beneficial effects of the embodiments created by this application are: after the first smart contract is generated in the blockchain integrated development environment, the first smart contract is deployed in the target container of the node, and the target container runs the first smart contract, and After obtaining the identity certificate issued by the node certificate, the target container can access the main chain network, and spread the first smart contract on the chain through the main chain network, thereby realizing multi-node verification on the chain and improving the verification efficiency. efficiency.
  • the target container and identity certificate Through the target container and identity certificate, the unified deployment of smart contracts offline and on the chain is realized, which shortens the time limit for debugging and deployment and improves the efficiency of smart contract debugging and deployment.
  • Figure 1 is a basic flow diagram of a smart contract deployment method according to a specific embodiment of the present application
  • Figure 2 is a schematic diagram of the basic structure of a smart contract deployment device according to a specific embodiment of the present application
  • Figure 3 is a basic structural block diagram of a computer device according to a specific embodiment of the present application.
  • terminal used here includes both a wireless signal receiver device that only has a wireless signal receiver without a transmission capability, and a device that has receiving and transmitting hardware that can A device that performs receiving and transmitting hardware for bidirectional communications on a bidirectional communications link.
  • Such equipment may include: cellular or other communication equipment with a single line display or a multi-line display or a cellular or other communication equipment without a multi-line display; PCS (Personal Communications Service, personal communication system), which can combine voice, data Processing, fax and/or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, pager, Internet/Intranet access, web browser, notepad, calendar and/or GPS (Global Positioning System (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other device having and/or including a radio frequency receiver.
  • PCS Personal Communications Service, personal communication system
  • PDA Personal Digital Assistant
  • GPS Global Positioning System (Global Positioning System) receiver
  • GPS Global Positioning System
  • a “terminal” may be portable, transportable, installed in a vehicle (air, maritime and/or land), or adapted and/or configured to operate locally, and/or in a distributed form. Operating anywhere on Earth and/or space.
  • the "terminal” used here can also be a communication terminal, an Internet access terminal, a music/video playback terminal, for example, it can be a PDA, MID (Mobile Internet Device, mobile Internet device) and/or a mobile phone with music/video playback function, It can also be a smart TV, set-top box and other devices.
  • the hardware referred to by names such as "server”, “client”, and “service node” in this application are essentially electronic devices with equivalent capabilities to personal computers, and are equipped with a central processing unit (including arithmetic units and controllers). ), memory, input devices, output devices and other necessary components disclosed by the von Neumann principle.
  • the computer program is stored in its memory.
  • the central processor transfers the program stored in the external memory into the memory to run, and executes the program.
  • the instructions in it interact with input and output devices to complete specific functions.
  • server in this application can also be extended to the situation of server cluster.
  • the servers should be logically divided. In physical space, these servers can be independent of each other but can be called through interfaces, or they can be integrated into a physical server.
  • a computer or a computer cluster Those skilled in the art should understand this modification, but it should not limit the implementation of the network deployment method of the present application.
  • One or several technical features of this application can be deployed on a server for implementation.
  • the client remotely calls the online service interface provided by the server to implement access, or it can be directly deployed and run on the client to implement access.
  • neural network models cited or possibly cited in this application can be deployed on a remote server and remotely called on the client, or can be deployed on a client with competent device capabilities for direct calling.
  • its corresponding intelligence can be obtained through transfer learning, so as to reduce the requirements for client hardware running resources and avoid excessive occupation of client hardware running resources.
  • Figure 1 is a basic flow diagram of the smart contract deployment method in this embodiment.
  • the first smart contract is collected through the blockchain integrated development environment.
  • the collection method can be a smart contract generated by collecting input from peripheral devices through the blockchain integrated development environment, or it can be a blockchain integrated
  • the development environment loads the smart contract generated by local or remote project class files.
  • the first smart contract specifically refers to the smart contract developed by the user and to be deployed. Only by uploading the first smart contract to each node of the blockchain can the deployment of the first smart contract be completed.
  • the blockchain integrated development environment is an online development environment. Users can directly launch the blockchain integrated development environment through the web page to develop smart contracts. Depending on the specific application scenario, in some implementations, the blockchain integrated development environment can also be a development toolkit installed locally.
  • the blockchain integrated development environment is a consortium chain integrated development environment exclusive to the consortium chain.
  • Consortium chain users can use the blockchain integrated development environment to develop smart contracts online through web pages, and then, through the block chain integrated development environment, The chain integrated development environment starts the alliance chain deployment of the first smart contract.
  • S1200 Generate a target container for running the first smart contract, and deploy the first smart contract to the target container;
  • the deployment method is: through the user-controlled blockchain node terminal or the temporary blockchain terminal logged into the user account, a target container for deploying the first smart contract is generated, and the target container verifies and tests the first smart contract. , upload the first smart contract to the blockchain.
  • the node terminal starts or activates a target terminal for running the first smart contract according to the first smart contract.
  • Head Standard containers are containers built through pre-computer programs to run smart contracts issued by block nodes.
  • the target container can be a single specific container, or it can refer to two or more containers with the same functions depending on the application scenario.
  • the first smart contract After the target container is started, the first smart contract needs to be converted into a binary instruction file that can be read and executed by computer logic.
  • the process of converting the first smart contract into a binary instruction file is called compilation.
  • the compilation process can be compiled by the compiler that comes with the target container, or by the compiler associated with the target container. For example, after the target container is activated, it sends compilation instructions to the compiler associated with it, and the compiler receives the compilation instructions. Finally, compile the first smart contract.
  • the file generated by compiling the first smart contract is a compiled file.
  • the compiled file After generating the compiled file of the first smart contract, the compiled file needs to be converted into an image file that can be run by the target contract.
  • the conversion process of the image file is to compile the file into a file in a set format according to the operating logic of the target container.
  • the image file can be produced and converted through the image tool that comes with the target container, or through the image tool associated with the target container.
  • the image file is sent to the target container, and the target container stores the image file in the container's image storage space to complete the deployment of the image file.
  • the target container runs the first smart contract, it only needs to read the image file from the container's image storage space and run it.
  • the target container in order to ensure the reliability of the smart contract on the chain, the target container needs to run the first smart contract and generate the corresponding test log. If an error message appears in the test log during the test, the patch script corresponding to the error model is searched in the preset patch database according to the model of the error message. After getting the patch script, activate other target containers that are the same as the target container. These target containers are defined as trial and error containers. After the trial and error container is started, the first smart contract and the corresponding patch script are deployed to the trial and error container at the same time for running. Through the running results, it is observed whether the patch script can solve the corresponding error problem. If the same type of error does not appear in the test log of the trial and error container, it means that the patch script is useful.
  • the target container embeds the patch script into the first smart contract according to the error report position in the test log, updates the first smart contract, and realizes the automation of the smart contract. Error repair helps improve the launch efficiency and reliability of the first smart contract.
  • each blockchain node has a node certificate indicating its legal identity.
  • the node certificate is a certificate file issued by the blockchain accounting node, certificate management node, certification node or other node with certificate issuance function after each blockchain node is successfully registered. With the node certificate, the blockchain node can recognize the identity of the main chain, be qualified to access the main chain network, and be qualified to propagate smart contracts in the main chain network.
  • identity authentication is required, and when the target container connects to the main chain network, identity authentication is also required.
  • identity authentication is also required.
  • the blockchain node needs to perform identity authentication first, and then request the main chain network to issue a legal identity certificate to the target container, and then the target container requests identity verification.
  • the identity certificate of the target container is directly issued to the target container by the blockchain node based on the node certificate.
  • the target container When the first smart contract is deployed to the target container, the target container will send a certificate request to the blockchain node where it is located. After receiving the certificate request, the blockchain node will read the node certificate stored locally. The node certificate records the owner information, issuer information, certificate signature and other information of the node certificate.
  • the blockchain node Based on the node certificate, the blockchain node generates a sub-certificate of the node certificate.
  • the sub-certificate also records owner information, issuer information, certificate signature and other information. Among them, the owner information is recorded as the target container information, and the issuer information records the certificate information of the node certificate.
  • the blockchain node issues the generated sub-certificate to the target container. After receiving the sub-certificate, the target container uses the sub-certificate as its own identity certificate.
  • S1400 Call the preset container orchestrator to connect the target container to the main chain network and perform identity verification;
  • a container orchestrator is provided, and the container editor can be (not limited to): Kubernetes orchestrator, OpenShift orchestrator, Docker Swarm orchestrator, Mesos orchestrator, Google Container Engine orchestrator and other container orchestrators.
  • the first smart contract and identity certificate need to be uploaded to the main chain network.
  • the target container needs to call the connection interface connected to the main chain network.
  • the container editor is used to configure the connection interface to the target container.
  • the connection interface is the uplink interface
  • the uplink interface is the API interface.
  • the target container After the container orchestrator allocates an uplink interface to the target container, the target container calls the uplink interface, starts the routing link, and connects the target container to the main chain network.
  • the main chain network is a consortium chain, but the main chain network can be a public chain network or a private chain network.
  • the target container After the target container is connected to the main chain network through the uplink interface, the target container sends the identity certificate to the main chain network. After receiving the identity certificate sent by the target container, the main chain network verifies the identity of the target container through the preset authentication rules. verify. After the identity certificate is verified, the main chain network confirms the identity of the target container, and the target container has the identity to upload smart contracts to the main chain network. If the identity certificate verification fails, the main chain network determines that the target container has illegal access and disconnects from the target container.
  • the target container When the identity certificate of the target container is verified on the main chain network, the target container sends the first smart contract to the main chain network. After receiving the first smart contract, the main chain network broadcasts the first smart contract on the chain and broadcasts the first smart contract to the main chain network. The smart contract is diffused. After receiving the diffused first smart contract, other nodes in the main chain network store the first smart contract so that when receiving the task corresponding to the first smart contract, they can call the first smart contract. implement.
  • the first smart contract is deployed in the target container of the node, and the target container runs the first smart contract, and obtains the identity of the node certificate issued
  • the target container can access the main chain network, and spread the first smart contract on-chain through the main chain network, thereby realizing multi-node verification on the chain and improving the efficiency of verification.
  • the target container and identity certificate Through the target container and identity certificate, the unified deployment of smart contracts offline and on the chain is realized, which shortens the time limit for debugging and deployment and improves the efficiency of smart contract debugging and deployment.
  • the first smart contract is deployed to the target container in the format of an image file.
  • S1200 includes:
  • the process of converting the first smart contract into a binary instruction file is called compilation.
  • the compilation process can be compiled by the compiler that comes with the target container, or by the compiler associated with the target container. For example, after the target container is activated, it sends compilation instructions to the compiler associated with it, and the compiler receives the compilation instructions. Finally, compile the first smart contract.
  • the file generated by compiling the first smart contract is a compiled file.
  • the compiled file After generating the compiled file of the first smart contract, the compiled file needs to be converted into an image file that can be run by the target contract.
  • the conversion process of the image file is to compile the file into a file in a set format according to the operating logic of the target container.
  • the image file can be produced and converted through the image tool that comes with the target container, or through the image tool associated with the target container.
  • the target container is a container built by pre-computer programming to run smart contracts published by block nodes.
  • the target container can be a single specific container, or it can refer to two or more containers with the same functions depending on the application scenario.
  • the target container sends the image file to the target container, and the target container stores the image file in the container's image storage space to complete the deployment of the image file.
  • the target container runs the first smart contract, it only needs to read the image file from the container's image storage space and run it.
  • the target container obtains the identity certificate through the node certificate.
  • S1300 includes:
  • Each blockchain node has a node certificate indicating its legal identity.
  • the node certificate is a certificate file issued by the blockchain accounting node, certificate management node, certification node or other node with certificate issuance function after each blockchain node is successfully registered. With the node certificate, the blockchain node can recognize the identity of the main chain, be qualified to access the main chain network, and be qualified to propagate smart contracts in the main chain network.
  • the target container When the first smart contract is deployed to the target container, the target container will send a certificate request to the blockchain node where it is located. After receiving the certificate request, the blockchain node will read the node certificate stored locally. The node certificate records the owner information, issuer information, certificate signature and other information of the node certificate.
  • the blockchain node Based on the node certificate, the blockchain node generates a sub-certificate of the node certificate.
  • the sub-certificate also records owner information, issuer information, certificate signature and other information. Among them, the owner information is recorded as the target container information, and the issuer information records the certificate information of the node certificate.
  • the blockchain node issues the generated sub-certificate to the target container. After receiving the sub-certificate, the target container uses the sub-certificate as its own identity certificate.
  • S1400 includes:
  • the first smart contract and identity certificate need to be uploaded to the main chain network.
  • the target container needs to call the connection interface connected to the main chain network.
  • the container editor is used to configure the connection interface to the target container.
  • the connection interface is the uplink interface
  • the uplink interface is the API interface.
  • the target container After the container orchestrator allocates an uplink interface to the target container, the target container calls the uplink interface, starts the routing link, and connects the target container to the main chain network.
  • the main chain network is a consortium chain, but the main chain network can be a public chain network or a private chain network.
  • the target container After the target container is connected to the main chain network through the uplink interface, the target container sends the identity certificate to the main chain network. After receiving the identity certificate sent by the target container, the main chain network verifies the identity of the target container through the preset authentication rules. verify. After the identity certificate is verified, the main chain network confirms the identity of the target container, and the target container has the identity to upload smart contracts to the main chain network. If the identity certificate verification fails, the main chain network determines that the target container has illegal access and disconnects from the target container.
  • the target container in addition to sending the first smart contract issued by the blockchain node to the main chain network, can also receive the second smart contract sent by other blockchain nodes. After receiving the second smart contract, the district Blockchain nodes need to verify the second smart contract. Specifically, after S1500 include:
  • the target container receives the second smart contract to be verified in the main chain network
  • the target container sends the first smart contract to the main chain network, and the blockchain node can also receive the second smart contract broadcasted by the main chain network to the blockchain node through the target container.
  • the second smart contract is a smart contract uploaded by other blockchain nodes in the blockchain. After receiving the second smart contract, the target container needs to test the second smart contract. After the test is correct, the second smart contract can be tested. Do a local deployment.
  • the blockchain node where the target container is located activates the verification container capable of running the second smart contract based on the environmental parameters required for the operation of the second smart contract.
  • the verification container is a pre-configured container used to verify smart contracts.
  • the blockchain node where the target container is located will pre-build the verification container corresponding to each smart contract according to the existing smart contract types in the blockchain. Therefore, when the second smart contract is received, the corresponding verification container can be activated according to the type of the second smart contract.
  • the target container sends the second smart contract to the verification container for verification.
  • the target container sends the second smart contract to the verification container for verification.
  • the verification method is: the verification container runs the second smart contract, generates a verification log during the operation, and sends the verification log to the main chain network to complete the verification of the second smart contract.
  • the verification method in some implementations is: the second smart contract has its own running result. After the verification container runs the second smart contract, a verification result will be generated, and the verification result will be matched with the running result. If the match is successful, The verification passes, otherwise, the verification fails.
  • the second smart contract received by the verification container is an image file. Therefore, the second smart contract can be deployed directly in the verification container. If the second smart contract received by the target container is not an image file, the second smart contract needs to be decoded first, and then deployed after converting the decoded file of the second smart contract into an image file.
  • the target container forwards the second smart contract to the verification container through a third party, for example, through the container orchestrator or the master controller, which forwards the second smart contract to the verification container.
  • the second smart contract is received through the target container to avoid the problem that the blockchain node needs to establish a connection with the main chain network when receiving the second smart contract that needs to be verified.
  • the first smart contract can be uploaded with only one connection.
  • the contract can also receive the second smart contract, which improves the transmission efficiency, reduces the number of times the connection interface is called, and realizes interface reuse.
  • S1630 includes:
  • the storage problem of the two containers is reused to solve the information transmission barrier.
  • the target storage address is the storage space exclusive to the target container. It is configured by the blockchain node or container orchestrator when the target container is built or started.
  • the target storage address of the target container After reading the target storage address of the target container, configure the storage address of the verification container, and configure the verification storage address of the verification container to be the same address as the target storage address. In this way, the target storage address and the verification storage address overlap with each other.
  • the target container stores the second smart contract in the target storage address
  • the target container stores the second smart contract in the target storage address.
  • the verification container reads the second smart contract in the verification storage address and verifies the second smart contract.
  • the verification container queries and verifies whether information has been written in the verification storage address through scheduled queries.
  • the verification container will query and verify that the information has been written in the verification storage address. This At this time, the verification container reads the second smart contract. After the verification container reads the second smart contract, it performs operation verification on the second smart contract.
  • the direct transfer of smart contracts between the verification container and the target container is achieved, improving the verification efficiency of the second smart contract.
  • the verification log of the second smart contract needs to be uploaded to the main chain network.
  • the verification container After the verification container finishes running the second smart contract, the verification container is released according to the program settings. After the verification container is released, all resources and permissions granted to the verification container are returned. Before verifying that the container is released, send release information and verification logs to the container orchestrator. Among them, the release information is to notify the container orchestrator to eliminate the coding and status monitoring of the verification container, and the verification log is the operation log generated by running the second smart contract.
  • the container orchestrator sends the verification log to the target container according to the release information
  • the container orchestrator After receiving the release information, the container orchestrator releases the status monitoring of the verification container, deletes the encoding information of the verification container, and then sends the verification log to the target container, which uploads the verification log to the main chain network.
  • the target container sends the verification log to the main chain network.
  • the target container After receiving the verification log sent by the container orchestrator, the target container uploads the verification log to the main chain network.
  • the main chain network collects the verification log to generate verification of the second smart contract by the full-link blockchain node. result.
  • the target container disconnects from the main chain network and starts the release process.
  • following S1500 includes:
  • the debugging module has the debugging interface of the first smart contract. After entering the debugging module, the operation page of the blockchain integrated development environment is generated. Visual debugging icon of the first smart contract.
  • the debugging module calls the first smart contract through the debugging interface to perform test operation and completes the test of the first smart contract. After the deployment is completed, the first smart contract is tested in the blockchain integrated development environment based on the visual icons, which improves testing efficiency.
  • Figure 2 is a schematic diagram of the basic structure of the smart contract deployment device in this embodiment.
  • a smart contract deployment device includes: a generation module 1100, a deployment module 1200, an issuance module 1300, a processing module 1400 and an execution module 1500.
  • the generation module 1100 is used to generate the first smart contract to be deployed based on the preset blockchain integrated development environment;
  • the deployment module 1200 is used to generate a target container for running the first smart contract, and transfer the first smart contract to Deployed to the target container;
  • the issuance module 1300 is used to issue the identity certificate of the target container according to the preset node certificate;
  • the processing module 1400 is used to call the preset container orchestrator to connect the target container to the main chain In the network, identity verification is performed;
  • the execution module 1500 is used to diffuse the first smart contract in the main chain network after the identity verification of the target container passes.
  • the target container After generating the first smart contract in the blockchain integrated development environment, deploy the first smart contract in the node In the target container of the node, the target container runs the first smart contract, and after obtaining the identity certificate issued by the node certificate, the target container can access the main chain network, and run the first smart contract through the main chain network. Diffusion on the chain enables multi-node verification on the chain and improves the efficiency of verification. Through the target container and identity certificate, the unified deployment of smart contracts offline and on the chain is realized, which shortens the time limit for debugging and deployment and improves the efficiency of smart contract debugging and deployment.
  • the smart contract deployment device also includes:
  • the first processing sub-module is used to compile the first smart contract and generate the compiled file of the first smart contract
  • the first compilation submodule is used to generate the image file of the first smart contract according to the compilation file
  • the first execution sub-module is used to start the target container according to the image file and deploy the image file to the target container.
  • the smart contract deployment device also includes:
  • the second processing submodule is used to read the pre-stored node certificate and the certificate request sent by the target container;
  • the second execution sub-module is configured to generate a sub-certificate of the node certificate according to the certificate request, and issue the sub-certificate to the target container as the identity certificate.
  • the smart contract deployment device also includes:
  • the first calling sub-module is used to call the container orchestrator to allocate an uplink interface to the target container;
  • the third processing sub-module is used to connect the target container to the main chain network according to the uplink interface
  • the third execution sub-module is used to send the identity certificate to the main chain network, so that the main chain network verifies the identity information of the target container based on the identity certificate.
  • the smart contract deployment device also includes:
  • the first receiving sub-module is used by the target container to receive the second smart contract to be verified in the main chain network
  • the fourth processing sub-module is used to start the verification container configured according to the second smart contract, wherein the verification container is used to run the second smart contract;
  • the fourth execution sub-module is used by the target container to send the second smart contract to the verification container for verification.
  • the smart contract deployment device also includes:
  • the second reading sub-module is used to read the target storage address of the target container
  • a first storage submodule configured to construct a verification storage address of the verification container according to the target storage address, and make the target storage address and the verification storage address overlap with each other;
  • the fifth processing sub-module is used for the target container to store the second smart contract in the target storage address
  • the fifth execution sub-module is used for the verification container to read the second smart contract in the verification storage address and verify the second smart contract.
  • the smart contract deployment device also includes:
  • the first release submodule is used to release the verification container after the verification of the second smart contract is completed, and send a release message and verification log to the container orchestrator;
  • the sixth processing sub-module is used for the container orchestrator to send the verification log to the target container according to the release information
  • the sixth execution sub-module is used for the target container to send the verification log to the main chain network.
  • the smart contract deployment device also includes:
  • the seventh processing sub-module is used to obtain the debugging interface of the first smart contract and the visual debugging icon of the first smart contract;
  • the seventh execution sub-module is used to call the first smart contract in the blockchain integrated development environment for test operation according to the debugging icon and the debugging interface.
  • Figure 3 is a basic structural block diagram of the computer equipment in this embodiment.
  • the computer device includes a processor, non-volatile storage media, memory and a network interface connected by a system bus.
  • the non-volatile storage medium of the computer device stores an operating system, a database and computer-readable instructions.
  • the database can store a sequence of control information.
  • the processor can achieve a A smart contract deployment method.
  • the processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device.
  • Computer readable instructions may be stored in the memory of the computer device, and when executed by the processor, the computer readable instructions may cause the processor to execute a smart contract deployment method.
  • the network interface of the computer device is used for communication with the terminal connection.
  • FIG. 3 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied.
  • the specific computer equipment can May include more or fewer parts than shown, or combine certain parts, or have a different arrangement of parts.
  • the processor is used to execute the specific functions of the generation module 1100, the deployment module 1200, the issuance module 1300, the processing module 1400 and the execution module 1500 in Figure 2, and the memory stores program codes and various data required to execute the above modules.
  • Network interfaces are used for data transmission to user terminals or between servers.
  • the memory in this embodiment stores the program code and data required to execute all sub-modules in the smart contract deployment device, and the server can call the server's program code and data to execute the functions of all sub-modules.
  • the computer device After the computer device generates the first smart contract in the blockchain integrated development environment, it deploys the first smart contract in the target container of the node, and the target container runs the first smart contract, and obtains the identity certificate issued by the node certificate. Finally, the target container can be connected to the main chain network, and the first smart contract is diffused on the chain through the main chain network, thereby realizing multi-node verification on the chain and improving the efficiency of verification.
  • the target container and identity certificate Through the target container and identity certificate, the unified deployment of smart contracts offline and on the chain is realized, which shortens the time limit for debugging and deployment and improves the efficiency of smart contract debugging and deployment.
  • This application also provides a storage medium storing computer-readable instructions.
  • the computer-readable instructions When executed by one or more processors, they cause the one or more processors to execute the steps of the smart contract deployment method of any of the above embodiments.
  • the computer program can be stored in a computer-readable storage medium.
  • the program can be stored in a computer-readable storage medium.
  • the flow of the above method embodiments may be included.
  • the aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
  • steps, measures, and solutions in the various operations, methods, and processes that have been discussed in this application can be alternated, changed, combined, or deleted.
  • steps, measures, and solutions in the various operations, methods, and processes that have been discussed in this application can also be alternated, changed, rearranged, decomposed, combined, or deleted.
  • steps, measures, and solutions in the prior art with various operations, methods, and processes disclosed in this application can also be replaced, changed, rearranged, decomposed, combined, or deleted.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

Disclosed in the present application are a smart contract deployment method and apparatus, a computer device, and a storage medium. The method comprises: on the basis of a preset blockchain integrated development environment, generating a first smart contract to be deployed; generating a target container running the first smart contract, and deploying the first smart contract into the target container; issuing an identity certificate of the target container according to a preset node certificate; calling a preset container orchestrator to access the target container into a main chain network for identity verification; and after the identity verification of the target container succeeds, diffusing the first smart contract in the main chain network. Offline and on-chain unified deployment of the smart contract is realized by means of the target container and the identity certificate, such that a time limit of debugging deployment is shortened, and the deployment debugging efficiency of the smart contract is improved.

Description

智能合约部署方法及其装置、设备、介质、产品Smart contract deployment method and its devices, equipment, media, and products
本申请要求于2022年07月21日提交中国专利局、申请号为202210862683.6、申请名称为“智能合约部署方法及其装置、设备、介质、产品”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application requires the priority of the Chinese patent application submitted to the China Patent Office on July 21, 2022, with the application number 202210862683.6 and the application name "Smart Contract Deployment Method and Devices, Equipment, Media, and Products", and all its contents are approved The reference is incorporated into the application.
技术领域Technical field
本申请涉及联盟链领域,特别涉及一种智能合约部署方法及系统、计算机存储介质。This application relates to the field of alliance chains, and in particular to a smart contract deployment method and system, and computer storage media.
背景技术Background technique
联盟链,只针对特定某个群体的成员和有限的第三方,内部指定多个预选的节点为记账人,每个块的生成由所有的预选节点共同决定,其他接入节点可以参与交易,但不过问记账过程,其他第三方可以通过该区块链开放的API进行限定查询。The alliance chain is only for members of a specific group and limited third parties. Multiple pre-selected nodes are designated internally as bookkeepers. The generation of each block is jointly decided by all pre-selected nodes. Other access nodes can participate in transactions. However, it does not involve the accounting process, and other third parties can conduct limited inquiries through the open API of the blockchain.
本申请创造的发明人在研究中发现,联盟链智能合约的编写是各自线下编写好,分别各自部署到自己控制的区块链节点,再去根据智能合约日志进行调试。这种部署调试方法,智能合约只能基于实体的区块链节点进行调试,过程费时费力,效率低下。The inventor of this application discovered during research that the alliance chain smart contracts are written offline and deployed to the blockchain nodes controlled by themselves, and then debugged based on the smart contract logs. With this deployment and debugging method, smart contracts can only be debugged based on entity blockchain nodes, which is a time-consuming, labor-intensive and inefficient process.
发明内容Contents of the invention
本申请的目的在于提供一种智能合约部署方法及系统、计算机存储介质,以至少解决现有联盟链部署效率低下的问题。The purpose of this application is to provide a smart contract deployment method, system, and computer storage medium to at least solve the problem of low efficiency in the deployment of existing alliance chains.
为解决上述技术问题,本申请提供一种智能合约部署方法,包括:In order to solve the above technical problems, this application provides a smart contract deployment method, including:
基于预设的区块链集成开发环境,生成待部署的第一智能合约;Based on the preset blockchain integrated development environment, generate the first smart contract to be deployed;
生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;Generate a target container that runs the first smart contract, and deploy the first smart contract to the target container;
根据预设的节点证书签发所述目标容器的身份证书;Issue the identity certificate of the target container according to the preset node certificate;
调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;Call the preset container orchestrator to connect the target container to the main chain network for identity verification;
当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。When the identity verification of the target container passes, the first smart contract is diffused in the main chain network.
为解决上述技术问题,本申请实施例还提供一种智能合约部署装置,包括:In order to solve the above technical problems, embodiments of the present application also provide a smart contract deployment device, including:
生成模块,用于基于预设的区块链集成开发环境,生成待部署的第一智能合约;The generation module is used to generate the first smart contract to be deployed based on the preset blockchain integrated development environment;
部署模块,用于生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;A deployment module, configured to generate a target container for running the first smart contract, and deploy the first smart contract into the target container;
签发模块,用于根据预设的节点证书签发所述目标容器的身份证书;An issuance module, used to issue the identity certificate of the target container according to the preset node certificate;
处理模块,用于调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证; The processing module is used to call the preset container orchestrator to connect the target container to the main chain network for identity verification;
执行模块,用于当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。An execution module, configured to diffuse the first smart contract in the main chain network after the identity verification of the target container passes.
为解决上述技术问题本申请实施例还提供一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:In order to solve the above technical problems, embodiments of the present application also provide a computer device, including a memory and a processor. Computer readable instructions are stored in the memory. When the computer readable instructions are executed by the processor, the computer readable instructions cause the computer readable instructions to be executed by the processor. The processor performs the following steps:
基于预设的区块链集成开发环境,生成待部署的第一智能合约;Based on the preset blockchain integrated development environment, generate the first smart contract to be deployed;
生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;Generate a target container that runs the first smart contract, and deploy the first smart contract into the target container;
根据预设的节点证书签发所述目标容器的身份证书;Issue the identity certificate of the target container according to the preset node certificate;
调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;Call the preset container orchestrator to connect the target container to the main chain network for identity verification;
当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。When the identity verification of the target container passes, the first smart contract is diffused in the main chain network.
为解决上述技术问题本申请实施例还提供一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:In order to solve the above technical problems, embodiments of the present application also provide a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, they cause one or more processors to perform the following steps:
基于预设的区块链集成开发环境,生成待部署的第一智能合约;Based on the preset blockchain integrated development environment, generate the first smart contract to be deployed;
生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;Generate a target container that runs the first smart contract, and deploy the first smart contract into the target container;
根据预设的节点证书签发所述目标容器的身份证书;Issue the identity certificate of the target container according to the preset node certificate;
调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;Call the preset container orchestrator to connect the target container to the main chain network for identity verification;
当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。When the identity verification of the target container passes, the first smart contract is diffused in the main chain network.
本申请创造实施例的有益效果是:在区块链集成开发环境中生成第一智能合约后,将第一智能合约部署在节点的目标容器中,由目标容器对第一智能合约进行运行,并且在得到节点证书签发的身份证书后,目标容器能够接入到主链网络中,并且通过主链网络对第一智能合约进行链上扩散传播,以此实现链上多节点验证,提高了验证的效率。通过目标容器和身份证书实现了智能合约线下和链上统一部署,缩短了调试部署的时限,提高了智能合约调试部署的效率。The beneficial effects of the embodiments created by this application are: after the first smart contract is generated in the blockchain integrated development environment, the first smart contract is deployed in the target container of the node, and the target container runs the first smart contract, and After obtaining the identity certificate issued by the node certificate, the target container can access the main chain network, and spread the first smart contract on the chain through the main chain network, thereby realizing multi-node verification on the chain and improving the verification efficiency. efficiency. Through the target container and identity certificate, the unified deployment of smart contracts offline and on the chain is realized, which shortens the time limit for debugging and deployment and improves the efficiency of smart contract debugging and deployment.
附图说明Description of drawings
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:The above and/or additional aspects and advantages of the present application will become apparent and readily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
图1为本申请一个具体实施例的智能合约部署方法的基本流程示意图;Figure 1 is a basic flow diagram of a smart contract deployment method according to a specific embodiment of the present application;
图2为本申请一个具体实施例的智能合约部署装置基本结构示意图;Figure 2 is a schematic diagram of the basic structure of a smart contract deployment device according to a specific embodiment of the present application;
图3为本申请一个具体实施例的计算机设备的基本结构框图。Figure 3 is a basic structural block diagram of a computer device according to a specific embodiment of the present application.
具体实施方式Detailed ways
下面详细描述本申请的实施例,所述实施例的示例在附图中示出,其中自始至终相同或类似的标号表示相同或类似的元件或具有相同或类似功能的元件。 下面通过参考附图描述的实施例是示例性的,仅用于解释本申请,而不能解释为对本申请的限制。The embodiments of the present application are described in detail below. Examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements with the same or similar functions. The embodiments described below with reference to the drawings are exemplary and are only used to explain the present application and cannot be construed as limiting the present application.
本技术领域技术人员可以理解,除非特意声明,这里使用的单数形式“一”、“一个”、“所述”和“该”也可包括复数形式。应该进一步理解的是,本申请的说明书中使用的措辞“包括”是指存在所述特征、整数、步骤、操作、元件和/或组件,但是并不排除存在或添加一个或多个其他特征、整数、步骤、操作、元件、组件和/或它们的组。Those skilled in the art will understand that, unless expressly stated otherwise, the singular forms "a", "an", "the" and "the" used herein may also include the plural form. It should be further understood that the word "comprising" used in the description of this application refers to the presence of stated features, integers, steps, operations, elements and/or components, but does not exclude the presence or addition of one or more other features, Integers, steps, operations, elements, components and/or groups thereof.
本技术领域技术人员可以理解,除非另外定义,这里使用的所有术语(包括技术术语和科学术语),具有与本申请所属领域中的普通技术人员的一般理解相同的意义。还应该理解的是,诸如通用字典中定义的那些术语,应该被理解为具有与现有技术的上下文中的意义一致的意义,并且除非像这里一样被特定定义,否则不会用理想化或过于正式的含义来解释。It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. It should also be understood that terms, such as those defined in general dictionaries, are to be understood to have meanings consistent with their meaning in the context of the prior art, and are not to be used in an idealistic or overly descriptive manner unless specifically defined as here. to explain the formal meaning.
本技术领域技术人员可以理解,这里所使用的“终端”既包括无线信号接收器的设备,其仅具备无发射能力的无线信号接收器的设备,又包括接收和发射硬件的设备,其具有能够在双向通信链路上,执行双向通信的接收和发射硬件的设备。这种设备可以包括:蜂窝或其他通信设备,其具有单线路显示器或多线路显示器或没有多线路显示器的蜂窝或其他通信设备;PCS(Personal Communications Service,个人通信系统),其可以组合语音、数据处理、传真和/或数据通信能力;PDA(Personal Digital Assistant,个人数字助理),其可以包括射频接收器、寻呼机、互联网/内联网访问、网络浏览器、记事本、日历和/或GPS(Global Positioning System,全球定位系统)接收器;常规膝上型和/或掌上型计算机或其他设备,其具有和/或包括射频接收器的常规膝上型和/或掌上型计算机或其他设备。这里所使用的“终端”可以是便携式、可运输、安装在交通工具(航空、海运和/或陆地)中的,或者适合于和/或配置为在本地运行,和/或以分布形式,运行在地球和/或空间的任何其他位置运行。这里所使用的“终端”还可以是通信终端、上网终端、音乐/视频播放终端,例如可以是PDA、MID(Mobile Internet Device,移动互联网设备)和/或具有音乐/视频播放功能的移动电话,也可以是智能电视、机顶盒等设备。Those skilled in the art can understand that the "terminal" used here includes both a wireless signal receiver device that only has a wireless signal receiver without a transmission capability, and a device that has receiving and transmitting hardware that can A device that performs receiving and transmitting hardware for bidirectional communications on a bidirectional communications link. Such equipment may include: cellular or other communication equipment with a single line display or a multi-line display or a cellular or other communication equipment without a multi-line display; PCS (Personal Communications Service, personal communication system), which can combine voice, data Processing, fax and/or data communication capabilities; PDA (Personal Digital Assistant), which may include a radio frequency receiver, pager, Internet/Intranet access, web browser, notepad, calendar and/or GPS (Global Positioning System (Global Positioning System) receiver; a conventional laptop and/or palmtop computer or other device having and/or including a radio frequency receiver. As used herein, a "terminal" may be portable, transportable, installed in a vehicle (air, maritime and/or land), or adapted and/or configured to operate locally, and/or in a distributed form. Operating anywhere on Earth and/or space. The "terminal" used here can also be a communication terminal, an Internet access terminal, a music/video playback terminal, for example, it can be a PDA, MID (Mobile Internet Device, mobile Internet device) and/or a mobile phone with music/video playback function, It can also be a smart TV, set-top box and other devices.
本申请所称的“服务器”、“客户端”、“服务节点”等名称所指向的硬件,本质上是具备个人计算机等效能力的电子设备,为具有中央处理器(包括运算器和控制器)、存储器、输入设备以及输出设备等冯诺依曼原理所揭示的必要构件的硬件装置,计算机程序存储于其存储器中,中央处理器将存储在外存中的程序调入内存中运行,执行程序中的指令,与输入输出设备交互,借此完成特定的功能。The hardware referred to by names such as "server", "client", and "service node" in this application are essentially electronic devices with equivalent capabilities to personal computers, and are equipped with a central processing unit (including arithmetic units and controllers). ), memory, input devices, output devices and other necessary components disclosed by the von Neumann principle. The computer program is stored in its memory. The central processor transfers the program stored in the external memory into the memory to run, and executes the program. The instructions in it interact with input and output devices to complete specific functions.
需要指出的是,本申请所称的“服务器”这一概念,同理也可扩展到适用于服务器机群的情况。依据本领域技术人员所理解的网络部署原理,所述各服务器应是逻辑上的划分,在物理空间上,这些服务器既可以是互相独立但可通过接口调用的,也可以是集成到一台物理计算机或一套计算机机群的。本领域技术人员应当理解这一变通,而不应以此约束本申请的网络部署方式的实施方式。It should be pointed out that the concept of "server" in this application can also be extended to the situation of server cluster. According to the network deployment principles understood by those skilled in the art, the servers should be logically divided. In physical space, these servers can be independent of each other but can be called through interfaces, or they can be integrated into a physical server. A computer or a computer cluster. Those skilled in the art should understand this modification, but it should not limit the implementation of the network deployment method of the present application.
本申请的一个或数个技术特征,除非明文指定,既可部署于服务器实施而 由客户端远程调用获取服务器提供的在线服务接口来实施访问,也可直接部署并运行于客户端来实施访问。One or several technical features of this application, unless expressly specified, can be deployed on a server for implementation. The client remotely calls the online service interface provided by the server to implement access, or it can be directly deployed and run on the client to implement access.
本申请中所引用或可能引用到的神经网络模型,除非明文指定,既可部署于远程服务器且在客户端实施远程调用,也可部署于设备能力胜任的客户端直接调用,某些实施例中,当其运行于客户端时,其相应的智能可通过迁移学习来获得,以便降低对客户端硬件运行资源的要求,避免过度占用客户端硬件运行资源。The neural network models cited or possibly cited in this application, unless expressly specified, can be deployed on a remote server and remotely called on the client, or can be deployed on a client with competent device capabilities for direct calling. In some embodiments, , when it runs on the client, its corresponding intelligence can be obtained through transfer learning, so as to reduce the requirements for client hardware running resources and avoid excessive occupation of client hardware running resources.
本申请所涉及的各种数据,除非明文指定,既可远程存储于服务器,也可存储于本地终端设备,只要其适于被本申请的技术方案所调用即可。Various data involved in this application, unless expressly specified, can be stored remotely in a server or in a local terminal device, as long as they are suitable for being called by the technical solution of this application.
本领域技术人员对此应当知晓:本申请的各种方法,虽然基于相同的概念而进行描述而使其彼此间呈现共通性,但是,除非特别说明,否则这些方法都是可以独立执行的。同理,对于本申请所揭示的各个实施例而言,均基于同一发明构思而提出,因此,对于相同表述的概念,以及尽管概念表述不同但仅是为了方便而适当变换的概念,应被等同理解。Those skilled in the art should know that although the various methods of the present application are described based on the same concept and are common to each other, these methods can all be executed independently unless otherwise specified. Similarly, the various embodiments disclosed in this application are all proposed based on the same inventive concept. Therefore, the same expressed concepts, as well as the concepts that are appropriately transformed for convenience only, although the conceptual expressions are different, should be regarded as equivalent. understand.
本申请即将揭示的各个实施例,除非明文指出彼此之间的相互排斥关系,否则,各个实施例所涉的相关技术特征可以交叉结合而灵活构造出新的实施例,只要这种结合不背离本申请的创造精神且可满足现有技术中的需求或解决现有技术中的某方面的不足即可。对此变通,本领域技术人员应当知晓。Unless the mutually exclusive relationship between the various embodiments to be disclosed in this application is explicitly stated, the relevant technical features involved in the various embodiments can be cross-combined to flexibly construct new embodiments, as long as such combination does not deviate from the present disclosure. The application must be creative and can meet the needs of the existing technology or solve some deficiencies in the existing technology. Those skilled in the art will be aware of modifications to this.
请参阅图1,图1为本实施例智能合约部署方法的基本流程示意图。Please refer to Figure 1, which is a basic flow diagram of the smart contract deployment method in this embodiment.
如图1所示,包括:As shown in Figure 1, it includes:
S1100、基于预设的区块链集成开发环境,生成待部署的第一智能合约;S1100. Based on the preset blockchain integrated development environment, generate the first smart contract to be deployed;
本实施方式中通过区块链集成开发环境对第一智能合约进行采集,采集的方式能够为通过区块链集成开发环境采集外设设备的输入而生成的智能合约,也能够是区块链集成开发环境加载本地或者远程工程类文件生成的智能合约。In this implementation, the first smart contract is collected through the blockchain integrated development environment. The collection method can be a smart contract generated by collecting input from peripheral devices through the blockchain integrated development environment, or it can be a blockchain integrated The development environment loads the smart contract generated by local or remote project class files.
第一智能合约具体是指由用户开发的,待部署的智能合约,只有将第一智能合约上传至区块链的各节点才能完成第一智能合约的部署。The first smart contract specifically refers to the smart contract developed by the user and to be deployed. Only by uploading the first smart contract to each node of the blockchain can the deployment of the first smart contract be completed.
区块链集成开发环境为线上的开发环境,用户能够通过网页直接启动区块链集成开发环境进行智能合约的开发。根据具体应用场景的不同,在一些实施方式中,区块链集成开发环境还能够为安装在本地的开发工具包。The blockchain integrated development environment is an online development environment. Users can directly launch the blockchain integrated development environment through the web page to develop smart contracts. Depending on the specific application scenario, in some implementations, the blockchain integrated development environment can also be a development toolkit installed locally.
在一些实施方式中,区块链集成开发环境为联盟链专属的联盟链集成开发环境,联盟链用户能够通过区块链集成开发环境,在线上通过网页对智能合约进行开发,然后,通过区块链集成开发环境启动第一智能合约的联盟链部署。In some implementations, the blockchain integrated development environment is a consortium chain integrated development environment exclusive to the consortium chain. Consortium chain users can use the blockchain integrated development environment to develop smart contracts online through web pages, and then, through the block chain integrated development environment, The chain integrated development environment starts the alliance chain deployment of the first smart contract.
S1200、生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;S1200. Generate a target container for running the first smart contract, and deploy the first smart contract to the target container;
当区块链集成开发环境生成第一智能合约后,需要对第一智能合约进行部署。部署的方式为:通过用户控制区块链节点终端或者登录用户账户的临时区块链终端,生成用于部署第一智能合约的目标容器,由该目标容器对第一智能合约进行验证、测试后,将第一智能合约上传至区块链上。After the blockchain integrated development environment generates the first smart contract, the first smart contract needs to be deployed. The deployment method is: through the user-controlled blockchain node terminal or the temporary blockchain terminal logged into the user account, a target container for deploying the first smart contract is generated, and the target container verifies and tests the first smart contract. , upload the first smart contract to the blockchain.
在一些实施方式中,区块链集成开发环境生成第一智能合约后,节点终端根据第一智能合约,启动或者激活一个用于运行第一智能合约的目标终端。目 标容器是通过预先计算机程序构建,用于运行由区块节点发布智能合约的容器。目标容器能够为单个特定的容器,也能够根据应用场景的不同代指两个或者两个以上具有相同功能的容器。In some implementations, after the blockchain integrated development environment generates the first smart contract, the node terminal starts or activates a target terminal for running the first smart contract according to the first smart contract. Head Standard containers are containers built through pre-computer programs to run smart contracts issued by block nodes. The target container can be a single specific container, or it can refer to two or more containers with the same functions depending on the application scenario.
目标容器启动后,需要对第一智能合约进行能够被计算机逻辑读取和执行的二进制指令文件,将第一智能合约转换为二进制指令文件的过程称之为编译。编译的过程能够通过目标容器自带的编译器进行编译,也能由于目标容器关联的编译器进行编译,例如,目标容器激活后,向与其关联的编译器发送编译指令,编译器接收到编译指令后,对第一智能合约进行编译。第一智能合约编译生成的文件为编译文件。After the target container is started, the first smart contract needs to be converted into a binary instruction file that can be read and executed by computer logic. The process of converting the first smart contract into a binary instruction file is called compilation. The compilation process can be compiled by the compiler that comes with the target container, or by the compiler associated with the target container. For example, after the target container is activated, it sends compilation instructions to the compiler associated with it, and the compiler receives the compilation instructions. Finally, compile the first smart contract. The file generated by compiling the first smart contract is a compiled file.
在生成第一智能合约的编译文件后,需要将编译文件转换为能够被目标合约运行的镜像文件。镜像文件的转换过程就是编译文件按照目标容器的运行逻辑,按照设定的格式制作而成的文件。镜像文件的制作能够通过目标容器自带的镜像工具进行转换,也能够通过与目标容器关联的镜像工具进行转换。当转换得到镜像文件后,将镜像文件发送至目标容器,目标容器将镜像文件存储在容器的镜像存储空间中,完成对镜像文件的部署。目标容器运行第一智能合约时,仅需要从容器的镜像存储空间内读取该镜像文件并运行即可。After generating the compiled file of the first smart contract, the compiled file needs to be converted into an image file that can be run by the target contract. The conversion process of the image file is to compile the file into a file in a set format according to the operating logic of the target container. The image file can be produced and converted through the image tool that comes with the target container, or through the image tool associated with the target container. After the image file is converted, the image file is sent to the target container, and the target container stores the image file in the container's image storage space to complete the deployment of the image file. When the target container runs the first smart contract, it only needs to read the image file from the container's image storage space and run it.
在一些实施方式中,为了保证上链的智能合约的可靠性,目标容器需要对第一智能合约进行运行,并生成对应的测试日志。如果测试过程中测试日志中出现报错信息,根据报错信息的型号,在预设的补丁数据库中查找与该报错型号相对应的补丁脚本。得到补丁脚本后,激活与目标容器相同的其他目标容器,这些目标容器被定义为试错容器。试错容器启动后将第一智能合约和对应的补丁脚本同时部署到试错容器中进行运行,通过运行结果观察补丁脚本能否解决对应的报错问题。如果在试错容器的测试日志中不出现相同型号的报错,则说明补丁脚本有用,否则,则说明补丁脚本无法自动修复第一智能合约,需要人工进行修复。当试错容器的测试日志中不出现相同型号的报错时,目标容器根据测试日志中的报错位置,将补丁脚本嵌入到第一智能合约中,对第一智能合约进行更新,实现智能合约的自动化报错修复,有助于提高第一智能合约的上线效率和可靠性。In some implementations, in order to ensure the reliability of the smart contract on the chain, the target container needs to run the first smart contract and generate the corresponding test log. If an error message appears in the test log during the test, the patch script corresponding to the error model is searched in the preset patch database according to the model of the error message. After getting the patch script, activate other target containers that are the same as the target container. These target containers are defined as trial and error containers. After the trial and error container is started, the first smart contract and the corresponding patch script are deployed to the trial and error container at the same time for running. Through the running results, it is observed whether the patch script can solve the corresponding error problem. If the same type of error does not appear in the test log of the trial and error container, it means that the patch script is useful. Otherwise, it means that the patch script cannot automatically repair the first smart contract and needs to be repaired manually. When the same type of error does not appear in the test log of the trial and error container, the target container embeds the patch script into the first smart contract according to the error report position in the test log, updates the first smart contract, and realizes the automation of the smart contract. Error repair helps improve the launch efficiency and reliability of the first smart contract.
S1300、根据预设的节点证书签发所述目标容器的身份证书;S1300. Issue the identity certificate of the target container according to the preset node certificate;
本实施方式中,每个区块链节点上都有一本表明其合法身份的节点证书。该节点证书是由区块链的记账节点、证书管理节点、认证节点或者其他具有证书发放功能的节点,在每个区块链节点注册成功后,向其颁发的证书文件。有了节点证书,区块链节点才能够通过主链的身份认知,具有接入主链网络的资格,以及在主链网络中传播智能合约的资格。In this implementation, each blockchain node has a node certificate indicating its legal identity. The node certificate is a certificate file issued by the blockchain accounting node, certificate management node, certification node or other node with certificate issuance function after each blockchain node is successfully registered. With the node certificate, the blockchain node can recognize the identity of the main chain, be qualified to access the main chain network, and be qualified to propagate smart contracts in the main chain network.
区块链节点接入主链网络时,需要进行身份认证,目标容器接入主链网络时同样也需要进行身份认证。每一个目标容器接入主链网络时,都需要由区块链节点先进行身份认证后,再向主链网络请求颁发给目标容器合法的身份证书,然后,再由目标容器请求身份验证。When a blockchain node connects to the main chain network, identity authentication is required, and when the target container connects to the main chain network, identity authentication is also required. When each target container accesses the main chain network, the blockchain node needs to perform identity authentication first, and then request the main chain network to issue a legal identity certificate to the target container, and then the target container requests identity verification.
在一些实施方式中,为了简化目标容器证书的获取难度,目标容器的身份证书由区块链节点基于节点证书直接向目标容器进行颁发。 In some implementations, in order to simplify the difficulty of obtaining the target container certificate, the identity certificate of the target container is directly issued to the target container by the blockchain node based on the node certificate.
当将第一智能合约部署到目标容器后,目标容器会向其所在的区块链节点发送证书请求。区块链节点在接收到证书请求后,会读取存储在本地的节点证书,该节点证书中记载节点证书的所有者信息、颁发者信息和证书签名等信息。When the first smart contract is deployed to the target container, the target container will send a certificate request to the blockchain node where it is located. After receiving the certificate request, the blockchain node will read the node certificate stored locally. The node certificate records the owner information, issuer information, certificate signature and other information of the node certificate.
基于该节点证书区块链节点生成该节点证书的子证书,子证书中同样记载有所有者信息、颁发者信息和证书签名等信息。其中,所有者信息记载为目标容器信息,颁发者信息记载节点证书的证书信息。区块链节点将生成的子证书颁发给目标容器,目标容器接收到子证书后,将该子证书作为自己的身份证书。Based on the node certificate, the blockchain node generates a sub-certificate of the node certificate. The sub-certificate also records owner information, issuer information, certificate signature and other information. Among them, the owner information is recorded as the target container information, and the issuer information records the certificate information of the node certificate. The blockchain node issues the generated sub-certificate to the target container. After receiving the sub-certificate, the target container uses the sub-certificate as its own identity certificate.
S1400、调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;S1400. Call the preset container orchestrator to connect the target container to the main chain network and perform identity verification;
本实施方式中设置有容器编排器,容器编辑器能够为(不限于):Kubernetes编排器、OpenShift编排器、Docker Swarm编排器、Mesos编排器、Google Container Engine编排器等容器编排器。In this implementation, a container orchestrator is provided, and the container editor can be (not limited to): Kubernetes orchestrator, OpenShift orchestrator, Docker Swarm orchestrator, Mesos orchestrator, Google Container Engine orchestrator and other container orchestrators.
目标容器部署了第一智能合约和身份证书后,需要将第一智能合约和身份证书上传至主链网络中。目标容器上传上述信息至主链网络,需要调用与主链网络连接的连接接口。容器编辑器用于向目标容器配置连接接口,该连接接口为上链接口,上链接口为API接口。After the first smart contract and identity certificate are deployed in the target container, the first smart contract and identity certificate need to be uploaded to the main chain network. To upload the above information to the main chain network, the target container needs to call the connection interface connected to the main chain network. The container editor is used to configure the connection interface to the target container. The connection interface is the uplink interface, and the uplink interface is the API interface.
容器编排器向目标容器分配上链接口后,目标容器调用该上链接口,启动路由链接,将目标容器连接至主链网络。在一些实施方式中,主链网络为联盟链,但是,主链网络能够为公链网络或者私链网络。After the container orchestrator allocates an uplink interface to the target container, the target container calls the uplink interface, starts the routing link, and connects the target container to the main chain network. In some implementations, the main chain network is a consortium chain, but the main chain network can be a public chain network or a private chain network.
目标容器通过上链接口与主链网络连接后,由目标容器向主链网络发送身份证书,主链网络接收到目标容器发送的身份证书后,通过预设的身份验证规则对目标容器的身份进行验证。身份证书验证通过后,主链网络确认目标容器的身份,目标容器具有了向主链网络上传智能合约的身份。如果身份证书验证不通过,则主链网络确定目标容器为非法接入,断开与目标容器的连接。After the target container is connected to the main chain network through the uplink interface, the target container sends the identity certificate to the main chain network. After receiving the identity certificate sent by the target container, the main chain network verifies the identity of the target container through the preset authentication rules. verify. After the identity certificate is verified, the main chain network confirms the identity of the target container, and the target container has the identity to upload smart contracts to the main chain network. If the identity certificate verification fails, the main chain network determines that the target container has illegal access and disconnects from the target container.
S1500、当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。S1500. After the identity verification of the target container passes, diffuse the first smart contract in the main chain network.
当目标容器的身份证书在主链网络验证通过后,目标容器向主链网络发送第一智能合约,主链网络在接收到第一智能合约,对第一智能合约进行链上广播,对第一智能合约进行扩散,主链网络中的其他节点在接收到扩散的第一智能合约后,对第一智能合约进行存储,以便在接收到第一智能合约对应的任务时,调用第一智能合约进行执行。When the identity certificate of the target container is verified on the main chain network, the target container sends the first smart contract to the main chain network. After receiving the first smart contract, the main chain network broadcasts the first smart contract on the chain and broadcasts the first smart contract to the main chain network. The smart contract is diffused. After receiving the diffused first smart contract, other nodes in the main chain network store the first smart contract so that when receiving the task corresponding to the first smart contract, they can call the first smart contract. implement.
上述实施方式在区块链集成开发环境中生成第一智能合约后,将第一智能合约部署在节点的目标容器中,由目标容器对第一智能合约进行运行,并且在得到节点证书签发的身份证书后,目标容器能够接入到主链网络中,并且通过主链网络对第一智能合约进行链上扩散传播,以此实现链上多节点验证,提高了验证的效率。通过目标容器和身份证书实现了智能合约线下和链上统一部署,缩短了调试部署的时限,提高了智能合约调试部署的效率。In the above implementation, after generating the first smart contract in the blockchain integrated development environment, the first smart contract is deployed in the target container of the node, and the target container runs the first smart contract, and obtains the identity of the node certificate issued After obtaining the certificate, the target container can access the main chain network, and spread the first smart contract on-chain through the main chain network, thereby realizing multi-node verification on the chain and improving the efficiency of verification. Through the target container and identity certificate, the unified deployment of smart contracts offline and on the chain is realized, which shortens the time limit for debugging and deployment and improves the efficiency of smart contract debugging and deployment.
在一些实施方式中,第一智能合约以镜像文件的格式部署到目标容器中。S1200包括:In some implementations, the first smart contract is deployed to the target container in the format of an image file. S1200 includes:
S1211、对所述第一智能合约进行编译,生成所述第一智能合约的编译文件; S1211. Compile the first smart contract and generate a compiled file of the first smart contract;
对第一智能合约进行能够被计算机逻辑读取和执行的二进制指令文件,将第一智能合约转换为二进制指令文件的过程称之为编译。编译的过程能够通过目标容器自带的编译器进行编译,也能由于目标容器关联的编译器进行编译,例如,目标容器激活后,向与其关联的编译器发送编译指令,编译器接收到编译指令后,对第一智能合约进行编译。第一智能合约编译生成的文件为编译文件。Convert the first smart contract into a binary instruction file that can be read and executed by computer logic. The process of converting the first smart contract into a binary instruction file is called compilation. The compilation process can be compiled by the compiler that comes with the target container, or by the compiler associated with the target container. For example, after the target container is activated, it sends compilation instructions to the compiler associated with it, and the compiler receives the compilation instructions. Finally, compile the first smart contract. The file generated by compiling the first smart contract is a compiled file.
S1212、根据所述编译文件生成所述第一智能合约的镜像文件;S1212. Generate the image file of the first smart contract according to the compiled file;
在生成第一智能合约的编译文件后,需要将编译文件转换为能够被目标合约运行的镜像文件。镜像文件的转换过程就是编译文件按照目标容器的运行逻辑,按照设定的格式制作而成的文件。镜像文件的制作能够通过目标容器自带的镜像工具进行转换,也能够通过与目标容器关联的镜像工具进行转换。After generating the compiled file of the first smart contract, the compiled file needs to be converted into an image file that can be run by the target contract. The conversion process of the image file is to compile the file into a file in a set format according to the operating logic of the target container. The image file can be produced and converted through the image tool that comes with the target container, or through the image tool associated with the target container.
S1213、根据所述镜像文件启动所述目标容器,并将所述镜像文件部署到所述目标容器中。S1213. Start the target container according to the image file, and deploy the image file to the target container.
当转换得到镜像文件后,启动或者激活一个用于运行第一智能合约的目标终端。目标容器是通过预先计算机程序构建,用于运行由区块节点发布智能合约的容器。目标容器能够为单个特定的容器,也能够根据应用场景的不同代指两个或者两个以上具有相同功能的容器。After the image file is converted, start or activate a target terminal for running the first smart contract. The target container is a container built by pre-computer programming to run smart contracts published by block nodes. The target container can be a single specific container, or it can refer to two or more containers with the same functions depending on the application scenario.
将镜像文件发送至目标容器,目标容器将镜像文件存储在容器的镜像存储空间中,完成对镜像文件的部署。目标容器运行第一智能合约时,仅需要从容器的镜像存储空间内读取该镜像文件并运行即可。Send the image file to the target container, and the target container stores the image file in the container's image storage space to complete the deployment of the image file. When the target container runs the first smart contract, it only needs to read the image file from the container's image storage space and run it.
在一些实施方式中,目标容器通过节点证书得到身份证书。具体地,S1300包括:In some embodiments, the target container obtains the identity certificate through the node certificate. Specifically, S1300 includes:
S1311、读取预存储的节点证书和所述目标容器发送的证书请求;S1311. Read the pre-stored node certificate and the certificate request sent by the target container;
每个区块链节点上都有一本表明其合法身份的节点证书。该节点证书是由区块链的记账节点、证书管理节点、认证节点或者其他具有证书发放功能的节点,在每个区块链节点注册成功后,向其颁发的证书文件。有了节点证书,区块链节点才能够通过主链的身份认知,具有接入主链网络的资格,以及在主链网络中传播智能合约的资格。Each blockchain node has a node certificate indicating its legal identity. The node certificate is a certificate file issued by the blockchain accounting node, certificate management node, certification node or other node with certificate issuance function after each blockchain node is successfully registered. With the node certificate, the blockchain node can recognize the identity of the main chain, be qualified to access the main chain network, and be qualified to propagate smart contracts in the main chain network.
S1312、根据所述证书请求生成所述节点证书的子证书,并将所述子证书作为所述身份证书颁发给所述目标容器。S1312. Generate a sub-certificate of the node certificate according to the certificate request, and issue the sub-certificate to the target container as the identity certificate.
当将第一智能合约部署到目标容器后,目标容器会向其所在的区块链节点发送证书请求。区块链节点在接收到证书请求后,会读取存储在本地的节点证书,该节点证书中记载节点证书的所有者信息、颁发者信息和证书签名等信息。When the first smart contract is deployed to the target container, the target container will send a certificate request to the blockchain node where it is located. After receiving the certificate request, the blockchain node will read the node certificate stored locally. The node certificate records the owner information, issuer information, certificate signature and other information of the node certificate.
基于该节点证书区块链节点生成该节点证书的子证书,子证书中同样记载有所有者信息、颁发者信息和证书签名等信息。其中,所有者信息记载为目标容器信息,颁发者信息记载节点证书的证书信息。区块链节点将生成的子证书颁发给目标容器,目标容器接收到子证书后,将该子证书作为自己的身份证书。Based on the node certificate, the blockchain node generates a sub-certificate of the node certificate. The sub-certificate also records owner information, issuer information, certificate signature and other information. Among them, the owner information is recorded as the target container information, and the issuer information records the certificate information of the node certificate. The blockchain node issues the generated sub-certificate to the target container. After receiving the sub-certificate, the target container uses the sub-certificate as its own identity certificate.
在一些实施方式中,目标容器与主链网络连接后,需要进行身份验证。具体地,S1400包括:In some implementations, authentication is required after the target container is connected to the main chain network. Specifically, S1400 includes:
S1411、调用所述容器编排器为所述目标容器分配上链接口; S1411. Call the container orchestrator to allocate an uplink port to the target container;
目标容器部署了第一智能合约和身份证书后,需要将第一智能合约和身份证书上传至主链网络中。目标容器上传上述信息至主链网络,需要调用与主链网络连接的连接接口。容器编辑器用于向目标容器配置连接接口,该连接接口为上链接口,上链接口为API接口。After the first smart contract and identity certificate are deployed in the target container, the first smart contract and identity certificate need to be uploaded to the main chain network. To upload the above information to the main chain network, the target container needs to call the connection interface connected to the main chain network. The container editor is used to configure the connection interface to the target container. The connection interface is the uplink interface, and the uplink interface is the API interface.
S1412、根据所述上链接口将所述目标容器连接到主链网络;S1412. Connect the target container to the main chain network according to the uplink interface;
容器编排器向目标容器分配上链接口后,目标容器调用该上链接口,启动路由链接,将目标容器连接至主链网络。在一些实施方式中,主链网络为联盟链,但是,主链网络能够为公链网络或者私链网络。After the container orchestrator allocates an uplink interface to the target container, the target container calls the uplink interface, starts the routing link, and connects the target container to the main chain network. In some implementations, the main chain network is a consortium chain, but the main chain network can be a public chain network or a private chain network.
S1413、向所述主链网络发生所述身份证书,以使所述主链网络根据所述身份证书对所述目标容器的身份信息进行验证。S1413. Send the identity certificate to the main chain network, so that the main chain network verifies the identity information of the target container based on the identity certificate.
目标容器通过上链接口与主链网络连接后,由目标容器向主链网络发送身份证书,主链网络接收到目标容器发送的身份证书后,通过预设的身份验证规则对目标容器的身份进行验证。身份证书验证通过后,主链网络确认目标容器的身份,目标容器具有了向主链网络上传智能合约的身份。如果身份证书验证不通过,则主链网络确定目标容器为非法接入,断开与目标容器的连接。After the target container is connected to the main chain network through the uplink interface, the target container sends the identity certificate to the main chain network. After receiving the identity certificate sent by the target container, the main chain network verifies the identity of the target container through the preset authentication rules. verify. After the identity certificate is verified, the main chain network confirms the identity of the target container, and the target container has the identity to upload smart contracts to the main chain network. If the identity certificate verification fails, the main chain network determines that the target container has illegal access and disconnects from the target container.
在一些实施方式中,目标容器除了向主链网络发送区块链节点发布的第一智能合约,还能够接收由其他区块链节点发送的第二智能合约,接收到第二智能合约后,区块链节点需要对第二智能合约进行验证。具体地,S1500之后包括:In some implementations, in addition to sending the first smart contract issued by the blockchain node to the main chain network, the target container can also receive the second smart contract sent by other blockchain nodes. After receiving the second smart contract, the district Blockchain nodes need to verify the second smart contract. Specifically, after S1500 include:
S1610、所述目标容器接收所述主链网络中待验证的第二智能合约;S1610. The target container receives the second smart contract to be verified in the main chain network;
目标容器将第一智能合约发送至主链网络,区块链节点还能够通过目标容器接收由主链网络广播扩散至区块链节点的第二智能合约。第二智能合约是由区块链中其他区块链节点上传的智能合约,目标容器在接收到该第二智能合约后,需要对第二智能合约进行测试,测试无误后再对第二智能合约进行本地部署。The target container sends the first smart contract to the main chain network, and the blockchain node can also receive the second smart contract broadcasted by the main chain network to the blockchain node through the target container. The second smart contract is a smart contract uploaded by other blockchain nodes in the blockchain. After receiving the second smart contract, the target container needs to test the second smart contract. After the test is correct, the second smart contract can be tested. Do a local deployment.
S1620、根据所述第二智能合约启动设置的验证容器,其中,所述验证容器用于运行所述第二智能合约;S1620. Start the verification container configured according to the second smart contract, wherein the verification container is used to run the second smart contract;
目标容器接收到第二智能合约后,目标容器所在的区块链节点,根据第二智能合约运行所需的环境参数,激活能够运行第二智能合约的验证容器。验证容器是预先配置完成的容器,用于对智能合约进行验证。目标容器所在的区块链节点根据区块链中已有的智能合约类型,对应的预先构建每种智能合约对应的验证容器。因此,当第二智能合约被接收后,根据第二智能合约的类型就能激活对应的验证容器。After the target container receives the second smart contract, the blockchain node where the target container is located activates the verification container capable of running the second smart contract based on the environmental parameters required for the operation of the second smart contract. The verification container is a pre-configured container used to verify smart contracts. The blockchain node where the target container is located will pre-build the verification container corresponding to each smart contract according to the existing smart contract types in the blockchain. Therefore, when the second smart contract is received, the corresponding verification container can be activated according to the type of the second smart contract.
S1630、所述目标容器将所述第二智能合约发送至所述验证容器中进行验证。S1630. The target container sends the second smart contract to the verification container for verification.
当第二智能合约被目标容器接收,并且激活用于部署第二智能合约的验证容器后,目标容器将第二智能合约发送至验证容器中进行验证。验证的方式为:验证容器运行第二智能合约,运行过程中生成验证日志,将该验证日志发送至主链网络中就完成第二智能合约的验证。在一些实施方式中的验证方式为:第二智能合约中自带有运行结果,验证容器运行第二智能合约后,会产生一个验证结果,将验证结果与运行结果进行匹配,如果匹配成功则,验证通过,否则,则验证失败。 When the second smart contract is received by the target container and the verification container for deploying the second smart contract is activated, the target container sends the second smart contract to the verification container for verification. The verification method is: the verification container runs the second smart contract, generates a verification log during the operation, and sends the verification log to the main chain network to complete the verification of the second smart contract. The verification method in some implementations is: the second smart contract has its own running result. After the verification container runs the second smart contract, a verification result will be generated, and the verification result will be matched with the running result. If the match is successful, The verification passes, otherwise, the verification fails.
验证容器接收的第二智能合约为镜像文件,因此,第二智能合约能够直接在验证容器进行部署。如果,目标容器接收的第二智能合约不是镜像文件,则需要先对第二智能合约进行译码,然后,在将第二智能合约的译码文件转换为镜像文件后部署。The second smart contract received by the verification container is an image file. Therefore, the second smart contract can be deployed directly in the verification container. If the second smart contract received by the target container is not an image file, the second smart contract needs to be decoded first, and then deployed after converting the decoded file of the second smart contract into an image file.
目标容器向验证容器发送第二智能合约是通过第三方进行转发的,例如,通过容器编排器或者主控器,将第二智能合约转发至验证容器。The target container forwards the second smart contract to the verification container through a third party, for example, through the container orchestrator or the master controller, which forwards the second smart contract to the verification container.
上述实施方式中,通过目标容器进行第二智能合约的接收,避免区块链节点接收需要验证的第二智能合约时,需要与主链网络建立连接问题,只需要一次连接就能够上传第一智能合约,也能够接收第二智能合约,提高了传输效率,降低了连接接口被调用的次数,实现了接口复用。In the above implementation, the second smart contract is received through the target container to avoid the problem that the blockchain node needs to establish a connection with the main chain network when receiving the second smart contract that needs to be verified. The first smart contract can be uploaded with only one connection. The contract can also receive the second smart contract, which improves the transmission efficiency, reduces the number of times the connection interface is called, and realizes interface reuse.
在一些实施方式中,由于,容器之间无法感知彼此的存在,也无法进行容器之间的信息交互,因此,目标容器与验证容器之间的信息传输需要进行第三方的信息中转,降低了信息传输的效率。S1630包括:In some implementations, since containers cannot perceive each other's existence and cannot interact with each other, information transmission between the target container and the verification container requires third-party information transfer, which reduces the information cost. transmission efficiency. S1630 includes:
S1631、读取所述目标容器的目标存储地址;S1631. Read the target storage address of the target container;
为解决目标容器与验证容器之间无法进行信息传输的问题,通过对两个容器的存储问题进行复用,解决信息传输壁障。In order to solve the problem that information cannot be transmitted between the target container and the verification container, the storage problem of the two containers is reused to solve the information transmission barrier.
接收到第二智能合约后,读取目标容器的目标存储地址,目标存储地址是目标容器专属的存储空间,在目标容器构建或者启动时,由区块链节点或者容器编排器进行配置。After receiving the second smart contract, read the target storage address of the target container. The target storage address is the storage space exclusive to the target container. It is configured by the blockchain node or container orchestrator when the target container is built or started.
S1632、根据所述目标存储地址构建所述验证容器的验证存储地址,并使所述目标存储地址和验证存储地址相互重叠;S1632. Construct the verification storage address of the verification container according to the target storage address, and make the target storage address and the verification storage address overlap with each other;
读取得到目标容器的目标存储地址后,对验证容器的存储地址进行配置,将验证容器的验证存储地址配置成与目标存储地址相同的地址。这样就实现了目标存储地址和验证存储地址的相互重叠。After reading the target storage address of the target container, configure the storage address of the verification container, and configure the verification storage address of the verification container to be the same address as the target storage address. In this way, the target storage address and the verification storage address overlap with each other.
S1633、所述目标容器将所述第二智能合约存储在所述目标存储地址中;S1633. The target container stores the second smart contract in the target storage address;
目标存储地址和验证存储地址相互重叠后,目标容器将第二智能合约存储在目标存储地址中。After the target storage address and the verification storage address overlap each other, the target container stores the second smart contract in the target storage address.
S1634、所述验证容器读取所述验证存储地址中的第二智能合约,并对所述第二智能合约进行验证。S1634. The verification container reads the second smart contract in the verification storage address and verifies the second smart contract.
验证容器通过定时查询的方式,查询验证存储地址中是否被写入信息,当目标容器将第二智能合约存储在目标存储地址中,验证容器就会查询到验证存储地址中写入了信息,此时,验证容器就读取到了第二智能合约。验证容器读取到第二智能合约后,对第二智能合约进行运行验证。The verification container queries and verifies whether information has been written in the verification storage address through scheduled queries. When the target container stores the second smart contract in the target storage address, the verification container will query and verify that the information has been written in the verification storage address. This At this time, the verification container reads the second smart contract. After the verification container reads the second smart contract, it performs operation verification on the second smart contract.
通过使目标存储地址和验证存储地址相互重叠,实现了验证容器和目标容器之间的智能合约直接传递,提高了第二智能合约的验证效率。By overlapping the target storage address and the verification storage address, the direct transfer of smart contracts between the verification container and the target container is achieved, improving the verification efficiency of the second smart contract.
在一些实施方式中,当验证容器运行完成第二智能合约后,需要将第二智能合约的验证日志上传至主链网络中。S1630之后包括:In some implementations, after the verification container completes running the second smart contract, the verification log of the second smart contract needs to be uploaded to the main chain network. After S1630 includes:
S1640、当所述第二智能合约验证完成后,释放所述验证容器,并向所述容器编排器发送释放消息和验证日志;S1640. After the second smart contract verification is completed, release the verification container and send a release message and verification log to the container orchestrator;
当验证容器运行完第二智能合约后,根据程序设定对验证容器进行释放, 验证容器释放后,赋予验证容器的所有资源和权限均回归。验证容器被释放之前,向容器编排器发送释放信息和验证日志。其中,释放信息是通知容器编排器消除对验证容器的编码和状态监控,验证日志则是运行第二智能合约生成的运行日志。After the verification container finishes running the second smart contract, the verification container is released according to the program settings. After the verification container is released, all resources and permissions granted to the verification container are returned. Before verifying that the container is released, send release information and verification logs to the container orchestrator. Among them, the release information is to notify the container orchestrator to eliminate the coding and status monitoring of the verification container, and the verification log is the operation log generated by running the second smart contract.
S1650、所述容器编排器根据所述释放信息,向所述目标容器发送所述验证日志;S1650. The container orchestrator sends the verification log to the target container according to the release information;
容器编排器在接收到释放信息后,解除对验证容器的状态监控,将验证容器的编码信息进行删除,然后,将验证日志发送至目标容器,由目标容器向主链网络上传验证日志。After receiving the release information, the container orchestrator releases the status monitoring of the verification container, deletes the encoding information of the verification container, and then sends the verification log to the target container, which uploads the verification log to the main chain network.
S1660、所述目标容器将所述验证日志发送至所述主链网络。S1660. The target container sends the verification log to the main chain network.
目标容器在接收到容器编排器发送的验证日志后,将该验证日志上传至主链网络中,主链网络对验证日志进行采集,以生成全链路区块链节点对第二智能合约的验证结果。在一些实施方式中,当目标容器发送完验证日志后,目标容器与主链网络断开连接,并启动释放程序。After receiving the verification log sent by the container orchestrator, the target container uploads the verification log to the main chain network. The main chain network collects the verification log to generate verification of the second smart contract by the full-link blockchain node. result. In some implementations, after the target container completes sending the verification log, the target container disconnects from the main chain network and starts the release process.
通过目标容器对验证日志进行上传,无需验证容器接入到主链网络中,也不用验证容器进行身份验证,提高了验证日志的上传速率,降低了资源使用频率,节约了算力资源。By uploading the verification log through the target container, there is no need for the verification container to be connected to the main chain network, and there is no need for the verification container to perform identity verification. This increases the upload rate of verification logs, reduces the frequency of resource usage, and saves computing resources.
在一些实施方式中,S1500之后包括:In some embodiments, following S1500 includes:
S1711、获取所述第一智能合约的调试接口,以及所述第一智能合约可视化的调试图标;S1711. Obtain the debugging interface of the first smart contract and the visual debugging icon of the first smart contract;
当第一智能合约部署完成后,进入到区块链集成开发环境的调试模块,调试模块中具有第一智能合约的调试接口,进入到调试模块后,在区块链集成开发环境的操作页面生成第一智能合约的可视化调试图标。After the deployment of the first smart contract is completed, enter the debugging module of the blockchain integrated development environment. The debugging module has the debugging interface of the first smart contract. After entering the debugging module, the operation page of the blockchain integrated development environment is generated. Visual debugging icon of the first smart contract.
S1712、根据所述调试图标和所述调试接口,在所述区块链集成开发环境中调用所述第一智能合约进行测试运行。S1712. According to the debugging icon and the debugging interface, call the first smart contract in the blockchain integrated development environment for test operation.
当用户通过调试图标启动对第一智能合约的调试任务后,调试模块通过调试接口调用第一智能合约进行测试运行,完成对第一智能合约的测试。在部署完成后,根据可视化的图标在区块链集成开发环境中对第一智能合约进行测试,提高了测试效率。When the user starts the debugging task of the first smart contract through the debugging icon, the debugging module calls the first smart contract through the debugging interface to perform test operation and completes the test of the first smart contract. After the deployment is completed, the first smart contract is tested in the blockchain integrated development environment based on the visual icons, which improves testing efficiency.
具体请参阅图2,图2为本实施例智能合约部署装置基本结构示意图。Please refer to Figure 2 for details. Figure 2 is a schematic diagram of the basic structure of the smart contract deployment device in this embodiment.
如图2所示,一种智能合约部署装置,包括:生成模块1100、部署模块1200、签发模块1300、处理模块1400和执行模块1500。生成模块1100用于基于预设的区块链集成开发环境,生成待部署的第一智能合约;部署模块1200用于生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;签发模块1300用于根据预设的节点证书签发所述目标容器的身份证书;处理模块1400用于调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;执行模块1500用于当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。As shown in Figure 2, a smart contract deployment device includes: a generation module 1100, a deployment module 1200, an issuance module 1300, a processing module 1400 and an execution module 1500. The generation module 1100 is used to generate the first smart contract to be deployed based on the preset blockchain integrated development environment; the deployment module 1200 is used to generate a target container for running the first smart contract, and transfer the first smart contract to Deployed to the target container; the issuance module 1300 is used to issue the identity certificate of the target container according to the preset node certificate; the processing module 1400 is used to call the preset container orchestrator to connect the target container to the main chain In the network, identity verification is performed; the execution module 1500 is used to diffuse the first smart contract in the main chain network after the identity verification of the target container passes.
在区块链集成开发环境中生成第一智能合约后,将第一智能合约部署在节 点的目标容器中,由目标容器对第一智能合约进行运行,并且在得到节点证书签发的身份证书后,目标容器能够接入到主链网络中,并且通过主链网络对第一智能合约进行链上扩散传播,以此实现链上多节点验证,提高了验证的效率。通过目标容器和身份证书实现了智能合约线下和链上统一部署,缩短了调试部署的时限,提高了智能合约调试部署的效率。After generating the first smart contract in the blockchain integrated development environment, deploy the first smart contract in the node In the target container of the node, the target container runs the first smart contract, and after obtaining the identity certificate issued by the node certificate, the target container can access the main chain network, and run the first smart contract through the main chain network. Diffusion on the chain enables multi-node verification on the chain and improves the efficiency of verification. Through the target container and identity certificate, the unified deployment of smart contracts offline and on the chain is realized, which shortens the time limit for debugging and deployment and improves the efficiency of smart contract debugging and deployment.
可选地,所述智能合约部署装置还包括:Optionally, the smart contract deployment device also includes:
第一处理子模块,用于对所述第一智能合约进行编译,生成所述第一智能合约的编译文件;The first processing sub-module is used to compile the first smart contract and generate the compiled file of the first smart contract;
第一编译子模块,用于根据所述编译文件生成所述第一智能合约的镜像文件;The first compilation submodule is used to generate the image file of the first smart contract according to the compilation file;
第一执行子模块,用于根据所述镜像文件启动所述目标容器,并将所述镜像文件部署到所述目标容器中。The first execution sub-module is used to start the target container according to the image file and deploy the image file to the target container.
可选地,所述智能合约部署装置还包括:Optionally, the smart contract deployment device also includes:
第二处理子模块,用于读取预存储的节点证书和所述目标容器发送的证书请求;The second processing submodule is used to read the pre-stored node certificate and the certificate request sent by the target container;
第二执行子模块,用于根据所述证书请求生成所述节点证书的子证书,并将所述子证书作为所述身份证书颁发给所述目标容器。The second execution sub-module is configured to generate a sub-certificate of the node certificate according to the certificate request, and issue the sub-certificate to the target container as the identity certificate.
可选地,所述智能合约部署装置还包括:Optionally, the smart contract deployment device also includes:
第一调用子模块,用于调用所述容器编排器为所述目标容器分配上链接口;The first calling sub-module is used to call the container orchestrator to allocate an uplink interface to the target container;
第三处理子模块,用于根据所述上链接口将所述目标容器连接到主链网络;The third processing sub-module is used to connect the target container to the main chain network according to the uplink interface;
第三执行子模块,用于向所述主链网络发生所述身份证书,以使所述主链网络根据所述身份证书对所述目标容器的身份信息进行验证。The third execution sub-module is used to send the identity certificate to the main chain network, so that the main chain network verifies the identity information of the target container based on the identity certificate.
可选地,所述智能合约部署装置还包括:Optionally, the smart contract deployment device also includes:
第一接收子模块,用于所述目标容器接收所述主链网络中待验证的第二智能合约;The first receiving sub-module is used by the target container to receive the second smart contract to be verified in the main chain network;
第四处理子模块,用于根据所述第二智能合约启动设置的验证容器,其中,所述验证容器用于运行所述第二智能合约;The fourth processing sub-module is used to start the verification container configured according to the second smart contract, wherein the verification container is used to run the second smart contract;
第四执行子模块,用于所述目标容器将所述第二智能合约发送至所述验证容器中进行验证。The fourth execution sub-module is used by the target container to send the second smart contract to the verification container for verification.
可选地,所述智能合约部署装置还包括:Optionally, the smart contract deployment device also includes:
第二读取子模块,用于读取所述目标容器的目标存储地址;The second reading sub-module is used to read the target storage address of the target container;
第一存储子模块,用于根据所述目标存储地址构建所述验证容器的验证存储地址,并使所述目标存储地址和验证存储地址相互重叠;A first storage submodule configured to construct a verification storage address of the verification container according to the target storage address, and make the target storage address and the verification storage address overlap with each other;
第五处理子模块,用于所述目标容器将所述第二智能合约存储在所述目标存储地址中;The fifth processing sub-module is used for the target container to store the second smart contract in the target storage address;
第五执行子模块,用于所述验证容器读取所述验证存储地址中的第二智能合约,并对所述第二智能合约进行验证。The fifth execution sub-module is used for the verification container to read the second smart contract in the verification storage address and verify the second smart contract.
可选地,所述智能合约部署装置还包括:Optionally, the smart contract deployment device also includes:
第一释放子模块,用于当所述第二智能合约验证完成后,释放所述验证容器,并向所述容器编排器发送释放消息和验证日志; The first release submodule is used to release the verification container after the verification of the second smart contract is completed, and send a release message and verification log to the container orchestrator;
第六处理子模块,用于所述容器编排器根据所述释放信息,向所述目标容器发送所述验证日志;The sixth processing sub-module is used for the container orchestrator to send the verification log to the target container according to the release information;
第六执行子模块,用于所述目标容器将所述验证日志发送至所述主链网络。The sixth execution sub-module is used for the target container to send the verification log to the main chain network.
可选地,所述智能合约部署装置还包括:Optionally, the smart contract deployment device also includes:
第七处理子模块,用于获取所述第一智能合约的调试接口,以及所述第一智能合约可视化的调试图标;The seventh processing sub-module is used to obtain the debugging interface of the first smart contract and the visual debugging icon of the first smart contract;
第七执行子模块,用于根据所述调试图标和所述调试接口,在所述区块链集成开发环境中调用所述第一智能合约进行测试运行。The seventh execution sub-module is used to call the first smart contract in the blockchain integrated development environment for test operation according to the debugging icon and the debugging interface.
为解决上述技术问题,本申请实施例还提供计算机设备。具体请参阅图3,图3为本实施例计算机设备基本结构框图。In order to solve the above technical problems, embodiments of the present application also provide computer equipment. Please refer to Figure 3 for details. Figure 3 is a basic structural block diagram of the computer equipment in this embodiment.
如图3所示,计算机设备的内部结构示意图。该计算机设备包括通过系统总线连接的处理器、非易失性存储介质、存储器和网络接口。其中,该计算机设备的非易失性存储介质存储有操作系统、数据库和计算机可读指令,数据库中可存储有控件信息序列,该计算机可读指令被处理器执行时,可使得处理器实现一种智能合约部署法。该计算机设备的处理器用于提供计算和控制能力,支撑整个计算机设备的运行。该计算机设备的存储器中可存储有计算机可读指令,该计算机可读指令被处理器执行时,可使得处理器执行一种智能合约部署法。该计算机设备的网络接口用于与终端连接通信。本领域技术人员可以理解,图3中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。As shown in Figure 3, a schematic diagram of the internal structure of computer equipment. The computer device includes a processor, non-volatile storage media, memory and a network interface connected by a system bus. Among them, the non-volatile storage medium of the computer device stores an operating system, a database and computer-readable instructions. The database can store a sequence of control information. When the computer-readable instructions are executed by the processor, the processor can achieve a A smart contract deployment method. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. Computer readable instructions may be stored in the memory of the computer device, and when executed by the processor, the computer readable instructions may cause the processor to execute a smart contract deployment method. The network interface of the computer device is used for communication with the terminal connection. Those skilled in the art can understand that the structure shown in Figure 3 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. The specific computer equipment can May include more or fewer parts than shown, or combine certain parts, or have a different arrangement of parts.
本实施方式中处理器用于执行图2中生成模块1100、部署模块1200、签发模块1300、处理模块1400和执行模块1500的具体功能,存储器存储有执行上述模块所需的程序代码和各类数据。网络接口用于向用户终端或服务器之间的数据传输。本实施方式中的存储器存储有智能合约部署装置中执行所有子模块所需的程序代码及数据,服务器能够调用服务器的程序代码及数据执行所有子模块的功能。In this embodiment, the processor is used to execute the specific functions of the generation module 1100, the deployment module 1200, the issuance module 1300, the processing module 1400 and the execution module 1500 in Figure 2, and the memory stores program codes and various data required to execute the above modules. Network interfaces are used for data transmission to user terminals or between servers. The memory in this embodiment stores the program code and data required to execute all sub-modules in the smart contract deployment device, and the server can call the server's program code and data to execute the functions of all sub-modules.
计算机设备在区块链集成开发环境中生成第一智能合约后,将第一智能合约部署在节点的目标容器中,由目标容器对第一智能合约进行运行,并且在得到节点证书签发的身份证书后,目标容器能够接入到主链网络中,并且通过主链网络对第一智能合约进行链上扩散传播,以此实现链上多节点验证,提高了验证的效率。通过目标容器和身份证书实现了智能合约线下和链上统一部署,缩短了调试部署的时限,提高了智能合约调试部署的效率。After the computer device generates the first smart contract in the blockchain integrated development environment, it deploys the first smart contract in the target container of the node, and the target container runs the first smart contract, and obtains the identity certificate issued by the node certificate. Finally, the target container can be connected to the main chain network, and the first smart contract is diffused on the chain through the main chain network, thereby realizing multi-node verification on the chain and improving the efficiency of verification. Through the target container and identity certificate, the unified deployment of smart contracts offline and on the chain is realized, which shortens the time limit for debugging and deployment and improves the efficiency of smart contract debugging and deployment.
本申请还提供一种存储有计算机可读指令的存储介质,计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行上述任一实施例智能合约部署方法的步骤。This application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, they cause the one or more processors to execute the steps of the smart contract deployment method of any of the above embodiments.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流 程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. The program can be stored in a computer-readable storage medium. When executed, the flow of the above method embodiments may be included. Procedure. Among them, the aforementioned storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM).
本技术领域技术人员可以理解,本申请中已经讨论过的各种操作、方法、流程中的步骤、措施、方案可以被交替、更改、组合或删除。进一步地,具有本申请中已经讨论过的各种操作、方法、流程中的其他步骤、措施、方案也可以被交替、更改、重排、分解、组合或删除。进一步地,现有技术中的具有与本申请中公开的各种操作、方法、流程中的步骤、措施、方案也可以被交替、更改、重排、分解、组合或删除。Those skilled in the art can understand that the steps, measures, and solutions in the various operations, methods, and processes that have been discussed in this application can be alternated, changed, combined, or deleted. Furthermore, other steps, measures, and solutions in the various operations, methods, and processes that have been discussed in this application can also be alternated, changed, rearranged, decomposed, combined, or deleted. Furthermore, the steps, measures, and solutions in the prior art with various operations, methods, and processes disclosed in this application can also be replaced, changed, rearranged, decomposed, combined, or deleted.
以上所述仅是本申请的部分实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本申请原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本申请的保护范围。 The above are only some of the embodiments of the present application. It should be pointed out that those of ordinary skill in the technical field can also make several improvements and modifications without departing from the principles of the present application. These improvements and modifications can also be made. should be regarded as the scope of protection of this application.

Claims (20)

  1. 一种智能合约部署方法,其中,包括:A smart contract deployment method, including:
    基于预设的区块链集成开发环境,生成待部署的第一智能合约;Based on the preset blockchain integrated development environment, generate the first smart contract to be deployed;
    生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;Generate a target container that runs the first smart contract, and deploy the first smart contract to the target container;
    根据预设的节点证书签发所述目标容器的身份证书;Issue the identity certificate of the target container according to the preset node certificate;
    调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;Call the preset container orchestrator to connect the target container to the main chain network for identity verification;
    当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。When the identity verification of the target container passes, the first smart contract is diffused in the main chain network.
  2. 根据权利要求1所述的智能合约部署方法,其中,所述生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中包括:The smart contract deployment method according to claim 1, wherein generating a target container for running the first smart contract and deploying the first smart contract to the target container includes:
    对所述第一智能合约进行编译,生成所述第一智能合约的编译文件;Compile the first smart contract and generate a compiled file of the first smart contract;
    根据所述编译文件生成所述第一智能合约的镜像文件;Generate an image file of the first smart contract according to the compiled file;
    根据所述镜像文件启动所述目标容器,并将所述镜像文件部署到所述目标容器中。Start the target container according to the image file, and deploy the image file to the target container.
  3. 根据权利要求1所述的智能合约部署方法,其中,所述根据预设的节点证书签发所述目标容器的身份证书包括:The smart contract deployment method according to claim 1, wherein the issuance of the identity certificate of the target container according to the preset node certificate includes:
    读取预存储的节点证书和所述目标容器发送的证书请求;Read the pre-stored node certificate and the certificate request sent by the target container;
    根据所述证书请求生成所述节点证书的子证书,并将所述子证书作为所述身份证书颁发给所述目标容器。Generate a subcertificate of the node certificate according to the certificate request, and issue the subcertificate to the target container as the identity certificate.
  4. 根据权利要求1所述的智能合约部署方法,其中,所述调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证包括:The smart contract deployment method according to claim 1, wherein said calling a preset container orchestrator to connect the target container to the main chain network and performing identity verification includes:
    调用所述容器编排器为所述目标容器分配上链接口;Call the container orchestrator to allocate an uplink port to the target container;
    根据所述上链接口将所述目标容器连接到主链网络;Connect the target container to the main chain network according to the uplink interface;
    向所述主链网络发生所述身份证书,以使所述主链网络根据所述身份证书对所述目标容器的身份信息进行验证。The identity certificate is sent to the main chain network, so that the main chain network verifies the identity information of the target container according to the identity certificate.
  5. 根据权利要求1所述的智能合约部署方法,其中,所述当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散之后,包括:The smart contract deployment method according to claim 1, wherein after the identity verification of the target container is passed, after the first smart contract is diffused in the main chain network, the method includes:
    所述目标容器接收所述主链网络中待验证的第二智能合约;The target container receives the second smart contract to be verified in the main chain network;
    根据所述第二智能合约启动设置的验证容器,其中,所述验证容器用于运行所述第二智能合约;Start a verification container configured according to the second smart contract, wherein the verification container is used to run the second smart contract;
    所述目标容器将所述第二智能合约发送至所述验证容器中进行验证。The target container sends the second smart contract to the verification container for verification.
  6. 根据权利要求5所述的智能合约部署方法,其中,所述目标容器将所述第二智能合约发送至所述验证容器中进行验证包括:The smart contract deployment method according to claim 5, wherein the target container sending the second smart contract to the verification container for verification includes:
    读取所述目标容器的目标存储地址;Read the target storage address of the target container;
    根据所述目标存储地址构建所述验证容器的验证存储地址,并使所述目标存储地址和验证存储地址相互重叠;Construct the verification storage address of the verification container according to the target storage address, and make the target storage address and the verification storage address overlap with each other;
    所述目标容器将所述第二智能合约存储在所述目标存储地址中;The target container stores the second smart contract in the target storage address;
    所述验证容器读取所述验证存储地址中的第二智能合约,并对所述第二智 能合约进行验证。The verification container reads the second smart contract in the verification storage address and verifies the second smart contract. The contract can be verified.
  7. 根据权利要求5所述的智能合约部署方法,其中,所述目标容器将所述第二智能合约发送至所述验证容器中进行验证之后,包括:The smart contract deployment method according to claim 5, wherein after the target container sends the second smart contract to the verification container for verification, it includes:
    当所述第二智能合约验证完成后,释放所述验证容器,并向所述容器编排器发送释放消息和验证日志;When the second smart contract verification is completed, release the verification container and send a release message and verification log to the container orchestrator;
    所述容器编排器根据所述释放信息,向所述目标容器发送所述验证日志;The container orchestrator sends the verification log to the target container according to the release information;
    所述目标容器将所述验证日志发送至所述主链网络。The target container sends the verification log to the main chain network.
  8. 根据权利要求1所述的智能合约部署方法,其中,所述当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散之后,包括:The smart contract deployment method according to claim 1, wherein after the identity verification of the target container is passed, after the first smart contract is diffused in the main chain network, the method includes:
    获取所述第一智能合约的调试接口,以及所述第一智能合约可视化的调试图标;Obtain the debugging interface of the first smart contract and the visual debugging icon of the first smart contract;
    根据所述调试图标和所述调试接口,在所述区块链集成开发环境中调用所述第一智能合约进行测试运行。According to the debugging icon and the debugging interface, the first smart contract is called in the blockchain integrated development environment for test operation.
  9. 一种智能合约部署装置,其中,包括:A smart contract deployment device, including:
    生成模块,用于基于预设的区块链集成开发环境,生成待部署的第一智能合约;The generation module is used to generate the first smart contract to be deployed based on the preset blockchain integrated development environment;
    部署模块,用于生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;A deployment module, configured to generate a target container for running the first smart contract, and deploy the first smart contract into the target container;
    签发模块,用于根据预设的节点证书签发所述目标容器的身份证书;An issuance module, used to issue the identity certificate of the target container according to the preset node certificate;
    处理模块,用于调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;The processing module is used to call the preset container orchestrator to connect the target container to the main chain network for identity verification;
    执行模块,用于当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。An execution module, configured to diffuse the first smart contract in the main chain network after the identity verification of the target container passes.
  10. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行如下步骤:A computer device includes a memory and a processor. Computer-readable instructions are stored in the memory. When the computer-readable instructions are executed by the processor, they cause the processor to perform the following steps:
    基于预设的区块链集成开发环境,生成待部署的第一智能合约;Based on the preset blockchain integrated development environment, generate the first smart contract to be deployed;
    生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;Generate a target container that runs the first smart contract, and deploy the first smart contract into the target container;
    根据预设的节点证书签发所述目标容器的身份证书;Issue the identity certificate of the target container according to the preset node certificate;
    调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;Call the preset container orchestrator to connect the target container to the main chain network for identity verification;
    当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。When the identity verification of the target container passes, the first smart contract is diffused in the main chain network.
  11. 根据权利要求10所述的计算机设备,其中,所述处理器还执行如下步骤:The computer device of claim 10, wherein the processor further performs the following steps:
    所述生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中包括:Generating a target container for running the first smart contract and deploying the first smart contract to the target container includes:
    对所述第一智能合约进行编译,生成所述第一智能合约的编译文件;Compile the first smart contract and generate a compiled file of the first smart contract;
    根据所述编译文件生成所述第一智能合约的镜像文件; Generate an image file of the first smart contract according to the compiled file;
    根据所述镜像文件启动所述目标容器,并将所述镜像文件部署到所述目标容器中。Start the target container according to the image file, and deploy the image file to the target container.
  12. 根据权利要求10所述的计算机设备,其中,所述处理器还执行如下步骤:The computer device of claim 10, wherein the processor further performs the following steps:
    所述根据预设的节点证书签发所述目标容器的身份证书包括:The issuance of the identity certificate of the target container according to the preset node certificate includes:
    读取预存储的节点证书和所述目标容器发送的证书请求;Read the pre-stored node certificate and the certificate request sent by the target container;
    根据所述证书请求生成所述节点证书的子证书,并将所述子证书作为所述身份证书颁发给所述目标容器。Generate a subcertificate of the node certificate according to the certificate request, and issue the subcertificate to the target container as the identity certificate.
  13. 根据权利要求10所述的计算机设备,其中,所述处理器还执行如下步骤:The computer device of claim 10, wherein the processor further performs the following steps:
    所述调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证包括:The calling of the preset container orchestrator to connect the target container to the main chain network and identity verification include:
    调用所述容器编排器为所述目标容器分配上链接口;Call the container orchestrator to allocate an uplink port to the target container;
    根据所述上链接口将所述目标容器连接到主链网络;Connect the target container to the main chain network according to the uplink interface;
    向所述主链网络发生所述身份证书,以使所述主链网络根据所述身份证书对所述目标容器的身份信息进行验证。The identity certificate is sent to the main chain network, so that the main chain network verifies the identity information of the target container according to the identity certificate.
  14. 根据权利要求10所述的计算机设备,其中,所述处理器还执行如下步骤:The computer device of claim 10, wherein the processor further performs the following steps:
    所述当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散之后,包括:After the identity verification of the target container passes, the first smart contract is diffused in the main chain network, including:
    所述目标容器接收所述主链网络中待验证的第二智能合约;The target container receives the second smart contract to be verified in the main chain network;
    根据所述第二智能合约启动设置的验证容器,其中,所述验证容器用于运行所述第二智能合约;Start a verification container configured according to the second smart contract, wherein the verification container is used to run the second smart contract;
    所述目标容器将所述第二智能合约发送至所述验证容器中进行验证。The target container sends the second smart contract to the verification container for verification.
  15. 根据权利要求14所述的计算机设备,其中,所述处理器还执行如下步骤:The computer device of claim 14, wherein the processor further performs the following steps:
    所述目标容器将所述第二智能合约发送至所述验证容器中进行验证包括:The target container sends the second smart contract to the verification container for verification including:
    读取所述目标容器的目标存储地址;Read the target storage address of the target container;
    根据所述目标存储地址构建所述验证容器的验证存储地址,并使所述目标存储地址和验证存储地址相互重叠;Construct the verification storage address of the verification container according to the target storage address, and make the target storage address and the verification storage address overlap with each other;
    所述目标容器将所述第二智能合约存储在所述目标存储地址中;The target container stores the second smart contract in the target storage address;
    所述验证容器读取所述验证存储地址中的第二智能合约,并对所述第二智能合约进行验证。The verification container reads the second smart contract in the verification storage address and verifies the second smart contract.
  16. 根据权利要求14所述的计算机设备,其中,所述处理器还执行如下步骤:The computer device of claim 14, wherein the processor further performs the following steps:
    所述目标容器将所述第二智能合约发送至所述验证容器中进行验证之后,包括:After the target container sends the second smart contract to the verification container for verification, it includes:
    当所述第二智能合约验证完成后,释放所述验证容器,并向所述容器编排器发送释放消息和验证日志;When the second smart contract verification is completed, release the verification container and send a release message and verification log to the container orchestrator;
    所述容器编排器根据所述释放信息,向所述目标容器发送所述验证日志; The container orchestrator sends the verification log to the target container according to the release information;
    所述目标容器将所述验证日志发送至所述主链网络。The target container sends the verification log to the main chain network.
  17. 根据权利要求10所述的计算机设备,其中,所述处理器还执行如下步骤:The computer device of claim 10, wherein the processor further performs the following steps:
    所述当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散之后,包括:After the identity verification of the target container passes, the first smart contract is diffused in the main chain network, including:
    获取所述第一智能合约的调试接口,以及所述第一智能合约可视化的调试图标;Obtain the debugging interface of the first smart contract and the visual debugging icon of the first smart contract;
    根据所述调试图标和所述调试接口,在所述区块链集成开发环境中调用所述第一智能合约进行测试运行。According to the debugging icon and the debugging interface, the first smart contract is called in the blockchain integrated development environment for test operation.
  18. 一种存储有计算机可读指令的存储介质,所述计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行如下步骤:A storage medium storing computer-readable instructions that, when executed by one or more processors, causes one or more processors to perform the following steps:
    基于预设的区块链集成开发环境,生成待部署的第一智能合约;Based on the preset blockchain integrated development environment, generate the first smart contract to be deployed;
    生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中;Generate a target container that runs the first smart contract, and deploy the first smart contract into the target container;
    根据预设的节点证书签发所述目标容器的身份证书;Issue the identity certificate of the target container according to the preset node certificate;
    调用预设的容器编排器将所述目标容器接入到主链网络中,进行身份验证;Call the preset container orchestrator to connect the target container to the main chain network for identity verification;
    当所述目标容器的身份验证通过后,将所述第一智能合约在所述主链网络中进行扩散。When the identity verification of the target container passes, the first smart contract is diffused in the main chain network.
  19. 根据权利要求18所述的存储介质,其中,所述一个或多个处理器还被配置执行如下步骤:The storage medium of claim 18, wherein the one or more processors are further configured to perform the following steps:
    所述生成运行所述第一智能合约的目标容器,并将所述第一智能合约部署到所述目标容器中包括:Generating a target container for running the first smart contract and deploying the first smart contract to the target container includes:
    对所述第一智能合约进行编译,生成所述第一智能合约的编译文件;Compile the first smart contract and generate a compiled file of the first smart contract;
    根据所述编译文件生成所述第一智能合约的镜像文件;Generate an image file of the first smart contract according to the compiled file;
    根据所述镜像文件启动所述目标容器,并将所述镜像文件部署到所述目标容器中。Start the target container according to the image file, and deploy the image file to the target container.
  20. 根据权利要求18所述的存储介质,其中,所述一个或多个处理器还被配置执行如下步骤:The storage medium of claim 18, wherein the one or more processors are further configured to perform the following steps:
    所述根据预设的节点证书签发所述目标容器的身份证书包括:The issuance of the identity certificate of the target container according to the preset node certificate includes:
    读取预存储的节点证书和所述目标容器发送的证书请求;Read the pre-stored node certificate and the certificate request sent by the target container;
    根据所述证书请求生成所述节点证书的子证书,并将所述子证书作为所述身份证书颁发给所述目标容器。 Generate a subcertificate of the node certificate according to the certificate request, and issue the subcertificate to the target container as the identity certificate.
PCT/CN2023/103599 2022-07-21 2023-06-29 Smart contract deployment method and apparatus, device, medium, and product WO2024016984A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210862683.6 2022-07-21
CN202210862683.6A CN115203330B (en) 2022-07-21 2022-07-21 Intelligent contract deployment method and device, equipment, medium and product thereof

Publications (1)

Publication Number Publication Date
WO2024016984A1 true WO2024016984A1 (en) 2024-01-25

Family

ID=83583280

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/103599 WO2024016984A1 (en) 2022-07-21 2023-06-29 Smart contract deployment method and apparatus, device, medium, and product

Country Status (2)

Country Link
CN (1) CN115203330B (en)
WO (1) WO2024016984A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115203330B (en) * 2022-07-21 2024-01-19 深圳前海环融联易信息科技服务有限公司 Intelligent contract deployment method and device, equipment, medium and product thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111355718A (en) * 2020-02-25 2020-06-30 中国工商银行股份有限公司 Block chain intelligent contract cloud deployment system and method
CN114157444A (en) * 2021-09-10 2022-03-08 北京天德科技有限公司 Block chain deployment system and deployment method based on container technology
US20220222096A1 (en) * 2021-01-08 2022-07-14 Pivotal Software, Inc. Container certificate injection
CN115203330A (en) * 2022-07-21 2022-10-18 深圳前海环融联易信息科技服务有限公司 Intelligent contract deployment method and device, equipment, medium and product thereof

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107819749A (en) * 2017-10-26 2018-03-20 平安科技(深圳)有限公司 Block catenary system and transaction data processing method based on ether mill
CN111327648B (en) * 2018-12-13 2022-04-12 北京果仁宝软件技术有限责任公司 Processing method and system based on block chain intelligent contract
US20210149880A1 (en) * 2019-11-20 2021-05-20 Insolar Technologies GmbH Systems and methods for extendable smart contracts in distributed ledger technology
CN111130841B (en) * 2019-11-21 2022-07-08 深圳壹账通智能科技有限公司 Block chain network deployment method, electronic device and computer-readable storage medium
CN112818368A (en) * 2021-02-09 2021-05-18 南京邮电大学 Digital certificate authentication method based on block chain intelligent contract
CN112596754B (en) * 2021-03-01 2021-07-02 腾讯科技(深圳)有限公司 Block chain intelligent contract deployment method and device
CN113609219A (en) * 2021-07-21 2021-11-05 微易签(杭州)科技有限公司 Method, system, device and storage medium for verifying file based on block chain

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111355718A (en) * 2020-02-25 2020-06-30 中国工商银行股份有限公司 Block chain intelligent contract cloud deployment system and method
US20220222096A1 (en) * 2021-01-08 2022-07-14 Pivotal Software, Inc. Container certificate injection
CN114157444A (en) * 2021-09-10 2022-03-08 北京天德科技有限公司 Block chain deployment system and deployment method based on container technology
CN115203330A (en) * 2022-07-21 2022-10-18 深圳前海环融联易信息科技服务有限公司 Intelligent contract deployment method and device, equipment, medium and product thereof

Also Published As

Publication number Publication date
CN115203330B (en) 2024-01-19
CN115203330A (en) 2022-10-18

Similar Documents

Publication Publication Date Title
CN110297689B (en) Intelligent contract execution method, device, equipment and medium
CN112104709B (en) Intelligent contract processing method, device, medium and electronic equipment
CN109002297B (en) Deployment method, device, equipment and storage medium of consensus mechanism
WO2024016984A1 (en) Smart contract deployment method and apparatus, device, medium, and product
CN109981279B (en) Block chain system, communication method, device, equipment and medium
CN112714158B (en) Transaction processing method, relay network, cross-link gateway, system, medium and equipment
CN102830992A (en) Plug-in loading method and system
CN110995825B (en) Intelligent contract issuing method, intelligent node equipment and storage medium
CN113766042B (en) Container address configuration method, system, device, equipment and medium
CN113467972A (en) Communication interface construction method, communication interface construction device, computer equipment and storage medium
CN110868324A (en) Service configuration method, device, equipment and storage medium
CN113360217A (en) Rule engine SDK calling method and device and storage medium
CN111400162B (en) Test method and test system
CN113849196A (en) Product management method based on multi-cloud management platform and related components
CN114489850B (en) Calling method and device of design software, computer equipment and storage medium
CN110008186A (en) For file management method, device, terminal and the medium of more ftp data sources
CN115248680A (en) Software construction method, system, device, medium, and program product
CN111782420B (en) Information processing method, device, equipment and medium based on Java Web framework
CN109766228A (en) Verification method and device on a kind of line based on interface
CN116467156A (en) Joint debugging test method and device, storage medium and electronic equipment
CN115098301A (en) Snapshot generation method and system for stateful application in cloud native scene
US12039473B2 (en) Software development project infrastructure builder tool
CN113938411B (en) Java-based API gateway login authentication test method
CN112968930B (en) Intelligent contract of block chain key value pair and design method thereof
WO2023159900A1 (en) Remote development method and device

Legal Events

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

Ref document number: 23842049

Country of ref document: EP

Kind code of ref document: A1