[zcash/zcash] Evaluate alternative transaction fee market mechanisms (#3473)

I’ve presented the ideas here online and at multiple events including most recently CRYPTO 2018 today, and I got a positive reception from some Zcash community members and it was suggested that I start a discussion on this topic, so here goes.

Currently, most public blockchains, including Ethereum, Bitcoin, and (as I understand) Zcash, use a block size limit and a fee market to regulate the inclusion of transactions and prevent users from spamming the blockchain, forcing transaction senders to pay for the costs they impose on the network. However, this cap-and-auction approach is only one of many ways of achieving thhis goal, and there are other mechanisms that are worth exploring, that I think are better for several reasons.

There are three major problems with the status quo of transaction fee markets:

* **Mismatch between volatility of transaction fee levels and social cost of transactions**: transaction fees on mature public blockchains, that have enough usage so that blocks are full, tend to be extremely volatile. On Ethereum, minimum fees are typically around 2 gwei (10^9 gwei = 1 ETH), but sometimes go up to 20-50 gwei and have even on one occasion gone up to over 200 gwei: https://etherscan.io/chart/gasprice. This clearly creates many inefficiencies, because it’s absurd to suggest that the cost incurred by the network from accepting one more transaction into a block actually is 100x more when gas prices are 200 gwei than when they are 2 gwei; in both cases, it’s a difference between 8 million gas and 8.02 million gas.
* **Inefficiencies of first price auctions**: see https://ethresear.ch/t/first-and-second-price-auctions-and-improved-transaction-fee-markets/2410 for a detailed writeup. In short, the current approach, where transaction senders publish a transaction with a fee, miners choose the highest-paying transactions, and everyone pays what they bid, is well-known in mechanism design literature to be highly inefficient, and so complex fee estimation algorithms are required, and even these algorithms often end up not working very well, leading to frequent fee overpayment. See also https://blog.bitgo.com/the-challenges-of-bitcoin-transaction-fee-estimation-e47a64a61c72 for a Bitcoin core developer’s description of the challenges involved in fee estimation in the status quo.
* **Instability of blockchains with no block reward**: in the long run, blockchains where there is no issuance (including Bitcoin and Zcash) at present intend to switch to rewarding miners entirely through transaction fees. However, there are [known results](http://randomwalker.info/publications/mining_CCS.pdf) showing that this likely leads to a lot of instability, incentivizing mining «sister blocks» that steal transaction fees, opening up much stronger selfish mining attack vectors, and more. There is at present no good mitigation for this.

I will suggest an alternative mechanism that mitigates all three of the issues. The protocol internally maintains a fee level `f`, and a miner that creates a block that includes `d` bytes (or gas, or weight units, or whatever) must pay a fee of `f * d`, which gets put into a pot. There is a maximum weight limit `M`. The protocol adjusts `f` so that long-run block space usage averages out to `M/2`; it can do this for example by adjusting `f[n+1] = f[n] * (1 + 0.2 * w[n] / M)`, where `f[n]` is the fee level in the current block, `f[n+1]` is the fee level for the next block, and `w[n]` is the total bytes/gas/weight consumed in the current block. In every block, a miner gets a reward equal to 1/N (eg. 1/10000) of the money remaining in the pot (note that this amount does NOT depend on the transactions they include in their block).

This accomplishes the following goals:

* It mitigates the economic inefficiencies from social cost mismatch due to fee volatility. There is a fairly nuanced economic argument here; see particularly pages 16-20 of the paper linked in https://ethresear.ch/t/draft-position-paper-on-resource-pricing/2838 (though I recommend reading the whole paper) for a detailed argument of why this is the case. Intuitively, the adjusting fee mechanism works like a fixed fee in the short run and a cap in the long run, and it turns out that because of [arguments from Martin Weitzman’s 1974 paper](https://scholar.harvard.edu/weitzman/files/prices_vs_quantities.pdf) fixed fees are likely better than a cap in the circumstances in which we’re actually presented in public blockchains.
* It replaces the auction with a fixed price sale (except during short periods where blocks fill up completely until fees catch up), making fee estimation extremely simple: calculate the fee `f` for the next block, if you can afford it pay it, otherwise don’t. This eliminates inefficiencies from the first price auction mechanism.
* It creates a mechanism similar to a permanent block reward (the 1/N coming from the pot), mitigating many of the instability issues with fee-only blockchains without requiring actual permanent issuance.

This is something that’s being discussed in the context of Ethereum but is theoretically relevant to any public blockchain, so is certainly something that the Zcash community could consider.

Добавить комментарий