Bitcoin New Block Event Trigger

1

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?

Anil M

Posted 2018-06-13T20:24:35.043

Reputation: 15

Answers

2

bitcoind offers a zmq hook which you can use to receive notifications on new blocks and transactions.

Raghav Sood

Posted 2018-06-13T20:24:35.043

Reputation: 10 897

1

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

ergesto

Posted 2018-06-13T20:24:35.043

Reputation: 36