9

Look at this level (a random pick from tzscan alt. branches) : https://tzscan.io/heads?level=308597

At this level there are 2 blocks : BKwxHgaBKAPBK8ofYgUoJTn3WVMbhVouhZgDzExmnAXHsUXqvp7 (the winner) BM1FKYSNBX428uU6uNywK424xG7Ljc28vnKp4mcR43t2j9UkqvY (the uncle)

tzscan shows me all data about the uncle's block. https://tzscan.io/BM1FKYSNBX428uU6uNywK424xG7Ljc28vnKp4mcR43t2j9UkqvY

But how i can see the same data using rpc calls ?

tnks for any tips

1
  • obviously i have already tried the command "tezos-client rpc get /chains/main/blocks/BM1FKYSNBX428uU6uNywK424xG7Ljc28vnKp4mcR43t2j9UkqvY" but it returns the error "Did not find service"
    – AndreaT
    Commented Feb 11, 2019 at 10:17

3 Answers 3

7

A node does not keep the former alternative heads. You can only query the current heads:

tezos-client -A mainnet-node.tzscan.io rpc help /chains/main/blocks

Old ones are removed when their fitness is too small compared to new ones.

You can see them on TzScan, but only the ones that TzScan saw (your node might see other ones), because TzScan stores them in an external database.

2
  • so, i can see them only when they occur or never again. Make sense but , how i can see them "in real time" ?
    – AndreaT
    Commented Feb 11, 2019 at 13:27
  • You have to keep pulling heads from the node all the time...
    – lefessan
    Commented Feb 11, 2019 at 14:49
3

You can get the alternative heads using tzscan API if you want :

http://api1.tzscan.io/v3/heads

This is basically what we display in the alt branches page :

https://tzscan.io/heads

2
  • thanks for your reply, but I would like to understand how to recover them by myself and do not use third-party data.
    – AndreaT
    Commented Feb 12, 2019 at 10:21
  • This answer should be downvoted as tzscan.io is no longer operational. Commented Feb 20, 2020 at 10:13
-2

I did some tests and I can say that FLF OCP's statement "A node does not keep the former alternative heads" it's not true.

If i query my node with tezos-client rpc get /chains/main/blocks i get a list of block_heads. The first one is the current head but the others are all (actually not all**) the alt heads.

And if i also query my node with tezos-client rpc get /chains/main/blocks/<one head from the list> i get all the info about it.

So, the node keep tracks of the alt heads too and i can retrieve it!

**Just a note

Quering different node give me different result. On my service node i get a list of 21 heads, on mainnet-node.tzscan.io i get 49 heads and on my baker i get 55 heads. This is partially related to node's uptime but not only. Some heads (even recent ones) are present only in one node and not in others.

(this the reason why i got an error looking for the head above on one of my node)

Does anyone have any idea why the nodes do not have all the same information (considering that all have the same uptime)?

4
  • 1
    The node does not keep every alt heads seen since the genesis block, what you are seeing is the more recent alt heads that your node saw. Old ones are removed. The difference between nodes is because every node does not see every alt heads. If one of your node is not connected to a node which share an alt branch with you, that's normal to not see it. So it will depend to who you are connected at one point.
    – cago
    Commented Feb 12, 2019 at 10:34
  • yes, you are right and i'm quite confident that the alt heads "history" is 5 cycles old max (this is also the reason because you can send a double baking evidence occurred max 5 cycles in the past)
    – AndreaT
    Commented Feb 12, 2019 at 11:00
  • No, the 5 cycle history for double baking evidence is just because the frozen deposits and rewards are not available later for punishment
    – lefessan
    Commented Feb 12, 2019 at 13:13
  • What I meant by "A node does not keep the former alternative heads" is that the node does not keep them very long, they are removed afterwards (I say that in my response...). What you see with the RPC is only the recent heads, but you cannot see more than that, even after a long time (mainnet-node.tzscan.io has been up since Dec 19, 2018, and you only see 49 heads...)
    – lefessan
    Commented Feb 12, 2019 at 13:33

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.