Skip to main content
Version: 2.0.0

Class: EpochKeyLiteProof

src.EpochKeyLiteProof

A class representing an epoch key lite proof. Each of the following properties are public signals for the proof.

Unlike the epoch key proof the lite proof does not prove membership in a state tree.

Hierarchy

Constructors

constructor

new EpochKeyLiteProof(publicSignals, proof, prover?)

Parameters

NameTypeDescription
publicSignals(string | bigint)[]The public signals of the epoch key lite proof that can be verified by the prover
proofSnarkProofThe proof that can be verified by the prover
prover?ProverThe prover that can verify the public signals and the proof

Example

import { EpochKeyLiteProof } from '@unirep/circuits'
const data = new EpochKeyLiteProof(publicSignals, proof)

Overrides

BaseProof.constructor

Defined in

circuits/src/EpochKeyLiteProof.ts:65

Properties

_snarkProof

Readonly _snarkProof: SnarkProof

The proof data in SnarkProof format. Use this when manually verifying with snarkjs.

Inherited from

BaseProof._snarkProof

Defined in

circuits/src/BaseProof.ts:24


attesterId

attesterId: bigint

The attester id for the proof.

Defined in

circuits/src/EpochKeyLiteProof.ts:45


chainId

chainId: bigint

The chain id for the proof.

Defined in

circuits/src/EpochKeyLiteProof.ts:53


circuit

Protected Optional circuit: Circuit

The string name of the type of circuit this proof came from. For the BaseProof class this is undefined.

Inherited from

BaseProof.circuit

Defined in

circuits/src/BaseProof.ts:28


control

control: bigint

The control field used for the proof. This field contains many signals binary encoded into a single 253 bit value. This value is automatically decoded into the other properties on this class.

Defined in

circuits/src/EpochKeyLiteProof.ts:24


data

data: bigint

The 32 byte data endorsed by the proof.

Defined in

circuits/src/EpochKeyLiteProof.ts:32


epoch

epoch: bigint

The epoch the proof was made within.

Defined in

circuits/src/EpochKeyLiteProof.ts:41


epochKey

epochKey: bigint

The epoch key being proved.

Defined in

circuits/src/EpochKeyLiteProof.ts:28


idx

Readonly idx: Object

The index of the data in the public signals

Type declaration

NameType
controlnumber
datanumber
epochKeynumber

Defined in

circuits/src/EpochKeyLiteProof.ts:15


nonce

nonce: bigint

The nonce used to generate the epoch key. To determine if this value is set check that revealNonce == 1.

Defined in

circuits/src/EpochKeyLiteProof.ts:37


proof

proof: bigint[]

The proof data formatted as string[]. Use this property when interacting with smart contracts.

Inherited from

BaseProof.proof

Defined in

circuits/src/BaseProof.ts:37


prover

Optional prover: Prover

The Prover object.

Inherited from

BaseProof.prover

Defined in

circuits/src/BaseProof.ts:41


publicSignals

Readonly publicSignals: bigint[]

The raw array of public signals for the proof.

Inherited from

BaseProof.publicSignals

Defined in

circuits/src/BaseProof.ts:33


revealNonce

revealNonce: bigint

A number indicating whether the epoch key nonce was revealed in the proof. This value will be either 1 or 0.

Defined in

circuits/src/EpochKeyLiteProof.ts:49

Methods

verify

verify(): Promise<boolean>

A function to verify the proof with the supplied Prover. The prover property must be set either in the constructor or manually, otherwise this will throw.

Returns

Promise<boolean>

True if the proof is valid, false otherwise

Example

const isValid: boolean = await proof.verify()

Inherited from

BaseProof.verify

Defined in

circuits/src/BaseProof.ts:95


buildControl

Static buildControl(config): bigint

Pack several variables into one bigint variable.

Parameters

NameTypeDescription
configEpochKeyControlThe variables that will be packed.

Returns

bigint

The control

Example

const control: bigint = EpochKeyLiteProof.buildControl({
epoch,
nonce,
attesterId,
revealNonce,
chainId
})

Defined in

circuits/src/EpochKeyLiteProof.ts:99