{"eip":1967,"title":"Proxy Storage Slots","description":"A consistent location where proxies store the address of the logic contract they delegate to, as well as other proxy-specific information.","authors":["Santiago Palladino (@spalladino)","Francisco Giordano (@frangio)","Hadrien Croubois (@Amxx)"],"status":"Final","type":"Standards Track","category":"ERC","created":"2019-04-24","discussionsTo":"https://ethereum-magicians.org/t/eip-1967-standard-proxy-storage-slots/3185","repo":"ERCs","label":"ERC-1967","officialUrl":"https://eips.ethereum.org/EIPS/eip-1967","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1967.md","url":"https://eips.huatuo.xyz/eip-1967/","tldr":{"en":"Fixes the exact storage slots where proxy contracts keep their implementation, beacon and admin addresses, so explorers and tools can see what any proxy really runs.","ja":"プロキシコントラクトが実装・ビーコン・管理者のアドレスを保存するストレージスロットを固定し、エクスプローラーやツールがあらゆるプロキシが実際に何を実行しているかを確認できるようにする。","ko":"프록시 컨트랙트가 구현, 비콘, 관리자 주소를 저장하는 스토리지 슬롯을 고정해, 익스플로러와 도구가 모든 프록시가 실제로 무엇을 실행하는지 볼 수 있게 한다.","zh":"固定代理合约存放实现、信标和管理员地址的确切存储槽，让区块浏览器和工具能看清任何代理实际运行的代码。"},"tags":["proxy","upgradeability","storage","delegatecall"],"explainers":{"en":{"lang":"en","tldr":"Fixes the exact storage slots where proxy contracts keep their implementation, beacon and admin addresses, so explorers and tools can see what any proxy really runs.","tags":["proxy","upgradeability","storage","delegatecall"],"related":[1822,1167,2535,7201,897],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1967/","markdown":"## What problem does it solve?\n\nAn upgradeable **proxy** holds the state and forwards every call with `delegatecall` to a separate **logic contract** (the implementation). The proxy must remember the implementation address somewhere, but:\n\n- If it uses an ordinary storage slot, the logic contract's own variables may overwrite it, since both share the proxy's storage.\n- If it exposes a public getter, that function selector could clash with one in the logic contract, a known way to hide backdoors.\n\nBefore ERC-1967, each proxy library chose its own location, so block explorers and wallets had no reliable way to tell that a contract was a proxy or which code it delegated to.\n\n## How it works\n\nThe standard defines three well-known storage slots. Each is `keccak256` of a label minus one, so the compiler will never allocate them and the hash has no known preimage:\n\n| Slot | Derived from | Holds | Event on change |\n| --- | --- | --- | --- |\n| `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` | `eip1967.proxy.implementation` | Logic contract address | `Upgraded(address indexed implementation)` |\n| `0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50` | `eip1967.proxy.beacon` | Beacon contract address | `BeaconUpgraded(address indexed beacon)` |\n| `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` | `eip1967.proxy.admin` | Address allowed to upgrade (optional) | `AdminChanged(address previousAdmin, address newAdmin)` |\n\n- Use **either** the implementation slot **or** the beacon slot. A **beacon** is a contract with `implementation() returns (address)`, which lets many proxies be upgraded at once. Tools should read the beacon slot only when the implementation slot is empty.\n- Any function that writes these slots, including initial setup, SHOULD emit the matching event so monitors can track upgrades.\n\nExplorers such as Etherscan read these slots to show a proxy's logic contract ABI; the spec cites USDC as an example.\n\n## Sample code\n\nFind the implementation behind any ERC-1967 proxy (ethers v6):\n\n```ts\nimport { JsonRpcProvider, getAddress, dataSlice, Contract, ZeroAddress } from \"ethers\";\n\nconst IMPL   = \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\";\nconst BEACON = \"0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\n\nasync function implementationOf(proxy: string): Promise\u003cstring\u003e {\n  const impl = getAddress(dataSlice(await provider.getStorage(proxy, IMPL), 12));\n  if (impl !== ZeroAddress) return impl;\n  const beacon = getAddress(dataSlice(await provider.getStorage(proxy, BEACON), 12));\n  const b = new Contract(beacon, [\"function implementation() view returns (address)\"], provider);\n  return b.implementation();\n}\n```\n\nReading and writing the slot in Solidity:\n\n```solidity\nbytes32 constant IMPLEMENTATION_SLOT =\n    bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1);\n\nfunction _getImplementation() internal view returns (address impl) {\n    bytes32 slot = IMPLEMENTATION_SLOT;\n    assembly { impl := sload(slot) }\n}\n```\n\n## Things to know\n\n- **Final** and the de facto proxy layout. OpenZeppelin's `ERC1967Proxy`, transparent proxies and UUPS ([ERC-1822](/eip-1822/)) all use these slots.\n- The standard fixes only *where* the data lives, not *who* may upgrade. Access control is up to the proxy or, for UUPS, the logic contract.\n- Contracts written in assembly or in unusual languages can still collide with these slots; the guarantee relies on Solidity and Vyper storage layout rules.\n- For non-upgradeable clones see [ERC-1167](/eip-1167/); for multi-facet proxies see [ERC-2535](/eip-2535/); for namespacing a logic contract's own storage see [ERC-7201](/eip-7201/).\n"},"ja":{"lang":"ja","tldr":"プロキシコントラクトが実装・ビーコン・管理者のアドレスを保存するストレージスロットを固定し、エクスプローラーやツールがあらゆるプロキシが実際に何を実行しているかを確認できるようにする。","tags":["proxy","upgradeability","storage","delegatecall"],"related":[1822,1167,2535,7201,897],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1967/","markdown":"## 何を解決するのか\n\nアップグレード可能な**プロキシ**は状態を保持し、すべての呼び出しを `delegatecall` で別の**ロジックコントラクト**（実装）に転送します。プロキシは実装アドレスをどこかに記憶しておく必要がありますが、次の問題があります。\n\n- 通常のストレージスロットを使うと、ロジックコントラクト自身の変数がそれを上書きしてしまう可能性があります。両者がプロキシのストレージを共有しているためです。\n- 公開 getter を用意すると、その関数セレクターがロジックコントラクト内のものと衝突する可能性があり、これはバックドアを隠す既知の手口です。\n\nERC-1967 以前は、プロキシライブラリごとに保存場所がバラバラだったため、ブロックエクスプローラーやウォレットは、あるコントラクトがプロキシかどうか、どのコードに委譲しているかを確実に知る手段がありませんでした。\n\n## 仕組み\n\nこの標準は、よく知られた 3 つのストレージスロットを定義します。それぞれラベルの `keccak256` から 1 を引いた値なので、コンパイラが割り当てることはなく、ハッシュの原像も知られていません。\n\n| スロット | 導出元 | 保持する値 | 変更時のイベント |\n| --- | --- | --- | --- |\n| `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` | `eip1967.proxy.implementation` | ロジックコントラクトのアドレス | `Upgraded(address indexed implementation)` |\n| `0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50` | `eip1967.proxy.beacon` | ビーコンコントラクトのアドレス | `BeaconUpgraded(address indexed beacon)` |\n| `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` | `eip1967.proxy.admin` | アップグレードを許可されたアドレス（任意） | `AdminChanged(address previousAdmin, address newAdmin)` |\n\n- 実装スロットとビーコンスロットは**どちらか一方**だけを使います。**ビーコン**は `implementation() returns (address)` を持つコントラクトで、多数のプロキシを一度にアップグレードできます。ツールは、実装スロットが空の場合にのみビーコンスロットを読むべきです。\n- 初期設定を含め、これらのスロットに書き込む関数は、監視ツールがアップグレードを追跡できるよう、対応するイベントを emit することが推奨されます（SHOULD）。\n\nEtherscan などのエクスプローラーはこれらのスロットを読み、プロキシのロジックコントラクトの ABI を表示します。仕様では USDC が例として挙げられています。\n\n## サンプルコード\n\nあらゆる ERC-1967 プロキシの背後にある実装を見つける（ethers v6）:\n\n```ts\nimport { JsonRpcProvider, getAddress, dataSlice, Contract, ZeroAddress } from \"ethers\";\n\nconst IMPL   = \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\";\nconst BEACON = \"0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\n\nasync function implementationOf(proxy: string): Promise\u003cstring\u003e {\n  const impl = getAddress(dataSlice(await provider.getStorage(proxy, IMPL), 12));\n  if (impl !== ZeroAddress) return impl;\n  const beacon = getAddress(dataSlice(await provider.getStorage(proxy, BEACON), 12));\n  const b = new Contract(beacon, [\"function implementation() view returns (address)\"], provider);\n  return b.implementation();\n}\n```\n\nSolidity でスロットを読み書きする:\n\n```solidity\nbytes32 constant IMPLEMENTATION_SLOT =\n    bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1);\n\nfunction _getImplementation() internal view returns (address impl) {\n    bytes32 slot = IMPLEMENTATION_SLOT;\n    assembly { impl := sload(slot) }\n}\n```\n\n## 知っておくべきこと\n\n- **Final** であり、事実上のプロキシレイアウトです。OpenZeppelin の `ERC1967Proxy`、transparent proxy、UUPS（[ERC-1822](/eip-1822/)）はすべてこれらのスロットを使います。\n- この標準が定めるのはデータが*どこに*あるかだけで、*誰が*アップグレードできるかではありません。アクセス制御はプロキシ側、UUPS の場合はロジックコントラクト側の責任です。\n- アセンブリや特殊な言語で書かれたコントラクトは、これらのスロットと衝突する可能性があります。この保証は Solidity と Vyper のストレージレイアウト規則に依存しています。\n- アップグレード不可のクローンについては [ERC-1167](/eip-1167/)、マルチファセットのプロキシについては [ERC-2535](/eip-2535/)、ロジックコントラクト自身のストレージの名前空間化については [ERC-7201](/eip-7201/) を参照してください。\n"},"ko":{"lang":"ko","tldr":"프록시 컨트랙트가 구현, 비콘, 관리자 주소를 저장하는 스토리지 슬롯을 고정해, 익스플로러와 도구가 모든 프록시가 실제로 무엇을 실행하는지 볼 수 있게 한다.","tags":["proxy","upgradeability","storage","delegatecall"],"related":[1822,1167,2535,7201,897],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1967/","markdown":"## 어떤 문제를 해결하나요?\n\n업그레이드 가능한 **프록시**는 상태를 보관하고, 모든 호출을 `delegatecall`로 별도의 **로직 컨트랙트**(구현)에 전달합니다. 프록시는 구현 주소를 어딘가에 기억해야 하는데, 문제가 있습니다.\n\n- 일반 스토리지 슬롯을 쓰면 로직 컨트랙트 자신의 변수가 그 값을 덮어쓸 수 있습니다. 둘이 프록시의 스토리지를 공유하기 때문입니다.\n- 공개 getter를 두면 그 함수 셀렉터가 로직 컨트랙트의 셀렉터와 충돌할 수 있으며, 이는 백도어를 숨기는 알려진 수법입니다.\n\nERC-1967 이전에는 프록시 라이브러리마다 저장 위치가 제각각이어서, 블록 익스플로러와 지갑은 어떤 컨트랙트가 프록시인지, 어떤 코드에 위임하는지 신뢰할 만하게 알 방법이 없었습니다.\n\n## 어떻게 동작하나요?\n\n이 표준은 잘 알려진 스토리지 슬롯 세 개를 정의합니다. 각 슬롯은 레이블의 `keccak256`에서 1을 뺀 값이라서, 컴파일러가 절대 할당하지 않고 해시의 원상(preimage)도 알려져 있지 않습니다.\n\n| 슬롯 | 유도 원본 | 저장 내용 | 변경 시 이벤트 |\n| --- | --- | --- | --- |\n| `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` | `eip1967.proxy.implementation` | 로직 컨트랙트 주소 | `Upgraded(address indexed implementation)` |\n| `0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50` | `eip1967.proxy.beacon` | 비콘 컨트랙트 주소 | `BeaconUpgraded(address indexed beacon)` |\n| `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` | `eip1967.proxy.admin` | 업그레이드가 허용된 주소(선택) | `AdminChanged(address previousAdmin, address newAdmin)` |\n\n- 구현 슬롯과 비콘 슬롯 중 **하나만** 사용합니다. **비콘**은 `implementation() returns (address)`를 가진 컨트랙트로, 많은 프록시를 한꺼번에 업그레이드할 수 있게 해 줍니다. 도구는 구현 슬롯이 비어 있을 때만 비콘 슬롯을 읽어야 합니다.\n- 초기 설정을 포함해 이 슬롯에 쓰는 모든 함수는 모니터링 도구가 업그레이드를 추적할 수 있도록 해당 이벤트를 emit하는 것이 권장됩니다(SHOULD).\n\nEtherscan 같은 익스플로러는 이 슬롯을 읽어 프록시의 로직 컨트랙트 ABI를 보여 줍니다. 스펙은 USDC를 예로 듭니다.\n\n## 샘플 코드\n\n임의의 ERC-1967 프록시 뒤에 있는 구현 찾기(ethers v6):\n\n```ts\nimport { JsonRpcProvider, getAddress, dataSlice, Contract, ZeroAddress } from \"ethers\";\n\nconst IMPL   = \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\";\nconst BEACON = \"0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\n\nasync function implementationOf(proxy: string): Promise\u003cstring\u003e {\n  const impl = getAddress(dataSlice(await provider.getStorage(proxy, IMPL), 12));\n  if (impl !== ZeroAddress) return impl;\n  const beacon = getAddress(dataSlice(await provider.getStorage(proxy, BEACON), 12));\n  const b = new Contract(beacon, [\"function implementation() view returns (address)\"], provider);\n  return b.implementation();\n}\n```\n\nSolidity에서 슬롯 읽고 쓰기:\n\n```solidity\nbytes32 constant IMPLEMENTATION_SLOT =\n    bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1);\n\nfunction _getImplementation() internal view returns (address impl) {\n    bytes32 slot = IMPLEMENTATION_SLOT;\n    assembly { impl := sload(slot) }\n}\n```\n\n## 알아둘 점\n\n- **Final** 상태이며 사실상의 프록시 레이아웃입니다. OpenZeppelin의 `ERC1967Proxy`, 트랜스페어런트 프록시, UUPS([ERC-1822](/eip-1822/))가 모두 이 슬롯을 사용합니다.\n- 이 표준은 데이터가 *어디에* 있는지만 정할 뿐, *누가* 업그레이드할 수 있는지는 정하지 않습니다. 접근 제어는 프록시, UUPS의 경우 로직 컨트랙트가 맡습니다.\n- 어셈블리나 특이한 언어로 작성된 컨트랙트는 여전히 이 슬롯과 충돌할 수 있습니다. 이 보장은 Solidity와 Vyper의 스토리지 레이아웃 규칙에 의존합니다.\n- 업그레이드 불가능한 클론은 [ERC-1167](/eip-1167/), 멀티 페이싯 프록시는 [ERC-2535](/eip-2535/), 로직 컨트랙트 자신의 스토리지 네임스페이싱은 [ERC-7201](/eip-7201/)을 참고하세요.\n"},"zh":{"lang":"zh","tldr":"固定代理合约存放实现、信标和管理员地址的确切存储槽，让区块浏览器和工具能看清任何代理实际运行的代码。","tags":["proxy","upgradeability","storage","delegatecall"],"related":[1822,1167,2535,7201,897],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1967/","markdown":"## 它解决什么问题？\n\n可升级的**代理（proxy）**保存状态，并通过 `delegatecall` 将每次调用转发给独立的**逻辑合约**（实现）。代理必须把实现地址记在某个地方，但是：\n\n- 如果使用普通存储槽，逻辑合约自己的变量可能会覆盖它，因为两者共享代理的存储。\n- 如果提供公开的 getter，该函数选择器可能与逻辑合约中的某个选择器冲突，这是已知的隐藏后门的手法。\n\n在 ERC-1967 之前，每个代理库各自选择存放位置，因此区块浏览器和钱包无法可靠地判断一个合约是否是代理，以及它委托给了哪份代码。\n\n## 它如何运作\n\n该标准定义了三个众所周知的存储槽。每个槽都是某个标签的 `keccak256` 减一，因此编译器永远不会分配到它们，并且该哈希没有已知的原像：\n\n| 存储槽 | 推导自 | 存放内容 | 变更时的事件 |\n| --- | --- | --- | --- |\n| `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc` | `eip1967.proxy.implementation` | 逻辑合约地址 | `Upgraded(address indexed implementation)` |\n| `0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50` | `eip1967.proxy.beacon` | 信标合约地址 | `BeaconUpgraded(address indexed beacon)` |\n| `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103` | `eip1967.proxy.admin` | 有权升级的地址（可选） | `AdminChanged(address previousAdmin, address newAdmin)` |\n\n- 实现槽和信标槽**二选一**。**信标（beacon）**是带有 `implementation() returns (address)` 的合约，可以一次升级许多代理。工具应仅在实现槽为空时才读取信标槽。\n- 任何写入这些槽的函数（包括初始设置）应当（SHOULD）触发对应的事件，以便监控方追踪升级。\n\nEtherscan 等浏览器会读取这些槽来展示代理的逻辑合约 ABI；规范以 USDC 为例。\n\n## 示例代码\n\n查找任意 ERC-1967 代理背后的实现（ethers v6）：\n\n```ts\nimport { JsonRpcProvider, getAddress, dataSlice, Contract, ZeroAddress } from \"ethers\";\n\nconst IMPL   = \"0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc\";\nconst BEACON = \"0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50\";\n\nconst provider = new JsonRpcProvider(process.env.RPC_URL);\n\nasync function implementationOf(proxy: string): Promise\u003cstring\u003e {\n  const impl = getAddress(dataSlice(await provider.getStorage(proxy, IMPL), 12));\n  if (impl !== ZeroAddress) return impl;\n  const beacon = getAddress(dataSlice(await provider.getStorage(proxy, BEACON), 12));\n  const b = new Contract(beacon, [\"function implementation() view returns (address)\"], provider);\n  return b.implementation();\n}\n```\n\n在 Solidity 中读写该存储槽：\n\n```solidity\nbytes32 constant IMPLEMENTATION_SLOT =\n    bytes32(uint256(keccak256(\"eip1967.proxy.implementation\")) - 1);\n\nfunction _getImplementation() internal view returns (address impl) {\n    bytes32 slot = IMPLEMENTATION_SLOT;\n    assembly { impl := sload(slot) }\n}\n```\n\n## 需要注意\n\n- 状态为 **Final**，是事实上的代理布局。OpenZeppelin 的 `ERC1967Proxy`、透明代理和 UUPS（[ERC-1822](/eip-1822/)）都使用这些槽。\n- 该标准只规定数据存放在*哪里*，不规定*谁*可以升级。访问控制由代理负责，对 UUPS 而言则由逻辑合约负责。\n- 用汇编或非常规语言编写的合约仍可能与这些槽冲突；这一保证依赖于 Solidity 和 Vyper 的存储布局规则。\n- 不可升级的克隆见 [ERC-1167](/eip-1167/)；多 facet 代理见 [ERC-2535](/eip-2535/)；为逻辑合约自身的存储划分命名空间见 [ERC-7201](/eip-7201/)。\n"}},"requiredBy":[5851,6224,7405,7546,7760,7963,8257]}
