Skip to content

Instantly share code, notes, and snippets.

@dgnsrekt
Last active October 21, 2019 01:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgnsrekt/f0f2eef1a3f3cc7ac399533091f31506 to your computer and use it in GitHub Desktop.
Save dgnsrekt/f0f2eef1a3f3cc7ac399533091f31506 to your computer and use it in GitHub Desktop.
from urllib.request import urlopen
from tkinter import *
from time import sleep
from random import choice
URL = "https://blockchain.info/q/getblockcount"
COLORS = ["yellow", "orange", "red"]
FONT = ("helvetica", 100, "bold")
def update_clock(previous=None):
current = urlopen(URL).read()
clock.config(text=current)
if previous:
if current > previous:
clock.config(bg=choice(COLORS))
return current
root = Tk()
root.title("Block Clock")
clock = Label(root, font=FONT, bg=choice(COLORS))
clock.grid(row=0, column=1)
previous = update_clock()
while True:
previous = update_clock(previous=previous)
root.update_idletasks()
root.update()
sleep(10)
@dgnsrekt
Copy link
Author

dgnsrekt commented Oct 20, 2019

--ideas--
block alarm clock
input: DateTime, blocks, minutes, hours, days, seconds,
estimates the number of blocks mined until that period of time.
displays blocks left until the alarm goes off.
allow a choice of a short melody sequence as the alarm sound.

project goal: Standard lib only.

@dgnsrekt
Copy link
Author

dgnsrekt commented Oct 20, 2019

Have you had a time demon or chronocop hacker takeover your timestream and confiscate your centralized time?

Introducing the block alarm clock. A clock protected by a blockchain database backend which helps decentralize your alarms and make them unconfiscatable from the time police.

Explanation of how the bitcoin blockchain works blah blah blah.

Why use an alarm clock based on the average time a block is mined on the bitcoin blockchain?

While the bitcoin mining rate has a precision of + or - 10 minutes, which can make you somewhat early or extremely late to work. You are trading accuracy and job security for a guarantee that your time will be cryptographically secure in the future. Blockchain always == better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment