Once your app is registered on base.dev, the Base App will auto-append your Builder Code to transactions its users make in your app (e.g. via your mini app, or the Base App’s browser). This powers your onchain analytics in base.dev and qualifies you for potential future rewards.
If users also access your app on the web or through other clients, you’ll need to integrate the dataSuffix parameter to capture that activity.When you register on base.dev, you will receive a Builder Code—a random string (e.g., bc_b7k3p9da) that you’ll use to generate your attribution suffix. The recommended approach is to configure dataSuffix at the client level, which appends your Builder Code to all transactions.
You can find your code anytime under Settings → Builder Code.
Install the required packages. Requires viem version 2.45.0 or higher.
Report incorrect code
Copy
Ask AI
npm i ox wagmi viem
2
Configure Your Wagmi Client
Add the dataSuffix option to your Wagmi config. This automatically appends your Builder Code to all transactions.
config.ts
Report incorrect code
Copy
Ask AI
import { createConfig, http } from "wagmi";import { base } from "wagmi/chains";import { Attribution } from "ox/erc8021";// Get your Builder Code from base.dev > Settings > Builder Codesconst DATA_SUFFIX = Attribution.toDataSuffix({ codes: ["YOUR-BUILDER-CODE"],});export const config = createConfig({ chains: [base], transports: { [base.id]: http(), }, dataSuffix: DATA_SUFFIX,});
3
Use Wagmi Hooks as Usual
With the config in place, all transactions automatically include your Builder Code—no changes to your hooks or components. This works with both useSendTransaction and useSendCalls.
App.tsx
Report incorrect code
Copy
Ask AI
import { useSendTransaction } from "wagmi";import { parseEther } from "viem";function SendButton() { const { sendTransaction } = useSendTransaction(); return ( <button onClick={() => sendTransaction({ to: "0x70997970c51812dc3a010c7d01b50e0d17dc79c8", value: parseEther("0.01"), }) } > Send ETH </button> );}
Privy provides a dataSuffix plugin that automatically appends your Builder Code to all transactions—including both EOA transactions and ERC-4337 smart wallet user operations.See the Privy Builder Codes integration guide for setup instructions.
Pass appCode, walletCode, or both to Attribution.toDataSuffix. The ox library detects Schema 2 automatically when either field is present.
1
Install Dependencies
Install the required packages. Requires the version of ox that includes ERC-8021 Schema 2 support.
Report incorrect code
Copy
Ask AI
npm i ox wagmi viem
2
Generate Your Attribution Suffix
Call Attribution.toDataSuffix with your app code and add it to your Wagmi config or Viem wallet client.
config.ts
Report incorrect code
Copy
Ask AI
import { createConfig, http } from "wagmi";import { base } from "wagmi/chains";import { Attribution } from "ox/erc8021";// Get your Builder Code from base.dev > Settings > Builder Codesconst DATA_SUFFIX = Attribution.toDataSuffix({ appCode: "YOUR-APP-CODE",});export const config = createConfig({ chains: [base], transports: { [base.id]: http() }, dataSuffix: DATA_SUFFIX,});
3
Extend with Wallet Code, Registries, or Metadata (Optional)
If you also need to attribute the wallet provider, point entities to custom registries, or attach campaign metadata, pass the additional fields to Attribution.toDataSuffix.
config.ts
Report incorrect code
Copy
Ask AI
import { Attribution } from "ox/erc8021";const DATA_SUFFIX = Attribution.toDataSuffix({ appCode: "YOUR-APP-CODE", // optional: use if you're an app walletCode: "YOUR-WALLET-CODE", // optional: use if you're a wallet registries: { app: { chainId: 8453, address: "0xYourAppRegistryAddress", }, wallet: { chainId: 8453, address: "0xYourWalletRegistryAddress", }, }, metadata: { utm_campaign: "winter-promo", source: "webapp", },});
At least one of appCode or walletCode must be present. chainId in registries is a plain number (e.g., 8453), consistent with Schema 1.