diff --git a/docs/ai-agents/setup/agent-builder-codes.mdx b/docs/ai-agents/setup/agent-builder-codes.mdx index 6ad25565c..cda0478b6 100644 --- a/docs/ai-agents/setup/agent-builder-codes.mdx +++ b/docs/ai-agents/setup/agent-builder-codes.mdx @@ -5,7 +5,7 @@ keywords: ["builder code", "Base.dev", "ERC-8021", "attribution", "onchain activ tag: "NEW" --- -Base.dev is the canonical registry for agents on Base. A Builder Code ties every transaction your agent sends to your identity in that registry, giving you verifiable onchain attribution and access to analytics and leaderboard features. +[Base.dev](https://base.dev) is the canonical registry for agents on Base. A Builder Code ties every transaction your agent sends to your identity in that registry, giving you verifiable onchain attribution and access to analytics and leaderboard features. ## What you get @@ -19,28 +19,29 @@ Base.dev is the canonical registry for agents on Base. A Builder Code ties every ## Get your Builder Code -One call. No auth. +A single, unauthenticated API call: ```bash Terminal curl -X POST https://api.base.dev/v1/agents/builder-codes \ -H "Content-Type: application/json" \ -d '{ - "wallet_address": "0x" + "walletAddress": "" }' ``` Response: -```json Title Response +```json Response { - "builder_code": "bc_a1b2c3d4", - "wallet_address": "0x...", + "builderCode": "bc_a1b2c3d4", + "walletAddress": "0x...", } ``` - + Already registered? Calling this endpoint again with the same wallet address returns your existing builder code. - + + --- ## Get a Builder Code using the Base skill @@ -53,17 +54,17 @@ npx skills add base/skills Then ask your agent: **"Register my agent for a builder code on Base.dev."** -The skill runs four phases: +The skill runs three phases: - Asks for your agent's wallet address. If you don't have one, it sends you to the [wallet setup guide](/ai-agents/guides/wallet-setup) before continuing. + Asks for your agent's wallet address. If you don't have one, it sends you to the [wallet setup guide](/ai-agents/setup/wallet-setup) before continuing. Calls `POST /v1/agents/builder-codes` with your wallet address, writes the returned code to `src/constants/builderCode.ts`, installs `ox`, and wires the ERC-8021 `dataSuffix` into your transaction client (viem, ethers.js, or managed service). It also writes an `AGENT_README.md` documenting the setup. - Confirms the setup and instructs you that every future transaction must include the ERC-8021 suffix. Missing it causes silent, permanent attribution loss — no error, no warning. + Confirms the setup and instructs you that every future transaction must include the ERC-8021 suffix. Missing it causes silent, permanent attribution loss. @@ -73,27 +74,26 @@ The skill runs four phases: If you're using an AI agent, point it to this page: -```text Title Prompt -Get a Builder Code for my agent on Base.dev using the documentation at [URL of this page]. +```text Prompt +Get a Builder Code for my agent on Base.dev using the documentation at https://docs.base.org/ai-agents/setup/agent-builder-codes. My agent's wallet address: [0x...] -Run this curl command, replacing the wallet address with mine: +Run this curl command, replacing the wallet address with my agent's: curl -X POST https://api.base.dev/v1/agents/builder-codes \ -H "Content-Type: application/json" \ - -d '{"wallet_address": "[0x...]"}' + -d '{"walletAddress": "0x..."}' -Return the builder_code from the response, then show me how to append it to my transactions using ERC-8021. +Return the `builderCode` from the response, then show me how to append it to my transactions using ERC-8021. ``` ---- +--- ## What happens next -Once you receive your Builder Code, it becomes active right away Base will begin tracking any transactions that include it. - -## API reference +Once you receive your Builder Code, it becomes active right away and Base will begin tracking any transactions that include it. +## API Reference ### Get builder code ``` @@ -104,8 +104,10 @@ No authentication required. | Field | Type | Required | Description | |---|---|---|---| -| `wallet_address` | string | Yes | Your agent's EVM wallet address (`0x...`) | - -Returns the builder code for the given wallet. The same wallet address always returns the same code — safe to call multiple times. +| `walletAddress` | string | Yes | Your agent's EVM wallet address (`0x...`) | +Returns the builder code for the given wallet. The same wallet address always returns the same code and is safe to call multiple times. +## Further reading +- [Builder Codes Overview](/base-chain/builder-codes/builder-codes) - What Builder Codes are, how ERC-8021 attribution works, and FAQs on gas, identity, and wallet support +- [Builder Codes for Agent Developers](/base-chain/builder-codes/agent-developers) - API reference, skill reference, and overview diff --git a/docs/base-chain/builder-codes/agent-developers.mdx b/docs/base-chain/builder-codes/agent-developers.mdx new file mode 100644 index 000000000..a34a1d1e1 --- /dev/null +++ b/docs/base-chain/builder-codes/agent-developers.mdx @@ -0,0 +1,98 @@ +--- +title: "Builder Codes for Agent Developers" +sidebarTitle: "For Agent Developers" +description: "Attribute your AI agent's onchain transactions to your identity on Base and unlock analytics and leaderboard features." +--- + +AI agents operate autonomously and send transactions without a user manually triggering each one. Builder Codes give you a way to attribute all of that activity back to your agent's identity on Base. + +## Why agents need Builder Codes + +- **Attribution** — Every transaction your agent sends is tied to your identity in the Base registry. Without it, your agent's onchain activity is anonymous. +- **Analytics** — Track your agent's transaction volume, user reach, and onchain conversion in [base.dev](https://base.dev). +- **Visibility** — Agents with Builder Codes can appear in discovery surfaces like Base's App Leaderboard and ecosystem spotlights. + +## How it works + +A Builder Code is a unique identifier (e.g. `bc_a1b2c3d4`) that gets appended to your agent's transaction calldata as an [ERC-8021](https://eip.tools/eip/8021) suffix. Smart contracts ignore the suffix; it is extracted by offchain indexers after the fact. The gas overhead is minimal (16 gas per non-zero byte). + +## API reference + +### Register your agent + +``` +POST /v1/agents/builder-codes +``` + +No authentication required. + +| Field | Type | Required | Description | +|---|---|---|---| +| `walletAddress` | string | Yes | Your agent's EVM wallet address (`0x...`) | + +Returns the builder code for the given wallet. The same wallet address always returns the same code. + +```bash Terminal +curl -X POST https://api.base.dev/v1/agents/builder-codes \ + -H "Content-Type: application/json" \ + -d '{ + "walletAddress": "" + }' +``` + +```json Response +{ + "builderCode": "bc_a1b2c3d4", + "walletAddress": "0x..." +} +``` + + +Already registered? Calling this endpoint again with the same wallet address returns your existing builder code. Safe to call on every deploy. + + +## Using the Base skill + +If you're using an AI coding tool (Claude Code, Cursor, Codex), install the Base skills package and let the skill handle registration end-to-end: + +```bash Terminal +npx skills add base/skills +``` + +Then ask your agent: **"Register my agent for a builder code on Base.dev."** + +The skill handles wallet validation, calls the registration API, writes the returned code to `src/constants/builderCode.ts`, installs `ox`, and wires the ERC-8021 `dataSuffix` into your transaction client (viem, ethers.js, or managed service). + +Read more in the [Builder Codes for Agents guide](/ai-agents/setup/agent-builder-codes). + +## Verify attribution + +To confirm your Builder Code is being appended correctly: + +**1. Check base.dev** + +- Visit [base.dev](https://base.dev) +- Select **Onchain** from the transaction type dropdown +- Under the Total Transactions section, attribution counts increment when transactions with your code are processed + +**2. Use a block explorer (Basescan, Etherscan, etc.)** + +- Find your transaction hash +- View the input data field +- Verify the last 16 bytes are the `8021` repeating +- Decode the suffix to confirm your Builder Code is present + +**3. Open source tools** + +- Use the [Builder Code Validation](https://builder-code-checker.vercel.app/) tool +- Select transaction type +- Enter the transaction or UserOperation hash +- Click the **Check Attribution** button + +## Next steps + + + + Step-by-step walkthrough for manual registration, prompt-driven setup, and wiring ERC-8021 into your transaction client + + diff --git a/docs/base-chain/builder-codes/builder-codes.mdx b/docs/base-chain/builder-codes/builder-codes.mdx index 4373a0284..80c857273 100644 --- a/docs/base-chain/builder-codes/builder-codes.mdx +++ b/docs/base-chain/builder-codes/builder-codes.mdx @@ -1,6 +1,6 @@ --- title: "Base Builder Codes" -description: "Attribute onchain activity to your app or wallet with Builder Codes." +description: "Attribute onchain activity to your app, wallet or agent with Builder Codes." --- ## What Are Builder Codes @@ -22,8 +22,8 @@ Each code has associated metadata. Onchain metadata primarily includes a "payout Implement the dataSuffix capability - - Integrate with the Base-Solana bridge + + Attribute your AI agent's transactions via the API diff --git a/docs/docs.json b/docs/docs.json index 3e53a1d8c..0286b3a04 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -154,7 +154,8 @@ "pages": [ "base-chain/builder-codes/builder-codes", "base-chain/builder-codes/app-developers", - "base-chain/builder-codes/wallet-developers" + "base-chain/builder-codes/wallet-developers", + "base-chain/builder-codes/agent-developers" ] }, { @@ -496,24 +497,6 @@ ] } }, - { - "tab": "Mini Apps", - "groups": [ - { - "group": "Quickstart", - "pages": [ - "mini-apps/quickstart/migrate-to-standard-web-app", - "get-started/build-app" - ] - }, - { - "group": "Growth", - "pages": [ - "mini-apps/growth/rewards" - ] - } - ] - }, { "tab": "AI Agents", "groups": [ @@ -583,6 +566,24 @@ } ] }, + { + "tab": "Mini Apps", + "groups": [ + { + "group": "Quickstart", + "pages": [ + "mini-apps/quickstart/migrate-to-standard-web-app", + "get-started/build-app" + ] + }, + { + "group": "Growth", + "pages": [ + "mini-apps/growth/rewards" + ] + } + ] + }, { "tab": "OnchainKit", "groups": [ @@ -800,7 +801,7 @@ "destination": "/get-started/build-app" }, { - "source": "ai-agents/guides/agent-builder-codes", + "source": "/ai-agents/guides/agent-builder-codes", "destination": "/ai-agents/setup/agent-builder-codes" }, { @@ -2845,7 +2846,7 @@ }, { "source": "/ai-agents/core-concepts/payments-and-transactions", - "destination": "/ai-agents/payments/x402-protocol" + "destination": "/ai-agents/payments/pay-for-services-with-x402" }, { "source": "/ai-agents/core-concepts/identity-verification-auth", @@ -2869,7 +2870,7 @@ }, { "source": "/ai-agents/quickstart/agentkit", - "destination": "/ai-agents/frameworks/agentkit" + "destination": "/ai-agents/skills/index" }, { "source": "/ai-agents/guides/agent-app", diff --git a/docs/get-started/base.mdx b/docs/get-started/base.mdx index 347da2109..644c924f1 100644 --- a/docs/get-started/base.mdx +++ b/docs/get-started/base.mdx @@ -13,9 +13,9 @@ mode: "wide"
### Agents - [Build an AI Agent](/ai-agents/index) - [Give Your Agent a Wallet](/ai-agents/core-concepts/wallets) - [Register Your Agent](/ai-agents/core-concepts/identity-verification-auth) + [Build an AI Agent](/ai-agents) + [Get Started with Agentic Payments (x402)](/ai-agents/quickstart/payments) + [Get Started with Agentic Trading](/ai-agents/quickstart/trading)
### Tokens @@ -34,8 +34,8 @@ mode: "wide" Authentication, payments, Basenames - - Build in-app social experiences + + Build and deploy autonomous onchain agents Cross-chain asset transfers