OPEN-SOURCE SCRIPT
HashCost - Bitcoin Mining Cost

HashCost estimates the electricity or hosting energy cost of producing one Bitcoin using a user-defined mining fleet.
Unlike a generic network-wide mining-cost model, HashCost is built around the miner's own operating history. Users enter dated fleet configurations containing effective hashrate, average paid power, electricity cost, and pool fee. Each configuration takes effect on its specified date, while previous configurations remain intact, allowing the plotted production-cost history to reflect changes in the user's mining setup over time.
HOW IT WORKS
HashCost combines the active fleet configuration with Bitcoin network difficulty and block subsidy data to estimate the expected BTC production per day.
Production Cost = Daily Paid Energy Cost / Expected Net BTC per Day
The model uses:
- Effective hashrate in TH/s
- Average paid power in kW
- Electricity or hosting-energy rate in USD/kWh
- Pool fee
- Bitcoin network difficulty
- Bitcoin block subsidy
Effective hashrate and paid power are entered as 24-hour averages. This makes it possible to represent miners who operate for only part of each day.
For example, a 300 TH/s miner consuming 6 kW for 8 hours per day can be represented as:
100 TH/s effective hashrate
2 kW average paid power
FLEET HISTORY
Each line represents one complete mining configuration:
YYYY-MM-DD | Effective TH/s | Avg Paid kW | $/kWh | Pool %
Example:
2026-01-01 | 1000 | 20 | 0.05 | 1
Add a new line whenever the mining setup changes. Keep previous lines in chronological order from oldest to newest.
HashCost preserves those historical configurations rather than retroactively applying the latest settings to the entire chart.
NETWORK DATA
Bitcoin difficulty and block-height data are sourced from Glassnode's crypto metrics on TradingView.
HashCost checks the freshness of the underlying network data and fails closed if the selected source becomes stale rather than silently continuing to calculate with outdated forward-filled values.
INFO PANEL
BTC Cost
Estimated energy production cost of one BTC.
BTC vs Cost
Percentage difference between current BTC market price and estimated production cost.
BTC / Day
Expected net BTC production per day after the entered pool fee.
Cost / Day
Average paid electricity or hosting energy cost per day.
Eff. Hashrate
Effective 24-hour mining hashrate.
SCOPE AND LIMITATIONS
HashCost is an electricity/hosting-energy operating-cost model. It is not an all-in accounting cost model.
It does not include hardware purchase cost, depreciation, repairs or maintenance, financing, taxes, labor, rent, or other expenses unless already incorporated into the entered energy rate.
Transaction-fee revenue is excluded.
HashCost is intended for standard 1D Bitcoin charts quoted in USD or supported USD-like markets such as USDT, USDC, and FDUSD.
It is a mining production-cost analysis tool, not a trading signal or price prediction.
Unlike a generic network-wide mining-cost model, HashCost is built around the miner's own operating history. Users enter dated fleet configurations containing effective hashrate, average paid power, electricity cost, and pool fee. Each configuration takes effect on its specified date, while previous configurations remain intact, allowing the plotted production-cost history to reflect changes in the user's mining setup over time.
HOW IT WORKS
HashCost combines the active fleet configuration with Bitcoin network difficulty and block subsidy data to estimate the expected BTC production per day.
Production Cost = Daily Paid Energy Cost / Expected Net BTC per Day
The model uses:
- Effective hashrate in TH/s
- Average paid power in kW
- Electricity or hosting-energy rate in USD/kWh
- Pool fee
- Bitcoin network difficulty
- Bitcoin block subsidy
Effective hashrate and paid power are entered as 24-hour averages. This makes it possible to represent miners who operate for only part of each day.
For example, a 300 TH/s miner consuming 6 kW for 8 hours per day can be represented as:
100 TH/s effective hashrate
2 kW average paid power
FLEET HISTORY
Each line represents one complete mining configuration:
YYYY-MM-DD | Effective TH/s | Avg Paid kW | $/kWh | Pool %
Example:
2026-01-01 | 1000 | 20 | 0.05 | 1
Add a new line whenever the mining setup changes. Keep previous lines in chronological order from oldest to newest.
HashCost preserves those historical configurations rather than retroactively applying the latest settings to the entire chart.
NETWORK DATA
Bitcoin difficulty and block-height data are sourced from Glassnode's crypto metrics on TradingView.
HashCost checks the freshness of the underlying network data and fails closed if the selected source becomes stale rather than silently continuing to calculate with outdated forward-filled values.
INFO PANEL
BTC Cost
Estimated energy production cost of one BTC.
BTC vs Cost
Percentage difference between current BTC market price and estimated production cost.
BTC / Day
Expected net BTC production per day after the entered pool fee.
Cost / Day
Average paid electricity or hosting energy cost per day.
Eff. Hashrate
Effective 24-hour mining hashrate.
SCOPE AND LIMITATIONS
HashCost is an electricity/hosting-energy operating-cost model. It is not an all-in accounting cost model.
It does not include hardware purchase cost, depreciation, repairs or maintenance, financing, taxes, labor, rent, or other expenses unless already incorporated into the entered energy rate.
Transaction-fee revenue is excluded.
HashCost is intended for standard 1D Bitcoin charts quoted in USD or supported USD-like markets such as USDT, USDC, and FDUSD.
It is a mining production-cost analysis tool, not a trading signal or price prediction.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.
Open-source Skript
Ganz im Sinne von TradingView hat dieser Autor sein/ihr Script als Open-Source veröffentlicht. Auf diese Weise können nun auch andere Trader das Script rezensieren und die Funktionalität überprüfen. Vielen Dank an den Autor! Sie können das Script kostenlos verwenden, aber eine Wiederveröffentlichung des Codes unterliegt unseren Hausregeln.
Haftungsausschluss
Die Informationen und Veröffentlichungen sind nicht als Finanz-, Anlage-, Handels- oder andere Arten von Ratschlägen oder Empfehlungen gedacht, die von TradingView bereitgestellt oder gebilligt werden, und stellen diese nicht dar. Lesen Sie mehr in den Nutzungsbedingungen.