---
title: "Deposits and withdrawals"
description: "Deposit from other chains through your deposit addresses, and withdraw USDT to other chains through the bridge: quote, sign a transfer, track the payout."
order: 33
llms: account, signing
---

Use this page to move funds between Grvt and wallets on other chains from code:

- **Deposits:** each main account has a deposit address on every supported chain. Tokens sent there are
  bridged to Grvt and credited to your main account.
- **Withdrawals to other chains** go through Grvt's bridge partner: get a quote, sign a transfer, then track
  the payout.
- **Withdrawals to Ethereum** use the [withdrawal](../reference/rpc/withdrawal.md) call instead, which the SDKs
  have.

The deposit address and bridge calls are on the edge host and have no SDK methods yet. Send them over HTTP as
shown here.

## Authenticate edge calls

- **Deposit addresses:** send your API key in an `X-API-Key` header. A session cookie from a login works too.
- **Bridge withdrawals:** send the session cookie, `Cookie: gravity=...`, from a login
  ([Authentication](authentication.md#by-hand)). The API key header alone gets HTTP 401
  (`err_auth_user_not_logged_in`).

Errors come back with an HTTP status and a body like
`{"code": "err_withdrawal_quote_expired", "message": "withdrawal quote has expired", "params": {}}`. Match on
`code`.

## Get your deposit addresses

```sh
export GRVT_DOMAIN=testnet.grvt.io
curl -sS "https://edge.$GRVT_DOMAIN/api/v1/deposit/addresses" \
  -H "X-API-Key: $GRVT_API_KEY"
```

The response lists one entry per chain:

```json nocheck
{
  "chains": [
    {
      "chain": "BASE_SEPOLIA",
      "chain_id": "84532",
      "deposit_address": "0x...",
      "supported_tokens": [{"name": "USDT", "contract_address": "0x..."}]
    },
    {
      "chain": "SOLANA_TEST",
      "chain_id": "solana_test",
      "deposit_address": "",
      "supported_tokens": [{"name": "USDT", "contract_address": "..."}]
    }
  ]
}
```

| Field | Meaning |
|---|---|
| `chain` | The chain's name. Pass it back exactly as returned. |
| `chain_id` | The EVM chain ID, or a name for chains without one, such as `"solana"` and `"tron"` (`"solana_test"` and `"tron_test"` on testnet). |
| `deposit_address` | Send tokens here. Empty when the address doesn't exist yet ([Create an address](#create-an-address-on-another-chain)). |
| `supported_tokens` | The tokens you can deposit on this chain, with their contract addresses. |
| `token_out` | Present only when deposits are credited as a different token, which it names. |

**Watch out:**

- The chains and tokens differ by environment and change over time. Read them from this call; don't hard-code
  them.
- A `contract_address` can be empty when Grvt couldn't look it up. Call again before you send that token.
- A new account fails with `err_chain_account_not_setup` ("funding account is not set up") until its main
  account is set up.

### Create an address on another chain

**When:** a chain is listed with an empty `deposit_address`.

```sh
curl -sS "https://edge.$GRVT_DOMAIN/api/v1/deposit/generate-address" \
  -H "X-API-Key: $GRVT_API_KEY" \
  -H "Content-Type: application/json" \
  --data '{"chain": "SOLANA_TEST"}'
```

It returns one entry in the same shape, with the new `deposit_address`. The chain name is not case-sensitive.
An unknown chain fails with `err_deposit_chain_not_supported`, and a chain that isn't open to your account with
`err_deposit_chain_not_available`.

### Track deposits

A bridged deposit arrives in your main account as a transfer with `transfer_type`
`NON_NATIVE_BRIDGE_DEPOSIT`. Find it with [transfer_history](../reference/rpc/transfer_history.md).

## Withdraw to another chain

**When:** you send USDT from your main account to a wallet on another chain.

Before you start:

- The destination address must be in your main account's withdrawal address book.
- The signing wallet needs the **External Transfer** (or Admin) permission on the main account
  ([Permissions](accounts.md#permissions)). The withdrawal is a transfer to the bridge partner's Grvt account.
- The funds must be in the main account. Move them from a sub-account with
  [transfer](../reference/rpc/transfer.md) first.

1. Read the routes and the bridge partner's account:

   ```sh
   curl -sS "https://edge.$GRVT_DOMAIN/api/v1/bridge/withdrawal-info" -H "Cookie: gravity=$GRVT_COOKIE"
   ```

   ```json nocheck
   {
     "provider": "RHINO",
     "funding_address": "0x...",
     "route": {
       "USDT": [{"chain": "BASE_SEPOLIA", "chain_id": "84532", "chain_type": "evm", "tokens_out": ["USDT"]}],
       "USDC": []
     }
   }
   ```

   `route` maps each token you can send (`token_in`) to the chains and tokens it can arrive as. Only USDT can
   be withdrawn this way today.

2. Get a quote. Nothing moves yet.

   ```sh
   curl -sS "https://edge.$GRVT_DOMAIN/api/v1/bridge/withdrawal-quote" \
     -H "Cookie: gravity=$GRVT_COOKIE" \
     -H "Content-Type: application/json" \
     --data '{"to_address": "0x...", "chain": "BASE_SEPOLIA", "token_in": "USDT", "token_out": "USDT", "amount": "100"}'
   ```

   The reply has `quote_id`, `pay_amount` (what leaves your main account), `receive_amount` (what arrives),
   `fee` (in `token_in`), `fee_usd`, `speed` and `expires_at`. All amounts are decimal strings.

3. Sign a [Transfer](../reference/signing/Transfer.md) from your main account to the bridge partner, with the
   quote's amount:

   | Field | Value |
   |---|---|
   | `fromAccount` | your main account ID |
   | `fromSubAccount` | `0` |
   | `toAccount` | `funding_address` from step 1 |
   | `toSubAccount` | `0` |
   | `tokenCurrency` | the `id` of USDT from [get_currency](../reference/rpc/get_currency.md) |
   | `numTokens` | `pay_amount` × 10^`balance_decimals` of USDT |
   | `nonce`, `expiration` | a random uint32; unix nanoseconds, at most 30 days ahead |

   [Signing](signing.md) explains the domain and the hashing.

4. Send the quote ID and the signature before `expires_at`:

   ```sh
   curl -sS "https://edge.$GRVT_DOMAIN/api/v1/bridge/withdraw" \
     -H "Cookie: gravity=$GRVT_COOKIE" \
     -H "Content-Type: application/json" \
     --data @- <<'EOF'
   {
     "quote_id": "...",
     "signature": {"signer": "0x...", "r": "0x...", "s": "0x...", "v": 28,
                   "expiration": "1767225600000000000", "nonce": 1002, "chain_id": 326}
   }
   EOF
   ```

   Here `chain_id` is a number, not a string as in other signed requests. You can leave it out: Grvt then uses
   its own chain ID.

   HTTP 202 means the transfer was sent: `{"quote_id", "tx_id", "state": "SUBMITTED", "receive_amount", "fee",
   "fee_usd"}`.

5. Check progress until the state is final:

   ```sh
   curl -sS "https://edge.$GRVT_DOMAIN/api/v1/bridge/withdrawal-status?quote_id=$QUOTE_ID" \
     -H "Cookie: gravity=$GRVT_COOKIE"
   ```

   The reply has `state`, `chain`, `token_out`, `receive_amount` and, once paid, `withdraw_tx_hash` on the
   destination chain.

| State | Meaning |
|---|---|
| `CREATED` | Quoted, not sent. |
| `SUBMITTED` | Sent to the bridge partner; payout not started. |
| `SENDING` | The bridge partner is paying out. |
| `COMPLETED` | Paid out. Final. |
| `REFUNDED` | Not paid out; the funds were returned. Final. |
| `FAILED` | Not paid out. Final. |

**Watch out:**

- If step 4 times out or returns a 5xx, the withdrawal may still go through. Check the status, or send the same
  request again with the same signature: if it went through, you get the first reply back. A quote can be sent
  only once, so retrying it can't withdraw twice.
- Don't get a new quote and sign again until the status of the first one is final, or you may withdraw twice.
- A quote past `expires_at` fails with `err_withdrawal_quote_expired` (HTTP 410). Get a new one.

<details>
<summary>Errors</summary>

| Status | Code | Cause |
|---|---|---|
| 404 | `err_withdrawal_address_not_in_address_book` | `to_address` isn't in the withdrawal address book for this chain type. |
| 422 | `err_withdrawal_token_not_supported` | `token_in` isn't USDT. |
| 422 | `err_withdrawal_route_not_supported` | This chain and `token_out` aren't a route right now. |
| 422 | `err_withdrawal_amount_below_fee` | The amount doesn't cover the fee. |
| 422 | `err_withdrawal_limit_exceeded` | A daily limit or the bridge's available funds would be exceeded. |
| 422 | `err_withdrawal_insufficient_balance` | The main account doesn't hold `pay_amount`. |
| 400 | `err_withdrawal_signature_invalid` | The signature doesn't match the quote, or has expired. |
| 403 | `err_withdrawal_address_rejected` | The destination failed screening or can't be used. |
| 403 | `err_user_has_insufficient_permissions` | The signing wallet lacks External Transfer. |
| 409 | `err_withdrawal_already_executed` | This quote was already sent. |
| 410 | `err_withdrawal_quote_expired` | Get a new quote. |
| 404 | `err_withdrawal_not_found` | No withdrawal with this `quote_id` for your account. |

</details>
