Operational AI Infrastructure & Autonomous DeFi Safeguards
A technical architecture unifying autonomous AI agent execution with 0G Private Compute planning, Cryptographic Human Approval Gate (ENS Subname Owner Authorization), Uniswap V3 on-chain execution, and 0G Storage immutable audit trails.
1. Abstract & Problem Statement
The rapid emergence of autonomous AI agents operating on public blockchain networks introduces the Web3 AI Agent Trust Trilemma:
- Key Compromise Risk: Exposing private keys to autonomous agent loops risks catastrophic loss of capital if the model is exploited or prompt-injected.
- Absence of Verifiable Human Intent: Onchain smart contracts cannot natively distinguish between an autonomous routine check and a high-stakes unauthorized drain.
- Zero Financial Privacy: Public EVM mempools leak agent trading strategies, stop-loss limits, and spending balances to MEV sandwichers and front-runners.
AegisNet solves this trilemma by introducing a zero-friction, multi-layer security architecture. Agents are assigned granular, revocable identities in AegisSubnameRegistry.sol, restricted by contract-level Enhanced Access Control (EAC), shielded by the ENS Owner Human Approval Gate whenever transaction values meet or exceed configurable thresholds (e.g. $1,000 USD), executed on Uniswap V3, and preserved via Merkle audit records on 0G Storage.
2. Agent Identity & Enhanced Access Control (EAC)
AegisNet establishes granular agent permissions through AegisSubnameRegistry.sol. The owner registers agent operating addresses, binding each to an AgentPermissions record containing strict onchain parameters:
approvalThresholdUSD: Dollar threshold (in 18-decimal precision) triggering mandatory human approval clearance.dailySpendingLimit: Aggregated 24-hour spending cap.whitelistedTargets: Approved target contract adapters (e.g., Uniswap V3 Adapter).isActive: Boolean flag enabling instantaneous owner revocation.
3. ENS Owner Approval Gate & Relayer Attestation
When an agent requests execution via AegisExecutionManager.sol, the contract evaluates the transaction value against the agent's threshold. If valueUSD >= approvalThresholdUSD, the transaction is intercepted and held in a pending state.
To verify genuine human intent and prevent unauthorized drains without exposing credentials, AegisNet leverages a Human Approval Gate with ECDSA relayer attestation, integrated with ENS subname owner authorization:
1. Agent submits proposed transaction payload to requestExecution().
2. Contract emits ExecutionRequested(requestId, requiresApproval = true).
3. Registered ENS domain owner initiates authorization via the Human Approval Gate session.
4. Authorization verifies domain ownership and request parameters onchain.
5. Gateway relayer validates owner authorization against AegisSubnameRegistry.
6. Per-request single-use nullifier \( N = \text{keccak256}(N_{\text{owner}} \mathbin{\Vert} \text{requestId}) \) is committed.
7. Relayer signs attestation digest \( \sigma = \text{Sign}(H(\text{requestId}, N, \text{deadline}, \text{manager}, \text{chainId})) \).
8. Contract verifies signature via approveWithRelayer() and unlocks atomic settlement on Uniswap V3.
4. 0G Private Compute & Decentralized Audit Storage
AegisNet integrates 0G Private Compute for confidential, TEE-attested strategy planning and 0G Storage for tamper-proof audit trails.
| Module | Technology | Function & Invariant |
|---|---|---|
0G Compute |
TEE-attested model (0gm-1.0-35b-a3b) |
Confidential trade strategy formulation, logging verifiable Request IDs. |
0G Storage |
Merkle tree decentralized persistence | Publishes JSON decision records (agent, plan, checks, tx hash) returning root hash. |
Fail-Safe Guard |
Deterministic fallback policy | If 0G is unreachable, no trade is proposed and the UI reports the reason. |
5. Uniswap V3 On-Chain Execution
AegisUniswapAdapter.sol interfaces directly with Uniswap's official SwapRouter02 (0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E) on Ethereum Sepolia. When an authorized request executes, the adapter transfers input assets, sets exact-input single swap parameters with strict slippage protection (amountOutMinimum), and routes output assets directly to the configured recipient.
6. Cryptographic Formalisms
For transaction value \( V_{\text{USD}} \), execution permission \( P_{\text{exec}} \) is formally defined by:
\( P_{\text{exec}} = \mathbb{I}\left(V_{\text{USD}} < T_{\text{approval}}\right) \lor \left(\mathbb{I}\left(V_{\text{USD}} \ge T_{\text{approval}}\right) \land \text{VerifyAttestation}(\sigma, \text{requestId}, N_{\text{nullifier}})\right) \)
The 24-hour rolling spending limit invariant guarantees that cumulative volume does not exceed the allowed allocation:
\( \sum_{t \in [T-24\text{h}, T]} V_{\text{USD}}(t) \le L_{\text{daily}} \)
7. Threat Model & Security Assurance
The protocol is engineered to resist private key leakages, prompt injection attacks, replay attacks, and unauthorized contract calls:
- Nullifier Tracking: Used nullifiers are recorded in mapping
usedNullifiers, preventing proof reuse across requests. - Target Whitelisting: Agents can only execute calls against explicitly whitelisted contracts.
- Daily Cap Rolling Window: 24-hour spending resets prevent cumulative capital depletion.
- Instant Revocation: Owners can immediately deactivate agent permissions onchain via
revokeSubname.
8. Deployed Contracts & Live Sepolia Verification
| Contract Name | Role / Architecture | Sepolia Testnet Address |
|---|---|---|
AegisSubnameRegistry |
Agent Identity, Limits & Target Whitelist | 0x6Dbd89B71e8AB7BF93a9200C6fB81951699549FE |
AegisExecutionManager |
Request Queue, Onchain Gate & Approval | 0x13d7b8Add8265AB1Cfdc3a6E8E60D1b3bcD56fa8 |
AegisUniswapAdapter |
Uniswap V3 SwapRouter02 Execution Adapter | 0x6383A973B4d65a48E489f22F9eD298CA7230C185 |
Relayer Signer |
ECDSA Attestation Signer for Agent Pass | 0x3C29CC205E4fb3e1cA6C89DECDFE5A5d4e46E799 |
Uniswap V3 SwapRouter02 |
Official Uniswap V3 Sepolia Router | 0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E |