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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.