{"eip":5920,"title":"PAY opcode","description":"Introduces a new opcode, PAY, to send ether to an address without calling any of its functions","authors":["Gavin John (@Pandapip1)","Zainan Victor Zhou (@xinbenlv)","Sam Wilson (@SamWilsn)","Jochem Brouwer (@jochem-brouwer)","Charles Cooper (@charles-cooper)"],"status":"Draft","type":"Standards Track","category":"Core","created":"2022-03-14","requires":[214,2929,7523],"discussionsTo":"https://ethereum-magicians.org/t/eip-5920-pay-opcode/11717","repo":"EIPs","label":"EIP-5920","officialUrl":"https://eips.ethereum.org/EIPS/eip-5920","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-5920.md","url":"https://eips.huatuo.xyz/eip-5920/","tldr":{"en":"Proposes a PAY opcode that sends ether to an address without executing any of its code, removing reentrancy, griefing and wasted gas from plain ETH transfers.","ja":"コードを一切実行せずにアドレスへ ether を送る PAY opcode を提案する。通常の ETH 送金から、リエントランシー、グリーフィング、無駄なガスを取り除く。","ko":"코드를 전혀 실행하지 않고 주소로 ether를 보내는 PAY opcode를 제안한다. 일반적인 ETH 전송에서 재진입, 그리핑, 낭비되는 가스를 없앤다.","zh":"提出一个 PAY opcode，向某个地址发送 ether 而不执行其任何代码，从而消除普通 ETH 转账中的重入、恶意捣乱（griefing）和浪费的 gas。"},"tags":["evm","opcode","core","ether","security"],"explainers":{"en":{"lang":"en","tldr":"Proposes a PAY opcode that sends ether to an address without executing any of its code, removing reentrancy, griefing and wasted gas from plain ETH transfers.","tags":["evm","opcode","core","ether","security"],"related":[7702,1153,2929,7523,6780],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-5920/","markdown":"## What problem does it solve?\n\nToday a contract sends ether with `CALL`, which hands execution to the recipient. That has side effects nobody asked for:\n\n- **Reentrancy**: the recipient can call back into the sender. Even the 2300-gas stipend is enough to write transient storage ([EIP-1153](/eip-1153/)).\n- **Denial of service**: the recipient can revert or burn gas, so payouts can be blocked.\n- **Wasted gas**: running recipient code costs gas even when you only want to move value. Since [EIP-7702](/eip-7702/), even EOAs can have delegated code, so \"just send to an EOA\" no longer guarantees no code runs.\n\nA dedicated opcode that only moves value avoids all of this.\n\n## How it works\n\n`PAY` (`0xfc`) pops `addr` then `val` (same order as `CALL`) and:\n\n1. Fails exceptionally inside a static call frame.\n2. Fails exceptionally if `addr` has any of its high 12 bytes set (not a clean 20-byte address). This keeps room for future address space extension.\n3. Charges gas, marks `addr` warm, and transfers `val` wei if the caller's balance is sufficient.\n4. Pushes `1` on success, `0` on failure. Currently only insufficient balance yields `0`.\n\nNo code at `addr` runs.\n\nGas is the sum of:\n\n- account access: warm read cost if `addr` is already accessed, otherwise cold access cost ([EIP-2929](/eip-2929/));\n- `GAS_NEW_ACCOUNT` if `addr` does not exist and `val` is non-zero;\n- `GAS_CALL_VALUE` if `val` is non-zero.\n\n`PAY` relies on networks having no empty accounts ([EIP-7523](/eip-7523/)).\n\n## Sample code\n\nPseudocode of the opcode, following the spec:\n\n```python\ndef op_pay(evm):\n    if evm.message.is_static:\n        raise ExceptionalHalt\n    addr = evm.stack.pop()\n    val = evm.stack.pop()\n    if addr \u003e\u003e 160 != 0:\n        raise ExceptionalHalt               # high 12 bytes must be zero\n    addr = to_address(addr)\n\n    cost = WARM_STORAGE_READ_COST if addr in evm.accessed_addresses else COLD_ACCOUNT_ACCESS_COST\n    if val != 0 and not account_exists(addr):\n        cost += GAS_NEW_ACCOUNT\n    if val != 0:\n        cost += GAS_CALL_VALUE\n    charge_gas(evm, cost)\n    evm.accessed_addresses.add(addr)\n\n    if balance(evm.message.current_target) \u003e= val:\n        move_ether(evm.message.current_target, addr, val)   # no code executed\n        evm.stack.push(1)\n    else:\n        evm.stack.push(0)\n```\n\n## Things to know\n\n- Status is **Draft**. It is a Core change that needs a hard fork, and it is not part of any scheduled upgrade, so it is not available on mainnet.\n- Contracts should not rely on the invalid-address halting behaviour; it may change.\n- It does not create a new class of risk: ether can already be forced into a contract via `SELFDESTRUCT` (restricted by [EIP-6780](/eip-6780/)) or as a block's coinbase. Contracts must never assume they control their own balance.\n- Until something like `PAY` ships, use pull-payment patterns or reentrancy guards when sending ether.\n"},"ja":{"lang":"ja","tldr":"コードを一切実行せずにアドレスへ ether を送る PAY opcode を提案する。通常の ETH 送金から、リエントランシー、グリーフィング、無駄なガスを取り除く。","tags":["evm","opcode","core","ether","security"],"related":[7702,1153,2929,7523,6780],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-5920/","markdown":"## 何を解決するのか\n\n現在、コントラクトは `CALL` で ether を送りますが、これは実行を受取人に渡します。これには、誰も求めていない副作用があります。\n\n- **リエントランシー**: 受取人が送信者を呼び返せます。2300 ガスのスタイペンドでさえ、transient storage への書き込み（[EIP-1153](/eip-1153/)）には十分です。\n- **サービス拒否**: 受取人が revert したりガスを使い切ったりできるため、支払いを妨害されることがあります。\n- **無駄なガス**: 価値を移したいだけでも、受取人のコードを実行するとガスがかかります。[EIP-7702](/eip-7702/) 以降は EOA でも委任されたコードを持てるため、「EOA に送るだけ」ではもはやコードが実行されないことを保証できません。\n\n価値の移動だけを行う専用の opcode があれば、これらすべてを避けられます。\n\n## 仕組み\n\n`PAY`（`0xfc`）は、`addr`、続いて `val` を pop し（`CALL` と同じ順序）、次のように動作します。\n\n1. static call フレーム内では例外的に失敗します。\n2. `addr` の上位 12 バイトのいずれかが設定されている場合（きれいな 20 バイトのアドレスではない場合）は、例外的に失敗します。これにより、将来のアドレス空間拡張の余地が残されます。\n3. ガスを消費し、`addr` を warm にし、呼び出し元の残高が足りていれば `val` wei を送金します。\n4. 成功なら `1`、失敗なら `0` をプッシュします。現在 `0` になるのは残高不足の場合だけです。\n\n`addr` のコードは実行されません。\n\nガスは次の合計です。\n\n- アカウントアクセス: `addr` がすでにアクセス済みなら warm の読み取りコスト、そうでなければ cold アクセスのコスト（[EIP-2929](/eip-2929/)）\n- `addr` が存在せず `val` が 0 でない場合の `GAS_NEW_ACCOUNT`\n- `val` が 0 でない場合の `GAS_CALL_VALUE`\n\n`PAY` は、ネットワークに空のアカウントが存在しないこと（[EIP-7523](/eip-7523/)）を前提としています。\n\n## サンプルコード\n\n仕様に沿った、opcode の疑似コードです。\n\n```python\ndef op_pay(evm):\n    if evm.message.is_static:\n        raise ExceptionalHalt\n    addr = evm.stack.pop()\n    val = evm.stack.pop()\n    if addr \u003e\u003e 160 != 0:\n        raise ExceptionalHalt               # high 12 bytes must be zero\n    addr = to_address(addr)\n\n    cost = WARM_STORAGE_READ_COST if addr in evm.accessed_addresses else COLD_ACCOUNT_ACCESS_COST\n    if val != 0 and not account_exists(addr):\n        cost += GAS_NEW_ACCOUNT\n    if val != 0:\n        cost += GAS_CALL_VALUE\n    charge_gas(evm, cost)\n    evm.accessed_addresses.add(addr)\n\n    if balance(evm.message.current_target) \u003e= val:\n        move_ether(evm.message.current_target, addr, val)   # no code executed\n        evm.stack.push(1)\n    else:\n        evm.stack.push(0)\n```\n\n## 知っておくべきこと\n\n- ステータスは **Draft** です。ハードフォークが必要な Core の変更であり、予定されているどのアップグレードにも含まれていないため、メインネットでは利用できません。\n- コントラクトは、無効なアドレスでの停止動作に依存すべきではありません。変更される可能性があります。\n- 新しい種類のリスクを生むわけではありません。ether は、すでに `SELFDESTRUCT`（[EIP-6780](/eip-6780/) で制限）やブロックの coinbase として、コントラクトに強制的に送り込めます。コントラクトは、自分の残高を自分で制御できると決して仮定してはなりません。\n- `PAY` のようなものが導入されるまでは、ether を送るときはプル型の支払いパターンやリエントランシーガードを使ってください。\n"},"ko":{"lang":"ko","tldr":"코드를 전혀 실행하지 않고 주소로 ether를 보내는 PAY opcode를 제안한다. 일반적인 ETH 전송에서 재진입, 그리핑, 낭비되는 가스를 없앤다.","tags":["evm","opcode","core","ether","security"],"related":[7702,1153,2929,7523,6780],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-5920/","markdown":"## 어떤 문제를 해결하나요?\n\n오늘날 컨트랙트는 `CALL`로 ether를 보내는데, 이는 실행을 수신자에게 넘깁니다. 이로 인해 아무도 원하지 않은 부작용이 생깁니다.\n\n- **재진입**: 수신자가 송신자를 다시 호출할 수 있습니다. 2300 가스 스티펜드만으로도 transient storage에 쓰기에 충분합니다([EIP-1153](/eip-1153/)).\n- **서비스 거부**: 수신자가 revert하거나 가스를 소진할 수 있어 지급이 막힐 수 있습니다.\n- **낭비되는 가스**: 가치만 옮기고 싶어도 수신자의 코드를 실행하면 가스가 듭니다. [EIP-7702](/eip-7702/) 이후에는 EOA도 위임된 코드를 가질 수 있어, \"EOA로 그냥 보내기\"가 더 이상 코드가 실행되지 않음을 보장하지 않습니다.\n\n가치만 옮기는 전용 opcode가 있으면 이 모든 것을 피할 수 있습니다.\n\n## 어떻게 동작하나요?\n\n`PAY`(`0xfc`)는 `addr`을 pop한 뒤 `val`을 pop하며(`CALL`과 같은 순서) 다음과 같이 동작합니다.\n\n1. static call 프레임 안에서는 예외적으로 실패합니다.\n2. `addr`의 상위 12바이트 중 하나라도 설정되어 있으면(깔끔한 20바이트 주소가 아니면) 예외적으로 실패합니다. 이는 향후 주소 공간 확장의 여지를 남겨 둡니다.\n3. 가스를 차감하고 `addr`을 warm으로 표시하며, 호출자의 잔액이 충분하면 `val` wei를 전송합니다.\n4. 성공하면 `1`, 실패하면 `0`을 push합니다. 현재는 잔액 부족일 때만 `0`이 됩니다.\n\n`addr`의 코드는 실행되지 않습니다.\n\n가스는 다음의 합입니다.\n\n- 계정 접근: `addr`이 이미 접근된 적이 있으면 warm 읽기 비용, 아니면 cold 접근 비용([EIP-2929](/eip-2929/))\n- `addr`이 존재하지 않고 `val`이 0이 아니면 `GAS_NEW_ACCOUNT`\n- `val`이 0이 아니면 `GAS_CALL_VALUE`\n\n`PAY`는 네트워크에 빈 계정이 없다는 것([EIP-7523](/eip-7523/))을 전제로 합니다.\n\n## 샘플 코드\n\n사양을 따른 opcode의 의사 코드입니다.\n\n```python\ndef op_pay(evm):\n    if evm.message.is_static:\n        raise ExceptionalHalt\n    addr = evm.stack.pop()\n    val = evm.stack.pop()\n    if addr \u003e\u003e 160 != 0:\n        raise ExceptionalHalt               # high 12 bytes must be zero\n    addr = to_address(addr)\n\n    cost = WARM_STORAGE_READ_COST if addr in evm.accessed_addresses else COLD_ACCOUNT_ACCESS_COST\n    if val != 0 and not account_exists(addr):\n        cost += GAS_NEW_ACCOUNT\n    if val != 0:\n        cost += GAS_CALL_VALUE\n    charge_gas(evm, cost)\n    evm.accessed_addresses.add(addr)\n\n    if balance(evm.message.current_target) \u003e= val:\n        move_ether(evm.message.current_target, addr, val)   # no code executed\n        evm.stack.push(1)\n    else:\n        evm.stack.push(0)\n```\n\n## 알아둘 점\n\n- 상태는 **Draft**입니다. 하드 포크가 필요한 Core 변경이며 예정된 어떤 업그레이드에도 포함되어 있지 않으므로 메인넷에서는 사용할 수 없습니다.\n- 컨트랙트는 잘못된 주소에서 중단되는 동작에 의존해서는 안 됩니다. 바뀔 수 있습니다.\n- 새로운 종류의 위험을 만들지는 않습니다. ether는 이미 `SELFDESTRUCT`([EIP-6780](/eip-6780/)로 제한됨)나 블록의 coinbase로 컨트랙트에 강제로 들어갈 수 있습니다. 컨트랙트는 자신의 잔액을 스스로 통제한다고 절대 가정해서는 안 됩니다.\n- `PAY` 같은 것이 도입되기 전까지는 ether를 보낼 때 풀 방식 지급 패턴이나 재진입 가드를 사용하세요.\n"},"zh":{"lang":"zh","tldr":"提出一个 PAY opcode，向某个地址发送 ether 而不执行其任何代码，从而消除普通 ETH 转账中的重入、恶意捣乱（griefing）和浪费的 gas。","tags":["evm","opcode","core","ether","security"],"related":[7702,1153,2929,7523,6780],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-5920/","markdown":"## 它解决什么问题？\n\n目前，合约通过 `CALL` 发送 ether，而这会把执行权交给接收方。这带来了没人想要的副作用：\n\n- **重入**：接收方可以回调发送方。即便是 2300 gas 的津贴，也足以写入 transient storage（[EIP-1153](/eip-1153/)）。\n- **拒绝服务**：接收方可以 revert 或耗尽 gas，因此付款可能被阻断。\n- **浪费 gas**：即使你只想转移价值，运行接收方的代码也要花费 gas。自 [EIP-7702](/eip-7702/) 以来，即使是 EOA 也可以有被委托的代码，所以\"只是发给 EOA\"已不再能保证不会运行任何代码。\n\n一个只转移价值的专用 opcode 可以避免这一切。\n\n## 它如何运作\n\n`PAY`（`0xfc`）依次弹出 `addr` 和 `val`（与 `CALL` 顺序相同），并且：\n\n1. 在静态调用帧内会异常失败。\n2. 如果 `addr` 的高 12 个字节中有任何一位被设置（不是干净的 20 字节地址），则异常失败。这为将来扩展地址空间留出了余地。\n3. 扣除 gas，把 `addr` 标记为 warm，并在调用者余额足够时转移 `val` wei。\n4. 成功时压入 `1`，失败时压入 `0`。目前只有余额不足才会得到 `0`。\n\n`addr` 处的代码不会运行。\n\ngas 是以下各项之和：\n\n- 账户访问：如果 `addr` 已被访问过，则为 warm 读取成本，否则为 cold 访问成本（[EIP-2929](/eip-2929/)）；\n- 如果 `addr` 不存在且 `val` 非零，则加上 `GAS_NEW_ACCOUNT`；\n- 如果 `val` 非零，则加上 `GAS_CALL_VALUE`。\n\n`PAY` 依赖于网络中不存在空账户（[EIP-7523](/eip-7523/)）。\n\n## 示例代码\n\n该 opcode 的伪代码，遵循规范：\n\n```python\ndef op_pay(evm):\n    if evm.message.is_static:\n        raise ExceptionalHalt\n    addr = evm.stack.pop()\n    val = evm.stack.pop()\n    if addr \u003e\u003e 160 != 0:\n        raise ExceptionalHalt               # high 12 bytes must be zero\n    addr = to_address(addr)\n\n    cost = WARM_STORAGE_READ_COST if addr in evm.accessed_addresses else COLD_ACCOUNT_ACCESS_COST\n    if val != 0 and not account_exists(addr):\n        cost += GAS_NEW_ACCOUNT\n    if val != 0:\n        cost += GAS_CALL_VALUE\n    charge_gas(evm, cost)\n    evm.accessed_addresses.add(addr)\n\n    if balance(evm.message.current_target) \u003e= val:\n        move_ether(evm.message.current_target, addr, val)   # no code executed\n        evm.stack.push(1)\n    else:\n        evm.stack.push(0)\n```\n\n## 需要注意\n\n- 状态为 **Draft**。这是一项需要硬分叉的 Core 变更，也不在任何已排期的升级之内，因此主网上不可用。\n- 合约不应依赖对无效地址的中止行为；它可能会改变。\n- 它不会带来新的一类风险：ether 本来就可以通过 `SELFDESTRUCT`（受 [EIP-6780](/eip-6780/) 限制）或作为区块的 coinbase 被强行塞入合约。合约绝不能假设自己能控制自己的余额。\n- 在类似 `PAY` 的机制上线之前，发送 ether 时请使用拉取式付款模式或重入保护。\n"}}}
