-
Notifications
You must be signed in to change notification settings - Fork 20.1k
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
getUncleCount(fromBlock,toBlock) - or: Doesn't total supply depend on uncle count? #2088
Comments
I don't see the point of having these new API calls. Could you please specify why these would be required for DApp development (or any other type of development)? If you'd like to get all uncles for statistics just loop over all the blocks in your desired range. Unsure what |
Thanks a lot for your answer.
Because otherwise I would have to iterate over all ~800,000 blocks, checking all of them for uncles. The ethereum architects have created a complicated rewards scheme which is not simply blocknumber*blockreward. But the current API is not yet providing all the necessary information to work with that complicated rewards scheme.
I would like to calculate the REAL total supply. supply = premine + mined The 'mined' part is tricky because of the uncle rewards. mined = rewards(blocks) + rewards(uncles) + rewards(include-uncle-into-block)
There is am extra reward given to miners who have included uncles into their mined blocks - right?
Or not? Then rewards(include-uncle-into-block) = 0 ? Yes? No? |
What you're describing are database indexes which is a non-trivial topic and why you're not likely to get an answer about aggregates via API any time soon. To effectively respond to queries like this will require more forethought than demanding a new API is created |
Yes. Probably because I have been coding on top of the fantastic, comfortable, genius NXT API for quite some time now, I am lacking the imagination how to live without it * lol * They do have a 7 times slower blocktime ... and I don't know how they did it ... but their blockchain size is only 1.7GB after 2.1 years. And still it provides exactly that: Database indices, to directly access all data objects on the chain. Quite an amazing system, really. Get inspired ... :-) |
Exactly. To prevent that, I was thinking about a supersimple internal summation, whenever a new block is added. Just sum up the count of {0,1}uncles ... These are thoughts about a future API, of course ... Is my above "supply = premine + ..." formula correct at all? Perhaps I am wrong in my assumption how much ether has been mined. But if not ...: Right now (without iterating over all 800k blocks) it is impossible to name the correct total supply of ether - right? So what about (in the future) storing just two integer values:
That won't cost anything. And (only) with that information, the REAL supply of ether can be calculated. Or ... if you think you can afford to store 800,000 * 4 bytes * 2 ... you could store 2 numbers for each block:
That would allow an easy getUncleCount(fromBlock,toBlock), and reveal all information. The first suggestion is really really easy to include in a future version - don't you think so? And to not be able to correctly name the total supply of a (platform that is also used as a) currency ... is a bit odd, no? |
If you need detailed information on the uncle headers of all blocks, please consider creating your own index. It is not that hard to build one. You can even update it incrementally using existing features of the web3 API. Just to be clear on this: We take suggestions for new APIs seriously and keep track of them. This is the first time anyone has requested an API for aggregate information on uncle headers. Consider |
@fjl one last question: Have I actually understood the mined/supply function correctly - or not? i.e. in #2088 (comment) is the central formula correct? -->
? Still wondering if I got it right, or not. Thanks a lot! |
Thanks a lot.
Then ... for the first time, anyone has ever wondered what the real supply of ether is - right? :-)
Nice. So one day, I might see that function. Thx. A tiny thing to add to it: While you are on it anyways, and when that above data is then available, please also create a simple API function that tells me, us, everyone ... about the total real coin supply: eth.supply() |
is my rewards calculation correct, or not? |
When I came across this function suggestion I actually consider it suboptimal communication, to close github issues before they are actually answered. --> What is the |
anyone? |
So here can can see what happens when issues are closed before they are answered. They are not on your radar anymore. This admin behaviour is just ... wrong. |
draft release v1.3.7
I want to calculate the total supply. But I cannot.
I am wondering if I understand the mining rewards correctly.
I think it is not simply
because of "uncles", right?
An uncle miner gets 4.375 coins or 3.75 coins (for 0Uncles and 1Uncles). Correct? More such additional rewards?
Plus including an uncle into a block gives an extra 5/32 coins to the block miner. Correct?
So the total supply of ETH is (probably)
Correct, or am I completely missing the point?
EDIT: As far as I understand it, this should be true
so the only new thing a future version needs to provide are these two integers
If the above is (near to) correct ... then it is impossible to calculate the REAL current supply at the moment. So:
I suggest new API functions:
or at least the aggregate sums until the current block:
where the first one would return the tuple of number of 0Uncles and 1Uncles (and 2Uncles if there are any) in that range of blocks; or the second one would return simple integers with the total number of {0,1}-uncles from genesis until now (similar to the eth.blockNumber integer).
Or is there an easier way to do this?
Used sources:
P.S.: Even the "big guys" are of a differing opinion on the "supply" topic - there is a (0.3 percent) difference between the "supply" reported at etherscan and CMC. Is that because of the above ?
The text was updated successfully, but these errors were encountered: