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

# Dynamic Fee Sharing Developer Guide

> Learn how to build Dynamic Fee Sharing integrations with the on-chain program, TypeScript SDK, Rust CPI bindings, and release notes.

Dynamic Fee Sharing lets a project configure a token fee vault, fund fees into it, and let configured shareholders claim their share over time. To learn more about product behavior, design considerations, compatibility, and formulas, you can read the following documentations.

<CardGroup cols={2}>
  <Card title="Learn more about Dynamic Fee Sharing" icon="book-open" iconType="solid" href="/helper-products/dynamic-fee-sharing/what-is-dynamic-fee-sharing">
    Product overview for fee vaults, fee sharing flows, and high-level integration behavior.
  </Card>

  <Card title="Dynamic Fee Sharing Formulas" icon="calculator" iconType="solid" href="/helper-products/dynamic-fee-sharing/formulas">
    Formula references for fee allocation, user shares, and claim accounting.
  </Card>
</CardGroup>

## Integration

<CardGroup cols={2}>
  <Card title="Program Accounts" icon="table-cells" iconType="solid" href="/developer-guides/dynamic-fee-sharing/program/accounts">
    Fee vault state, token vault PDA, fee vault authority PDA, constants, and token support.
  </Card>

  <Card title="Program Instructions" icon="list" iconType="solid" href="/developer-guides/dynamic-fee-sharing/program/instructions">
    Initialization, direct funding, source-program funding, and fee claim instruction details.
  </Card>

  <Card title="Program Events" icon="list" iconType="solid" href="/developer-guides/dynamic-fee-sharing/program/events">
    Anchor event-CPI payloads for vault initialization, funding, and user claims.
  </Card>

  <Card title="Program Errors" icon="triangle-exclamation" iconType="solid" href="/developer-guides/dynamic-fee-sharing/program/errors">
    Anchor custom error codes, enum names, messages, and common integration causes.
  </Card>

  <Card title="TypeScript SDK" icon="code" iconType="solid" href="/developer-guides/dynamic-fee-sharing/typescript-sdk/getting-started">
    TypeScript SDK for creating vaults, funding them, reading state, and claiming user fees.
  </Card>

  <Card title="Rust CPI" icon="terminal" iconType="solid" href="/developer-guides/dynamic-fee-sharing/rust-integration/cpi">
    Anchor CPI integration with the `dynamic-fee-sharing` program crate.
  </Card>
</CardGroup>

## Program IDs

The `dynamic_fee_sharing` program ID is the same on mainnet and devnet:

| Network      | Program ID                                    |
| ------------ | --------------------------------------------- |
| Mainnet Beta | `dfsdo2UqvwfN8DuUVrMRNfQe11VaiNoKcMqLHVvDPzh` |
| Devnet       | `dfsdo2UqvwfN8DuUVrMRNfQe11VaiNoKcMqLHVvDPzh` |

The program-wide fee vault authority PDA is:

| Authority           | Address                                        |
| ------------------- | ---------------------------------------------- |
| Fee Vault Authority | `EYqHRdtepv1KKUkPAYMBYpSfiGfNd8sa55ZtswodTfBS` |

## Fee Vault Types

| Vault type        | Address model                              | Created by                                       | Main use                                                                                       |
| ----------------- | ------------------------------------------ | ------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
| Non-PDA fee vault | External keypair account                   | `initialize_fee_vault` / `createFeeVault`        | Standalone fee sharing when the vault address can be created and stored off-chain.             |
| PDA fee vault     | PDA from `["fee_vault", base, token_mint]` | `initialize_fee_vault_pda` / `createFeeVaultPda` | Protocol integrations where a deterministic vault address must sign source-program fee claims. |

Both vault types share the same `FeeVault` state layout and support direct funding plus user claims. Only PDA fee vaults support `fund_by_claiming_fee`, because the vault PDA signs the downstream whitelisted claim or withdrawal instruction.

## Source Repositories

<CardGroup cols={2}>
  <Card title="Dynamic Fee Sharing Program" icon="code" iconType="solid" href="https://github.com/MeteoraAg/dynamic-fee-sharing">
    Anchor program source for `dynamic_fee_sharing`.
  </Card>

  <Card title="Dynamic Fee Sharing IDL" icon="file-code" iconType="solid" href="https://github.com/MeteoraAg/dynamic-fee-sharing-sdk/blob/main/src/idl/idl.json">
    Published IDL used by the TypeScript SDK.
  </Card>
</CardGroup>

<CardGroup cols={1}>
  <Card title="TypeScript SDK" icon="node-js" iconType="solid" href="https://github.com/MeteoraAg/dynamic-fee-sharing-sdk">
    SDK for transaction builders, state reads, PDA helpers, and example scripts.
  </Card>
</CardGroup>

## Commands

| Task                     | Command                                                        |
| ------------------------ | -------------------------------------------------------------- |
| Build program            | `cd dynamic-fee-sharing && anchor build`                       |
| Run program tests        | `cd dynamic-fee-sharing && pnpm install && pnpm test`          |
| Build TypeScript SDK     | `cd dynamic-fee-sharing-sdk && pnpm install && pnpm run build` |
| Run TypeScript SDK tests | `cd dynamic-fee-sharing-sdk && bun test`                       |

## Stay Updated

<CardGroup cols={1}>
  <Card title="Dynamic Fee Sharing Changelog" icon="newspaper" iconType="solid" href="/developer-guides/dynamic-fee-sharing/changelog">
    Program and SDK changes for integration planning.
  </Card>
</CardGroup>
