Implement gambling

This commit is contained in:
2025-12-13 23:41:07 +01:00
parent fd6b5019ac
commit 872e44e317
10 changed files with 954 additions and 171 deletions

View File

@@ -19,12 +19,15 @@ def main():
try:
with open("blockchain", "rb") as f:
while True:
block = f.read(292)
if len(block) != 292:
block = f.read(293)
if len(block) != 293:
break
timestamp = int.from_bytes(block[244:252], "big")
if block[0] == 3:
# Reveal Transaction, skip the associated data
f.read(5376)
timestamp = int.from_bytes(block[245:253], "big")
time_info = time.strftime("%d.%m.%Y %H:%M:%S", time.localtime(timestamp))
message = prepare_message(block[148:180])
message = prepare_message(block[149:181])
print(f"[{time_info}] {message}")
except FileNotFoundError:
print("Found no blockchain file", file=sys.stderr)