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

# Earn

# Earn

Move part of a shielded balance into an ERC-4626 yield vault and back without
leaving the pool. A deposit spends a private note of the vault's asset, the
external call gateway calls the vault, and the vault shares come back as a
private note. A withdrawal redeems shares the same way and credits the asset.
If the vault call can't deliver the signed minimum, the input is refunded to
your private balance instead. Like [swaps](https://docs.privacyboost.io/sdk/cli/guides/swaps.md), earn is a gateway feature
that each deployment enables separately; see [Earn](https://docs.privacyboost.io/sdk/concepts/earn.md).

> [!NOTE]
>
> `earn deposit` and `earn withdraw` need your wallet private key on each run
> (the CLI prompts for it, or reads `PRIVATE_KEY`). `earn vaults` and
> `earn history` are public reads, and `earn status` runs on a saved `login`
> session.

## Finding Vaults

```bash theme={null}
privacy-boost earn vaults
```

This prints the deployment's vault catalog as JSON. For each vault, note
`vaultAddress`, the `asset` it takes (with its `decimals`), `apy` (fractions:
`0.05` is 5%), and `availability`, which says whether deposits and redemptions
can be submitted right now.

The catalog is optional. A deployment without it fails this command but still
supports deposits and withdrawals; get the vault address from the deployment's
operator instead.

## Depositing

```bash theme={null}
privacy-boost earn deposit \
  --vault 0xVault... \
  --amount 100 \
  --human \
  --decimals 6
```

`--amount` is net: exactly the assets that enter the vault. The Gateway fee
replaces the regular unshield fee and is charged on top, so your balance of the
asset has to cover both. With `--human`, `--decimals` is the asset's decimals
(default 18).

`--slippage-bps` sets how far below the vault's on-chain preview the result may
land (default 100, or 1%). The deployment caps it. If the vault would mint fewer
shares than that minimum when the request executes, the deposit is refunded,
and the fee is still charged.

Output:

```
Earn deposit submitted
  Request ID:  <request-id>
  Vault:       0xVault...
  Amount:      100000000
  Fee:         <fee>
  Expected out: <expected-shares>
  Min out:     <minimum-shares>
  Expires at block 12345678
Track credit with: privacy-boost earn status <request-id>
```

`-o json` prints the same result as JSON.

## Withdrawing

Shares sit in your shielded balance under the vault address:

```bash theme={null}
privacy-boost balance --token 0xVault...
```

`earn withdraw` redeems them. `--amount` is a number of shares, and the fee is
charged in shares on top of it, so leave room for it when you withdraw
everything. With `--human`, `--decimals` is the share token's decimals
(default 18), which can differ from the asset's.

```bash theme={null}
privacy-boost earn withdraw --vault 0xVault... --amount 50 --human
```

## Tracking an Operation

```bash theme={null}
privacy-boost earn status <request-id>
```

The status is printed as JSON and includes the gateway projection. Wait for
`creditStatus`: `completed` means the output note was credited, and `rescued`
means the escrow was paid to the rescue destination. Both end the wait.
`settlement` is `fallback` when the vault call missed its minimum and the input
was refunded.

A failure ends the wait too, since it never reaches `completed`: `settlement`
is `failed_before_settlement` when the request failed before it settled
on-chain, or `reorged` when its settlement was reorged out, and `creditStatus`
is `failed` when the credit didn't go through.

In `history`, an earn operation appears as two rows, one per epoch.
`privacy-boost history --collapse-gateway` shows it as one.

## Vault History

`earn history` prints one vault's TVL or net-APY series for a chart. It needs
the catalog.

```bash theme={null}
# One series
privacy-boost earn history --vault 0xVault... --metric netApy --period 1m
# Both series (omit --metric)
privacy-boost earn history --vault 0xVault...
```

`--period` is `1w`, `1m`, `3m`, or `all` (default `1w`). See
[Vault history charts](https://docs.privacyboost.io/sdk/concepts/earn.md#vault-history-charts) for reading the
series.

## Next Steps

* [Commands Reference](https://docs.privacyboost.io/sdk/cli/guides/commands.md#earn-commands)
* [Private Swaps](https://docs.privacyboost.io/sdk/cli/guides/swaps.md)
* [Transaction History](https://docs.privacyboost.io/sdk/cli/guides/transactions.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.