Are Bitcoin miners still making money?
Deephaven Data Labs8 min read·Just now--
Using Deephaven + AI to analyze why mining profitability just hit a wall
Bitcoin mining is in a weird place right now.
Last month, Bitfarms — one of North America’s largest mining operations — announced they’re exiting Bitcoin mining entirely by 2027. After posting a $46 million quarterly loss, they’re converting their data centers to AI infrastructure. Their CEO said the pivot could generate more income than Bitcoin mining ever did.
They’re not alone. For years, the math was simple: miners process transactions, earn block rewards, and as long as the Bitcoin they earn exceeds their electricity costs, they profit. Historically, this worked beautifully. The block reward was generous, Bitcoin’s price kept climbing, and miners printed money.
Two years ago, the April 2024 halving cut block rewards from 6.25 BTC to 3.125 BTC. Since then, network difficulty has hit repeated all-time highs while the block reward stays fixed. The squeeze has only gotten tighter — and now, a lot of miners are underwater.
Two years post-halving, hashprice has collapsed over 70%. Most home miners are now losing money on every hash.
Let’s use Deephaven and AI to dig into the numbers: what’s driving the collapse, and where’s your breakeven point?
The question
Here’s what we want to understand:
- How much revenue does a miner actually earn per unit of hashpower?
- How has that changed over time, especially post-halving?
- At what electricity price does mining become unprofitable?
We’ll answer these by connecting an AI agent to Deephaven, loading historical mining data, and asking questions in plain English. The agent writes the queries; we interpret the results.
“Are miners making money right now?” — That’s the question. The AI handles the analysis.
Setting up the data layer
First, let’s load historical Bitcoin mining data. We’ll use data from Blockchain.com and Hashrate Index, which provide metrics like hashrate, difficulty, miner revenue, and transaction fees.
from deephaven import read_csv
from deephaven import dtypes as dht
# Blockchain.com CSVs have no headers, so we define column names and types
col_defs = {"Timestamp": dht.string, "Value": dht.double}
# Load miner revenue directly from Blockchain.com (CSV format)
revenue_url = (
"https://api.blockchain.info/charts/miners-revenue?timespan=3years&format=csv"
)
miner_revenue = read_csv(revenue_url, headless=True, header=col_defs).view(
[
"Date = parseInstant(Timestamp.replace(` `, `T`) + `Z`)",
"MinerRevenue_USD = Value",
]
)
# Load network hashrate
hashrate_url = "https://api.blockchain.info/charts/hash-rate?timespan=3years&format=csv"
network_hashrate = read_csv(hashrate_url, headless=True, header=col_defs).view(
["Date = parseInstant(Timestamp.replace(` `, `T`) + `Z`)", "Hashrate_THs = Value"]
)Now let’s join these tables and calculate the key metric: hashprice — the revenue a miner earns per terahash per second per day. This is where Deephaven starts to pay off: the same join and calculation code works whether you’re analyzing two years of history or streaming live data.
# Join revenue and hashrate data
mining_data = miner_revenue.natural_join(network_hashrate, on="Date")
# Calculate hashprice: daily revenue per TH/s
mining_data = mining_data.update(["Hashprice_USD = MinerRevenue_USD / Hashrate_THs"])pConnecting MCP
With the data in Deephaven, we connect an AI agent via MCP (Model Context Protocol). This lets Claude or another agent query our tables directly — no export to CSV, no copying data into a chat window. The AI sees your actual tables and can run real queries against them.
from deephaven.mcp import Server
# Start MCP server
mcp_server = Server()
mcp_server.start()Now we can ask questions in plain English and get real analysis.
The conversation
“What’s the current hashprice compared to pre-halving?”
You: What’s the current hashprice compared to right before the halving? Show me the percentage change.
Claude’s response:p
I’ll compare the most recent hashprice to the value from just before the April 2024 halving.
# Get current hashprice
current = mining_data.tail(1).view(
["Current_Date = Date", "Current_Hashprice = Hashprice_USD"]
)
# Get pre-halving hashprice (last reading before April 20, 2024)
pre_halving = (
mining_data.where(
"Date >= parseInstant(`2024-04-01T00:00:00Z`) && Date < parseInstant(`2024-04-20T00:00:00Z`)"
)
.tail(1)
.view(["PreHalving_Date = Date", "PreHalving_Hashprice = Hashprice_USD"])
)
# Join and calculate percentage change
comparison = current.join(pre_halving).update(
[
"Pct_Change = (Current_Hashprice - PreHalving_Hashprice) / PreHalving_Hashprice * 100"
]
)Hashprice has collapsed by over 70% since the halving. Miners are earning far less than they were making for the same hashpower two years ago.
“When did the halving happen and what was the immediate impact?”
You: Show me hashprice before and after the April 2024 halving. What was the immediate impact?
Claude’s response:
from deephaven import agg
# Filter to halving period (April 2024)
halving_period = mining_data.where(
"Date >= parseInstant(`2024-04-01T00:00:00Z`) && Date <= parseInstant(`2024-05-01T00:00:00Z`)"
).sort("Date")
# Calculate pre/post halving averages
pre_halving = mining_data.where(
"Date >= parseInstant(`2024-03-15T00:00:00Z`) && Date < parseInstant(`2024-04-20T00:00:00Z`)"
).agg_by([agg.avg("Avg_Hashprice = Hashprice_USD")])
post_halving = mining_data.where(
"Date >= parseInstant(`2024-04-20T00:00:00Z`) && Date <= parseInstant(`2024-05-15T00:00:00Z`)"
).agg_by([agg.avg("Avg_Hashprice = Hashprice_USD")])The halving cut miner revenue per hashpower by about 43%, which aligns with the block reward dropping from 6.25 BTC to 3.125 BTC (the gap from 50% reflects transaction fee revenue, which wasn’t affected).
The halving cut hashprice by nearly half — exactly as designed.
“At what electricity price are miners losing money?”
You: If I’m running an Antminer S19 XP (140 TH/s, 3010W), at what electricity price do I start losing money?
Claude’s response:
Let me calculate the break-even electricity rate based on current hashprice.
# Mining rig specs
hashrate_ths = 140 # TH/s
power_watts = 3010 # W
hours_per_day = 24
# Current hashprice
current_hashprice = 0.043 # USD per TH/s per day
# Daily revenue
daily_revenue = hashrate_ths * current_hashprice
# Daily power consumption in kWh
daily_kwh = (power_watts * hours_per_day) / 1000
# Break-even electricity rate
breakeven_rate = daily_revenue / daily_kwh
print(f"Daily Revenue: ${daily_revenue:.2f}")
print(f"Daily Power: {daily_kwh:.1f} kWh")
print(f"Break-even Rate: ${breakeven_rate:.4f}/kWh")If you’re paying more than $0.08/kWh for electricity, you’re losing money on every hash you compute.
The average U.S. residential electricity rate? $0.12–0.16/kWh. That means most home miners in the U.S. are underwater right now.
“Show me the trend — is this getting better or worse?”
For visualizations, you don’t even need the AI. Deephaven’s chart builder lets you drag columns onto axes and see results instantly — no code required. But if you want the AI to prepare filtered data for plotting:
You: Filter hashprice to the last 6 months so I can chart it.
Claude’s response:
# Filter to last 6 months for visualization
recent_hashprice = mining_data.where("Date >= now() - 'PT4320H'").view(
["Date", "Hashprice_USD"]
)From there, right-click the table and select Chart Builder to visualize, or ask the AI follow-up questions to dig deeper.
Result:
The trend is clear: hashprice has been in steady decline since the halving, with occasional spikes during fee events (like ordinals or runes mints). But the baseline keeps dropping as more hashrate comes online while the block reward stays fixed.
“What would Bitcoin’s price need to be for miners to break even at $0.10/kWh?”
You: If electricity costs $0.10/kWh, what Bitcoin price would make mining profitable again?
Claude’s response:
# Current network metrics
current_difficulty = 156e12 # 156 trillion
block_reward_btc = 3.125
blocks_per_day = 144
network_hashrate_ths = 1.1e9 # 1.1 ZH/s = 1.1 billion TH/s
# Miner specs (S19 XP)
miner_hashrate = 140 # TH/s
miner_watts = 3010
electricity_cost = 0.10 # $/kWh
# Daily costs
daily_kwh = (miner_watts * 24) / 1000
daily_cost = daily_kwh * electricity_cost
# Miner's share of network hashrate
hashrate_share = miner_hashrate / network_hashrate_ths
# Daily BTC earned
daily_btc = block_reward_btc * blocks_per_day * hashrate_share
# Required BTC price for break-even
required_btc_price = daily_cost / daily_btc
print(f"Daily Cost: ${daily_cost:.2f}")
print(f"Daily BTC Earned: {daily_btc:.8f}")
print(f"Required BTC Price: ${required_btc_price:,.0f}")The bigger picture
Here’s what the data tells us:
- The halving worked exactly as designed. Miner revenue per hashpower dropped ~43% overnight.
- Hashprice is at multi-year lows. Miners now earn over 70% less than pre-halving.
- Only efficient miners survive. You need electricity under $0.08/kWh to be profitable with current hardware.
- Home mining is mostly dead. Residential electricity rates make small-scale mining a losing proposition.
- The squeeze continues. As more hashrate comes online, the pie gets divided into smaller slices.
This is why major mining companies are pivoting to AI and high-performance computing. The economics of pure Bitcoin mining are brutal right now.
Making it real-time
The analysis above uses historical data, but here’s the key insight: every query we wrote works identically on real-time data. Deephaven is data-agnostic — swap the static CSV for a live feed, and all your joins, aggregations, and calculations update automatically. No code changes required.
Here’s a live version using the same free Blockchain.com API:
from deephaven import function_generated_table, empty_table
import urllib.request
def fetch_current_metrics():
"""Fetch latest metrics from Blockchain.com (free, no API key)."""
revenue_url = (
"https://api.blockchain.info/charts/miners-revenue?timespan=1days&format=csv"
)
hashrate_url = (
"https://api.blockchain.info/charts/hash-rate?timespan=1days&format=csv"
)
with urllib.request.urlopen(revenue_url) as r:
revenue = float(r.read().decode().strip().split("\n")[-1].split(",")[1])
with urllib.request.urlopen(hashrate_url) as r:
hashrate = float(r.read().decode().strip().split("\n")[-1].split(",")[1])
hashprice = revenue / hashrate
return empty_table(1).update(
[
"Timestamp = now()",
f"Revenue_USD = (double){revenue}",
f"Hashrate_EH = (double){hashrate}",
f"Hashprice_USD = (double){hashprice}",
]
)
# Poll every 5 minutes - table ticks automatically
live_metrics = function_generated_table(
fetch_current_metrics, refresh_interval_ms=300_000
)Open live_metrics in Deephaven and watch it tick. Every downstream table, chart, or calculation that depends on it updates automatically — no refresh button, no polling loop. That's the Deephaven difference.
Note: The example above is ticking every 300ms to demonstrate the concept. In practice, you would set this to a more reasonable interval like 5 minutes.
Why this matters
Bitcoin mining is one of the most capital-intensive industries in crypto. Understanding the economics — in real-time — is critical for:
- Miners deciding whether to expand, hold, or shut down operations.
- Investors evaluating mining company stocks (MARA, RIOT, CLSK).
- Traders understanding selling pressure from miners who need to liquidate.
- Analysts forecasting network security and hash rate trends.
With Deephaven + MCP, the workflow is simple: load data once, ask questions forever. The AI queries your actual tables — not a stale export. When the data updates, so do the answers. No spreadsheets to rebuild, no dashboards to refresh manually.
The numbers don’t lie: mining profitability has never been tighter. The question is whether Bitcoin’s price will catch up before more miners capitulate.
Try it yourself
Want to run this analysis on your own data?
- Try the demo — no install required, runs in your browser.
- Install Deephaven — free and takes 5 minutes.
- Set up MCP — connect your AI agent.
- Load mining data — use the Blockchain.com API or your own data sources.
- Start asking questions — let the AI handle the query logic.
The crypto markets may be in a weird place, but at least now you can quantify exactly how weird.
Questions? Join our Slack community to discuss mining economics, share your analysis, or get help setting up your own crypto data pipeline.