{"eip":1620,"title":"Money Streaming","description":"Money streaming represents the idea of continuous payments over a finite period of time. Block numbers are used as a proxy of time to continuously update balances.","authors":["Paul Berg (@PaulRBerg)"],"status":"Stagnant","type":"Standards Track","category":"ERC","created":"2018-11-24","discussionsTo":"https://github.com/ethereum/EIPs/issues/1620","repo":"ERCs","label":"ERC-1620","officialUrl":"https://eips.ethereum.org/EIPS/eip-1620","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-1620.md","url":"https://eips.huatuo.xyz/eip-1620/","tldr":{"en":"A standard for money streaming: a payer locks ERC-20 tokens in a contract and the recipient can withdraw them continuously as blocks pass, turning salaries and subscriptions into pay-as-you-go flows.","ja":"お金のストリーミングの標準。支払者が ERC-20 トークンをコントラクトにロックし、受取人はブロックが進むにつれて継続的に引き出せる。給与やサブスクリプションを従量制のフローに変える。","ko":"돈 스트리밍을 위한 표준. 지불자가 ERC-20 토큰을 컨트랙트에 잠가 두면 수취인이 블록이 지나는 만큼 계속 인출할 수 있어, 급여와 구독을 사용한 만큼 내는 흐름으로 바꾼다.","zh":"一种资金流式支付标准：付款方把 ERC-20 代币锁定在合约中，收款方可随着区块推进持续提取，把工资和订阅变成按使用付费的资金流。"},"tags":["payments","streaming","defi","erc20","erc"],"explainers":{"en":{"lang":"en","tldr":"A standard for money streaming: a payer locks ERC-20 tokens in a contract and the recipient can withdraw them continuously as blocks pass, turning salaries and subscriptions into pay-as-you-go flows.","tags":["payments","streaming","defi","erc20","erc"],"related":[20],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-1620/","markdown":"## What problem does it solve?\n\nSalaries, rent and subscriptions are paid in chunks, usually monthly, because traditional payment rails are expensive to use often. That forces one side to trust the other: the employee works a month before being paid, or the subscriber pays a month in advance.\n\nOn a blockchain, \"money as a function of time\" is practical. ERC-1620 standardises a contract where funds flow from sender to recipient block by block. The recipient can withdraw what has accrued at any moment, and either party can stop the stream and split the balance fairly.\n\n## How it works\n\nA single master contract holds many streams. Each `Stream` records:\n\n- `sender`, `recipient` and `tokenAddress` (an [ERC-20](/eip-20/) token; Ether should not be accepted),\n- `balance`: funds still in the stream,\n- `timeframe`: `start` and `stop` block numbers,\n- `rate`: `payment` released every `interval` blocks.\n\nThe flow:\n\n1. **`create(recipient, token, startBlock, stopBlock, payment, interval)`**: the sender deposits enough tokens for the whole period. A sender may run several streams in parallel.\n2. **`balanceOf(streamId, addr)`**: shows what each party is currently entitled to. The recipient's share grows roughly as `payment rate × (current block − start block)`.\n3. **`withdraw(streamId, amount)`**: only the recipient may pull accrued funds.\n4. **`redeem(streamId)`**: any party may end the stream early. Accrued funds go to the recipient and the rest back to the sender.\n5. **Updates**: changing the token, stop block or rate requires every party to confirm; either party can revoke a pending update.\n\nEvents (`LogCreate`, `LogWithdraw`, `LogRedeem`, `LogConfirmUpdate`, `LogRevokeUpdate`, `LogExecuteUpdate`) record each step.\n\n## Sample code\n\nCore accounting for one stream, in modern Solidity (simplified, illustration only):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nstruct Stream {\n    address sender;\n    address recipient;\n    address token;\n    uint256 deposit;\n    uint256 withdrawn;\n    uint256 startBlock;\n    uint256 stopBlock;\n    uint256 payment;   // tokens released per interval\n    uint256 interval;  // blocks per interval\n}\n\nlibrary StreamMath {\n    /// Amount the recipient has earned so far but not yet withdrawn.\n    function recipientBalance(Stream memory s) internal view returns (uint256) {\n        if (block.number \u003c= s.startBlock) return 0;\n        uint256 end = block.number \u003c s.stopBlock ? block.number : s.stopBlock;\n        uint256 earned = ((end - s.startBlock) / s.interval) * s.payment;\n        if (earned \u003e s.deposit) earned = s.deposit;\n        return earned - s.withdrawn;\n    }\n\n    /// What the sender would get back if the stream were redeemed now.\n    function senderBalance(Stream memory s) internal view returns (uint256) {\n        return s.deposit - s.withdrawn - recipientBalance(s);\n    }\n}\n```\n\n## Things to know\n\n- Status is **Stagnant**. The spec is an early sketch, and its method list has inconsistencies (for example, the signatures shown under `confirmUpdate` and `revokeUpdate` do not match their headings). Treat it as a concept, not a finished interface.\n- Block numbers stand in for time. If average block times change, a stream ends sooner or later in wall-clock time than expected. The spec discusses this at length and suggests renegotiating via `update` or using timestamps from an oracle. Using `block.timestamp` instead is a common alternative.\n- Lock the full deposit up front. Without it, the recipient's accrued balance is only a promise.\n- The spec mentions future \"multi-hop\" streams (A to B to C) but does not define them.\n"},"ja":{"lang":"ja","tldr":"お金のストリーミングの標準。支払者が ERC-20 トークンをコントラクトにロックし、受取人はブロックが進むにつれて継続的に引き出せる。給与やサブスクリプションを従量制のフローに変える。","tags":["payments","streaming","defi","erc20","erc"],"related":[20],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-1620/","markdown":"## 何を解決するのか\n\n給与、家賃、サブスクリプションは、従来の決済手段は頻繁に使うと高くつくため、通常は月ごとなど、まとまった単位で支払われます。そのため、どちらかが相手を信頼せざるを得ません。従業員は支払われる前に 1 か月働き、契約者は 1 か月前払いします。\n\nブロックチェーンでは、「時間の関数としてのお金」が現実的です。ERC-1620 は、資金が送り手から受取人へブロックごとに流れるコントラクトを標準化します。受取人はいつでも、その時点までに発生した分を引き出せ、どちらの当事者もストリームを止めて残高を公平に分けられます。\n\n## 仕組み\n\n1 つのマスターコントラクトが多数のストリームを保持します。各 `Stream` は次を記録します。\n\n- `sender`、`recipient`、`tokenAddress`（[ERC-20](/eip-20/) トークン。Ether は受け付けるべきではありません）\n- `balance`: ストリームに残っている資金\n- `timeframe`: `start` と `stop` のブロック番号\n- `rate`: `interval` ブロックごとに解放される `payment`\n\n流れ:\n\n1. **`create(recipient, token, startBlock, stopBlock, payment, interval)`**: 送り手が期間全体に十分な量のトークンを預け入れます。送り手は複数のストリームを並行して運用できます。\n2. **`balanceOf(streamId, addr)`**: 各当事者が現在受け取る権利のある額を示します。受取人の取り分は、おおよそ `支払いレート × (現在のブロック − 開始ブロック)` で増えていきます。\n3. **`withdraw(streamId, amount)`**: 発生した資金を引き出せるのは受取人だけです。\n4. **`redeem(streamId)`**: どの当事者でもストリームを途中で終了できます。発生した資金は受取人へ、残りは送り手へ戻ります。\n5. **更新**: トークン、停止ブロック、レートの変更には、すべての当事者の確認が必要です。どちらの当事者も、保留中の更新を取り消せます。\n\nイベント（`LogCreate`、`LogWithdraw`、`LogRedeem`、`LogConfirmUpdate`、`LogRevokeUpdate`、`LogExecuteUpdate`）が各ステップを記録します。\n\n## サンプルコード\n\n1 つのストリームの中核となる会計処理を、現代の Solidity で（簡略化、説明用のみ）:\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nstruct Stream {\n    address sender;\n    address recipient;\n    address token;\n    uint256 deposit;\n    uint256 withdrawn;\n    uint256 startBlock;\n    uint256 stopBlock;\n    uint256 payment;   // tokens released per interval\n    uint256 interval;  // blocks per interval\n}\n\nlibrary StreamMath {\n    /// Amount the recipient has earned so far but not yet withdrawn.\n    function recipientBalance(Stream memory s) internal view returns (uint256) {\n        if (block.number \u003c= s.startBlock) return 0;\n        uint256 end = block.number \u003c s.stopBlock ? block.number : s.stopBlock;\n        uint256 earned = ((end - s.startBlock) / s.interval) * s.payment;\n        if (earned \u003e s.deposit) earned = s.deposit;\n        return earned - s.withdrawn;\n    }\n\n    /// What the sender would get back if the stream were redeemed now.\n    function senderBalance(Stream memory s) internal view returns (uint256) {\n        return s.deposit - s.withdrawn - recipientBalance(s);\n    }\n}\n```\n\n## 知っておくべきこと\n\n- ステータスは **Stagnant** です。仕様は初期のスケッチであり、メソッドの一覧には不整合があります（たとえば、`confirmUpdate` と `revokeUpdate` の下に示されたシグネチャが見出しと一致しません）。完成したインターフェースではなく、コンセプトとして扱ってください。\n- 時間の代わりにブロック番号が使われます。平均ブロック時間が変わると、ストリームは実時間で予想より早く、または遅く終わります。仕様はこれについて長く論じており、`update` による再交渉や、オラクルからのタイムスタンプの利用を提案しています。代わりに `block.timestamp` を使うのも一般的な選択肢です。\n- 預け入れ全額を最初にロックしてください。そうしないと、受取人の発生済み残高は約束にすぎません。\n- 仕様は将来の「マルチホップ」ストリーム（A から B、B から C）に触れていますが、定義はしていません。\n"},"ko":{"lang":"ko","tldr":"돈 스트리밍을 위한 표준. 지불자가 ERC-20 토큰을 컨트랙트에 잠가 두면 수취인이 블록이 지나는 만큼 계속 인출할 수 있어, 급여와 구독을 사용한 만큼 내는 흐름으로 바꾼다.","tags":["payments","streaming","defi","erc20","erc"],"related":[20],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-1620/","markdown":"## 어떤 문제를 해결하나요?\n\n급여, 월세, 구독료는 전통적인 결제 수단을 자주 쓰면 비용이 크기 때문에 보통 월 단위처럼 덩어리로 지급됩니다. 그러면 한쪽이 상대를 믿어야 합니다. 직원은 한 달을 일한 뒤에 급여를 받고, 구독자는 한 달 치를 미리 냅니다.\n\n블록체인에서는 \"시간의 함수로서의 돈\"이 현실적입니다. ERC-1620은 자금이 발신자에게서 수취인에게 블록 단위로 흐르는 컨트랙트를 표준화합니다. 수취인은 언제든 그동안 쌓인 금액을 인출할 수 있고, 어느 쪽이든 스트림을 중단하고 잔액을 공정하게 나눌 수 있습니다.\n\n## 어떻게 동작하나요?\n\n하나의 마스터 컨트랙트가 여러 스트림을 보관합니다. 각 `Stream`은 다음을 기록합니다.\n\n- `sender`, `recipient`, `tokenAddress`([ERC-20](/eip-20/) 토큰이며 이더는 받지 않아야 함)\n- `balance`: 스트림에 남아 있는 자금\n- `timeframe`: `start`와 `stop` 블록 번호\n- `rate`: `interval` 블록마다 풀리는 `payment`\n\n흐름:\n\n1. **`create(recipient, token, startBlock, stopBlock, payment, interval)`**: 발신자가 전체 기간에 충분한 토큰을 예치합니다. 발신자는 여러 스트림을 병렬로 운영할 수 있습니다.\n2. **`balanceOf(streamId, addr)`**: 각 당사자가 현재 받을 자격이 있는 금액을 보여 줍니다. 수취인의 몫은 대략 `지급 속도 × (현재 블록 − 시작 블록)`으로 늘어납니다.\n3. **`withdraw(streamId, amount)`**: 쌓인 자금을 가져갈 수 있는 것은 수취인뿐입니다.\n4. **`redeem(streamId)`**: 어느 당사자든 스트림을 일찍 끝낼 수 있습니다. 쌓인 자금은 수취인에게, 나머지는 발신자에게 돌아갑니다.\n5. **업데이트**: 토큰, 중단 블록, 속도를 바꾸려면 모든 당사자의 확인이 필요하며, 어느 쪽이든 대기 중인 업데이트를 철회할 수 있습니다.\n\n이벤트(`LogCreate`, `LogWithdraw`, `LogRedeem`, `LogConfirmUpdate`, `LogRevokeUpdate`, `LogExecuteUpdate`)가 각 단계를 기록합니다.\n\n## 샘플 코드\n\n최신 Solidity로 작성한 스트림 하나의 핵심 회계(단순화, 설명용):\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nstruct Stream {\n    address sender;\n    address recipient;\n    address token;\n    uint256 deposit;\n    uint256 withdrawn;\n    uint256 startBlock;\n    uint256 stopBlock;\n    uint256 payment;   // tokens released per interval\n    uint256 interval;  // blocks per interval\n}\n\nlibrary StreamMath {\n    /// Amount the recipient has earned so far but not yet withdrawn.\n    function recipientBalance(Stream memory s) internal view returns (uint256) {\n        if (block.number \u003c= s.startBlock) return 0;\n        uint256 end = block.number \u003c s.stopBlock ? block.number : s.stopBlock;\n        uint256 earned = ((end - s.startBlock) / s.interval) * s.payment;\n        if (earned \u003e s.deposit) earned = s.deposit;\n        return earned - s.withdrawn;\n    }\n\n    /// What the sender would get back if the stream were redeemed now.\n    function senderBalance(Stream memory s) internal view returns (uint256) {\n        return s.deposit - s.withdrawn - recipientBalance(s);\n    }\n}\n```\n\n## 알아둘 점\n\n- 상태는 **Stagnant**입니다. 명세는 초기 스케치이며 메서드 목록에 불일치가 있습니다(예: `confirmUpdate`와 `revokeUpdate` 아래에 나온 시그니처가 제목과 맞지 않음). 완성된 인터페이스가 아니라 개념으로 받아들이세요.\n- 시간 대신 블록 번호를 사용합니다. 평균 블록 시간이 바뀌면 스트림은 실제 시간으로 예상보다 일찍 또는 늦게 끝납니다. 명세는 이 문제를 길게 논의하며 `update`로 재협상하거나 오라클의 타임스탬프를 쓰자고 제안합니다. 대신 `block.timestamp`를 쓰는 것도 흔한 대안입니다.\n- 전체 예치금을 처음에 잠그세요. 그렇지 않으면 수취인의 누적 잔액은 약속에 불과합니다.\n- 명세는 향후의 \"멀티 홉\" 스트림(A에서 B, 다시 C로)을 언급하지만 정의하지는 않습니다.\n"},"zh":{"lang":"zh","tldr":"一种资金流式支付标准：付款方把 ERC-20 代币锁定在合约中，收款方可随着区块推进持续提取，把工资和订阅变成按使用付费的资金流。","tags":["payments","streaming","defi","erc20","erc"],"related":[20],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-1620/","markdown":"## 它解决什么问题？\n\n工资、房租和订阅通常按月分批支付，因为传统支付渠道频繁使用的成本很高。这就迫使一方必须信任另一方：员工工作一个月后才拿到报酬，或者订阅者提前预付一个月。\n\n在区块链上，“随时间变化的资金”是可行的。ERC-1620 标准化了这样一种合约：资金逐个区块地从发送方流向接收方。接收方可以随时提取已累计的部分，任何一方都可以停止资金流并公平地分配余额。\n\n## 它如何运作\n\n一个主合约保存许多条资金流。每个 `Stream` 记录：\n\n- `sender`、`recipient` 和 `tokenAddress`（一种 [ERC-20](/eip-20/) 代币；不应接受以太币），\n- `balance`：仍在资金流中的资金，\n- `timeframe`：`start` 和 `stop` 区块号，\n- `rate`：每隔 `interval` 个区块释放 `payment`。\n\n流程：\n\n1. **`create(recipient, token, startBlock, stopBlock, payment, interval)`**：发送方存入足够支付整个期间的代币。一个发送方可以并行运行多条资金流。\n2. **`balanceOf(streamId, addr)`**：显示各方当前有权获得的金额。接收方的份额大致按 `支付速率 × (当前区块 − 起始区块)` 增长。\n3. **`withdraw(streamId, amount)`**：只有接收方可以提取已累计的资金。\n4. **`redeem(streamId)`**：任何一方都可以提前结束资金流。已累计的资金归接收方，其余退回发送方。\n5. **更新**：更改代币、结束区块或速率需要所有各方确认；任何一方都可以撤销待处理的更新。\n\n事件（`LogCreate`、`LogWithdraw`、`LogRedeem`、`LogConfirmUpdate`、`LogRevokeUpdate`、`LogExecuteUpdate`）记录每一步。\n\n## 示例代码\n\n用现代 Solidity 表示的一条资金流的核心记账（简化版，仅作演示）：\n\n```solidity\n// SPDX-License-Identifier: MIT\npragma solidity ^0.8.20;\n\nstruct Stream {\n    address sender;\n    address recipient;\n    address token;\n    uint256 deposit;\n    uint256 withdrawn;\n    uint256 startBlock;\n    uint256 stopBlock;\n    uint256 payment;   // tokens released per interval\n    uint256 interval;  // blocks per interval\n}\n\nlibrary StreamMath {\n    /// Amount the recipient has earned so far but not yet withdrawn.\n    function recipientBalance(Stream memory s) internal view returns (uint256) {\n        if (block.number \u003c= s.startBlock) return 0;\n        uint256 end = block.number \u003c s.stopBlock ? block.number : s.stopBlock;\n        uint256 earned = ((end - s.startBlock) / s.interval) * s.payment;\n        if (earned \u003e s.deposit) earned = s.deposit;\n        return earned - s.withdrawn;\n    }\n\n    /// What the sender would get back if the stream were redeemed now.\n    function senderBalance(Stream memory s) internal view returns (uint256) {\n        return s.deposit - s.withdrawn - recipientBalance(s);\n    }\n}\n```\n\n## 需要注意\n\n- 状态为 **Stagnant**。该规范是早期的草图，其方法列表存在不一致（例如 `confirmUpdate` 和 `revokeUpdate` 下给出的签名与标题不符）。请把它当作一个概念，而不是完成的接口。\n- 区块号被用来代替时间。如果平均出块时间改变，资金流在现实时间中会比预期更早或更晚结束。规范对此做了大量讨论，建议通过 `update` 重新协商，或使用来自预言机的时间戳。改用 `block.timestamp` 是常见的替代方案。\n- 请提前锁定全部存款。否则，接收方已累计的余额只是一个承诺。\n- 规范提到了未来的“多跳”资金流（A 到 B 再到 C），但没有定义它们。\n"}}}
