-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_ecosystem_study.py
More file actions
62 lines (48 loc) · 2.23 KB
/
Copy pathrun_ecosystem_study.py
File metadata and controls
62 lines (48 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env python3
"""Run the ecosystem lifecycle privacy study.
Simulates the full lifecycle (Silent Payments funding -> CoinJoin -> on-chain and
Lightning spending) for each CoinJoin protocol against the six-observer adversary
set, and measures the realized anonymity each protocol delivers across the
lifecycle, under single observers and worst-case collusion.
Outputs ``ecosystem_study_results.json`` for the website build.
"""
from __future__ import annotations
import json
import time
from pathlib import Path
from coinjoin_simulator.ecosystem.study import build_ecosystem_study
OUTPUT_PATH = Path("ecosystem_study_results.json")
def main() -> None:
start = time.time()
print("Building ecosystem lifecycle privacy study...")
study = build_ecosystem_study(n_users=30, maker_pool_size=50, seed=0)
payload = study.to_dict()
payload["generated_at"] = time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime())
OUTPUT_PATH.write_text(json.dumps(payload, indent=2) + "\n")
elapsed = time.time() - start
print(f"\nWrote {OUTPUT_PATH} in {elapsed:.2f}s\n")
print("Realized mixed-coin anonymity set across the lifecycle:")
print(
f" {'protocol':<32} {'passive':>8} {'spend-CP':>9} "
f"{'collude':>8} {'deanon':>7}"
)
for h in payload["headline"]:
print(
f" {h['label'][:32]:<32} {h['passive_mixed']:>8.1f} "
f"{h['spend_cp_mixed']:>9.1f} {h['collude_worst']:>8.1f} "
f"{h['collude_mixed_deanon_pct']:>6.0f}%"
)
print("\nSybil sensitivity (JoinMarket+fee-quant, co-participant attack):")
for r in payload["sybil_sensitivity"]:
if r["protocol"] == "joinmarket_feequant":
print(
f" Sybil {r['sybil_fraction']:.0%} of makers -> "
f"mixed set {r['mixed_effective_set']:.1f} "
f"({r['mixed_deanon_fraction']:.0%} deanonymized)"
)
print("\nThe core finding: under full collusion (funding payer + passive +")
print("spend counterparty + Lightning), every protocol's worst lifecycle")
print("stage collapses. On-chain CoinJoin alone does not deliver durable")
print("privacy; the funding anchor and the spend leak dominate.")
if __name__ == "__main__":
main()