> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cosmos.network/llms.txt
> Use this file to discover all available pages before exploring further.

# Epochs

> gRPC queries and transaction messages defined by the epochs module in Cosmos SDK v0.55.

<Info>
  Generated from [`cosmos/cosmos-sdk@2086680ff8b0`](https://github.com/cosmos/cosmos-sdk/tree/2086680ff8b08fd269ee653e087ea577bab79534/proto) on ref `release/v0.55.x`.
</Info>

## Queries

A node exposes only the services its application registers:

* gRPC on port 9090
* REST on port 1317, if the method has an HTTP binding

Run `grpcurl -plaintext localhost:9090 list` to see what a node serves.

Queries are read-only and never pass through consensus. See [Queries](/sdk/latest/learn/concepts/transactions#queries).

Replace `<string>` placeholders with real values and omit unused filters. Payloads use protobuf JSON, and some `string` fields accept enum constants listed under Types. Field tables give the encoding each value takes.

Examples assume a local node. For TLS endpoints, use port 443 and omit `-plaintext`. See [gRPC services](/sdk/latest/api-reference/grpc/index) for reflection, address formats, and decimal encoding.

### CurrentEpoch

CurrentEpoch provide current epoch of specified identifier

|      |                                            |
| ---- | ------------------------------------------ |
| gRPC | `cosmos.epochs.v1beta1.Query/CurrentEpoch` |
| REST | `GET /cosmos/epochs/v1beta1/current_epoch` |

Request `QueryCurrentEpochRequest`:

| Field        | Type     | Description |
| ------------ | -------- | ----------- |
| `identifier` | `string` |             |

Response `QueryCurrentEpochResponse`:

| Field           | Type    | Description |
| --------------- | ------- | ----------- |
| `current_epoch` | `int64` |             |

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
grpcurl -plaintext -d '{"identifier":"<string>"}' \
  localhost:9090 cosmos.epochs.v1beta1.Query/CurrentEpoch
```

### EpochInfos

EpochInfos provide running epochInfos

|      |                                          |
| ---- | ---------------------------------------- |
| gRPC | `cosmos.epochs.v1beta1.Query/EpochInfos` |
| REST | `GET /cosmos/epochs/v1beta1/epochs`      |

Request `QueryEpochInfosRequest`:

This message has no fields.

Response `QueryEpochInfosResponse`:

| Field    | Type                                               | Description |
| -------- | -------------------------------------------------- | ----------- |
| `epochs` | [`EpochInfo`](#cosmos-epochs-v1beta1-epochinfo)\[] |             |

```bash theme={"theme":{"light":"github-light-high-contrast","dark":"github-dark-high-contrast"}}
grpcurl -plaintext localhost:9090 cosmos.epochs.v1beta1.Query/EpochInfos
```

## Types

Messages referenced by the fields above. Protocol buffers version 3 has no required fields, so every field is optional on the wire, and a `[]` suffix marks a repeated field.

### cosmos.epochs.v1beta1.EpochInfo

EpochInfo is a struct that describes the data going into a timer defined by the x/epochs module.

| Field                        | Type        | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ---------------------------- | ----------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `identifier`                 | `string`    | identifier is a unique reference to this particular timer.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `start_time`                 | `Timestamp` | start\_time is the time at which the timer first ever ticks. If start\_time is in the future, the epoch will not begin until the start time.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `duration`                   | `Duration`  | duration is the time in between epoch ticks. In order for intended behavior to be met, duration should be greater than the chains expected block time. Duration must be non-zero.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `current_epoch`              | `int64`     | current\_epoch is the current epoch number, or in other words, how many times has the timer 'ticked'. The first tick (current\_epoch=1) is defined as the first block whose blocktime is greater than the EpochInfo start\_time.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `current_epoch_start_time`   | `Timestamp` | current\_epoch\_start\_time describes the start time of the current timer interval. The interval is (current\_epoch\_start\_time, current\_epoch\_start\_time + duration] When the timer ticks, this is set to current\_epoch\_start\_time = last\_epoch\_start\_time + duration only one timer tick for a given identifier can occur per block. NOTE! The current\_epoch\_start\_time may diverge significantly from the wall-clock time the epoch began at. Wall-clock time of epoch start may be >> current\_epoch\_start\_time. Suppose current\_epoch\_start\_time = 10, duration = 5. Suppose the chain goes offline at t=14, and comes back online at t=30, and produces blocks at every successive time. (t=31, 32, etc.) \* The t=30 block will start the epoch for (10, 15] \* The t=31 block will start the epoch for (15, 20] \* The t=32 block will start the epoch for (20, 25] \* The t=33 block will start the epoch for (25, 30] \* The t=34 block will start the epoch for (30, 35] \* The **t=36** block will start the epoch for (35, 40] |
| `epoch_counting_started`     | `bool`      | epoch\_counting\_started is a boolean, that indicates whether this epoch timer has began yet.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `current_epoch_start_height` | `int64`     | current\_epoch\_start\_height is the block height at which the current epoch started. (The block height at which the timer last ticked)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
