Skip to main content
← Blog
Base EcosystemTechnical Deep-Dive

Agentbot Goes Onchain
Builder Codes, NFTs & Swaps

June 5, 2026 · 12 min read

Last night we shipped three major Base ecosystem integrations in a single session: Builder Codes for onchain attribution, NFT wristbands for community access, and token swaps via the CDP Trade API. Here's what we built and how it works.

1. Builder Codes — Onchain Attribution

Every transaction your agent sends is anonymous without attribution. Builder Codes fix this by appending a unique identifier to your transaction calldata using the ERC-8021 standard.

How It Works

A Builder Code is a unique string (e.g. bc_4k0319ta) that gets encoded into the last bytes of your transaction data. Smart contracts ignore the suffix — it's extracted by offchain indexers after the fact. Gas overhead is minimal (16 gas per non-zero byte).

Our Implementation

We integrated Builder Codes at the wagmi config level, meaning every transaction from Agentbot automatically includes the attribution. Here's the setup:

import { Attribution } from "ox/erc8021";

const BUILDER_CODE = 'bc_4k0319ta';

const DATA_SUFFIX = Attribution.toDataSuffix({
  codes: [BUILDER_CODE],
});

export const wagmiConfig = createConfig({
  chains: [base, baseSepolia],
  connectors: [coinbaseWallet({ appName: 'Agentbot' })],
  transports: {
    [base.id]: http(),
    [baseSepolia.id]: http(),
  },
  dataSuffix: DATA_SUFFIX,  // Every tx includes this
});

The critical fix was ensuring WalletProvider imports this config instead of creating its own. Without this, the dataSuffix was dead code — transactions went out unattributed.

What You See on Base

Once users start sending onchain transactions (minting NFTs, swapping tokens), your activity appears on the Base App Leaderboard. You'll see:

  • Total transacting users
  • Number of transactions
  • Gas spent
  • Paymaster subsidies

2. Digital Wristband — NFT Community Access

The Digital Wristband is an ERC-721 NFT on Base that grants lifetime access to baseFM streams, token-gated community channels, and exclusive artist drops.

The Flow

Users visit agentbot.sh/wristband and see one of three states:

Not logged in

"Sign In with Email" + "Connect Base Wallet" buttons

Logged in, no wallet

"Connect Base Wallet" + "Get a Base Wallet" link

Wallet connected

Mint flow — "Mint Wristband — Free" button

Smart Wallet Detection

The component detects wallet connections through multiple layers:

  • wagmi hooksuseAccount() for managed connections
  • window.ethereum — fallback detection for any EVM wallet
  • useCustomSession — email auth state from NextAuth

CDP Paymaster (Gasless)

We integrated the CDP Paymaster for gasless minting. The user pays nothing — CDP sponsors the gas from your $500 monthly allowance. Setup requires:

  1. CDP account with payment method in Billing
  2. Paymaster endpoint URL from Onchain Tools
  3. NFT contract allowlisted in Paymaster config

⚠️ Note

The example contract 0x66519F...D49 from CDP docs doesn't exist on Base mainnet. You need to deploy your own ERC-721 contract. We recommend Remix IDE for fastest deployment.

3. Token Swaps — CDP Trade API

The CDP Trade API enables onchain token swaps across Base, Ethereum, Arbitrum, Optimism, and Polygon — with sub-500ms execution and multi-DEX routing.

Supported Tokens

ET
ETH
US
USDC
WE
WETH
DE
DEGEN
AE
AERO

How to Swap

  1. Navigate to agentbot.sh/dashboard/swap
  2. Connect your Base wallet
  3. Select tokens and enter amount
  4. Review the quote (rate, price impact, slippage)
  5. Confirm the swap in your wallet

API Architecture

The swap flow uses a two-step process:

// 1. Get price estimate (debounced, fast)
POST /api/swap
{ action: "quote", fromToken, toToken, fromAmount, walletAddress }

// 2. Execute swap (requires wallet signature)
POST /api/swap
{ action: "swap", fromToken, toToken, fromAmount, walletAddress }

The backend uses the @coinbase/cdp-sdk for quote generation and execution. Slippage protection is built in (1% default). Every swap includes Builder Code attribution automatically.

4. Agentbot Bridge — Chat from Any Device

The Bridge connects your local OpenClaw instance to Agentbot, letting you chat with your AI from any device — phone, tablet, another computer.

Setup

BRIDGE_SECRET=your_secret bash <(curl -sSL https://agentbot.sh/bridge/install.sh)

The bridge client polls the server every 3 seconds, receives requests, runs them through your local OpenClaw, and sends responses back. Your data stays on your machine.

What's Next

  • Deploy Real NFT Contract

    The CDP example contract doesn't exist on mainnet. Deploy via Remix IDE or thirdweb.

  • Add CDP Billing

    Enable gasless mints by adding a payment method in CDP Portal → Billing.

  • Base Notifications

    Push updates to users who pinned Agentbot in the Base App.

  • Base MCP Integration

    Give agents a wallet. Check balances, send funds, pay x402 APIs.

Built by Agentbot · Powered by MiMo V2.5 · Built on Base

ONLINE
© 2026 Agentbot