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

# Quickstart

> Connect your agent to Rhaios and complete an end-to-end yield deposit.

# Quickstart

This page is structured for AI agents. Every step is copy-pasteable.

## Environment Reference

| Key                | Value                                                                                                                     |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| API Base URL       | `https://api.staging.rhaios.com`                                                                                          |
| Health Check       | `GET https://api.staging.rhaios.com/health`                                                                               |
| Supported chains   | `ethereum` (1), `base` (8453)                                                                                             |
| Pricing policy     | `yield_discover` and `yield_prepare` at \$0.01 via x402 (currently not enforced on staging)                               |
| Test RPC endpoints | [`GET /v1/testing/fork-status`](/tools/testing_fork_status), [`POST /v1/testing/fund-wallet`](/tools/testing_fund_wallet) |
| Ops Dashboard      | `https://staging.rhaios.com/ops`                                                                                          |
| Explorers          | `https://etherscan.io`, `https://basescan.org`                                                                            |

***

## Step 1: Verify API health

```bash theme={null}
curl https://api.staging.rhaios.com/health
```

You should receive a `200 OK` response.

***

## Step 2: Set up a wallet

You need an EOA (externally owned account) with a private key for signing transactions. We recommend [Privy](https://privy.io/) for wallet creation — it integrates well with agent runtimes like OpenClaw. Any provider (Turnkey, local key, etc.) also works.

Save your wallet address for use in subsequent calls.

***

## Step 3: Fund your wallet

Rhaios staging runs managed [test RPCs](/concepts/test-rpc) — chain forks that mirror mainnet state. Agents can mint test balances without spending real tokens.

Check test RPC health first:

```bash theme={null}
curl https://api.staging.rhaios.com/v1/testing/fork-status
```

Fund your wallet on the test RPC:

```bash theme={null}
curl -X POST https://api.staging.rhaios.com/v1/testing/fund-wallet \
  -H "Content-Type: application/json" \
  -d '{
    "chain": "base",
    "walletAddress": "0xYOUR_WALLET_ADDRESS",
    "ethWei": "2000000000000000",
    "usdcAmount": "5000000"
  }'
```

Both amounts are in **base units**: `ethWei` is in wei (above = 0.002 ETH), `usdcAmount` is in 6-decimal base units (above = 5 USDC). Max per call: 0.02 ETH / 50 USDC. See [`POST /v1/testing/fund-wallet`](/tools/testing_fund_wallet) for full parameter docs.

This mints test balances on a test RPC only — no real mainnet or Base tokens are involved.

<Note>
  This quickstart uses test RPC execution paths. `POST /v1/testing/fund-wallet` balances exist only on managed chain forks and are the expected funding source for this flow. See [Test RPCs](/concepts/test-rpc) for details on caps and supported tokens.
</Note>

***

## Step 4: Discover Vaults

Browse available vaults before committing:

```bash theme={null}
curl -X POST https://api.staging.rhaios.com/v1/yield/discover \
  -H "Content-Type: application/json" \
  -d '{
    "chain": "base",
    "asset": "USDC",
    "strategy": "balanced"
  }'
```

Expected outcome:

* Returns a ranked list of vaults with APY, risk, TVL, and Sharpe data
* Each vault includes a `vaultId` you can pass to `POST /v1/yield/prepare`

***

## Step 5: Dry-Run Prepare

Pick a vault from the discovery results and prepare a deposit:

```bash theme={null}
curl -X POST https://api.staging.rhaios.com/v1/yield/prepare \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "deposit",
    "chain": "base",
    "asset": "USDC",
    "amount": "1",
    "agentAddress": "0xYOUR_WALLET_ADDRESS",
    "vaultId": "VAULT_ID_FROM_DISCOVERY"
  }'
```

Expected outcome:

* Response includes strategy metadata + setup/execution payload
* If `needsSetup=true`, setup transaction details are returned
* If `needsSetup=false`, an `intentEnvelope` is returned for signing

<Note>
  Pricing policy for `POST /v1/yield/discover` and `POST /v1/yield/prepare` is **\$0.01 per call** via x402 when payment enforcement is enabled. Current staging deployment keeps x402 disabled. See [Payments](/concepts/payments) for details.
</Note>

***

## Step 6: Sign and Execute

After validating the prepare response, sign the `intentEnvelope.signing` payload with your agent's key (EIP-712), then execute:

```bash theme={null}
curl -X POST https://api.staging.rhaios.com/v1/yield/execute \
  -H "Content-Type: application/json" \
  -d '{
    "intentEnvelope": { ... },
    "intentSignature": "0xYOUR_SIGNATURE",
    "intentId": "0xMERKLE_ROOT"
  }'
```

Expected execute result:

```json theme={null}
{
  "executionModel": "erc4337-validator-intent-v1",
  "result": "executed",
  "userOpHash": "0x...",
  "txHash": "0x...",
  "chainId": 8453,
  "chain": "base",
  "receipt": {
    "status": "success"
  },
  "explorerUrl": "https://basescan.org/tx/0x..."
}
```

***

## Step 7: Verify Position

Check positions:

```bash theme={null}
curl "https://api.staging.rhaios.com/v1/yield/status?userAddress=0xYOUR_WALLET_ADDRESS"
```

Confirm:

* Position appears under the selected chain
* Portfolio totals are updated

Check vault history:

```bash theme={null}
curl "https://api.staging.rhaios.com/v1/yield/history?vaultId=42&period=30d"
```

Optional UI check:

```
https://staging.rhaios.com/ops
```

***

## Withdraw from a vault

Call `POST /v1/yield/prepare` with `operation: "redeem"` to withdraw from a position:

```bash theme={null}
curl -X POST https://api.staging.rhaios.com/v1/yield/prepare \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "redeem",
    "chain": "base",
    "agentAddress": "0xYOUR_WALLET_ADDRESS",
    "vaultId": "42",
    "percentage": 100
  }'
```

Then sign and submit the returned `intentEnvelope` via `POST /v1/yield/execute` — the same flow as depositing.

You can use `percentage` (0-100) or `shares` (exact share count), but not both.

***

## Rebalance between vaults

Call `POST /v1/yield/prepare` with `operation: "rebalance"` to move funds from one vault to a better one:

```bash theme={null}
curl -X POST https://api.staging.rhaios.com/v1/yield/prepare \
  -H "Content-Type: application/json" \
  -d '{
    "operation": "rebalance",
    "chain": "base",
    "agentAddress": "0xYOUR_WALLET_ADDRESS",
    "vaultId": "42",
    "percentage": 100
  }'
```

Rebalance atomically redeems from the source vault and deposits into a vault selected by strategy. Sign and execute the same way.

***

## Troubleshooting Quick Reference

| Error                                   | Cause                                                 | Fix                                                                  |
| --------------------------------------- | ----------------------------------------------------- | -------------------------------------------------------------------- |
| `ethWei/usdcAmount exceeds testing cap` | Request over server policy limits                     | Lower request amount or adjust server caps                           |
| `needsSetup=true` repeatedly            | Setup tx not finalized                                | Verify setup tx on explorer, wait for confirmation, retry            |
| `Preflight simulation failed`           | Transaction would revert on-chain                     | Check wallet balance/approvals, re-run `POST /v1/yield/prepare`      |
| `Anvil forks not configured`            | Setup relay requires a [test RPC](/concepts/test-rpc) | Operator config issue — contact Rhaios support                       |
| `AA24` signature validation             | Stale calldata or signer mismatch                     | Re-run `POST /v1/yield/prepare`, then re-sign                        |
| `AA21` prefund issue                    | Insufficient gas funds                                | Fund wallet with more ETH on target chain                            |
| `AA50` postOp reverted                  | Paymaster/relayer path issue                          | Retry once, then inspect relayer/paymaster config                    |
| `No suitable vaults found`              | Active vault filters too strict                       | Use `strategy: "balanced"`, remove extra filters                     |
| `Payment required` (HTTP 402)           | x402 enforcement enabled on deployment                | Attach X-PAYMENT header and retry (pre-prod default is not enforced) |

***

## What's next

* **Explore strategies** — Read [Strategies](/concepts/strategies)
* **Browse all endpoints** — See the [Endpoint Reference](/tools/yield_prepare)
