zkVerify blog

Deep Dive: Phala x zkVerify Integration for TEE Applications

deep dive : phala x zk verify integration for tee applications
zkVerify
zkVerify

Deep Dive: Phala x zkVerify Integration for TEE Applications

In our first video, we introduced the Phala integration with zkVerify and outlined how this collaboration strengthens trust in TEE (Trusted Execution Environment) applications. Today, we’re going deeper—showing just how simple it is for developers to integrate zkVerify into their existing TEE workflows.

Watch the Deep Dive

In this video, Arman from zkVerify DevRel walks through the Phala integration and shows exactly how simple it is to verify TEE attestations with zkVerify:

Verifying Phala Attestations on zkVerify

The first update: the Phala Explorer now natively supports zkVerify.

This means that when you view a TEE attestation in the explorer, you can go to Onchain Attestation → Verify with zkVerify and complete verification directly on-chain. No extra steps required.

Random Number Generation on TEE + zkVerify

For this demo, we built a simple random number generator (RNG) application. Randomness is a crucial primitive in blockchains—powering lotteries, gaming, consensus mechanisms, and more. Traditionally, blockchains rely on Oracles for randomness. But what if randomness could be generated and attested directly at the TEE level?

Here’s how it works:

  1. Random Number Creation – Inside the TEE, the app generates a random number using a simple math.random function.
  2. Attestation – The TEE produces an attestation confirming the random number came from secure hardware.
  3. zkVerify Proof Pipeline – That attestation is sent to zkVerify, verified on SP1, and finalized on-chain—ready to be used by any connected application.

This process removes the need for external Oracles while maintaining trust, security, and verifiability.

How Developers Can Integrate

We designed the integration to be as simple as possible.

  • Frontend Applications:
    Use the useZkVerify hook from the FRA Code Explorer repo. Just pass your attestation into the hook, and display the verification status (zkStatus) in your UI.
  • Backend Applications:
    Even simpler—just make two API calls:
    1. Submit the attestation to zkVerify.
    2. Query the verification status.

All the complexity—proof generation on SP1, verification through zkVerify Relayer, etc.—is handled behind the scenes by our servers.

Demo Walkthrough

In our RNG app demo, the flow looks like this:

  1. Generate a random number in the TEE.
  2. Use the Phala SDK to create attestation (TDX code).
  3. Pass the attestation to zkVerify.
  4. Pipeline runs: attest → prove → verify.
  5. Final output: a transaction hash confirming verification across all zkVerify-supported networks.

This attestation can now be consumed by any on-chain application that requires randomness.

Cost Savings

Beyond ease of use, zkVerify delivers significant cost reductions:

  • Proving: ~20% savings
  • Verification: 90%+ savings on gas fees

That means developers can scale applications without being burdened by prohibitive costs.

Closing Thoughts

Phala’s integration with zkVerify demonstrates how easy and impactful it is to bring ZK verification into TEE applications. Whether you’re building RNG, privacy-preserving DeFi, or other TEE-based tools, zkVerify makes trustless verification seamless and cost-efficient.

If you’re a developer building with TEEs and want to try this out, check the Phala Explorer or dive into the FRA Code Explorer repository. And if you have questions, the zkVerify team is here to help.