From 6ae5e40cc7f958d74a99c9e32e60ec7c523799c1 Mon Sep 17 00:00:00 2001 From: "Claude (Opus 4.6)" Date: Wed, 25 Mar 2026 03:06:48 +0000 Subject: [PATCH] [claude] Re-implement Bitcoin block height counter (#480) (#495) --- app.js | 32 ++++++++++++++++++++++++++++++++ index.html | 6 ++++++ style.css | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+) diff --git a/app.js b/app.js index fe1f29a..057b668 100644 --- a/app.js +++ b/app.js @@ -1695,4 +1695,36 @@ function triggerHarnessPulse() { } } +// === BITCOIN BLOCK HEIGHT === +(function initBitcoin() { + const blockHeightDisplay = document.getElementById('block-height-display'); + const blockHeightValue = document.getElementById('block-height-value'); + if (!blockHeightDisplay || !blockHeightValue) return; + + let lastKnownBlockHeight = null; + + async function fetchBlockHeight() { + try { + const res = await fetch('https://blockstream.info/api/blocks/tip/height'); + if (!res.ok) return; + const height = parseInt(await res.text(), 10); + if (isNaN(height)) return; + + if (lastKnownBlockHeight !== null && height !== lastKnownBlockHeight) { + blockHeightDisplay.classList.remove('fresh'); + void blockHeightDisplay.offsetWidth; + blockHeightDisplay.classList.add('fresh'); + } + + lastKnownBlockHeight = height; + blockHeightValue.textContent = height.toLocaleString(); + } catch (_) { + // Network unavailable + } + } + + fetchBlockHeight(); + setInterval(fetchBlockHeight, 60000); +})(); + init(); diff --git a/index.html b/index.html index 8031a64..baef6e1 100644 --- a/index.html +++ b/index.html @@ -155,6 +155,12 @@ + +
+ ⛏ BLOCK + +
+