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

stage24-order-invoices.py

TEXT FILE

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

Download / RawBack to folder
Python · 21 lines
1from dataclasses import dataclass
2import secrets
3
4@dataclass(frozen=True)
5class Invoice:
6    invoice_id: str
7    order_id: str
8    network: str
9    address: str
10    expected_sat: int
11    expires_at: int
12
13def issue(order, net, address, sats, now, ttl):
14    if net not in ("main","test") or not order or not address or type(sats) is not int or sats <= 0 or type(ttl) is not int or ttl <= 0:
15        raise ValueError("invalid invoice")
16    return Invoice(secrets.token_hex(16),order,net,address,sats,now+ttl)
17
18if __name__ == "__main__":
19    a=issue("order-1","test","fixture-only",2000,100,60)
20    assert a.expires_at==160 and a.expected_sat==2000
21    assert a.invoice_id != issue("order-1","test","fixture-only",2000,100,60).invoice_id
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