Add Electrum SPV client and address listener

Minimal Electrum protocol client (client.py) plus a scripthash
subscription listener (listener.py) that watches user deposit addresses
for confirmed UTXOs, with the address->scripthash conversion helper and
a manual smoke-test script against the dev bootstrap server.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-21 10:25:38 +02:00
co-authored by Claude Sonnet 5
parent f1261584ff
commit a21e058cdd
7 changed files with 353 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
"""Manual smoke test: connect to the configured Electrum server, do the
server.version handshake, subscribe to headers and confirm a sane tip height.
Usage: PYTHONPATH=. python scripts/electrum_smoke_test.py
"""
import asyncio
from app.config import settings
from app.electrum.client import ElectrumClient
async def main() -> None:
client = ElectrumClient(settings.electrum_host, settings.electrum_port, settings.electrum_use_ssl)
await client.connect()
print("connected + handshake OK")
header = await client.subscribe_headers()
print("tip:", header)
assert header["height"] > 0
await client.close()
print("OK")
if __name__ == "__main__":
asyncio.run(main())