mirror of https://github.com/zcash/zips.git
203 lines
15 KiB
HTML
203 lines
15 KiB
HTML
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<title>ZIP 2002: Explicit Fees</title>
|
||
<meta charset="utf-8" />
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" crossorigin="anonymous">
|
||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" crossorigin="anonymous"></script>
|
||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
|
||
<meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"></head>
|
||
<body>
|
||
<section>
|
||
<pre>ZIP: 2002
|
||
Title: Explicit Fees
|
||
Owners: Daira-Emma Hopwood <daira-emma@electriccoin.co>
|
||
Kris Nuttycombe <kris@electriccoin.co>
|
||
Jack Grigg <jack@electriccoin.co>
|
||
Credits: Simon Liu
|
||
Status: Draft
|
||
Category: Consensus
|
||
License: MIT
|
||
Discussions-To: <<a href="https://github.com/zcash/zips/issues/803">https://github.com/zcash/zips/issues/803</a>>
|
||
Pull-Request: <<a href="https://github.com/zcash/zips/pull/919">https://github.com/zcash/zips/pull/919</a>></pre>
|
||
<section id="terminology"><h2><span class="section-heading">Terminology</span><span class="section-anchor"> <a rel="bookmark" href="#terminology"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
|
||
<p>The key word "MUST" in this document is to be interpreted as described in BCP 14 <a id="footnote-reference-1" class="footnote_reference" href="#bcp14">1</a> when, and only when, it appears in all capitals.</p>
|
||
<p>The term "network upgrade" in this document is to be interpreted as described in ZIP 200. <a id="footnote-reference-2" class="footnote_reference" href="#zip-0200">7</a></p>
|
||
<p>The character § is used when referring to sections of the Zcash Protocol Specification. <a id="footnote-reference-3" class="footnote_reference" href="#protocol">2</a></p>
|
||
<p>The terms "Mainnet" and "Testnet" are to be interpreted as described in § 3.12 ‘Mainnet and Testnet’. <a id="footnote-reference-4" class="footnote_reference" href="#protocol-networks">4</a></p>
|
||
</section>
|
||
<section id="abstract"><h2><span class="section-heading">Abstract</span><span class="section-anchor"> <a rel="bookmark" href="#abstract"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
|
||
<p>This proposal adds an explicit <code>fee</code> field to the v6 transaction format. Instead of fees being implicit in the difference between the input value and output value of the transaction, all value transfers, including fee transfers to miners, will be explicit and committed to via the txid.</p>
|
||
</section>
|
||
<section id="motivation"><h2><span class="section-heading">Motivation</span><span class="section-anchor"> <a rel="bookmark" href="#motivation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
|
||
<p>When it comes to fee selection, it should be very hard to make mistakes. The current transparent fee computation (inherited from Bitcoin) — input value less output value — is prone to user error. It is very easy to forget to add an output for a change address, make a calculation error <a id="footnote-reference-5" class="footnote_reference" href="#bitcointalk-fee-error">6</a>, mix up units etc.</p>
|
||
<p>In addition, when signing a transaction with a hardware wallet, using an implicit fee means that the hardware wallet must recompute the fee on its own and cannot simply display the value being committed to.</p>
|
||
<p>Finally, this change will make it possible for light clients to determine the fee paid by a transaction without needing to download and inspect transparent inputs to the transaction.</p>
|
||
</section>
|
||
<section id="requirements"><h2><span class="section-heading">Requirements</span><span class="section-anchor"> <a rel="bookmark" href="#requirements"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
|
||
<p>Parties that see a transaction, even in isolation, reliably know its fee. That is, the fee must be explicit in the encoding of the transaction, and no potentially error-prone calculations or additional chain data are needed to compute it.</p>
|
||
</section>
|
||
<section id="specification"><h2><span class="section-heading">Specification</span><span class="section-anchor"> <a rel="bookmark" href="#specification"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
|
||
<section id="changes-to-zip-230">
|
||
<h3>Changes to ZIP 230 <a id="footnote-reference-6" class="footnote_reference" href="#zip-0230">8</a></h3>
|
||
<p>The following field is appended to the Common Transaction Fields of the v6 transaction format after <code>nExpiryHeight</code> <a id="footnote-reference-7" class="footnote_reference" href="#zip-0230-transaction-format">9</a>:</p>
|
||
<table>
|
||
<thead>
|
||
<tr>
|
||
<th>Bytes</th>
|
||
<th>Name</th>
|
||
<th>Data Type</th>
|
||
<th>Description</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
<tr>
|
||
<td>8</td>
|
||
<td><code>fee</code></td>
|
||
<td><code>uint64</code></td>
|
||
<td>The fee to be paid by this transaction, in zatoshis.</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<p>Note: If both this ZIP and ZIP 233 are selected for inclusion in the same Network Upgrade, then the ambiguity in ordering of the fields added by these ZIPs would need to be resolved.</p>
|
||
</section>
|
||
<section id="changes-to-the-zcash-protocol-specification"><h3><span class="section-heading">Changes to the Zcash Protocol Specification</span><span class="section-anchor"> <a rel="bookmark" href="#changes-to-the-zcash-protocol-specification"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
|
||
<p>In § 3.4 ‘Transactions and Treestates’ <a id="footnote-reference-8" class="footnote_reference" href="#protocol-transactions">3</a> (last modified by ZIP 236 <a id="footnote-reference-9" class="footnote_reference" href="#zip-0236">10</a>), add the following consensus rule and note:</p>
|
||
<blockquote>
|
||
<ul>
|
||
<li>[NU7 onward] For v6 and later transactions, the remaining value in the transparent transaction value pool, in zatoshis, MUST be equal to the value of the transaction’s <code>fee</code> field.</li>
|
||
</ul>
|
||
<p>Non-normative note: The effect of these rules is that the <code>fee</code> field of v6 and later coinbase transactions will always be zero.</p>
|
||
</blockquote>
|
||
<p>In § 7.1 ‘Transaction Encoding and Consensus’ <a id="footnote-reference-10" class="footnote_reference" href="#protocol-txnconsensus">5</a>, add:</p>
|
||
<blockquote>
|
||
<p>[NU7 onward] <code>fee</code> MUST be in the range
|
||
<span class="math">\(\{ 0 .. \mathsf{MAX\_MONEY} \}\!\)</span>
|
||
.</p>
|
||
</blockquote>
|
||
</section>
|
||
<section id="modifications-relative-to-zip-244">
|
||
<h3>Modifications relative to ZIP 244 <a id="footnote-reference-11" class="footnote_reference" href="#zip-0244">11</a></h3>
|
||
<p>Relative to the sighash algorithm defined in ZIP 244, the sighash algorithm that applies to v6 transactions differs by appending the <code>fee</code> field to the Common Transaction Fields that are the input to the digest in T.1: header_digest <a id="footnote-reference-12" class="footnote_reference" href="#zip-0244-header-digest">12</a>:</p>
|
||
<pre>T.1f: fee (8-byte little-endian fee amount)</pre>
|
||
<p>Note: If both this ZIP and ZIP 233 are selected for inclusion in the same Network Upgrade, then the ambiguity in ordering of the fields added by these ZIPs would need to be resolved.</p>
|
||
</section>
|
||
<section id="applicability"><h3><span class="section-heading">Applicability</span><span class="section-anchor"> <a rel="bookmark" href="#applicability"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h3>
|
||
<p>All of these changes apply identically to Mainnet and Testnet.</p>
|
||
</section>
|
||
</section>
|
||
<section id="deployment"><h2><span class="section-heading">Deployment</span><span class="section-anchor"> <a rel="bookmark" href="#deployment"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
|
||
<p>This ZIP is proposed to be deployed with the next transaction version change, which is assumed to be v6. <a id="footnote-reference-13" class="footnote_reference" href="#zip-0230">8</a></p>
|
||
</section>
|
||
<section id="reference-implementation"><h2><span class="section-heading">Reference implementation</span><span class="section-anchor"> <a rel="bookmark" href="#reference-implementation"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
|
||
<p>TBD</p>
|
||
</section>
|
||
<section id="references"><h2><span class="section-heading">References</span><span class="section-anchor"> <a rel="bookmark" href="#references"><img width="24" height="24" class="section-anchor" src="assets/images/section-anchor.png" alt=""></a></span></h2>
|
||
<table id="bcp14" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>1</th>
|
||
<td><a href="https://www.rfc-editor.org/info/bcp14">Information on BCP 14 — "RFC 2119: Key words for use in RFCs to Indicate Requirement Levels" and "RFC 8174: Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words"</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="protocol" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>2</th>
|
||
<td><a href="protocol/protocol.pdf">Zcash Protocol Specification, Version 2024.5.1 [NU6] or later</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="protocol-transactions" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>3</th>
|
||
<td><a href="protocol/protocol.pdf#transactions">Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 3.4: Transactions and Treestates</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="protocol-networks" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>4</th>
|
||
<td><a href="protocol/protocol.pdf#networks">Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 3.12: Mainnet and Testnet</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="protocol-txnconsensus" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>5</th>
|
||
<td><a href="protocol/protocol.pdf#txnconsensus">Zcash Protocol Specification, Version 2024.5.1 [NU6]. Section 7.1.2: Transaction Consensus Rules</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="bitcointalk-fee-error" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>6</th>
|
||
<td><a href="https://bitcointalk.org/index.php?topic=1818791.0">Bitcoin Forum post by @Voiceeeeee, March 8, 2017. "PLEASE HELP.. I sent a transaction with a 2.5 BTC transaction fee"</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="zip-0200" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>7</th>
|
||
<td><a href="zip-0200">ZIP 200: Network Upgrade Mechanism</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="zip-0230" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>8</th>
|
||
<td><a href="zip-0230">ZIP 230: Version 6 Transaction Format</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="zip-0230-transaction-format" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>9</th>
|
||
<td><a href="zip-0230#transaction-format">ZIP 230: Version 6 Transaction Format. Specification: Transaction Format</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="zip-0236" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>10</th>
|
||
<td><a href="zip-0236">ZIP 236: Blocks should balance exactly</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="zip-0244" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>11</th>
|
||
<td><a href="zip-0244">ZIP 244: Transaction Identifier Non-Malleability</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="zip-0244-header-digest" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>12</th>
|
||
<td><a href="zip-0244#t-1-header-digest">ZIP 244: Transaction Identifier Non-Malleability. Section T.1: Header Digest</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
<table id="draft-txv6-sighash" class="footnote">
|
||
<tbody>
|
||
<tr>
|
||
<th>13</th>
|
||
<td><a href="draft-txv6-sighash">ZIP draft: Version 6 Transaction Signature Validation</a></td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</section>
|
||
</section>
|
||
</body>
|
||
</html> |