<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>~iany/ Crypto Economics</title><link>https://blog.iany.me/tags/crypto-economics/</link><description>Recent content in Crypto Economics «~iany/»</description><language>en-US</language><managingEditor>me@iany.me (Ian Yang)</managingEditor><webMaster>me@iany.me (Ian Yang)</webMaster><copyright>CC-BY-SA 4.0</copyright><lastBuildDate>Sat, 05 Sep 2020 17:52:10 +0800</lastBuildDate><atom:link href="https://blog.iany.me/tags/crypto-economics/index.xml" rel="self" type="application/rss+xml"/><item><title>Monero Dynamic Block Weight</title><link>https://blog.iany.me/2020/09/monero-dynamic-block-weight/</link><pubDate>Sat, 05 Sep 2020 17:52:10 +0800</pubDate><author>me@iany.me (Ian Yang)</author><guid>https://blog.iany.me/2020/09/monero-dynamic-block-weight/</guid><description>&lt;p&gt;Monero dynamic block weight is an interesting design. Instead of a fixed supply of transaction space, Monero uses the history blocks to determine the dynamic limit and use the median to control the increasing pace.&lt;/p&gt;
&lt;p&gt;The major reference of this article is chapter 7.3 Money supply in the book &lt;em&gt;Zero to Monero: Second Edition&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id="block-weight-limit"&gt;Block Weight Limit&lt;/h2&gt;
&lt;p&gt;The current block&amp;rsquo;s &lt;code&gt;cumulative_weights_median&lt;/code&gt; is the base limit for the next block. The max block weight of the next block is &lt;code&gt;2 ∗ cumulative_weights_median&lt;/code&gt; and the block reward decays when the block weight is greater than &lt;code&gt;cumulative_weights_median&lt;/code&gt;.&lt;/p&gt;
&lt;figure class="kg-image-card"&gt;
&lt;img alt="Block Reward decays when the weight is greater than `cumulative_weights_median`" class="kg-image" loading="lazy" src="https://blog.iany.me/2020/09/monero-dynamic-block-weight/block_reward_hu_a4d65800908d1a14.png" srcset="https://blog.iany.me/2020/09/monero-dynamic-block-weight/block_reward_hu_f563f3d572f4eecb.png 400w, https://blog.iany.me/2020/09/monero-dynamic-block-weight/block_reward_hu_a4d65800908d1a14.png 640w" sizes="(max-width: 400px) 100vw, 640px" /&gt;
&lt;figcaption &gt;Block Reward decays when the weight is greater than &lt;code&gt;cumulative_weights_median&lt;/code&gt;&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;p&gt;The definition of &lt;code&gt;cumulative_weights_median&lt;/code&gt; is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;cumulative_weights_median = max{
300kB,
min{
max{
300kB,
median_100blocks_weights
},
50 ∗ effective_longterm_median
}
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The item &lt;code&gt;300kB&lt;/code&gt; is the lower bound of &lt;code&gt;cumulative_weights_median&lt;/code&gt;, which can be removed to simplify the formula.&lt;/p&gt;
&lt;p&gt;The term &lt;code&gt;effective_longterm_median&lt;/code&gt; changes slowly and can be considered as a constant here. It acts as the upper bound.&lt;/p&gt;
&lt;p&gt;The value of &lt;code&gt;cumulative_weights_median&lt;/code&gt; indeed is the median of the last 100 blocks weights clamped between 300kB and &lt;code&gt;50 * effective_longterm_median&lt;/code&gt;. In turn, the block weight is restricted by &lt;code&gt;cumulative_weights_median&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The base limit &lt;code&gt;cumulative_weights_median&lt;/code&gt; increases when there are at least 50 in the recent 100 blocks which weight is greater than &lt;code&gt;cumulative_weights_median&lt;/code&gt;, indicating that at least half of the miners are willing to take the block reward penalty. Miners are incentivized to take the penalty because the transaction fees can cover the loss.&lt;/p&gt;
&lt;p&gt;If the network runs at full load, &lt;code&gt;cumulative_weights_median&lt;/code&gt; doubles every 50 blocks and will reach the upper bound &lt;code&gt;50 * effective_longterm_median&lt;/code&gt; eventually.&lt;/p&gt;
&lt;p&gt;Pay attention that &lt;code&gt;cumulative_weights_median&lt;/code&gt; falls immediately when the network load drops. If there are 50 in the last 100 blocks which weight is less than 300kB, &lt;code&gt;cumulative_weights_median&lt;/code&gt; will become 300kB. Maintaining &lt;code&gt;cumulative_weights_median&lt;/code&gt; at a value higher than 300kB requires continuous transaction traffic.&lt;/p&gt;
&lt;figure class="kg-image-card"&gt;
&lt;img alt="An example of how `cumulative_weights_median` changes" class="kg-image" loading="lazy" src="https://blog.iany.me/2020/09/monero-dynamic-block-weight/cumulative_weights_median_hu_45a0a734eb11529e.png" srcset="https://blog.iany.me/2020/09/monero-dynamic-block-weight/cumulative_weights_median_hu_a0c29b0f14ec132b.png 400w, https://blog.iany.me/2020/09/monero-dynamic-block-weight/cumulative_weights_median_hu_45a0a734eb11529e.png 640w" sizes="(max-width: 400px) 100vw, 640px" /&gt;
&lt;figcaption &gt;An example of how &lt;code&gt;cumulative_weights_median&lt;/code&gt; changes&lt;/figcaption&gt;
&lt;/figure&gt;
&lt;h2 id="long-term-limit"&gt;Long Term Limit&lt;/h2&gt;
&lt;p&gt;The value of &lt;code&gt;effective_longterm_median&lt;/code&gt; caps the max block weight in the short term. As the name suggests, it is the median of the &lt;code&gt;longterm_block_weight&lt;/code&gt; of the last 100,000 blocks.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;effective_longterm_median = max { 300kB, median_100000blocks_longterm_weights }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The definition &lt;code&gt;longterm_block_weight&lt;/code&gt; is&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;min { block_weight, 1.4 ∗ previous_effective_longterm_median }
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The value of &lt;code&gt;effective_longterm_median&lt;/code&gt; is the median of the last 100,000 blocks weights clamped between 300kB and &lt;code&gt;1.4 * previous effective_longterm_median&lt;/code&gt;. Same with &lt;code&gt;cumulative_weights_median&lt;/code&gt;, it increases slowly and drops sharply.
If all the blocks weights are greater than &lt;code&gt;1.4 ∗ previous_effective_longterm_median&lt;/code&gt;, &lt;code&gt;effective_longterm_median&lt;/code&gt; rises by 40% every 50,000 blocks.&lt;/p&gt;</description><category domain="https://blog.iany.me/post/">Posts</category><category domain="https://blog.iany.me/tags/blockchain/">Blockchain</category><category domain="https://blog.iany.me/tags/crypto-economics/">Crypto Economics</category><category domain="https://blog.iany.me/tags/monero/">Monero</category></item></channel></rss>