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

# MetaMask Smart Accounts quickstart

You can get started quickly with [MetaMask Smart Accounts](/smart-accounts-kit/development/concepts/smart-accounts/) by creating your first [smart account](/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. and sending a [user operation](/smart-accounts-kit/development/reference/glossary#user-operation)**User operation** A pseudo-transaction object defined by ERC-4337 that describes what a smart account should execute. User operations are submitted to the alternate mempool managed by bundlers..

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

- Install [Node.js](https://nodejs.org/en/blog/release/v18.18.0) v18 or later.
- Install [Yarn](https://yarnpkg.com/), [npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm), or another package manager.

## Steps[​](#steps "Direct link to Steps")

### 1. Install the Smart Accounts Kit[​](#1-install-the-smart-accounts-kit "Direct link to 1. Install the Smart Accounts Kit")

Install the [Smart Accounts Kit](https://www.npmjs.com/package/@metamask/smart-accounts-kit):

- npm
- Yarn
- pnpm
- Bun

```
npm install @metamask/smart-accounts-kit

```

```
yarn add @metamask/smart-accounts-kit

```

```
pnpm add @metamask/smart-accounts-kit

```

```
bun add @metamask/smart-accounts-kit

```

### 2. Set up a Public Client[​](#2-set-up-a-public-client "Direct link to 2. Set up a Public Client")

Set up a Public Client using Viem's [createPublicClient](https://viem.sh/docs/clients/public) function. This client will let the smart account query the signer's account state and interact with the blockchain network.

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

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

```

### 3. Set up a Bundler Client[​](#3-set-up-a-bundler-client "Direct link to 3. Set up a Bundler Client")

Set up a Bundler Client using Viem's [createBundlerClient](https://viem.sh/account-abstraction/clients/bundler) function. This lets you use the [bundler](/smart-accounts-kit/development/reference/glossary#bundler)**Bundler** An ERC-4337 component that manages the alternate mempool: it collects user operations from smart accounts, packages them, and submits them to the network. service to estimate gas for [user operations](/smart-accounts-kit/development/reference/glossary#user-operation)**User operation** A pseudo-transaction object defined by ERC-4337 that describes what a smart account should execute. User operations are submitted to the alternate mempool managed by bundlers. and submit transactions to the network.

```
import { createBundlerClient } from 'viem/account-abstraction'

const bundlerClient = createBundlerClient({
  client: publicClient,
  transport: http('https://your-bundler-rpc.com'),
})

```

### 4. Create a MetaMask smart account[​](#4-create-a-metamask-smart-account "Direct link to 4. Create a MetaMask smart account")

Create a [MetaMask smart account](/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. to send the first [user operation](/smart-accounts-kit/development/reference/glossary#user-operation)**User operation** A pseudo-transaction object defined by ERC-4337 that describes what a smart account should execute. User operations are submitted to the alternate mempool managed by bundlers..

This example configures a Hybrid smart account, which is a flexible smart account implementation that 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:

```
import { Implementation, toMetaMaskSmartAccount } from '@metamask/smart-accounts-kit'
import { privateKeyToAccount } from 'viem/accounts'

const account = privateKeyToAccount('0x...')

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

```

See [Create a MetaMask smart account](/smart-accounts-kit/development/guides/smart-accounts/create-smart-account/) to learn how to configure different smart account types.

### 5. Send a user operation[​](#5-send-a-user-operation "Direct link to 5. Send a user operation")

Send a [user operation](/smart-accounts-kit/development/reference/glossary#user-operation)**User operation** A pseudo-transaction object defined by ERC-4337 that describes what a smart account should execute. User operations are submitted to the alternate mempool managed by bundlers. using Viem's [sendUserOperation](https://viem.sh/account-abstraction/actions/bundler/sendUserOperation) method.

The smart account will remain counterfactual until the first user operation. If the smart account is not deployed, it will be automatically deployed upon the sending first user operation.

```
import { parseEther } from 'viem'

// Appropriate fee per gas must be determined for the specific bundler being used.
const maxFeePerGas = 1n
const maxPriorityFeePerGas = 1n

const userOperationHash = await bundlerClient.sendUserOperation({
  account: smartAccount,
  calls: [
    {
      to: '0x1234567890123456789012345678901234567890',
      value: parseEther('1'),
    },
  ],
  maxFeePerGas,
  maxPriorityFeePerGas,
})

```

See [Send a user operation](/smart-accounts-kit/development/guides/smart-accounts/send-user-operation/) to learn how to estimate fee per gas, and wait for the transaction receipt.

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

- To grant specific permissions to other accounts from your smart account, [create a delegation](/smart-accounts-kit/development/guides/delegation/execute-on-smart-accounts-behalf/).
- This quickstart example uses a Hybrid smart account. You can also [configure other smart account types](/smart-accounts-kit/development/guides/smart-accounts/create-smart-account/).
- To upgrade an EOA to a smart account, see the [EIP-7702 quickstart](/smart-accounts-kit/development/get-started/smart-account-quickstart/eip7702/).
- To quickly bootstrap a MetaMask Smart Accounts project, [use the CLI](/smart-accounts-kit/development/get-started/use-the-cli/).
