# Quickstart -- EIP-7702 (/get-started/eip-7702/quickstart)

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



[EIP-7702](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md) is an Ethereum upgrade that allows for attaching a piece of EVM code to a EOA, effectively turning it into a "dual account" that can function simultaneously as a EOA and a smart account.  You can learn more about EIP-7702 from our blog series [here](https://www.zerodev.app/blogs/what-does-eip-7702-mean-for-you-part-1-the-adoption-cycle-of-7702) and [here](https://www.zerodev.app/blogs/blog-7702-for-dapps).

In practical terms, this means that EOA users can now enjoy most of the benefits of AA, such as gas sponsorship, transaction batching, session keys, chain abstraction, and more.

In this example, we will upgrade a EOA into a ZeroDev smart account ([Kernel](https://github.com/zerodevapp/kernel)) and send a gasless batched transaction from it.

## Complete example [#complete-example]

Here's [the complete code example](https://github.com/zerodevapp/zerodev-examples/blob/main/7702/7702.ts) for you to reference as you follow along.

You can run the example with `npx ts-node 7702/7702.ts` after you [set up the repo](https://github.com/zerodevapp/zerodev-examples?tab=readme-ov-file#zerodev-examples).

<div className="fd-steps">
  <div className="fd-step">
    ## Install packages [#install-packages]

    You will be using the following packages:

    <Tabs items="[&#x22;npm&#x22;,&#x22;yarn&#x22;,&#x22;pnpm&#x22;,&#x22;bun&#x22;]">
      <Tab value="npm">
        ```bash
        npm i @zerodev/sdk viem
        ```
      </Tab>

      <Tab value="yarn">
        ```bash
        yarn add @zerodev/sdk viem
        ```
      </Tab>

      <Tab value="pnpm">
        ```bash
        pnpm add @zerodev/sdk viem
        ```
      </Tab>

      <Tab value="bun">
        ```bash
        bun add @zerodev/sdk viem
        ```
      </Tab>
    </Tabs>
  </div>

  <div className="fd-step">
    ## Create a project for a 7702-compatible network [#create-a-project-for-a-7702-compatible-network]

    In this example, we will use the Sepolia testnet, but you can use any 7702-compatible network such as Arbitrum and Base.

    * Go to [the ZeroDev dashboard](https://dashboard.zerodev.app) and create a project for `Sepolia`.
    * Enable gas sponsorship for Sepolia under `Gas Policies`.
    * Create a `.env` file as follows:

    ```bash
    ZERODEV_RPC=<YOUR_RPC_FROM_DASHBOARD>
    ```

    Use the ZeroDev RPC on your project page from the dashboard.
  </div>

  <div className="fd-step">
    ## Upgrade EOA to smart account [#upgrade-eoa-to-smart-account]

    To upgrade a EOA to a smart account, you need to sign an "authorization."  You can create this authorization manually and pass it to the ZeroDev SDK, or you can let ZeroDev create this authorization automatically.

    ### Automatically create the authorization [#automatically-create-the-authorization]

    Set up a ZeroDev account using the 7702 helper functions:

    ```ts
    import { createKernelAccount, createKernelAccountClient, createZeroDevPaymasterClient } from "@zerodev/sdk";
    import { KERNEL_V3_3 } from "@zerodev/sdk/constants";

    const kernelVersion = KERNEL_V3_3;

    // This is the EOA you want to upgrade
    const eip7702Account = privateKeyToAccount(generatePrivateKey());

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

    const account = await createKernelAccount(publicClient, {
      eip7702Account,
      entryPoint,
      kernelVersion
    })

    const paymasterClient = createZeroDevPaymasterClient({
      chain,
      transport: http(ZERODEV_RPC),
    });

    const kernelClient = createKernelAccountClient({
      account,
      chain,
      bundlerTransport: http(ZERODEV_RPC),
      paymaster: paymasterClient,
      client: publicClient,
      userOperation: {
        estimateFeesPerGas: async ({ bundlerClient }) => {
          return getUserOperationGasPrice(bundlerClient)
        }
      }
    })
    ```

    Note that in this example, `eip7702Account` is the EOA you want to upgrade.  We are using a random EOA in this example but you should replace this with the actual EOA.

    ### Manually create the authorization [#manually-create-the-authorization]

    You can create the authorization manually with [Viem's `signAuthorization` function](https://viem.sh/docs/eip7702/signAuthorization), then pass the authorization to the ZeroDev SDK.

    When you create the authorization, make sure you are specifying [Kernel](https://github.com/zerodevapp/kernel) as the smart account.

    ```ts
    import { KERNEL_V3_3 } from "@zerodev/sdk/constants";

    const authorization = await walletClient.signAuthorization({
      account: signer,
      contractAddress: KERNEL_V3_3,
    })

    const account = await createKernelAccount(publicClient, {
      eip7702Account: signer,
      entryPoint,
      kernelVersion,
      eip7702Auth: authorization
    })
    ```
  </div>

  <div className="fd-step">
    ## Sending UserOps from the smart account [#sending-userops-from-the-smart-account]

    Once you have upgraded the EOA to a smart account, you can use the ZeroDev SDK as usual.  For example, to send a gasless batched UserOp:

    ```ts
    const userOpHash = await kernelClient.sendUserOperation({
      callData: await kernelClient.account.encodeCalls([
        {
          to: zeroAddress,
          value: BigInt(0),
          data: "0x",
        },
        {
          to: zeroAddress,
          value: BigInt(0),
          data: "0x",
        },
      ]),
    })

    await kernelClient.waitForUserOperationReceipt({
      hash: userOpHash,
    })

    console.log("UserOp completed")
    ```

    Congratulations!  You just sent your first gasless, batched transaction using a EOA.  You can see it by looking up your account on [the Sepolia explorer](https://sepolia.etherscan.io/).  Note that you may need to look under "Internal Transactions" because UserOps do not appear as regular transactions.

    Easy, right?  Now try some of the more advanced [examples](https://7702.zerodev.app/) for building with 7702, or explore the rest of the ZeroDev docs!
  </div>
</div>
