-
Notifications
You must be signed in to change notification settings - Fork 182
[ZIP 234] Smooth Out The Block Subsidy Issuance #706
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
53 commits
Select commit
Hold shift + click to select a range
3e4ca01
Smooth Out The Block Subsidy Issuance
753d180
Update draft-issuance.md
aphelionz b0c142f
Update draft-issuance.md
aphelionz 54317ed
Update draft-issuance.md
aphelionz 2d691eb
Update draft-issuance.md
aphelionz 66dab1e
Update draft-issuance.md
aphelionz 907fe1c
update: add ZSF_BALANCE and ZsfBalanceAfter(h)
aphelionz 8b725d8
Update draft-issuance.md
aphelionz 087f7b9
Update draft-issuance.md
aphelionz e3a28eb
Update draft-issuance.md
aphelionz 609a3c6
Update draft-issuance.md
aphelionz 5e6c367
update: references and definitions
aphelionz 013dcc1
Update draft-issuance.md
aphelionz bf090f4
Update draft-issuance.md
aphelionz dca1174
Update draft-issuance.md
aphelionz de30fea
Update draft-issuance.md
aphelionz 45ff587
Update draft-issuance.md
aphelionz 8cc6f92
Update draft-issuance.md
aphelionz 9f4e7fd
Update draft-issuance.md
aphelionz c2a591a
fix: credits
aphelionz 8ea2ecc
fix: define constants
aphelionz 4983a32
fix: S(h) to BlockSubsidy(h)
aphelionz c5f83c1
fix: refactor motivation section
aphelionz 1e977ba
update: add more context to motivation
aphelionz 74649db
update: rename requirements from G* to R*
aphelionz 2448c6c
update: add graph
aphelionz e1aa108
update: render html
aphelionz f603576
Update draft-issuance.md
aphelionz 5d5bc35
Update draft-issuance.md
aphelionz 31d05c5
Update draft-issuance.md
aphelionz 4b6d62c
Update draft-issuance.md
aphelionz 44d5b95
Update draft-issuance.md
aphelionz 3f77205
Update draft-issuance.md
aphelionz 732e65a
update: fix issuance clarity points
aphelionz d5ea3da
update: deployment block height
aphelionz 44fc779
Update draft-issuance.md
aphelionz 212244f
Update draft-issuance.md
aphelionz fedfd9e
Update draft-issuance.md
aphelionz 54e349d
update: provide predictability... bullet point
aphelionz 7c64666
update: 4126/100_000_000
aphelionz 900b868
Update simulation code
tomekpiotrowski 3f6eb54
Update the subsidy fraction. Remove Other Notes.
tomekpiotrowski 776295c
Update plots and simulator outputs
tomekpiotrowski c315670
typos
tomekpiotrowski 86049bb
Expand the BLOCK_SUBSIDY_FRACTION rationale
tomekpiotrowski b580625
Add information about deployment after ZSF is deployed
tomekpiotrowski 0c42f7b
Explicitly mention dependency on ZSF
tomekpiotrowski f5224f8
Add information about ZSF subsidies per block
tomekpiotrowski be2140a
Update draft-issuance.md
tomekpiotrowski 7133f29
remove network upgrade requirement
tomekpiotrowski f4d84e9
Move deployoment to top level and move it closer to the end
tomekpiotrowski 20a12da
remove the summary section from motivation
tomekpiotrowski 96169eb
Update draft-issuance.md
tomekpiotrowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,159 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <title>Draft issuance: Smooth Out The Block Subsidy Issuance</title> | ||
| <meta charset="utf-8" /> | ||
| <script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js?config=TeX-AMS-MML_HTMLorMML"></script> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="css/style.css"> | ||
| </head> | ||
| <body> | ||
| <pre><code>ZIP: | ||
| Title: Smooth Out The Block Subsidy Issuance | ||
| Owners: Jason McGee <jason@shieldedlabs.com> | ||
| Mark Henderson <mark@equilibrium.co> | ||
| Tomek Piotrowski <tomek@eiger.co> | ||
| Mariusz Pilarek <mariusz@eiger.co> | ||
| Original-Authors: Nathan Wilcox | ||
| Credits: Nathan Wilcox | ||
| Mark Henderson | ||
| Jason McGee | ||
| Status: Draft | ||
| Category: Consensus | ||
| Created: 2023-08-23 | ||
| License: BSD-2-Clause</code></pre> | ||
| <h1 id="terminology">Terminology</h1> | ||
| <p>The key words “MUST”, “SHOULD”, “SHOULD NOT”, “MAY”, “RECOMMENDED”, | ||
| “OPTIONAL”, and “REQUIRED” in this document are to be interpreted as | ||
| described in RFC 2119. [1]</p> | ||
| <p>“Network upgrade” - to be interpreted as described in ZIP 200. | ||
| [2]</p> | ||
| <p>“Block Subsidy” - the algorithmic issuance of ZEC on block creation – | ||
| part of the consensus rules. Split between the miner and the Dev Fund. | ||
| Also known as Block Reward.</p> | ||
| <p>“Issuance” - The method by which unmined or unissued ZEC is converted | ||
| to ZEC available to users of the network</p> | ||
| <p>“We” - the ZIP authors, owners listed in the above front matter</p> | ||
| <p>“<code>AVAILABLE_SUBSIDIES(h)</code>” is the total ZEC available to | ||
| pay out Block Subsidies from at block height <code>h</code>, ie. “not | ||
| yet mined ZEC at h”.</p> | ||
| <p>“<code>BLOCK_SUBSIDY_FRACTION</code>” = 41 / 100,000,000 or | ||
| <code>0.00000041</code></p> | ||
| <h1 id="abstract">Abstract</h1> | ||
| <p>This ZIP proposes a change to how nodes calculate the block | ||
| subsidy.</p> | ||
| <p>Instead of following a step function around the four-year halving | ||
| cycle inherited from Bitcoin, we propose a slow exponential “smoothing” | ||
| of the curve. The new issuance scheme would approximate the current 4 | ||
| year cycle, and results in the last zatoshi being spent in around 113 | ||
| years.</p> | ||
| <h1 id="motivation">Motivation</h1> | ||
| <p>Zcash’s economic model is inherited from Bitcoin and includes the | ||
| concept of a halving mechanism to regulate the issuance of new coins. | ||
| This approach, though foundational, invites a reevaluation amid Zcash’s | ||
| ongoing evolution. As the network matures, the need to address potential | ||
| future challenges and ensure a sustained and stable economic ecosystem | ||
| becomes apparent. The transition to a smoothed emissions curve offers an | ||
| opportunity to adjust the network’s issuance dynamics while maintaining | ||
| the supply cap of 21,000,000 coins. By doing so, Zcash endeavors to | ||
| optimize its economic framework, accommodating changing circumstances | ||
| while maintaining predictability and stability in rewards | ||
| distribution.</p> | ||
| <p>This proposal outlines a solution to address challenges associated | ||
| with the existing block subsidy issuance mechanism in the Zcash network. | ||
| The primary goal of this proposal is to introduce a more predictable and | ||
| stable issuance of ZEC by smoothing out the issuance curve while | ||
| preserving the supply cap. It’s important to note that this proposal | ||
| does not seek to alter the fundamental aspects of Zcash’s issuance | ||
| policy. The average block subsidy size over time will remain the same | ||
| and the funds for block subsidies will last a similar amount of time. | ||
| Instead, it focuses solely on enhancing the predictability and | ||
| consistency of the block subsidy issuance process.</p> | ||
| <p>Smoothing the emissions curve helps ensure that the network remains | ||
| economically viable and stable as it transitions from a traditional | ||
| issuance mechanism to one that maintains a sustainable and predictable | ||
| issuance of rewards over time. It prevents abrupt changes in the rate of | ||
| newly issued coins, which could lead to disruptions in the network’s | ||
| economic model and potentially impact its security and sustainability. A | ||
| smoother emissions curve allows for a more gradual and controlled | ||
| transition, providing ZEC stakeholders and participants with a clear | ||
| understanding of how rewards will be distributed over time.</p> | ||
| <h1 id="specification">Specification</h1> | ||
| <p>Smoothing the issuance curve is possible using an exponential decay | ||
| formula that satisfies the following requirements:</p> | ||
| <h2 id="requirements">Requirements</h2> | ||
| <ol type="1"> | ||
| <li>Block subsidies MUST be weakly decreasing</li> | ||
| <li>Block subsidies SHOULD approximate a continuous function</li> | ||
| <li>When <code>AVAILABLE_SUBSIDIES(h) > 0</code> then block subsidies | ||
| for block <code>h</code> MUST always be <code>> 0</code>, preventing | ||
| a final “unmined” zatoshi</li> | ||
| <li>For any 4 year period, all paid out block subsidies MUST equal | ||
| approximately half of <code>AVAILABLE_SUBSIDIES</code> at the beginning | ||
| of that 4 year period</li> | ||
| <li>This functionality MUST be introduced as part of a network | ||
| upgrade</li> | ||
| </ol> | ||
| <p>The above requirements assume no deflationary action, i.e. that no | ||
| ZEC is added to <code>AVAILABLE_SUBSIDIES</code>. They are referenced | ||
| below as <strong>Rn</strong>.</p> | ||
| <h2 id="solution">Solution</h2> | ||
| <p>Given the block height <code>h</code> define a function | ||
| <strong>S</strong>, such that:</p> | ||
| <p><strong>S(h)</strong> = Block subsidy for a given <code>h</code>, | ||
| that satisfies above requirements.</p> | ||
| <p>Please note that</p> | ||
| <p><code>AVAILABLE_SUBSIDIES(h+1) = AVAILABLE_SUBSIDIES(h) - S(h)</code> | ||
| assuming no deflationary action.</p> | ||
| <p>An exponential decay function <strong>S</strong> satisfies | ||
| <strong>R1</strong> and <strong>R2</strong> above:</p> | ||
| <p><code>S(h) = BLOCK_SUBSIDY_FRACTION * AVAILABLE_SUBSIDIES(h)</code></p> | ||
| <p>Finally, to satisfy <strong>R3</strong> above we need to always round | ||
| up to at least 1 Zatoshi if | ||
| <code>AVAILABLE_SUBSIDIES(h) > 0</code>:</p> | ||
| <p><code>S(h) = ROUND_UP(BLOCK_SUBSIDY_FRACTION * AVAILABLE_SUBSIDIES(h))</code></p> | ||
| <h1 id="rationale">Rationale</h1> | ||
| <h2 id="block_subsidy_fraction"><code>BLOCK_SUBSIDY_FRACTION</code></h2> | ||
| <p>That value of <code>41 / 100_000_000</code> was selected so that it | ||
| satisfies the equation:</p> | ||
| <p><code>(1 - BLOCK_SUBSIDY_FRACTION)^NUMBER_OF_BLOCKS_IN_4_YEARS ~ ½</code></p> | ||
| <p>Meaning after a period of 4 years around half of | ||
| <code>AVAILABLE_SUBSIDIES</code> will be paid out as block subsidies, | ||
| thus satisfying <strong>R4</strong>.</p> | ||
| <h2 id="other-notes">Other Notes</h2> | ||
| <p>The suggested implementation avoids using float numbers. Rust and C++ | ||
| will both round the result of the final division up, satisfying | ||
| <strong>R3</strong> above.</p> | ||
| <h1 id="appendix-simulation">Appendix: Simulation</h1> | ||
| <p>We encourage readers to run the following Rust code, which simulates | ||
| block subsidies. According to this simulation, assuming no deflationary | ||
| action, block subsidies would last for approximately 113 years:</p> | ||
| <h2 id="rust-code">Rust Code</h2> | ||
| <div class="sourceCode" id="cb2"><pre | ||
| class="sourceCode rust"><code class="sourceCode rust"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="kw">fn</span> main() <span class="op">{</span></span> | ||
| <span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="co">// approximate available subsidies in August of 2023</span></span> | ||
| <span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="kw">let</span> <span class="kw">mut</span> available_subsidies<span class="op">:</span> <span class="dt">i64</span> <span class="op">=</span> <span class="dv">4671731</span> <span class="op">*</span> <span class="dv">100_000_000</span><span class="op">;</span></span> | ||
| <span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="kw">let</span> <span class="kw">mut</span> block<span class="op">:</span> <span class="dt">u32</span> <span class="op">=</span> <span class="dv">0</span><span class="op">;</span></span> | ||
| <span id="cb2-5"><a href="#cb2-5" aria-hidden="true" tabindex="-1"></a></span> | ||
| <span id="cb2-6"><a href="#cb2-6" aria-hidden="true" tabindex="-1"></a> <span class="cf">while</span> available_subsidies <span class="op">></span> <span class="dv">0</span> <span class="op">{</span> </span> | ||
| <span id="cb2-7"><a href="#cb2-7" aria-hidden="true" tabindex="-1"></a> <span class="kw">let</span> block_subsidy <span class="op">=</span> (available_subsidies <span class="op">*</span> <span class="dv">41</span> <span class="op">+</span> <span class="dv">99_999_999</span>) <span class="op">/</span> <span class="dv">100_000_000</span><span class="op">;</span></span> | ||
| <span id="cb2-8"><a href="#cb2-8" aria-hidden="true" tabindex="-1"></a> available_subsidies <span class="op">-=</span> block_subsidy<span class="op">;</span></span> | ||
| <span id="cb2-9"><a href="#cb2-9" aria-hidden="true" tabindex="-1"></a></span> | ||
| <span id="cb2-10"><a href="#cb2-10" aria-hidden="true" tabindex="-1"></a> <span class="pp">println!</span>(</span> | ||
| <span id="cb2-11"><a href="#cb2-11" aria-hidden="true" tabindex="-1"></a> <span class="st">"{} ({} years): {}({} ZEC) {}({} ZEC)"</span><span class="op">,</span></span> | ||
| <span id="cb2-12"><a href="#cb2-12" aria-hidden="true" tabindex="-1"></a> block<span class="op">,</span> <span class="co">// current block</span></span> | ||
| <span id="cb2-13"><a href="#cb2-13" aria-hidden="true" tabindex="-1"></a> block <span class="op">/</span> <span class="dv">420_768</span><span class="op">,</span> <span class="co">// ~ current year</span></span> | ||
| <span id="cb2-14"><a href="#cb2-14" aria-hidden="true" tabindex="-1"></a> block_subsidy<span class="op">,</span> <span class="co">// block subsidy in zatoshis</span></span> | ||
| <span id="cb2-15"><a href="#cb2-15" aria-hidden="true" tabindex="-1"></a> block_subsidy <span class="op">/</span> <span class="dv">100_000_000</span><span class="op">,</span> <span class="co">// block subsidy in ZEC</span></span> | ||
| <span id="cb2-16"><a href="#cb2-16" aria-hidden="true" tabindex="-1"></a> available_subsidies<span class="op">,</span> <span class="co">// available subsidies in zatoshis</span></span> | ||
| <span id="cb2-17"><a href="#cb2-17" aria-hidden="true" tabindex="-1"></a> available_subsidies <span class="op">/</span> <span class="dv">100_000_000</span> <span class="co">// available subsidies in ZEC</span></span> | ||
| <span id="cb2-18"><a href="#cb2-18" aria-hidden="true" tabindex="-1"></a> )<span class="op">;</span></span> | ||
| <span id="cb2-19"><a href="#cb2-19" aria-hidden="true" tabindex="-1"></a></span> | ||
| <span id="cb2-20"><a href="#cb2-20" aria-hidden="true" tabindex="-1"></a> block <span class="op">+=</span> <span class="dv">1</span><span class="op">;</span></span> | ||
| <span id="cb2-21"><a href="#cb2-21" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span> </span> | ||
| <span id="cb2-22"><a href="#cb2-22" aria-hidden="true" tabindex="-1"></a><span class="op">}</span></span></code></pre></div> | ||
| <p>Last line of output of the above program is:</p> | ||
| <p><code>47699804 (113 years): 1(0 ZEC) 0(0 ZEC)</code></p> | ||
| <p>Note the addition of 99,999,999 before division to force rounding up | ||
| of non-zero values.</p> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,169 @@ | ||
| ``` | ||
| ZIP: | ||
| Title: Smooth Out The Block Subsidy Issuance | ||
| Owners: Jason McGee <jason@shieldedlabs.com> | ||
| Mark Henderson <mark@equilibrium.co> | ||
| Tomek Piotrowski <tomek@eiger.co> | ||
| Mariusz Pilarek <mariusz@eiger.co> | ||
| Original-Authors: Nathan Wilcox | ||
| Credits: Nathan Wilcox | ||
| Mark Henderson | ||
| Jason McGee | ||
| Status: Draft | ||
| Category: Consensus | ||
| Created: 2023-08-23 | ||
| License: BSD-2-Clause | ||
| ``` | ||
|
|
||
| # 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. [1] | ||
|
|
||
| "Network upgrade" - to be interpreted as described in ZIP 200. [2] | ||
|
|
||
| “Block Subsidy” - the algorithmic issuance of ZEC on block creation – part of | ||
| the consensus rules. Split between the miner and the Dev Fund. Also known as Block Reward. | ||
|
|
||
| “Issuance” - The method by which unmined or unissued ZEC is converted to ZEC available | ||
| to users of the network | ||
|
teor2345 marked this conversation as resolved.
Outdated
|
||
|
|
||
| “We” - the ZIP authors, owners listed in the above front matter | ||
|
|
||
|
aphelionz marked this conversation as resolved.
Outdated
aphelionz marked this conversation as resolved.
|
||
| “`AVAILABLE_SUBSIDIES(h)`” is the total ZEC available to pay out Block Subsidies from at | ||
| block height `h`, ie. “not yet mined ZEC at h”. | ||
|
|
||
| “`BLOCK_SUBSIDY_FRACTION`” = 41 / 100,000,000 or `0.00000041` | ||
|
teor2345 marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Abstract | ||
|
|
||
| This ZIP proposes a change to how nodes calculate the block subsidy. | ||
|
|
||
| Instead of following a step function around the four-year halving cycle inherited | ||
| from Bitcoin, we propose a slow exponential “smoothing” of the curve. The new issuance | ||
| scheme would approximate the current 4 year cycle, and results in the last | ||
| zatoshi being spent in around 113 years. | ||
|
aphelionz marked this conversation as resolved.
Outdated
teor2345 marked this conversation as resolved.
Outdated
|
||
|
|
||
|
teor2345 marked this conversation as resolved.
|
||
| # Motivation | ||
|
|
||
| Zcash’s economic model is inherited from Bitcoin and includes the concept of a halving | ||
| mechanism to regulate the issuance of new coins. This approach, though foundational, invites | ||
| a reevaluation amid Zcash’s ongoing evolution. As the network matures, the need to address | ||
| potential future challenges and ensure a sustained and stable economic ecosystem becomes | ||
| apparent. The transition to a smoothed emissions curve offers an opportunity to adjust the network's | ||
| issuance dynamics while maintaining the supply cap of 21,000,000 coins. By doing so, Zcash | ||
| endeavors to optimize its economic framework, accommodating changing circumstances while | ||
| maintaining predictability and stability in rewards distribution. | ||
|
teor2345 marked this conversation as resolved.
Outdated
|
||
|
|
||
| This proposal outlines a solution to address challenges associated with the existing block | ||
| subsidy issuance mechanism in the Zcash network. The primary goal of this proposal is to | ||
| introduce a more predictable and stable issuance of ZEC by smoothing out the issuance | ||
| curve while preserving the supply cap. It's important to note that this proposal does | ||
| not seek to alter the fundamental aspects of Zcash's issuance policy. The average block | ||
| subsidy size over time will remain the same and the funds for block subsidies will last | ||
|
aphelionz marked this conversation as resolved.
Outdated
|
||
| a similar amount of time. Instead, it focuses solely on enhancing the predictability | ||
| and consistency of the block subsidy issuance process. | ||
|
|
||
| Smoothing the emissions curve helps ensure that the network remains economically | ||
| viable and stable as it transitions from a traditional issuance mechanism to one | ||
| that maintains a sustainable and predictable issuance of rewards over time. It | ||
| prevents abrupt changes in the rate of newly issued coins, which could lead to | ||
| disruptions in the network's economic model and potentially impact its security | ||
| and sustainability. A smoother emissions curve allows for a more gradual and controlled | ||
| transition, providing ZEC stakeholders and participants with a clear understanding of | ||
| how rewards will be distributed over time. | ||
|
|
||
|
|
||
|
|
||
| # Specification | ||
|
|
||
| Smoothing the issuance curve is possible using an exponential decay formula that | ||
| satisfies the following requirements: | ||
|
|
||
| ## Requirements | ||
|
aphelionz marked this conversation as resolved.
Outdated
|
||
|
|
||
| 1. Block subsidies MUST be weakly decreasing | ||
|
aphelionz marked this conversation as resolved.
Outdated
|
||
| 2. Block subsidies SHOULD approximate a continuous function | ||
|
aphelionz marked this conversation as resolved.
Outdated
|
||
| 3. When `AVAILABLE_SUBSIDIES(h) > 0` then block subsidies for block `h` | ||
| MUST always be `> 0`, preventing a final “unmined” zatoshi | ||
| 4. For any 4 year period, all paid out block subsidies MUST equal approximately | ||
| half of `AVAILABLE_SUBSIDIES` at the beginning of that 4 year period | ||
|
teor2345 marked this conversation as resolved.
Outdated
|
||
| 5. This functionality MUST be introduced as part of a network upgrade | ||
|
tomekpiotrowski marked this conversation as resolved.
Outdated
|
||
|
|
||
| The above requirements assume no deflationary action, i.e. that no ZEC is added | ||
| to `AVAILABLE_SUBSIDIES`. They are referenced below as **Rn**. | ||
|
teor2345 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Solution | ||
|
aphelionz marked this conversation as resolved.
Outdated
|
||
|
|
||
| Given the block height `h` define a function **S**, such that: | ||
|
|
||
| **S(h)** = Block subsidy for a given `h`, that satisfies above requirements. | ||
|
|
||
| Please note that | ||
|
|
||
| `AVAILABLE_SUBSIDIES(h+1) = AVAILABLE_SUBSIDIES(h) - S(h)` assuming no deflationary action. | ||
|
|
||
| An exponential decay function **S** satisfies **R1** and **R2** above: | ||
|
|
||
| `S(h) = BLOCK_SUBSIDY_FRACTION * AVAILABLE_SUBSIDIES(h)` | ||
|
|
||
| Finally, to satisfy **R3** above we need to always round up to at least 1 Zatoshi | ||
| if `AVAILABLE_SUBSIDIES(h) > 0`: | ||
|
|
||
| `S(h) = ROUND_UP(BLOCK_SUBSIDY_FRACTION * AVAILABLE_SUBSIDIES(h))` | ||
|
aphelionz marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Rationale | ||
|
|
||
| ## `BLOCK_SUBSIDY_FRACTION` | ||
|
|
||
| That value of `41 / 100_000_000` was selected so that it satisfies the equation: | ||
|
teor2345 marked this conversation as resolved.
Outdated
|
||
|
|
||
| `(1 - BLOCK_SUBSIDY_FRACTION)^NUMBER_OF_BLOCKS_IN_4_YEARS ~ ½` | ||
|
|
||
| Meaning after a period of 4 years around half of `AVAILABLE_SUBSIDIES` will be paid out | ||
| as block subsidies, thus satisfying **R4**. | ||
|
aphelionz marked this conversation as resolved.
Outdated
|
||
|
|
||
|
|
||
| ## Other Notes | ||
|
|
||
| The suggested implementation avoids using float numbers. Rust and C++ will both round | ||
| the result of the final division up, satisfying **R3** above. | ||
|
tomekpiotrowski marked this conversation as resolved.
Outdated
|
||
|
|
||
| # Appendix: Simulation | ||
|
|
||
| We encourage readers to run the following Rust code, which simulates block subsidies. | ||
| According to this simulation, assuming no deflationary action, block subsidies would | ||
| last for approximately 113 years: | ||
|
teor2345 marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Rust Code | ||
|
|
||
| ```rust | ||
| fn main() { | ||
| // approximate available subsidies in August of 2023 | ||
|
tomekpiotrowski marked this conversation as resolved.
Outdated
|
||
| let mut available_subsidies: i64 = 4671731 * 100_000_000; | ||
|
teor2345 marked this conversation as resolved.
Outdated
|
||
| let mut block: u32 = 0; | ||
|
|
||
| while available_subsidies > 0 { | ||
| let block_subsidy = (available_subsidies * 41 + 99_999_999) / 100_000_000; | ||
| available_subsidies -= block_subsidy; | ||
|
|
||
| println!( | ||
| "{} ({} years): {}({} ZEC) {}({} ZEC)", | ||
| block, // current block | ||
| block / 420_768, // ~ current year | ||
| block_subsidy, // block subsidy in zatoshis | ||
| block_subsidy / 100_000_000, // block subsidy in ZEC | ||
| available_subsidies, // available subsidies in zatoshis | ||
| available_subsidies / 100_000_000 // available subsidies in ZEC | ||
| ); | ||
|
|
||
| block += 1; | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| Last line of output of the above program is: | ||
|
|
||
| `47699804 (113 years): 1(0 ZEC) 0(0 ZEC)` | ||
|
|
||
| Note the addition of 99,999,999 before division to force rounding up of non-zero values. | ||
|
tomekpiotrowski marked this conversation as resolved.
Outdated
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assigned ZIP 234.