mirror of
https://github.com/Rate-Limiting-Nullifier/kzg-rln.git
synced 2026-01-08 15:03:52 -05:00
chore: init versionA crate
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
target
|
||||
Cargo.lock
|
||||
11
versionA/Cargo.toml
Normal file
11
versionA/Cargo.toml
Normal file
@@ -0,0 +1,11 @@
|
||||
[package]
|
||||
name = "versionA"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
ark-poly-commit = "0.3.0"
|
||||
ark-ec = "0.3.0"
|
||||
ark-bls12-381 = "0.3.0"
|
||||
ark-std = "0.3.0"
|
||||
ark-poly = "0.3.0"
|
||||
54
versionA/src/main.rs
Normal file
54
versionA/src/main.rs
Normal file
@@ -0,0 +1,54 @@
|
||||
use std::collections::HashMap;
|
||||
|
||||
use ark_bls12_381::*;
|
||||
use ark_ec::{bls12::Bls12, PairingEngine};
|
||||
use ark_poly::univariate::DensePolynomial;
|
||||
use ark_poly_commit::kzg10::*;
|
||||
use ark_std::test_rng;
|
||||
|
||||
type UniPoly_381 = DensePolynomial<<Bls12_381 as PairingEngine>::Fr>;
|
||||
|
||||
struct RLN {
|
||||
limit: u8,
|
||||
trusted_setup_params: UniversalParams<Bls12<Parameters>>,
|
||||
}
|
||||
|
||||
impl RLN {
|
||||
fn new(limit: u8) -> Self {
|
||||
let rng = &mut test_rng();
|
||||
let trusted_setup_params =
|
||||
KZG10::<Bls12_381, UniPoly_381>::setup(limit as usize, false, rng)
|
||||
.expect("Setup failed");
|
||||
|
||||
Self {
|
||||
limit,
|
||||
trusted_setup_params,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct User {}
|
||||
|
||||
impl User {
|
||||
fn new() -> Self {
|
||||
Self {}
|
||||
}
|
||||
|
||||
fn send(&self, message: &str) {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let rln = RLN::new(1);
|
||||
let user = User::new();
|
||||
|
||||
// user.send("Hello");
|
||||
// user.send("I'm spammer");
|
||||
|
||||
let rng = &mut test_rng();
|
||||
let trusted_setup_params =
|
||||
KZG10::<Bls12_381, UniPoly_381>::setup(1, false, rng).expect("Setup failed");
|
||||
|
||||
println!("{:#?}", trusted_setup_params);
|
||||
}
|
||||
Reference in New Issue
Block a user