mpcsetup

package
v0.1.33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractKeys

func ExtractKeys(srs1 *Phase1, srs2 *Phase2, evals *Phase2Evaluations, nConstraints int) (pk groth16.ProvingKey, vk groth16.VerifyingKey)

func InitPhase2

func InitPhase2(r1cs *cs.R1CS, srs1 *Phase1) (Phase2, Phase2Evaluations)

func VerifyPhase1

func VerifyPhase1(c0, c1 *Phase1, c ...*Phase1) error

func VerifyPhase2

func VerifyPhase2(c0, c1 *Phase2, c ...*Phase2) error

Types

type Phase1

type Phase1 struct {
	Parameters struct {
		G1 struct {
			Tau      []curve.G1Affine // {[τ⁰]₁, [τ¹]₁, [τ²]₁, …, [τ²ⁿ⁻²]₁}
			AlphaTau []curve.G1Affine // {α[τ⁰]₁, α[τ¹]₁, α[τ²]₁, …, α[τⁿ⁻¹]₁}
			BetaTau  []curve.G1Affine // {β[τ⁰]₁, β[τ¹]₁, β[τ²]₁, …, β[τⁿ⁻¹]₁}
		}
		G2 struct {
			Tau  []curve.G2Affine // {[τ⁰]₂, [τ¹]₂, [τ²]₂, …, [τⁿ⁻¹]₂}
			Beta curve.G2Affine   // [β]₂
		}
	}
	PublicKeys struct {
		Tau, Alpha, Beta PublicKey
	}
	Hash []byte // sha256 hash
}

Phase1 represents the Phase1 of the MPC described in https://eprint.iacr.org/2017/1050.pdf

Also known as "Powers of Tau"

func InitPhase1

func InitPhase1(power int) (phase1 Phase1)

InitPhase1 initialize phase 1 of the MPC. This is called once by the coordinator before any randomness contribution is made (see Contribute()).

func (*Phase1) Contribute

func (phase1 *Phase1) Contribute()

Contribute contributes randomness to the phase1 object. This mutates phase1.

func (*Phase1) ReadFrom

func (phase1 *Phase1) ReadFrom(reader io.Reader) (int64, error)

ReadFrom implements io.ReaderFrom

func (*Phase1) WriteTo

func (phase1 *Phase1) WriteTo(writer io.Writer) (int64, error)

WriteTo implements io.WriterTo

type Phase2

type Phase2 struct {
	Parameters struct {
		G1 struct {
			Delta curve.G1Affine
			L, Z  []curve.G1Affine
		}
		G2 struct {
			Delta curve.G2Affine
		}
	}
	PublicKey PublicKey
	Hash      []byte
}

func (*Phase2) Contribute

func (c *Phase2) Contribute()

func (*Phase2) ReadFrom

func (c *Phase2) ReadFrom(reader io.Reader) (int64, error)

ReadFrom implements io.ReaderFrom

func (*Phase2) WriteTo

func (phase2 *Phase2) WriteTo(writer io.Writer) (int64, error)

WriteTo implements io.WriterTo

type Phase2Evaluations

type Phase2Evaluations struct {
	G1 struct {
		A, B, VKK []curve.G1Affine
	}
	G2 struct {
		B []curve.G2Affine
	}
}

func (*Phase2Evaluations) ReadFrom

func (c *Phase2Evaluations) ReadFrom(reader io.Reader) (int64, error)

ReadFrom implements io.ReaderFrom

func (*Phase2Evaluations) WriteTo

func (c *Phase2Evaluations) WriteTo(writer io.Writer) (int64, error)

WriteTo implements io.WriterTo

type PublicKey

type PublicKey struct {
	SG  curve.G1Affine
	SXG curve.G1Affine
	XR  curve.G2Affine
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL