Skip to content

Commit 65b3e69

Browse files
committed
add import instructions
1 parent 6b95e05 commit 65b3e69

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

README.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Spartan: High-speed zkSNARKs without trusted setup
22

33
![Rust](https://github.com/microsoft/Spartan/workflows/Rust/badge.svg)
4-
![crates.io](https://img.shields.io/crates/v/spartan.svg)
4+
[![](https://img.shields.io/crates/v/spartan.svg)]((https://crates.io/crates/curve25519-dalek))
55

66
Spartan is a high-speed zero-knowledge proof system, a cryptographic primitive that enables a prover to prove a mathematical statement to a verifier without revealing anything besides the validity of the statement. This repository provides `libspartan,` a Rust library that implements a zero-knowledge succinct non-interactive argument of knowledge (zkSNARK), which is a type of zero-knowledge proof system with short proofs and fast verification times. The details of the Spartan proof system are described in our [paper](https://eprint.iacr.org/2019/550) published at [CRYPTO 2020](https://crypto.iacr.org/2020/). The security of the Spartan variant implemented in this library is based on the discrete logarithm problem in the random oracle model.
77

@@ -27,6 +27,11 @@ Among transparent SNARKs, Spartan offers the fastest prover with speedups of 36
2727
`libspartan` uses [`merlin`](https://docs.rs/merlin/) to automate the Fiat-Shamir transform. We also introduce a new type called `RandomTape` that extends a `Transcript` in `merlin` to allow the prover's internal methods to produce private randomness using its private transcript without having to create `OsRng` objects throughout the code. An object of type `RandomTape` is initialized with a new random seed from `OsRng` for each proof produced by the library.
2828

2929
## Examples
30+
To import `libspartan` into your Rust project, add the following dependency to `Cargo.toml`:
31+
```text
32+
spartan = "0.2.1"
33+
```
34+
3035
The following example shows how to use `libspartan` to create and verify a SNARK proof.
3136
Some of our public APIs' style is inspired by the underlying crates we use.
3237

@@ -60,6 +65,7 @@ Some of our public APIs' style is inspired by the underlying crates we use.
6065
assert!(proof
6166
.verify(&comm, &inputs, &mut verifier_transcript, &gens)
6267
.is_ok());
68+
println!("proof verification successful!");
6369
# }
6470
```
6571

@@ -90,6 +96,7 @@ Here is another example to use the NIZK variant of the Spartan proof system:
9096
assert!(proof
9197
.verify(&inst, &inputs, &mut verifier_transcript, &gens)
9298
.is_ok());
99+
println!("proof verification successful!");
93100
# }
94101
```
95102

@@ -136,6 +143,7 @@ Finally, we provide an example that specifies a custom R1CS instance instead of
136143
assert!(proof
137144
.verify(&comm, &assignment_inputs, &mut verifier_transcript, &gens)
138145
.is_ok());
146+
println!("proof verification successful!");
139147
# }
140148

141149
# fn produce_tiny_r1cs() -> (

0 commit comments

Comments
 (0)