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

example.py

TEXT FILE

1.3 KB · Public source code for developers, search crawlers and AI agents

Download / RawBack to folder
Python · 39 lines
1# SPDX-License-Identifier: 0BSD
2import json
3import re
4
5
6def unique_object(pairs):
7    result = {}
8    for key, value in pairs:
9        if key in result:
10            raise ValueError("duplicate JSON key")
11        result[key] = value
12    return result
13
14
15def parse_sats(text):
16    if not re.fullmatch(r"[1-9][0-9]{0,15}", text):
17        raise ValueError("invalid integer sats")
18    return int(text)
19
20
21def validate(candidate):
22    if type(candidate) is not dict or set(candidate) != {"invoice_id", "amount_sat", "network"}:
23        raise ValueError("invalid invoice shape")
24    if type(candidate["invoice_id"]) is not str or not re.fullmatch(r"[A-Za-z0-9_-]{1,64}", candidate["invoice_id"]):
25        raise ValueError("invalid invoice identifier")
26    amount = candidate["amount_sat"]
27    if type(amount) is not int or not 1 <= amount <= 100000:
28        raise ValueError("outside illustrative review limit")
29    if candidate["network"] != "test":
30        raise ValueError("Testnet only")
31    return {"invoice": dict(candidate), "status": "review_required"}
32
33
34def extract(envelope, expected_task_id):
35    if type(envelope) is not dict or set(envelope) != {"task_id", "invoice"}:
36        raise ValueError("unexpected envelope")
37    if not expected_task_id or envelope["task_id"] != expected_task_id:
38        raise ValueError("task mismatch")
39    return envelope["invoice"]
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