Skip to content

Commit d4b6469

Browse files
committed
added keywords to metadata
1 parent 3aac74f commit d4b6469

2 files changed

Lines changed: 179 additions & 0 deletions

File tree

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
---
2+
title: "Get a Builder Code for Your Agent"
3+
description: "Register your agent on Base.dev and append a Builder Code to every transaction to measure onchain activity."
4+
keywords: ["builder code", "Base.dev", "ERC-8021", "attribution", "onchain activity", "agent attribution", "dataSuffix", "builder codes", "Base builder codes", "agent onchain"]
5+
---
6+
7+
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.
8+
9+
## What you get
10+
11+
- **Builder Code** — a unique identifier (e.g. `bc_a1b2c3d4`) that you append to your onchain transactions. Base uses this to measure your agent's activity on Base Chain.
12+
13+
## Prerequisites
14+
15+
- An EVM wallet address that your agent operates from
16+
17+
That's it. No authentication, no wallet signing, no account creation.
18+
19+
---
20+
21+
## Get your Builder Code
22+
23+
One call. No auth.
24+
25+
```bash Terminal
26+
curl -X POST https://api.base.dev/v1/agents/builder-codes \
27+
-H "Content-Type: application/json" \
28+
-d '{
29+
"wallet_address": "0x<your-wallet-address>"
30+
}'
31+
```
32+
33+
Response:
34+
35+
```json Title Response
36+
{
37+
"builder_code": "bc_a1b2c3d4",
38+
"wallet_address": "0x...",
39+
"usage_instructions": "Append this builder code to your onchain transactions using the ERC-8021 standard. See: https://docs.base.org/base-chain/quickstart/builder-codes"
40+
}
41+
```
42+
43+
**Idempotent** — calling it again with the same wallet address returns the same builder code.
44+
45+
---
46+
47+
## Get a Builder Code with a prompt
48+
49+
If you're using an AI agent, point it to this page:
50+
51+
```text Title Prompt
52+
Get a Builder Code for my agent on Base.dev using the documentation at [URL of this page].
53+
54+
My agent's wallet address: [0x...]
55+
56+
Follow the instructions to:
57+
1. Call POST /v1/agents/builder-codes with my wallet address
58+
2. Return the builder code
59+
3. Show me how to append the builder code to my transactions using ERC-8021
60+
```
61+
62+
---
63+
64+
## Append your Builder Code to transactions
65+
66+
Once you have a Builder Code, append it to every onchain transaction so Base can measure your agent's activity. This uses the [ERC-8021 standard](/base-chain/quickstart/builder-codes).
67+
68+
<CodeGroup>
69+
70+
```typescript viem lines expandable
71+
import { createWalletClient, http } from "viem";
72+
import { base } from "viem/chains";
73+
import { privateKeyToAccount } from "viem/accounts";
74+
import { Attribution } from "ox/erc8021";
75+
76+
const DATA_SUFFIX = Attribution.toDataSuffix({
77+
codes: ["bc_a1b2c3d4"],
78+
});
79+
80+
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
81+
82+
export const walletClient = createWalletClient({
83+
account,
84+
chain: base,
85+
transport: http(),
86+
dataSuffix: DATA_SUFFIX,
87+
});
88+
89+
// All transactions sent through this client automatically include your Builder Code
90+
const hash = await walletClient.sendTransaction({
91+
to: "0x70997970c51812dc3a010c7d01b50e0d17dc79c8",
92+
value: parseEther("0.1"),
93+
});
94+
```
95+
96+
```javascript ethers.js lines expandable
97+
import { Attribution } from 'ox/erc8021';
98+
import { ethers } from 'ethers';
99+
100+
const builderCode = 'bc_a1b2c3d4';
101+
const suffix = Attribution.toDataSuffix({ codes: [builderCode] });
102+
103+
const provider = new ethers.JsonRpcProvider('https://mainnet.base.org');
104+
const wallet = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
105+
106+
const tx = {
107+
to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
108+
value: ethers.parseEther('0.1'),
109+
data: suffix, // or append to existing calldata
110+
};
111+
112+
const txResponse = await wallet.sendTransaction(tx);
113+
```
114+
115+
```python web3.py lines expandable
116+
from web3 import Web3
117+
from eth_account import Account
118+
from ox.erc8021 import Attribution
119+
120+
builder_code = 'bc_a1b2c3d4'
121+
suffix = Attribution.to_data_suffix(codes=[builder_code])
122+
123+
w3 = Web3(Web3.HTTPProvider('https://mainnet.base.org'))
124+
account = Account.from_key(os.environ['PRIVATE_KEY'])
125+
126+
tx = {
127+
'from': account.address,
128+
'to': '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
129+
'value': Web3.to_wei(0.1, 'ether'),
130+
'data': suffix, # or append to existing calldata
131+
'nonce': w3.eth.get_transaction_count(account.address),
132+
'gas': 21000,
133+
'gasPrice': w3.eth.gas_price,
134+
'chainId': 8453,
135+
}
136+
137+
signed = account.sign_transaction(tx)
138+
tx_hash = w3.eth.send_raw_transaction(signed.raw_transaction)
139+
```
140+
141+
</CodeGroup>
142+
143+
---
144+
145+
## What happens next
146+
147+
Your Builder Code starts working immediately — Base will measure any transaction that includes it.
148+
149+
To unlock additional features, you can optionally register your agent later:
150+
151+
| Feature | Requires registration? |
152+
|---|---|
153+
| Onchain activity measurement | No — works as soon as you append the builder code |
154+
| Public leaderboard | Yes — requires wallet verification via registration |
155+
| Verified coin badge | Yes — requires registration + coin verification |
156+
| Dashboard analytics | Yes — requires registration + claiming |
157+
158+
**Register later:** When you're ready, authenticate via SIWE and call `POST /v1/agents/register` to verify your wallet, add metadata, and become leaderboard-eligible. See [full registration docs](./register-and-sign-in-your-agent).
159+
160+
---
161+
162+
## API reference
163+
164+
### Get builder code
165+
166+
```
167+
POST /v1/agents/builder-codes
168+
```
169+
170+
No authentication required.
171+
172+
| Field | Type | Required | Description |
173+
|---|---|---|---|
174+
| `wallet_address` | string | Yes | Your agent's EVM wallet address (`0x...`) |
175+
176+
Returns the builder code for the given wallet. Idempotent — the same wallet always returns the same code.
177+
178+

docs/docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,7 @@
534534
{
535535
"group": "Guides",
536536
"pages": [
537+
"ai-agents/guides/builder-codes",
537538
"ai-agents/guides/wallet-setup",
538539
"ai-agents/guides/x402-payments",
539540
"ai-agents/guides/register-and-sign-in-your-agent",

0 commit comments

Comments
 (0)