# Transaction Fees

## Contents

* [Block Maximum Fees (block\_fee\_max)](#block_fee_max)
* [Block Mean Fees (block\_fee\_mean)](#block_fee_mean)
* [Block Median Fees (block\_fee\_median)](#block_fee_median)
* [Block Minimum Fees (block\_fee\_min)](#block_fee_min)
* [Miner Fees per Block (block\_fees)](#block_fees)

## Block Maximum Fees <a href="#block_fee_max" id="block_fee_max"></a>

**Definition**

Mined block's max transaction fee in native units.

**Dictionary**

<table data-header-hidden><thead><tr><th width="165"></th><th width="210"></th><th width="107"></th><th></th></tr></thead><tbody><tr><td>Name</td><td>MetricID</td><td>Unit</td><td>Interval</td></tr><tr><td>Block Maximum Fees</td><td>block_fee_max</td><td>Native Currency</td><td>1 block</td></tr></tbody></table>

**Methodology**

The most recently-mined block is evaluated and the maximum of fees in that block is computed.

**Available Assets**

Bitcoin (BTC)

**Sample Query**

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

## Block Mean Fees <a href="#block_fee_mean" id="block_fee_mean"></a>

**Definition**

Mined block's mean transaction fee in native units.

**Dictionary**

<table data-header-hidden><thead><tr><th width="165"></th><th width="210"></th><th width="107"></th><th></th></tr></thead><tbody><tr><td>Name</td><td>MetricID</td><td>Unit</td><td>Interval</td></tr><tr><td>Block Mean Fees</td><td>block_fee_mean</td><td>Native Currency</td><td>1 block</td></tr></tbody></table>

**Methodology**

The most recently-mined block is evaluated and the mean of fees in that block is computed.

**Available Assets**

Bitcoin (BTC)

**Sample Query**

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

## Block Median Fees <a href="#block_fee_median" id="block_fee_median"></a>

**Definition**

Mined block's median transaction fee in native units.

**Dictionary**

<table data-header-hidden><thead><tr><th width="165"></th><th width="210"></th><th width="107"></th><th></th></tr></thead><tbody><tr><td>Name</td><td>MetricID</td><td>Unit</td><td>Interval</td></tr><tr><td>Block Median Fees</td><td>block_fee_median</td><td>Native Currency</td><td>1 block</td></tr></tbody></table>

**Methodology**

The most recently-mined block is evaluated and the median of fees in that block is computed.

**Available Assets**

Bitcoin (BTC)

**Sample Query**

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

## Block Minimum Fees <a href="#block_fee_min" id="block_fee_min"></a>

**Definition**

Mined block's minimum transaction fee in native units.

**Dictionary**

<table data-header-hidden><thead><tr><th width="165"></th><th width="210"></th><th width="107"></th><th></th></tr></thead><tbody><tr><td>Name</td><td>MetricID</td><td>Unit</td><td>Interval</td></tr><tr><td>Block Minimum Fees</td><td>block_fee_min</td><td>Native Currency</td><td>1 block</td></tr></tbody></table>

**Methodology**

The most recently-mined block is evaluated and the minimum of fees in that block is computed.

**Available Assets**

Bitcoin (BTC)

**Sample Query**

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

## Miner Fees per Block <a href="#block_fees" id="block_fees"></a>

**Definition**

The sum of fees paid to miners for the transactions included in each mined block.

**Dictionary**

| Name                 | MetricID    | Unit       | Interval |
| -------------------- | ----------- | ---------- | -------- |
| Miner Fees per block | block\_fees | Difficulty | 1 block  |

**Methodology**

The most recently-mined block is evaluated and the sum of fees in that block is computed.

**Available Assets**

Bitcoin (BTC), *Ethereum (ETH)\**

*\* Historical data covering the pre-merge timeframe only (up to 9/15/2022). With the merge ETH switched from Proof of Work and miners to Proof of Stake and validators meaning the miner fees per block are non-existent post the merge date for Ethereum.*

**Sample Query**

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

## API Endpoints

metrics can be accessed using these endpoints:

* `timeseries/asset-metrics`

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

{% openapi src="<https://2398817338-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MO23j33wWGzm0NrZseN%2Fuploads%2Fgit-blob-1522f16027d90845f8750dd9c51c03b8e7aab67f%2Fopenapi.yaml?alt=media>" 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-1522f16027d90845f8750dd9c51c03b8e7aab67f%2Fopenapi.yaml?alt=media)
{% endopenapi %}

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

```shell
curl --compressed "https://api.coinmetrics.io/v4/timeseries/asset-metrics?metrics=block_fees&assets=btc&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=block_fees&assets=btc&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="block_fees", 
        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/transaction-fees.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.
