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

stage16-subscription-billing.py

TEXT FILE

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

Download / RawBack to folder
Python · 13 lines
1import hashlib
2import json
3
4def invoice_id(subscription, start, now):
5    if type(start) is not int or type(now) is not int or now < start:
6        raise ValueError('invalid time')
7    period = (now-start)//(30*86400)
8    payload = json.dumps([subscription,start,period],separators=(',',':'))
9    return hashlib.sha256(payload.encode()).hexdigest()
10
11assert invoice_id('s1',0,1) == invoice_id('s1',0,86400)
12assert invoice_id('s1',0,1) != invoice_id('s1',0,30*86400)
13assert invoice_id('s1',0,1) != invoice_id('s2',0,1)
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