From 224e2420fd1c1257f78624bb7d391e39362f5391 Mon Sep 17 00:00:00 2001 From: Yak Date: Mon, 3 Feb 2025 18:00:26 -0300 Subject: [PATCH 1/5] streaming CHIP --- CHIPs/chip-0041.md | 61 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 CHIPs/chip-0041.md diff --git a/CHIPs/chip-0041.md b/CHIPs/chip-0041.md new file mode 100644 index 00000000..1ccb4840 --- /dev/null +++ b/CHIPs/chip-0041.md @@ -0,0 +1,61 @@ +CHIP Number | < Creator must leave this blank. Editor will assign a number.> +:-------------|:---- +Title | Streaming Puzzle +Description | A puzzle that allows continuous payments to a receiver over a fixed time period. The stream may be stopped early by a clawback puzzle. +Authors | [yakuhito](https://github.com/yakuhito), [Michael Taylor](https://github.com/MichaelTaylor3D) +Editor | < Creator must leave this blank. Editor will be assigned.> +Comments-URI | < Creator must leave this blank. Editor will assign a URI.> +Status | < Creator must leave this blank. Editor will assign a status.> +Category | Informational +Sub-Category | Chialisp +Created | 2025-02-03 +Requires | - +Replaces | - +Superseded-By | - + +## Abstract +This CHIP proposes a new puzzle for continuously streaming XCH or CATs to a receiver over a fixed time period. The sender creates a streaming coin holding the total amount to be transferred. As time passes, the receiver’s claimable portion increases proportionally. The receiver may spend the coin to claim their accrued share at any point, causing the puzzle to create a new streaming coin with the remainder. A designated clawback puzzle may stop the stream at any time. In that case, the receiver still obtains their accrued amount, but a new streaming coin is not generated. + +## Motivation +Many blockchain protocols use vesting schedules to distribute tokens to investors. This proposal simplifies that process by leveraging the coinset model for fine-grained, continuous payments without requiring multiple delayed transactions. The included clawback mechanism expands possible use cases, such as enabling DAOs to reward contributors with an option to halt payments early if needed. This arrangement ensures that the recipient retains all accrued funds up to the clawback time. + +## Backwards Compatibility +This proposal is fully backwards compatible. The streaming coin pays out to the recipient puzzle hash in a manner that current wallets can recognize. Specifically, it uses a standard payout output condition (i.e., `CREATE_COIN` with the receiver’s puzzle hash as the hint), ensuring that existing wallet software will properly detect incoming CAT or XCH coins. + +## Rationale + - **Minimize Required On-Chain Transactions**: The puzzle design requires fewer on-chain transactions than repeated partial payments, allowing payouts in the smallest possible increments without manually creating multiple outputs. This offers greater flexibility and more granularity over the next best option, which requires creating multiple delayed clawback transactions. + - **Controlled Access**: Only the receiver and the clawback puzzle may spend the streaming coin. This restricts potential spam payout transactions triggered by third parties while granting the receiver freedom to choose timing for claims (e.g., for tax considerations). +- **Clawback Option**: Giving the sender the ability to stop the stream increases puzzle complexity but substantially expands the puzzle’s utility in scenarios such as DAO-based contributor grants, where early termination may be necessary. The puzzle ensures that accrued funds are released to the receiver even when the stream is stopped. + +## Specification +The streaming puzzle can be found [here](https://github.com/Yakuhito/streaming/blob/master/puzzles/stream.clsp). + +The streaming identifier is defined as the coin name of the initial streaming coin. This identifier is a bech32m-encoded string with the prefix `s` (for mainnet) or `ts` (for testnet). For example, a valid testnet stream ID might be: + +``` +ts10f73rwr50l7q3r6nwapwk9ttptk26s4he0wmdfq4247jshnmqfgqslthzu +``` + +During creation of the first streaming coin, the following information must be provided via memos: + - Recipient puzzle hash + - Clawback puzzle hash + - Start timestamp + - End timestamp + +Wallets or other software analyzing the chain can parse these memos from the eve streaming coin’s creation and verify that they match the puzzle hash included in the associated `CREATE_COIN` condition. This allows driver code to be able to spend the first streaming coin. + + +## Test Cases +A series of tests verifying partial claims and clawbacks is provided in the reference implementation. + +## Reference Implementation +The reference implementation can be found [here](https://github.com/Yakuhito/streaming/tree/master). It includes: + - Puzzle and driver code + - Tests + - A CLI tool for viewing and interacting with streaming CATs through the Sage RPC + +## Security +Aside from puzzle risk, senders and receivers should keep in mind that Chia network fees fluctuate. It might become expensive to interact with the streaming coin. The puzzle has been optimized to reduce transaction size and fees, typically costing less than comparable operations like NFT transfers. + +## Copyright +Copyright and rights to this CHIP waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). From b943f0d08a8ab2188d359cf2381ee7d18946706f Mon Sep 17 00:00:00 2001 From: Yak Date: Mon, 3 Feb 2025 18:21:05 -0300 Subject: [PATCH 2/5] stream prefix --- CHIPs/chip-0041.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHIPs/chip-0041.md b/CHIPs/chip-0041.md index 1ccb4840..aada948a 100644 --- a/CHIPs/chip-0041.md +++ b/CHIPs/chip-0041.md @@ -30,10 +30,10 @@ This proposal is fully backwards compatible. The streaming coin pays out to the ## Specification The streaming puzzle can be found [here](https://github.com/Yakuhito/streaming/blob/master/puzzles/stream.clsp). -The streaming identifier is defined as the coin name of the initial streaming coin. This identifier is a bech32m-encoded string with the prefix `s` (for mainnet) or `ts` (for testnet). For example, a valid testnet stream ID might be: +The streaming identifier is defined as the coin name of the initial streaming coin. This identifier is a bech32m-encoded string with the prefix `stream` (for mainnet) or `tstream` (for testnet). For example, a valid testnet stream ID might be: ``` -ts10f73rwr50l7q3r6nwapwk9ttptk26s4he0wmdfq4247jshnmqfgqslthzu +tstream1yxruadr5c02n37sn392ejrvczsyfrmjv7m0ynjpgkrhhzym66n5qez4qck ``` During creation of the first streaming coin, the following information must be provided via memos: From ce13a272000e1d100401d98cb72161b6217176d0 Mon Sep 17 00:00:00 2001 From: danieljperry Date: Tue, 4 Feb 2025 11:16:31 +0800 Subject: [PATCH 3/5] Assign CHIP-41 --- CHIPs/chip-0041.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/CHIPs/chip-0041.md b/CHIPs/chip-0041.md index aada948a..e893022f 100644 --- a/CHIPs/chip-0041.md +++ b/CHIPs/chip-0041.md @@ -1,11 +1,11 @@ -CHIP Number | < Creator must leave this blank. Editor will assign a number.> +CHIP Number | 0041 :-------------|:---- Title | Streaming Puzzle Description | A puzzle that allows continuous payments to a receiver over a fixed time period. The stream may be stopped early by a clawback puzzle. Authors | [yakuhito](https://github.com/yakuhito), [Michael Taylor](https://github.com/MichaelTaylor3D) -Editor | < Creator must leave this blank. Editor will be assigned.> -Comments-URI | < Creator must leave this blank. Editor will assign a URI.> -Status | < Creator must leave this blank. Editor will assign a status.> +Editor | [Dan Perry](https://github.com/danieljperry) +Comments-URI | [CHIPs repo, PR #142](https://github.com/Chia-Network/chips/pull/142) +Status | Draft Category | Informational Sub-Category | Chialisp Created | 2025-02-03 From 66f53fb1be188ca9718334681a963db678914693 Mon Sep 17 00:00:00 2001 From: Yak Date: Tue, 4 Feb 2025 19:48:20 -0300 Subject: [PATCH 4/5] clarifications --- CHIPs/chip-0041.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHIPs/chip-0041.md b/CHIPs/chip-0041.md index aada948a..47f134e5 100644 --- a/CHIPs/chip-0041.md +++ b/CHIPs/chip-0041.md @@ -23,6 +23,9 @@ Many blockchain protocols use vesting schedules to distribute tokens to investor This proposal is fully backwards compatible. The streaming coin pays out to the recipient puzzle hash in a manner that current wallets can recognize. Specifically, it uses a standard payout output condition (i.e., `CREATE_COIN` with the receiver’s puzzle hash as the hint), ensuring that existing wallet software will properly detect incoming CAT or XCH coins. ## Rationale +The receiver and clawback initiator are considered to be custody puzzles (e.g., `p2_delegated_puzzle_or_hidden_puzzle`), and are set when the streaming coin is first created. Usually, the streaming coin creator will use one of their addresses as the clawback puzzle, allowing them to stop streaming funds in the future. Alternatively, the clawback puzzle can be set to `()`, effectively disabling the clawback functionality of the streaming coin and creating a 'permanent commitment' stream. Both puzzles are required to send a message to spend the coin. The claimed/clawed back funds are also created with these puzzle hashes. + +When designing the puzzle, our main considerations were: - **Minimize Required On-Chain Transactions**: The puzzle design requires fewer on-chain transactions than repeated partial payments, allowing payouts in the smallest possible increments without manually creating multiple outputs. This offers greater flexibility and more granularity over the next best option, which requires creating multiple delayed clawback transactions. - **Controlled Access**: Only the receiver and the clawback puzzle may spend the streaming coin. This restricts potential spam payout transactions triggered by third parties while granting the receiver freedom to choose timing for claims (e.g., for tax considerations). - **Clawback Option**: Giving the sender the ability to stop the stream increases puzzle complexity but substantially expands the puzzle’s utility in scenarios such as DAO-based contributor grants, where early termination may be necessary. The puzzle ensures that accrued funds are released to the receiver even when the stream is stopped. From 8e17d18691ae5441a4f979ffdd5c1e791c30bff6 Mon Sep 17 00:00:00 2001 From: danieljperry Date: Fri, 21 Feb 2025 10:59:38 +0800 Subject: [PATCH 5/5] Move CHIP-41 to Review status --- CHIPs/chip-0041.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHIPs/chip-0041.md b/CHIPs/chip-0041.md index 1ac0fd95..ebf4b8b7 100644 --- a/CHIPs/chip-0041.md +++ b/CHIPs/chip-0041.md @@ -5,7 +5,7 @@ Description | A puzzle that allows continuous payments to a receiver over a fi Authors | [yakuhito](https://github.com/yakuhito), [Michael Taylor](https://github.com/MichaelTaylor3D) Editor | [Dan Perry](https://github.com/danieljperry) Comments-URI | [CHIPs repo, PR #142](https://github.com/Chia-Network/chips/pull/142) -Status | Draft +Status | Review Category | Informational Sub-Category | Chialisp Created | 2025-02-03