> ## 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.

# Architecture

> How Rhaios uses EIP-7702 for non-custodial smart wallet yield.

# Architecture

Rhaios uses a non-custodial architecture where your agent's EOA gains smart wallet capabilities through EIP-7702 delegation. Rhaios never holds keys or funds.

## Why this is agent-safe for money movement

Autonomous agents need trustworthy intelligence and deterministic boundaries for financial actions. Rhaios enforces that boundary by returning structured execution plans, requiring caller-side signatures, and validating signed payloads before relay.

The result is an execution path that is safer than free-form API scripting for value transfer:

* Typed endpoint inputs and outputs
* Explicit prepare -> sign -> execute transitions
* Non-custodial signing boundary in the runtime wallet layer
* Inspectable post-execution state via status/history endpoints

## EIP-7702 delegation

[EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) lets an EOA temporarily delegate its execution to a smart contract implementation. Your agent's EOA delegates to a [Nexus](https://docs.biconomy.io/nexus) smart account, gaining access to:

* **Batch operations** — approve + deposit in a single transaction
* **Module system** — execution module for batched yield operations
* **Gas abstraction** — pay gas in USDC instead of ETH

The delegation is set by signing an authorization and including it in a Type 4 transaction. Your agent's key never leaves its control.

## Flow

```mermaid theme={null}
sequenceDiagram
    participant Agent as Agent EOA
    participant A2Y as Rhaios API
    participant Chain as Base

    Agent->>A2Y: POST /v1/yield/prepare
    A2Y->>A2Y: Find best vault, build calldata
    A2Y-->>Agent: Unsigned calldata + vault info

    Note over Agent: Agent signs with own key

    Agent->>A2Y: POST /v1/yield/execute
    A2Y->>Chain: Submit UserOperation via relayer
    Chain-->>A2Y: Receipt
    A2Y-->>Agent: Transaction hash + position update
```

## First-time setup

When `POST /v1/yield/prepare` detects that an agent's EOA has no EIP-7702 delegation, it returns setup-only details for a direct EIP-7702 type-4 transaction. That setup transaction:

1. Delegates the EOA to the Nexus smart account implementation
2. Initializes the account with the default validator (signature verification) and execution module (yield operations)

After setup confirms on-chain, call `POST /v1/yield/prepare` again for the deposit/redeem/rebalance UserOperation payload.

## Smart account modules

| Module        | Role                                                                  |
| ------------- | --------------------------------------------------------------------- |
| **Validator** | Default validator — verifies the agent's signatures on all operations |
| **Executor**  | Executes yield operations (approve, deposit, redeem)                  |

## Preflight simulation

When preflight simulation is enabled, `POST /v1/yield/execute` creates an ephemeral [test RPC](/concepts/test-rpc) at the latest block, simulates the signed transaction, and only submits to the bundler if simulation succeeds. The ephemeral fork is destroyed after each simulation regardless of outcome.

This prevents failed transactions from reaching the chain and wasting gas. Simulation failures are surfaced as errors — there is no "observe-only" mode that would allow a failed simulation to proceed.

## Execution Infrastructure

Rhaios builds on audited open-source contracts for on-chain execution:

* **[Superform v2-core](https://github.com/superform-xyz/v2-core)** — audited intent validation (SuperValidator), batched yield operations (SuperExecutor), and pre/post-execution safety hooks
* **[Biconomy Nexus v1.2.0](https://github.com/bcnmy/nexus)** — smart account implementation for EIP-7702 delegation ([audit reports](https://github.com/bcnmy/nexus/tree/main/audits))

Rhaios is the yield intelligence and strategy layer on top of this execution infrastructure — vault discovery, risk scoring, strategy selection, and execution plan construction.

## What Rhaios does and does not do

| Rhaios does                               | Rhaios does not                  |
| ----------------------------------------- | -------------------------------- |
| Find and score yield vaults               | Hold your agent's private key    |
| Build unsigned transaction calldata       | Custody funds                    |
| Simulate before submitting (when enabled) | Sign transactions on your behalf |
| Submit signed transactions to the chain   | Control your smart wallet        |
| Track positions and yield                 |                                  |
