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

# Set up recovery

> Install guardian recovery for an SDK-managed smart account.

Social recovery lets one or more guardian accounts rotate the smart account's owner-validator configuration. Guardians cannot send normal transactions, but they can replace owners without approval from the current owner.

<Warning>
  There is no recovery time delay. A guardian threshold can take ownership
  immediately. Prefer several independently controlled guardians and a threshold
  greater than one.
</Warning>

This SDK flow is separate from [managed wallet recovery](/wallets/recovery/set-up). Managed recovery verifies a user's email or OAuth identity and registers a new app-origin passkey. The Custom signer flow below installs accounts you control as on-chain guardians.

Follow the [Custom signer quickstart](/wallets/custom-signer/quickstart) first. Configure a production bundler as described in [ERC-4337](/wallets/custom-signer/configuration/erc-4337); guardian recovery uses UserOperations, not Rhinestone intents.

## Install during account creation

Add recovery to the account configuration:

```ts theme={null}
const rhinestoneAccount = await rhinestone.createAccount({
  owners: {
    type: "ecdsa",
    accounts: [ownerAccount],
  },
  recovery: {
    guardians: [guardianAccountA, guardianAccountB, guardianAccountC],
    threshold: 2,
  },
});
```

The threshold defaults to `1`. Recovery is installed with the account's other modules when the account is deployed on a chain.

## Install on an existing account

Install the recovery validator with an owner-signed UserOperation:

```ts theme={null}
import { enable as enableRecovery } from "@rhinestone/sdk/actions/recovery";

const result = await rhinestoneAccount.sendUserOperation({
  chain,
  calls: [
    enableRecovery([guardianAccountA, guardianAccountB, guardianAccountC], 2),
  ],
});
await rhinestoneAccount.waitForExecution(result);
```

Set up recovery on every chain where the account needs it. Module installation on one chain does not install it elsewhere.

## Nexus constraints

Nexus accounts must use Ownable V0 as both their configured owner validator and the recovery target:

```ts theme={null}
const ownableV0Address = "0x2483da3a338895199e5e538530213157e931bf06";

const rhinestoneAccount = await rhinestone.createAccount({
  account: { type: "nexus" },
  owners: {
    type: "ecdsa",
    accounts: [ownerAccount],
    module: ownableV0Address,
  },
  recovery: {
    guardians: [guardianAccount],
  },
});
```

An existing Nexus account using the default owner validator must migrate while its current owner is still available. Adding `recovery` to the local SDK configuration does not migrate an already deployed account.

<Warning>
  Guardian recovery does not support EIP-7702 Nexus accounts. Recovery modules
  cannot revoke the EOA's authority over its delegated account.
</Warning>

Continue with [Recover an account](/wallets/custom-signer/recovery/recover-an-account).
