{"eip":1681,"title":"Temporal Replay Protection","description":"This EIP proposes adding a 'temporal' replay protection to transactions, in the form of a valid-until timestamp. This EIP is very similar to https://github.","authors":["Martin Holst Swende (@holiman)"],"status":"Stagnant","type":"Standards Track","category":"Core","created":"2019-01-08","discussionsTo":"https://ethereum-magicians.org/t/temporal-replay-protection/2355","repo":"EIPs","label":"EIP-1681","officialUrl":"https://eips.ethereum.org/EIPS/eip-1681","sourceUrl":"https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1681.md","url":"https://eips.huatuo.xyz/eip-1681/","tldr":{"en":"Proposed a `valid-until` timestamp on transactions, so a transaction that has not been included by a chosen time can never be mined or replayed later.","ja":"トランザクションに `valid-until` タイムスタンプを加えることを提案した。選んだ時刻までに取り込まれなかったトランザクションは、後からマイニングされたりリプレイされたりすることが決してなくなる。","ko":"트랜잭션에 `valid-until` 타임스탬프를 추가하자고 제안했다. 선택한 시각까지 포함되지 않은 트랜잭션은 나중에 채굴되거나 재전송(replay)될 수 없게 된다.","zh":"提议为交易增加 `valid-until` 时间戳，使得在选定时间之前未被打包的交易，以后永远不会被挖出或被重放。"},"tags":["transactions","replay-protection","expiry","mempool","core"],"explainers":{"en":{"lang":"en","tldr":"Proposed a `valid-until` timestamp on transactions, so a transaction that has not been included by a chosen time can never be mined or replayed later.","tags":["transactions","replay-protection","expiry","mempool","core"],"related":[155,2718,2711],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1681/","markdown":"## What problem does it solve?\n\nAn Ethereum transaction, once signed, stays valid until its nonce is used. That creates several headaches:\n\n- During busy events (the spec mentions ICOs) a transaction can sit in the mempool for days and then execute long after the user stopped wanting it, still costing gas.\n- Nodes have no shared rule for when to drop stale pending transactions.\n- Some state-cleanup ideas, such as clearing empty \"dust\" accounts, would reset nonces and let old transactions be replayed. Preventing that by changing nonce rules is invasive.\n\nEIP-1681 adds a simple expiry: the signer says \"only valid before time T\".\n\n## How it works\n\nThe rollout has two phases:\n\n1. **Hard fork X:** transactions gain an optional `valid-until` field, a `uint64` like `nonce`. If present, the transaction can only be included in a block whose `timestamp \u003c valid-until`.\n2. **Soft fork Y:** `valid-until` becomes mandatory; transactions without it are invalid.\n\nWhy wall-clock time instead of a block number (as an earlier proposal used):\n\n- the signer always knows the current UTC time, even on an offline machine,\n- the block number to time mapping drifts (hashrate, difficulty bomb), and is meaningless on testnets,\n- \"valid for two hours\" is easier for people to choose than \"valid for 514 blocks\".\n\nThere is no maximum, so a user can still sign a transaction valid far into the future.\n\n## Sample code\n\nPseudocode for the inclusion check and the extended legacy RLP:\n\n```python\n# legacy transaction with the optional extra field\ntx = rlp.encode([\n    nonce, gas_price, gas_limit, to, value, data,\n    valid_until,              # uint64 unix timestamp, new\n    v, r, s,\n])\n\ndef can_include(tx, block):\n    if tx.valid_until is None:\n        return block.number \u003c FORK_Y   # mandatory after phase Y\n    return block.timestamp \u003c tx.valid_until\n```\n\nA wallet would set it like this:\n\n```ts\nconst validUntil = Math.floor(Date.now() / 1000) + 2 * 60 * 60; // two hours from now\n```\n\n## Things to know\n\n- Status is **Stagnant**. Ethereum transactions still have no protocol-level expiry; tools rely on nonce replacement to cancel stuck transactions.\n- The field placement in the RLP above is illustrative; the spec does not fix the encoding. Since [EIP-2718](/eip-2718/) typed transactions, any such field would more naturally live in a new transaction type. [EIP-2711](/eip-2711/) (withdrawn) proposed one with an expiry.\n- Phase Y would break pre-signed transactions kept on paper backups or gift cards, which is the main security trade-off the spec calls out.\n- Many smart contracts implement their own deadline parameter (for example DEX swaps) to get the same effect at the application level.\n"},"ja":{"lang":"ja","tldr":"トランザクションに `valid-until` タイムスタンプを加えることを提案した。選んだ時刻までに取り込まれなかったトランザクションは、後からマイニングされたりリプレイされたりすることが決してなくなる。","tags":["transactions","replay-protection","expiry","mempool","core"],"related":[155,2718,2711],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1681/","markdown":"## 何を解決するのか\n\nEthereum のトランザクションは、一度署名されると、その nonce が使われるまで有効なままです。これにはいくつかの悩みがあります。\n\n- 混雑するイベント（仕様書は ICO を挙げています）の間、トランザクションが何日もメンプールに残り、ユーザーがもう望まなくなった後になってから実行され、それでもガスを消費する可能性があります。\n- ノードには、古くなった保留中のトランザクションをいつ破棄するかについて、共有されたルールがありません。\n- 空の「ダスト」アカウントを消去するといった、ステートのクリーンアップに関するいくつかのアイデアは、nonce をリセットして、古いトランザクションのリプレイを可能にしてしまいます。nonce のルールを変えてそれを防ぐのは、影響が大きすぎます。\n\nEIP-1681 は、シンプルな有効期限を加えます。署名者が「時刻 T より前にのみ有効」と指定するものです。\n\n## 仕組み\n\n展開は 2 段階です。\n\n1. **ハードフォーク X:** トランザクションに任意の `valid-until` フィールドが加わります。`nonce` と同じ `uint64` です。これがある場合、トランザクションは `timestamp \u003c valid-until` を満たすブロックにのみ取り込めます。\n2. **ソフトフォーク Y:** `valid-until` が必須になり、これがないトランザクションは無効になります。\n\n（以前の提案が使っていた）ブロック番号ではなく実時間を使う理由:\n\n- オフラインのマシンであっても、署名者は常に現在の UTC 時刻を知っている\n- ブロック番号と時刻の対応は、ハッシュレートや難易度爆弾によってずれ、テストネットでは意味をなさない\n- 「2 時間有効」は、「514 ブロック有効」よりも人が選びやすい\n\n上限はないため、ユーザーは遠い将来まで有効なトランザクションに署名することもできます。\n\n## サンプルコード\n\n取り込み判定と、拡張されたレガシー RLP の疑似コード:\n\n```python\n# legacy transaction with the optional extra field\ntx = rlp.encode([\n    nonce, gas_price, gas_limit, to, value, data,\n    valid_until,              # uint64 unix timestamp, new\n    v, r, s,\n])\n\ndef can_include(tx, block):\n    if tx.valid_until is None:\n        return block.number \u003c FORK_Y   # mandatory after phase Y\n    return block.timestamp \u003c tx.valid_until\n```\n\nウォレットは次のように設定します。\n\n```ts\nconst validUntil = Math.floor(Date.now() / 1000) + 2 * 60 * 60; // two hours from now\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。Ethereum のトランザクションには、今もプロトコルレベルの有効期限がありません。ツールは、詰まったトランザクションをキャンセルするのに nonce の置き換えに頼っています。\n- 上の RLP でのフィールドの位置は例示です。仕様書はエンコーディングを固定していません。[EIP-2718](/eip-2718/) の型付きトランザクション以降は、このようなフィールドは新しいトランザクションタイプに置くほうが自然です。[EIP-2711](/eip-2711/)（撤回）は、有効期限を持つそのようなタイプを提案しました。\n- フェーズ Y は、紙のバックアップやギフトカードに保管されている署名済みトランザクションを無効にしてしまいます。これが、仕様書が指摘する主なセキュリティ上のトレードオフです。\n- 多くのスマートコントラクトは（たとえば DEX のスワップで）独自のデッドラインパラメータを実装して、アプリケーションレベルで同じ効果を得ています。\n"},"ko":{"lang":"ko","tldr":"트랜잭션에 `valid-until` 타임스탬프를 추가하자고 제안했다. 선택한 시각까지 포함되지 않은 트랜잭션은 나중에 채굴되거나 재전송(replay)될 수 없게 된다.","tags":["transactions","replay-protection","expiry","mempool","core"],"related":[155,2718,2711],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1681/","markdown":"## 어떤 문제를 해결하나요?\n\n이더리움 트랜잭션은 한 번 서명되면 그 nonce가 사용될 때까지 유효합니다. 이는 여러 골칫거리를 낳습니다.\n\n- 혼잡한 시기(명세서는 ICO를 언급합니다)에 트랜잭션이 멤풀에 며칠씩 머물다가, 사용자가 더 이상 원하지 않게 된 한참 뒤에 실행되어 여전히 gas를 소모할 수 있습니다.\n- 오래된 대기 트랜잭션을 언제 버릴지에 대해 노드들이 공유하는 규칙이 없습니다.\n- 빈 \"더스트\" 계정을 정리하는 것 같은 일부 상태 정리 아이디어는 nonce를 초기화해서 오래된 트랜잭션이 재전송되게 할 수 있습니다. nonce 규칙을 바꿔서 이를 막는 것은 변경 폭이 너무 큽니다.\n\nEIP-1681은 간단한 만료 기능을 추가합니다. 서명자가 \"시각 T 이전에만 유효\"라고 지정하는 것입니다.\n\n## 어떻게 동작하나요?\n\n배포는 두 단계입니다.\n\n1. **하드포크 X:** 트랜잭션에 선택적 `valid-until` 필드가 생깁니다. `nonce`와 같은 `uint64`입니다. 이 필드가 있으면 트랜잭션은 `timestamp \u003c valid-until`인 블록에만 포함될 수 있습니다.\n2. **소프트포크 Y:** `valid-until`이 필수가 되며, 이 필드가 없는 트랜잭션은 무효입니다.\n\n(이전 제안이 사용했던) 블록 번호 대신 실제 시각을 쓰는 이유:\n\n- 오프라인 기기에서도 서명자는 항상 현재 UTC 시각을 알고 있습니다.\n- 블록 번호와 시간의 대응은 해시율과 난이도 폭탄에 따라 어긋나며, 테스트넷에서는 의미가 없습니다.\n- \"2시간 동안 유효\"가 \"514개 블록 동안 유효\"보다 사람이 고르기 쉽습니다.\n\n상한은 없으므로 사용자는 먼 미래까지 유효한 트랜잭션에 여전히 서명할 수 있습니다.\n\n## 샘플 코드\n\n포함 여부 검사와 확장된 레거시 RLP의 의사 코드:\n\n```python\n# legacy transaction with the optional extra field\ntx = rlp.encode([\n    nonce, gas_price, gas_limit, to, value, data,\n    valid_until,              # uint64 unix timestamp, new\n    v, r, s,\n])\n\ndef can_include(tx, block):\n    if tx.valid_until is None:\n        return block.number \u003c FORK_Y   # mandatory after phase Y\n    return block.timestamp \u003c tx.valid_until\n```\n\n지갑은 다음과 같이 설정합니다.\n\n```ts\nconst validUntil = Math.floor(Date.now() / 1000) + 2 * 60 * 60; // two hours from now\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 이더리움 트랜잭션에는 여전히 프로토콜 수준의 만료가 없으며, 도구들은 막힌 트랜잭션을 취소하기 위해 nonce 교체에 의존합니다.\n- 위 RLP에서 필드의 위치는 예시입니다. 명세서는 인코딩을 고정하지 않습니다. [EIP-2718](/eip-2718/) 타입 트랜잭션 이후로는 이런 필드가 새로운 트랜잭션 타입에 들어가는 것이 더 자연스럽습니다. [EIP-2711](/eip-2711/)(철회됨)이 만료 기능을 가진 그런 타입을 제안했습니다.\n- 단계 Y는 종이 백업이나 기프트 카드에 보관된 사전 서명 트랜잭션을 무효로 만드는데, 이것이 명세서가 짚는 주된 보안상의 절충입니다.\n- 많은 스마트 컨트랙트는 (예를 들어 DEX 스왑에서) 자체 마감 시한 파라미터를 구현해 애플리케이션 수준에서 같은 효과를 얻습니다.\n"},"zh":{"lang":"zh","tldr":"提议为交易增加 `valid-until` 时间戳，使得在选定时间之前未被打包的交易，以后永远不会被挖出或被重放。","tags":["transactions","replay-protection","expiry","mempool","core"],"related":[155,2718,2711],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1681/","markdown":"## 它解决什么问题？\n\n以太坊交易一旦签名，在其 nonce 被使用之前一直有效。这带来了几个麻烦：\n\n- 在繁忙时期（规范提到了 ICO），交易可能在内存池中停留数天，然后在用户早已不再需要它之后才执行，并且仍然要消耗 gas。\n- 节点对于何时丢弃过时的待处理交易没有共同的规则。\n- 一些状态清理的想法，例如清除空的\"灰尘\"账户，会重置 nonce，使旧交易可以被重放。通过修改 nonce 规则来防止这种情况，改动太大。\n\nEIP-1681 增加了一个简单的过期机制：签名者声明\"仅在时间 T 之前有效\"。\n\n## 它如何运作\n\n推出分为两个阶段：\n\n1. **硬分叉 X：** 交易获得一个可选的 `valid-until` 字段，与 `nonce` 一样是 `uint64`。如果存在，该交易只能被打包进 `timestamp \u003c valid-until` 的区块。\n2. **软分叉 Y：** `valid-until` 变为必填；没有它的交易无效。\n\n为什么使用挂钟时间而不是区块号（早先的提案使用的是区块号）：\n\n- 即使在离线的机器上，签名者也总是知道当前的 UTC 时间，\n- 区块号与时间的对应关系会漂移（算力、难度炸弹），并且在测试网上毫无意义，\n- \"有效两小时\"比\"有效 514 个区块\"更容易让人选择。\n\n没有设置上限，所以用户仍然可以签署一笔在遥远的未来仍然有效的交易。\n\n## 示例代码\n\n打包检查和扩展后的旧版 RLP 的伪代码：\n\n```python\n# legacy transaction with the optional extra field\ntx = rlp.encode([\n    nonce, gas_price, gas_limit, to, value, data,\n    valid_until,              # uint64 unix timestamp, new\n    v, r, s,\n])\n\ndef can_include(tx, block):\n    if tx.valid_until is None:\n        return block.number \u003c FORK_Y   # mandatory after phase Y\n    return block.timestamp \u003c tx.valid_until\n```\n\n钱包可以这样设置它：\n\n```ts\nconst validUntil = Math.floor(Date.now() / 1000) + 2 * 60 * 60; // two hours from now\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。以太坊交易至今仍没有协议层面的过期机制；工具依靠替换 nonce 来取消卡住的交易。\n- 上面 RLP 中的字段位置只是示意；规范没有固定编码方式。自 [EIP-2718](/eip-2718/) 类型化交易以来，这样的字段更自然地应放在新的交易类型中。[EIP-2711](/eip-2711/)（已撤回）就提出过一种带过期时间的交易类型。\n- 阶段 Y 会使保存在纸质备份或礼品卡上的预签名交易失效，这是规范指出的主要安全权衡。\n- 许多智能合约自行实现了截止时间参数（例如 DEX 兑换），以便在应用层获得同样的效果。\n"}}}
