How to get the current epoch and slot via API?

Hi, I want to display a cardano-node sync progress bar in my app. So I can query the epoch my node is up to during syncing, but how can I know what’s the latest epoch/slot out there (in the world)?

Is there any publicly available API for that?

See how guild operators calculate it. You can calculate it based on parameters from the genesis files:

1 Like

Thank you! I’ll try that

Lol! I’ve rewrote this function to JS just to discover that in Alonzo they’ve added syncProgress to the response

    "epoch": 155,
    "hash": "42f877bcbd10ed80f24209593525a3a6798c5c06472b9aea4407d8b5f8cf0bab",
    "slot": 36684644,
    "block": 2893622,
    "era": "Alonzo",
    "syncProgress": "100.00"

Hehe, this makes it easier :slight_smile:
If you want to know how old the TIP is you can also take a look at my little TIP Reporting Script:


1 Like

You can also try blockfrost API,