Post
Topic
Board Development & Technical Discussion
Merits 2 from 1 user
Topic OP
Is it possible to iterate over all blocks, incl orphans, with the RPC api?
by
CuriousCarl
on 30/01/2015, 08:20:16 UTC
⭐ Merited by ABCbits (2)

I'm trying to iterate over all blocks, incl orphans, via the rpc api.

First, these are my assumptions. Please tell if these are correct:

  • Orphaned blocks are valid blocks.
  • Orphaned blocks contains valid transactions.
  • The transactions in an orphaned blocks can only be found in that orphaned block.

In order to iterate over all blocks in the longest chain you could use these commands:
Code:
getblockcount
getblockhash
getblock

But what about all the orphans? They are not part of the longest chain, right? You can get any block if you know the hash with "getblock". But how do you discover the hash of the orphans in the first place?

Is there a way to discover the orphans via rpc?