Skip to content

Commit

Permalink
rename zkdvrf to zkrand
Browse files Browse the repository at this point in the history
  • Loading branch information
kitounliu committed Jul 2, 2024
1 parent 0caefef commit cb0e2f2
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "zkdvrf"
name = "zkrand"
version = "0.1.0"
authors = ["Jia Liu"]
edition = "2021"
Expand Down Expand Up @@ -47,7 +47,7 @@ default = ['g2chip']
g2chip = []

[lib]
name = "zkdvrf"
name = "zkrand"
path = "src/lib.rs"

[[bin]]
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ yarn deploy

2. Populate your demo-config.json file using-

a) your zkdvrf.sol deployed address
a) your Zkdvrf deployed address
b) five sample addresses, and their private keys from ganache pre-generated accounts

### Step-3: NIDKG
Expand Down Expand Up @@ -299,10 +299,9 @@ yarn random
```

After the members have done submitting partial evaluations - verify that a pseudorandom number is generated on the admin window!
Respond 'yes' on the admin window to start producing the next pseudorandom and 'no' to quit.

### Re-running
Respond 'yes' on the admin window to continue generating pseudorandom numbers.

If you have exited the admin script, but have already been through the NIDKG process, you can continue with random number generation through running-

```
Expand Down Expand Up @@ -332,6 +331,6 @@ The round number for target random is set to be 3 in the script.
```
yarn lottery:play
```
Before zkdvrf.sol starts producing the target random, players can enter the lottery by depositing a certain amount of ethers.
Before Zkdvrf starts producing the target random, players can enter the lottery by depositing a certain amount of ethers.

5. Continuing the above Step-4 for generating random until the round number hits 3 which will trigger the lottery admin to pick and pay a winner.
4 changes: 2 additions & 2 deletions benches/dkg_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ mod dkg_benches {
};
use halo2wrong::utils::DimensionMeasurement;
use rand_core::OsRng;
use zkdvrf::dkg::DkgConfig;
use zkdvrf::{DkgCircuit, DkgMemberParams, MemberKey};
use zkrand::dkg::DkgConfig;
use zkrand::{DkgCircuit, DkgMemberParams, MemberKey};

fn dkg_proof_verify<
const THRESHOLD: usize,
Expand Down
15 changes: 8 additions & 7 deletions benches/dvrf_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ mod dvrf_benches {
use halo2wrong::halo2::arithmetic::Field;
use rand_core::OsRng;
use sha3::{Digest, Keccak256};
use zkdvrf::dkg::DkgConfig;
use zkdvrf::{
use zkrand::dkg::DkgConfig;
use zkrand::{
combine_partial_evaluations, hash_to_curve_bn, keygen, shares, DkgShareKey, PseudoRandom,
EVAL_PREFIX,
};
Expand Down Expand Up @@ -89,11 +89,12 @@ mod dvrf_benches {
let h: BnG1 = hasher(input).to_affine();

let proof = (h * a).to_affine();
let value = Keccak256::new()
.chain_update(proof.x.to_bytes())
.chain_update(proof.y.to_bytes())
.finalize()
.to_vec();
// reverse order to match solidity version
let mut bytes = proof.y.to_bytes().to_vec();
bytes.extend(proof.x.to_bytes());
bytes.reverse();

let value = Keccak256::new().chain_update(bytes).finalize().to_vec();
let pr = PseudoRandom::new(proof, value);

c.bench_function("dvrf pseudorandom verification", move |b| {
Expand Down
4 changes: 2 additions & 2 deletions bin/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use crate::serialise::{
#[cfg(not(feature = "g2chip"))]
use serialise::DkgMemberPublicParams as DkgMemberPublicParamsSerde;

use zkdvrf::dkg::{DkgConfig, PartialEval};
use zkdvrf::{
use zkrand::dkg::{DkgConfig, PartialEval};
use zkrand::{
combine_partial_evaluations, dkg_global_public_params, load_or_create_params,
load_or_create_pk, load_or_create_vk, DkgGlobalPubParams, DkgMemberParams,
DkgMemberPublicParams, DkgShareKey, MemberKey, PseudoRandom,
Expand Down
4 changes: 2 additions & 2 deletions bin/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use anyhow::Result;
use halo2wrong::curves::bn256::Fr as BnScalar;
use rand_core::RngCore;
use std::fs::{read_to_string, write};
use zkdvrf::dkg::{DkgConfig, PartialEval};
use zkdvrf::{
use zkrand::dkg::{DkgConfig, PartialEval};
use zkrand::{
combine_partial_evaluations, dkg_global_public_params, DkgGlobalPubParams, DkgMemberParams,
DkgMemberPublicParams, DkgShareKey, MemberKey, PseudoRandom,
};
Expand Down
2 changes: 1 addition & 1 deletion bin/serialise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use halo2wrong::curves::grumpkin::G1Affine as GkG1;
use halo2wrong::curves::CurveAffine;
use hex::{decode, encode};
use serde::{Deserialize, Serialize};
use zkdvrf::{
use zkrand::{
dkg::DkgConfig, dkg::PartialEval as PartialEvalCurve,
dkg::PartialEvalProof as PartialEvalProofCurve, DkgGlobalPubParams as DkgGlobalPubParamsCurve,
DkgMemberParams as DkgMemberParamsCurve, DkgMemberPublicParams as DkgMemberPublicParamsCurve,
Expand Down
4 changes: 2 additions & 2 deletions examples/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use halo2wrong::halo2::poly::kzg::commitment::{ParamsKZG, ParamsVerifierKZG};
use rand_core::{OsRng, RngCore};
use std::fs::{create_dir_all, File};
use std::io::Write;
use zkdvrf::dkg::DkgConfig;
use zkdvrf::{load_or_create_params, load_or_create_pk, DkgMemberParams, MemberKey};
use zkrand::dkg::DkgConfig;
use zkrand::{load_or_create_params, load_or_create_pk, DkgMemberParams, MemberKey};

const DIR_GENERATED: &str = "./demo/contracts_generated/separate";

Expand Down
4 changes: 2 additions & 2 deletions examples/verifier_combi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ use rand_chacha::ChaCha20Rng;
use rand_core::{OsRng, RngCore, SeedableRng};
use std::fs::{create_dir_all, File};
use std::io::Write;
use zkdvrf::dkg::DkgConfig;
use zkdvrf::{load_or_create_params, load_or_create_pk, DkgMemberParams, MemberKey};
use zkrand::dkg::DkgConfig;
use zkrand::{load_or_create_params, load_or_create_pk, DkgMemberParams, MemberKey};

const DIR_GENERATED: &str = "./contracts/dkg-verifier";

Expand Down
4 changes: 2 additions & 2 deletions examples/verifier_combi_full.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use rand_core::{OsRng, RngCore, SeedableRng};
use serde::{Deserialize, Serialize};
use std::fs::{create_dir_all, File};
use std::io::Write;
use zkdvrf::dkg::{DkgConfig, PartialEval};
use zkdvrf::{
use zkrand::dkg::{DkgConfig, PartialEval};
use zkrand::{
combine_partial_evaluations, dkg_global_public_params, hash_to_curve_bn, load_or_create_params,
load_or_create_pk, DkgGlobalPubParams, DkgMemberParams, MemberKey, PseudoRandom, EVAL_PREFIX,
};
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "zkdvrf",
"name": "zkrand",
"description": "A distributed verifiable random function (DVRF) is a t-out-of-n threshold scheme that enables a group of n participants to jointly compute a random output. The output should be unique, publicly verifiable, unpredictable, and unbiased.",
"version": "1.0.0",
"main": "hardhat.config.ts",
Expand Down Expand Up @@ -41,12 +41,12 @@
},
"repository": {
"type": "git",
"url": "git+https://github.com/bobanetwork/zkdvrf.git"
"url": "git+https://github.com/bobanetwork/zkrand.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/bobanetwork/zkdvrf/issues"
"url": "https://github.com/bobanetwork/zkrand/issues"
},
"homepage": "https://github.com/bobanetwork/zkdvrf#readme"
"homepage": "https://github.com/bobanetwork/zkrand#readme"
}

0 comments on commit cb0e2f2

Please sign in to comment.