Regarding Abe, it should load orphan blocks from the blockchain if you use the blkfile loader... I haven't looked in detail the use of the orphan_block
table but it's empty on both my db's despite the fact I do have orphan blocks in them (I can't say it's a bug yet but it sure looks fishy).
You can search orphan block by hash in Abe, but to find the hashes you need to look directly in the database. This query works for me on MySQL, using binary hash storage (hence the HEX()
function); be sure to remove it if you store hashes as CHAR hex strings (used to be the default).
SELECT block_height, HEX(block_hash) FROM block b
LEFT JOIN block_next bn ON (b.block_id = bn.block_id)
WHERE bn.next_block_id IS NULL
ORDER BY b.block_id DESC LIMIT 1,10;
The LIMIT 1,10
is to skip the most recent loaded block which is most likely the tip; it has no block_next_id but it's not orphan neither.
If you use the RPC loader, you can only catch orphan blocks while loading the latest blocks; it won't receive any orphan from bitcoind unless if it hasn't yet been orphaned! You may catch some using abe_loader and eventually with some code I'm still testing that will allow constantly loading mempool and blocks.