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

stage20-payment-throughput.py

TEXT FILE

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

Download / RawBack to folder
Python · 20 lines
1from concurrent.futures import ThreadPoolExecutor
2from collections import Counter
3from time import perf_counter_ns
4
5def benchmark(handler, count=1000, workers=4):
6    if count < 1 or workers < 1:
7        raise ValueError("invalid workload")
8    start = perf_counter_ns()
9    with ThreadPoolExecutor(max_workers=workers) as pool:
10        outcomes = Counter(pool.map(handler, range(count)))
11    elapsed = max(1, perf_counter_ns()-start)
12    if set(outcomes) - {"accepted", "rejected", "unknown"}:
13        raise ValueError("unexpected outcome")
14    return {"counts": dict(outcomes), "elapsed_ns": elapsed,
15            "requests_per_second": count*1e9/elapsed}
16
17if __name__ == "__main__":
18    result = benchmark(lambda i: ("accepted", "rejected", "unknown")[i%3], 300)
19    assert result["counts"] == dict(accepted=100, rejected=100, unknown=100)
20    print(result)
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