<p><code>bitcoind</code> offers a <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md" rel="nofollow noreferrer">zmq hook</a> which you can use to receive notifications on new blocks and transactions.</p>

CC BY-SA 4.0
2018-06-13T20:29:59.507Z
2018-06-13T20:29:59.507Z
Raghav Sood
<p>You can use blocknotify option, Execute command when the best block changes, read more here <a href="https://en.bitcoin.it/wiki/Running_Bitcoin" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Running_Bitcoin</a> </p>

CC BY-SA 4.0
2018-06-13T20:35:08.063Z
2018-06-13T20:35:08.063Z
ergesto
<p>I want to know when a new block is discovered, I am watching debug.log to see if it has changed, I know there is a new block if the line contains "UpdateTip: new best". Is there a better way to do this?</p>

<blockchain><block><relay>
Bitcoin New Block Event Trigger
Anil M
# Bitcoin New Block Event Trigger

(Asked by: username_0 on 2018-06-13)

I want to know when a new block is discovered, I am watching debug.log to see if it has changed, I know there is a new block if the line contains "UpdateTip: new best". Is there a better way to do this?

**Tags:** blockchain, block, relay


---

## 2 answers

### Answer by username_1 on 2018-06-13. Score: 2 | Accepted answer

`bitcoind` offers a [zmq hook](https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md) which you can use to receive notifications on new blocks and transactions.


---

### Answer by username_2 on 2018-06-13. Score: 1

You can use blocknotify option, Execute command when the best block changes, read more here <https://en.bitcoin.it/wiki/Running_Bitcoin>


---

