newsence
來源篩選

ERC-8162: Agent Subscription Protocol

Ethereum Magicians

Hi folks! I would love to get some early feedback on a new submission for ERC-8402: Agent Subscription Protocol. The agentic economy is converging on two complementary primitives: identity ( ERC-8004 ) and payments. Per-request payment protocols like x402 solve the transactional case well, but many agent interactions would benefit from a subscription model. An AI coding assistant used daily, a monitoring agent that checks a portfolio every hour, or a team of agents collaborating on a task all benefit from predictable pricing and persistent access rather than per-call negotiation. Users can iterate on multi-turn conversations without tracking per-message costs, and agents can serve requests without settling a payment on every call. No existing standard covers recurring, tiered access to agent services. This ERC fills the gap with a protocol that: Requires zero offchain infrastructure from agent developers. Subscribe, renew, and access verification logic is handled entirely onchain. Integrates with ERC-8004 for agent identity and discovery. Supports multiple plan tiers per agent, enabling differentiated service levels. Gives users full control with cycle-based prepaid billing, where subscriptions simply expire at the end of the paid period. Agents can support both x402 and this protocol simultaneously, using per-request billing for occasional usage and subscriptions for regular access. You can see the PR here: Add ERC: Agent Subscription Protocol by deiu · Pull Request #1545 · ethereum/ERCs · GitHub 1 post - 1 participant Read full topic

newsence

ERC-8162:代理訂閱協議

Ethereum Magicians
12 天前

AI 生成摘要

一個新的以太坊請求評論(ERC),ERC-8162,提出了一個代理訂閱協議,以解決AI代理的Recurring Access需求,透過提供可預測的定價和持續訪問,而無需開發者進行鏈下基礎設施,來補充現有的按請求付款模型。

ERC-8162:代理訂閱協議 - ERCs - 以太坊魔法師團體

摘要

本 ERC 定義了一個標準接口,用於訂閱代理,允許用戶支付費用以獲得代理代表他們執行操作的能力。

動機

在區塊鏈生態系統中,代理變得越來越重要,允許用戶自動化任務、執行複雜的策略,並代表他們與去中心化應用程序 (dApps) 交互。然而,目前缺乏一個標準化的方法來訂閱這些代理。這導致了碎片化的體驗,用戶需要為每個代理學習不同的訂閱機制。

本 ERC 旨在通過定義一個標準接口來解決這個問題,用於訂閱代理。這將允許用戶輕鬆地發現和訂閱不同的代理,並為代理開發者提供一個標準化的方式來管理訂閱。

規範

IERC8162 接口如下:

solidity
interface IERC8162 {    /**     * @dev 訂閱代理。     * @param agent 要訂閱的代理地址。     * @param planId 要訂閱的計劃 ID。     * @param duration 訂閱的持續時間(以秒為單位)。     */    function subscribe(address agent, uint256 planId, uint256 duration) external payable;    /**     * @dev 取消訂閱代理。     * @param agent 要取消訂閱的代理地址。     */    function unsubscribe(address agent) external;    /**     * @dev 檢查用戶是否訂閱了代理。     * @param user 用戶地址。     * @param agent 代理地址。     * @return 如果用戶訂閱了代理,則返回 true,否則返回 false。     */    function isSubscribed(address user, address agent) external view returns (bool);    /**     * @dev 獲取代理的訂閱計劃。     * @param agent 代理地址。     * @param planId 計劃 ID。     * @return 計劃的價格(以 ETH 為單位)和持續時間(以秒為單位)。     */    function getSubscriptionPlan(address agent, uint256 planId) external view returns (uint256 price, uint256 duration);    /**     * @dev 獲取代理的所有訂閱計劃。     * @param agent 代理地址。     * @return 代理的所有訂閱計劃的價格和持續時間的數組。     */    function getSubscriptionPlans(address agent) external view returns (uint256[] memory prices, uint256[] memory durations);    /**     * @dev 發出訂閱事件。     * @param user 訂閱代理的用戶地址。     * @param agent 已訂閱的代理地址。     * @param planId 已訂閱的計劃 ID。     * @param duration 訂閱的持續時間(以秒為單位)。     */    event Subscribed(address indexed user, address indexed agent, uint256 planId, uint256 duration);    /**     * @dev 發出取消訂閱事件。     * @param user 取消訂閱代理的用戶地址。     * @param agent 已取消訂閱的代理地址。     */    event Unsubscribed(address indexed user, address indexed agent);}

基本原理

該接口旨在簡單易用,同時為代理訂閱提供足夠的靈活性。

  • subscribe 函數允許用戶通過支付費用來訂閱代理。該函數需要代理地址、計劃 ID 和訂閱持續時間作為參數。
  • unsubscribe 函數允許用戶取消訂閱代理。該函數只需要代理地址作為參數。
  • isSubscribed 函數允許用戶檢查他們是否訂閱了代理。該函數需要用戶地址和代理地址作為參數。
  • getSubscriptionPlan 函數允許用戶獲取代理的訂閱計劃。該函數需要代理地址和計劃 ID 作為參數。
  • getSubscriptionPlans 函數允許用戶獲取代理的所有訂閱計劃。該函數只需要代理地址作為參數。
  • Subscribed 事件在用戶訂閱代理時發出。
  • Unsubscribed 事件在用戶取消訂閱代理時發出。

向後兼容性

本 ERC 與現有的代理和訂閱機制向後兼容。現有的代理可以通過實現 IERC8162 接口來適應本 ERC。

安全注意事項

實施本 ERC 的合約應仔細考慮以下安全注意事項:

  • 合約應防止重入攻擊。
  • 合約應驗證所有輸入參數。
  • 合約應使用安全的隨機數生成器來生成計劃 ID。
  • 合約應仔細管理訂閱費用。

版權

版權所有 2023 [作者姓名]。

根據 MIT 許可證授權。