Absolute slotheight in rest api

Is there any way to get the absolute slot height via REST API?
I’m trying to build a transaction and apparently I need the absolute slot height to set the ttl.

cardano-cli query tip --mainnet
returns with the actual slot number (slotNo):

{
    "blockNo": 16829,
    "headerHash": "3e6f59b10d605e7f59ba8383cb0ddcd42480ddcc0a85d41bad1e4648eb5465ad",
    "slotNo": 369200
}

https://docs.cardano.org/projects/cardano-node/en/latest/stake-pool-operations/simple_transaction.html#determine-the-ttl-time-to-live-for-the-transaction

Yeah, I know about cli. But I’m limited to using REST API only. The slot is relative there and I cannot find a way to get an absolute slot height.

the result of query tip gives back the absolute slot height.
are you using cardano-rest? like this?

I use an external public node (some-web-address/api/… ), not running it myself. So all I can do is making http requests to this api that has all the methods from cardano-rest docs (cardano-explorer-api Documentation and https://input-output-hk.github.io/cardano-rest/submit-api).

yes, it seems that there is no such query - weird
So what I suggest is to get the current epoch - then multiply that number with the max slot number (432000) - and you will get an absolute slot number which is higher then the current absolute slot number till the next epoch. or always add another max slot number to the result.

1 Like

Thanks a lot! I though about it and apparently this is the only way.