Skip to content

VitalR/parallax-wallet

Repository files navigation

Parallax

Your ENS-named AI LP agent: AI proposes, onchain policy decides.

Give Parallax some ETH and a policy. It plans and reviews range LP actions on your behalf. The wallet is the only thing that can move funds, and it only does so within bounds you signed. Even if the AI is wrong, your funds cannot leave the policy.

The agent thinks on 0G Compute (TEE-verified, OpenAI-compatible inference) with OpenAI as a fallback. It remembers on 0G Storage. It runs on schedule via KeeperHub. It is addressable as you.parallax.eth via ENS. The four are runtime layers of one product, not a sponsor checklist.

Parallax Wallet is an AI smart wallet for Uniswap v4 liquidity management. A user gives the wallet ETH and a policy. The AI agent researches a Uniswap v4 ETH/USDC opportunity, proposes a bounded LP range, and gets an independent review. The wallet can execute only if onchain policy checks pass.

This is not an AI bot with a private key. The AI creates proposals. The smart wallet enforces limits. Every run is stored as an auditable record.

What the demo proves

  • AI reasoning: 0G Compute runs researcher, planner, and reviewer agents.
  • Wallet safety: ParallaxWallet can only execute through authorized policy modules.
  • Uniswap v4 execution: Sepolia ETH/USDC swap + v4 LP mint are bound into the proof.
  • KeeperHub execution: Direct Execution submits an approved policy action.
  • 0G memory: the final run record is uploaded to 0G Storage.
  • ENS identity: wallet and agent roles are indexed as named identities.
  • Refusal: unsafe over-cap actions are rejected before signing and by onchain policy.

60-second proof

Open these first:

npm run demo:replay
jq '.status, .audit.storagePointer, .infrastructure.zerogCompute.status, .refusalCase.observedError' runs/agentic-proof-latest.json
jq '.keeperhub.status, .result.transactionHash' runs/keeperhub-mint-latest.json
jq '.wallet.ensName, .wallet.forwardStatus, .wallet.registry.storedMetadataURI' runs/ens-summary-latest.json

Best artifacts to inspect:

  • runs/agentic-proof-latest.json — final agent proof: 0G Compute, live 0G Storage, policy gate, refusal probe, ENS/registry publish txs.
  • deployments/product-demo.sepolia.json — deployed wallet, modules, Uniswap v4 addresses, policy hash, KeeperHub executor.
  • runs/keeperhub-mint-latest.json — KeeperHub Direct Execution proof.
  • runs/sepolia-eth-usdc-1777560962992.json — live ETH/USDC swap + v4 mint binding.
  • runs/sepolia-policy-block-1777596884531.json — live MaxCapitalExceeded refusal proof.
  • runs/ens-summary-latest.json — current identity state; AgentENSRegistry is synced to the final 0G pointer while Sepolia resolver forward records are reported honestly.

What is real today

  • A modular smart wallet (ParallaxWallet) deployed on Sepolia, with Ownable2Step ownership, ERC-1271 signature validation, and module-only invoke.
  • Two onchain policy modules:
    • PolicyModule — bounds Uniswap v4 LP lifecycle (mint / increase / decrease / collect / burn) by pair, fee, tick spacing, hooks, tick range, capital cap, cooldown, and replay-resistant proposal+review hashes.
    • SwapPolicyModule — same gate model for native ETH → token swaps via Universal Router v4.
  • Live Sepolia evidence:
    • ETH → USDC swap: tx 0x07c0b115435c83526f6f39357ad01e4757a7d408ef6eae504432633a8b50f478
    • ETH/USDC v4 mint (direct executor scenario): tx 0xa3713730955e49b76a2178945d20f0370be5b1ba2ac2457cd8c88622d54101f7, position id 27407, owned by the Parallax wallet.
    • Policy mint via KeeperHub (Direct Execution): completed run; tx 0xe8fae4c5af0185e63ac092eab1b6361fc30c0e5c8391c5bee83f2cfd42169394, execution id ac8ulvfit1t4tk0ngrt2j. Details and artifact path: Verified run in docs/KEEPERHUB_SETUP.md.
    • 0G Compute agent loop — full npm run agent:run with --provider 0g-compute produced status: ready (reviewer approved, deterministic gate all-green, refusal probe blocked off-chain) with infrastructure.zerogCompute.status: live. Verifiable hashes and checklist: docs/ZEROG_COMPUTE_SETUP.md — Verified happy path.
    • 0G Storage final memory — latest proof uploaded to Galileo: 0g://galileo/0xc76a4e62eabf257b48b1f5e712337e30f44a512ed443dbf46523a13fb02f0965; submit tx 0x088a88c3938951721fefaab6ea0ec8b2251296daae231e692a96d8b52dbcb76d.
    • ENS / identityAgentENSRegistry on Sepolia is synced to the final 0G pointer for wallet.parallax.eth, researcher.parallax.eth, planner.parallax.eth, simulator.parallax.eth, reviewer.parallax.eth, and executor.parallax.eth. runs/ens-summary-latest.json reports the registry as live and reports resolver forward records honestly if missing.
    • Refusal: live eth_call against the deployed PolicyModule reverts with MaxCapitalExceeded for an over-cap mint request. See runs/sepolia-policy-block-*.json.
  • An LLM agent loop (npm run agent:run) that:
    1. reads live pool state via Uniswap v4 StateView,
    2. asks an LLM researcher to pick a pair from the policy-allowed candidates,
    3. asks an LLM planner for a typed LiquidityAction proposal inside policy bounds,
    4. evaluates a deterministic gate (tick alignment, amount caps, cooldown, policy hash),
    5. asks an independent LLM reviewer to approve or reject,
    6. re-runs the planner+reviewer with an unsafe intent to prove the agent layer also refuses,
    7. binds everything to the live mint and live blocked-policy hashes,
    8. content-hashes the artifact and persists it (live 0G Storage when configured, local mirror otherwise).

How to run the canonical demo

Install:

npm install

Required env (in .env):

SEPOLIA_RPC_URL=...
OWNER_PRIVATE_KEY=...
# at least one of (0G Compute is primary; OpenAI is the fallback):
# Option A — API key (direct proxy; see docs/ZEROG_COMPUTE_SETUP.md):
ZEROG_COMPUTE_API_KEY=app-sk-...
# Option B — broker SDK path:
# ZEROG_COMPUTE_PROVIDER_ADDRESS=0x...
# ZEROG_COMPUTE_PRIVATE_KEY=...            # broker signer; OWNER_PRIVATE_KEY works in a pinch
PARALLAX_OPENAI_API_KEY=sk-...           # OpenAI fallback (or OPENAI_API_KEY)
# optional, for live 0G Storage:
ZEROG_STORAGE_ENABLED=true
ZEROG_STORAGE_PRIVATE_KEY=...
# optional, for honest ENS labels:
OWNED_ENS_NAME=parallax.eth              # any name you control on Sepolia

To bootstrap 0G Compute broker ledger (one-time; skip if you only use ZEROG_COMPUTE_API_KEY — see API-key path):

npm run zerog:setup -- --deposit 5       # fund the broker ledger from your signer
npm run zerog:setup -- --list            # show live providers
npm run zerog:setup -- --acknowledge 0x... # acknowledge the chosen provider once

See docs/ZEROG_COMPUTE_SETUP.md for the deterministic walkthrough.

To pre-flight 0G Storage (live upload probe):

ZEROG_STORAGE_ENABLED=true npm run zerog:storage-test

The pre-flight prints the resolved signer, balance, calculated storage fee, and resulting rootHash/txHash. See docs/ZEROG_STORAGE_SETUP.md for the deterministic walkthrough.

KeeperHub (live policy execution)

npm run keeperhub:mint -- --dry-run   # print planned executeMintPosition args
npm run keeperhub:mint                # Direct Execution API + poll tx status

Requires KH_API_KEY or KEEPERHUB_API_KEY, a funded KeeperHub org wallet on Sepolia, and onchain PolicyModule / SwapPolicyModule executor equal to that relay address (see Align onchain executor in docs/KEEPERHUB_SETUP.md). For deployments/product-demo.sepolia.json, roles.executor is that KeeperHub relay; roles.owner stays your operator EOA for policy and ENS admin.

You do not need a canvas workflow — this path uses the REST contract-call API only. A recorded successful mint (execution id, tx, runs/keeperhub-mint-latest.json) is under Verified run in the same doc.

Reconcile with scenario:eth-usdc:sepolia: that script signs swap and mint locally using EXECUTOR_PRIVATE_KEY (defaulting to OWNER_PRIVATE_KEY). It only succeeds if that key’s address matches the modules’ executor onchain. With the committed product manifest, that is the KeeperHub relay unless you rotate setExecutor back to your own EOA.

Run the agent loop (live Sepolia, real LLM). --provider selects 0G Compute, OpenAI, or auto (0G first, OpenAI fallback per call); see docs/ZEROG_COMPUTE_SETUP.md — Provider strategy.

npm run agent:run                        # auto: 0G Compute primary, OpenAI fallback
npm run agent:run -- --provider 0g-compute   # all LLM calls via 0G (API key or broker)
npm run agent:run -- --provider openai       # all LLM calls via OpenAI
npm run agent:run -- --intent "Hold the position; do not add capital."
npm run agent:run -- --no-refusal-probe      # skip the unsafe re-prompt

Produces runs/agentic-proof-latest.json containing:

  • research — LLM research output, provider, model, chatId.
  • plan — LLM proposal (pair, tick range, amount caps, liquidity).
  • deterministicGate — onchain-shape policy checks computed locally.
  • review — independent LLM reviewer decision and reasoning.
  • refusalProbe — same agent loop run with an unsafe intent; verifies the agent layer rejects before the chain even has to.
  • executionBinding — bound to the real Sepolia swap/mint hashes and position id.
  • refusalCase — bound to the live MaxCapitalExceeded proof.
  • infrastructure — honest per-layer status (Uniswap, 0G Compute, 0G Storage, ENS, KeeperHub).
  • audit — content hash, run hash, storage pointer (0g://galileo/<id> if live, parallax-local://<hash> otherwise). The final committed Galileo pointer is in runs/agentic-proof-latest.json; an earlier live-storage proof is archived as runs/agentic-proof-1777764206072.json (see docs/ZEROG_STORAGE_SETUP.md — Step 4).

Replay the public proof without private keys:

npm run demo:replay

Re-run the live scenario or the live blocked-policy proof:

npm run scenario:eth-usdc:sepolia
npm run policy-block:sepolia

Push wallet + agent identities into the live AgentENSRegistry on Sepolia:

npm run registry:sync                       # write fresh records / bump pointer
npm run registry:sync -- --dry-run          # show diff only
npm run registry:sync -- --metadata-uri 0g://galileo/0x...   # explicit pointer

Create the ENS subname tree (wallet.<name>.eth, researcher.<name>.eth, …) and parent text records in one idempotent command (best for ENS “AI agents” judging): npm run ens:setup (see docs/ENS_SEPOLIA_SETUP.md).

The sync is idempotent: each role already on-chain with the same address + name + metadata is a no-op, fresh roles get a setAgentIdentity tx, and roles where only the metadata pointer moved get a cheaper setAgentMetadataURI tx. Running npm run agent:run -- --sync-registry (or setting PARALLAX_SYNC_REGISTRY=true) closes the loop: the agent loop persists the artifact, then pushes the new pointer to the registry in the same run, and the artifact's infrastructure.ens.registrySync block records each tx hash.

To upgrade local:wallet to a real your-name.eth resolvable identity on Sepolia, see docs/ENS_SEPOLIA_SETUP.md. For how ENS ties to AgentENSRegistry, 0G Storage, and each agent role (verification checklist + data flow), see docs/ENS_IDENTITY_ARCHITECTURE.md.

Three-minute judge path

Anchored to docs/THREE_DAY_EXECUTION_STRATEGY.md (submission wedge + sponsor boundaries).

  1. Manifest — open deployments/product-demo.sepolia.json: wallet, policyModule, policyHash, roles.
  2. Agent + policynpm run agent:run -- --provider 0g-compute (or auto with OpenAI fallback): show status, deterministicGate, refusalProbe, and infrastructure in runs/agentic-proof-latest.json. Verifiable 0G-only happy path: docs/ZEROG_COMPUTE_SETUP.md.
  3. Onchain execution — Etherscan: scenario mint/swap from executionBinding, or KeeperHub Verified run in docs/KEEPERHUB_SETUP.md.
  4. Blocked policyruns/sepolia-policy-block-*.json + refusalCase in the agentic proof.
  5. Honesty — README Honesty disclosures + runs/ens-summary-latest.json for the current ENS resolver/registry split.

Demo script (60 seconds)

  1. Open deployments/product-demo.sepolia.json — show the wallet, policy modules, and signed policyHash.
  2. npm run agent:run — show research → plan → deterministic gate → reviewer; one panel per LLM call with provider and model.
  3. Show the refusal probe in the same artifact: same wallet, same policy, unsafe user intent, agent layer rejects before signing.
  4. Open a live mint tx on Sepolia Etherscan (direct scenario mint above, or KeeperHub mint from Verified run in docs/KEEPERHUB_SETUP.md); the position NFT belongs to the Parallax wallet when the policy path succeeds.
  5. Open runs/sepolia-policy-block-*.json — show the contract reverts on an over-cap request via eth_call.
  6. Show runs/agentic-proof-latest.json infrastructure block and storage pointer; the final proof records live 0G Storage, ENS publish txs, and registry sync txs.
  7. npm run ens:summary — show the on-chain AgentENSRegistry records: each role has the latest 0g://galileo/... pointer as its metadataURI; Sepolia resolver forward records are reported as matched/missing without overclaiming.

Project layout

contracts/   ParallaxWallet, PolicyModule, SwapPolicyModule, UniswapV4Module, UniswapV4SwapModule, AgentENSRegistry + Foundry tests
src/agents/  LLM client interface, OpenAI client, 0G Compute client, researcher / planner / reviewer
src/cli/     The canonical scripts: deploy, setup, scenario, policy-block, agent:run, demo:replay, ens:summary
src/integrations/uniswap/   v4 StateView reads, pool id, position status
src/integrations/zerog/     content-hashed run-record persistence with local mirror and optional 0G Galileo upload
src/integrations/ens/       live Sepolia ENS read (resolver, address, reverse, text records)
src/integrations/keeperhub/   Direct Execution API client for policy mints
src/integrations/registry/  AgentENSRegistry adapter (on-chain identity writes + idempotent diff)
docs/        final strategy + setup/verification guides; stale planning docs live under docs/archive/

Policy defaults (deployed on Sepolia)

  • Pair: native ETH / Sepolia USDC
  • Fee: 2500
  • Tick spacing: 50
  • Allowed tick bounds: -204100 .. -192100
  • Max ETH per mint: 0.005 ETH, max USDC per mint: 15 USDC
  • Max ETH per swap: 0.002 ETH
  • Mint cooldown: 3600s (intentional — a repeat mint within the hour reverts with CooldownActive).
  • Swap cooldown: 0s

The pool is a small controlled Sepolia pool. Sepolia liquidity proves the execution mechanics, not APY.

Honesty disclosures

  • 0G Compute is a real decentralized inference network with OpenAI-compatible endpoints and TEE attestation. It is not "on-chain LLM" in the literal sense — it is off-chain GPU inference with on-chain settlement and signed responses. We surface the provider address and the ZG-Res-Key chatId in artifacts so verifiers can later check the response signature.
  • 0G Storage is live on Galileo testnet through @0gfoundation/0g-storage-ts-sdk v1.2.8 (the renamed successor to the deprecated @0glabs/0g-ts-sdk). When ZEROG_STORAGE_ENABLED=true the agent loop pays the on-chain storage fee, distributes the artifact to the storage nodes, and records 0g://galileo/<rootHash> as the audit pointer. A 10 KB run artifact costs ~1.4 µOG. The deterministic parallax-local://<contentHash> mirror under runs/storage/ is always written so the artifact stays auditable even when storage is disabled or the testnet is down. Active submission artifacts and active code paths do not use 0g://mock/....
  • ENS identities reflect what is actually owned. If OWNED_ENS_NAME is not configured, names are labelled local:wallet and local:agent/<role>. The deployed AgentENSRegistry on Sepolia (0x151d106084f4dd81c1cc3983d8e14f5f6f3c66cf) is the authoritative on-chain index of these labels and their latest run pointer; npm run registry:sync writes them and npm run ens:summary reads them back. The summary also runs the universal-resolver path (forward address, reverse name, text records) for owned names.
  • KeeperHubDirect Execution submits PolicyModule.executeMintPosition via npm run keeperhub:mint when an API key is set (KH_API_KEY or KEEPERHUB_API_KEY). The KeeperHub org relay must be authorized as executor onchain and match roles.executor in the manifest. The committed product-demo.sepolia.json uses that relay for executor; npm run scenario:eth-usdc:sepolia still signs locally and only works if EXECUTOR_PRIVATE_KEY matches that executor (or after you point setExecutor at your own EOA again). See docs/KEEPERHUB_SETUP.md (including Verified run). Upstream CLI and API docs are on the KeeperHub site.

Product thesis

AI DeFi agents should not be anonymous scripts with private keys. Parallax shows that:

  • a named smart wallet can custody assets,
  • AI can plan and review LP actions,
  • but onchain policy decides what executes,
  • and every decision is auditable on durable memory.

Hard safety belongs in contracts. AI text is audit evidence, not execution authority.

License

MIT — see the repository's LICENSE

Built for

ETHGlobal Open Agents 2026

Parallax is built for the AI-agent wallet track: named autonomous agents, live sponsor infrastructure, and a contract-enforced safety boundary for DeFi execution.

About

ENS-native AI smart wallet for policy-bounded Uniswap v4 liquidity management.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors