Latest Epoch
GET /v1/epochs/latest
Get the current network tip and epoch information from Ogmios. This endpoint provides real-time blockchain tip data, useful for calculating transaction TTL (time-to-live) values.
Example Request:
bash
curl -X GET "https://api.fireblocks.partners.iagon.com/v1/epochs/latest" \
-H "Authorization: Bearer YOUR_API_KEY"Response:
Content-Type: application/json;charset=utf-8
json
{
"success": true,
"data": {
"tip": {
"slot": 141234567,
"epoch": 536,
"epoch_slot": 234567
},
"network": {
"era": "conway",
"name": "mainnet",
"sync_progress": 1
},
"params": {
"epoch_length": 432000,
"slot_length": 1
}
}
}Response Fields:
Tip Object
| Field | Type | Description |
|---|---|---|
slot | integer | Absolute slot number (use this for TTL calculation) |
epoch | integer | Current epoch number |
epoch_slot | integer | Slot number within the current epoch (0 to epoch_length-1) |
Network Object
| Field | Type | Description |
|---|---|---|
era | string | Current Cardano era (e.g., "conway", "babbage") |
name | string | Network name (e.g., "mainnet", "preprod", "preview") |
sync_progress | number | Node synchronization progress (0-1, where 1 = fully synced) |
Params Object
| Field | Type | Description |
|---|---|---|
epoch_length | integer | Number of slots per epoch (432000 for mainnet) |
slot_length | integer | Duration of each slot in seconds (1 for mainnet post-Shelley) |
Usage Example: Calculating Transaction TTL
Use the tip information to calculate a safe TTL for transactions:
javascript
const response = await fetch('/v1/epochs/latest', {
headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
});
const { data } = await response.json();
// Set TTL to 2 hours (7200 slots) from current tip
const ttl = data.tip.slot + 7200;
// Use this TTL when building your transaction
console.log(`Transaction TTL: ${ttl}`);