{
  "schemaVersion": 1,
  "slug": "crypto-mining-calculator",
  "category": "crypto",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "e6332306aa462c3b4f7f2a1348db000fe30e937e2ca1dcf59693d7bdc00a4dee",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/crypto-mining-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "P = (H ÷ N) × R × (1 − f ÷ 100) × C − k",
    "vars": [
      [
        "H",
        "Your hashrate"
      ],
      [
        "N",
        "Network hashrate"
      ],
      [
        "R",
        "Block reward × blocks per day"
      ],
      [
        "f",
        "Pool fee (%)"
      ],
      [
        "C",
        "Coin price"
      ],
      [
        "k",
        "Daily electricity = kW × 24 × rate"
      ]
    ],
    "note": "Both hashrates are TH/s. At the rounded 900,000,000 TH/s reference, the default 100 TH/s miner has a 1/9,000,000 share. Break-even days = hardware cost ÷ daily profit only when daily profit > 0; otherwise no finite payback is shown. Network rate is editable, not live. Transaction fees and operating costs beyond electricity are excluded."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const empty={dailyRevenue:null,dailyElectricity:null,dailyProfit:null,monthlyProfit:null,breakEvenDays:null,shareOfNetwork:null,verdict:null};const vals=[hashrate,networkHashrate,blockReward,blocksPerDay,coinPrice,powerDraw,electricityRate,poolFee,hardwareCost].map(Number);if(vals.some(v=>!Number.isFinite(v))||hashrate<0||networkHashrate<=0||blockReward<0||blocksPerDay<=0||coinPrice<0||powerDraw<0||electricityRate<0||poolFee<0||poolFee>20||hardwareCost<0)return{...empty,__error:'inputError'};const share=hashrate/networkHashrate,coinsPerDay=share*blockReward*blocksPerDay*(1-poolFee/100),revenue=coinsPerDay*coinPrice,power=powerDraw/1000*24*electricityRate,profit=revenue-power;if(![share,coinsPerDay,revenue,power,profit].every(Number.isFinite))return{...empty,__error:'inputError'};const breakEvenDays=profit>0?hardwareCost/profit:'Not reachable at current daily profit';if(typeof breakEvenDays==='number'&&!Number.isFinite(breakEvenDays))return{...empty,__error:'inputError'};return{dailyRevenue:revenue,dailyElectricity:power,dailyProfit:profit,monthlyProfit:profit*30,breakEvenDays,shareOfNetwork:share*100,verdict:profit<=0?'Unprofitable at this electricity price':hardwareCost/profit>1000?'Marginal — over three years to break even':'Profitable on these assumptions'};",
    "inputs": [
      {
        "name": "hashrate",
        "type": "number",
        "default": 100,
        "min": 0.0001,
        "max": 10000000,
        "step": 0.0001
      },
      {
        "name": "networkHashrate",
        "type": "number",
        "default": 900000000,
        "min": -1,
        "max": 1000000000,
        "step": 0.001
      },
      {
        "name": "blockReward",
        "type": "number",
        "default": 3.125,
        "min": 0,
        "max": 1000000,
        "step": 0.0001
      },
      {
        "name": "blocksPerDay",
        "type": "number",
        "default": 144,
        "min": 0.001,
        "max": 100000,
        "step": 0.001
      },
      {
        "name": "coinPrice",
        "type": "number",
        "default": 60000,
        "min": 0,
        "max": 10000000,
        "step": 0.01
      },
      {
        "name": "powerDraw",
        "type": "number",
        "default": 3250,
        "min": 0,
        "max": 100000,
        "step": 10
      },
      {
        "name": "electricityRate",
        "type": "number",
        "default": 0.08,
        "min": 0,
        "max": 10,
        "step": 0.001
      },
      {
        "name": "poolFee",
        "type": "number",
        "default": 2,
        "min": 0,
        "max": 20,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "hardwareCost",
        "type": "number",
        "default": 4000,
        "min": 0,
        "max": 10000000,
        "step": 10
      }
    ],
    "outputs": [
      {
        "name": "dailyRevenue",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "dailyElectricity",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "dailyProfit",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "monthlyProfit",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "breakEvenDays",
        "precision": 0,
        "unit": "days",
        "type": "text"
      },
      {
        "name": "shareOfNetwork",
        "precision": 6,
        "unit": "%"
      },
      {
        "name": "verdict",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
