> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/drift-labs/protocol-v2/llms.txt
> Use this file to discover all available pages before exploring further.

# Drift Protocol v2

> On-chain perpetuals DEX on Solana with lightning-fast execution and deep liquidity

<img className="block dark:hidden" src="https://uploads-ssl.webflow.com/611580035ad59b20437eb024/616f97a42f5637c4517d0193_Logo%20(1)%20(1).png" alt="Drift Protocol Logo" height="120" />

<img className="hidden dark:block" src="https://uploads-ssl.webflow.com/611580035ad59b20437eb024/616f97a42f5637c4517d0193_Logo%20(1)%20(1).png" alt="Drift Protocol Logo" height="120" />

# Welcome to Drift Protocol v2

Drift Protocol v2 is a decentralized perpetuals exchange built on Solana, offering lightning-fast execution, deep liquidity, and a powerful TypeScript SDK for seamless integration.

## Getting Started

<CardGroup cols={2}>
  <Card title="Installation" icon="download" href="/installation">
    Install the Drift SDK and set up your development environment
  </Card>

  <Card title="Quick Start" icon="rocket" href="/quickstart">
    Place your first trade in minutes with our step-by-step guide
  </Card>

  <Card title="TypeScript API Reference" icon="code" href="https://drift-labs.github.io/protocol-v2/sdk/">
    Explore the complete TypeScript SDK documentation
  </Card>

  <Card title="v2-teacher Docs" icon="book" href="https://drift-labs.github.io/v2-teacher/">
    Comprehensive guides and examples for TypeScript and Python
  </Card>
</CardGroup>

## What is Drift Protocol?

Drift Protocol v2 is a decentralized perpetuals trading platform that enables:

* **Perpetual Futures Trading**: Trade crypto perpetuals with leverage on Solana
* **Deep Liquidity**: Access liquidity through Drift's innovative vAMM (virtual Automated Market Maker)
* **Low Latency**: Benefit from Solana's high-throughput blockchain for near-instant trade execution
* **Cross-Collateral**: Use multiple assets as collateral for your positions
* **Comprehensive SDK**: Build trading bots, integrations, and applications with our TypeScript SDK

## Key Features

<AccordionGroup>
  <Accordion title="Virtual AMM (vAMM)" icon="chart-line">
    Drift's vAMM provides deep liquidity and competitive pricing without requiring traditional order books. The vAMM dynamically adjusts prices based on market conditions and oracle data.
  </Accordion>

  <Accordion title="Cross-Collateral Margin" icon="coins">
    Use USDC and other supported assets as collateral across all your positions. The protocol automatically calculates your total collateral value and margin requirements.
  </Accordion>

  <Accordion title="TypeScript SDK" icon="code">
    The `@drift-labs/sdk` package provides a complete set of tools for:

    * Account management and deposits
    * Placing and managing orders
    * Monitoring positions and market data
    * Building automated trading strategies
  </Accordion>

  <Accordion title="Oracle Integration" icon="satellite-dish">
    Drift integrates with multiple oracle providers (Pyth, Switchboard) to ensure accurate and reliable price feeds for all markets.
  </Accordion>
</AccordionGroup>

## Core Concepts

### BigNum Precision

The Drift SDK uses [bn.js](https://github.com/indutny/bn.js/) for numerical values to handle Solana's precise token amounts. All numbers are represented as integers with specific precision levels:

| Precision Name          | Value | Use Case                       |
| ----------------------- | ----- | ------------------------------ |
| `QUOTE_PRECISION`       | 10^6  | USDC amounts                   |
| `PRICE_PRECISION`       | 10^6  | Market prices                  |
| `BASE_PRECISION`        | 10^9  | Base asset amounts (e.g., SOL) |
| `AMM_RESERVE_PRECISION` | 10^9  | AMM calculations               |

<Note>
  A value of `10,500,000` with `QUOTE_PRECISION` (10^6) equals `10.5 USDC`
</Note>

### Markets

Drift supports multiple perpetual markets (SOL-PERP, BTC-PERP, ETH-PERP, etc.). Each market has:

* A unique market index
* An oracle for price feeds
* AMM parameters for liquidity
* Funding rate mechanisms

### Account Structure

Users interact with Drift through:

1. **User Account**: Your trading account on Drift (created on first deposit)
2. **Collateral**: USDC or other supported tokens deposited as margin
3. **Positions**: Open perpetual positions across various markets
4. **Orders**: Limit orders, market orders, and other order types

## Example Bots & Integrations

Looking to build automated strategies? Check out example implementations:

* [Keeper Bots](https://github.com/drift-labs/keeper-bots-v2) - Market makers, liquidators, fillers, and more
* Automated trading strategies
* Arbitrage bots
* Liquidation engines

## Network Support

The SDK supports both Solana networks:

<CodeGroup>
  ```typescript Mainnet theme={null}
  const sdkConfig = initialize({ env: 'mainnet-beta' });
  ```

  ```typescript Devnet theme={null}
  const sdkConfig = initialize({ env: 'devnet' });
  ```
</CodeGroup>

<Warning>
  Devnet provides a USDC faucet for testing. Mainnet requires real USDC deposits.
</Warning>

## Community & Support

<CardGroup cols={3}>
  <Card title="Discord" icon="discord" href="https://discord.com/channels/849494028176588802/878700556904980500">
    Join the Drift community
  </Card>

  <Card title="Documentation" icon="book" href="https://docs.drift.trade/">
    Universal Drift docs
  </Card>

  <Card title="GitHub" icon="github" href="https://github.com/drift-labs/protocol-v2">
    View the source code
  </Card>
</CardGroup>

## Next Steps

<Steps>
  <Step title="Install the SDK">
    Follow our [installation guide](/installation) to set up the Drift SDK in your project
  </Step>

  <Step title="Complete the Quickstart">
    Learn how to [place your first trade](/quickstart) with our step-by-step tutorial
  </Step>

  <Step title="Explore Advanced Features">
    Dive into the [TypeScript API docs](https://drift-labs.github.io/protocol-v2/sdk/) to build sophisticated trading applications
  </Step>
</Steps>

## License

Drift Protocol v2 is licensed under [Apache 2.0](https://github.com/drift-labs/protocol-v2/blob/master/LICENSE).
