<p>I don't believe there is a direct way to do this via ZeroMQ. Your best bet would be to validate the ancestry for each block as you receive it.</p>

<p>When you receive a block, check its parent hash against blocks you have already seen. If the parent chain validates <em>and</em> you do not have another, longer child chain from the parent block already, you can accept this block.</p>

CC BY-SA 4.0
2018-07-18T15:48:29.413Z
2018-07-18T15:48:29.413Z
Raghav Sood
<p>I'am writing an application which receives information about new tx and blocks via ZeroMQ. There is a chance that I will receive notifs about blocks which will later on become stale blocks. Is there a way to verify whether the block has become stale?</p>

<block><zeromq><stale-block>
Detecting stale blocks with ZeroMQ
Maciej Mościcki
# Detecting stale blocks with ZeroMQ

(Asked by: username_0 on 2018-07-18)

I'am writing an application which receives information about new tx and blocks via ZeroMQ. There is a chance that I will receive notifs about blocks which will later on become stale blocks. Is there a way to verify whether the block has become stale?

**Tags:** block, zeromq, stale-block


---

## 1 answers

### Answer by username_1 on 2018-07-18. Score: 1 | Accepted answer

I don't believe there is a direct way to do this via ZeroMQ. Your best bet would be to validate the ancestry for each block as you receive it.

When you receive a block, check its parent hash against blocks you have already seen. If the parent chain validates *and* you do not have another, longer child chain from the parent block already, you can accept this block.


---

