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

stage23-donation-page.py

TEXT FILE

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

Download / RawBack to folder
Python · 17 lines
1from urllib.parse import urlencode
2
3def payment_uri(address, sats=None):
4    if not address.isascii() or not address.isalnum():
5        raise ValueError('unsafe address characters')
6    if sats is None: return 'bitcoin:' + address
7    if type(sats) is not int or not 0 < sats <= 21_000_000 * 100_000_000:
8        raise ValueError('invalid amount')
9    whole, fraction = divmod(sats, 100_000_000)
10    return 'bitcoin:' + address + '?' + urlencode({'amount': f'{whole}.{fraction:08d}'})
11
12if __name__ == '__main__':
13    assert payment_uri('fixture', 1234) == 'bitcoin:fixture?amount=0.00001234'
14    assert payment_uri('fixture') == 'bitcoin:fixture'
15    try: payment_uri('fixture', True)
16    except ValueError: pass
17    else: raise AssertionError('boolean amount 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