From 400eebe87b616b1914395a9de80e4bc746ab4912 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Mon, 15 Aug 2022 17:28:54 -0400 Subject: [PATCH 01/48] Create zip-proportional-output-fee-mechanism-pofm --- ...proportional-output-fee-mechanism-pofm.rst | 191 ++++++++++++++++++ 1 file changed, 191 insertions(+) create mode 100644 zip-proportional-output-fee-mechanism-pofm.rst diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst new file mode 100644 index 000000000..bcd954864 --- /dev/null +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -0,0 +1,191 @@ +:: + + ZIP: XXX + Title: Proportional Output Fee Mechanism (POFM) + Owners: Aditya Bharadwaj + Credits: Madars Vizra, Kris Nuttycombe + Status: Draft + Community Status: Request for comments : + Category: Wallet + Created: 2022-08-15 + License: MIT + + +Terminology +=========== + +The key words "MUST", "SHOULD", "SHOULD NOT", "MAY", "RECOMMENDED", +"OPTIONAL", and "REQUIRED" in this document are to be interpreted as +described in RFC 2119. [#RFC2119]_ + +"Z" refers to shielded address. +"T" refers to transparent address. + +"POFM" refers to the proposed change in conventional fee as described in +this ZIP. + +The term "default transaction fee" in this document is in reference +to Z to Z, T to Z & Z to T transaction fee paid to miners on the Zcash network +for the work on including the shielded transaction in a block. + + +Abstract +======== + +The goal of this ZIP is to change the conventional transaction fees for +Shielded transactions and get buy-in from wallet developers, miners & Zcash users. + +With an updated transaction fee formula, miners will be compensated fairly for +including transactions with a high number of outputs, while still allowing low fees +for regular shielded transaction use cases. + + +Out of Scope for this Proposal +============ + +Discussion around transaction fees for T to T. + + +Motivation +============ + +In light of recent network activity, it is time to review and update the +standard 1,000 zats transaction fees set in ZIP-313. + + +The conventional transaction fee presently is 0.00001 ZEC or 1,000 zats per +ZIP-313, that allowed exploration of novel use cases of the Zcash blockchain. +The Zcash network has operated for almost 2 years of 1,000 zats fee per shielded +transaction without consideration for the total number of inputs and outputs in the transaction. +This has resulted in high output transactions with 1,100 outputs costing the same as +transactions with 2 outputs. + + +Requirements for consensus +------------------------- + +Wallet developers must update the fees to the proposed formula by Madars and +Kris Nuttycomb [#madars-1]_ + +min_fee = 0.00001 + 0.00001 * max(0, #nullifiers + #shielded outputs - 4) + +The change to the conventional transaction fees must be undertaken soon +as the Zcash network has been under heavy load with high-output transactions while +regular shielded transactions with 2 outputs are affected when relying on current +light wallet infrastructure. + +The following parties need to be part of the consensus: + +* The technical aspects of a changing conventional fee based on outputs +need to be evaluated. +* A guarantee from mining groups is required to include the updated POFM +transactions in the next block. +* Wallet developers need to update the software to use the new fee. +* Zcash documentation and community outreach must be undertaken to +make the change known. + + +Requirements for adoption +------------------------- + +The change to the conventional transaction fees should be undertaken soon +as it gets difficult to gain consensus with the growth in the network +of wallets, exchanges, miners, and third parties involved. + +The following parties need to be part of the consensus: + +* Support from mining groups is required to include the updated conventional + fee transactions in the next block. +* Wallet developers need to provide a commitment to update the software to use + the new fee. +* Zcash documentation and community outreach must be undertaken to make the + change known. + + +Security and privacy considerations +----------------------------------- + +Unique transaction fees may reveal specific users or wallets or wallet versions, +which would reduce privacy for those specific users and the rest of the network. +Hence this change should be accepted by a majority of shielded transaction +software providers before deploying the change. + +Long term, the issue of fees needs to be re-visited in separate future +proposals as the blocks start getting consistently full. New ZIPs with +scaling solutions, will need to be evaluated and applied. + + +Denial of Service Vulnerability +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +A transaction-rate-based denial of service attack occurs when an attacker +generates enough transactions over a window of time to prevent legitimate +transactions from being mined, or to hinder syncing blocks for full nodes +or miners. + +There are two primary protections to this kind of attack in Zcash: the +block size limit, and transaction fees. The block size limit ensures that +full nodes and miners can keep up with the blockchain even if blocks are +completely full. However, users sending legitimate transactions may not +have their transactions confirmed in a timely manner. + +Variable fees could mitigate this kind of denial of service: if there are +more transactions available than can fit into a single block, then a miner +will typically choose the transactions that pay the highest fees. If +legitimate wallets were to increase their fees during this condition, the +attacker would also increase the fees of their transactions. It is +sometimes argued that this would impose a cost to the attacker that would +limit the time window for which they can continue the attack. However, there +is little evidence that the actual costs involved would be a sufficient +disincentive. + +This proposal does not alter how fees are paid from transactions to miners. + +Wallet developers and operators should monitor the Zcash network for rapid +growth in transaction rates. + + +Specification +============= + +Wallets implementing this specification will use a conventional fee in the form of +min_fee = 0.00001 + 0.00001 * max(0, #nullifiers + #shielded outputs - 4) +starting from block 180,000. + + +Transaction relaying +-------------------- + +zcashd, and potentially other node implementations, implement fee-based +restrictions on relaying of mempool transactions. Nodes that normally relay +transactions are expected to do so for transactions that pay at least the +conventional fee, unless there are other reasons not to do so for robustness +or denial-of-service mitigation. + + +Mempool size limiting +--------------------- + +zcashd limits the size of the mempool as described in [#zip-0401]_. This +specifies a *low\_fee\_penalty* that is added to the "eviction weight" if the +transaction pays a fee less than the proposed increase with POFM. + + +Support +======= + +The developers of the following wallets intend to implement the updated fee mechanism: + +* Zecwallet Suite (Zecwallet Lite for Desktop/iOS/Android & Zecwallet FullNode); +* Nighthawk Wallet for Android & iOS; +* ECC Mobile SDKs for iOS & Android +* zcashd built-in wallet + + +Acknowledgements +================ + +Thanks to Madars Vizra for suggesting the fee mechanism. And Kris Nuttycombe to +suggest optimization. + +.. [#madars-1] `Madars concrete soft-fork proposal `_ From b59960268c0024609079ab6c3fae069ab14565ec Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Mon, 15 Aug 2022 17:49:52 -0400 Subject: [PATCH 02/48] Update fee formula. Fix name spelling. --- zip-proportional-output-fee-mechanism-pofm.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index bcd954864..2ed2adb25 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -3,9 +3,9 @@ ZIP: XXX Title: Proportional Output Fee Mechanism (POFM) Owners: Aditya Bharadwaj - Credits: Madars Vizra, Kris Nuttycombe + Credits: Madars Virza, Kris Nuttycombe Status: Draft - Community Status: Request for comments : + Community Status: Request for comments : https://forum.zcashcommunity.com/t/zip-proportional-output-fee-mechanism-pofm/42808 Category: Wallet Created: 2022-08-15 License: MIT @@ -67,7 +67,7 @@ Requirements for consensus Wallet developers must update the fees to the proposed formula by Madars and Kris Nuttycomb [#madars-1]_ -min_fee = 0.00001 + 0.00001 * max(0, #nullifiers + #shielded outputs - 4) +min_fee = base_fee * max(0, #inputs + #outputs - 4) The change to the conventional transaction fees must be undertaken soon as the Zcash network has been under heavy load with high-output transactions while @@ -149,7 +149,7 @@ Specification ============= Wallets implementing this specification will use a conventional fee in the form of -min_fee = 0.00001 + 0.00001 * max(0, #nullifiers + #shielded outputs - 4) +min_fee = base_fee * max(0, #inputs + #outputs - 4) starting from block 180,000. @@ -185,7 +185,7 @@ The developers of the following wallets intend to implement the updated fee mech Acknowledgements ================ -Thanks to Madars Vizra for suggesting the fee mechanism. And Kris Nuttycombe to +Thanks to Madars Virza for suggesting the fee mechanism. And Kris Nuttycombe to suggest optimization. .. [#madars-1] `Madars concrete soft-fork proposal `_ From 1b5a6feaa979b57e739501d83602f01b3468c321 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Mon, 15 Aug 2022 17:56:40 -0400 Subject: [PATCH 03/48] Add transparent inputs & outputs wording. --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 2ed2adb25..a5b7605ca 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -69,6 +69,10 @@ Kris Nuttycomb [#madars-1]_ min_fee = base_fee * max(0, #inputs + #outputs - 4) +Where #inputs and #outputs also take into account transparent inputs and outputs. +Otherwise, the fee structure (if not otherwise changed) will preferentially encourage +usage of the transparent part of the chain. + The change to the conventional transaction fees must be undertaken soon as the Zcash network has been under heavy load with high-output transactions while regular shielded transactions with 2 outputs are affected when relying on current From d4274592babf79bf2e59657c11eb5d071b618100 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Mon, 15 Aug 2022 18:03:32 -0400 Subject: [PATCH 04/48] Update zip-proportional-output-fee-mechanism-pofm.rst Co-authored-by: Kris Nuttycombe --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index a5b7605ca..f7c48535c 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -65,7 +65,7 @@ Requirements for consensus ------------------------- Wallet developers must update the fees to the proposed formula by Madars and -Kris Nuttycomb [#madars-1]_ +Kris Nuttycombe [#madars-1]_ min_fee = base_fee * max(0, #inputs + #outputs - 4) From f20476914dcb667b4552cb1cd4a7076c0f68df86 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Mon, 15 Aug 2022 18:20:04 -0400 Subject: [PATCH 05/48] Update wording in requirements for consensus. --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index a5b7605ca..8c3886cf1 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -61,10 +61,10 @@ This has resulted in high output transactions with 1,100 outputs costing the sam transactions with 2 outputs. -Requirements for consensus +Requirements for gathering consensus ------------------------- -Wallet developers must update the fees to the proposed formula by Madars and +Wallet developers must update the fees to the proposed formula by Madars Virza and Kris Nuttycomb [#madars-1]_ min_fee = base_fee * max(0, #inputs + #outputs - 4) From 05c3311b728afd9e12956e1b04b322b45615e99a Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Mon, 15 Aug 2022 18:22:16 -0400 Subject: [PATCH 06/48] Add wording. --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index f7c48535c..04a0f86da 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -61,7 +61,7 @@ This has resulted in high output transactions with 1,100 outputs costing the sam transactions with 2 outputs. -Requirements for consensus +Requirements for gathering consensus ------------------------- Wallet developers must update the fees to the proposed formula by Madars and From c8adeaadabfb1cf0ce3a92994f81fddf5f0905be Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Mon, 15 Aug 2022 21:18:31 -0400 Subject: [PATCH 07/48] Fix target block height. --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 04a0f86da..597494e33 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -154,7 +154,7 @@ Specification Wallets implementing this specification will use a conventional fee in the form of min_fee = base_fee * max(0, #inputs + #outputs - 4) -starting from block 180,000. +starting from block 1,800,000. Transaction relaying From 2e764803a251f22a9622f277bb64cac303bbd418 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:40:25 -0400 Subject: [PATCH 08/48] Add ZIP #317 Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 597494e33..2706ece68 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -1,6 +1,6 @@ :: - ZIP: XXX + ZIP: 317 Title: Proportional Output Fee Mechanism (POFM) Owners: Aditya Bharadwaj Credits: Madars Virza, Kris Nuttycombe From 27f8ace2df1d75a09de7f9da87fff15fd17c52c8 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:44:51 -0400 Subject: [PATCH 09/48] Fix formatting for credits. Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 2706ece68..c224697e4 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -3,7 +3,8 @@ ZIP: 317 Title: Proportional Output Fee Mechanism (POFM) Owners: Aditya Bharadwaj - Credits: Madars Virza, Kris Nuttycombe + Credits: Madars Virza + Kris Nuttycombe Status: Draft Community Status: Request for comments : https://forum.zcashcommunity.com/t/zip-proportional-output-fee-mechanism-pofm/42808 Category: Wallet From 4cc0a69dcea317e34b8979c5e436e51079739174 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:46:03 -0400 Subject: [PATCH 10/48] Update wording. Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index c224697e4..f1a25c7a4 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -37,8 +37,8 @@ The goal of this ZIP is to change the conventional transaction fees for Shielded transactions and get buy-in from wallet developers, miners & Zcash users. With an updated transaction fee formula, miners will be compensated fairly for -including transactions with a high number of outputs, while still allowing low fees -for regular shielded transaction use cases. +including transactions with a high number of inputs or outputs, while still allowing +low fees for regular shielded transaction use cases. Out of Scope for this Proposal From 9188c51f23d8747e819499230f0ae255e5ce8097 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:46:36 -0400 Subject: [PATCH 11/48] Fix unit and link ZIP-313 Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index f1a25c7a4..d5ef77793 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -51,7 +51,7 @@ Motivation ============ In light of recent network activity, it is time to review and update the -standard 1,000 zats transaction fees set in ZIP-313. +standard 1,000 zatoshi transaction fees set in ZIP 313 [#zip-0313]_. The conventional transaction fee presently is 0.00001 ZEC or 1,000 zats per From 9a717d078ba4d3c02425b174ccde17c2921cf7e8 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:47:17 -0400 Subject: [PATCH 12/48] Change must to should for requirements. Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index d5ef77793..ce12d21a3 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -65,7 +65,7 @@ transactions with 2 outputs. Requirements for gathering consensus ------------------------- -Wallet developers must update the fees to the proposed formula by Madars and +Wallet developers SHOULD update the fees to the proposed formula by Madars and Kris Nuttycombe [#madars-1]_ min_fee = base_fee * max(0, #inputs + #outputs - 4) From b8d595b9432623cbc8b6a29b278c902d55dc3ce1 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:52:57 -0400 Subject: [PATCH 13/48] Update fee formula to avoid 0 fee calculation. --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index ce12d21a3..973643552 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -68,7 +68,7 @@ Requirements for gathering consensus Wallet developers SHOULD update the fees to the proposed formula by Madars and Kris Nuttycombe [#madars-1]_ -min_fee = base_fee * max(0, #inputs + #outputs - 4) +min_fee = base_fee * max(1, #inputs + #outputs - 4) Where #inputs and #outputs also take into account transparent inputs and outputs. Otherwise, the fee structure (if not otherwise changed) will preferentially encourage @@ -154,7 +154,7 @@ Specification ============= Wallets implementing this specification will use a conventional fee in the form of -min_fee = base_fee * max(0, #inputs + #outputs - 4) +min_fee = base_fee * max(1, #inputs + #outputs - 4) starting from block 1,800,000. From 62f6aac146b29e9085da1d2c165ed3e96cde7ff0 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:54:45 -0400 Subject: [PATCH 14/48] Remove Out of Scope section. Plan to apply new conventional fees to all transaction types. --- zip-proportional-output-fee-mechanism-pofm.rst | 6 ------ 1 file changed, 6 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 973643552..efbc962fc 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -41,12 +41,6 @@ including transactions with a high number of inputs or outputs, while still allo low fees for regular shielded transaction use cases. -Out of Scope for this Proposal -============ - -Discussion around transaction fees for T to T. - - Motivation ============ From 63bd0d9d4c7ff0636712b567e6bcb5a802cb9651 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:56:22 -0400 Subject: [PATCH 15/48] Add PR details to header. Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index efbc962fc..9acfad3d9 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -6,10 +6,11 @@ Credits: Madars Virza Kris Nuttycombe Status: Draft - Community Status: Request for comments : https://forum.zcashcommunity.com/t/zip-proportional-output-fee-mechanism-pofm/42808 Category: Wallet Created: 2022-08-15 License: MIT + Discussions-To: + Pull-Request: Terminology From cff9e8e2b9474553116c8cb91cba75e4082987a1 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 14:59:24 -0400 Subject: [PATCH 16/48] Update timeline for new conventional fees to immediate. Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 9acfad3d9..55cefe95c 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -150,7 +150,8 @@ Specification Wallets implementing this specification will use a conventional fee in the form of min_fee = base_fee * max(1, #inputs + #outputs - 4) -starting from block 1,800,000. +starting from block 1,800,000 for Mainnet, or immediately on implementing this +ZIP for Testnet. Transaction relaying From a1906aeaf407dd3a4cf7cf08632af6ff452c73ba Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 15:01:21 -0400 Subject: [PATCH 17/48] Define network terms. Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 55cefe95c..ff41e13e9 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -30,6 +30,8 @@ The term "default transaction fee" in this document is in reference to Z to Z, T to Z & Z to T transaction fee paid to miners on the Zcash network for the work on including the shielded transaction in a block. +The terms "Mainnet, "Testnet", and "zatoshi" in this document are defined as in [#protocol-networks]_. + Abstract ======== From 595443be5d678cabe7e809859f19874e537d7db4 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 15:02:01 -0400 Subject: [PATCH 18/48] Add references. Co-authored-by: Daira Hopwood --- zip-proportional-output-fee-mechanism-pofm.rst | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index ff41e13e9..170fdc9ab 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -188,7 +188,15 @@ The developers of the following wallets intend to implement the updated fee mech Acknowledgements ================ -Thanks to Madars Virza for suggesting the fee mechanism. And Kris Nuttycombe to -suggest optimization. +Thanks to Madars Virza for initially proposing a the fee mechanism similar to that +proposed in this ZIP [#madars-1], and to Kris Nuttycombe for suggested improvements. -.. [#madars-1] `Madars concrete soft-fork proposal `_ + +References +========== + +.. [#RFC2119] `RFC 2119: Key words for use in RFCs to Indicate Requirement Levels `_ +.. [#protocol-networks] `Zcash Protocol Specification, Version 2022.3.5. Section 3.12: Mainnet and Testnet `_ +.. [#madars-1] `Madars concrete soft-fork proposal `_ +.. [#zip-0313] `ZIP 313: Reduce Conventional Transaction Fee to 1000 zatoshis `_ +.. [#zip-0401] `ZIP 401: Addressing Mempool Denial-of-Service `_ From 91b8e832f15b27d604cf39e7eda6370183439f6d Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 15:02:18 -0400 Subject: [PATCH 19/48] Change support section to endorsements. Co-authored-by: Francisco Gindre --- ...proportional-output-fee-mechanism-pofm.rst | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 170fdc9ab..6d5790617 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -174,15 +174,29 @@ specifies a *low\_fee\_penalty* that is added to the "eviction weight" if the transaction pays a fee less than the proposed increase with POFM. -Support -======= +Endorsements +============ + +the following entities/groups/indiviudals expressed their support for the updated fee mechanism: + + +*Developer Groups or Sole OSS contributors* + +* Zecwallet Suite (Zecwallet Lite for Desktop/iOS/Android & Zecwallet FullNode) +* Nighthawk Wallet for Android & iOS + + +*Other Endorsements* + +* Jane Doe jane.doe@xxx.yyy +* Pseudo Dude ps@zzz.aaa -The developers of the following wallets intend to implement the updated fee mechanism: +To express and request your support to be added to this ZIP please comment below indicating +- (group) name/pseudonym +- affiliation +- contact -* Zecwallet Suite (Zecwallet Lite for Desktop/iOS/Android & Zecwallet FullNode); -* Nighthawk Wallet for Android & iOS; -* ECC Mobile SDKs for iOS & Android -* zcashd built-in wallet +or, conversely e-mail the same details to the Owner of the ZIP Acknowledgements From 9e642a5efbb83dd09cfa7afd092e38a07b7317a4 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 15:05:26 -0400 Subject: [PATCH 20/48] Manually add changes to Abstract. --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 6d5790617..30e33fbea 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -43,6 +43,10 @@ With an updated transaction fee formula, miners will be compensated fairly for including transactions with a high number of inputs or outputs, while still allowing low fees for regular shielded transaction use cases. +Once the new fee policy is enforced, this will additionally increase the cost of creating +transactions that collectively have many inputs or outputs, discouraging usage patterns +that cause either intentional or unintentional denial of service. + Motivation ============ From b19307a5d9ad11e06829e08c0dd0fa977c882869 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 15:07:29 -0400 Subject: [PATCH 21/48] Add change requirements to zcash toolchain. Co-authored-by: Francisco Gindre --- zip-proportional-output-fee-mechanism-pofm.rst | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 30e33fbea..893e6d695 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -106,7 +106,14 @@ The following parties need to be part of the consensus: the new fee. * Zcash documentation and community outreach must be undertaken to make the change known. - +* Changes to librustzcash crates to: + * expose minimum recommended fee for a given number of recipients + * implement default fee equation and corresponding unit tests + * integration of such mechanism to Transaction Builder APIs +* adopt `librustzcash` changes to mobile SDK repos: + * ZcashLightClientKit + * zcash-light-client-ffi + * zcash-android-wallet-sdk Security and privacy considerations ----------------------------------- From 050234bec634855f5fb8132dfc14156ed6e568f8 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 16 Aug 2022 15:35:05 -0400 Subject: [PATCH 22/48] Fix formatting. --- zip-proportional-output-fee-mechanism-pofm.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 893e6d695..38cc3b6dc 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -188,15 +188,13 @@ transaction pays a fee less than the proposed increase with POFM. Endorsements ============ -the following entities/groups/indiviudals expressed their support for the updated fee mechanism: - +The following entities/groups/indiviudals expressed their support for the updated fee mechanism: *Developer Groups or Sole OSS contributors* * Zecwallet Suite (Zecwallet Lite for Desktop/iOS/Android & Zecwallet FullNode) * Nighthawk Wallet for Android & iOS - *Other Endorsements* * Jane Doe jane.doe@xxx.yyy From 937013ab9f49a44f076f20d0e3ef46f92ae8ca63 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Wed, 17 Aug 2022 20:51:53 -0400 Subject: [PATCH 23/48] Update wording on transactions covered under the ZIP. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 38cc3b6dc..aad72a0eb 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -36,8 +36,8 @@ The terms "Mainnet, "Testnet", and "zatoshi" in this document are defined as in Abstract ======== -The goal of this ZIP is to change the conventional transaction fees for -Shielded transactions and get buy-in from wallet developers, miners & Zcash users. +The goal of this ZIP is to change the conventional fees for transactions +and get buy-in from wallet developers, miners and Zcash users. With an updated transaction fee formula, miners will be compensated fairly for including transactions with a high number of inputs or outputs, while still allowing From 2881b47dc5baedb0924627eb5334bd18cb8b3985 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Wed, 17 Aug 2022 20:53:21 -0400 Subject: [PATCH 24/48] Fix formatting for rST. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index aad72a0eb..0d33e1a03 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -49,7 +49,7 @@ that cause either intentional or unintentional denial of service. Motivation -============ +========== In light of recent network activity, it is time to review and update the standard 1,000 zatoshi transaction fees set in ZIP 313 [#zip-0313]_. From 19496d39b32d9b184339ad9b9d662e9fe63f1b67 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Wed, 17 Aug 2022 20:53:45 -0400 Subject: [PATCH 25/48] Remove hyphen. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 0d33e1a03..2c6fe5130 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -56,7 +56,7 @@ standard 1,000 zatoshi transaction fees set in ZIP 313 [#zip-0313]_. The conventional transaction fee presently is 0.00001 ZEC or 1,000 zats per -ZIP-313, that allowed exploration of novel use cases of the Zcash blockchain. +ZIP 313, that allowed exploration of novel use cases of the Zcash blockchain. The Zcash network has operated for almost 2 years of 1,000 zats fee per shielded transaction without consideration for the total number of inputs and outputs in the transaction. This has resulted in high output transactions with 1,100 outputs costing the same as From 34a82f2d1b1e1ad1143ad1870cae96f97a4bb90b Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Wed, 17 Aug 2022 20:54:26 -0400 Subject: [PATCH 26/48] Formatting fixes for rST. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 2c6fe5130..e280433b6 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -64,7 +64,7 @@ transactions with 2 outputs. Requirements for gathering consensus -------------------------- +------------------------------------ Wallet developers SHOULD update the fees to the proposed formula by Madars and Kris Nuttycombe [#madars-1]_ From f7142872544f2fbef0ad0092e16b02bbfe3f09bb Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Wed, 17 Aug 2022 20:58:39 -0400 Subject: [PATCH 27/48] Update working to min_fee Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index e280433b6..c4542e538 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -182,7 +182,7 @@ Mempool size limiting zcashd limits the size of the mempool as described in [#zip-0401]_. This specifies a *low\_fee\_penalty* that is added to the "eviction weight" if the -transaction pays a fee less than the proposed increase with POFM. +transaction pays a fee less than the `min_fee` specified by this ZIP. Endorsements From 69af6ea056a1956f648cbbe606981b05c904d82b Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Wed, 17 Aug 2022 21:07:21 -0400 Subject: [PATCH 28/48] Update wording. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index c4542e538..17ce6ab95 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -211,8 +211,9 @@ or, conversely e-mail the same details to the Owner of the ZIP Acknowledgements ================ -Thanks to Madars Virza for initially proposing a the fee mechanism similar to that -proposed in this ZIP [#madars-1], and to Kris Nuttycombe for suggested improvements. +Thanks to Madars Virza for initially proposing a fee mechanism similar to that +proposed in this ZIP [#madars-1], and to Kris Nuttycombe, Jack Grigg, and Daira +Hopwood for suggested improvements. References From e232e50ea1bdbcc294b834236cf939b4055bb761 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Wed, 17 Aug 2022 21:11:43 -0400 Subject: [PATCH 29/48] Update wording. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 17ce6ab95..05ca13201 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -73,7 +73,7 @@ min_fee = base_fee * max(1, #inputs + #outputs - 4) Where #inputs and #outputs also take into account transparent inputs and outputs. Otherwise, the fee structure (if not otherwise changed) will preferentially encourage -usage of the transparent part of the chain. +usage of the transparent part of the protocol. The change to the conventional transaction fees must be undertaken soon as the Zcash network has been under heavy load with high-output transactions while From 94d6b8acb23c4aed7fca7491acccd057efa54906 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Thu, 18 Aug 2022 16:13:24 -0400 Subject: [PATCH 30/48] Add base_fee and marginal_fee fields. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 05ca13201..9c755f885 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -162,7 +162,9 @@ Specification ============= Wallets implementing this specification will use a conventional fee in the form of -min_fee = base_fee * max(1, #inputs + #outputs - 4) +base_fee = ... +marginal_fee = ... +min_fee = base_fee + marginal_fee * max(0, #inputs + #outputs - 4) starting from block 1,800,000 for Mainnet, or immediately on implementing this ZIP for Testnet. From 0628577cbc220726499007fdf40a118b3a8beeab Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Thu, 18 Aug 2022 16:30:02 -0400 Subject: [PATCH 31/48] Include base_fee & marginal_fee constants. Update the discount constant to 3. Create deployment section and make Security and Privacy considerations top-level heading. --- ...proportional-output-fee-mechanism-pofm.rst | 42 ++++++++++++------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 9c755f885..89253d384 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -69,7 +69,7 @@ Requirements for gathering consensus Wallet developers SHOULD update the fees to the proposed formula by Madars and Kris Nuttycombe [#madars-1]_ -min_fee = base_fee * max(1, #inputs + #outputs - 4) +min_fee = base_fee * max(1, #inputs + #outputs - 3) Where #inputs and #outputs also take into account transparent inputs and outputs. Otherwise, the fee structure (if not otherwise changed) will preferentially encourage @@ -115,8 +115,27 @@ The following parties need to be part of the consensus: * zcash-light-client-ffi * zcash-android-wallet-sdk -Security and privacy considerations ------------------------------------ + +Specification +============= + +Wallets implementing this specification will use a conventional fee in the form of +base_fee and marginal_fee. + +The proposal would end up selecting one of: +* base_fee = 1000, marginal_fee = 250 in @nuttycom's proposal. +* base_fee = 1000, marginal_fee = 1000 in @madars' proposal. +* base_fee = 10000, marginal_fee = 2500 in @daira's proposal. +* base_fee = 1000, marginal_fee = 1000 for Shielded, Shielding and De-shielding +transactions, and base_fee = 10000, marginal_fee = 10000 for Transparent transactions +per @nighthawk24's proposal. + +And calculated per the following forumla: +min_fee = base_fee + marginal_fee * max(0, #inputs + #outputs - 3) + + +Security and Privacy considerations +============= Unique transaction fees may reveal specific users or wallets or wallet versions, which would reduce privacy for those specific users and the rest of the network. @@ -158,17 +177,6 @@ Wallet developers and operators should monitor the Zcash network for rapid growth in transaction rates. -Specification -============= - -Wallets implementing this specification will use a conventional fee in the form of -base_fee = ... -marginal_fee = ... -min_fee = base_fee + marginal_fee * max(0, #inputs + #outputs - 4) -starting from block 1,800,000 for Mainnet, or immediately on implementing this -ZIP for Testnet. - - Transaction relaying -------------------- @@ -187,6 +195,12 @@ specifies a *low\_fee\_penalty* that is added to the "eviction weight" if the transaction pays a fee less than the `min_fee` specified by this ZIP. +Deployment +============= +The height for coordinating deployment is block 1,800,000 for Mainnet, or immediately on +implementing this ZIP for Testnet. + + Endorsements ============ From b7eed2545c4a3ae5e3593f775049a92dd8e1bfcf Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Thu, 18 Aug 2022 16:40:02 -0400 Subject: [PATCH 32/48] Add credits. Remove specification from Motivation section. --- zip-proportional-output-fee-mechanism-pofm.rst | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 89253d384..b731977ba 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -5,6 +5,8 @@ Owners: Aditya Bharadwaj Credits: Madars Virza Kris Nuttycombe + Daira Hopwood + Jack Grigg Status: Draft Category: Wallet Created: 2022-08-15 @@ -54,7 +56,6 @@ Motivation In light of recent network activity, it is time to review and update the standard 1,000 zatoshi transaction fees set in ZIP 313 [#zip-0313]_. - The conventional transaction fee presently is 0.00001 ZEC or 1,000 zats per ZIP 313, that allowed exploration of novel use cases of the Zcash blockchain. The Zcash network has operated for almost 2 years of 1,000 zats fee per shielded @@ -66,10 +67,8 @@ transactions with 2 outputs. Requirements for gathering consensus ------------------------------------ -Wallet developers SHOULD update the fees to the proposed formula by Madars and -Kris Nuttycombe [#madars-1]_ - -min_fee = base_fee * max(1, #inputs + #outputs - 3) +Wallet developers SHOULD update the fees to the proposed formula under Specification section +by Madars Virza and Kris Nuttycombe [#madars-1]_ Where #inputs and #outputs also take into account transparent inputs and outputs. Otherwise, the fee structure (if not otherwise changed) will preferentially encourage From 93d3ce8474adbd0c3e7844a59a74517016c7fc7c Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Thu, 18 Aug 2022 16:41:41 -0400 Subject: [PATCH 33/48] Add credits. --- zip-proportional-output-fee-mechanism-pofm.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index b731977ba..6ac81c82d 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -7,6 +7,7 @@ Kris Nuttycombe Daira Hopwood Jack Grigg + Francisco Gindre Status: Draft Category: Wallet Created: 2022-08-15 From 7516306a188332a84f855e20ebd189e4b0e5be2e Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Fri, 19 Aug 2022 13:42:32 -0400 Subject: [PATCH 34/48] Update wording under motivation. --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 6ac81c82d..a0418b0a4 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -59,8 +59,8 @@ standard 1,000 zatoshi transaction fees set in ZIP 313 [#zip-0313]_. The conventional transaction fee presently is 0.00001 ZEC or 1,000 zats per ZIP 313, that allowed exploration of novel use cases of the Zcash blockchain. -The Zcash network has operated for almost 2 years of 1,000 zats fee per shielded -transaction without consideration for the total number of inputs and outputs in the transaction. +The Zcash network has operated for almost 2 years at a conventional 1,000 zats fee per +shielded transaction, without consideration for the total number of inputs and outputs in the transaction. This has resulted in high output transactions with 1,100 outputs costing the same as transactions with 2 outputs. From 5ea7810081b3dcb4ca3deeaad27864bced181639 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Mon, 22 Aug 2022 21:02:03 -0400 Subject: [PATCH 35/48] Update formula to include marginal fee and grace window size. --- zip-proportional-output-fee-mechanism-pofm.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index a0418b0a4..eaab73038 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -131,7 +131,9 @@ transactions, and base_fee = 10000, marginal_fee = 10000 for Transparent transac per @nighthawk24's proposal. And calculated per the following forumla: -min_fee = base_fee + marginal_fee * max(0, #inputs + #outputs - 3) +min_fee = base_fee + marginal_fee * max(0, inputs + outputs - grace_window_size) + +where grace_window_size = 4 Security and Privacy considerations From 05c8b6fb6a9bdd0140ddf6c73266edeb653a10db Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 30 Aug 2022 00:07:27 -0400 Subject: [PATCH 36/48] Add changes related to Zebra Co-authored-by: teor --- zip-proportional-output-fee-mechanism-pofm.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index eaab73038..b2f4f77b4 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -110,6 +110,7 @@ The following parties need to be part of the consensus: * expose minimum recommended fee for a given number of recipients * implement default fee equation and corresponding unit tests * integration of such mechanism to Transaction Builder APIs +* Changes to the Zebra mempool's conventional fee calculation * adopt `librustzcash` changes to mobile SDK repos: * ZcashLightClientKit * zcash-light-client-ffi From e74e23f946e23e6f66951888615cb006445ce297 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 30 Aug 2022 00:07:50 -0400 Subject: [PATCH 37/48] Add Zebra Co-authored-by: teor --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index b2f4f77b4..9efb5b414 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -193,7 +193,7 @@ or denial-of-service mitigation. Mempool size limiting --------------------- -zcashd limits the size of the mempool as described in [#zip-0401]_. This +zcashd and Zebra limit the size of the mempool as described in [#zip-0401]_. This specifies a *low\_fee\_penalty* that is added to the "eviction weight" if the transaction pays a fee less than the `min_fee` specified by this ZIP. From 7bbaf4ad42c3137331499bbd15a9a3e74311bc6a Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 30 Aug 2022 00:08:57 -0400 Subject: [PATCH 38/48] Add Standards wording. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 9efb5b414..0e8132f56 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -9,7 +9,8 @@ Jack Grigg Francisco Gindre Status: Draft - Category: Wallet + Category: Standards / Wallet + Obsoletes: ZIP 313 Created: 2022-08-15 License: MIT Discussions-To: From ffa113de6bf9c09917c28737b8df5939f1fb5fe5 Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 30 Aug 2022 00:10:17 -0400 Subject: [PATCH 39/48] Clarify specification. Co-authored-by: str4d --- ...proportional-output-fee-mechanism-pofm.rst | 68 ++++++++++++++++--- 1 file changed, 58 insertions(+), 10 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 0e8132f56..7e12fe163 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -121,21 +121,69 @@ The following parties need to be part of the consensus: Specification ============= -Wallets implementing this specification will use a conventional fee in the form of -base_fee and marginal_fee. +This specification defines three parameters that are used to calculate the +conventional fee: -The proposal would end up selecting one of: +=================== ============================ +Parameter Units +=================== ============================ +`base_fee` zatoshis +`marginal_fee` zatoshis per input or output +`grace_window_size` inputs or outputs +=================== ============================ + +Wallets implementing this specification SHOULD use a conventional fee +calculated in zatoshis per the following formula:: + + base_fee + marginal_fee * max(0, inputs + outputs - grace_window_size) + +The parameters are set to the following values: +* `base_fee = TODO`; +* `marginal_fee = TODO`; +* `grace_window_size = 4`. + +It is not a consensus requirement that fees follow this formula; however, +wallets SHOULD use this fee to reduce information leakage in transactions +unless overridden by the user. + +Transaction relaying +-------------------- + +zcashd, zebrad, and potentially other node implementations, implement +fee-based restrictions on relaying of mempool transactions. Nodes that +normally relay transactions are expected to do so for transactions that pay +at least the conventional fee, unless there are other reasons not to do so +for robustness or denial-of-service mitigation. + +Mempool size limiting +--------------------- + +zcashd and zebrad limit the size of the mempool as described in [#zip-0401]_. +This specifies a *low\_fee\_penalty* that is added to the "eviction weight" +if the transaction pays a fee less than the conventional transaction fee. +This threshold is modified to use the new conventional fee formula. + +Block production +---------------- + +Miners, mining pools, and other block producers, select transactions for +inclusion in blocks using a variety of criteria. Where the criteria +previously used the conventional transaction fee defined in ZIP 313 to +decide on transaction inclusion, it is expected to instead use the formula +specified in this ZIP. + +Open Issues +----------- + +> TODO: Remove this section once a decision is made. + +Possible alternatives for the parameters: * base_fee = 1000, marginal_fee = 250 in @nuttycom's proposal. * base_fee = 1000, marginal_fee = 1000 in @madars' proposal. * base_fee = 10000, marginal_fee = 2500 in @daira's proposal. * base_fee = 1000, marginal_fee = 1000 for Shielded, Shielding and De-shielding -transactions, and base_fee = 10000, marginal_fee = 10000 for Transparent transactions -per @nighthawk24's proposal. - -And calculated per the following forumla: -min_fee = base_fee + marginal_fee * max(0, inputs + outputs - grace_window_size) - -where grace_window_size = 4 + transactions, and base_fee = 10000, marginal_fee = 10000 for Transparent transactions + per @nighthawk24's proposal. Security and Privacy considerations From e5a6d5a8155a8e8a5cc340e91d0c754c652f843a Mon Sep 17 00:00:00 2001 From: nighthawk24 Date: Tue, 30 Aug 2022 00:11:01 -0400 Subject: [PATCH 40/48] Change wording to Non-standard tx. fees. Co-authored-by: str4d --- zip-proportional-output-fee-mechanism-pofm.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 7e12fe163..d0afa0c26 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -189,7 +189,7 @@ Possible alternatives for the parameters: Security and Privacy considerations ============= -Unique transaction fees may reveal specific users or wallets or wallet versions, +Non-standard transaction fees may reveal specific users or wallets or wallet versions, which would reduce privacy for those specific users and the rest of the network. Hence this change should be accepted by a majority of shielded transaction software providers before deploying the change. From 902449d38adfe9fb9fefa5bf8498ea03c32352fe Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 20 Sep 2022 10:49:33 +0100 Subject: [PATCH 41/48] Apply suggestions from code review Co-authored-by: teor --- zip-proportional-output-fee-mechanism-pofm.rst | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index d0afa0c26..cddf09fb1 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -1,7 +1,7 @@ :: ZIP: 317 - Title: Proportional Output Fee Mechanism (POFM) + Title: Proportional Transfer Fee Mechanism Owners: Aditya Bharadwaj Credits: Madars Virza Kris Nuttycombe @@ -187,7 +187,7 @@ Possible alternatives for the parameters: Security and Privacy considerations -============= +=================================== Non-standard transaction fees may reveal specific users or wallets or wallet versions, which would reduce privacy for those specific users and the rest of the network. @@ -248,7 +248,8 @@ transaction pays a fee less than the `min_fee` specified by this ZIP. Deployment -============= +========== + The height for coordinating deployment is block 1,800,000 for Mainnet, or immediately on implementing this ZIP for Testnet. @@ -280,8 +281,8 @@ Acknowledgements ================ Thanks to Madars Virza for initially proposing a fee mechanism similar to that -proposed in this ZIP [#madars-1], and to Kris Nuttycombe, Jack Grigg, and Daira -Hopwood for suggested improvements. +proposed in this ZIP [#madars-1], and to Kris Nuttycombe, Jack Grigg, Daira Hopwood, +and Francisco Gindre for suggested improvements. References From bb04751a5bb3dfa3f3e885f5d1f980040f1347df Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 22 Sep 2022 00:05:31 +0100 Subject: [PATCH 42/48] Updates from ZIP Editor's meeting. Co-authored-by: Jack Grigg Co-authored-by: Kris Nuttycombe Co-authored-by: Teor Signed-off-by: Daira Hopwood --- README.rst | 2 +- zip-0401.rst | 8 +- ...proportional-output-fee-mechanism-pofm.rst | 232 ++++++++---------- 3 files changed, 109 insertions(+), 133 deletions(-) diff --git a/README.rst b/README.rst index 4afb892f3..00bed2ce9 100644 --- a/README.rst +++ b/README.rst @@ -138,7 +138,7 @@ Index of ZIPs 323 Specification of getblocktemplate for Zcash Reserved 339 Wallet Recovery Words Reserved 400 Wallet.dat format Draft - 401 Addressing Mempool Denial-of-Service Final + 401 Addressing Mempool Denial-of-Service Active 402 New Wallet Database Format Reserved 403 Verification Behaviour of zcashd Reserved 416 Support for Unified Addresses in zcashd Reserved diff --git a/zip-0401.rst b/zip-0401.rst index d3ff0a93d..1abad5bfa 100644 --- a/zip-0401.rst +++ b/zip-0401.rst @@ -3,7 +3,7 @@ ZIP: 401 Title: Addressing Mempool Denial-of-Service Owners: Daira Hopwood - Status: Final + Status: Active Category: Network Created: 2019-09-09 License: MIT @@ -83,8 +83,8 @@ which is an integer defined as: Each transaction also has an *eviction weight*, which is *cost* + *low_fee_penalty*, where *low_fee_penalty* is 16000 if the transaction pays a fee less than the -conventional fee, otherwise 0. The conventional fee is currently defined as -1000 zatoshis [#zip-0313]_. +conventional fee, otherwise 0. The conventional fee is currently defined in +[#zip-0317]_. Each node also MUST hold a FIFO queue RecentlyEvicted of pairs (txid, time), where the time indicates when the transaction with the given txid was evicted. The txid @@ -211,5 +211,5 @@ References .. [#zip-0208] `ZIP 208: Shorter Block Target Spacing `_ .. [#zip-0239] `ZIP 239: Relay of Version 5 Transactions `_ .. [#zip-0252] `ZIP 252: Deployment of the NU5 Network Upgrade `_ -.. [#zip-0313] `ZIP 313: Reduce Conventional Transaction Fee to 1000 zatoshis `_ +.. [#zip-0317] `ZIP 317: Proportional Transfer Fee Mechanism `_ .. [#BitcoinCore-PR6722] `Bitcoin Core PR 6722: Limit mempool by throwing away the cheapest txn and setting min relay fee to it `_ diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index cddf09fb1..58659c0c8 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -20,21 +20,16 @@ Terminology =========== -The key words "MUST", "SHOULD", "SHOULD NOT", "MAY", "RECOMMENDED", -"OPTIONAL", and "REQUIRED" in this document are to be interpreted as -described in RFC 2119. [#RFC2119]_ +The key word "SHOULD" in this document is to be interpreted as described in +RFC 2119. [#RFC2119]_ -"Z" refers to shielded address. -"T" refers to transparent address. +The term "conventional transaction fee" in this document is in reference +to the value of a transaction fee that is conventionally used by wallets, +and that a user can reasonably expect miners on the Zcash network to accept +for including a transaction in a block. -"POFM" refers to the proposed change in conventional fee as described in -this ZIP. - -The term "default transaction fee" in this document is in reference -to Z to Z, T to Z & Z to T transaction fee paid to miners on the Zcash network -for the work on including the shielded transaction in a block. - -The terms "Mainnet, "Testnet", and "zatoshi" in this document are defined as in [#protocol-networks]_. +The terms "Mainnet, "Testnet", and "zatoshi" in this document are defined +as in [#protocol-networks]_. Abstract @@ -43,79 +38,39 @@ Abstract The goal of this ZIP is to change the conventional fees for transactions and get buy-in from wallet developers, miners and Zcash users. -With an updated transaction fee formula, miners will be compensated fairly for -including transactions with a high number of inputs or outputs, while still allowing -low fees for regular shielded transaction use cases. - -Once the new fee policy is enforced, this will additionally increase the cost of creating -transactions that collectively have many inputs or outputs, discouraging usage patterns -that cause either intentional or unintentional denial of service. - Motivation ========== -In light of recent network activity, it is time to review and update the -standard 1,000 zatoshi transaction fees set in ZIP 313 [#zip-0313]_. - -The conventional transaction fee presently is 0.00001 ZEC or 1,000 zats per -ZIP 313, that allowed exploration of novel use cases of the Zcash blockchain. -The Zcash network has operated for almost 2 years at a conventional 1,000 zats fee per -shielded transaction, without consideration for the total number of inputs and outputs in the transaction. -This has resulted in high output transactions with 1,100 outputs costing the same as -transactions with 2 outputs. - - -Requirements for gathering consensus ------------------------------------- - -Wallet developers SHOULD update the fees to the proposed formula under Specification section -by Madars Virza and Kris Nuttycombe [#madars-1]_ - -Where #inputs and #outputs also take into account transparent inputs and outputs. -Otherwise, the fee structure (if not otherwise changed) will preferentially encourage -usage of the transparent part of the protocol. +In light of recent network activity, it is time to review and update the +standard 1,000 zatoshi transaction fee set in ZIP 313 [#zip-0313]_. -The change to the conventional transaction fees must be undertaken soon -as the Zcash network has been under heavy load with high-output transactions while -regular shielded transactions with 2 outputs are affected when relying on current -light wallet infrastructure. +The conventional transaction fee presently is 0.00001 ZEC or 1,000 zatoshis, as +specified in ZIP 313. This allowed exploration of novel use cases of the Zcash +blockchain. The Zcash network has operated for almost 2 years at a conventional +transaction fee of 1,000 zatoshis, without consideration for the total number +of inputs and outputs in each transaction. Under this conventional fee, some +usage of the chain has been characterized by high-output transactions with +1,100 outputs paying the same conventional fee as a transaction with 2 outputs. -The following parties need to be part of the consensus: +The objective of the new fee policy, once it is enforced, is for fees paid by +transactions to fairly reflect the processing costs that they impose on various +participants in the network. This will tend to discourage usage patterns that +cause either intentional or unintentional denial of service, while still +allowing low fees for regular transaction use cases. -* The technical aspects of a changing conventional fee based on outputs -need to be evaluated. -* A guarantee from mining groups is required to include the updated POFM -transactions in the next block. -* Wallet developers need to update the software to use the new fee. -* Zcash documentation and community outreach must be undertaken to -make the change known. +Requirements +============ -Requirements for adoption -------------------------- - -The change to the conventional transaction fees should be undertaken soon -as it gets difficult to gain consensus with the growth in the network -of wallets, exchanges, miners, and third parties involved. - -The following parties need to be part of the consensus: - -* Support from mining groups is required to include the updated conventional - fee transactions in the next block. -* Wallet developers need to provide a commitment to update the software to use - the new fee. -* Zcash documentation and community outreach must be undertaken to make the - change known. -* Changes to librustzcash crates to: - * expose minimum recommended fee for a given number of recipients - * implement default fee equation and corresponding unit tests - * integration of such mechanism to Transaction Builder APIs -* Changes to the Zebra mempool's conventional fee calculation -* adopt `librustzcash` changes to mobile SDK repos: - * ZcashLightClientKit - * zcash-light-client-ffi - * zcash-android-wallet-sdk +* The conventional fee formula should not favour or discriminate against any + of the Orchard, Sapling, or transparent protocols. +* The fee for a transaction should scale linearly with the number of inputs + and/or outputs. +* Users should not be penalised for using a small number of dummy inputs + and/or outputs to reduce information leakage. +* Users should be able to redeem a small number of UTXOs or notes with value + below the marginal fee per input. Specification @@ -127,7 +82,6 @@ conventional fee: =================== ============================ Parameter Units =================== ============================ -`base_fee` zatoshis `marginal_fee` zatoshis per input or output `grace_window_size` inputs or outputs =================== ============================ @@ -135,16 +89,18 @@ Parameter Units Wallets implementing this specification SHOULD use a conventional fee calculated in zatoshis per the following formula:: - base_fee + marginal_fee * max(0, inputs + outputs - grace_window_size) + marginal_fee * max(grace_window_size, inputs + outputs) The parameters are set to the following values: -* `base_fee = TODO`; * `marginal_fee = TODO`; * `grace_window_size = 4`. +An Orchard action is counted as one input and one output. +A Sprout JoinSplit is counted as two inputs and two outputs. + It is not a consensus requirement that fees follow this formula; however, -wallets SHOULD use this fee to reduce information leakage in transactions -unless overridden by the user. +wallets SHOULD create transactions that pay this fee, in order to reduce +information leakage, unless overridden by the user. Transaction relaying -------------------- @@ -152,8 +108,8 @@ Transaction relaying zcashd, zebrad, and potentially other node implementations, implement fee-based restrictions on relaying of mempool transactions. Nodes that normally relay transactions are expected to do so for transactions that pay -at least the conventional fee, unless there are other reasons not to do so -for robustness or denial-of-service mitigation. +at least the conventional fee as specified in this ZIP, unless there are +other reasons not to do so for robustness or denial-of-service mitigation. Mempool size limiting --------------------- @@ -178,29 +134,63 @@ Open Issues > TODO: Remove this section once a decision is made. Possible alternatives for the parameters: -* base_fee = 1000, marginal_fee = 250 in @nuttycom's proposal. -* base_fee = 1000, marginal_fee = 1000 in @madars' proposal. -* base_fee = 10000, marginal_fee = 2500 in @daira's proposal. -* base_fee = 1000, marginal_fee = 1000 for Shielded, Shielding and De-shielding - transactions, and base_fee = 10000, marginal_fee = 10000 for Transparent transactions - per @nighthawk24's proposal. + +* marginal_fee = 250 in @nuttycom's proposal. +* marginal_fee = 1000 adapted from @madars' proposal. +* marginal_fee = 2500 in @daira's proposal. +* marginal_fee = 1000 for Shielded, Shielding and De-shielding + transactions, and marginal_fee = 10000 for Transparent transactions + adapted from @nighthawk24's proposal. + +(In @madars' and @nighthawk24's original proposals, there was an additional +`base_fee` parameter that caused the relationship between fee and number +of inputs/outputs to be non-proportional above the `grace_window_size`. This +is no longer expressible with the formula specified above.) + +Logical actions +''''''''''''''' + +The currently proposed formula may disadvantage Orchard transactions, as a +result of an Orchard Action combining an input and an output. This means that +Orchard effectively requires padding of either inputs or outputs to ensure that +the number of inputs and outputs are the same. Usage of Sapling and transparent +protocols does not require this padding, and so this could effectively +discriminate against Orchard. + +An alternative formula, instead of using `inputs + outputs`, uses a concept +of "logical actions", computed as follows:: + + logical_actions = max(transparent_inputs, transparent_outputs) + + 2*sprout_joinsplits + + max(sapling_inputs, sapling_outputs) + + orchard_actions + +The conventional fee formula would then be:: + + marginal_fee * max(grace_actions, logical_actions) + +Possible alternatives for the parameters in this alternative: + +* grace_actions = 2. +* marginal_fee = 500 adapted from @nuttycom's proposal. +* marginal_fee = 2000 adapted from @madars' proposal. +* marginal_fee = 5000 adapted from @daira's proposal. Security and Privacy considerations =================================== -Non-standard transaction fees may reveal specific users or wallets or wallet versions, -which would reduce privacy for those specific users and the rest of the network. -Hence this change should be accepted by a majority of shielded transaction -software providers before deploying the change. +Non-standard transaction fees may reveal specific users or wallets or wallet +versions, which would reduce privacy for those specific users and the rest +of the network. However, the advantage of faster deployment argued against +synchronizing the change in wallet behaviour at a specific block height. Long term, the issue of fees needs to be re-visited in separate future -proposals as the blocks start getting consistently full. New ZIPs with +proposals as the blocks start getting consistently full. New ZIPs with scaling solutions, will need to be evaluated and applied. - Denial of Service Vulnerability -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +------------------------------- A transaction-rate-based denial of service attack occurs when an attacker generates enough transactions over a window of time to prevent legitimate @@ -229,52 +219,38 @@ Wallet developers and operators should monitor the Zcash network for rapid growth in transaction rates. -Transaction relaying --------------------- - -zcashd, and potentially other node implementations, implement fee-based -restrictions on relaying of mempool transactions. Nodes that normally relay -transactions are expected to do so for transactions that pay at least the -conventional fee, unless there are other reasons not to do so for robustness -or denial-of-service mitigation. - - -Mempool size limiting ---------------------- - -zcashd and Zebra limit the size of the mempool as described in [#zip-0401]_. This -specifies a *low\_fee\_penalty* that is added to the "eviction weight" if the -transaction pays a fee less than the `min_fee` specified by this ZIP. - - Deployment ========== -The height for coordinating deployment is block 1,800,000 for Mainnet, or immediately on -implementing this ZIP for Testnet. +Wallets can deploy these changes immediately. Nodes can deploy restrictions +to their policies for relaying, mempool acceptance and eviction, and/or +mining once a sufficient proportion of wallets in the ecosystem are observed +to be paying at least the updated conventional transaction fee. Endorsements ============ -The following entities/groups/indiviudals expressed their support for the updated fee mechanism: +The following entities/groups/indiviudals expressed their support for the +updated fee mechanism: *Developer Groups or Sole OSS contributors* * Zecwallet Suite (Zecwallet Lite for Desktop/iOS/Android & Zecwallet FullNode) * Nighthawk Wallet for Android & iOS -*Other Endorsements* +To express and request your support to be added to this ZIP please comment +below indicating: -* Jane Doe jane.doe@xxx.yyy -* Pseudo Dude ps@zzz.aaa +* (group) name/pseudonym +* affiliation +* contact -To express and request your support to be added to this ZIP please comment below indicating -- (group) name/pseudonym -- affiliation -- contact +or, conversely e-mail the same details to the Owner of the ZIP. -or, conversely e-mail the same details to the Owner of the ZIP +> TODO: Endorsements may depend on specific parameter choices. The ZIP +> Editors should ensure that the endorsements are accurate before merging +> this ZIP. Acknowledgements @@ -282,14 +258,14 @@ Acknowledgements Thanks to Madars Virza for initially proposing a fee mechanism similar to that proposed in this ZIP [#madars-1], and to Kris Nuttycombe, Jack Grigg, Daira Hopwood, -and Francisco Gindre for suggested improvements. +Francisco Gindre, Greg Pfeil, and Teor for suggested improvements. References ========== .. [#RFC2119] `RFC 2119: Key words for use in RFCs to Indicate Requirement Levels `_ -.. [#protocol-networks] `Zcash Protocol Specification, Version 2022.3.5. Section 3.12: Mainnet and Testnet `_ +.. [#protocol-networks] `Zcash Protocol Specification, Version 2022.3.8. Section 3.12: Mainnet and Testnet `_ .. [#madars-1] `Madars concrete soft-fork proposal `_ .. [#zip-0313] `ZIP 313: Reduce Conventional Transaction Fee to 1000 zatoshis `_ .. [#zip-0401] `ZIP 401: Addressing Mempool Denial-of-Service `_ From 0d6c46dec13449cc401daa677c2ee8c48642b936 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 27 Sep 2022 23:14:39 +0100 Subject: [PATCH 43/48] Fix typos --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 58659c0c8..4b47853e8 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -231,7 +231,7 @@ to be paying at least the updated conventional transaction fee. Endorsements ============ -The following entities/groups/indiviudals expressed their support for the +The following entities/groups/individuals expressed their support for the updated fee mechanism: *Developer Groups or Sole OSS contributors* @@ -257,7 +257,7 @@ Acknowledgements ================ Thanks to Madars Virza for initially proposing a fee mechanism similar to that -proposed in this ZIP [#madars-1], and to Kris Nuttycombe, Jack Grigg, Daira Hopwood, +proposed in this ZIP [#madars-1]_, and to Kris Nuttycombe, Jack Grigg, Daira Hopwood, Francisco Gindre, Greg Pfeil, and Teor for suggested improvements. From cc3d133d4fd3f72598444fbc748225268ee3c057 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Mon, 3 Oct 2022 18:55:33 +0100 Subject: [PATCH 44/48] Nodes can deploy the low_fee_penalty threshold change immediately --- zip-proportional-output-fee-mechanism-pofm.rst | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 4b47853e8..7b3586e18 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -222,10 +222,14 @@ growth in transaction rates. Deployment ========== -Wallets can deploy these changes immediately. Nodes can deploy restrictions -to their policies for relaying, mempool acceptance and eviction, and/or -mining once a sufficient proportion of wallets in the ecosystem are observed -to be paying at least the updated conventional transaction fee. +Wallets can deploy these changes immediately. Nodes can deploy the change +to the *low\_fee\_penalty* threshold described in `Mempool size limiting`_ +immediately. + +Nodes can deploy restrictions to their policies for relaying, mempool +acceptance, and/or mining once a sufficient proportion of wallets in the +ecosystem are observed to be paying at least the updated conventional +transaction fee. Endorsements From 775601608ca47551c61b4956b228f5dfcad3bc8b Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Mon, 3 Oct 2022 20:00:09 +0100 Subject: [PATCH 45/48] Use conformance language for deployment --- zip-proportional-output-fee-mechanism-pofm.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 7b3586e18..f43f92823 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -222,8 +222,8 @@ growth in transaction rates. Deployment ========== -Wallets can deploy these changes immediately. Nodes can deploy the change -to the *low\_fee\_penalty* threshold described in `Mempool size limiting`_ +Wallets SHOULD deploy these changes immediately. Nodes SHOULD deploy the +change to the *low\_fee\_penalty* threshold described in `Mempool size limiting`_ immediately. Nodes can deploy restrictions to their policies for relaying, mempool From fd23f02d397f3e08e867511c4178266057f5a7c5 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Mon, 3 Oct 2022 20:03:10 +0100 Subject: [PATCH 46/48] Node developers SHOULD coordinate on deployment schedule --- zip-proportional-output-fee-mechanism-pofm.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index f43f92823..af7125fab 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -229,7 +229,8 @@ immediately. Nodes can deploy restrictions to their policies for relaying, mempool acceptance, and/or mining once a sufficient proportion of wallets in the ecosystem are observed to be paying at least the updated conventional -transaction fee. +transaction fee. Node developers SHOULD coordinate on deployment +schedule. Endorsements From e30626a59a588f25afd2c1891e169a8ce2a247d3 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Mon, 3 Oct 2022 21:23:22 +0100 Subject: [PATCH 47/48] Apply suggestions from review with @nighthawk24 --- ...proportional-output-fee-mechanism-pofm.rst | 58 +++++++------------ 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index af7125fab..304cb2eb1 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -67,9 +67,11 @@ Requirements of the Orchard, Sapling, or transparent protocols. * The fee for a transaction should scale linearly with the number of inputs and/or outputs. -* Users should not be penalised for using a small number of dummy inputs - and/or outputs to reduce information leakage. -* Users should be able to redeem a small number of UTXOs or notes with value +* Users should not be penalised for sending transactions constructed + with padding of inputs and outputs to reduce information leakage. + (The default policy employed by zcashd and the mobile SDKs pads to + two inputs and outputs for each shielded pool used by the transaction). +* Users should be able to spend a small number of UTXOs or notes with value below the marginal fee per input. @@ -89,14 +91,16 @@ Parameter Units Wallets implementing this specification SHOULD use a conventional fee calculated in zatoshis per the following formula:: - marginal_fee * max(grace_window_size, inputs + outputs) + logical_actions = max(transparent_inputs, transparent_outputs) + + 2*sprout_joinsplits + + max(sapling_inputs, sapling_outputs) + + orchard_actions -The parameters are set to the following values: -* `marginal_fee = TODO`; -* `grace_window_size = 4`. + conventional_fee = marginal_fee * max(grace_actions, logical_actions) -An Orchard action is counted as one input and one output. -A Sprout JoinSplit is counted as two inputs and two outputs. +The parameters are set to the following values: +* `marginal_fee = 5000`; +* `grace_window_size = 2`. It is not a consensus requirement that fees follow this formula; however, wallets SHOULD create transactions that pay this fee, in order to reduce @@ -147,34 +151,16 @@ Possible alternatives for the parameters: of inputs/outputs to be non-proportional above the `grace_window_size`. This is no longer expressible with the formula specified above.) -Logical actions -''''''''''''''' - -The currently proposed formula may disadvantage Orchard transactions, as a -result of an Orchard Action combining an input and an output. This means that -Orchard effectively requires padding of either inputs or outputs to ensure that -the number of inputs and outputs are the same. Usage of Sapling and transparent -protocols does not require this padding, and so this could effectively -discriminate against Orchard. - -An alternative formula, instead of using `inputs + outputs`, uses a concept -of "logical actions", computed as follows:: - - logical_actions = max(transparent_inputs, transparent_outputs) + - 2*sprout_joinsplits + - max(sapling_inputs, sapling_outputs) + - orchard_actions - -The conventional fee formula would then be:: - - marginal_fee * max(grace_actions, logical_actions) - -Possible alternatives for the parameters in this alternative: +Rationale for logical actions +''''''''''''''''''''''''''''' -* grace_actions = 2. -* marginal_fee = 500 adapted from @nuttycom's proposal. -* marginal_fee = 2000 adapted from @madars' proposal. -* marginal_fee = 5000 adapted from @daira's proposal. +A previous proposal used `inputs + outputs` instead of logical actions. +This would have disadvantages Orchard transactions, as a result of an +Orchard Action combining an input and an output. The effect of this +combining is that Orchard requires padding of either inputs or outputs +to ensure that the number of inputs and outputs are the same. Usage of +Sapling and transparent protocols does not require this padding, and +so this could have effectively discriminated against Orchard. Security and Privacy considerations From 23fcd67a3f57b368d386ea169619212c13e34775 Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Tue, 4 Oct 2022 21:32:20 +0100 Subject: [PATCH 48/48] Apply suggestions from review with @nuttycom --- zip-proportional-output-fee-mechanism-pofm.rst | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/zip-proportional-output-fee-mechanism-pofm.rst b/zip-proportional-output-fee-mechanism-pofm.rst index 304cb2eb1..a4faa0ed2 100644 --- a/zip-proportional-output-fee-mechanism-pofm.rst +++ b/zip-proportional-output-fee-mechanism-pofm.rst @@ -81,12 +81,12 @@ Specification This specification defines three parameters that are used to calculate the conventional fee: -=================== ============================ +=================== ============================================== Parameter Units -=================== ============================ -`marginal_fee` zatoshis per input or output -`grace_window_size` inputs or outputs -=================== ============================ +=================== ============================================== +`marginal_fee` zatoshis per logical action (as defined below) +`grace_window_size` logical actions +=================== ============================================== Wallets implementing this specification SHOULD use a conventional fee calculated in zatoshis per the following formula:: @@ -154,6 +154,11 @@ is no longer expressible with the formula specified above.) Rationale for logical actions ''''''''''''''''''''''''''''' +The intention is to make the fee paid for a transaction depend on its +impact on the network, without discriminating between different protocols +(Orchard, Sapling, or transparent). The impact on the network depends on +the numbers of inputs and outputs. + A previous proposal used `inputs + outputs` instead of logical actions. This would have disadvantages Orchard transactions, as a result of an Orchard Action combining an input and an output. The effect of this