Randomness TEE Service

Verifiable randomness service powered by Phala Trusted Execution Environment.

Overview

Located at services/verifiable-randomness-service, this service provides:

  • Hardware-backed random number generation
  • Remote attestation proofs
  • Replay attack prevention
  • x402 payment support

Why TEE?

Using Intel TDX (Trusted Domain Extensions):

  • Private keys never leave the enclave
  • Cryptographic proof of hardware security
  • Cannot be manipulated by software attacks
  • Compliant with verifiable randomness requirements

API Endpoints

Generate Random Seed

POST /api/v1/generate

Returns a verifiable random seed with attestation proof.

Integration

Randomness service is integrated with:

  • Livestream Server (raffle winner selection)
  • Marketplace API (pack opening)

Running Locally

cd services/verifiable-randomness-service
pnpm dev

Environment

Required variables:

  • PAYMENT_WALLET - Wallet for receiving payments

Next Steps