You can also check my implementation of zcash halving countdown here
My halving countdown also get the current block reward and reward after halving. And other things.
Read more about it on my free2z page
Or go straight here to see it in action.
I believe it’s quite accurate. But I’m not sure though.
edit
To be more specific, my api returns all this info (example):
{
"height":2146985, // Current blockchain height
"next_halving":2726400, // Next Halving block height
"remaining_blocks":579415, // Remaining blocks until next halving
"current_subsidy":312500000, // Current block subsidy in zatoshi
"next_subsidy":156250000, // Next block subsidy in zatoshi
"countdown":
{
"secs":45, // Remaining seconds until next halving
"mins":8, // Remaining minutes until next halving
"hours":23, // Remaining hours until next halving
"days":502 // Remaining days until next halving
},
"halving_date":"2024-11-20T21:46:45.773Z" // Estimated date the halving will occur
}