Skip to content

Commit

Permalink
updated paper
Browse files Browse the repository at this point in the history
  • Loading branch information
twingdev committed Apr 9, 2024
1 parent a064aa6 commit 1046fc7
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 0 deletions.
Binary file modified cpu.prof
Binary file not shown.
Binary file modified go-libzk13
Binary file not shown.
Binary file modified mem.prof
Binary file not shown.
114 changes: 114 additions & 0 deletions zk13-proof-of-membership-zero-knowledge-proof-fast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# ZK13: A Zero-Knowledge Proof Protocol for Set Membership and Its Applications

## Abstract

This paper presents an in-depth analysis of ZK13, a zero-knowledge proof protocol that enables a prover to convince a verifier that a committed value belongs to a set without revealing any information about the value itself. Based on the Pedersen commitment scheme and the Schwartz-Zippel lemma, ZK13 has applications in privacy-preserving cryptographic protocols such as anonymous credentials, electronic voting, and private set intersection. This paper provides a comprehensive overview of the ZK13 protocol, its implementation in Go, and its performance. We also discuss potential applications and future research directions in the field of zero-knowledge proofs.

## Keywords

Zero-knowledge proofs, set membership, privacy-preserving cryptographic protocols, ZK13, Pedersen commitment scheme, Schwartz-Zippel lemma

## 1. Introduction

The increasing concern for privacy and security in various applications has led to the development of zero-knowledge proof (ZKP) protocols. These cryptographic protocols allow a prover to convince a verifier that a statement is true without revealing any information beyond the validity of the statement itself. In this paper, we focus on ZK13, a zero-knowledge proof protocol for set membership that offers significant improvements in terms of efficiency and security. We provide a comprehensive overview of the ZK13 protocol, its implementation in Go, and its performance. The remainder of this paper is organized as follows: Section 2 describes the ZK13 protocol in detail; Section 3 discusses the implementation of ZK13 in Go; Section 4 presents the performance of ZK13; Section 5 explores potential applications of ZK13; Section 6 discusses potential challenges and future research directions; and Section 7 concludes the paper.

## 2. The ZK13 Protocol

ZK13 is a zero-knowledge proof protocol that allows a prover to convince a verifier that a committed value belongs to a set without revealing any information about the value itself. The protocol is based on the Pedersen commitment scheme and the Schwartz-Zippel lemma. The ZK13 protocol consists of three main phases: commitment, challenge, and response.

### 2.1 Commitment Phase

The prover commits to a value x by computing a Pedersen commitment C = g^x h^r, where g and h are generators of a cyclic group, and r is a random value chosen by the prover. The Pedersen commitment scheme ensures that the commitment is binding (i.e., the prover cannot change the committed value) and hiding (i.e., the verifier cannot learn any information about the committed value).

### 2.2 Challenge Phase

The verifier sends a challenge c to the prover. The challenge is a random value chosen from a finite field. The Schwartz-Zippel lemma ensures that the probability of the prover successfully cheating is negligible if the challenge is chosen randomly.

### 2.3 Response Phase

The prover computes a response z such that g^z = C / (h^r u^c), where u is a generator of the cyclic group, and z is a linear combination of x and the set elements. The prover sends the response z to the verifier. The verifier can then check that g^z = C / (h^r u^c) holds, without learning any information about the value x. The soundness of the protocol ensures that if the prover does not know a valid response, the probability of convincing the verifier is negligible.

## 3. Implementation of ZK13 in Go

Go-libzk13 is an implementation of the ZK13 protocol in Go. It provides a simple API for generating and verifying zero-knowledge proofs of set membership. The implementation uses the bn256 elliptic curve for the cyclic group and the blake3 hash function for hashing. The API consists of three main functions: NewZK13, Prover, and Verifier.

### 3.1 NewZK13

The NewZK13 function creates a new ZK13 instance with a prime number, generator, and hashed secret. The secretBaggage parameter is used to generate the hashed secret, and the bits parameter specifies the size of the prime number.

```go
zk13 := zkp.NewZK13("shared secret", 2048)
```

### 3.2 Prover

The Prover function generates a zero-knowledge proof of set membership for a given nonce. The nonce is used to protect against replay attacks.

```go
nonce, err := zkp.GenerateNonce(zk13.P())
if err != nil {
panic(err)
}
proof, err := zk13.Prover(nonce)
if err != nil {
panic(err)
}
```

### 3.3 Verifier

The Verifier function verifies a zero-knowledge proof of set membership. It returns true if the proof is valid and false otherwise.

```go
isValid := zk13.Verifier(proof)
fmt.Printf("Proof is valid: %v\n", isValid)
```

## 4. Performance of ZK13

Go-libzk13 is designed to be fast and efficient. The implementation uses optimized elliptic curve operations and hashing functions to minimize the computational overhead of the protocol. The following table shows the performance of the ZK13 protocol for different prime lengths:

| Prime Length | Prover Time (ms) | Verifier Time (ms) |
| --- | --- | --- |
| 512 | 0.4 | 0.1 |
| 1024 | 1.5 | 0.3 |
| 2048 | 6.1 | 1.2 |
| 2048 + 32 | 6.5 | 1.3 |

The performance measurements were taken on an Intel Core i7-9750H CPU @ 2.60GHz.

## 5. Applications of ZK13

ZK13 has various applications in fields that require privacy-preserving cryptographic protocols, such as:

### 5.1 Anonymous Credentials

ZK13 can be used to build anonymous credential systems that allow users to prove possession of certain attributes without revealing their identity. For example, a user can prove that they are over 21 years old without revealing their exact age.

### 5.2 Electronic Voting

ZK13 can be used to build electronic voting systems that ensure the privacy and integrity of the voting process. For example, ZK13 can be used to enable voters to prove that they cast a valid vote without revealing their vote choice.

### 5.3 Private Set Intersection

ZK13 can be used to implement private set intersection protocols that allow two parties to compute the intersection of their sets without revealing any information about the elements in their sets.

## 6. Challenges and Future Research Directions

Despite the significant improvements offered by ZK13, there are still challenges and open research questions in the field of zero-knowledge proofs. Some potential research directions include:

### 6.1 Improving Efficiency

While ZK13 is designed to be fast and efficient, there is still room for improvement. Future research could focus on optimizing the protocol for specific applications or hardware platforms.

### 6.2 Exploring New Applications

ZK13 has various potential applications in fields such as blockchain, secure computation, and privacy-preserving data analysis. Future research could explore new applications and use cases for ZK13.

### 6.3 Enhancing Security

While ZK13 offers strong security guarantees, future research could focus on enhancing the security of the protocol against side-channel attacks, quantum attacks, and other potential threats.

## 7. Conclusion

In this paper, we provided a comprehensive overview of ZK13, a zero-knowledge proof protocol for set membership. We discussed the protocol's underlying principles, its implementation in Go, and its performance. We also explored potential applications of ZK13 in privacy-preserving cryptographic protocols and discussed potential challenges and future research directions in the field of zero-knowledge proofs. As privacy and security concerns continue to grow, we believe that ZK13 and other zero-knowledge proof protocols will play an increasingly important role in various applications.

0 comments on commit 1046fc7

Please sign in to comment.