Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
Overview
Suppose several businesses want to use the same transfer logic while maintaining their own administrators and balances. Storing the same logic in each account incurs deployment costs every time. Adopting existing logic would reduce this duplication without sacrificing independent storage.
Shared logic and independent storage
For example, businesses A and B each maintain balances at their own addresses. The logic that checks users' transfer requests and updates balances may be identical, but the administrator who can move A's balances differs from the administrator who can move B's balances. The goal is to share the logic. Inheriting the other business's administrator and balance values would change who is allowed to operate which assets.
Code is the logic executed when an account is called. EIP8298 proposes an instruction that adopts already deployed code as the code executed by another account. It updates the record of the code to execute while leaving the account's address and stored data intact.

After adopting the shared code, A's execution still uses A's storage, and B's execution uses B's storage. The operation does not copy the administrators or balances stored in the source account.
From code adoption to subsequent calls
The adopting account first stores its own configuration, such as its administrator and recovery mechanism, then specifies the source address. The executing node checks whether the specified account has eligible code. If it does, the node updates the adopting account's code record. Subsequent calls execute the adopted code.
If the source subsequently changes to different code, the code already adopted remains unchanged. If the execution containing the adoption is reverted, the code change is reverted as well. When applying this to a wallet, complete the new authentication and operation mechanisms before adopting the code, because direct transaction submission with the original private key cannot be restored.
Motivation
Both the cost of repeatedly deploying code and the transaction submission authority retained by the original private key relate to how an account's code is determined. EIP8298 addresses these issues by allowing an account to adopt existing code as ordinary deployed code.
Repeated storage of identical code
Even if a developer creates 100 accounts that execute the same logic, the configuration of each account, such as its administrator or name, differs. Storing the individual values is unavoidable, but deploying identical logic 100 times is not necessarily required. With code adoption, each account stores its own configuration and references the shared code.

This eliminates the cost of deploying the adopted code again. The cost of adding a new account to the state and writing values such as its administrator remains. Even under a pricing model that charges heavily for creating new state, referencing existing code can be distinguished from increasing the amount of stored data.
Transaction submission authority retained by the original private key
Even after introducing a new authentication mechanism into a wallet, if the original private key can still submit transactions directly, an attacker who obtains that key can bypass the new authentication. If an administrator wants to migrate to quantum-resistant authentication, adding the new scheme and retiring the old transaction submission authority are separate tasks.
EIP8298 allows ordinary wallet code to be adopted after the destination public key and recovery mechanism have been stored. After adoption, the account operates through that code, and direct transaction submission using the original key is no longer accepted. Migrating without storing the new configuration would leave the account with code but no one able to authenticate.
However, the instruction itself does not define a quantum-resistant signature scheme. Nor does it change every signature verification mechanism inside applications, so the retirement of transaction submission authority must be distinguished from individual signature authentication mechanisms.
Specification
Code adoption consists of validating the supplied address and updating the record of the code executed by the account. What becomes visible immediately after the update differs between the current call, subsequent calls, and completion of account creation.
Code adoption instruction input and update target
The instruction for adopting existing code in one's own account is SETCODEFROM.
Its opcode is 0xA7. It pops one value from the stack and uses the lower 160 bits as the source address, source.
It does not accept raw code bytes or their hash directly.
The stack changes as follows.
Before execution: [..., source]
After execution: [..., success]The executing node reads the identifier of the code held by the specified account.
This identifier is the codeHash. If the source is eligible, the node updates the current account's value to match the source.
It does not read and copy the source account's stored data.
| Return value | Condition | Code change |
|---|---|---|
success = 0 |
Invalid source | No change |
success = 1 |
Valid source | Update if the hash differs; otherwise retain the existing value |
A return value of 1 indicates that the source is valid, so it is returned even if the account already uses the same code. Returning 0 alone does not automatically revert earlier storage operations. A caller that requires successful adoption must revert the entire operation when it receives 0.

The address updated is the execution context address returned by the ADDRESS instruction and whose storage is written by SSTORE.
Even when executing code loaded from another account, the current execution context is updated, rather than the account providing the code.
Source eligibility and exceptional halts
Nodes determine whether an account is eligible as a source using the following conditions.
| Check | Condition for a valid source |
|---|---|
| Account existence | The account exists in the current state. |
| Code presence | Its hash is not the hash representing empty code. |
| First byte of code | It is ordinary deployed code that does not start with 0xEF. |
| Time of creation | The account was not created in the current transaction. |
The value of EMPTYCODEHASH, which represents empty code, is as follows.
0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470The first-byte check uses EIP3541's restriction prohibiting newly deployed code from starting with 0xEF.
Data indicating a code delegation target is excluded by the same prefix, so the node does not follow a source's delegation target to find code.
For more on EIP3541, see the following article.
[EIP3541] Prohibiting Contract Deployment with Code Starting with 0xEF
In addition, the deletion instruction can remove code and storage only for accounts created in the same transaction. In accordance with EIP6780, which defines this condition, the node checks whether the source is among the accounts created in the current transaction. Disallowing adoption from newly created accounts prevents the code's provenance from disappearing at the end of the transaction.
An invalid source and an environment in which the instruction cannot be executed at all produce different results.
| Condition | Result |
|---|---|
| Invalid source | Returns 0 and continues executing subsequent instructions. |
| Static execution | Halts exceptionally before charging for source access. |
| Current account is a system contract | Likewise halts exceptionally before source access. |
| Insufficient gas at any stage | Halts exceptionally at that stage. |
System contracts are accounts called from a special sender, SYSTEM_ADDRESS, during block processing.
That sender is 0xfffffffffffffffffffffffffffffffffffffffe.
The deposit contract under EIP6110, which supplies deposit logs to the consensus layer, is not protected by this rule because its logs are read rather than the contract being called.
Code in the current frame and subsequent calls
An execution frame is the unit that holds the code loaded for a call, its current execution position, and working data. Even when code adoption succeeds, an already running frame continues executing the code it loaded. Execution does not restart from the beginning of the new code.

Operations that inspect the account's current code, however, see the update immediately.
| Operation | Code accessed immediately after adoption |
|---|---|
CODESIZE and CODECOPY in the current frame |
Code already loaded by that frame |
EXTCODESIZE, EXTCODEHASH, and EXTCODECOPY targeting the current account |
Adopted code |
| A call to the current account initiated after adoption | Adopted code |
Even within the same transaction, a later call back into the account executes the new code. Accordingly, before making external calls after adoption, prepare storage that the new code can handle in the event of reentrancy. If the adopting frame or its parent execution is reverted, the code change is rolled back like any other state change.
Initialization during creation and finalizing code
initcode is the initialization logic that stores account-specific values during account creation and returns the code to deploy.
Code can be adopted within this initialization process, whether the account is created by a direct contract creation transaction, CREATE, or CREATE2.
The prohibition on using an account created in the current transaction as a source and the permission for an account under creation to adopt existing code apply to different targets.

At the end of creation, the code hash remaining in the new account determines the deployment method.
| Code hash at completion | Code deployed | Return data from initialization |
|---|---|---|
| Empty code hash | Returned code, as usual | Validated, charged for storage, and deployed |
| Adopted code hash | The last successfully adopted code that was not reverted | Treated as empty; no validation, hashing, deployment, or storage charges |
During adoption, the initialization process continues executing the code already loaded, but code inspections and calls targeting the account under creation see the adopted code. When clients report deployed code in creation results, such as in traces, they also report the adopted code that actually remains.
However, the return data received by the creator remains empty on success, as defined by EIP211. Consumers of the return data after the call cannot obtain the adopted code itself from that data or its length.
For more on EIP211, see the following article.
[EIP211] RETURNDATASIZE and RETURNDATACOPY for Managing Dynamically Sized Return Data
The cost of redeploying adopted code is avoided, but the cost of adding storage for a new account remains. If the destination account already exists, no new-account state gas is charged, as usual. If creation fails or is reverted, code adoption is rolled back along with the other state changes.
Wallet migration and transaction submission authority
EIP7702 allows an externally owned address to store a delegation designation so that code from another address executes within its own storage context. Nodes read the delegation target from that record to determine which code executes with the account's authority.
For more on EIP7702, see the following article.
[EIP7702] Turning an EOA into a Contract Account
When this delegated code executes and adopts ordinary code, the delegation designation stored in the account is replaced by ordinary code. Under EIP3607, which checks whether a transaction sender has code, legacy ECDSA-signed transactions that recover this address as the sender become invalid. ECDSA is the signature scheme used to verify signers with conventional private keys. What becomes invalid here is direct transaction submission using that scheme.
For more on EIP3607, see the following article.
[EIP3607] Preventing Ethereum Address Collisions
Redelegation through EIP7702 is also rejected because it requires empty code or a valid delegation designation.

If the adopted code itself has an authorized update mechanism, it can be updated to other ordinary code. However, there is no instruction to restore empty code and reenable direct submission with the original key. Continued operation of the account shifts to the authentication and execution functionality of the adopted code.
Gas costs for access and updates
A node maintains a set of addresses treated as already accessed during execution. Some addresses, such as the sender and recipient, are registered from the outset, so executing an instruction for the first time is not the same as paying the first-access cost. EIP2929 defines this set, registers precompiles from the beginning, and also applies additions from access lists and other active standards.
For more on EIP2929, see the following article.
[EIP2929] Increasing Gas Costs for Certain Opcodes
If the source is already in the set before the instruction executes, it is warm; otherwise, it is cold.
The source read cost and code validation cost are paid first. Only if the source is valid is the cost of comparing the current value added.
If the code hashes differ, an additional update cost is charged.

EIP8038, which defines access and update costs, uses the following values.
| Constant | Value | Use in this instruction |
|---|---|---|
COLD_ACCOUNT_ACCESS |
3000 | Read a source account not yet in the accessed set |
WARM_ACCESS |
100 | Read an already accessed account or perform additional code checks |
ACCOUNT_WRITE |
9000 | Update to a different code hash |
| Result | Cold source | Warm source |
|---|---|---|
| Invalid source | 3100 | 200 |
| Valid source with the same current hash | 3200 | 300 |
| Valid source requiring a code hash update | 12200 | 9300 |
For example, switching to a valid source that has not yet been accessed costs 12200: 3000 for reading, 100 for validation, 100 for checking the current value, and 9000 for updating. If the source is valid but the code is already identical, the last 9000 is not charged, bringing the total to 3200.
Insufficient gas before a charge at any stage causes an exceptional halt. If the initial charge cannot be paid, the source is not added to the accessed set. Once the initial cost is paid, even an invalid source is registered as accessed. When examining a source with a delegation designation, the delegation target is neither read nor charged for, nor is it marked as accessed.
Under EIP8037, which separates state creation costs from execution costs, state gas for adopting existing code is 0. There is no additional storage charge based on the number of code bytes, and the cost is calculated separately from new-account creation and initialization. The data conveying the source address is charged according to the normal rules for calldata or deployment code.
Recording code changes at the block level
The block-level access list defined by EIP7928 tells nodes which accounts were read or written within a block. Nodes read the values and positions of code changes to identify the code applicable at each point and use it for parallel execution and state application. For adoption, the record contains a hash identifying the code rather than repeating the code bytes.
# Code deployment or delegation
[block_access_index, new_code]
# Code adoption with SETCODEFROM
[block_access_index, b"", new_code_hash]The format for these code changes is CodeChange.
An adoption record consists of three elements, with new_code_hash appended, while other code changes retain the existing two-element format.
Records that do not conform to these rules, such as representing adoption in the two-element bytecode format, are invalid.

The code identified by the hash must exist in the pre-block state or in a code deployment record at a lower block access index. Resolution is not deferred to a record at the same or a later index.
A source for which the initial access cost was paid is included in the record regardless of whether it is valid. Its change lists are empty only if there are no other changes to that account. For example, even if an address is invalid as a source because it was created in the current transaction, its normal code deployment record is retained.
If there was insufficient gas even for the initial access charge, the source was not read and is not included in the record. After adoption, the code change is recorded according to the value remaining at the end of the transaction and the operation that last set that value.
Public mempool validation rules
The public mempool is where nodes share transactions that have not yet been included in a block. When an account adopts ordinary code, pending legacy signed transactions from that account become invalid. Nodes remove them after processing the block and reject new transactions arriving through the same submission method.
However, the account can continue operating through other transaction formats that authenticate via code, or through calls from other accounts. EIP8141 is a format that separates authentication, actual operations, and fee approval into distinct execution units. Nodes simulate the initial validation phase until the payer is determined, confirming sender authentication and fee approval before admitting the transaction to the public mempool.
For more on EIP8141, see the following article.
[EIP8141] Frame Transactions with Flexible Authentication, Execution, and Gas Payment

If code could be changed during validation, many other pending operations could become invalid, so the scope of validation is restricted.
ERC7562, which defines validation rules for code-based operation requests, also takes the approach of prohibiting SETCODEFROM during validation.
Nodes inspect the instructions executed during validation and prevent this change from occurring in the validation process.
For more on ERC7562, see the following article.
[ERC7562] Account Abstraction Transaction Validation Rules
EIP8141 distinguishes the following cases in the initial validation phase.
| Target | Public mempool treatment |
|---|---|
| Execution of the adoption instruction | Prohibited during initial validation. |
| Externally reachable code contains the adoption instruction | Treated as mutable code. Data portions of PUSH instructions, for example, are not counted as instructions. |
| The sender's own resolved code contains the adoption instruction | Its presence alone does not make the code mutable for this purpose, but executing it during initial validation remains prohibited. |
External code contains DELEGATECALL or CALLCODE |
Track code hashes as dependencies and limit the number of pending transactions depending on them. |
For delegated externally owned accounts themselves, EIP7702 recommends limiting pending transactions to one. This is distinct from the rule limiting the number of transactions that depend on external code. Both are public mempool operating rules rather than block consensus rules.
Example wallet migration code
First write the public key and recovery configuration to the account's own storage so the new code can authenticate operations. The proposal's example performs storage initialization and code adoption within the same execution.
SSTORE(pq_pubkey_slot, userPubkey)
SSTORE(recovery_slot, recoveryConfig)
if SETCODEFROM(PQ_WALLET_TEMPLATE) == 0: REVERT()
STOPuserPubkey is the public key used for the new authentication mechanism, and recoveryConfig configures recovery.
After storing both, the account adopts the existing wallet code, PQ_WALLET_TEMPLATE.
If the source is invalid and the instruction returns 0, REVERT rolls back the earlier storage operations; otherwise, execution ends with STOP.
This snippet alone does not fully implement the verification of who approved the migration or verification of the source code's contents. It illustrates the order of storing values before adoption and should not be used directly in a production wallet.
Example token clone code
ERC20 defines basic operations for transferring fungible balances. Users pass the accounts and the amounts to transfer to the functions. Even clones that use identical transfer logic can have independent storage and administrators.
For more on ERC20, see the following article.
[ERC20] ERC20 Explained from the Ground Up
The clone example in the proposal deploys a small piece of initialization code, calls it, and then adopts the shared code.
SSTORE(name_slot, "MyToken")
SSTORE(symbol_slot, "MYT")
SSTORE(owner_slot, msg.sender)
if SETCODEFROM(ERC20_TEMPLATE) == 0: REVERT()
STOPThe name, symbol, and administrator values are written to the newly created account's own storage.
They are not copied from the adopted ERC20_TEMPLATE.
If adoption fails, the initialization writes are reverted as well.
Here, msg.sender is the address that called the initialization logic.
If a factory calls it, the factory becomes the administrator. If the end user should instead become the administrator, the design must pass that user's address as authenticated input.
This post-deployment callback approach is distinct from completing adoption within the initialization code during creation.
Additional notes
Restricting sources to accounts that exist in the current state ensures that nodes execute the same code even when their storage histories differ. The restriction excluding sources created in the same transaction and the use of hashes in change records are also tied to these code resolution requirements.

Address-based selection and code availability
A scheme that accepted raw code hashes alone would depend on whether a node still has the corresponding code locally. A recently synchronized node and a node retaining historical code do not necessarily have identical local databases. Reading the current hash from an existing account allows code resolution to rely on the state at that point.
This is also why the existence condition is separate from the empty-code check. Even in implementations that represent the hash of a nonexistent account as zero, a hash with no corresponding bytes cannot be adopted by mistake. If the source subsequently switches to other code, nodes retain the earlier bytecode referenced by the adopting account.
Allowing sources created within the same transaction could lead to cases where adopted code cannot be found in the final record after deletion or replacement of the source. This can also occur through indirect adoption via an existing account, so checking only the immediate source is insufficient. Excluding all sources created in the current transaction maintains the requirement that the code can be resolved from the pre-block state or an earlier deployment record.
Two methods of finalizing code during creation
At the end of creation, an account either deploys the bytecode returned by initialization or retains the code adopted during initialization. The final code hash determines which method is used, leaving no ambiguity about whether adopted or returned code takes precedence. By initializing account-specific values first, both initialization and adoption can be completed in a single transaction even during direct contract creation.
Whereas this approach selects existing code, EIP6913 proposes replacing an account's code with new bytes in memory. EIP6913 prohibits replacement when the executing code differs from the account's own code, as with ordinary delegated execution. EIP8298 can update the current account even during delegated execution, changing both how the source is selected and which modules can be granted update authority.
For more on EIP6913, see the following article.
[EIP6913] The SETCODE Instruction for Upgrading Contracts While Retaining Data and Addresses
Why adoption records contain only hashes
If every adoption of identical code appended its entire bytecode to a block-level access list, a small execution cost could generate a large record. For example, updating from a warm source costs 9300, but repeatedly recording the maximum permitted code size would be disproportionate to that cost. Adoption is represented by a 32-byte hash rather than adding duplicate bytecode.
However, recording only a hash is useful only if every node can resolve the original code. The source existence and creation-time constraints ensure this prerequisite. Even under designs such as EIP8279, which impose a minimum fee based on record size, the fixed-size adoption record allows the increase in record size during execution to be measured.
Compatibility
The new instruction and extended code change format require network-wide activation. The proposal is in draft status, and the existence of a development implementation does not establish availability on production networks.

Instruction activation and changes to the record format
Assigning a new meaning to 0xA7 changes the behavior of code that previously halted because the instruction was undefined.
Nodes that understand only the existing two-element code change format cannot handle the three-element adoption record.
Nodes following the EIP8298 record rules also reject blocks that represent adoption as bytecode in the conventional format.
Support for instruction execution and change record generation and validation must therefore be introduced together and activated as consensus rules through a hard fork. Publication of development execution specifications or tests does not establish a production activation date.
Existing code with the reserved first byte
Before EIP3541 was activated, three contracts with code starting with 0xEF were created.
EIP8298 also excludes these contracts as sources. Because their first byte, 0xEF, is an undefined instruction that causes an exceptional halt, the restriction does not prevent the sharing of executable logic.
This check is applied alongside the conditions preventing empty code or a delegation designation from being adopted in place of ordinary code.
Reference implementation
Ethereum's official execution specifications repository contains a public PR adding an implementation of EIP8298. The following describes the Python implementation. The proposal does not require clients to use the same internal sets or type names.

Instruction validation and gas charging
The setcodefrom function implementing the instruction first rejects static execution and system contracts, then processes the source input and its costs.
After converting the input to an address, it pays the initial access cost and checks the source's existence and code conditions.
The op_implementation instruction table maps opcode Ops.SETCODEFROM to this function.
For a valid source, the comparison and update proceed in the following order.
success = U256(1)
charge_gas(evm, GasCosts.WARM_ACCESS)
current_account = get_account(tx_state, evm.current_target)
if current_account.code_hash != source_account.code_hash:
charge_gas(evm, GasCosts.ACCOUNT_WRITE)
new_code_hash = source_account.code_hash
if new_code_hash is not None:
adopt_code(tx_state, evm.current_target, new_code_hash)
push(evm.stack, success)The function pays the comparison cost before reading the current value and charges the update cost only if the hashes differ. If a valid source has the same hash, no update value is set and 1 is pushed onto the stack. For an invalid source, the function does not enter this valid-source branch and returns the initial value of 0.
Static execution triggers WriteInStaticContext first, while a protected account triggers CodeChangeInSystemContract.
Insufficient gas raises an exception during the relevant charging stage, and the ordinary executor handles state rollback.
The names of these functions and exceptions are choices made by the Python implementation.
Storing and rolling back code adoption
The adopt_code function, which updates the code reference, replaces the target account's code_hash.
It also adds the address to the accounts_with_adopted_code set to identify accounts for which code adoption was the last code-setting operation.
This is stored separately from deploying new bytecode.
def write_code_hash(account: Account) -> None:
account.code_hash = code_hash
modify_state(tx_state, address, write_code_hash)
tx_state.accounts_with_adopted_code.add(address)The set provides internal information for selecting the hash-based format when constructing the block's change record later. It is not mandatory adoption state that every client must represent as an identical set.
The copy_tx_state function, which snapshots state, also copies the set, and restore_tx_state restores it on rollback.
The incorporate_tx_into_block function clears the tracking information after incorporating a transaction's changes, so it is not carried over to another transaction.
These helper functions do not themselves check gas or whether static execution is permitted; they process state already checked by the instruction function and executor.
Returned code at the end of creation
The process_create function executes the creation frame and reads the new account's code hash if execution succeeds.
If an adopted value remains, it returns without proceeding to conventional deployment of the returned code so that the adopted code is retained.
evm = process_call(evm)
if not evm.error:
created_account = get_account(tx_state, evm.current_target)
if created_account.code_hash != EMPTY_CODE_HASH:
return evm
contract_code = evm.outputEMPTY_CODE_HASH is the constant representing empty code in this implementation.
If the code hash is empty, evm.output is validated and charged for as deployment code. Otherwise, the implementation takes the branch that retains adopted code.
If creation execution failed, this success branch is not entered, and the ordinary failure handling reverts adoption as well.
Change records for adopted code
The AdoptedCodeChange type, representing hash-based adoption, contains the block access index, empty bytecode, and adopted hash.
The add_code_change function replaces an existing change at the same index with the final value, or adds a new record if none exists.
The update_builder_from_tx function, which selects the record format, compares the code hashes before and after execution.
If the value returns to the original, the code change is removed. If a subsequent call only retains a value already recorded at the same index, that record is preserved.
When a new value remains, the function records accounts in the adoption set using the hash format and other accounts using the bytecode format.
For system calls sharing the same index, it is important that a later write that redetects an earlier adoption does not replace the record with the format containing the entire code. Using the adoption set for this decision is an implementation technique; the proposal specifies the final change record format. The recording functions do not charge EVM gas. They read the state reflecting execution and rollback.
Protecting system contracts
The public implementation groups special accounts called during block processing into an address set named SYSTEM_CONTRACTS.
The instruction function checks whether the current execution context address is in the set and, if so, halts before reading the source.
The deposit contract, whose logs are simply read, is not included.
SYSTEM_ADDRESS is a constant representing the single sender address.
fork.py also imports the same constant from a shared file, allowing the targets called during block processing and those protected by the adoption instruction to be aligned through shared definitions.
The organization of sets and exception classes is implementation-specific, but preventing code adoption from replacing protocol-used code is a requirement of the proposal.
Tests
The proposal's test section does not yet contain concrete test cases. The public implementation includes tests for the instruction, creation process, and other behavior; the existence of those tests must be distinguished from the results of running them in a given environment.

Checking inputs and code visibility
Checking only that adoption succeeds would miss implementations that incorrectly charge for identical hashes or use the wrong code in the current frame. The following table maps inputs to expected observations.
| Input or situation | Expected observation |
|---|---|
| Nonexistent source | Returns 0; code remains unchanged. |
| Source created in the current transaction | Returns 0, but the original deployment record is retained as usual. |
| Valid source with identical hash | Returns 1; no update charge is applied. |
| Static execution or a system contract | Halts exceptionally before accessing the source. |
| Current frame immediately after adoption | Continues executing its previously loaded code. |
| Call initiated after adoption | Executes the new code. |
| Initialization code adopts code and also returns data | Retains the adopted code and does not deploy the returned data. |
| Parent execution is reverted | Adoption and initialization changes are rolled back. |
The public PR tests source types, execution contexts, gas boundaries, post-migration submission, and block-level access lists. However, there are no results from running the entire public test suite in the environment used to produce this article. The existence of test code does not mean that every path has been verified in production clients.
Security
Permitting code adoption allows an account to change the logic it executes later. The adoption authority, contents of the approved code, initialization, and post-migration authentication and transaction capabilities must each be checked.

Adoption authority and changes to delegation targets
If anyone can call a function that adopts code, an attacker can replace the account's behavior. Verify the administrator's explicit approval and restrict the modules delegated to execute with the account's authority. Because delegated execution updates the current account, such modules must be treated as having been granted code update authority.
If an EIP7702 delegation target adopts code, the behavior of other accounts delegating to that target also changes. A target that previously executed nothing, for example because it had empty code, executes the ordinary code after adoption. The scope of trust in a delegation target therefore includes the code that the target can adopt later.
Matching code at approval and adoption time
If the source can change its own code, approving its address alone does not ensure that the same code exists when execution takes place. For example, if the source switches to code B after the administrator has inspected code A and signed the approval, the signature approving A could result in adoption of B.
Include the expected code hash in signatures or proposals.
Immediately before SETCODEFROM, the executing code reads the current value with EXTCODEHASH and compares it with the approved hash.
Do not insert an external call between the comparison and adoption, and revert if the hashes do not match.
After adoption is complete, the account does not follow subsequent changes at the source address. That independence applies to the reference after adoption; the risk of selecting the wrong code at the moment of adoption remains. Both address authorization and verification of the content that will actually execute are required.
Initialization and reentrant calls
If the administrator's storage location or value expected by the new code does not match the adopting account's storage state, authorization checks may produce incorrect results. Complete the initialization needed for migration in the same transaction as adoption, rather than leaving a state in which anyone can register as the administrator later. The code must define the order of storage writes and an authenticated initialization method.
An account under creation can also receive a callback if it calls an external contract after adopting code. That reentrant call executes the new code, which may read values that the initialization logic has not yet written. Either complete the necessary storage writes before adoption or reject reentrancy during initialization.
The fact that the current execution frame continues with the old code does not imply that reentrant execution also uses the old code. Consider storage layout together with the point at which the new code becomes active.
Legacy signatures and submission methods after migration
Adopting ordinary code prohibits direct transaction submission through legacy ECDSA signatures.
If an application uses ecRecover to recover an address from a signature, a signature created using the original private key may still recover the same address, potentially leaving authentication paths such as transfer permissions available.
EIP8151 is a separate proposal to exclude addresses with ordinary code from the recovery result.
Where it is active, authentication with the old key that would recover the account's original address no longer succeeds.
Even when recovery is rejected, the call itself completes with empty output and success = 1, so signatures must not be accepted solely on the basis of the success flag.
If a new key has been configured, authentication using that key is not invalidated. Conversely, if the new key is unconfigured, authentication relies only on a fallback to the old key, and there is no independently authenticated initialization method, the entire account becomes permanently inoperable. This is why code adoption and configuration of the new authentication and recovery mechanisms must be completed in the same transaction.
Post-migration operations require either code capable of approving the sender and fees under EIP8141 or a mechanism for delivering operation requests from outside the account. ERC4337 defines a format in which code verifies operation requests and can be called through a shared execution entry point. A wallet can initiate operations without directly submitting transactions with the old key by receiving requests from that entry point and executing authenticated operations.
For more on ERC4337, see the following article.
[ERC4337] Implementing Account Abstraction Without Protocol Changes
EIP8298 does not require EIP8141 to be active. On a chain where that transaction format is unavailable, adopting code that also lacks a mechanism for external operations leaves the account unable to initiate transactions. Even if EIP8141 becomes active later, the adopted code itself must support its validation and approval processes.
Executing code has no reliable way to determine which EIPs are active on a chain. Before migration, verify externally which operation methods are supported by the target network and the code to be adopted.
Receiving assets and node-side dependency information
Sending ETH to an account with ordinary code through CALL executes that code.
For token transfers that invoke receiver hooks, the adopted code also handles receipt.
Transfers fail if the code rejects incoming assets or lacks the required hooks. The ability to submit transactions after migration does not guarantee that assets can also be received.
Nodes must avoid assuming that an account's code remains unchanged when validating operations. They track pending operations that depend on external code and limit the number that can be invalidated by a single update. This makes it possible to determine which validation results are no longer usable when a code hash dependency changes.
In addition, the change record contains only the hash of adopted code rather than repeatedly including its bytes. This prevents inexpensive code adoption operations from inflating record size disproportionately. Account-level authorization and node-level validation and recording restrictions protect different aspects of the system.
Conclusion
EIP8298 introduces an instruction for adopting existing code while retaining an account's address and independent storage, making the adopted code effective in subsequent calls. Although it saves code redeployment costs, applying it to wallets retires the old key's direct transaction submission authority. Initialization, authorization, and post-migration sending and receiving must therefore be designed together.
The official proposal defines the code adoption conditions, change records, and public mempool rules.

