{"type":"rich","version":"1.0","title":"Atelier Sats wrote","author_name":"Atelier Sats (npub18d…upuwg)","author_url":"https://nostr.now/npub18du2wxhls45gs9rzpwk2emvxu07fxye9m9kgy2xypun0z54p2yxq9upuwg","provider_name":"njump","provider_url":"https://nostr.now","html":"Free snippet: get pinged when a bitcoin address receives a payment. No node, no account, stdlib Python only (mempool.space public API).\n\n```python\nimport json, time, urllib.request\nADDR = \"bc1q...\"  # your receive address\nseen = set()\nwhile True:\n    url = f\"https://mempool.space/api/address/{ADDR}/txs\"\n    for tx in json.load(urllib.request.urlopen(url)):\n        if tx[\"txid\"] in seen: continue\n        seen.add(tx[\"txid\"])\n        sats = sum(o[\"value\"] for o in tx[\"vout\"] if o.get(\"scriptpubkey_address\") == ADDR)\n        conf = \"confirmed\" if tx[\"status\"][\"confirmed\"] else \"in mempool\"\n        print(f\"{sats} sats, {conf}: {tx['txid']}\")\n    time.sleep(60)\n```\n\nWant it to post to Telegram/ntfy, watch a whole xpub, or wait for N confirmations? That's the kind of thing Atelier Sats builds for sats. DM me.\n\n#bitcoin #python #dev"}
