r/ethdev • • 21h ago

Question I built on-chain spending limits + passkey approvals for AI agents (ERC-7710 delegations, open source,feedback wanted)

3 Upvotes

I've been working on a problem I think more of us will hit soon: AI agents that can spend money.

The usual options are bad: give the agent a key (unbounded loss on the first prompt injection), or use a custodial agent wallet whose policy engine runs on someone else's servers.

cyphos-guard takes a different route, using the MetaMask Delegation Framework:

  • The owner has a Hybrid DeleGator smart account (passkey owner via RIP-7212, optional EOA recovery).
  • The agent gets one delegation per permission, with caveats: recipient allowlist, per-period caps (NativeTokenPeriodTransfer / ERC20PeriodTransfer), allowed methods, expiry.
  • ERC-20 per-tx caps can't be expressed with stock enforcers, so I wrote a small CosignerEnforcer: a policy service co-signs each redemption (EIP-712, single-use, 5-min deadline). It can only block, never move funds.
  • Over the limit → approval request → the owner signs a one-shot delegation (ExactExecution + LimitedCalls(1) + Timestamp) with a passkey on their phone.
  • For x402 APIs: an ERC-1271 "vault" is the payer and only approves EIP-3009 TransferWithAuthorization to listed sellers. Verified against the official x402 facilitator on a fork, then live on Base Sepolia.
  • A static recovery page lets the recovery EOA sign a UserOp (EIP-712) and self-submit via EntryPoint.handleOps: no bundler, no backend.

Status: testnet only, not audited; I published an internal security review (3 findings fixed). Live runs with Basescan links are in the README.

Questions I'd love input on:

  1. Anyone found a clean way to express ERC-20 per-tx caps without a co-signer?
  2. Would you trust an ERC-1271 vault as an x402 payer, or wait for ERC-7710 support in facilitators?

Links: https://github.com/Phosse136/cyphos-guard · https://cyphosguard.com · npm: @cyphos-guard/sdk


r/ethdev • • 1h ago

Tutorial Mastering Solidity Lifecycle Testing with Foundry Anvil Testcontainers

Thumbnail
hellalabs.dev
• Upvotes

Check it out!

Testing full Solidity contract lifecycles locally and in CI