@tinybirdpro/plugin-opaque
v0.1.3
Published
ElizaOS plugin for Opaque - Zero-knowledge proof generation in AWS Nitro Enclave for privacy-preserving blockchain transactions
Maintainers
Readme
@tinybirdpro/plugin-opaque
ElizaOS plugin for Opaque - Zero-knowledge proof generation in AWS Nitro Enclave for privacy-preserving blockchain transactions.
Features
- Privacy-Preserving: Generate ZK proofs inside from Enclave Endpoints
- Policy Enforcement: Enforce spending limits, time windows, and whitelists
- Blockchain Integration: Execute transactions on Mantle with verified proofs
- Secure: Proofs generated in hardware-isolated environment
- Easy Integration: Simple ElizaOS plugin interface
Installation
npm install @tinybirdpro/plugin-opaque
# or
bun add @tinybirdpro/plugin-opaqueConfiguration
Add these environment variables to your .env file:
# Agent Wallet Configuration
AGENT_PRIVATE_KEY=0x...
# User Configuration
OPAQUE_USER_ADDRESS=0x...
OPAQUE_INSTALLATION_ID=1
# Contract Addresses (Mantle Sepolia)
OPAQUE_VERIFIER_ADDRESS=0x...
OPAQUE_TOKEN_ADDRESS=0x...
# Enclave URL
OPAQUE_ENCLAVE_URL=http://{INSTANCE-IP}:8001Usage
In your ElizaOS character file:
{
"name": "YourAgent",
"plugins": ["@tinybirdpro/plugin-opaque"],
"settings": {
"secrets": {}
}
}Example Interaction:
User: Send 50 USDC to 0x1234...5678
Agent: I'll execute this transaction with privacy protection using Opaque.
[Generates ZK proof in enclave]
[Verifies on-chain]
✅ Transaction executed: 0xabcd...How It Works
- Policy Storage: User policies are stored in a remote Enclave
- Proof Generation: When executing a transaction, the agent:
- Sends transaction data to the enclave via proxy url
- Enclave validates against stored policies
- Generates a ZK proof if policies are satisfied
- On-Chain Verification: Proof is verified on-chain before execution
- Transaction Execution: If proof is valid, transaction executes
Architecture
ElizaOS Agent
↓
Plugin Opaque
↓
AWS Nitro Enclave (Port 8001)
├── Policy Storage
├── Noir Circuit
├── Barretenberg (ZK Proof)
└── Offline CRS Cache
↓
Mantle Blockchain
├── Verifier Contract
└── Vault ContractAPI
Actions
EXECUTE_OPAQUE_TRANSACTION
Execute a transaction with ZK proof generation.
Parameters:
recipient: Address to send tokens toamount: Amount to send (in token units)
Example:
{
"action": "EXECUTE_OPAQUE_TRANSACTION",
"recipient": "0x1234567890123456789012345678901234567890",
"amount": "50000000000000000000"
}Policy Configuration
Policies are configured per user and installation:
{
"maxAmount": {
"enabled": true,
"limit": "100000000000000000000" // 100 tokens
},
"timeWindow": {
"enabled": true,
"startHour": 9,
"endHour": 17
},
"whitelist": {
"enabled": true,
"root": "0x...",
"path": ["0x...", "0x..."],
"index": 0
}
}Enclave Attestation
The enclave provides cryptographic proof that proofs are generated in a genuine AWS Nitro Enclave:
PCR0: c498ee76151fbd1cf0a5824cb958a2b6dfd4757eeebc0997abefa62ad095693bf5714aa6b8122836f67bc43b27c792ba
Anyone can verify by rebuilding the enclave and comparing PCR measurements.
Development
# Install dependencies
bun install
# Build plugin
bun run build
# Run tests
bun testLinks
License
MIT
Support
For issues and questions:
- GitHub Issues: https://github.com/acgodson/opaque/issues
- Enclave Endpoint: http://{instance-pubic-ip}:8001
