Class: EpochKeyProof
src.EpochKeyProof
A class representing an epoch key proof. Each of the following properties are public signals for the proof.
Hierarchy
↳
EpochKeyProof
Constructors
constructor
• new EpochKeyProof(publicSignals
, proof
, prover?
)
Parameters
Name | Type | Description |
---|---|---|
publicSignals | (string | bigint )[] | The public signals of the epoch key proof that can be verified by the prover |
proof | Groth16Proof | The proof that can be verified by the prover |
prover? | Prover | The prover that can verify the public signals and the proof |
Example
import { EpochKeyProof } from '@unirep/circuits'
const data = new EpochKeyProof(publicSignals, proof)
Overrides
Defined in
circuits/src/EpochKeyProof.ts:69
Properties
_snarkProof
• Readonly
_snarkProof: Groth16Proof
The proof data in Groth16Proof
format. Use this when manually verifying with snarkjs
.
Inherited from
Defined in
attesterId
• attesterId: bigint
The attester id for the proof.
Defined in
circuits/src/EpochKeyProof.ts:49
chainId
• chainId: bigint
The chain id for the proof.
Defined in
circuits/src/EpochKeyProof.ts:57
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
Defined in
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/EpochKeyProof.ts:32
data
• data: bigint
The 32 byte data endorsed by the proof.
Defined in
circuits/src/EpochKeyProof.ts:36
epoch
• epoch: bigint
The epoch the proof was made within.
Defined in
circuits/src/EpochKeyProof.ts:45
epochKey
• epochKey: bigint
The epoch key being proved.
Defined in
circuits/src/EpochKeyProof.ts:23
idx
• Readonly
idx: Object
The index of the data in the public signals
Type declaration
Name | Type |
---|---|
control | number |
data | number |
epochKey | number |
stateTreeRoot | number |
Defined in
circuits/src/EpochKeyProof.ts:13
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/EpochKeyProof.ts:41
proof
• proof: bigint
[]
The proof data formatted as string[]
. Use this property when interacting with smart contracts.
Inherited from
Defined in
prover
• Optional
prover: Prover
The Prover
object.
Inherited from
Defined in
publicSignals
• Readonly
publicSignals: bigint
[]
The raw array of public signals for the proof.
Inherited from
Defined in
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/EpochKeyProof.ts:53
stateTreeRoot
• stateTreeRoot: bigint
The state tree root the proof was made against. This should be verified to exist onchain when verifying the proof.
Defined in
circuits/src/EpochKeyProof.ts:28
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
Defined in
buildControl
▸ Static
buildControl(config
): bigint
Pack several variables into one bigint
variable.
Parameters
Name | Type | Description |
---|---|---|
config | EpochKeyControl | The variables that will be packed. |
Returns
bigint
The control
Example
EpochKeyProof.buildControl({
epoch,
nonce,
attesterId,
revealNonce,
chainId
})