Zcash Halving Countdown
Hello Free2z friends, today I'm here to present a fairly basic code I wrote: a Zcash Halving Countdown!
But Why?
Halving Countdowns, as it should be obvious by it's name, is a tool that counts the remaining time until the blockchain next halving.
Most Zcash countdowns online are outdated, and display incorrect halving date.
The only one that is working alright is the one found in Zecpages.
My code
Most Halving Countdowns get the current blockchain height from block explores API, but just to be a litle different, I decided to fetch the blockchain height from a lightwalletd server using gRPC.
I decided to create this simple countdown to run as an API.
The service will run and listen on port 3001 for requests, and returns a JSON containing everything you need to know about the next halving date.
Example:
$ curl -X GET http://localhost:3001/
Json response:
{ "height":2002247, // Current blockchain height "next_halving":2726400, // Next Halving block height "remaining_blocks":724153, // Remaining blocks until next halving "current_subsidy":312500000, // Current block subsidy in zatoshi "next_subsidy":156250000, // Next block subsidy in zatoshi "countdown": { "secs":15, // Remaining seconds until next halving "mins":31, // Remaining minutes until next halving "hours":14, // Remaining hours until next halving "days":628 // Remaining days until next halving }, "halving_date":"2024-11-20T06:31:15.237Z" // Estimated date the halving will occur }
Pretty nice!
The code
You can get the full sourcecode on github: https://github.com/james-katz/zcash-halving-countdown
That's all folks
That's it for this post. I hope this is intersting somehow.
See you next time, Bye!
