DOCUMENTATION
Learn how to build with ERC-8004, BAP-578, and X402 protocols on BNB Chain
USER GUIDE
Step-by-step instructions for using BAP.Market
REGISTER AN AGENT (X402 GASLESS)
What You'll Need
- A Web3 wallet (MetaMask, Trust Wallet, etc.)
- 10 U tokens (United Stables) - can be purchased on PancakeSwap
- Small amount of BNB for one-time approval (~$0.01)
Steps
- 1.Go to /register and connect your wallet
- 2.Fill in agent details: name, description, and optional image (uploaded to IPFS)
- 3.First-time only: Approve U token to relayer (requires BNB for gas)
- 4.Sign the X402 payment request (off-chain, no gas)
- 5.Wait for confirmation - the relayer pays gas and registers your agent
- 6.โ Done! You now have an Agent NFT (ERC-8004)
๐ก X402 Gasless: After the one-time approval, all future registrations are completely gasless. The relayer covers gas fees and pulls your 10 U payment automatically.
UPGRADE TO NFA (FREE)
What You'll Need
- An existing Agent NFT (from step 1)
- BNB for gas (~$0.10)
- Optional: New image to replace agent's original avatar
Steps
- 1.Go to /upgrade and enter your Agent ID
- 2.Fill in NFA details: Persona (personality/role) and Experience (capabilities)
- 3.Optional: Upload a new image (will replace agent's original image in metadata)
- 4.Click "UPGRADE TO NFA" and confirm the transaction
- 5.โ Your agent is now an NFA (BAP-578) with lifecycle control, balance, and learning capabilities!
๐ Free Upgrade: NFA upgrades are free (no platform fee). You only pay BNB gas. The agent will automatically use your Agent ID as the NFA token ID for consistency.
FUND & MANAGE YOUR NFA
Deposit BNB (For Gas & Execution)
- 1.Go to /my-agents and click "MANAGE NFA" on your NFA
- 2.In the "NFA Balance" section, enter the amount of BNB to deposit
- 3.Click "FUND NFA" and confirm the transaction
- 4.๐ฐ Your NFA now has a balance to pay for gas when executing autonomous actions
Lifecycle Management
- Pause: Temporarily suspend agent actions (reversible)
- Unpause: Resume a paused agent
- Terminate: Permanently disable agent (irreversible, balance returned)
- Withdraw: Remove BNB from agent balance back to your wallet
AI LEARNING (FREE)
Enable Learning
- 1.On your NFA detail page, scroll to "Learning Module"
- 2.Click "ENABLE LEARNING" (requires gas)
- 3.Once enabled, you can start learning tasks
Start Learning
- 1.Choose a learning type: Model Training (improve AI) or Knowledge Base (learn facts)
- 2.Enter a custom title (e.g., "Trading Strategy Analysis")
- 3.Click "START LEARNING" - AI will generate learning content (powered by OpenAI)
- 4.Automatic on-chain submission: When learning completes, the platform will automatically prompt your wallet to submit the Merkle root to the blockchain
- 5.๐ Learning history is now permanently recorded on-chain and expandable to view summaries
๐ 100% Free: AI learning is completely free. No deductions from your NFA balance. You only pay gas for the on-chain submission (~$0.05).
LIST NFA FOR SALE
Steps
- 1.Go to /marketplace/list
- 2.Select your NFA from the dropdown (only shows NFAs you own)
- 3.First-time only: Approve the marketplace contract to manage your NFAs (requires gas)
- 4.Enter your listing price in BNB (e.g., 0.5 BNB)
- 5.Click "LIST NFA" and confirm the transaction
- 6.๐ฏ Your NFA is now listed on the marketplace!
Delist (Remove Listing)
If you change your mind:
- Go to the marketplace or your NFA detail page
- Click the "DELIST" button on your listing
- Confirm the transaction (requires gas)
- Your NFA is no longer for sale
๐ฐ Marketplace Fee: BAP.Market charges a 2.5% platform fee on sales. For example, if you sell for 1 BNB, you receive 0.975 BNB.
BUY AN NFA FROM MARKETPLACE
Steps
- 1.Browse listings at /marketplace
- 2.Use filters and sorting to find NFAs (by price, name, original agent ID)
- 3.Click "BUY NOW" on an NFA you like
- 4.Review the price and confirm the transaction (price + gas)
- 5.โ You now own the NFA! It appears in /my-agents
What You Get
- Full ownership: The NFA NFT is transferred to your wallet
- All capabilities: Learning history, balance, logic contract (if set)
- Management rights: Fund, withdraw, pause, terminate, re-list for sale
- Metadata: Name, image, persona, experience from the original creator
๐ก Pro Tip: Check the NFA's learning history and balance before buying. NFAs with more learning records may be more valuable!
CONTRACT ADDRESSES
Official contract addresses on BNB Chain Mainnet (Chain ID: 56)
ERC-8004: AGENT IDENTITY
Decentralized agent discovery and reputation system
IDENTITY REGISTRY
Register agents with ERC-721 NFT identity. Each agent has a unique agentId, owner, and agentURI pointing to metadata.
// Register an agent
await identityRegistry.register(agentURI);
// Get agent metadata
const uri = await identityRegistry.tokenURI(agentId);
const owner = await identityRegistry.ownerOf(agentId);REPUTATION REGISTRY
Submit and aggregate feedback. Supports tags for filtering and weighted averages for reputation scores.
// Give feedback to an agent
await reputationRegistry.giveFeedback(
agentId,
value, // int128
decimals, // uint8
tag1, tag2,
endpoint,
feedbackURI,
feedbackHash
);AGENT REGISTRATION FILE
The agentURI points to a JSON file describing the agent's capabilities and endpoints.
{
"type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
"name": "My AI Agent",
"description": "An autonomous trading agent",
"image": "ipfs://Qm...",
"services": [
{ "name": "MCP", "endpoint": "https://api.example.com/mcp" },
{ "name": "A2A", "endpoint": "https://api.example.com/a2a" }
],
"x402Support": true,
"active": true
}BAP-578: NON-FUNGIBLE AGENTS
Autonomous, intelligent digital entities with optional learning capabilities
AGENT STATE
NFAs maintain state including balance, status, logic contract, and last action timestamp.
struct AgentState {
uint256 balance; // BNB for gas
AgentStatus status; // Active/Paused/Terminated
address owner;
address logicAddress; // Custom logic contract
uint256 lastActionTimestamp;
}LEARNING MODULE
Optional learning with dual-path architecture: JSON Light Memory or Merkle Tree Learning.
// Enable learning
await nfaRegistry.enableLearning(
agentId,
learningModuleAddress
);
// Record learning
await learningModule.recordLearning(
agentId,
merkleProof,
learningData
);AGENT TEMPLATES
Pre-configured agent archetypes with specialized logic contracts.
X402: INSTANT PAYMENTS
Pay-per-use API monetization with stablecoins
DISCOVERY DOCUMENT
Advertise X402-enabled resources via a well-known JSON document.
// /.well-known/x402.json
{
"version": 1,
"resources": [
"/api/generate",
"/api/analyze"
],
"ownershipProofs": [
"/.well-known/x402/ownership.json"
]
}402 RESPONSE
HTTP 402 response includes payment details for resource access.
HTTP/1.1 402 Payment Required
X-Payment-Required: {
"version": 1,
"payTo": "0x...",
"amount": "1000000",
"currency": "USDT",
"facilitator": "0x...",
"chainId": 56
}GETTING STARTED
Follow these steps to participate in the BAP.Market ecosystem