non-fungible-agents-BAP-578 README

项目的 README,来自 github.com/ChatAndBuild/non-fungible-agents-BAP-578。合并为一个 markdown 文件:README.md。

BAP578 - Non-Fungible Agents (NFA)

Non-Fungible Agents

Overview

BAP-578 introduces Non-Fungible Agents (NFAs)—programmable, autonomous tokens that act as on-chain "agents" capable of executing tasks, evolving, and interacting with other contracts. This standard merges the uniqueness of NFTs with autonomous functionality, positioning BNB Chain as the home for decentralized automation.

This implementation provides a complete framework for creating, managing, and governing autonomous agent tokens on the BNB Chain with optional learning capabilities that allow agents to evolve and improve over time.

For a comprehensive technical breakdown, read the Whitepaper

🚀 Enhanced Learning Capabilities

BAP-578 now offers two development paths to accommodate different use cases and developer preferences:

Path 1: JSON Light Experience (Default)

Perfect for most developers and immediate deployment:

Path 2: Merkle Tree Learning (Optional)

For advanced developers wanting truly evolving agents:

Key Benefits

Why a Token Standard?

The Need for Standardization

While traditional NFTs (BEP-721) provide uniqueness and ownership, they lack the standardized interfaces needed for autonomous behavior and cross-platform agent interactions. BAP-578 addresses this gap by defining:

  1. Consistent Agent Interfaces: Standardized methods for action execution, state management, and logic upgrades that enable predictable interactions across platforms.

  2. Interoperability Framework: Common patterns for how agents interact with other contracts, services, and each other, creating an ecosystem where agents from different developers can work together.

  3. Hybrid On-Chain/Off-Chain Architecture: Clear separation between on-chain identity and permissions versus off-chain extended experience and complex behaviors, optimizing for both gas efficiency and rich functionality.

  4. Optional Learning System: Standardized interfaces for agent learning and evolution, allowing developers to choose between simple static agents or sophisticated learning agents.

  5. Security Boundaries: Standardized circuit breaker patterns, permission systems, and access controls that protect users and their assets.

On-Chain vs. Off-Chain Components

BAP-578 carefully balances which components belong on-chain versus off-chain:

Component Storage Rationale
Agent Identity On-chain Core identity must be immutable and universally accessible
Ownership & Permissions On-chain Security and access control require consensus verification
Basic Metadata On-chain Essential for marketplace display and basic interactions
Logic Address On-chain Determines how the agent behaves when actions are executed
Learning Tree Root On-chain Cryptographic proof of learning state (32 bytes only)
Extended Experience Off-chain (with hash verification) Rich experience would be prohibitively expensive on-chain
Learning Tree Data Off-chain (with Merkle verification) Detailed learning data with cryptographic integrity
Complex Behaviors Off-chain Advanced AI behaviors require off-chain computation
Voice/Animation Off-chain (with URI reference) Media assets are too large for on-chain storage

This hybrid approach ensures that:

Ecosystem Benefits

Standardization through BAP-578 enables:

  1. Developer Ecosystem: Common interfaces allow developers to build agent-compatible applications without custom integration for each agent implementation.

  2. Marketplace Integration: Platforms can display, trade, and interact with agents using standardized methods, regardless of the agent's specific purpose or learning capabilities.

  3. Cross-Platform Compatibility: Agents can move between applications while maintaining their identity, experience, and learned behaviors.

  4. User Ownership: Clear separation of on-chain and off-chain components ensures users maintain control of their agents' data and behavior.

  5. Innovation Acceleration: Developers can focus on creating unique agent behaviors rather than reinventing infrastructure patterns.

  6. Learning Portability: Agents with learning enabled can carry their knowledge and experience across different platforms and applications.

Key Features

Token Structure

Architecture

The BAP-578 standard consists of the following components:

Core Contracts

Learning System

Interfaces and Examples

Agent Templates

Extended Metadata

BAP-578 tokens include an enhanced metadata structure with:

Basic Metadata

Learning Enhancements

Use Cases

Traditional Agents (JSON Light Experience)

Learning Agents (Merkle Tree Learning)

Quick Start

Installation

npm install

Compile Contracts

npm run compile

Run Tests

npm test

Deploy

# Local development
npm run deploy

# BSC Testnet
npm run deploy:testnet

# BSC Mainnet  
npm run deploy:mainnet

Interact with Contract

# Interactive CLI
npm run interact:testnet

Verify on BSCScan

# Automatic verification
npm run verify:testnet

# Manual verification guide
npm run verify:manual:testnet

BAP-578 Dev Kit (SkillsHub)

To streamline adapter design, vault safety checks, deployment sequencing, and test scaffolding, this repository includes a SkillsHub-based Dev Kit guide.

Install commands:

npx @skillshub/bap578-adapter-blueprint
npx @skillshub/bap578-vault-checklist
npx @skillshub/bap578-deploy-plan
npx @skillshub/bap578-test-template
npx @skillshub/bap578-contract-idea-sprint

Optional local skeletons included:

Contract Structure

AgentMetadata

struct AgentMetadata {
    string persona;       // JSON traits/style
    string experience;    // Agent's role/expertise
    string voiceHash;     // Voice identifier
    string animationURI;  // Animation resource
    string vaultURI;      // Vault resource
    bytes32 vaultHash;    // Vault identifier
}

Key Functions

Environment Setup

Create a .env file:

DEPLOYER_PRIVATE_KEY=your_private_key_here
TESTNET_RPC_URL=https://data-seed-prebsc-1-s1.binance.org:8545/
MAINNET_RPC_URL=https://bsc-dataseed.binance.org/
BSCSCAN_API_KEY=your_bscscan_api_key_here

Network Configuration

Available Scripts

Command Description
npm test Run test suite
npm run compile Compile contracts
npm run deploy Deploy to local network
npm run deploy:testnet Deploy to BSC testnet
npm run deploy:mainnet Deploy to BSC mainnet
npm run interact Interactive CLI
npm run verify:testnet Verify on testnet BSCScan
npm run clean Clean artifacts
npm run coverage Generate test coverage

License

MIT

non-fungible-agents-BAP-578 (ChatAndBuild/non-fungible-agents-BAP-578)

正在搜索数据库…

这是什么?BAP-578 是面向 BNB Chain 的非同质化智能体(NFA)代币标准:这是一种可编程的自主代币,可以作为链上智能体,执行任务、维护状态,并可选择随时间学习和进化。
这只是一个代币标准,还是一个完整的开发框架?两者兼有:它是一个扩展了 BEP-721、加入智能体专用函数的代币标准,同时也是一套完整的智能合约框架,包含工厂合约、治理、金库、学习模块以及现成的智能体模板。
我该如何开始构建和部署智能体?Quick Start 部分会依次介绍安装依赖、编译合约、运行测试、部署到 BNB Chain,以及在 BSCScan 上验证已部署的合约。此外,还附带了 SkillsHub Dev Kit,其中包含文档和一份 15 分钟入门指南,可用于适配器设计和测试脚手架搭建。
使用 BAP-578 智能体需要准备什么?你需要在 BNB Chain 上持有 BNB,用于部署和为智能体充值,因为在前三个免费智能体之后,每次铸造需花费 0.01 BNB;同时还需要一套类似 Solidity/Hardhat 的工具链,用于编译、测试和部署智能合约。
所有智能体默认都具备学习能力吗?不是,学习功能需要主动开启。智能体默认使用简单的 JSON Light Experience 路径;而能让智能体真正进化的 Merkle Tree Learning 路径则是可选的、更高级的选择。
这个标准面向哪些人?它面向 BNB Chain 智能合约开发者,用于构建自主链上智能体,适用场景包括 DeFi 投资组合管理、DAO 参与、游戏 NPC,以及由 AI 驱动的品牌或个人助理等。
仓库开箱即用地提供了哪些智能体模板?仓库包含 StrategicAgent、DeFiAgent、GameAgent、DAOAgent、CreatorAgent、DAOAmbassadorAgent、LifestyleAgent、FanCollectibleAgent,以及用于测试基础智能体交互的 MockAgentLogic 模板。
Merkle Tree Learning 如何降低 gas 费用?链上只存储智能体学习树的一个 32 字节 Merkle 根,详细的学习数据保存在链下,并通过与该根进行的密码学验证来确保其可靠性。
为什么要提出新标准,而不直接使用 BEP-721 NFT?普通的 BEP-721 NFT 只提供唯一性和所有权,但缺乏针对自主行为、跨平台智能体互操作性以及可选链上学习的标准化接口;BAP-578 正是在此基础上补充了这些能力。
该标准包含哪些安全机制?它包含 CircuitBreaker 合约,用于全局或针对特定合约的紧急暂停;包含 VaultPermissionManager,用于对链下数据进行限时授权访问;还包含一个专门的治理合约,用于协议层面的变更。
大小
3.5 MB
星标
423
更新
提交May 22
时长
1年
提交 · 90 天