Skip to content

Set request

Important

Before setting your request please ensure you have created a credential request.

To add your criteria to the Receptor Smart Contract for verification, you need to call the setZKPRequest function. This function is inherited in the Receptor Smart Contract from the ZKP Verifier.

For example we set a criteria for “to be born before 01/01/2002”;

Crafting Query

const query = {
  requestId: requestId,
  schema: SchemaHash,
  claimPathKey: ClaimPathKey,
  operator: OPERATORS.LT, // operator
  value: [CRITERIA_VALUE, ...new Array(63).fill(0).map((i) => 0)],
};
  • requestId: ID associated with the request.
  • schema: bigInt representation of schema of requested credential.
  • claimPathKey: Represents the path to the queries key inside the merklized credential.
  • operator: Choose values between 1-6 to set criteria. Refer to Queries
  • value: Criteria based on which we want to verify a User.

Setting ZKPRequest

The setZKPRequest uses the above query and interacts with the Receptor Smart Contract to set the criteria for verification.

let tx = await BSC.setZKPRequest(
  newRequestId,
  validatorAddress,
  query.schema,
  query.claimPathKey,
  query.operator,
  query.value
);
  • requestId: ID associated with the request.
  • validatorAddress: Address of deployed MTP validator; CredentiaAtomicQueryMTPValidator.
  • query: Query contains values for setting criteria.

Next Up: Embed proof →