Disclosure of Invention
The embodiment of the invention provides a block chain-based application program authorization use method, device and storage medium, so that when the application program runs, the application program can be run according to an authorization scheme corresponding to the application program, and the application program can be effectively activated before running, so that the application program can run normally.
In a first aspect, an embodiment of the present invention provides an application authorization use method based on a block chain, including:
after a participating node in a blockchain network downloads an application program through the blockchain network, starting a virtual machine by a local client of the participating node, and sending a blockchain identifier of the participating node to the virtual machine, wherein the virtual machine is used for running the application program;
when the virtual machine determines that the block chain network does not have an authorization scheme corresponding to the application program according to the identification information of the application program, the local client receives encrypted information sent by the virtual machine, wherein the encrypted information is obtained by encrypting an authorization identification code by the virtual machine by using a public key of the participating node, and the authorization identification code is generated by the virtual machine;
the local client decrypts the encrypted information according to the private key of the participating node to obtain the authorization identification code;
the local client broadcasts a first message in the blockchain network, wherein the first message comprises the authorization identification code, an authorization scheme selected by a user of the participating node, a blockchain identification of the participating node and transaction amount information;
when the virtual machine determines that the first message is recorded in a blockchain ledger by a first accounting node in the blockchain network, and an authorized identification code recorded in the blockchain ledger is the same as an authorized identification code generated by the virtual machine, the local client receives a notification message sent by the virtual machine, wherein the notification message is used for notifying the local client to broadcast a second message in the blockchain network, the second message comprises the blockchain identification of the participating node and an authorization scheme for the operation of the virtual machine, and the authorization scheme for the operation of the virtual machine is an authorization scheme selected by a user of the participating node.
In a second aspect, an embodiment of the present invention provides a method for authorized use of an application based on a block chain, including:
after a participating node in a blockchain network downloads an application program through the blockchain network, a local client of the participating node starts a virtual machine, and the virtual machine receives a blockchain identifier of the participating node sent by the local client;
after the virtual machine starts the application program, inquiring an authorization scheme corresponding to the application program in the block chain network according to the identification information of the application program;
when the virtual machine determines that the block chain network does not have the authorization scheme corresponding to the application program, the virtual machine generates an authorization identification code, and encrypts the authorization identification code by adopting the public key of the participating node to obtain encrypted information;
the virtual machine sends the encrypted information to the local client so that the local client decrypts the encrypted information according to the private key of the participating node to obtain the authorized identification code, and broadcasts a first message in the blockchain network, wherein the first message comprises the authorized identification code, an authorization scheme selected by a user of the participating node, a blockchain identifier of the participating node and transaction amount information;
when the virtual machine determines that the first message is recorded into a blockchain ledger by a first accounting node in the blockchain network, and the authorized identification code recorded in the blockchain ledger is the same as the authorized identification code generated by the virtual machine, the virtual machine sends a notification message to the local client, wherein the notification message is used for notifying the local client to broadcast a second message in the blockchain network, the second message comprises the blockchain identification of the participating node and an authorization scheme for the operation of the virtual machine, and the authorization scheme for the operation of the virtual machine is an authorization scheme selected by a user of the participating node.
In a third aspect, an embodiment of the present invention provides a local client participating in a node, including:
the starting module is used for starting the virtual machine after the participating nodes in the block chain network download the application program through the block chain network;
a sending module, configured to send the blockchain identifier of the participating node to the virtual machine, where the virtual machine is configured to run the application program;
a receiving module, configured to receive, when the virtual machine determines that there is no authorization scheme corresponding to the application program in the blockchain network according to the identification information of the application program, encryption information sent by the virtual machine, where the encryption information is obtained by encrypting, by the virtual machine, an authorization identifier code by using a public key of the participating node, and the authorization identifier code is generated by the virtual machine;
the decryption module is used for decrypting the encrypted information according to the private key of the participating node to obtain the authorized identification code;
the sending module is further configured to broadcast a first message in the blockchain network, where the first message includes the authorization identification code, the authorization scheme selected by the user of the participating node, the blockchain identification of the participating node, and transaction amount information;
the receiving module is further configured to: when the virtual machine determines that the first message is recorded into a blockchain ledger by a first accounting node in the blockchain network, and an authorized identification code recorded in the blockchain ledger is the same as an authorized identification code generated by the virtual machine, receiving a notification message sent by the virtual machine, wherein the notification message is used for notifying the local client to broadcast a second message in the blockchain network, the second message comprises the blockchain identification of the participating node and an authorization scheme for the operation of the virtual machine, and the authorization scheme for the operation of the virtual machine is an authorization scheme selected by a user of the participating node.
In a fourth aspect, an embodiment of the present invention provides a virtual machine participating in a node, including:
the receiving module is used for receiving the blockchain identifier of the participating node sent by a local client after the participating node in the blockchain network downloads an application program through the blockchain network and the local client of the participating node starts a virtual machine;
the starting module is used for starting the application program;
the query module is used for querying an authorization scheme corresponding to the application program in the block chain network according to the identification information of the application program after the application program is started by the starting module;
the generation module is used for generating an authorization identification code when the block chain network does not have the authorization scheme corresponding to the application program;
the encryption module is used for encrypting the authorization identification code by adopting the public key of the participating node to obtain encrypted information;
a sending module, configured to send the encrypted information to the local client, so that the local client decrypts the encrypted information according to a private key of the participating node to obtain the authorized identification code, and broadcasts a first message in the blockchain network, where the first message includes the authorized identification code, an authorization scheme selected by a user of the participating node, a blockchain identifier of the participating node, and transaction amount information;
the sending module is further configured to: when the virtual machine determines that the first message is recorded into a blockchain ledger by a first accounting node in the blockchain network, and an authorization identification code recorded in the blockchain ledger is the same as an authorization identification code generated by the virtual machine, sending a notification message to the local client, wherein the notification message is used for notifying the local client to broadcast a second message in the blockchain network, the second message comprises the blockchain identification of the participating node and an authorization scheme for the operation of the virtual machine, and the authorization scheme for the operation of the virtual machine is an authorization scheme selected by a user of the participating node.
In a fifth aspect, the present invention provides a computer-readable storage medium, on which a computer program is stored, the computer program being executed by a processor to implement the method of the first aspect or the second aspect.
According to the method, the device and the storage medium for authorized use of the application program based on the blockchain, provided by the embodiment of the invention, after the application program is downloaded through the participating node, the authorization scheme of the application program is inquired according to the identification information of the application program, when the authorization scheme of the application program exists in the blockchain network, the application program is operated according to the authorization scheme of the application program, and when the authorization scheme of the application program does not exist in the blockchain network, the authorization scheme of the application program is selected by a user through the local client of the participating node. Therefore, when the application program runs, the application program can be run according to the authorization scheme corresponding to the application program, so that the application program can be effectively activated before running, and the application program can run normally.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The block chain-based application program authorization use method provided by the embodiment of the invention can be applied to the communication system shown in fig. 1. As shown in fig. 1, the communication system includes: node A, a billing node P, a billing node Q and a participating node, wherein node A, billing node P, billing node Q and participating node are nodes in a blockchain network. It is understood that the description is only illustrative and does not limit the number and types of nodes in the blockchain network. The accounting node can be one or a plurality of cloud servers, the cloud servers are a server cluster, a plurality of servers are arranged, the server cluster is similar to a universal computer framework, and the cloud servers comprise processors, hard disks, memories, system buses and the like. The participating node may specifically be a user terminal, e.g. a smartphone, a tablet, a personal computer, etc. In addition, in the embodiment of the present application, the blockchain network is a decentralized peer-to-peer (P2P) communication network.
The block chain-based application program authorization use method provided by the embodiment of the invention aims to solve the technical problems in the prior art.
The following describes the technical solutions of the present invention and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present invention will be described below with reference to the accompanying drawings.
Fig. 2 is a flowchart of an application authorization using method based on a block chain according to an embodiment of the present invention. The embodiment of the invention provides a block chain-based application program authorization use method aiming at the technical problems in the prior art, and the method comprises the following specific steps:
step 201, after a participating node in a blockchain network downloads an application program through the blockchain network, a local client of the participating node starts a virtual machine and sends a blockchain identifier of the participating node to the virtual machine, where the virtual machine is used to run the application program.
As shown in fig. 1, node a may specifically be a server of a developer of an application, and node a may publish the application in the blockchain network. Specifically, the node a may sign the executable code of the application program or the download address information of the executable code of the application program by using the private key of the node a, so as to obtain signed information. Further, node a broadcasts the signed message in the blockchain network so that other nodes in the blockchain network can receive the signed message. In addition, while the node a issues the executable code of the application program or the download address information of the executable code of the application program, the node a may also issue an authorization scheme corresponding to the application program, where the authorization scheme may specifically be a price per use of the application program, or the authorization scheme may specifically be a price corresponding to a lifetime of the application program and the lifetime, or the authorization scheme may specifically be a price at which the application program is permanently used. It is to be understood that the authorization scheme corresponding to the application program is not limited thereto, and is only schematically illustrated here.
When the accounting node receives the signed information issued by the node a in the blockchain network, the accounting node verifies the private key signature of the node a according to the public key of the node a, after the private key signature of the node a passes the verification, the accounting node may record the broadcast message of the node a in the blockchain network in a new block, and when the new block is recorded in the blockchain account book, the broadcast message is also recorded in the blockchain account book along with the new block. The broadcast message of the node a in the blockchain network may include executable code of an application program issued by the node a or download address information of the executable code of the application program. Or, the broadcast message of the node a in the blockchain network may include executable code of an application program issued by the node a or download address information of the executable code of the application program, and an authorization scheme corresponding to the application program.
The participating node shown in fig. 1 may be any one of the participating nodes in the blockchain network, and the participating node may download the application program distributed by the node a through the blockchain network. For example, the participating node may download the application's executable code directly from the blockchain ledger. Or, the participating node may obtain the download address information of the executable code from the blockchain ledger, and further download the executable code of the application program according to the download address information.
After the participating node downloads the executable code of the application program, the local client of the participating node starts a virtual environment to start running the executable code of the application program. In particular, the virtual environment may specifically be a virtual machine, which may be used to run executable code of the application. When the blockchain account book includes the authorization scheme corresponding to the application program, the virtual machine may download the authorization scheme corresponding to the application program from the blockchain account book, and run the application program according to the authorization scheme. In addition, when the local client of the participating node starts the virtual environment, the blockchain identifier of the participating node can be sent to the virtual machine. In this embodiment, each node in the blockchain network may correspond to a unique blockchain identifier.
Step 202, when the virtual machine determines that there is no authorization scheme corresponding to the application program in the blockchain network according to the identification information of the application program, the local client receives encrypted information sent by the virtual machine, where the encrypted information is obtained by encrypting an authorization identification code by the virtual machine using the public key of the participating node, and the authorization identification code is generated by the virtual machine.
After the application program is started, the virtual machine may query whether an authorization scheme corresponding to the application program exists in the blockchain network according to the identification information of the application program, and if the authorization scheme corresponding to the application program exists in the blockchain network, for example, the authorization scheme corresponding to the application program is recorded in the blockchain ledger, the virtual machine runs the application program according to the authorization scheme. If the authorization scheme corresponding to the application does not exist in the blockchain network, for example, the blockchain ledger does not have the authorization scheme corresponding to the application, the virtual machine may generate an authorization identifier according to the blockchain identifier of the participating node and according to a pre-agreed algorithm. Further, the virtual machine encrypts the authorization identification code by using the public key of the participating node to obtain encrypted information, and sends the encrypted information to the local client of the participating node.
And 203, the local client decrypts the encrypted information according to the private key of the participating node to obtain the authorization identification code.
And after the local client of the participating node receives the encrypted information, decrypting the encrypted information by using the private key of the participating node to obtain the authorization identification code.
Step 204, the local client broadcasts a first message in the blockchain network, where the first message includes the authorization identification code, the authorization scheme selected by the user of the participating node, the blockchain identification of the participating node, and the transaction amount information.
Further, the local client may broadcast a first message in the blockchain network, the first message may include the authorization identification code, the authorization scheme selected by the user of the participating node, the blockchain identification of the participating node, and transaction amount information. Wherein the local client may display a plurality of selectable authorization schemes for the application, the user of the participating node selecting the authorization scheme on the local client for eventual execution of the application.
Optionally, the broadcasting, by the local client, the first message in the blockchain network includes: and the local client signs the first message by adopting the private key of the participating node and broadcasts the signed first message in the block chain network.
Step 205, when the virtual machine determines that the first message is recorded in a blockchain ledger by a first accounting node in the blockchain network, and the authorized identification code recorded in the blockchain ledger is the same as the authorized identification code generated by the virtual machine, the local client receives a notification message sent by the virtual machine, where the notification message is used to notify the local client to broadcast a second message in the blockchain network, and the second message includes the blockchain identification of the participating node and an authorization scheme for the virtual machine to operate, where the authorization scheme for the virtual machine to operate is an authorization scheme selected by a user of the participating node.
After the local ue broadcasts the first message in the blockchain network, a first accounting node, e.g., accounting node P, in the blockchain network may record the first message in a new block, and further record the first message in a blockchain account book. The virtual machine may detect in real-time whether an authorization scheme selected by the user identified by the blockchain identification of the participating node is recorded in a blockchain ledger. If the virtual machine determines that the authorization scheme selected by the user and identified by the blockchain identifier of the participating node is recorded in the blockchain account book by the accounting node P, and the authorization identifier recorded in the blockchain account book is the same as the authorization identifier generated by the virtual machine, the virtual machine may determine that the user identity of the participating node is real, and run the application program according to the authorization scheme selected by the user and identified by the participating node. At the same time, the virtual machine may also send a notification message to the local client of the participating node, which may notify the local client to broadcast a second message in the blockchain network. Specifically, the notification message may be configured to notify the local client to sign the second message by using the private key of the participating node, so as to obtain a signed second message, and further broadcast the signed second message in the blockchain network. Wherein the second message may include the blockchain identification of the participating node and an authorization scheme for the virtual machine to run, wherein the authorization scheme for the virtual machine to run is an authorization scheme selected by a user of the participating node.
Further, the accounting node as shown in fig. 1 may further determine whether the transaction amount information in the first message matches the authorization scheme for the virtual machine operation in the second message, and if so, the accounting node may also record the second message into the blockchain ledger, e.g., the accounting node may notify the second accounting node, e.g., accounting node Q, to record the second message into the blockchain ledger. When the second message is recorded in the blockchain ledger, it indicates that the operation of the application is approved by the blockchain network, otherwise the second message is not recorded in the blockchain ledger.
After the node a receives the amount paid by the participating node for running the application, the node a may send a part of the amount in a preset proportion to the accounting node P and the accounting node Q as an accounting reward, so as to stimulate the verification workload of the accounting node P and the accounting node Q in the process of issuing the application.
After downloading the application program through the participating node, the embodiment of the invention inquires the authorization scheme of the application program according to the identification information of the application program, when the authorization scheme of the application program exists in the blockchain network, the application program is operated according to the authorization scheme of the application program, and when the authorization scheme of the application program does not exist in the blockchain network, the authorization scheme of the application program is selected by a user through the local client of the participating node. Therefore, when the application program runs, the application program can be run according to the authorization scheme corresponding to the application program, so that the application program can be effectively activated before running, and the application program can run normally.
Fig. 3 is a flowchart of a method for authorized use of an application based on a blockchain according to another embodiment of the present invention. The method for authorized use of an application based on a block chain provided by this embodiment specifically includes the following steps:
step 301, after a participating node in a blockchain network downloads an application program through the blockchain network, a local client of the participating node starts a virtual machine, and the virtual machine receives a blockchain identifier of the participating node sent by the local client.
As shown in fig. 1, node a may specifically be a server of a developer of an application, and node a may publish the application in the blockchain network. Specifically, the node a may sign the executable code of the application program or the download address information of the executable code of the application program by using the private key of the node a, so as to obtain signed information. Further, node a broadcasts the signed message in the blockchain network so that other nodes in the blockchain network can receive the signed message. In addition, while the node a issues the executable code of the application program or the download address information of the executable code of the application program, the node a may also issue an authorization scheme corresponding to the application program, where the authorization scheme may specifically be a price per use of the application program, or the authorization scheme may specifically be a price corresponding to a lifetime of the application program and the lifetime, or the authorization scheme may specifically be a price at which the application program is permanently used. It is to be understood that the authorization scheme corresponding to the application program is not limited thereto, and is only schematically illustrated here.
When the accounting node receives the signed information issued by the node a in the blockchain network, the accounting node verifies the private key signature of the node a according to the public key of the node a, after the private key signature of the node a passes the verification, the accounting node may record the broadcast message of the node a in the blockchain network in a new block, and when the new block is recorded in the blockchain account book, the broadcast message is also recorded in the blockchain account book along with the new block. The broadcast message of the node a in the blockchain network may include executable code of an application program issued by the node a or download address information of the executable code of the application program. Or, the broadcast message of the node a in the blockchain network may include executable code of an application program issued by the node a or download address information of the executable code of the application program, and an authorization scheme corresponding to the application program.
The participating node shown in fig. 1 may be any one of the participating nodes in the blockchain network, and the participating node may download the application program distributed by the node a through the blockchain network. For example, the participating node may download the application's executable code directly from the blockchain ledger. Or, the participating node may obtain the download address information of the executable code from the blockchain ledger, and further download the executable code of the application program according to the download address information.
After the participating node downloads the executable code of the application program, the local client of the participating node starts a virtual environment to start running the executable code of the application program. In particular, the virtual environment may specifically be a virtual machine, which may be used to run executable code of the application. When the blockchain account book includes the authorization scheme corresponding to the application program, the virtual machine may download the authorization scheme corresponding to the application program from the blockchain account book, and run the application program according to the authorization scheme. In addition, when the local client of the participating node starts the virtual environment, the blockchain identifier of the participating node can be sent to the virtual machine. In this embodiment, each node in the blockchain network may correspond to a unique blockchain identifier.
Step 302, after the virtual machine starts the application program, querying an authorization scheme corresponding to the application program in the block chain network according to the identification information of the application program.
After the application program is started, the virtual machine can query whether an authorization scheme corresponding to the application program exists in the blockchain network or not according to the identification information of the application program.
Step 303, when the virtual machine determines that the block chain network does not have the authorization scheme corresponding to the application program, the virtual machine generates an authorization identification code, and encrypts the authorization identification code by using the public key of the participating node to obtain encrypted information.
If an authorization scheme corresponding to the application program exists in the blockchain network, for example, the authorization scheme corresponding to the application program is recorded in the blockchain account book, the virtual machine runs the application program according to the authorization scheme. If the authorization scheme corresponding to the application does not exist in the blockchain network, for example, the blockchain ledger does not have the authorization scheme corresponding to the application, the virtual machine may generate an authorization identifier according to the blockchain identifier of the participating node and according to a pre-agreed algorithm. Further, the virtual machine encrypts the authorization identification code by using the public key of the participating node to obtain encrypted information.
Step 304, the virtual machine sends the encrypted information to the local client, so that the local client decrypts the encrypted information according to the private key of the participating node to obtain the authorized identification code, and broadcasts a first message in the blockchain network, where the first message includes the authorized identification code, an authorization scheme selected by a user of the participating node, a blockchain identifier of the participating node, and transaction amount information.
The virtual machine sends the encryption information to a local client of the participating node. And after the local client of the participating node receives the encrypted information, decrypting the encrypted information by using the private key of the participating node to obtain the authorization identification code. Further, the local client may broadcast a first message in the blockchain network, the first message may include the authorization identification code, the authorization scheme selected by the user of the participating node, the blockchain identification of the participating node, and transaction amount information.
Step 305, when the virtual machine determines that the first message is recorded into a blockchain ledger by a first accounting node in the blockchain network, and the authorization identification code recorded in the blockchain ledger is the same as the authorization identification code generated by the virtual machine, the virtual machine sends a notification message to the local client, wherein the notification message is used for notifying the local client to broadcast a second message in the blockchain network, the second message comprises the blockchain identification of the participating node and an authorization scheme for the operation of the virtual machine, and the authorization scheme for the operation of the virtual machine is an authorization scheme selected by a user of the participating node.
Optionally, the method further includes: when the virtual machine determines that the first message is recorded into a blockchain account book by a first accounting node in the blockchain network, and the authorized identification code recorded in the blockchain account book is the same as the authorized identification code generated by the virtual machine, the virtual machine determines that the user identity of the participating node is real, and runs the application program according to the authorization scheme selected by the user of the participating node.
After the local ue broadcasts the first message in the blockchain network, a first accounting node, e.g., accounting node P, in the blockchain network may record the first message in a new block, and further record the first message in a blockchain account book. The virtual machine may detect in real-time whether an authorization scheme selected by the user identified by the blockchain identification of the participating node is recorded in a blockchain ledger. If the virtual machine determines that the authorization scheme selected by the user and identified by the blockchain identifier of the participating node is recorded in the blockchain account book by the accounting node P, and the authorization identifier recorded in the blockchain account book is the same as the authorization identifier generated by the virtual machine, the virtual machine may determine that the user identity of the participating node is real, and run the application program according to the authorization scheme selected by the user and identified by the participating node. At the same time, the virtual machine may also send a notification message to the local client of the participating node, which may notify the local client to broadcast a second message in the blockchain network. Specifically, the notification message may be configured to notify the local client to sign the second message by using the private key of the participating node, so as to obtain a signed second message, and further broadcast the signed second message in the blockchain network. Wherein the second message may include the blockchain identification of the participating node and an authorization scheme for the virtual machine to run, wherein the authorization scheme for the virtual machine to run is an authorization scheme selected by a user of the participating node.
Optionally, the blockchain network further includes a second accounting node, where the second accounting node is configured to record the second message into a blockchain ledger when it is determined that the transaction amount information in the first message matches the authorization scheme for the virtual machine to operate in the second message.
Further, the accounting node as shown in fig. 1 may further determine whether the transaction amount information in the first message matches the authorization scheme for the virtual machine operation in the second message, and if so, the accounting node may also record the second message into the blockchain ledger, e.g., the accounting node may notify the second accounting node, e.g., accounting node Q, to record the second message into the blockchain ledger. When the second message is recorded in the blockchain ledger, it indicates that the operation of the application is approved by the blockchain network, otherwise the second message is not recorded in the blockchain ledger.
After the node a receives the amount paid by the participating node for running the application, the node a may send a part of the amount in a preset proportion to the accounting node P and the accounting node Q as an accounting reward, so as to stimulate the verification workload of the accounting node P and the accounting node Q in the process of issuing the application.
After downloading the application program through the participating node, the embodiment of the invention inquires the authorization scheme of the application program according to the identification information of the application program, when the authorization scheme of the application program exists in the blockchain network, the application program is operated according to the authorization scheme of the application program, and when the authorization scheme of the application program does not exist in the blockchain network, the authorization scheme of the application program is selected by a user through the local client of the participating node. Therefore, when the application program runs, the application program can be run according to the authorization scheme corresponding to the application program, so that the application program can be effectively activated before running, and the application program can run normally.
Fig. 4 is a schematic structural diagram of a local client of a participating node according to an embodiment of the present invention. The local client of the participating node provided in the embodiment of the present invention may execute the processing procedure provided in the embodiment of the block chain-based application authorization use method, as shown in fig. 4, the local client 40 of the participating node includes: a starting module 41, a sending module 42, a receiving module 43 and a decryption module 44; the starting module 41 is configured to start the virtual machine after the participating node in the blockchain network downloads the application program through the blockchain network; the sending module 42 is configured to send the blockchain identifier of the participating node to the virtual machine, where the virtual machine is configured to run the application program; the receiving module 43 is configured to receive, when the virtual machine determines, according to the identification information of the application program, that there is no authorization scheme corresponding to the application program in the blockchain network, encryption information sent by the virtual machine, where the encryption information is obtained by encrypting, by the virtual machine, an authorization identifier code by using a public key of the participating node, where the authorization identifier code is generated by the virtual machine; the decryption module 44 is configured to decrypt the encrypted information according to the private key of the participating node to obtain the authorized identification code; the sending module 42 is further configured to broadcast a first message in the blockchain network, where the first message includes the authorization identification code, the authorization scheme selected by the user of the participating node, the blockchain identification of the participating node, and the transaction amount information; the receiving module 43 is further configured to: when the virtual machine determines that the first message is recorded into a blockchain ledger by a first accounting node in the blockchain network, and an authorized identification code recorded in the blockchain ledger is the same as an authorized identification code generated by the virtual machine, receiving a notification message sent by the virtual machine, wherein the notification message is used for notifying the local client to broadcast a second message in the blockchain network, the second message comprises the blockchain identification of the participating node and an authorization scheme for the operation of the virtual machine, and the authorization scheme for the operation of the virtual machine is an authorization scheme selected by a user of the participating node.
Optionally, thelocal client 40 further includes: asignature module 45; thesignature module 45 is configured to sign the first message by using a private key of the participating node; when the sendingmodule 42 broadcasts the first message in the blockchain network, it is specifically configured to: broadcasting the signed first message in the blockchain network.
The local client of the participating node in the embodiment shown in fig. 4 may be configured to execute the technical solution of the above method embodiment, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 5 is a schematic structural diagram of a virtual machine of a participating node according to an embodiment of the present invention. The virtual machine of the participating node provided in the embodiment of the present invention may execute the processing flow provided in the embodiment of the block chain-based application authorization use method, as shown in fig. 5, the virtual machine 50 of the participating node includes: a receiving module 51, a starting module 52, an inquiring module 53, a generating module 54, an encrypting module 55 and a sending module 56; the receiving module 51 is configured to receive, after a participating node in a blockchain network downloads an application program through the blockchain network and a local client of the participating node starts a virtual machine, a blockchain identifier of the participating node sent by the local client; the starting module 52 is used for starting the application program; the query module 53 is configured to, after the start module starts the application program, query an authorization scheme corresponding to the application program in the blockchain network according to the identification information of the application program; the generating module 54 is configured to generate an authorization identifier code when there is no authorization scheme corresponding to the application program in the blockchain network; the encryption module 55 is configured to encrypt the authorization identifier with the public key of the participating node to obtain encrypted information; the sending module 56 is configured to send the encrypted information to the local client, so that the local client decrypts the encrypted information according to the private key of the participating node to obtain the authorized identification code, and broadcasts a first message in the blockchain network, where the first message includes the authorized identification code, an authorization scheme selected by a user of the participating node, a blockchain identifier of the participating node, and transaction amount information; the sending module 56 is further configured to: when the virtual machine determines that the first message is recorded into a blockchain ledger by a first accounting node in the blockchain network, and an authorization identification code recorded in the blockchain ledger is the same as an authorization identification code generated by the virtual machine, sending a notification message to the local client, wherein the notification message is used for notifying the local client to broadcast a second message in the blockchain network, the second message comprises the blockchain identification of the participating node and an authorization scheme for the operation of the virtual machine, and the authorization scheme for the operation of the virtual machine is an authorization scheme selected by a user of the participating node.
Optionally, thevirtual machine 50 of the participating node further includes: adetermination module 57; the determiningmodule 57 is configured to, when the virtual machine determines that the first message is recorded in a blockchain ledger by a first accounting node in the blockchain network, and the authorized identification code recorded in the blockchain ledger is the same as the authorized identification code generated by the virtual machine, determine that the user identity of the participating node is real, and run the application according to the authorization scheme selected by the user of the participating node.
Optionally, the blockchain network further includes a second accounting node, where the second accounting node is configured to record the second message into a blockchain ledger when it is determined that the transaction amount information in the first message matches the authorization scheme for the virtual machine to operate in the second message.
The virtual machine of the participating node in the embodiment shown in fig. 5 may be used to execute the technical solution of the above method embodiment, and the implementation principle and technical effect are similar, which are not described herein again.
In addition, the embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the method for authorized use of an application based on a blockchain described in the foregoing embodiment.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.