Skip to content

Commit e358c01

Browse files
committed
changed side bar added tag
1 parent d4b6469 commit e358c01

2 files changed

Lines changed: 2 additions & 83 deletions

File tree

docs/ai-agents/guides/builder-codes.mdx

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: "Get a Builder Code for Your Agent"
33
description: "Register your agent on Base.dev and append a Builder Code to every transaction to measure onchain activity."
44
keywords: ["builder code", "Base.dev", "ERC-8021", "attribution", "onchain activity", "agent attribution", "dataSuffix", "builder codes", "Base builder codes", "agent onchain"]
5+
tag: "NEW"
56
---
67

78
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.
@@ -58,88 +59,6 @@ Follow the instructions to:
5859
2. Return the builder code
5960
3. Show me how to append the builder code to my transactions using ERC-8021
6061
```
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-
14362
---
14463

14564
## What happens next

docs/docs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@
534534
{
535535
"group": "Guides",
536536
"pages": [
537-
"ai-agents/guides/builder-codes",
538537
"ai-agents/guides/wallet-setup",
538+
"ai-agents/guides/builder-codes",
539539
"ai-agents/guides/x402-payments",
540540
"ai-agents/guides/register-and-sign-in-your-agent",
541541
"ai-agents/guides/agent-app",

0 commit comments

Comments
 (0)