Ethereum’s Issuance: uncleReward
This the second in a series of two articles detailing Ethereum’s issuance. Read the first part, which discusses the
blockReward calculation. Also, see the code base for the actual code. This article discusses the
Previously, we looked at the ungrammatical second sentence in Section 11.3 of Ethereum’s Yellow Paper. In the first article, we discussed the first half of that sentence concerning
blockReward. In this article we discuss the remaining half of that sentence (shown below) which details the
It would be more accurate for the Yellow Paper to say that the “beneficiary of each ommer gets rewarded…” as there may be more than one uncle in the block, each with a different miner. We call this reward the
The calculation of the
uncleReward is a function of the
blockNumber in which it appears, the uncle’s own
blockNumber, and the
baseReward from the previous article. A block “becomes an uncle” when it shows up in the uncle list of a canonical block.
uncleReward is calculated from the block’s
baseReward reduced by
1/8 for each block the uncle is distant from the current block. If an uncle is more than six blocks old, it is not rewarded
Before we proceed, let’s take a small detour to look at the fourth sentence of Section 11.3, the only sentence we haven’t looked at yet. This sentence informs the calculation of
This simplifies our concerns. It means we don’t have to keep track of previously applied rewards. The winner of a
blockReward may also win one or more
uncleRewards in the same block. Furthermore, a single miner may win both
uncleRewards in the same block.
Back to the Main Line…
uncleReward is described by the following set of three unnecessarily-complicated equations (163, 164, and 165):
We will look at each one separately. Starting with Equation 163:
Translating Equation 163 into English, it says “For each uncle in the block’s uncle list (if any), the account of the uncle’s miner either (a) remains empty if it was previously empty and the
uncleReward is zero, or (b) the account transitions to a new state (called
a-prime) as per Equation 164”:
This translates to English as, “The state of the account of the uncle’s miner after the block,
a-prime, is the same as it was prior to the block except for the fact that balance has increased by the value R (the
And finally, Equation 165 defines the
Translating this final bit to English: “The
uncleReward is the
baseReward lessened by
1/8 for each block that the uncle is distant from the present block.”
Note that the uncle’s
blockNumber will always be less than the block’s
blockNumber, making the value in the innermost parentheses always negative, and thereby lowering the
uncleReward for each block distant from the front of the chain.
All of the above mumbo-jumbo fits nicely into this TrueBlocks code:
These calculations, at least to me, are much easier when written in code than they are in the Yellow Paper .
getUncleReward needs to be called for each uncle in the block; therefore, we must first call
getUncleCount, and spin to query for each uncle block. Then, we can extract the uncle’s block number, and calculate
We accumulate the rewards for the uncles and return that value to the caller:
Rolling it Up
We’ve shown that the
blockReward and the
uncleReward are not that complicated, and that both are functions of
Until now, we’ve shown this calculation for individual blocks. The only thing left to do is to roll through each block in the chain, accumulating the results for presentation.
We use a
C++ accumulator class we call
CReconciliation. The name implies an additional feature that we will discuss in the README of the code base where we ‘reconcile’ the expected or modeled values with actual account balances directly from the chain.
There have been other proposed scripts to the Crypto Twitter uproar. Those scripts only model the behavior of the chain. They do not validate or audit the behavior. We explain this auditing process in the README.
For now, we conclude this article with code that processes the rewards for each block.
The following code shows an excellent feature of TrueBlocks.
TrueBlocks provides many functions that start with
forEvery, such as
reduce. One sends an arbitrary function and arbitrary data pointer to each block in the chain (or each transaction, or each address, or whatever) and allows the function to be applied to the data.
This tends to make the topmost code of a TrueBlocks app very minimal:
One need only define the function
calcRewards, which we’ve done throughout these two articles.
The above code spins through each block, accumulating, auditing, and presenting the data for that block, and then reports the results of the accumulated data to the screen.
One Final Thought
Here, I wish to interject my own personal opinion: the Yellow Paper is stupidly over-complicated. The code that generates the Ether Supply is, in the end, trivial. For some ungodly reason, the specification wildly over-complicates it. I suppose that’s the nature of engineers with a Ph.D.
Support Our Work
I wish to thank Meriam Zandi for her help in this article.
Help us continue our work. Visit our GitCoin grant page here: https://gitcoin.co/grants/184/trueblocks, and donate today.
Or, if you’d rather not expose yourself to scrutiny, and you’d still like to donate, send ETH to 0xB97073B754660BB356DfE12f78aE366D77DBc80f.
- The Best Crypto Trading Bot
- Crypto Copy Trading Platforms
- The Best Crypto Tax Software
- Best Crypto Trading Platforms
- Best Crypto Lending Platforms
- Best Blockchain Analysis Tools
- Crypto arbitrage guide: How to make money as a beginner
- Best Crypto Charting Tool
- Ledger vs Trezor
- What are the best books to learn about Bitcoin?
- 3Commas Review
- AAX Exchange Review | Referral Code, Trading Fee, Pros and Cons
- Deribit Review | Options, Fees, APIs and Testnet
- FTX Crypto Exchange Review
- NGRAVE ZERO review
- Bybit Exchange Review
- 3Commas vs Cryptohopper
- The Best Bitcoin Hardware wallet
- Best monero wallet
- ledger nano s vs x
- Bitsgap vs 3Commas vs Quadency
- Ledger Nano S vs Trezor one vs Trezor T vs Ledger Nano X
- BlockFi vs Celsius vs Hodlnaut
- Bitsgap review — A Crypto Trading Bot That Makes Easy Money
- Quadency Review- A Crypto Trading Bot Made For Professionals
- PrimeXBT Review | Leverage Trading, Fee and Covesting
- Ellipal Titan Review
- SecuX Stone Review
- BlockFi Review | Earn up to 8.6% interests on your Crypto