Skip to main content
Version: 2.0.0

Class: UserStateTransitionProof

src.UserStateTransitionProof

A class representing a user state transition proof. Each of the following properties are public signals for the proof.

Hierarchy

Constructors

constructor

new UserStateTransitionProof(publicSignals, proof, prover?, config?)

Parameters

NameTypeDefault valueDescription
publicSignals(string | bigint)[]undefinedThe public signals of the user state transition proof that can be verified by the prover
proofSnarkProofundefinedThe proof that can be verified by the prover
prover?ProverundefinedThe prover that can verify the public signals and the proof
configCircuitConfigCircuitConfig.default-

Example

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

Overrides

BaseProof.constructor

Defined in

circuits/src/UserStateTransitionProof.ts:57

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/UserStateTransitionProof.ts:41


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/UserStateTransitionProof.ts:36


epochKeys

epochKeys: bigint[]

The epoch keys that are output as public signals. These should be verified to not exist in the epoch tree.

Defined in

circuits/src/UserStateTransitionProof.ts:32


historyTreeRoot

historyTreeRoot: bigint

The history tree root being proven against.

Defined in

circuits/src/UserStateTransitionProof.ts:24


idx

Readonly idx: Object

Type declaration

NameType
controlnumber
epochKeysnumber
historyTreeRootnumber
stateTreeLeafnumber

Defined in

circuits/src/UserStateTransitionProof.ts:14


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


stateTreeLeaf

stateTreeLeaf: bigint

The new state tree leaf for the user.

Defined in

circuits/src/UserStateTransitionProof.ts:28


toEpoch

toEpoch: bigint

The epoch the user is transitioning to.

Defined in

circuits/src/UserStateTransitionProof.ts:45

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
configObjectThe variables that will be packed.

Returns

bigint

The control

Example

UserStateTransitionProof.buildControl({
toEpoch,
attesterId,
})

Defined in

circuits/src/UserStateTransitionProof.ts:96