---
eip: 7377
label: EIP-7377
title: Migration Transaction
status: Stagnant
type: Standards Track
category: Core
created: 2023-07-21
requires: 170, 1559, 2200, 2718
official: https://eips.ethereum.org/EIPS/eip-7377
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7377.md
canonical: https://eips.huatuo.xyz/eip-7377/
lang: en
tldr: A proposed one-time transaction type that turns an existing EOA into a smart contract wallet in place, keeping its address and assets.
tags: [account-abstraction, transactions, eoa, core]
---

# EIP-7377: Migration Transaction

> Allow EOAs to send a one-time transaction which deploys code at their account.

**TL;DR:** A proposed one-time transaction type that turns an existing EOA into a smart contract wallet in place, keeping its address and assets.

## What problem does it solve?

Smart contract wallets offer recovery, batching, spending limits and more, but most users still hold assets in plain EOAs. Moving to a new contract address means transferring every token, NFT and position one by one, which is expensive and tedious. Many users never do it.

EIP-7377 proposed a protocol-level shortcut: let an EOA send one special transaction that installs contract code **at its own address**, so the account becomes a smart contract without moving anything.

## How it works

A new [EIP-2718](/eip-2718/) transaction type `0x04`:

```
0x04 || rlp([chainId, nonce, maxFeePerGas, maxPriorityFeePerGas, gasLimit,
             codeAddr, storage, data, value, accessList, yParity, r, s])
```

- There is no `to` field. Instead, `codeAddr` points to an already-deployed contract whose code is copied onto the sender's account. Pointing at existing code avoids putting the same wallet bytecode in calldata over and over.
- `storage` is a list of `(slot, value)` pairs written into the sender's storage, for example to set the wallet owner.
- After that, the transaction makes a normal [EIP-1559](/eip-1559/)-style call into the sender's (now contract) account with `data` and `value`, so it can run any initialisation.
- The code at `codeAddr` must be non-empty and below the 24,576-byte limit.
- Intrinsic gas is the usual 1559 formula plus **20,000 gas per storage tuple**. No extra charge for deployment, since clients store identical code once.
- During execution `tx.origin` is set to `keccak256(sender)[0..20]` rather than the sender, so existing `msg.sender == tx.origin` "is this an EOA?" checks keep behaving.

Because of [EIP-3607](/eip-3607/) (accounts with code cannot send transactions), the migration can only happen once.

## Sample code

Pseudocode of what a client does when processing the transaction:

```python
def apply_migration_tx(state, tx, sender):
    code = state[tx.codeAddr].code
    assert 0 < len(code) < 24576
    state[sender].code = code                 # install wallet code at the EOA
    for slot, value in tx.storage:
        state[sender].storage[slot] = value   # e.g. owner, guardians
    origin = keccak256(sender)[:20]           # rewritten tx.origin
    return evm_call(caller=sender, to=sender, origin=origin,
                    data=tx.data, value=tx.value)
```

## Things to know

- Status is **Stagnant**. It was not scheduled for any network upgrade.
- The underlying goal, giving EOAs smart-account features, was addressed in Pectra by [EIP-7702](/eip-7702/), which lets an EOA *delegate* to contract code instead of permanently replacing its code.
- The private key still exists after migration. Signature-based schemes such as [ERC-2612](/eip-2612/) `permit` could still be signed with it, so revealing or losing the key would remain dangerous. Migration also happens per chain, so the same address on other chains stays a plain EOA.
- Wallets would need to treat this transaction type with extreme care, since a blind-signed migration could hand the account to an attacker's code.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-7377
