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

stage19-payment-metrics.py

TEXT FILE

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

Download / RawBack to folder
Python · 18 lines
1from collections import Counter
2
3class Metrics:
4    def __init__(self):
5        self.counts = Counter()
6    def observe(self, network, outcome):
7        if network not in ('main', 'test') or outcome not in ('accepted', 'rejected', 'unknown'):
8            raise ValueError('invalid label')
9        self.counts[network, outcome] += 1
10    def unknown_ratio(self, network):
11        total = sum(v for (n, _), v in self.counts.items() if n == network)
12        return self.counts[network, 'unknown'] / total if total else None
13
14m = Metrics()
15assert m.unknown_ratio('test') is None
16m.observe('test', 'unknown')
17m.observe('test', 'accepted')
18assert m.unknown_ratio('test') == 0.5
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