2

Let's say, we have following block: https://ropsten.etherscan.io/block/7375 It has two uncles:

0xa9e3fe7090c12fd6db3cec305d21437b0c968188becafc099f4324964015d27a      
0x33eace2f6ffee2a214053c538f1fe2998a53a4bfc0a02000bc5280af7f166396

The following link shows detailed information about first uncle: https://ropsten.etherscan.io/uncle/0xa9e3fe7090c12fd6db3cec305d21437b0c968188becafc099f4324964015d27a

I am interested how I can get a detailed information about each uncle, like in the link above. Is there some API for uncle data?

I need this in order to calculate uncle reward.

7
  • Maybe I'm missing something, but why isn't it just the same URL but using the second hash instead of the first? Commented Sep 26, 2017 at 21:27
  • Here is my issue: I'd like to calculate uncle reward, the formula is (U_n + 8 - B_n) * R / 8, where U_n = uncle number. When a new block occurs, it shows only uncle hashes. So I need to understand how I can get uncle numbers. Most probably there's something which I don't understand
    – Ivan Ursul
    Commented Sep 26, 2017 at 21:30
  • The link you provide links to the first uncle with the first hash. If you change the hash to use the second hash instead, you see the block number for the second uncle which happens to be the same as the first one--but that makes sense. They are brothers, and they are brothers of this block's parent, so they would have the same height as the parent--one less than the block. (I'm not sure if this happens every time [that uncle is one less than current block], but it makes sense here.) Commented Sep 26, 2017 at 21:35
  • You are not right, see this block: ropsten.etherscan.io/block/4447
    – Ivan Ursul
    Commented Sep 26, 2017 at 21:36
  • Oh. I get it now. Maybe your asking "is there an API" as opposed to "where is the link"? Sorry about that. Commented Sep 26, 2017 at 21:36

1 Answer 1

1

You can use the eth_getUncleByHashAndIndex RPC function to retrieve the block that holds the block number of that uncle. First retrieve the block in question. It will contain a list of uncle hashes. Then use eth_getUncleByHash to get the block that is represented by that hash.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.