Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ZIP 317] Proportional Transfer Fee Mechanism #631

Merged
merged 50 commits into from
Oct 10, 2022
Merged
Changes from 4 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
400eebe
Create zip-proportional-output-fee-mechanism-pofm
nighthawk24 Aug 15, 2022
b599602
Update fee formula.
nighthawk24 Aug 15, 2022
1b5a6fe
Add transparent inputs & outputs wording.
nighthawk24 Aug 15, 2022
d427459
Update zip-proportional-output-fee-mechanism-pofm.rst
nighthawk24 Aug 15, 2022
f204769
Update wording in requirements for consensus.
nighthawk24 Aug 15, 2022
4c1970f
Merge branch 'master' of https://github.com/nighthawk24/zips
nighthawk24 Aug 15, 2022
05c3311
Add wording.
nighthawk24 Aug 15, 2022
c8adeaa
Fix target block height.
nighthawk24 Aug 16, 2022
2e76480
Add ZIP #317
nighthawk24 Aug 16, 2022
27f8ace
Fix formatting for credits.
nighthawk24 Aug 16, 2022
4cc0a69
Update wording.
nighthawk24 Aug 16, 2022
9188c51
Fix unit and link ZIP-313
nighthawk24 Aug 16, 2022
9a717d0
Change must to should for requirements.
nighthawk24 Aug 16, 2022
b8d595b
Update fee formula to avoid 0 fee calculation.
nighthawk24 Aug 16, 2022
62f6aac
Remove Out of Scope section.
nighthawk24 Aug 16, 2022
63bd0d9
Add PR details to header.
nighthawk24 Aug 16, 2022
cff9e8e
Update timeline for new conventional fees to immediate.
nighthawk24 Aug 16, 2022
a1906ae
Define network terms.
nighthawk24 Aug 16, 2022
595443b
Add references.
nighthawk24 Aug 16, 2022
91b8e83
Change support section to endorsements.
nighthawk24 Aug 16, 2022
9e642a5
Manually add changes to Abstract.
nighthawk24 Aug 16, 2022
b19307a
Add change requirements to zcash toolchain.
nighthawk24 Aug 16, 2022
050234b
Fix formatting.
nighthawk24 Aug 16, 2022
937013a
Update wording on transactions covered under the ZIP.
nighthawk24 Aug 18, 2022
2881b47
Fix formatting for rST.
nighthawk24 Aug 18, 2022
19496d3
Remove hyphen.
nighthawk24 Aug 18, 2022
34a82f2
Formatting fixes for rST.
nighthawk24 Aug 18, 2022
f714287
Update working to min_fee
nighthawk24 Aug 18, 2022
69af6ea
Update wording.
nighthawk24 Aug 18, 2022
e232e50
Update wording.
nighthawk24 Aug 18, 2022
94d6b8a
Add base_fee and marginal_fee fields.
nighthawk24 Aug 18, 2022
0628577
Include base_fee & marginal_fee constants.
nighthawk24 Aug 18, 2022
b7eed25
Add credits.
nighthawk24 Aug 18, 2022
93d3ce8
Add credits.
nighthawk24 Aug 18, 2022
7516306
Update wording under motivation.
nighthawk24 Aug 19, 2022
5ea7810
Update formula to include marginal fee and grace window size.
nighthawk24 Aug 23, 2022
05c8b6f
Add changes related to Zebra
nighthawk24 Aug 30, 2022
e74e23f
Add Zebra
nighthawk24 Aug 30, 2022
7bbaf4a
Add Standards wording.
nighthawk24 Aug 30, 2022
ffa113d
Clarify specification.
nighthawk24 Aug 30, 2022
e5a6d5a
Change wording to Non-standard tx. fees.
nighthawk24 Aug 30, 2022
902449d
Apply suggestions from code review
daira Sep 20, 2022
bb04751
Updates from ZIP Editor's meeting.
daira Sep 21, 2022
0d6c46d
Fix typos
daira Sep 27, 2022
cc3d133
Nodes can deploy the low_fee_penalty threshold change immediately
daira Oct 3, 2022
7756016
Use conformance language for deployment
daira Oct 3, 2022
fd23f02
Node developers SHOULD coordinate on deployment schedule
daira Oct 3, 2022
e30626a
Apply suggestions from review with @nighthawk24
daira Oct 3, 2022
4033b7f
Merge pull request #2 from daira/proportional-fee
nighthawk24 Oct 3, 2022
23fcd67
Apply suggestions from review with @nuttycom
daira Oct 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
195 changes: 195 additions & 0 deletions zip-proportional-output-fee-mechanism-pofm.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,195 @@
::

ZIP: XXX
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
Title: Proportional Output Fee Mechanism (POFM)
daira marked this conversation as resolved.
Show resolved Hide resolved
Owners: Aditya Bharadwaj <nighthawk24@gmail.com>
Credits: Madars Virza, Kris Nuttycombe
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
Status: Draft
Community Status: Request for comments : https://forum.zcashcommunity.com/t/zip-proportional-output-fee-mechanism-pofm/42808
Category: Wallet
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
Created: 2022-08-15
License: MIT
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved


Terminology
daira marked this conversation as resolved.
Show resolved Hide resolved
===========

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]_
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

"Z" refers to shielded address.
"T" refers to transparent address.

daira marked this conversation as resolved.
Show resolved Hide resolved
"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.
daira marked this conversation as resolved.
Show resolved Hide resolved

nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

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.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

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.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

Out of Scope for this Proposal
============

Discussion around transaction fees for T to T.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved


nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
Motivation
============
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

In light of recent network activity, it is time to review and update the
standard 1,000 zats transaction fees set in ZIP-313.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved


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.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
The Zcash network has operated for almost 2 years of 1,000 zats fee per shielded
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
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
-------------------------
nuttycom marked this conversation as resolved.
Show resolved Hide resolved
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

Wallet developers must update the fees to the proposed formula by Madars and
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
Kris Nuttycombe [#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.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

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.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved


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:

daira marked this conversation as resolved.
Show resolved Hide resolved
* 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.

nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

Security and privacy considerations
-----------------------------------

Unique transaction fees may reveal specific users or wallets or wallet versions,
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
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.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
daira marked this conversation as resolved.
Show resolved Hide resolved


Denial of Service Vulnerability
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

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.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider deleting some of this section, since the premise of this ZIP is that there is at least some chance that it will work to discourage transaction DoS.


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 = base_fee * max(0, #inputs + #outputs - 4)
starting from block 180,000.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved


Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe the effect on users of wallets that are not upgraded.

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
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved
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.
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved


Support
=======

The developers of the following wallets intend to implement the updated fee mechanism:
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

* 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
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved

Acknowledgements
================

Thanks to Madars Virza for suggesting the fee mechanism. And Kris Nuttycombe to
suggest optimization.

.. [#madars-1] `Madars concrete soft-fork proposal <https://forum.zcashcommunity.com/t/zip-reduce-default-shielded-transaction-fee-to-1000-zats/37566/89?u=aiyadt>`_
nighthawk24 marked this conversation as resolved.
Show resolved Hide resolved