file_path stringlengths 7 180 | content stringlengths 0 811k | repo stringclasses 11
values |
|---|---|---|
src/layers/batch_mat_mul.rs | use std::{collections::HashMap, marker::PhantomData, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, Axis, IxDyn};
use crate::{
gadgets::gadget::{GadgetConfig, GadgetType},
layers::fully_connected::FullyConnectedConfig,
};
use super::{
fully_conne... | https://github.com/ddkang/zkml |
src/layers/conv2d.rs | // TODO: Speed up Depthwise operations with Freivald's algorithm
use std::{collections::HashMap, marker::PhantomData, rc::Rc};
use halo2_proofs::{
circuit::{AssignedCell, Layouter},
halo2curves::ff::PrimeField,
plonk::Error,
};
use ndarray::{Array, IxDyn};
use crate::{
gadgets::{
bias_div_round_relu6::Bi... | https://github.com/ddkang/zkml |
src/layers/dag.rs | use std::{collections::HashMap, fs::File, io::BufWriter, marker::PhantomData, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use crate::{
gadgets::gadget::{convert_to_u64, GadgetConfig},
layers::{
arithmetic::{add::AddChip, div_var::DivVarChip, mul::MulChip, sub::Su... | https://github.com/ddkang/zkml |
src/layers/div_fixed.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{
circuit::{AssignedCell, Layouter, Value},
halo2curves::ff::PrimeField,
plonk::Error,
};
use ndarray::{Array, IxDyn};
use crate::gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
var_div::VarDivRoundChip,
};
use super::layer::{AssignedTe... | https://github.com/ddkang/zkml |
src/layers/fully_connected.rs | use std::{collections::HashMap, marker::PhantomData, rc::Rc};
use halo2_proofs::{
circuit::{AssignedCell, Layouter, Region, Value},
halo2curves::ff::PrimeField,
plonk::{Advice, Column, Error},
};
use ndarray::{Array, ArrayView, Axis, IxDyn};
use crate::{
gadgets::{
add_pairs::AddPairsChip,
dot_prod::D... | https://github.com/ddkang/zkml |
src/layers/layer.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{
circuit::{AssignedCell, Layouter},
halo2curves::ff::PrimeField,
plonk::Error,
};
use ndarray::{Array, IxDyn};
use crate::gadgets::gadget::{GadgetConfig, GadgetType};
#[derive(Clone, Copy, Debug, Default, Hash, Eq, PartialEq)]
pub enum LayerType {
A... | https://github.com/ddkang/zkml |
src/layers/logistic.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
nonlinear::logistic::LogisticGadgetChip,
};
use super::layer::{AssignedTensor, CellRc, Gad... | https://github.com/ddkang/zkml |
src/layers/max_pool_2d.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::{
gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
max::MaxChip,
},
layers::conv2d::{Conv2DChip, PaddingEnum},
};
use super::layer::{A... | https://github.com/ddkang/zkml |
src/layers/mean.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{
circuit::{AssignedCell, Layouter, Value},
halo2curves::ff::PrimeField,
plonk::Error,
};
use ndarray::{Array, Axis, IxDyn};
use crate::gadgets::gadget::{GadgetConfig, GadgetType};
use super::{
averager::Averager,
layer::{AssignedTensor, CellRc, Ga... | https://github.com/ddkang/zkml |
src/layers/noop.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use crate::gadgets::gadget::GadgetConfig;
use super::layer::{AssignedTensor, CellRc, GadgetConsumer, Layer, LayerConfig};
pub struct NoopChip {}
impl<F: PrimeField> Layer<F> for NoopChip {
f... | https://github.com/ddkang/zkml |
src/layers/pow.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
nonlinear::pow::PowGadgetChip,
};
use super::layer::{AssignedTensor, CellRc, GadgetConsume... | https://github.com/ddkang/zkml |
src/layers/rsqrt.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
nonlinear::rsqrt::RsqrtGadgetChip,
};
use super::layer::{AssignedTensor, CellRc, GadgetCon... | https://github.com/ddkang/zkml |
src/layers/shape.rs | pub mod broadcast;
pub mod concatenation;
pub mod mask_neg_inf;
pub mod pack;
pub mod pad;
pub mod permute;
pub mod reshape;
pub mod resize_nn;
pub mod rotate;
pub mod slice;
pub mod split;
pub mod transpose;
| https://github.com/ddkang/zkml |
src/layers/shape/broadcast.rs | //
// Broadcast is used as a temporary measure to represent a the backprop
// of a full-kernel AvgPool2D
//
use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::Array;
use crate::{
gadgets::gadget::GadgetConfig,
layers::layer::{As... | https://github.com/ddkang/zkml |
src/layers/shape/concatenation.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{concatenate, Axis};
use crate::{
gadgets::gadget::{GadgetConfig, GadgetType},
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, Layer... | https://github.com/ddkang/zkml |
src/layers/shape/mask_neg_inf.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::{
gadgets::gadget::GadgetConfig,
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, LayerConfig};
pub struc... | https://github.com/ddkang/zkml |
src/layers/shape/pack.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{concatenate, Axis};
use crate::{
gadgets::gadget::{GadgetConfig, GadgetType},
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, Layer... | https://github.com/ddkang/zkml |
src/layers/shape/pad.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{
circuit::{AssignedCell, Layouter},
halo2curves::ff::PrimeField,
plonk::Error,
};
use ndarray::{Array, Axis, IxDyn, Slice};
use crate::{
gadgets::gadget::GadgetConfig,
layers::layer::{AssignedTensor, GadgetConsumer},
};
use super::super::layer::{L... | https://github.com/ddkang/zkml |
src/layers/shape/permute.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::IxDyn;
use crate::{
gadgets::gadget::GadgetConfig,
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, LayerConfig};
pub struct Permute... | https://github.com/ddkang/zkml |
src/layers/shape/reshape.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::Array;
use crate::{
gadgets::gadget::GadgetConfig,
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, LayerConfig};
pub struct Reshape... | https://github.com/ddkang/zkml |
src/layers/shape/resize_nn.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::{
gadgets::gadget::GadgetConfig,
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, LayerConfig};
pub struc... | https://github.com/ddkang/zkml |
src/layers/shape/rotate.rs | // TODO: The implementation is not ideal.
use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use crate::{
gadgets::gadget::GadgetConfig,
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, LayerConfi... | https://github.com/ddkang/zkml |
src/layers/shape/slice.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::Slice;
use crate::{
gadgets::gadget::{GadgetConfig, GadgetType},
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, LayerConfig};
pub ... | https://github.com/ddkang/zkml |
src/layers/shape/split.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Axis, Slice};
use crate::{
gadgets::gadget::{GadgetConfig, GadgetType},
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, LayerConfig... | https://github.com/ddkang/zkml |
src/layers/shape/transpose.rs | use std::{collections::HashMap, rc::Rc};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::{
gadgets::gadget::GadgetConfig,
layers::layer::{AssignedTensor, CellRc, GadgetConsumer},
};
use super::super::layer::{Layer, LayerConfig};
pub struc... | https://github.com/ddkang/zkml |
src/layers/softmax.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{
circuit::{AssignedCell, Layouter},
halo2curves::ff::PrimeField,
plonk::Error,
};
use ndarray::{s, Array, IxDyn};
use crate::gadgets::{
adder::AdderChip,
gadget::{Gadget, GadgetConfig, GadgetType},
max::MaxChip,
nonlinear::exp::ExpGadgetCh... | https://github.com/ddkang/zkml |
src/layers/sqrt.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
nonlinear::sqrt::SqrtGadgetChip,
};
use super::layer::{AssignedTensor, CellRc, GadgetConsu... | https://github.com/ddkang/zkml |
src/layers/square.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
square::SquareGadgetChip,
var_div::VarDivRoundChip,
};
use super::layer::{AssignedTensor... | https://github.com/ddkang/zkml |
src/layers/squared_diff.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::{
gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
squared_diff::SquaredDiffGadgetChip,
var_div::VarDivRoundChip,
},
utils::he... | https://github.com/ddkang/zkml |
src/layers/tanh.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
nonlinear::tanh::TanhGadgetChip,
};
use super::layer::{AssignedTensor, CellRc, GadgetConsu... | https://github.com/ddkang/zkml |
src/layers/update.rs | use std::{collections::HashMap, rc::Rc, vec};
use halo2_proofs::{circuit::Layouter, halo2curves::ff::PrimeField, plonk::Error};
use ndarray::{Array, IxDyn};
use crate::gadgets::{
gadget::{Gadget, GadgetConfig, GadgetType},
update::UpdateGadgetChip,
};
use super::layer::{AssignedTensor, CellRc, GadgetConsumer, La... | https://github.com/ddkang/zkml |
src/lib.rs | #![feature(int_roundings)]
pub mod commitments;
pub mod gadgets;
pub mod layers;
pub mod model;
pub mod utils;
| https://github.com/ddkang/zkml |
src/model.rs | use std::{
collections::{BTreeMap, BTreeSet, HashMap},
marker::PhantomData,
rc::Rc,
sync::{Arc, Mutex},
};
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner, Value},
halo2curves::ff::{FromUniformBytes, PrimeField},
plonk::{Advice, Circuit, Column, ConstraintSystem, Error, Instance},
};
use lazy_... | https://github.com/ddkang/zkml |
src/utils.rs | pub mod helpers;
pub mod loader;
pub mod proving_ipa;
pub mod proving_kzg;
| https://github.com/ddkang/zkml |
src/utils/helpers.rs | use halo2_proofs::{
circuit::{AssignedCell, Value},
halo2curves::ff::PrimeField,
};
use ndarray::{Array, IxDyn};
use num_bigint::BigUint;
use crate::{gadgets::gadget::convert_to_u128, model::PUBLIC_VALS};
// TODO: this is very bad
pub const RAND_START_IDX: i64 = i64::MIN;
pub const NUM_RANDOMS: i64 = 20001;
// C... | https://github.com/ddkang/zkml |
src/utils/loader.rs | use std::{fs::File, io::BufReader};
use serde_derive::{Deserialize, Serialize};
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct TensorMsgpack {
pub idx: i64,
pub shape: Vec<i64>,
pub data: Vec<i64>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct LayerMsgpack {
pub layer_type: String,... | https://github.com/ddkang/zkml |
src/utils/proving_ipa.rs | use std::{
fs::File,
io::{BufReader, Write},
path::Path,
time::Instant,
};
use halo2_proofs::{
dev::MockProver,
halo2curves::pasta::{EqAffine, Fp},
plonk::{create_proof, keygen_pk, keygen_vk, verify_proof},
poly::{
commitment::{Params, ParamsProver},
ipa::{
commitment::{IPACommitmentSchem... | https://github.com/ddkang/zkml |
src/utils/proving_kzg.rs | use std::{
fs::File,
io::{BufReader, Write},
path::Path,
time::Instant,
};
use halo2_proofs::{
dev::MockProver,
halo2curves::bn256::{Bn256, Fr, G1Affine},
plonk::{create_proof, keygen_pk, keygen_vk, verify_proof, VerifyingKey},
poly::{
commitment::Params,
kzg::{
commitment::{KZGCommitment... | https://github.com/ddkang/zkml |
testing/circuits/last_two_layers.py | import tensorflow as tf
import os
import numpy as np
interpreter = tf.lite.Interpreter(
model_path=f'./testing/circuits/v2_1.0_224.tflite'
)
interpreter.allocate_tensors()
NAME_TO_TENSOR = {}
for tensor_details in interpreter.get_tensor_details():
NAME_TO_TENSOR[tensor_details['name']] = tensor_details
Wc = ... | https://github.com/ddkang/zkml |
frontend/vite.config.js | import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
})
| https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/circuit.circom | pragma circom 2.0.0;
include "./model.circom";
include "./utils/cid.circom";
include "./utils/encrypt.circom";
template Main(n) {
// private inputs
signal input in[n][797*8];
signal input conv2d_weights[3][3][1][4];
signal input conv2d_bias[4];
signal input batch_normalization_a[4];
signal inp... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/encryption.circom | pragma circom 2.0.0;
include "./utils/encrypt.circom";
template Main() {
// public inputs
signal input public_key[2];
// private inputs
signal input in[1000]; // zero-padded at the end
signal input private_key;
// outputs
signal output hash;
signal output shared_key;
signal outpu... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/model.circom | pragma circom 2.0.0;
include "../node_modules/circomlib-ml/circuits/BatchNormalization2D.circom";
include "../node_modules/circomlib-ml/circuits/Dense.circom";
include "../node_modules/circomlib-ml/circuits/Conv2D.circom";
include "../node_modules/circomlib-ml/circuits/AveragePooling2D.circom";
include "../node_module... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/ch.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/constants.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/main.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/maj.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/rotate.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/sha256.circom | pragma circom 2.0.0;
include "constants.circom";
include "sha256compression.circom";
template Sha256(nBits) {
signal input in[nBits];
signal output out[256];
var i;
var k;
var nBlocks;
var bitsLastBlock;
nBlocks = ((nBits + 64)\512)+1;
signal paddedIn[nBlocks*512];
for (k=0; k... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/sha256_2.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/sha256compression.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/sha256compression_function.circom | // signal input hin[256];
// signal input inp[512];
// signal output out[256];
pragma circom 2.0.0;
function rrot(x, n) {
return ((x >> n) | (x << (32-n))) & 0xFFFFFFFF;
}
function bsigma0(x) {
return rrot(x,2) ^ rrot(x,13) ^ rrot(x,22);
}
function bsigma1(x) {
return rrot(x,6) ^ rrot(x,11) ^ rr... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/shift.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/sigma.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/sigmaplus.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/t1.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/t2.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/sha256/xor3.circom | /*
Copyright 2018 0KIMS association.
This file is part of circom (Zero Knowledge Circuit Compiler).
circom is a free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, o... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/utils/cid.circom | pragma circom 2.0.0;
include "../sha256/sha256.circom";
include "../../node_modules/circomlib-ml/circuits/circomlib/bitify.circom";
// convert a 797x8 bit array (pgm) to 28x28x1 array (pixels)
template getPixels() {
signal input in[797*8];
signal output out[28][28][1];
component pixels[28][28][1];
f... | https://github.com/socathie/ZKaggleV2 |
hardhat/circuits/utils/encrypt.circom | pragma circom 2.0.0;
include "../../node_modules/circomlib-ml/circuits/crypto/encrypt.circom";
include "../../node_modules/circomlib-ml/circuits/crypto/ecdh.circom";
// encrypt 1000 inputs
template encrypt1000() {
// public inputs
signal input public_key[2];
// private inputs
signal input in[1000];
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Bounty.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "./ICircuitVerifier.sol";
import "./IEncryptionVerifier.sol";
contract Bounty is Initializable, O... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/BountyFactory.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
import "./Bounty.sol";
import "@openzeppelin/contracts/proxy/Clones.sol";
contract BountyFactory {
address public immutable encryptionVerifier;
address public immutable bountyTemplate;
address[] public bounties;
uint public bountyCount;
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/ICircuitVerifier.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
interface ICircuitVerifier {
function verifyProof(
uint[2] memory a,
uint[2][2] memory b,
uint[2] memory c,
uint[] memory input
) external view returns (bool);
} | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/IEncryptionVerifier.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
interface IEncryptionVerifier {
function verifyProof(
uint[2] memory a,
uint[2][2] memory b,
uint[2] memory c,
uint[1005] memory input
) external view returns (bool);
} | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing100.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing100 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(0,0);
vk[1] = G1Point(
30669490561985555906356211620843631747625274766223321183... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing1000.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing1000 {
struct G1Point {
uint X;
uint Y;
}
G1Point[106] public vk;
constructor() {
vk[0] = G1Point(
19391891390609481429849774145579503985374912055370046060106347963180567737648,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing200.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing200 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(
5280447958522165271753443781707956962932493679043298614057258828764744713115,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing300.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing300 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(
4152372711129164001388267322213971146957149153241123267759240469268693995296,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing400.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing400 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(
8449608423833037886689363696679598002380977316690731686317181458570600648998,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing500.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing500 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(
8017365071475770317213092030893590918235912283489212360180207554216851342282,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing600.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing600 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(
1991890746054979274067153105515635741980863425728522437606931770461856188116,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing700.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing700 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(
9440809148011862556974623395734247470581005158317701517995290948210647853666,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing800.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing800 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(
559294184750664917430341870656604694071008897392190220192116267892035169297,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/Pairing900.sol | // SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.17;
contract Pairing900 {
struct G1Point {
uint X;
uint Y;
}
G1Point[101] public vk;
constructor() {
vk[0] = G1Point(
18307463072870674736741132489299673350923024551765424057435422228540653970783,
... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/circuitVerifier.sol | //
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, dis... | https://github.com/socathie/ZKaggleV2 |
hardhat/contracts/encryptionVerifier.sol | //
// Copyright 2017 Christian Reitwiessner
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, dis... | https://github.com/socathie/ZKaggleV2 |
hardhat/deploy/deploy.js | module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const pairing100 = await deploy('Pairing100', {
from: deployer,
log: true
});
const pairing200 = await deploy('Pairing200', {
from:... | https://github.com/socathie/ZKaggleV2 |
hardhat/hardhat.config.js | require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-ethers");
require("hardhat-deploy");
require("hardhat-contract-sizer");
require("hardhat-gas-reporter");
require("dotenv").config();
// const { PRIVATE_KEY: GOERLI_PRIVATE_KEY, ALCHEMY_API_KEY } = process.env;
module.exports = {
solidity: {
... | https://github.com/socathie/ZKaggleV2 |
hardhat/scripts/bump-solidity.js | const fs = require("fs");
const solidityRegex = /pragma solidity \^\d+\.\d+\.\d+/
const inputRegex = /uint\[\d+\] memory input(?!;)/
const contentRegex = /proof\.C = Pairing\.G1Point\(c\[0\], c\[1\]\);([\s\S]*?)if \(verify\(inputValues, proof\) == 0\)/
const verifierRegex = /contract Verifier/
let content = fs.readFil... | https://github.com/socathie/ZKaggleV2 |
hardhat/scripts/upload-data.js | require("dotenv").config();
const lighthouse = require('@lighthouse-web3/sdk');
const fs = require('fs');
const apiKey = process.env.API_KEY;
async function main() {
const hashes = [];
for (let i = 0; i < 1000; i++) {
const path = "assets/" + i + ".pgm"; //Give path to the file
const response... | https://github.com/socathie/ZKaggleV2 |
hardhat/test/0.lighthouse.test.js | const { expect } = require("chai");
const { ethers } = require("hardhat");
require("dotenv").config();
const lighthouse = require('@lighthouse-web3/sdk');
const { recoverShards } = require("@lighthouse-web3/kavach");
const fs = require("fs");
const privateKey = process.env.PRIVATE_KEY;
const publicKey = process.env.P... | https://github.com/socathie/ZKaggleV2 |
hardhat/test/1.circuit.test.js | const { expect, assert } = require("chai");
const { ethers } = require("hardhat");
const { groth16 } = require("snarkjs");
const fs = require("fs");
const crypto = require("crypto");
const base32 = require("base32.js");
const F1Field = require("ffjavascript").F1Field;
const Scalar = require("ffjavascript").Scalar;
ex... | https://github.com/socathie/ZKaggleV2 |
hardhat/test/2.bounty.test.js | const { expect } = require("chai");
const { ethers } = require("hardhat");
const fs = require("fs");
const base32 = require("base32.js");
const labels = require("../assets/labels.json");
const circuitCalldata = require("./circuitCalldata.json");
const encryptionCalldata = require("./encryptionCalldata.json");
// re... | https://github.com/socathie/ZKaggleV2 |
hardhat/test/3.factory.test.js | const { expect } = require("chai");
const { ethers } = require("hardhat");
const fs = require("fs");
const base32 = require("base32.js");
const labels = require("../assets/labels.json");
// read ../assets/cid.txt into an array of strings
const cids = fs.readFileSync("assets/cid.txt").toString().split("\r");
const i... | https://github.com/socathie/ZKaggleV2 |
pgm.ipynb | {
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"from tensorflow import keras\n",
"from PIL import Image\n",
"import json"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [... | https://github.com/socathie/ZKaggleV2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.