# Block Times

## Contents

* [Time between blocks (time\_inter\_block )](#time_inter_block)
* [Time Since Last Block (time\_since\_last\_block)](#time_since_last_block)

## Time between blocks <a href="#time_inter_block" id="time_inter_block"></a>

**Definition**

The time elapsed between the block at the tip of the chain (the most recent block) and its predecessor.

**Dictionary**

| Name                | MetricID           | Unit    | Interval |
| ------------------- | ------------------ | ------- | -------- |
| Time between blocks | time\_inter\_block | seconds | 1 minute |

**Methodology**

The metric is computed as the time difference between the arrival of the block at the chain tip as seen by our nodes, and the arrival of the previous block.

**Available Assets**

Bitcoin (BTC), Ethereum (ETH)

**Sample Query**

{% embed url="<https://api.coinmetrics.io/v4/timeseries/asset-metrics?api_key=%3Cyour_key%3E&assets=btc&frequency=1m&limit_per_asset=1&metrics=time_inter_block&pretty=true>" %}

## Time Since Last Block <a href="#time_since_last_block" id="time_since_last_block"></a>

**Definition**

The time elapsed between the current time and the last block at the tip of the chain (the most recent block).

**Dictionary**

| Name                  | MetricID                 | Category | Sub-category     | Type  | Unit    | Interval |
| --------------------- | ------------------------ | -------- | ---------------- | ----- | ------- | -------- |
| Time since last block | time\_since\_last\_block | KRI      | Block Attributes | Delta | seconds | 1 minute |

**Methodology**

The metric is computed as the time difference between the arrival of the block at the chain tip as seen by our nodes, and the current time. As a timestamp for the block at the chain tip this metric uses the concept of miner\_time (for more on the differences between miner\_time and consensus\_time refer to our [wiki article](https://gitlab.com/coinmetrics/front-end/knowledge-base/-/blob/master/docs/on-chain-data/methodologies/on-chain-basics.md) on normalizing timestamps). For Bitcoin, miner\_time can be set arbitrarily by miners which can impact the value of this metric.

**Available Assets**

Bitcoin (BTC), Ethereum (ETH)

**Sample Query**

{% embed url="<https://api.coinmetrics.io/v4/timeseries/asset-metrics?api_key=%3Cyour_key%3E&assets=btc,eth&frequency=1m&limit_per_asset=1&metrics=time_since_last_block&pretty=true>" %}

## API Endpoints

Block time metrics can be accessed using these endpoints:

* `timeseries/asset-metrics`

and by passing in the metric ID's `time_*` in the `metrics` parameter.

{% openapi src="/files/kc3C7O6zTLYNBA0AcsZt" path="/timeseries/asset-metrics" method="get" %}
[openapi.yaml](https://2398817338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MO23j33wWGzm0NrZseN%2Fuploads%2Fgit-blob-a236d0d04b3b155748ce07a17aca8108fce9b7c2%2Fopenapi.yaml?alt=media)
{% endopenapi %}

{% tabs %}
{% tab title="Shell" %}

```shell
curl --compressed "https://api.coinmetrics.io/v4/timeseries/asset-metrics?metrics=time_inter_block&assets=btc&frequency=1m&pretty=true&api_key=<your_key>"
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
response = requests.get('https://api.coinmetrics.io/v4/timeseries/asset-metrics?metrics=time_inter_block&assets=btc&frequency=1m&pretty=true&api_key=<your_key>').json()
print(response)
```

{% endtab %}

{% tab title="Python Client" %}

```python
from coinmetrics.api_client import CoinMetricsClient

api_key = "<API_KEY>"
client = CoinMetricsClient(api_key)

print(
    client.get_asset_metrics(
        metrics="time_inter_block", 
        assets="btc",
    ).to_dataframe()
)
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gitbook-docs.coinmetrics.io/network-data/network-data-overview/kri/block-times.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
