Browse Source

Add note about hashrate and adjusted ETA algorithm.

master
Trey Del Bonis 4 years ago
parent
commit
a4e661f23f
2 changed files with 54 additions and 14 deletions
  1. 26
    14
      www/index.html
  2. 28
    0
      www/main.js

+ 26
- 14
www/index.html View File

@@ -35,18 +35,20 @@
<div id="faq">
<h2 style="text-align: center;">Halving FAQ</h2>

<p>Q: What's a halving? Does that mean I'll have twice/half as many coins?</p>
<p>
A: No, a reward halving is when the fixed subsidy for miners gets cut in
half. This has happened twice before, and will happen many more times
until all bitcoins have been mined (21 million).
<b>Q:</b> What's a halving? Does that mean I'll have twice/half as many coins?
</p>
<p>
<b>A:</b> No, a reward halving is when the fixed subsidy for miners gets
cut in half. This has happened twice before, and will happen many more
times until all bitcoins have been mined (21 million).
</p>

<p>
Q: Who decides when halvings happen? Can this be stopped?
<b>Q:</b> Who decides when halvings happen? Can this be stopped?
</p>
<p>
A: Satoshi embedded the halving algorithm into the consensus protocol of
<b>A:</b> Satoshi embedded the halving algorithm into the consensus protocol of
the Bitcoin network. It can only be changed if every user of the
network decided to change it as part of a hard fork. One of Bitcoin's
core offerings is its fixed and unchangable monetary policy, so it's
@@ -57,41 +59,51 @@
</p>

<p>
Q: I noticed some of your measurments here are different than those on
<b>Q:</b> I noticed some of your measurments here are different than those on
other countdown clocks. Why is that?
</p>
<p>
A: Since mining is a probabilistic process, it's impossible to predict
<b>A:</b> Since mining is a probabilistic process, it's impossible to predict
when new blocks will be mined. <em>On average</em>, new blocks are
mined every 10 minutes, but this can vary a lot. So it's hard to
predict <em>exactly</em> when block number 630000 will be mined, but all
answers will converge when the time comes. Since everyone does the math
slightly differently we all get slightly different answers.
</p>
<p>
<b>Update:</b> I've been noticing the hashrate seems to be a lot higher
than usual. I wrote a modified block halving ETA algorithm that bases
block times on the average of the recent blocks, but I won't display it
directly as might give too misleading predictions, or my code might be
wrong. You can check its answer below:
<br/>
<button onclick="updateFancyPrediction();">Check adjusted ETA</button>
<i><span id="fancyprediction"></span></i>
</p>

<p>
Q: Can I use this event to make money?
<b>Q:</b> Can I use this event to make money?
</p>
<p>
A: Probably not. But it's been observed that crypto bull markets have
<b>A:</b> Probably not. But it's been observed that crypto bull markets have
happened in the (roughly) year after each of the previous two halvings,
so take that how you will.
</p>

<p>
Q: Bull markets? Does that mean I should buy Bitcoin?
<b>Q:</b> Bull markets? Does that mean I should buy Bitcoin?
</p>
<p>
A: That's up to you. I'm not your financial advisor. Don't invest what
<b>A:</b> That's up to you. I'm not your financial advisor. Don't invest what
you can't afford to lose.
<!-- But also, buy Bitcoin! -->
</p>

<p>
Q: I have another question for you
<b>Q:</b> I have another question for you
</p>
<p>
A: I can be contacted at the following addresses...
<b>A:</b> I can be contacted at the following addresses...
<ul>
<li>Matrix: @trey:foobar.style</li>
<li>IRC on Freenode: treyzania</li>

+ 28
- 0
www/main.js View File

@@ -121,6 +121,34 @@ function formatDate(date) {
return datePart + " " + timePart;
}

function calcAdjustedETA() {
let sum = 0;
for (let i = 0; i < recentBlocks.length - 1; i++) {
let cur = recentBlocks[i];
let prev = recentBlocks[i + 1];
let diff = cur.timestamp - prev.timestamp;
if (diff < 0) {
continue;
}
sum += diff;
}

let avgBlockTimeSec = sum / (recentBlocks.length - 1);
let secsLeft = (calcNextHalvingHeight() - getCurTipBlock().height) * avgBlockTimeSec;

let now = new Date();
let tzOff = now.getTimezoneOffset();
let adjEta = new Date(now.getTime() + (secsLeft * 1000) - (tzOff * 60));

return formatDate(adjEta);
}

function updateFancyPrediction() {
let adjEta = calcAdjustedETA();
let elem = document.getElementById("fancyprediction");
elem.innerHTML = "very roughly " + adjEta + " local time";
}

function isHalvingHeight(height) {
return height % HALVING_PERIOD == 0;
}

Loading…
Cancel
Save