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-merchant-settlement.py

TEXT FILE

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

Download / RawBack to folder
Python · 9 lines
1def settlement(credits, liabilities):
2    for values in (credits,liabilities):
3        if any(type(v) is not int or v < 0 for v in values.values()):
4            raise ValueError('invalid ledger amount')
5    net=sum(credits.values())-sum(liabilities.values())
6    return {'available_sat':max(0,net),'shortfall_sat':max(0,-net)}
7
8assert settlement({'out1':9000},{'refund1':1000,'batch1':3000}) == {'available_sat':5000,'shortfall_sat':0}
9assert settlement({'out1':100},{'refund1':200}) == {'available_sat':0,'shortfall_sat':100}
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