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

# Quickstart

> Make your first trade.

Go from an empty wallet to a resting ETH-PERP order on **testnet** in five steps.

<CodeGroup>
  ```bash TypeScript (SDK) theme={null}
  npm install @derivexyz/derive-ts ethers ws
  ```

  ```bash Python (SDK) theme={null}
  # Coming soon.
  ```

  ```bash Rust (SDK) theme={null}
  # Coming soon.
  ```
</CodeGroup>

Set `PRIVATE_KEY` (your account owner wallet) in your environment before running
the snippets below. The examples use a public Sepolia RPC endpoint, so no RPC
setup is needed.

<Steps>
  <Step title="Get Sepolia ETH for gas">
    Your wallet pays gas for the on-chain deposit. Grab testnet ETH from the
    [Google Cloud Sepolia faucet](https://cloud.google.com/application/web3/faucet/ethereum/sepolia).
  </Step>

  <Step title="Mint testnet USDC">
    Open [testnet.app.derive.xyz/developers](https://testnet.app.derive.xyz/developers),
    connect your wallet, and click **Mint** to receive testnet USDC — the collateral
    you'll deposit in the next step.
  </Step>

  <Step title="Choose a manager and risk universe">
    Every subaccount lives under a **manager** in a **risk universe** — together they
    set the margin model and which markets you can trade. Risk universe 1 is the
    **prime** universe, where ETH-PERP trades. See
    [Managers & risk universes](/trading/managers-and-risk-universes) for the full model.

    <CodeGroup>
      ```typescript TypeScript (SDK) theme={null}
      import { DeriveClient } from '@derivexyz/derive-ts';
      import { JsonRpcProvider, Wallet } from 'ethers';

      const client = new DeriveClient({
        network: 'testnet',
        wallet: process.env.PRIVATE_KEY!,
      });

      // Find USDC's spot asset and the prime-universe (risk universe 1) manager.
      const currencies = await client.marketData.getAllCurrencies();
      const usdc = currencies.find((c) => c.currency === 'USDC')!;
      const spotAsset = usdc.spot.find((s) => s.name === 'USDC') ?? usdc.spot[0];

      const prime = usdc.managers.find((m) => m.risk_universe_id === 1)!;
      const managerId = prime.sm; // standard-margin manager for the prime universe
      ```

      ```python Python (SDK) theme={null}
      # Coming soon.
      ```

      ```rust Rust (SDK) theme={null}
      // Coming soon.
      ```
    </CodeGroup>
  </Step>

  <Step title="Deposit to create your account">
    Your first deposit creates your Derive account and its first subaccount under the
    manager you chose — there is no separate "create account" call. Your wallet
    submits the on-chain deposit.

    <CodeGroup>
      ```typescript TypeScript (SDK) theme={null}
      // Snapshot subaccounts so we can spot the new one after depositing.
      const knownSubaccountIds = await client.subaccounts.list();

      // Your wallet signs the on-chain ActionManager tx (ERC-20 approve + deposit).
      const rpcUrl = 'https://ethereum-sepolia-rpc.publicnode.com';
      const signer = new Wallet(
        process.env.PRIVATE_KEY!,
        new JsonRpcProvider(rpcUrl),
      );
      await client.deposits.contractCall.depositToNewSubaccount({
        signer,
        asset: spotAsset.address,
        amount: '100',
        managerId,
      });

      // The exchange assigns the subaccount id once it sees the deposit (~2 min).
      const subaccountId = await client.deposits.awaitNewSubaccount({
        knownSubaccountIds,
      });
      console.log(`account ready: subaccount ${subaccountId}`);
      ```

      ```python Python (SDK) theme={null}
      # Coming soon.
      ```

      ```rust Rust (SDK) theme={null}
      // Coming soon.
      ```
    </CodeGroup>
  </Step>

  <Step title="Place an ETH-PERP order">
    Open the WebSocket, log in, and place a limit order. `place()` encodes the trade
    action, EIP-712-signs it locally with your key, and submits `private/order` — the
    exchange only ever settles what you signed.

    <CodeGroup>
      ```typescript TypeScript (SDK) theme={null}
      await client.connect(); // open the websocket
      await client.login(); // authenticate the session — required for private/*

      const { order } = await client.orders.place({
        subaccountId,
        instrumentName: 'ETH-PERP',
        direction: 'buy',
        amount: '1',
        limitPrice: '3100', // rests below market
      });
      console.log(`${order.order_id}: ${order.order_status} @ ${order.limit_price}`);

      await client.close();
      ```

      ```python Python (SDK) theme={null}
      # Coming soon.
      ```

      ```rust Rust (SDK) theme={null}
      // Coming soon.
      ```
    </CodeGroup>

    <Tip>
      `maxFee` caps the fee baked into the signature; omit it and the SDK defaults
      to 3× the current taker cost. To stream your fills as they happen, subscribe
      to the `{subaccountId}.trades` channel — see [Subscriptions](/subscriptions).
    </Tip>
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Authentication" href="/authentication/session-login">
    Session login, JWT, and the wallet-vs-session-key auth paths.
  </Card>

  <Card title="Action signing" href="/authentication/action-signing">
    The full EIP-712 `Action` envelope, per-module `data` layouts, and nonces.
  </Card>

  <Card title="Session keys" href="/authentication/session-keys">
    Delegate a signing key so you never hot-wire your wallet into a bot.
  </Card>

  <Card title="Contracts" href="/getting-started/contracts">
    On-chain contract addresses per deployment (action manager, vApp, outbox,
    spot vault).
  </Card>
</CardGroup>


## Related topics

- [Programmatic Onboarding](/getting-started/depositing.md)
- [Introduction](/getting-started/introduction.md)
