Skip to main content

Public inputs-only

This sub-section assumes that you are trying to create a Type-4 Market that doesn't support confidential inputs and that your IVS enclave containing the proof verification logic is ready. It also assumes that you have kalypso-sdk set up correctly.

The steps below will use kalypso-sdk to help you connect the proof verification logic in the IVS enclave with the rest of Kalypso contracts so that proofs can be verified and Requests can be settled correctly.

Steps

  • Fetch the attestation of the enclave

    const ivsAttestationData = await kalypso.MarketPlace().IvsEnclaveConnector().getAttestation()
  • Extract PCRs from the Attesatation Data

    const ivsImagePcrs = KalypsoSdk.getRlpedPcrsFromAttestation(ivsAttestationData.attestation_document);
  • Finally broadcast the transaction to create the TeeVerifier

    const tx = await kalypso
    .MarketPlace()
    .createTeeVerifier(await wallet.getAddress(), kalypsoConfig.tee_verifier_deployer, kalypsoConfig.attestation_verifier, ivsImagePcrs);

    Note down the transaction hash. The transaction will create a new contract whose address can be found on a chain explorer.

    todo! (programmatically fetch the tee proof verifier address)

kalypso-tutorial/index.ts
    <!--  Existing Code Setup -->
const ivsAttestationData = await kalypso.MarketPlace().IvsEnclaveConnector().getAttestation();
console.log({ ivs_enclave_key: ivsAttestationData.secp_key });
const ivsPubKey = PublicKey.fromHex(ivsAttestationData.secp_key as string);
console.log({ ivs_compressed: ivsPubKey.compressed.toString("hex") });

const ivsImagePcrs = KalypsoSdk.getRlpedPcrsFromAttestation(ivsAttestationData.attestation_document);
console.log({ ivsImagePcrs });

const data = await kalypso
.MarketPlace()
.createTeeVerifier(await wallet.getAddress(), kalypsoConfig.tee_verifier_deployer, kalypsoConfig.attestation_verifier, ivsImagePcrs);

console.log("Tee Verifier Creation Receipt hash", data.hash);

Verify the enclave key

Finally verify the enclave key of the deployed enclave

kalypso-tutorial/index.ts
// Existing Code
const data = await kalypso
.MarketPlace()
.verifyTeeKey(teeVerifier, generatorAttestationData.attestation_document);
console.log("Tee Verifier VerifyKey tx receipt hash", data.hash);
  • teeVerifier: Address of the teeVerifier contract

If the transaction hash is successfully received, it implies that the verification was successful. The function reverts otherwise.