Skip to main content
Base Builder Codes enable developers to unlock rewards by attributing onchain activity back to their applications. By appending an ERC-8021 attribution suffix to transaction data, Base can identify which application originated each transaction and reward builders accordingly. Privy’s dataSuffix plugin makes this integration seamless—once configured, the attribution suffix is automatically appended to all transactions sent through your app, including both EOA transactions and ERC-4337 smart wallet user operations.

Prerequisites

  • A Privy app with @privy-io/react-auth v3.13.0+ configured
  • A registered Builder Code from base.dev > Settings > Builder Codes

Installation

Install the ox library to generate ERC-8021 compliant data suffixes:
npm install ox

Integration

Import the dataSuffix plugin from Privy and the Attribution utility from ox:
import {PrivyProvider, dataSuffix} from '@privy-io/react-auth';
import {Attribution} from 'ox/erc8021';

// Generate the ERC-8021 attribution suffix with your Builder Code
const ERC_8021_ATTRIBUTION_SUFFIX = Attribution.toDataSuffix({
  codes: ['YOUR-BUILDER-CODE'] // Replace with your code from base.dev > Settings > Builder Codes
});

function App() {
  return (
    <PrivyProvider
      appId="your-privy-app-id"
      config={{
        ...yourOtherConfig,
        plugins: [dataSuffix(ERC_8021_ATTRIBUTION_SUFFIX)]
      }}
    >
      {/* your app's content */}
    </PrivyProvider>
  );
}
That’s it! Once configured, every transaction sent through your Privy-powered app will include the ERC-8021 attribution suffix, enabling you to unlock rewards from Base.

How it works

The dataSuffix plugin automatically appends your attribution data to:
Transaction TypeWhere Suffix is Appended
EOA transactionstransaction.data field
Smart wallets (ERC-4337)userOp.callData field
The ERC-8021 suffix follows a standardized format that Base’s sequencer can parse:
TX_DATA + [CODES_LENGTH][CODES] + [SCHEMA_ID] + [ERC_MARKER]
This allows Base to attribute transactions to your app without requiring any changes to your existing transaction logic or smart contracts.
Base Builder Codes rewards are specific to transactions on Base mainnet and Base Sepolia. However, the dataSuffix plugin will append the suffix to transactions on all chains. If you need chain-specific suffix behavior, please reach out to the Privy team.
The dataSuffix plugin is not yet supported when using the @privy-io/wagmi adapter. If you need wagmi support, please contact the Privy team for assistance.

Resources