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.
This article examines ERC-725, a proposal that separates contract execution from data storage to support flexible and extensible smart contracts.
This article translates, summarizes, and expands on the following specification.
More EIP explainers:
Overview
ERC-725 provides a standard for flexible, long-lived data management and execution in smart contracts. It consists of two sub-specifications that can be used independently or together.
ERC725Y provides a generic key-value data store. Contracts can store arbitrary data, including extensions to NFT metadata.
ERC725X provides general-purpose execution, allowing a contract to perform arbitrary calls, including calls to external contracts.
Combining the two interfaces enables extensible account systems for smart contract accounts, updateable metadata, and flexible execution logic. The account standard built around these interfaces is called LSP0-ERC725Account.
Motivation
The standard addresses the need for flexible smart contract accounts that remain useful as requirements evolve.
Ethereum smart contract accounts support many applications, but an existing account may be difficult to extend with new metadata or accommodate future specifications.
ERC-725 defines generic data storage and execution separately so that developers can use either capability on its own or combine them into an account.
The interfaces are also useful beyond accounts. ERC725Y can support NFT and token metadata or extensible on-chain profiles, while ERC725X enables flexible operation execution.
Both are intended as reusable building blocks for smart contracts.
Specification
Overview
ERC725X and ERC725Y are independent specifications that can be combined into a general-purpose account contract.
- ERC725X provides general-purpose execution, including external calls, native-token transfers, and contract deployment.
- ERC725Y provides general-purpose storage for reading and writing arbitrary data using keys and values.
The combined account design is standardized as LSP0-ERC725Account.
Interface
// SPDX-License-Identifier: CC0-1.0
pragma solidity >=0.5.0 <0.7.0;
// ERC165 identifier: `0x7545acac`
interface IERC725X /* is ERC165, ERC173 */ {
event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 data);
event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt);
function execute(uint256 operationType, address target, uint256 value, bytes memory data) external payable returns(bytes memory);
function executeBatch(uint256[] memory operationsType, address[] memory targets, uint256[] memory values, bytes memory datas) external payable returns(bytes[] memory);
}
// ERC165 identifier: `0x629aa694`
interface IERC725Y /* is ERC165, ERC173 */ {
event DataChanged(bytes32 indexed dataKey, bytes dataValue);
function getData(bytes32 dataKey) external view returns(bytes memory);
function getDataBatch(bytes32[] memory dataKeys) external view returns(bytes[] memory);
function setData(bytes32 dataKey, bytes memory dataValue) external;
function setDataBatch(bytes32[] memory dataKeys, bytes[] memory dataValues) external;
}
interface IERC725 /* is IERC725X, IERC725Y */ {
}Ownership management (ERC-173)
Contracts implementing ERC725X or ERC725Y are controlled by an owner, which can be an EOA or a smart contract.
For an introduction to ERC-173, see:
[ERC173] Managing Smart Contract Ownership
owner
function owner() external view returns (address);Returns the current owner of the contract.
Returns
address— the current owner's address.
transferOwnership
function transferOwnership(address newOwner) external;Transfers ownership to a new address. Only the current owner can perform this operation.
Parameters
newOwner— the new owner's address.
OwnershipTransferred
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);Emitted when ownership changes, recording the previous and new owners.
Fields
previousOwner— the previous owner's address.newOwner— the new owner's address.
ERC725X (execution)
Interface ID
ERC725X supports ERC-165 interface detection through supportsInterface.
- ERC725X interface ID:
0x7545acac.
For an introduction to ERC-165, see:
[ERC165] Checking Whether a Contract Supports an Interface
execute
function execute(
uint256 operationType,
address target,
uint256 value,
bytes memory data
) external payable returns(bytes memory);Executes an external call, transfers native tokens, or deploys a contract. The caller must be authorized as the owner. The operation type selects CALL, CREATE, STATICCALL, or another supported action. CREATE2 deployment additionally uses a salt.
Parameters
operationType— 0: CALL, 1: CREATE, 2: CREATE2, 3: STATICCALL, 4: DELEGATECALL.target— the destination address, unused for CREATE and CREATE2.value— native-token amount in wei.data— calldata or deployment bytecode with constructor arguments, including a salt for CREATE2.
Returns
bytes— the call result or the deployed contract address encoded as bytes.
executeBatch
function executeBatch(
uint256[] memory operationsType,
address[] memory targets,
uint256[] memory values,
bytes[] memory datas
) external payable returns(bytes[] memory);Executes multiple operations together, including calls, deployments, and transfers. All arrays must have equal lengths, and execution is restricted to the owner.
Parameters
operationsType— operation types.targets— destination addresses.values— native-token amounts.datas— calldata or deployment bytecode for each operation.
Returns
bytes[]— the individual call results or deployed addresses.
Executed
event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 data);Records execution of a call through execute. The original article describes this event as excluding CREATE, STATICCALL, and DELEGATECALL; consult the specification and implementation for exact emission rules.
Fields
operationType— the operation performed.target— the called address.value— native-token amount transferred.data— the first four bytes of the calldata, representing the function selector where applicable.
ContractCreated
event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt);Emitted when a contract is deployed using CREATE or CREATE2. Records the operation, deployed address, native-token value, and CREATE2 salt where applicable.
Fields
operationType— CREATE or CREATE2.contractAddress— the deployed contract address.value— native-token amount sent.salt— the CREATE2 salt, empty for CREATE.
ERC725Y (data storage)
Interface ID
ERC725Y supports ERC-165 interface detection through supportsInterface.
- ERC725Y interface ID:
0x629aa694.
getData
function getData(bytes32 dataKey) external view returns(bytes memory);Retrieves the arbitrary bytes stored under a specified key.
Parameters
dataKey— the key to query.
Returns
bytes— the stored value.
getDataBatch
function getDataBatch(bytes32[] memory dataKeys) external view returns(bytes[] memory);Retrieves values for multiple keys in a single call instead of invoking getData repeatedly.
Parameters
dataKeys— the array of keys to query.
Returns
bytes[]— the corresponding values.
setData
function setData(bytes32 dataKey, bytes memory dataValue) external;Writes data under one key. Only the owner can write data, and a successful update emits DataChanged.
Parameters
dataKey— the key to update.dataValue— the bytes to store.
setDataBatch
function setDataBatch(bytes32[] memory dataKeys, bytes[] memory dataValues) external;Writes multiple key-value pairs in a single operation. Only the owner can perform this operation.
Parameters
dataKeys— the keys to update.dataValues— the corresponding byte values.
DataChanged
event DataChanged(bytes32 indexed dataKey, bytes dataValue);Emitted when data is successfully stored, recording the updated key and the new value.
Fields
dataKey— the updated key.dataValue— the newly stored bytes.
Data key conventions
ERC725Y permits arbitrary bytes32 keys. A recommended convention is to derive a key using keccak256 of a label. For example, keccak256('ERCXXXMyNewKeyType') produces the following key.
0x6935a24ea384927f250ee0b954ed498cd9203fc5d2bf95c735e52e6ca675e047This convention supports structured, extensible data schemas. The related LSP2-ERC725JSONSchema standard defines data types, structure, and encoding conventions.
Additional explanation
Designing flexible data management
ERC725Y uses generic key-value storage to accommodate future changes and extensions without requiring a new dedicated storage interface for each data field.
Stored data can be updated, making the interface suitable for evolving account profiles and on-chain configuration. Both off-chain applications and other smart contracts can read the data, enabling protocols and DApps to change their behavior according to the values stored in ERC-725-compatible contracts.
Function optimization and language independence
The original design used Solidity function overloading to expose single-key and multiple-key variants of getData and setData under the same names. This allowed callers to select a suitable variant while minimizing gas costs.
However, not every blockchain programming language supports overloading. From 2023 onward, the standard moved to explicitly named Batch variants, such as getDataBatch and setDataBatch. This improves compatibility across programming languages.
Compatibility
ERC-725 has evolved since ERC725v2 was proposed around 2018–2019, while retaining its basic design. Earlier implementations may share substantial functionality with newer versions, but changes to interfaces and events mean compatibility should be checked explicitly.
The main changes include:
- Separate getDataBatch and setDataBatch functions for multiple keys.
- Changes to some event structures and interface IDs.
- An executeBatch function for multiple operations.
- Removal of overloading in favor of language-independent function names.
ERC725Y aims to balance long-term compatibility with future extensibility, allowing developers to design and manipulate on-chain data efficiently.
Security
Risks of general-purpose execution
ERC725X allows arbitrary external calls, contract deployments, and native-token transfers through a general-purpose interface. This flexibility also introduces security risks.
Reentrancy is an important consideration. If an external interaction calls back into an account before its state updates are complete, it may undermine accounting or other invariants, potentially causing unauthorized transfers or data changes. An external CALL can invoke untrusted recipient code, including a fallback function. Developers must ensure that the account's authorization and state remain consistent during such interactions.
Risks of delegatecall
Operation type 4 executes DELEGATECALL, which runs the target's code in the calling contract's context. That code can modify storage, ownership, and arbitrary data maintained through ERC725Y.
Delegated code may also execute SELFDESTRUCT. Historically this could delete the caller's code and storage. Under Ethereum's post-EIP-6780 rules, general deletion of an existing contract is no longer possible through this opcode, although native balances can still be transferred and the same-transaction creation exception remains. Arbitrary delegated execution nevertheless presents serious risks to assets and state.
Safe implementation practices
- Enforce owner authorization.
- Restrict delegatecall to trusted code.
- Complete relevant state updates before external interactions, following checks-effects-interactions.
- Use appropriate reentrancy protection.
- Validate data and protect storage layout and critical slots.
ERC725X is powerful but requires careful security design. Developers should establish a clear reason for permitting operations such as delegatecall and understand their consequences before enabling them.
Citation
Fabian Vogelsteller (@frozeman), Tyler Yasaka (@tyleryasaka), "ERC-725: General data key/value store and execution [DRAFT]," Ethereum Improvement Proposals, no. 725, October 2017. [Online serial]. Available: https://eips.ethereum.org/EIPS/eip-725.
Conclusion
ERC-725 separates execution and data storage into reusable, extensible smart contract interfaces.
If you have questions, feel free to contact me on Twitter.
I also publish material on the following platforms.



