> ## Documentation Index
> Fetch the complete documentation index at: https://docs.privy.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrating Base builder codes

[Base Builder Codes](https://base.dev) enable developers to unlock rewards by attributing onchain activity back to their applications. By appending an [ERC-8021](https://www.erc8021.com/) 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 configured with `@privy-io/react-auth` v3.22.0+ or `@privy-io/expo` v0.73.0+
* A registered Builder Code from [base.dev](https://base.dev) > Settings > Builder Codes

## Installation

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

<View title="React" icon="react">
  ```bash theme={"system"}
  npm install ox
  ```
</View>

<View title="React Native" icon="react">
  ```bash theme={"system"}
  npx expo install ox
  ```
</View>

## Integration

<View title="React" icon="react">
  Import the `dataSuffix` plugin from Privy and the `Attribution` utility from `ox`:

  ```tsx theme={"system"}
  import {PrivyProvider, dataSuffix} from '@privy-io/react-auth';
  import {Attribution} from 'ox/erc8021';

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

  function App() {
    return (
      <PrivyProvider
        appId="your-privy-app-id"
        config={{
          ...yourOtherConfig,
          plugins: [dataSuffix(ERC_8021_ATTRIBUTION_SUFFIX)]
        }}
      >
        {/* App content */}
      </PrivyProvider>
    );
  }
  ```
</View>

<View title="React Native" icon="react">
  Create one Privy client with the `dataSuffix` plugin, then pass the client to `PrivyProvider`:

  ```tsx theme={"system"}
  import {createPrivyClient, dataSuffix, PrivyProvider} from '@privy-io/expo';
  import {Attribution} from 'ox/erc8021';

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

  // Create one client for the app
  const client = createPrivyClient({
    appId: 'your-privy-app-id',
    clientId: 'your-privy-client-id',
    plugins: [dataSuffix(ERC_8021_ATTRIBUTION_SUFFIX)]
  });

  function App() {
    return <PrivyProvider client={client}>{/* App content */}</PrivyProvider>;
  }
  ```
</View>

**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 Type         | Where Suffix is Appended |
| ------------------------ | ------------------------ |
| EOA transactions         | `transaction.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.

<Info>
  Base Builder Codes rewards are specific to transactions on Base mainnet and Base Sepolia. However,
  the `dataSuffix` plugin appends the suffix to every transaction on every supported chain, with the
  sole exception of Tempo (type 118) transactions. If your app needs chain-specific suffix behavior,
  [contact the Privy team](https://privy.io/slack).
</Info>

<Warning>
  The `dataSuffix` plugin is not yet supported when using the
  [`@privy-io/wagmi`](/wallets/connectors/ethereum/integrations/wagmi) adapter. If you need wagmi
  support, please [contact the Privy team](https://privy.io/slack) for assistance.
</Warning>

## Resources

<CardGroup cols={2}>
  <Card title="ERC-8021 Specification" icon="book" href="https://www.erc8021.com/">
    Learn more about the ERC-8021 attribution standard.
  </Card>

  <Card title="Base Builder Codes" icon="coins" href="https://base.dev">
    Register for a Builder Code and track your rewards.
  </Card>

  <Card title="ox Library" icon="code" href="https://oxlib.sh">
    Documentation for the ox Ethereum utilities library.
  </Card>
</CardGroup>
