Zero knowledge proof-based privacy protection method and system for authenticated data in smart contract
A Zero Knowledge Proof (ZKP)-based privacy protection method and system for authenticated data in a smart contract wherein initialization is performed. Inputting a security parameter obtains a public parameter. A Data Authenticator (DA) generates a public/private key pair. A key pair is generated using the public parameter and a verification circuit as inputs, the key pair including a proof and a verification key. Authentication on private data of a Decentralized App (DApp) User (DU) is performed using the private key of the DA, and generates a signature. A DU prover terminal inputs private data as an input value and a calculation result and hash value as output values. The DU generates a ZKP using the proof key. A validator verifies whether the ZKP is correct. If verification passes, the calculation result is correct; otherwise the calculation result is wrong. The validator executes a smart contract based on the verification result.
1. A Zero Knowledge Proof (ZKP)-based privacy protection method for authenticated data in a smart contract, the method comprising:
inputting a security parameter to obtain a public parameter using a zero-knowledge proof algorithm, and generating, by a trusted Data Authenticator (DA), a public/private key pair;
generating a key pair by using the public parameter and a verification circuit as inputs, the key pair including a proof key and a verification key;
performing authentication on private data of a Decentralized App (DApp) User (DU) by using the private key of the trusted DA, and generating a signature;
inputting, by a DU prover terminal, the private data serving as an input value and a calculation result and a hash value serving as output values of the verification circuit, and generating, by the DU, a ZKP using the proof key; and
verifying, by a validator by using the verification key, whether the ZKP is correct or not, and determining that the calculation result is correct when the verification is passed, or determining that the calculation result is wrong when the verification fails, and executing, by the validator, a smart contract based on a result of the verification.
2. The method of claim 1 , wherein the inputting the security parameter to obtain the public parameter is performed by inputting the security parameter to obtain the public parameter using a ZKP system.
3. The method of claim 1 , wherein the generating, by the trusted DA, the public/private key pair is performed by selecting, by the trusted DA, a digital signature mechanism to generate the public/private key pair, and announcing, by the trusted DA, the public key.
4. The method of claim 1 , wherein a plurality of trusted DAs are allowed, such that private data of a user is authenticated and signed by different DAs.
5. The method of claim 1 , wherein the generating the key pair by using the public parameter and the verification circuit as inputs is performed by:
executing a ZKP system by using the public parameter and the verification circuit as inputs to generate the key pair.
6. The method of claim 1 , wherein a ZKP system is executed to generate the key pair, the key pair being allowed to be generated jointly by a plurality of trusted institutions or generated by a trusted process.
7. The method of claim 1 , wherein the generating, by the DU, of a proof is performed by executing, by the DU, a ZKP system to generate the proof.
8. A Zero Knowledge Proof (ZKP)-based privacy protection system for authenticated data in a smart contract, the system comprising:
one or more computer processors programmed to function as:
an initialization module, stored in a memory, configured to perform initialization including inputting a security parameter to obtain a public parameter using a zero-knowledge proof algorithm, and generating a public/private key pair by a trusted Data Authenticator (DA);
a key pair generation module, stored in the memory, configured to generate a key pair by using the public parameter and a verification circuit as inputs, the key pair including a proof key and a verification key;
a data authentication module, stored in the memory, configured to perform authentication on private data of a Decentralized App (DApp) User (DU) by using the private key of the trusted DA, and generate a signature;
a proof generation module, stored in the memory, configured to input, by a DU prover terminal, the private data serving as an input value and a calculation result and a hash value serving as output values of the verification circuit, and generate, by the DU, a ZKP using the proof key; and
a proof verification module, stored in the memory, configured to verify, by a validator by using the verification key, whether the ZKP is correct or not, and determine that the calculation result is correct when the verification is passed, or determine that the calculation result is wrong when the verification fails, and execute, by the validator, a smart contract based on a result of the verification.