# Transactions

## Contents

* [Transactions in Block (block\_tx\_count)](#block_tx_count)
* [Mempool Transaction Count (mempool\_count)](#mempool_count)
* [Transaction Count Entered Mempool 1 Minute (mempool\_count\_entered\_1m)](#block_tx_count)

## Transactions in Block <a href="#block_tx_count" id="block_tx_count"></a>

**Definition**

The count of all transactions within the most recent block processed.

**Dictionary**

| Name                  | MetricID         | Unit                  | Interval |
| --------------------- | ---------------- | --------------------- | -------- |
| Transactions in Block | block\_tx\_count | Count of transactions | 1b       |

**Methodology**

The most recent block we processed within a 1-minute window is evaluated and the number of transactions within the block are counted. For UTXO based currencies, this includes the coinbase transaction.

**Available Assets**

Bitcoin (BTC), Ethereum (ETH)

**Sample Query**

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

## Mempool Transaction Count <a href="#mempool_count" id="mempool_count"></a>

**Definition**

The count of all mempool transactions at a point in time.

**Dictionary**

| Name                      | MetricID       | Unit        | Interval |
| ------------------------- | -------------- | ----------- | -------- |
| Mempool Transaction Count | mempool\_count | Transaction | 1m       |

**Methodology**

The mempool is evaluated and all transactions indexed. All unprocessed mempool transactions at a point in time are then counted.

**Available Assets**

Bitcoin (BTC)

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=mempool_count&pretty=true>" %}

## Transaction Count Entered Mempool 1 Minute <a href="#mempool_count_entered" id="mempool_count_entered"></a>

**Definition**

The count of all transactions that have entered the mempool over the course of a 1-minute aggregation window. The beginning of this time window is noted in the “time” field of the response.

**Dictionary**

| Name                                       | MetricID                    | Unit        | Interval |
| ------------------------------------------ | --------------------------- | ----------- | -------- |
| Transaction Count entered mempool 1 minute | mempool\_count\_entered\_1m | Transaction | 1m       |

**Methodology**

The mempool is evaluated and all transactions that have been entered (new transactions broadcasted by users) since a point in time are counted.

**Available Assets**

Bitcoin (BTC)

**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=mempool_count_entered_1m&pretty=true>" %}

## API Endpoints

Transactions metrics can be accessed using these endpoints:

* `timeseries/asset-metrics`

and by passing in the metric ID's `block_tx_count*` and `mempool_count_*` 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=block_tx_count&assets=btc&frequency=1b&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_tx_count&assets=btc&frequency=1b&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_tx_count", 
        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/transactions.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.
