Deploy Your ERC-8004 Agent in TEE

January 29, 2026
5 min read
Deploy Your ERC-8004 Agent in TEE

In under five minutes, this guide shows you how to deploy a powerful AI agent that combines confidential computing with blockchain identity. You will launch an agent that runs in a hardware-secured Trusted Execution Environment (TEE) and possesses a verifiable on-chain identity using the ERC-8004 standard.

This approach solves a critical problem: how to trust autonomous agents. By giving your AI a secure, on-chain passport, you enable it to interact verifiably with the decentralized world.

What You'll Build

An AI agent that:

  • Runs in Intel TDX (trusted execution environment)
  • Has verifiable on-chain identity (ERC-8004)
  • Signs messages with TEE-derived keys
  • Executes Python/shell code securely
  • Provides cryptographic attestation proofs

Prerequisites


Step 1: Fork the Template

  1. Go to github.com/Phala-Network/erc-8004-tee-agent
  2. Click Fork to create your own copy
  3. Clone locally to customize:
    git clone https://github.com/YOUR_USERNAME/erc-8004-tee-agent.git
    cd erc-8004-tee-agent
    

Step 2: Configure Your Agent

Copy the environment template:

cp .env.example .env

Edit .env with your values:

# Required secrets
GITHUB_REPO=https://github.com/YOUR_USERNAME/YOUR_REPO.git
GIT_COMMIT_HASH=YOUR_PRODUCTION_COMMIT_HASH
AGENT_SALT=my-unique-agent-salt-12345
SUBGRAPH_API_KEY=<your-graph-api-key>
REDPILL_API_KEY=<your-redpill-key>

Important: The AGENT_SALT determines your wallet address. Use a unique, secure value and keep it secret.

Optionally customize agent_config.json:

{
  "metadata": {
    "name": "My TEE Agent",
    "description": "Your agent description"
  }
}

Step 3: Commit Your Changes

git add .
git commit -m "Configure my TEE agent"
git push origin main

Note your commit hash:

git rev-parse HEAD

Step 4: Deploy on Phala Cloud

  1. Go to cloud.phala.com or use the Phala Cloud CLI
  2. Click Deploy New CVM
  3. Upload docker-compose.yml from your repository

Configure Your Instance

SettingValue
OSdstack-0.5.x or later
Instance2+ vCPU, 4GB+ RAM, 10GB+ storage

Set Environment Variables

Add these as encrypted secrets:

VariableValue
GITHUB_REPOhttps://github.com/YOUR_USERNAME/erc-8004-tee-agent.git
GIT_COMMIT_HASHYour commit hash from Step 3
AGENT_SALTYour unique secret salt
SUBGRAPH_API_KEYYour Graph API key
REDPILL_API_KEYYour RedPill API key

Click Deploy and wait for provisioning (~2-3 minutes).

Deploy Through CLI

# Sign into your Phala Cloud Account
npx phala auth login

# Set your .env variables
cp .env.example .env

# Deploy to Phala Cloud
npx phala deploy -e .env

Step 5: Access Your Agent

  1. Go to View Details → Networks
  2. Your agent URL: https://<app-id>-8000.<gateway-domain>
  3. Open it in your browser

You'll see the Dashboard with your wallet address.


Step 6: Fund Your Wallet

  1. Copy your wallet address from the Dashboard
  2. Send ~0.01 Sepolia ETH to this address

Get free Sepolia ETH from:

Wait for the transaction to confirm.


Step 7: Register Your Agent

On the Dashboard:

  1. Step 1: Register Identity
    • Click Register
    • Wait for blockchain confirmation (~15-30 seconds)
  2. Step 2: Submit Reputation
    • Click Submit Initial Reputation
    • This creates your on-chain reputation entry

Your agent now has an on-chain identity!


Step 8: Start Chatting

Click Developer API to access the chat interface.

Try these commands:

  • "What's my wallet address?"
  • "Generate an attestation proof"
  • "Run this Python code: print('Hello from TEE!')"
  • "Sign this message: Hello World"

Verify Your Agent

Check On-Chain Registration

Visit Sepolia Etherscan and search for:

  • IdentityRegistry: 0x8004A818BFB912233c491871b3d84c89A494BD9e
  • ReputationRegistry: 0x8004B663056A597Dffe9eCcC1965A193B7388713

Your agent should appear in both registries.

Verify TEE Attestation

In the chat, ask:

Generate an attestation proof

The response includes:

  • TDX quote (cryptographic proof)
  • Event log (execution trace)
  • Verification info

Customization

Change Agent Metadata

Edit agent_config.json:

{
  "metadata": {
    "name": "My Custom Agent",
    "description": "What my agent does"
  },
  "capabilities": {
    "domains": ["finance", "data-analysis"],
    "skills": ["python-execution", "api-integration"]
  }
}

Add Custom Tools

Modify src/agent/chat_agent.py to add capabilities:

  • Database queries
  • External API calls
  • Custom computations

Update Your Deployment

After changes:

git add . && git commit -m "Update agent"
git push origin main

Get new commit hash and update GIT_COMMIT_HASH in Phala Cloud, then redeploy.


Troubleshooting

"Agent not registered"

  • Check wallet has sufficient ETH
  • Verify the transaction confirmed on Etherscan

"Subgraph query failed"

"Chat not responding"

  • Verify REDPILL_API_KEY is valid
  • Check logs in Phala Cloud dashboard

Need Help?


Congratulations! You've deployed a TEE-secured AI agent with on-chain identity.

Recent Posts

Related Posts