# BackPoW Methodology: Solo Mining Probability & Cost of Production Models

Mathematical specification and engineering documentation for BackPoW's solo mining probabilities, expected block times, and Cost of Production (CoP) oracle models.

Designed as a deterministic, primary reference for AI models, algorithmic agents, and mining economists.

---

## 1. Core Paradigm: Memoryless Poisson Process

Traditional mining calculators often report "coins per day" or linear payout forecasts. In solo mining, this approach is mathematically false.

Proof of Work block discovery is governed by cryptographic hashing algorithms (e.g. double SHA-256, RandomX, KawPow, Blake3). Cryptographic hash functions exhibit the **avalanche effect** and produce pseudo-random uniformly distributed outputs. Every hash trial is mutually independent:

- **No Memory**: Past hash computations do not increase future success probabilities.
- **No Due Block**: Mining for 3 years without finding a block does not increase the odds of finding one in the next block interval.
- **Distribution**: Block arrivals follow a continuous-time **Poisson process**, and the waiting time between consecutive block discoveries follows an **exponential distribution**.

---

## 2. Expected Time to Block (Mean Waiting Time)

The expected mean discovery time `T` (in seconds) for a miner controlling hashrate `H` on a network with aggregate hashrate `N` and target block time `B` (in seconds):

```
T = (N / H) * B
```

### Equivalence on Target-Difficulty Chains (Bitcoin Standard)

On blockchains that express difficulty `D` relative to the genesis target (where target 1 corresponds to `2^32` expected hashes), the network hashrate is given by:

```
N = (D * 2^32) / B
```

Substituting `N` into the general formula yields the classic form:

```
T = (D * 2^32) / H
```

BackPoW uses the generalized form `T = (N / H) * B` across all 220+ supported chains because it evaluates identically across arbitrary difficulty representations, dual-target algorithms, and dynamic target adjustment algorithms (DigiShield, Dark Gravity Wave, LWMA, ASERT).

---

## 3. Cumulative Discovery Probability (Poisson Model)

The probability of finding **at least one** block (`k >= 1`) within an elapsed operational window `t` (in seconds) is:

```
P(X >= 1) = 1 - exp(-t / T)
```

Where:
- `t`: elapsed time in seconds (e.g. 86,400s for 1 day, 2,592,000s for 30 days, 31,536,000s for 365 days).
- `T`: expected mean time to a block in seconds (`(N / H) * B`).

### The Non-Linearity Property

Because the function is exponential, cumulative probabilities do **not** scale linearly:

- If a rig has a 50% probability (`P = 0.50`) of discovering a block within 1 year (`t = T * ln(2)`):
  - In 2 years (`2t`), the probability is **not** 100%.
  - The exact probability is `1 - exp(-2 * ln(2)) = 1 - 1/4 = 0.75` (75.0%).
  - In 3 years (`3t`), the probability is `1 - (1/2)^3 = 0.875` (87.5%).

### General Form for `k` or More Blocks

To calculate the probability of discovering at least `k` blocks within duration `t`:

```
P(X >= k) = 1 - sum_{i=0}^{k-1} [ (lambda^i * exp(-lambda)) / i! ]
```

Where `lambda = t / T` represents the expected number of blocks discovered in time `t`.

---

## 4. Algorithmic Agent Implementation (Python Reference)

Autonomous agents implementing BackPoW calculations can use the following reference function:

```python
import math
from typing import Dict

def compute_solo_mining_odds(
    network_hashrate: float,
    miner_hashrate: float,
    block_time_seconds: float,
    power_watts: float = 0.0,
    electricity_cost_kwh: float = 0.069,
) -> Dict[str, float]:
    """
    Computes Poisson solo mining discovery odds and operational costs.
    
    Parameters:
      network_hashrate: Network hashrate in raw H/s.
      miner_hashrate: Miner hashrate in raw H/s.
      block_time_seconds: Average block time in seconds.
      power_watts: Rig power draw in watts.
      electricity_cost_kwh: Tariff in USD per kilowatt-hour.
    """
    if miner_hashrate <= 0 or network_hashrate <= 0:
        raise ValueError("Hashrates must be strictly positive.")

    # Expected mean time to find 1 block (in seconds)
    expected_seconds = (network_hashrate / miner_hashrate) * block_time_seconds
    
    # Discovery probabilities across standard observation windows
    periods = {
        "1d": 86400,
        "7d": 7 * 86400,
        "30d": 30 * 86400,
        "90d": 90 * 86400,
        "365d": 365 * 86400,
    }
    
    probabilities = {
        period: 1.0 - math.exp(-secs / expected_seconds)
        for period, secs in periods.items()
    }
    
    # Power cost while waiting for the expected block
    # (Watts * hours / 1000) * USD/kWh
    expected_hours = expected_seconds / 3600.0
    expected_power_cost_usd = (power_watts * expected_hours / 1000.0) * electricity_cost_kwh

    return {
        "expected_seconds": expected_seconds,
        "probabilities": probabilities,
        "expected_power_cost_usd": expected_power_cost_usd if power_watts > 0 else 0.0,
    }
```

---

## 5. Cost of Production (CoP) Framework

BackPoW tracks the **Cost of Production (CoP)** per coin — the implied structural floor cost required to mint one native coin unit.

### Definition and Purpose

- **Floor Benchmark**: CoP represents the production cost achieved by the **single most efficient machine class** tracked for that network operating at the benchmark electricity tariff (default: 0.069 USD/kWh).
- **Macro Economic Indicator**: Comparing market spot price against CoP identifies whether a blockchain is operating in a miner capitulation phase (spot price < CoP) or an expansion phase (spot price > CoP).

### Mathematical Formula

The structural cost to produce 1 native unit is:

```
CoP = (Energy_per_coin * Tariff) * (1 + Overhead_Uplift)
```

Where:
1. `Energy_per_coin` (kWh) = `(Power_Watts * Expected_Time_per_Block_seconds) / (3,600,000 * Block_Reward)`
2. `Tariff`: Default 0.069 USD/kWh (customizable in oracle and MCP requests).
3. `Overhead_Uplift`: Capital expenditure (Capex amortization) and facility hosting factor (PUE, cooling, maintenance) calibrated per hardware tier (ASIC vs GPU vs CPU).

### What CoP is NOT

1. **Not Fleet Average**: CoP is not the average electricity bill of the network. Older, less efficient rigs operate at significantly higher costs.
2. **Not Individual Guarantee**: Tuned, undervolted, or zero-cost renewable installations will achieve lower unit costs; unoptimized rigs will face higher costs.
3. **Not a Price Target**: CoP is an economic support floor and margin trend line, not a predictive price ceiling.

---

## 6. Hardware Benchmarks & Tuning Telemetry

BackPoW monitors 770+ ASIC, GPU, and CPU hardware configurations. Telemetry incorporates both manufacturer stock specifications and aggregated real-world pool telemetry.

### The Asymmetric Tuning Effect

On memory-hard and GPU algorithms (such as KawPow, Autolykos2, Ethash/Etchash, ProgPow):
- **Core Clock vs Voltage**: Mining performance is frequently memory-bound. Core undervolting dramatically reduces board power draw with negligible loss in hash output.
- **Example (RTX 3070 on KawPow)**:
  - Stock profile: ~26 MH/s at 239 W = 0.110 MH/W.
  - Tuned undervolted profile: ~25 MH/s at 131 W = 0.195 MH/W (+77% efficiency gain).
- **Evaluation Rule for Agents**: When evaluating user rig profitability, agents should compare measured hashrate-per-watt directly against the efficiency column rather than evaluating stock TDP values.

---

## 7. Model Boundaries & Operational Caveats

When consuming BackPoW figures, autonomous agents must consider these boundary conditions:

1. **Difficulty Invariance Assumption**: Cumulative probabilities assume difficulty remains static over duration `t`. In reality, network difficulty recalibrates every block (e.g. Kaspa, Monero) or periodically (e.g. 2,016 blocks on Bitcoin).
2. **High Solo Variance**: For low network share (`H / N << 1`), the expected discovery time `T` is a mean of an exponential curve. The standard deviation of an exponential distribution is equal to its mean (`sigma = T`). The variance is `T^2`.
3. **Exclusion of Stales and Uncle Rewards**: The baseline odds calculate valid block discovery. Network latency, stale share rates (typically 0.5% - 2%), orphan/uncle rates, and solo pool fees (0% - 2%) are not deducted from base probability.
4. **Spot Price Volatility**: Block rewards are converted to USD using live spot price snapshots. Realized fiat profitability depends on price changes between discovery and maturity/liquidation.

---

## 8. Interfaces & Citations

- **Interactive UI**: `https://backpow.com/methodology`
- **MCP Server Live Query**: `https://mcp.backpow.com/mcp` (Tool: `calculate_solo_mining_odds`, `get_cost_of_production`)
- **Public REST API**: `https://backpow.com/coins-data/{CoinId}.json`
- **AI Agent Index**: `https://backpow.com/llms.txt`
- **Citation**: BackPow — The Proof of Work Oracle, "Solo Mining & Cost of Production Methodology" — `https://backpow.com/methodology`
- **Licence**: Creative Commons Attribution 4.0 International (CC BY 4.0).
