User profile picture

Hardware Over Oracles: $0.01 TEE-Backed Randomness API (Offchain)

Chainlink VRF, Switchboard VRF, and other onchain VRF providers are overkill for gacha games and non-crypto applications, but there are still other usecases where verifiable randomness is important. I architected an upto 99%-more cost effective alternative using Intel TDX on Phala Network and Arweave for the Mystery Gift project.

Try it | Source


The Problem

Gacha games, loot boxes, and any random reward system where players spend real money needs verifiable randomness. Chainlink VRF costs $5-50 per request and requires on-chain integration. For a game doing 1,000 daily pulls, that’s $150K+/year just for randomness.

We needed something cheaper that still proves fairness—without the blockchain overhead.


The Solution

TEE-backed randomness. We run a random number generator inside Intel TDX (a hardware Trusted Execution Environment), then attach a cryptographic attestation proving:

  1. The randomness was generated inside genuine Intel hardware
  2. The code hasn’t been tampered with
  3. The specific request was processed
┌─────────────────┐     ┌──────────────────────┐     ┌─────────────┐
│  Client Request │────▶│ TEE generates random │────▶│ Attestation │
└─────────────────┘     └──────────────────────┘     └──────┬──────┘

                       ┌─────────────────┐                  │
                       │ Client Receives │◀─────────────────┘
                       │     Result      │     ┌─────────────┐
                       └─────────────────┘     │  Arweave    │
                                               │   Proof     │
                                               └─────────────┘

The stack:

  • Runtime: Intel TDX (Phala Cloud)
  • Randomness: OS CSPRNG (/dev/urandom) inside the TEE
  • Attestation: TDX quote with hardware measurements
  • Proof storage: Arweave via Turbo SDK (free under 100KB)
  • Payment: x402 protocol (USDC on Base or Solana)

The Cost Breakdown

SolutionCost per RequestAnnual Cost (365K req)Verifiable?
Math.random()$0$0✗ No proof
Our TEE Solution~$0.01~$3,650✓ Hardware attestation
Switchboard VRF~$0.28~$102K✓ On-chain
Chainlink VRF~$5-50~$1.8M-$18M✓ On-chain

For Mystery Gift’s 1,000 daily pulls: ~$6/month vs ~$100K/month with Switchboard or ~$15,000/month with Chainlink.

Why not just use Math.random()? For gacha games where players spend real money, users need to verify fairness. Without proof, you’re asking players to trust you didn’t rig the drops.


When to Use What

Use CaseOur SolutionChainlink VRF
Gacha games / loot boxes✓ Perfect fitOverkill
Off-chain gaming✓ Perfect fitOverkill
On-chain lottery✗ Won’t work✓ Required
DeFi liquidations✗ Won’t work✓ Required

The Tradeoffs

Not deterministic. Same request returns different results—fine for gacha pulls, unusable for smart contracts.

Hardware trust assumption. We trust Intel’s TDX implementation; Chainlink distributes trust across 18+ oracle nodes.

Off-chain only. The attestation proves fairness to your backend, not to a smart contract.

For gacha games, these tradeoffs are acceptable. Users verify the TEE attestation, Arweave provides an immutable audit trail, and the 96% cost savings (vs Switchboard) fund better game development.


Built with Intel TDX, Arweave, and x402.

Tags:

# cryptography

# tee

# api