THAMER
Sovereign Bitcoin Wallet

WALLET AI BITCOIN

Your Bitcoin Wallet. Your Keys. Your Engine.

Self-hosted Bitcoin software built for developers, applications, and AI agents.

CREATE WALLET

stage19-structured-logging.py

TEXT FILE

666 B · Public source code for developers, search crawlers and AI agents

Download / RawBack to folder
Python · 18 lines
1import json, re
2
3def event(kind, request_id, elapsed_ms):
4    if kind not in ('approved', 'denied', 'unknown', 'settled'):
5        raise ValueError('event kind')
6    if not isinstance(request_id, str) or not re.fullmatch(r'[0-9a-f]{32}', request_id):
7        raise ValueError('opaque ID required')
8    if type(elapsed_ms) is not int or elapsed_ms < 0:
9        raise ValueError('duration')
10    return json.dumps(dict(event=kind, request_id=request_id, elapsed_ms=elapsed_ms))
11
12assert json.loads(event('unknown', 'a'*32, 50))['elapsed_ms'] == 50
13try:
14    event('unknown', 'secret', 50)
15except ValueError:
16    pass
17else:
18    raise AssertionError('invalid ID accepted')
Read-only source · Select a line number to link directly · Raw download above

Latest from the Lab

THAMER illustrated developer portrait and signature

ABOUT THE DEVELOPER

Independent Software Developer specializing in Bitcoin Script, Golang, and AI Agents.

Software engineering · Independent research · Open-source projects