# blocks-until-next-epoch (/docs/query/blocks-until-next-epoch)

Derived from the chain's own `next_epoch_start_block` at one pinned block.
The actual fire can shift by a few blocks (per-block epoch cap defers,
owner triggers pull earlier) — to act on the epoch itself, use
`client.wait_for_epoch()`.

**Category:** Epochs & timing

## Parameters [#parameters]

| Parameter | Type    | Description      |
| --------- | ------- | ---------------- |
| `netuid`  | integer | Subnet to query. |

## CLI [#cli]

```bash
btcli query blocks-until-next-epoch --netuid <integer> --json
```

## Python [#python]

```python
import bittensor as sub

async with sub.Client("finney") as client:
    result = await client.read("blocks_until_next_epoch", netuid=1)
```
