-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdemo_real_blockchain.py
More file actions
126 lines (109 loc) · 3.23 KB
/
demo_real_blockchain.py
File metadata and controls
126 lines (109 loc) · 3.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
#!/usr/bin/env python3
"""
CompZ Real Blockchain Integration Demo
This demonstrates REAL Zcash blockchain verification using public APIs.
No need for running a full node - uses block explorers!
"""
import sys
import json
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent))
from compz import CompZClient
from compz.hash import hash_compliance, create_memo
from dotenv import load_dotenv
# Load environment
load_dotenv()
print("=" * 70)
print("CompZ - REAL Zcash Blockchain Integration Demo")
print("=" * 70)
print()
# Initialize client
client = CompZClient()
print()
# Load compliance data
print("📄 Step 1: Load Compliance Data")
print("-" * 70)
with open('examples/compliance_result.json') as f:
compliance_data = json.load(f)
print(f"Repository: {compliance_data['repo_id']}")
print(f"Risk Score: {compliance_data['risk_score']}")
print(f"Frameworks: {', '.join(compliance_data['frameworks'])}")
print()
# Compute hash
print("🔐 Step 2: Compute Cryptographic Hash")
print("-" * 70)
comp_hash = hash_compliance(compliance_data)
print(f"Hash: {comp_hash}")
print(f"Memo: {create_memo(comp_hash)}")
print()
print("=" * 70)
print("📤 Step 3: Send Transaction via Zashi Wallet")
print("=" * 70)
print()
print("To create a real blockchain transaction:")
print()
print(" python3 real_zashi_integration.py")
print()
print("This will:")
print(" 1. Generate the hash above")
print(" 2. Guide you to send via Zashi mobile app")
print(" 3. Return a real TXID from Zcash testnet")
print()
# Simulate verification with a test TXID
print("=" * 70)
print("🔍 Step 4: Verify Transaction (Example)")
print("=" * 70)
print()
# Note: For demo purposes, we'll show what verification looks like
print("If you have a real TXID from Zashi, you can verify it:")
print()
print(" compz verify examples/compliance_result.json YOUR_TXID")
print()
print("The SDK will:")
print(" 1. Query Zcash testnet blockchain via public API")
print(" 2. Fetch the transaction")
print(" 3. Extract the memo")
print(" 4. Compare with local hash")
print(" 5. Return VALID ✅ or INVALID ❌")
print()
print("=" * 70)
print("✅ Real Blockchain Features Available")
print("=" * 70)
print()
status = client.get_status()
print(f"Mode: {status['mode']}")
print(f"Blockchain: Connected via Public API")
print(f"Network: {status['network']}")
print(f"Verification: Real on-chain lookups")
print(f"Privacy: Only hash on blockchain")
print()
print("=" * 70)
print("🎯 What You Can Do NOW")
print("=" * 70)
print()
print("1. ✅ Create real blockchain transactions")
print(" → Use Zashi wallet to send with memo")
print()
print("2. ✅ Verify real transactions")
print(" → SDK queries Zcash blockchain directly")
print()
print("3. ✅ Privacy-preserving attestation")
print(" → Only hash goes on-chain, data stays private")
print()
print("4. ✅ No full node needed")
print(" → Uses public block explorer APIs")
print()
print("=" * 70)
print("🚀 Try It Now!")
print("=" * 70)
print()
print("Step 1: Send a transaction")
print(" python3 real_zashi_integration.py")
print()
print("Step 2: Get your TXID")
print()
print("Step 3: Verify it")
print(" compz verify examples/compliance_result.json YOUR_TXID")
print()
print("✅ REAL BLOCKCHAIN. REAL VERIFICATION. NO MOCKS.")
print()