What Is the `pflops` Metric in Amadeus Protocol? Network Compute Capacity Explained
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, implemented as the pflops/1 function. This Elixir function derives the network's floating‑point performance from four key inputs:
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 viaAPI.Epoch.score/0.diff_multiplier– Difficulty scaling factor (2^difficulty_bits), computed usingBitwise.bsl/2againstAPI.Epoch.get_diff_bits/0.ops– Floating‑point operations per basic calculation. The constantmacs = 16 * 16 * 50240represents 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:
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:
# 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:
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(lines 129‑140) – Implementspflops/1and injects the value intoAPI.Chain.stats/0.ex/lib/http/prometheus.ex(lines 49‑52) – Exposesamadeus_pflopsas a Prometheus gauge.ex/lib/http/multiserver.ex(lines 265‑294) – Routes/metrics/statsand/api/chain/statsto the statistics handlers.ex/lib/epoch/epoch.ex– ProvidesAPI.Epoch.score/0andAPI.Epoch.get_diff_bits/0, the underlying data sources for the calculation.
Summary
pflopsrepresents 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/statsand Prometheus via/metrics/stats. - Core implementation in
ex/lib/api/api_chain.exwith routing inex/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 that prioritize stability over precision during early‑epoch measurement windows.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →