# What Is the `pflops` Metric in Amadeus Protocol? Network Compute Capacity Explained

> Understand the pflops metric in Amadeus Protocol. Learn how it estimates network compute capacity in petaflops from solver scores difficulty and epoch time. Optimize your node.

- Repository: [Amadeus Protocol/node](https://github.com/amadeusprotocol/node)
- Tags: deep-dive
- Published: 2026-08-20

---

**`pflops` in Amadeus Protocol estimates the network's total compute capacity in petaflops (10¹⁵ floating‑point operations per second), calculated from solver scores, difficulty, and elapsed epoch time.**

The `pflops` metric provides operators, block explorers, and monitoring systems with a real‑time view of the effective computational power securing the Amadeus network. Derived from on‑chain data, this chain‑level statistic bridges protocol internals with observable infrastructure metrics through both JSON and Prometheus interfaces.

## How the `pflops` Metric Is Computed

The core calculation resides in [`ex/lib/api/api_chain.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/api/api_chain.ex), implemented as the `pflops/1` function. This Elixir function derives the network's floating‑point performance from four key inputs:

```elixir
def pflops(height) do
  # A*B = C  M = 16  K = 50240  N = 16  u8xi8 = i32

  height_in_epoch = rem(height, 100_000)

  total_score = API.Epoch.score()
                |> Enum.map(&Enum.at(&1, 1))
                |> Enum.sum()

  diff_multiplier = Bitwise.bsl(1, API.Epoch.get_diff_bits())
  total_calcs    = total_score * diff_multiplier      # (A·B)

  macs = 16 * 16 * 50240
  ops  = macs * 2                                   # MACs × 2 → FLOPs per calculation

  seconds = height_in_epoch * 0.5 + 1               # 0.5 s per block + 1 s safety margin

  ((total_calcs * ops) / seconds) / 1.0e15         # → petaflops

end

```

### Breakdown of Calculation Parameters

- **`total_score`** – Sum of all solver scores for the current epoch, retrieved via `API.Epoch.score/0`.
- **`diff_multiplier`** – Difficulty scaling factor (`2^difficulty_bits`), computed using `Bitwise.bsl/2` against `API.Epoch.get_diff_bits/0`.
- **`ops`** – Floating‑point operations per basic calculation. The constant `macs = 16 * 16 * 50240` represents multiply‑accumulate operations, doubled to convert to FLOPs.
- **`seconds`** – Estimated elapsed epoch time: `height_in_epoch * 0.5 + 1`, assuming 0.5 seconds per block with a 1‑second safety margin.

The final formula divides total FLOPs by elapsed seconds, then scales by `1.0e15` to produce the petaflop estimate.

## Accessing the `pflops` Metric in Amadeus Protocol

The metric is exposed through two primary interfaces, enabling integration with diverse tooling stacks.

### HTTP API (JSON)

Query the public endpoint for real‑time inspection:

```bash
curl https://<node-host>/api/chain/stats | jq .pflops

```

Returns the current petaflop estimate as a floating‑point number.

### Prometheus Metrics Endpoint

Scrape `http://<node-host>/metrics/stats` for observability pipeline integration. The metric appears as defined in [`ex/lib/http/prometheus.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/http/prometheus.ex):

```elixir

# HELP amadeus_pflops Estimated network petaflops

# TYPE amadeus_pflops gauge

amadeus_pflops #{format_float(stats.pflops)}

```

This gauge can be graphed directly in Grafana or consumed by any Prometheus‑compatible monitoring system.

### Direct Elixir Invocation

For local calculation or testing, call the internal function:

```elixir
iex> Amadeus.API.Chain.pflops(1_234_567)
123.45  # petaflops

```

This invokes the same implementation used by the node's public interfaces.

## Source Code Reference

The `pflops` metric flows through these key files in the `amadeusprotocol/node` repository:

- **[`ex/lib/api/api_chain.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/api/api_chain.ex)** (lines 129‑140) – Implements `pflops/1` and injects the value into `API.Chain.stats/0`.
- **[`ex/lib/http/prometheus.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/http/prometheus.ex)** (lines 49‑52) – Exposes `amadeus_pflops` as a Prometheus gauge.
- **[`ex/lib/http/multiserver.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/http/multiserver.ex)** (lines 265‑294) – Routes `/metrics/stats` and `/api/chain/stats` to the statistics handlers.
- **[`ex/lib/epoch/epoch.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/epoch/epoch.ex)** – Provides `API.Epoch.score/0` and `API.Epoch.get_diff_bits/0`, the underlying data sources for the calculation.

## Summary

- **`pflops` represents network compute capacity in petaflops**, derived from solver activity and protocol difficulty.
- **Calculation depends on four variables**: total epoch score, difficulty multiplier, per‑calculation FLOPs constant, and elapsed time estimate.
- **Dual exposure**: JSON via `/api/chain/stats` and Prometheus via `/metrics/stats`.
- **Core implementation** in [`ex/lib/api/api_chain.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/api/api_chain.ex) with routing in [`ex/lib/http/multiserver.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/http/multiserver.ex).

## Frequently Asked Questions

### What does a higher `pflops` value indicate in Amadeus Protocol?

A higher `pflops` reading signals increased computational participation from solvers in the current epoch. Since the metric scales with both `total_score` and `diff_multiplier`, rising values typically reflect either more active solvers, higher difficulty settings, or faster block production relative to the 0.5‑second target.

### How accurate is the `pflops` estimate compared to actual hardware performance?

The `pflops` metric is a protocol‑level approximation, not a hardware benchmark. It assumes theoretical FLOP counts based on fixed MAC dimensions (`16×16×50240`) and a consistent 0.5‑second block time. Real‑world efficiency varies by solver hardware, implementation optimizations, and network latency.

### Can I use `pflops` for difficulty adjustment decisions?

While `pflops` correlates with network security, the Amadeus Protocol uses separate mechanisms for difficulty targeting. The metric is informational—designed for monitoring rather than consensus‑critical adjustments. Examine `API.Epoch.get_diff_bits/0` and related epoch logic for the actual difficulty algorithm.

### Why is the block time assumption set to 0.5 seconds?

The 0.5‑second constant reflects Amadeus Protocol's target block time. The `+ 1` safety margin prevents division by near‑zero values at epoch start. These are implementation choices in [`ex/lib/api/api_chain.ex`](https://github.com/amadeusprotocol/node/blob/main/ex/lib/api/api_chain.ex) that prioritize stability over precision during early‑epoch measurement windows.