upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/docs/mining-calculator.md
diff options
context:
space:
mode:
authorbitflash-maintainer <noreply@bitflash.invalid>2026-09-05 22:46:52 +0000
committerbitflash-maintainer <noreply@bitflash.invalid>2026-09-05 22:46:52 +0000
commitceae3d076b5ad11ee84729ae43f14e9312896646 (patch)
tree7e9132aa871fdc01cb95268d2f5ea3bb11853ddf /docs/mining-calculator.md
parentbe63e83d79e7e00e6b8ca889a70e6a19886aa1d8 (diff)
parent66e0b9158d050c46b1ff2509faeee3f4573cac1c (diff)
Bring main onto the line this project actually ships
main had drifted to a history with no ancestor in common with the tree we build and deploy. It sat at be63e83 (2026-08-09) with 28 commits; the shipped line, deploy/soak-2026-08-21, had 383. The two shared nothing -- git merge-base returns no result at all -- so anyone cloning this repository landed on a default branch that was neither current nor related to the running node. The 28 commits on main were audited before this merge: every one is already present in the tree by content, including the two that are hardest to see because they were rewritten afterwards -- the payout reorg-safety work (PayoutBlockStillOnChain, since evolved to re-check on every retry rather than once at maturity) and the nostr relay certificate verification (SSL_set1_host, now with a Windows root-store path). Nothing on main is lost by this merge. Recorded as a merge rather than a force-push: main only ever moves forward, its old history stays reachable as the first parent, and this is revertible. The tree is taken wholesale from the merged branch, so main's content is now exactly what was built and tested. What this brings onto main: - compactblock: BIP152-style compact block relay ported from upstream 1.2.23, primitives and unit test only, with the RAND_bytes failure path closed and the reconstruction allocation bounded. - upstream/main 17741d9: isolated testnet parameters and genesis, optional 2 MB large pages for RandomX. Mainnet genesis verified byte-identical through upstream's BuildGenesisBlock() refactor. - deploy: every image built on bookworm so binaries run on Debian 12, and the container build now honours the RandomX and libsecp256k1 pins it had been silently ignoring since before 1.2.15. Gates at this tree: 15/15 selftests, compactblock's 17 checks, consensus constants unchanged against e4f898c apart from the pre-existing MAX_BLOCK_SIZE_GEN, mainnet genesis intact, money-log check ok.
Diffstat (limited to 'docs/mining-calculator.md')
-rw-r--r--docs/mining-calculator.md108
1 files changed, 108 insertions, 0 deletions
diff --git a/docs/mining-calculator.md b/docs/mining-calculator.md
new file mode 100644
index 0000000..e6cb61b
--- /dev/null
+++ b/docs/mining-calculator.md
@@ -0,0 +1,108 @@
1# Bitflash mining calculator
2
3`scripts/bitflash-mining-calculator.py` is a local WhatToMine-style calculator
4for Bitflash.
5
6It does not fetch market prices, does not talk to exchanges, and does not
7change consensus. Price is a manual input until Bitflash has a reliable public
8market.
9
10## Examples
11
12Estimate from network hashrate:
13
14```bash
15python3 scripts/bitflash-mining-calculator.py \
16 --hashrate 21 --hashrate-unit kh/s \
17 --network-hashrate 1.56 --network-hashrate-unit mh/s \
18 --watts 140 --kwh-cost 0.10 \
19 --price 0.001 --pool-fee 1
20```
21
22Estimate from Bitflash difficulty:
23
24```bash
25python3 scripts/bitflash-mining-calculator.py \
26 --hashrate 21 --hashrate-unit kh/s \
27 --difficulty 45600 \
28 --watts 140 --kwh-cost 0.10
29```
30
31Machine-readable output:
32
33```bash
34python3 scripts/bitflash-mining-calculator.py \
35 --hashrate 21 --hashrate-unit kh/s \
36 --network-hashrate 1.56 --network-hashrate-unit mh/s \
37 --json
38```
39
40## Bitflash Difficulty Scale
41
42Bitflash does not use Bitcoin's SHA256 difficulty-1 constant for pool shares.
43The chain's easiest RandomX target is `bnProofOfWorkLimit = ~uint256(0) >> 12`,
44so difficulty 1 expects about `4096` hashes.
45
46The calculator uses:
47
48```text
49network_hashrate = difficulty * 4096 / block_time_seconds
50```
51
52At the default two-minute block target:
53
54```text
55network_hashrate = difficulty * 4096 / 120
56```
57
58If you already know network hashrate, pass `--network-hashrate` directly and
59the script derives the equivalent Bitflash difficulty for display.
60
61## Reward Estimate
62
63The expected daily reward is:
64
65```text
66blocks_per_day = 86400 / block_time_seconds
67miner_share = miner_hashrate / network_hashrate
68gross_btf_per_day = blocks_per_day * block_reward * miner_share
69net_btf_per_day = gross_btf_per_day * (1 - pool_fee_percent / 100)
70```
71
72Electricity is:
73
74```text
75electricity_per_day = watts / 1000 * 24 * kwh_cost
76```
77
78This is an expectation, not a promise. Solo mining variance can be very large,
79especially when the miner has a small share of the network.
80
81## Future Website Use
82
83The script is intentionally standalone so the same math can later back a
84website widget or status dashboard. Until a public price exists, a website
85calculator should keep price as a manual field and label fiat profit as
86speculative.
87
88## Website Fields
89
90A public calculator should ask for:
91
92- miner hashrate and unit;
93- power draw in watts;
94- electricity price per kWh;
95- pool fee percent;
96- optional BTF price;
97- either current Bitflash difficulty or current network hashrate.
98
99The output should separate:
100
101- estimated BTF per day;
102- estimated gross fiat revenue, if a manual price was provided;
103- electricity cost;
104- net profit/loss;
105- the difficulty/hashrate assumptions used.
106
107Never present the fiat number as a market quote unless it comes from a real
108public market. Before that exists, label it as a manual scenario.