Skip to content

Commit 3469edf

Browse files
committed
doc: improve landing example.
1 parent bbb53cd commit 3469edf

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/lib.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,23 @@
1919
//! # use curve25519_dalek::ristretto::RistrettoPoint;
2020
//! # use curve25519_dalek::scalar::Scalar;
2121
//! # use group::Group;
22-
//!
2322
//! let mut instance = sigma_rs::LinearRelation::new();
2423
//! let mut rng = rand::thread_rng();
25-
//! let witness = vec![Scalar::random(&mut rng), Scalar::random(&mut rng)];
2624
//!
25+
//! // Define the proof statement.
2726
//! let [var_x, var_r] = instance.allocate_scalars();
2827
//! let [var_G, var_H] = instance.allocate_elements();
2928
//! instance.allocate_eq(var_G * var_x + var_H * var_r);
3029
//! instance.set_elements([(var_G, RistrettoPoint::generator()), (var_H, RistrettoPoint::random(&mut rng))]);
30+
//!
31+
//! // Assign the image of the linear map.
32+
//! let witness = vec![Scalar::random(&mut rng), Scalar::random(&mut rng)];
3133
//! instance.compute_image(&witness);
32-
//! let narg_string: Vec<u8> = instance.into_nizk(b"your session identifier").unwrap().prove_batchable(&witness, &mut rng).unwrap();
34+
//!
35+
//! // Create a non-interactive argument for the instance.
36+
//! let nizk = instance.into_nizk(b"your session identifier").unwrap();
37+
//! let narg_string: Vec<u8> = nizk.prove_batchable(&witness, &mut rng).unwrap();
38+
//! // Print the narg string.
3339
//! println!("{}", hex::encode(narg_string));
3440
//! ```
3541
//!

0 commit comments

Comments
 (0)