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

# Create a smart account

> Create a Rhinestone smart account and configure its owners.

A Rhinestone smart account is a smart contract wallet. It doesn't hold keys. Instead, you configure one or more signers that are authorised to control it. The account is deployed on the first transaction, not at creation time.

## Create an account

Pass the owner signer when calling `createAccount`. Here's an example using an external wallet (MetaMask) via Viem:

```ts theme={null}
import { RhinestoneSDK, walletClientToAccount } from '@rhinestone/sdk'
import { createWalletClient, custom } from 'viem'
import { sepolia } from 'viem/chains'

const walletClient = createWalletClient({
  chain: sepolia,
  transport: custom(window.ethereum!),
})

const rhinestone = new RhinestoneSDK({
  apiKey: process.env.RHINESTONE_API_KEY as string,
})

const signer = walletClientToAccount(walletClient)

const account = await rhinestone.createAccount({
  owners: {
    type: 'ecdsa',
    accounts: [signer],
  },
})

const accountAddress = account.getAddress()
```

The SDK derives a deterministic account address from the owner configuration. The same owners always produce the same address, with no deployment transaction required upfront.

<Note>Creating an account only computes a counterfactual address. The smart contract is not deployed until you send the first outbound transaction on a given chain. Receiving tokens (funding the address) does not trigger deployment.</Note>

<Warning>The smart account address is not the same as the signer address. If you look up your signer (EOA) on a block explorer, it will appear as a regular account. The smart account is a separate contract address derived from the owner configuration.</Warning>

## Custom nonce

By default, the SDK uses a nonce of `0` to derive the account address. Pass a custom nonce to get a different address for the same set of owners. This is useful when you need multiple accounts per signer.

```ts theme={null}
const account = await rhinestone.createAccount({
  owners: {
    type: 'ecdsa',
    accounts: [signer],
  },
  account: {
    nonce: 1n,
  },
})
```

<Note>Different nonce = different account address, even with identical owners.</Note>

## Restore an existing account

There is no `importAccount` method. The SDK derives the account address deterministically from the owner configuration, so calling `createAccount` with the same owners (and nonce) always returns the same account. To restore an account in a new session or on a different device, just call `createAccount` again with the original signer:

```ts theme={null}
// Same signer + same nonce = same account address, every time
const account = await rhinestone.createAccount({
  owners: {
    type: 'ecdsa',
    accounts: [signer],
  },
})
```

No state is lost. The account's onchain history, balances, and modules are all tied to the deterministic address, not to the SDK instance.

## Choose a signer type

The example above uses an ECDSA signer (external wallet). Rhinestone supports several signer types: passkeys, embedded wallets, external wallets, and multi-factor combinations.

<CardGroup cols={2}>
  <Card title="Signer types" icon="key" href="./setup-signer">
    Choose the right signer for your use case: native keys, embedded wallets, or external wallets.
  </Card>

  <Card title="EIP-7702" icon="zap" href="./eip-7702">
    Add smart account features to an existing EOA without changing its address.
  </Card>
</CardGroup>
