> For the complete documentation index, see [llms.txt](/llms.txt).

# Create a smart account

You can enable users to create a [MetaMask smart account](/smart-accounts-kit/concepts/smart-accounts/) directly in your dapp. Use [toMetaMaskSmartAccount](/smart-accounts-kit/reference/smart-account/#tometamasksmartaccount)to create different types of smart accounts with different signature schemes.

## Prerequisites[​](#prerequisites "Direct link to Prerequisites")

[Install and set up the Smart Accounts Kit.](/smart-accounts-kit/get-started/install/)

## Hybrid smart account[​](#hybrid-smart-account "Direct link to Hybrid smart account")

A [Hybrid smart account](/smart-accounts-kit/concepts/smart-accounts/#hybrid-smart-account) supports both an [EOA](/smart-accounts-kit/development/reference/glossary#externally-owned-account-eoa)**Externally owned account (EOA)** A private-key-controlled account with no built-in programmable execution logic. owner and any number of [passkey](/smart-accounts-kit/development/reference/glossary#passkey)**Passkey** A cryptographic key that can be used to sign transactions instead of a private key. (WebAuthn) [signers](/smart-accounts-kit/development/reference/glossary#signer)**Signer** An account that can sign transactions for a smart account..

This example uses `toMetaMaskSmartAccount` and Viem's [Wallet Client](https://viem.sh/docs/clients/wallet)to create a Hybrid smart account. The `signer` parameter also accepts Viem's [Local Account](https://viem.sh/docs/accounts/local) and [WebAuthnAccount](https://viem.sh/account-abstraction/accounts/webauthn#webauthn-account).

See the [toMetaMaskSmartAccount](/smart-accounts-kit/reference/smart-account/#tometamasksmartaccount) API reference for more information.

- example.ts
- client.ts
- signer.ts

```
import { publicClient } from './client.ts'
import { walletClient } from './signer.ts'
import { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit'

// Some wallets like MetaMask may require you to request access to
// account addresses using walletClient.requestAddresses() first.
const [address] = await walletClient.getAddresses()

const smartAccount = await toMetaMaskSmartAccount({
  client: publicClient,
  implementation: Implementation.Hybrid,
  deployParams: [address, [], [], []],
  deploySalt: '0x',
  signer: { walletClient },
})

```

```
import { http, createPublicClient } from 'viem'
import { sepolia as chain } from 'viem/chains'

const transport = http()
export const publicClient = createPublicClient({
  transport,
  chain,
})

```

```
import { sepolia as chain } from 'viem/chains'
import { createWalletClient, custom } from 'viem'

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

```

## Multisig smart account[​](#multisig-smart-account "Direct link to Multisig smart account")

A [Multisig smart account](/smart-accounts-kit/concepts/smart-accounts/#multisig-smart-account) supports multiple [EOA](/smart-accounts-kit/development/reference/glossary#externally-owned-account-eoa)**Externally owned account (EOA)** A private-key-controlled account with no built-in programmable execution logic. [signers](/smart-accounts-kit/development/reference/glossary#signer)**Signer** An account that can sign transactions for a smart account. with a configurable threshold for execution.

This example uses [toMetaMaskSmartAccount](/smart-accounts-kit/reference/smart-account/#tometamasksmartaccount) to create a Multisig smart account with a combination of account signers and Wallet Client signers.

- example.ts
- client.ts
- signers.ts

```
import { publicClient } from './client.ts'
import { account, walletClient } from './signers.ts'
import { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit'

const owners = [account.address, walletClient.address]
const signer = [{ account }, { walletClient }]
const threshold = 2n

const smartAccount = await toMetaMaskSmartAccount({
  client: publicClient,
  implementation: Implementation.MultiSig,
  deployParams: [owners, threshold],
  deploySalt: '0x',
  signer,
})

```

```
import { http, createPublicClient } from 'viem'
import { sepolia as chain } from 'viem/chains'

const transport = http()
export const publicClient = createPublicClient({
  transport,
  chain,
})

```

```
import { privateKeyToAccount, generatePrivateKey } from 'viem/accounts'
import { sepolia as chain } from 'viem/chains'
import { http, createWalletClient } from 'viem'

// This private key will be used to generate the first signer.
const privateKey = generatePrivateKey()
export const account = privateKeyToAccount(privateKey)

// This private key will be used to generate the second signer.
const walletClientPrivateKey = generatePrivateKey()
const walletClientAccount = privateKeyToAccount(walletClientPrivateKey)

export const walletClient = createWalletClient({
  account: walletClientAccount,
  chain,
  transport: http(),
})

```

note

The number of signers must be at least equal to the threshold to generate a valid signature.

## EIP-7702 smart account[​](#eip-7702-smart-account "Direct link to EIP-7702 smart account")

An [EIP-7702 smart account](/smart-accounts-kit/concepts/smart-accounts/#stateless-7702-smart-account) represents an [EOA](/smart-accounts-kit/development/reference/glossary#externally-owned-account-eoa)**Externally owned account (EOA)** A private-key-controlled account with no built-in programmable execution logic. that has been upgraded to support [MetaMask Smart Accounts](/smart-accounts-kit/development/reference/glossary#metamask-smart-account)**MetaMask smart account** A smart contract account created using the Smart Accounts Kit that supports programmable behavior, flexible signing options, and ERC-7710 delegations. functionality as defined by [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702).

This example uses [toMetaMaskSmartAccount](/smart-accounts-kit/reference/smart-account/#tometamasksmartaccount)and Viem's [privateKeyToAccount](https://viem.sh/docs/accounts/local/privateKeyToAccount) to create an EIP-7702 smart account. This example doesn't handle the upgrade process; see the [EIP-7702 quickstart](/smart-accounts-kit/get-started/smart-account-quickstart/eip7702/) to learn how to upgrade.

Important

The EIP-7702 implementation only works with Viem's [Local Accounts](https://viem.sh/docs/accounts/local). It doesn't work with a [JSON-RPC Account](https://viem.sh/docs/accounts/jsonRpc) like MetaMask.

See the [Upgrade a MetaMask EOA to a smart account](https://metamask-docs-f8nytczy3-consensys-ddffed67.vercel.app/tutorials/upgrade-eoa-to-smart-account/) tutorial.

- example.ts
- client.ts
- signer.ts

```
import { publicClient } from './client.ts'
import { account } from './signer.ts'
import { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit'

const smartAccount = await toMetaMaskSmartAccount({
  client: publicClient,
  implementation: Implementation.Stateless7702,
  address: account.address,
  signer: { account },
})

```

```
import { http, createPublicClient } from 'viem'
import { sepolia as chain } from 'viem/chains'

const transport = http()
export const publicClient = createPublicClient({
  transport,
  chain,
})

```

```
import { privateKeyToAccount, generatePrivateKey } from 'viem/accounts'

const privateKey = generatePrivateKey()
export const account = privateKeyToAccount(privateKey)

```

## Next steps[​](#next-steps "Direct link to Next steps")

- [Configure signers](/smart-accounts-kit/guides/smart-accounts/signers/) to use a signer that fits your needs.
- [Deploy the smart account](/smart-accounts-kit/guides/smart-accounts/deploy-smart-account/) and [send user operations](/smart-accounts-kit/guides/smart-accounts/send-user-operation/) using [Viem Account Abstraction clients](/smart-accounts-kit/guides/configure-toolkit/).
- [Create delegations](/smart-accounts-kit/guides/delegation/execute-on-smart-accounts-behalf/) to grant scoped permissions to other accounts.
