Blockclock
On your display
Bitcoin price, block height, sats per dollar and Moscow time – with an animation on every new block.
- Topic
- Miscellaneous
- Includes
- Script
Runs on
- Runs on 32×8 (TC001 & DIY)
- Runs on 52×16 (TC002)
- Does not run on 32×8 with AWTRIX 3 (TC001 & DIY) Made for AWTRIX NG.
Choose your display in the next step.
Script description
The four numbers of a Blockclock mini on your AWTRIX: Bitcoin price, block height, sats per
dollar and Moscow time. Every time a new block is found, a block drops onto the display, flashes
and the new height slides in.
Runs on the clock itself as a Berry script. No server, no Home Assistant, no API key.
| Page | Shows | Example |
|---|---|---|
| price | BTC price in the chosen currency | 104215; $104,215 with symbols off; 1.05M from a million on |
| height | height of the chain tip | 921445; 921,445 with symbols off |
| sats | sats per unit of the currency (100,000,000 / price) | 960 |
| moscow | Moscow time: sats per unit as HH:MM | 9:60 |
Made for 32 × 8 clocks (Ulanzi TC001, AWTRIX 2, DIY ESP32 and ESP32-S3). It also runs on wider
panels and on the TC002, where it uses the top 8 rows.
Install
From the AWTRIX Hub: open the Blockclock page, press Send to AWTRIX, enter your clock's
address.
By hand:
- Open the web UI of your clock (its IP address, or
http://awtrixng-xxxxxx.local). - Scripts tab → new script, name it
Blockclock. - Paste the contents of
Blockclock.ax, press Save. - It joins the rotation. Press the right button to skip ahead to it.
The first numbers appear 15–20 seconds after a reboot: the clock holds HTTPS requests until the
network has settled. Until then the last known values are shown, dimmed.
Settings
Apps tab → the gear on the Blockclock row. Saving restarts the script.
| Setting | Default | What it does |
|---|---|---|
| Mempool server | https://mempool.space |
Any mempool instance, also your own node (Umbrel, Start9, RoninDojo, ...), e.g. http://umbrel.local:3006. No trailing slash needed |
| Currency | USD | USD, EUR, GBP, CAD, CHF, AUD or JPY |
| Price refresh | 5 min | How often the price is fetched |
| Block check | 60 s | How often the block height is checked |
| CoinGecko fallback | off | After two failed price requests, ask CoinGecko instead |
| Pages | price,height,sats,moscow |
Which pages, in which order. Leave one out to hide it |
| Seconds per page | 4 | How long each page stays |
| Symbols | on | The small symbol on the left of each page |
| Value colour | white | Colour of the numbers |
| Accent colour | #F7931A |
Symbols and the new-block animation |
| New block animation | drop | drop, fireworks or off |
| New block melody | off | A short melody on the buzzer. Off by default, because blocks also come at night |
What you see
- Bright numbers are fresh. Dimmed numbers are cached: shown after a reboot, or when the
last good answer is older than three refresh intervals. - A red pixel in the top right corner means the last request failed. The script retries with
growing pauses (1, 2, 4, 8, then every 15 minutes; a "429 Too Many Requests" jumps
straight to 4 minutes) and shows the last known values meanwhile. --means no value has ever arrived, for example on a clock that was never online.
The new-block animation
When the height goes up, the Blockclock comes to the front of the rotation and plays the
animation, then shows its pages. It does not play:
- when the clock starts or the script is saved (the first height is the baseline),
- right after a failed request (it would be an old block you missed),
- for a jump of more than 3 blocks (a resync, not a new block).
Test it: while the Blockclock is on screen, press the middle button.
If you took the Blockclock out of the rotation on the Apps tab, a notification shows the new
height instead.
Good to know
- One script, about 18 KB of script memory. It keeps only the numbers, never the server's
answers, and reads at most 32 bytes of each answer. - The middle button plays the animation while the Blockclock is on screen. A notification on top of
it is dismissed with the middle button once the Blockclock has moved on. - In JPY a yen buys only about six sats, so the sats page shows decimals and Moscow time stays
near0:06. - On ESP32 clocks HTTPS is encrypted but certificates are not checked. The script sends no
credentials, so this only matters if someone on your network fakes the price.
Data sources
- mempool.space REST API:
/api/v1/pricesand
/api/blocks/tip/height. Free and keyless, please keep the intervals friendly, or point the
script at your own node. - CoinGecko Simple Price API, only if you turn the fallback on. The
public API is rate limited; see CoinGecko's terms.
Sign in to view and copy the code of this script.
Discussion 0
Ask a question, suggest a change or share how you use it.
No comments yet. Start the conversation.
More scripts in Miscellaneous
Something wrong with this script? Report it.
Have an idea?
Sign in to ask questions and join the conversation.