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

# Quickstart

> Set up the Deposit API and process your first cross-chain deposit.

Register a managed account, deposit USDC on one chain, and receive it on another — all through a few API calls.

## Prerequisites

* A Rhinestone API key
* A wallet with testnet USDC on Optimism Sepolia ([Circle faucet](https://faucet.circle.com/))

<Steps>
  <Step title="Configure your client">
    Set up gas sponsorship so deposit bridging is covered. This is a one-time call per API key.

    ```ts theme={null}
    const DEPOSIT_SERVICE_URL =
      "https://v1.orchestrator.rhinestone.dev/deposit-processor";
    const API_KEY = "YOUR_RHINESTONE_API_KEY";

    const response = await fetch(`${DEPOSIT_SERVICE_URL}/setup`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "x-api-key": API_KEY,
      },
      body: JSON.stringify({
        params: {
          sponsorship: {
            "eip155:84532": { gas: "all" }, // Base Sepolia
            "eip155:11155420": { gas: "all" }, // Optimism Sepolia
          },
        },
      }),
    });

    console.log(`Setup: ${response.status}`);
    ```

    You should see `Setup: 200`.
  </Step>

  <Step title="Register a managed account">
    Register a server-managed account with a target chain and token. The service creates a smart account deterministically from your API key and the salt you provide, and returns deposit addresses.

    ```ts theme={null}
    import { keccak256, toHex } from "viem";

    // Use any unique identifier per user (e.g., internal user ID)
    const salt = keccak256(toHex("user-123"));

    const RECIPIENT = "0xYOUR_RECIPIENT_ADDRESS";
    const TARGET_CHAIN = "eip155:84532"; // Base Sepolia
    const TARGET_TOKEN = "0x036CbD53842c5426634e7929541eC2318f3dCF7e"; // USDC on Base Sepolia

    const registerResponse = await fetch(
      `${DEPOSIT_SERVICE_URL}/register-managed`,
      {
        method: "POST",
        headers: {
          "Content-Type": "application/json",
          "x-api-key": API_KEY,
        },
        body: JSON.stringify({
          account: {
            salt,
            target: {
              chain: TARGET_CHAIN,
              token: TARGET_TOKEN,
              recipient: RECIPIENT,
            },
          },
        }),
      },
    );

    const { evmDepositAddress, solanaDepositAddress } =
      await registerResponse.json();
    console.log(`EVM deposit address: ${evmDepositAddress}`);
    console.log(`Solana deposit address: ${solanaDepositAddress}`);
    ```

    You should see two deposit addresses printed. The `evmDepositAddress` is where users send tokens on any supported EVM chain.
  </Step>

  <Step title="Verify registration">
    ```ts theme={null}
    const check = await fetch(`${DEPOSIT_SERVICE_URL}/check/${evmDepositAddress}`);
    const checkData = await check.json();
    console.log(checkData);
    ```

    You should see:

    ```json theme={null}
    {
      "isRegistered": true,
      "targetChain": "eip155:84532",
      "targetToken": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
      "sourceChains": ["eip155:84532", "eip155:11155420", "eip155:421614"]
    }
    ```
  </Step>

  <Step title="Deposit tokens">
    Transfer USDC to the deposit address on Optimism Sepolia. The deposit service detects it and bridges it to Base Sepolia automatically.

    ```ts theme={null}
    import {
      createWalletClient,
      http,
      encodeFunctionData,
      erc20Abi,
      parseUnits,
    } from "viem";
    import { privateKeyToAccount } from "viem/accounts";
    import { optimismSepolia } from "viem/chains";

    const funder = privateKeyToAccount("0xYOUR_FUNDING_KEY");
    const walletClient = createWalletClient({
      account: funder,
      chain: optimismSepolia,
      transport: http(),
    });

    // USDC on Optimism Sepolia
    const USDC = "0x5fd84259d66Cd46123540766Be93DFE6D43130D7";

    const txHash = await walletClient.sendTransaction({
      to: USDC,
      data: encodeFunctionData({
        abi: erc20Abi,
        functionName: "transfer",
        args: [evmDepositAddress, parseUnits("1", 6)],
      }),
    });

    console.log(`Deposit tx: ${txHash}`);
    ```
  </Step>

  <Step title="Check deposit status">
    Poll the deposits endpoint by transaction hash to track the bridging progress. See [status tracking](/deposits/api/status-tracking#polling) for the full response schema.

    ```ts theme={null}
    async function waitForDeposit(txHash: string) {
      const url = `${DEPOSIT_SERVICE_URL}/deposits?txHash=${txHash}`;

      while (true) {
        const response = await fetch(url, {
          headers: { "x-api-key": API_KEY },
        });
        const { deposits } = await response.json();
        const deposit = deposits[0];

        if (deposit?.status === "completed") {
          console.log("Deposit completed:", deposit.destinationTxHash);
          return deposit;
        }

        if (deposit?.status === "failed") {
          console.error("Deposit failed:", deposit.errorCode);
          return deposit;
        }

        await new Promise((r) => setTimeout(r, 1_000));
      }
    }

    await waitForDeposit(txHash);
    ```

    Once bridging completes, the deposit status changes to `completed` and includes the destination transaction hash. The USDC is now at the recipient address on Base Sepolia.
  </Step>
</Steps>

## Next steps

<CardGroup cols={2}>
  <Card title="Initial setup" icon="settings" href="/deposits/api/initial-setup">
    Webhooks, sponsorship rules, and deposit whitelists.
  </Card>

  <Card title="Account registration" icon="user-plus" href="/deposits/api/account-registration">
    User-owned accounts, session configuration, and output token rules.
  </Card>

  <Card title="Deposit processing" icon="arrow-right-left" href="/deposits/api/deposit-processing">
    Deposit lifecycle, retries, and status tracking.
  </Card>

  <Card title="Status tracking" icon="activity" href="/deposits/api/status-tracking">
    Track deposits via polling or webhooks.
  </Card>
</CardGroup>
