BACDelta[][3]*big.Int// {( βui(x)+αvi(x)+wi(x) ) / δ } from l+1 to m
Z[]*big.Int
G1struct{
Alpha[3]*big.Int
Beta[3]*big.Int
Delta[3]*big.Int
At[][3]*big.Int// {a(τ)} from 0 to m
BACGamma[][3]*big.Int// {( βui(x)+αvi(x)+wi(x) ) / γ } from 0 to m
}
G2struct{
Beta[3][2]*big.Int
Gamma[3][2]*big.Int
Delta[3][2]*big.Int
BACGamma[][3][2]*big.Int// {( βui(x)+αvi(x)+wi(x) ) / γ } from 0 to m
}
PowersTauDelta[][3]*big.Int// powers of τ encrypted in G1 curve, divided by δ
}
typeVkstruct{
IC[][3]*big.Int
G1struct{
Alpha[3]*big.Int
}
G2struct{
Beta[3][2]*big.Int
Gamma[3][2]*big.Int
Delta[3][2]*big.Int
}
}
// Setup is the data structure holding the Trusted Setup data. The Setup.Toxic sub struct must be destroyed after the GenerateTrustedSetup function is completed
// Setup is the data structure holding the Trusted Setup data. The Setup.Toxic sub struct must be destroyed after the GenerateTrustedSetup function is completed
typeSetupstruct{
typeSetupstruct{
Toxicstruct{
Toxicstruct{
@ -23,35 +53,8 @@ type Setup struct {
}
}
// public
// public
Pkstruct{// Proving Key
BACDelta[][3]*big.Int// {( βui(x)+αvi(x)+wi(x) ) / δ } from l+1 to m
Z[]*big.Int
G1struct{
Alpha[3]*big.Int
Beta[3]*big.Int
Delta[3]*big.Int
At[][3]*big.Int// {a(τ)} from 0 to m
BACGamma[][3]*big.Int// {( βui(x)+αvi(x)+wi(x) ) / γ } from 0 to m
}
G2struct{
Beta[3][2]*big.Int
Gamma[3][2]*big.Int
Delta[3][2]*big.Int
BACGamma[][3][2]*big.Int// {( βui(x)+αvi(x)+wi(x) ) / γ } from 0 to m
}
PowersTauDelta[][3]*big.Int// powers of τ encrypted in G1 curve, divided by δ
}
Vkstruct{
IC[][3]*big.Int
G1struct{
Alpha[3]*big.Int
}
G2struct{
Beta[3][2]*big.Int
Gamma[3][2]*big.Int
Delta[3][2]*big.Int
}
}
PkPk
VkVk
}
}
// Proof contains the parameters to proof the zkSNARK
// Proof contains the parameters to proof the zkSNARK
@ -219,7 +222,7 @@ func GenerateTrustedSetup(witnessLength int, circuit circuitcompiler.Circuit, al
}
}
// GenerateProofs generates all the parameters to proof the zkSNARK from the Circuit, Setup and the Witness
// GenerateProofs generates all the parameters to proof the zkSNARK from the Circuit, Setup and the Witness
G1T[][3]*big.Int// t encrypted in G1 curve, G1T == Pk.H
A[][3]*big.Int
B[][3][2]*big.Int
C[][3]*big.Int
Kp[][3]*big.Int
Ap[][3]*big.Int
Bp[][3]*big.Int
Cp[][3]*big.Int
Z[]*big.Int
}
typeVkstruct{
Vka[3][2]*big.Int
Vkb[3]*big.Int
Vkc[3][2]*big.Int
IC[][3]*big.Int
G1Kbg[3]*big.Int// g1 * Kbeta * Kgamma
G2Kbg[3][2]*big.Int// g2 * Kbeta * Kgamma
G2Kg[3][2]*big.Int// g2 * Kgamma
Vkz[3][2]*big.Int
}
// Setup is the data structure holding the Trusted Setup data. The Setup.Toxic sub struct must be destroyed after the GenerateTrustedSetup function is completed
// Setup is the data structure holding the Trusted Setup data. The Setup.Toxic sub struct must be destroyed after the GenerateTrustedSetup function is completed
typeSetupstruct{
typeSetupstruct{
Toxicstruct{
Toxicstruct{
@ -28,28 +51,8 @@ type Setup struct {
}
}
// public
// public
G1T[][3]*big.Int// t encrypted in G1 curve, G1T == Pk.H
G2T[][3][2]*big.Int// t encrypted in G2 curve
Pkstruct{// Proving Key pk:=(pkA, pkB, pkC, pkH)
A[][3]*big.Int
B[][3][2]*big.Int
C[][3]*big.Int
Kp[][3]*big.Int
Ap[][3]*big.Int
Bp[][3]*big.Int
Cp[][3]*big.Int
Z[]*big.Int
}
Vkstruct{
Vka[3][2]*big.Int
Vkb[3]*big.Int
Vkc[3][2]*big.Int
IC[][3]*big.Int
G1Kbg[3]*big.Int// g1 * Kbeta * Kgamma
G2Kbg[3][2]*big.Int// g2 * Kbeta * Kgamma
G2Kg[3][2]*big.Int// g2 * Kgamma
Vkz[3][2]*big.Int
}
PkPk
VkVk
}
}
// Proof contains the parameters to proof the zkSNARK
// Proof contains the parameters to proof the zkSNARK
@ -242,13 +245,13 @@ func GenerateTrustedSetup(witnessLength int, circuit circuitcompiler.Circuit, al
// tEncr = Utils.Bn.Fq1.Mul(tEncr, setup.Toxic.T)
// tEncr = Utils.Bn.Fq1.Mul(tEncr, setup.Toxic.T)
tEncr=Utils.FqR.Mul(tEncr,setup.Toxic.T)
tEncr=Utils.FqR.Mul(tEncr,setup.Toxic.T)
}
}
setup.G1T=gt1
setup.Pk.G1T=gt1
returnsetup,nil
returnsetup,nil
}
}
// GenerateProofs generates all the parameters to proof the zkSNARK from the Circuit, Setup and the Witness
// GenerateProofs generates all the parameters to proof the zkSNARK from the Circuit, Setup and the Witness
Utils.Bn.Pairing(Utils.Bn.G1.Add(vkxpia,proof.PiA),proof.PiB),// TODO Add(vkxpia, proof.PiA) can go outside in order to save computation, as is reused later
Utils.Bn.Pairing(Utils.Bn.G1.Add(vkxpia,proof.PiA),proof.PiB),// TODO Add(vkxpia, proof.PiA) can go outside in order to save computation, as is reused later