-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathenterprise-blockchain.html
More file actions
200 lines (188 loc) Β· 7.29 KB
/
Copy pathenterprise-blockchain.html
File metadata and controls
200 lines (188 loc) Β· 7.29 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
ο»Ώ<!DOCTYPE html>
<html>
<head>
<title>π’ Enterprise Elite Blockchain Explorer</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
background: linear-gradient(135deg, #0a0a2a 0%, #1a1a3a 100%);
color: #e0e0ff;
font-family: 'Courier New', monospace;
padding: 20px;
}
.header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
padding: 20px;
border-radius: 10px;
margin-bottom: 20px;
text-align: center;
}
.block {
background: rgba(20, 30, 50, 0.9);
border: 2px solid #667eea;
border-radius: 10px;
padding: 15px;
margin: 10px 0;
transition: all 0.3s;
}
.block:hover {
transform: translateX(10px);
border-color: #00ff88;
box-shadow: 0 0 20px rgba(0,255,136,0.3);
}
.hash {
font-family: monospace;
font-size: 11px;
color: #00ff88;
word-break: break-all;
}
.enterprise-badge {
background: #ff0066;
padding: 3px 8px;
border-radius: 5px;
font-size: 10px;
display: inline-block;
}
.stats {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 15px;
margin-bottom: 20px;
}
.stat-card {
background: rgba(0,0,0,0.5);
padding: 15px;
border-radius: 10px;
text-align: center;
border: 1px solid #667eea;
}
.stat-value {
font-size: 28px;
font-weight: bold;
color: #00ff88;
}
button {
background: linear-gradient(135deg, #667eea, #764ba2);
border: none;
padding: 10px 20px;
margin: 5px;
border-radius: 5px;
cursor: pointer;
color: white;
font-weight: bold;
}
button:hover {
transform: scale(1.05);
}
.verification {
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.7; }
}
</style>
</head>
<body>
<div class="header">
<h1>π’ ATOMIC SWARM GODS ELITE</h1>
<h2>ENTERPRISE BLOCKCHAIN EXPLORER v1.7.0</h2>
<p>π Immutable Audit Trail | π Real-time Monitoring | βοΈ SHA-256 Verified</p>
</div>
<div class="stats" id="stats">
<div class="stat-card">
<div class="stat-value" id="blockCount">0</div>
<div>Total Blocks</div>
</div>
<div class="stat-card">
<div class="stat-value" id="chainHeight">0</div>
<div>Chain Height</div>
</div>
<div class="stat-card">
<div class="stat-value" id="activeSessions">0</div>
<div>Active Sessions</div>
</div>
<div class="stat-card">
<div class="stat-value" id="integrity">β</div>
<div>Integrity Status</div>
</div>
</div>
<div style="text-align: center; margin-bottom: 20px;">
<button onclick="refreshBlockchain()">π Refresh Chain</button>
<button onclick="verifyChain()">π Verify Integrity</button>
<button onclick="exportChain()">π€ Export Blockchain</button>
<button onclick="addTestBlock()">β Add Test Block</button>
</div>
<div id="blockchain"></div>
<script>
const API = 'http://localhost:3001';
async function refreshBlockchain() {
try {
const response = await fetch(`${API}/api/blockchain`);
const blocks = await response.json();
const metrics = await fetch(`${API}/metrics`).then(r => r.json());
document.getElementById('blockCount').innerText = blocks.length;
document.getElementById('chainHeight').innerText = metrics.blockchainHeight;
document.getElementById('activeSessions').innerText = metrics.activeSurgeries;
const container = document.getElementById('blockchain');
container.innerHTML = blocks.map(block => `
<div class="block">
<div style="display: flex; justify-content: space-between;">
<h3>π¦ BLOCK #${block.index}</h3>
<span class="enterprise-badge">ENTERPRISE GRADE</span>
</div>
<div style="margin-top: 10px;">
<div><strong>β° Timestamp:</strong> ${block.timestamp}</div>
<div><strong>π― Event:</strong> ${block.data.event}</div>
<div><strong>π Session:</strong> ${block.data.sessionId}</div>
<div><strong>π Repository:</strong> ${block.data.repo || 'N/A'}</div>
<div><strong>πΏ Branch:</strong> ${block.data.branch || 'main'}</div>
<div class="hash"><strong>π Hash:</strong> ${block.hash}</div>
<div class="hash"><strong>β¬
οΈ Previous:</strong> ${block.previousHash.substring(0, 32)}...</div>
<div><strong>π Verified:</strong> β
Blockchain Integrity Confirmed</div>
</div>
</div>
`).reverse().join('');
} catch(e) {
console.error('Error:', e);
}
}
async function verifyChain() {
const blocks = await fetch(`${API}/api/blockchain`).then(r => r.json());
let valid = true;
for (let i = 1; i < blocks.length; i++) {
if (blocks[i].previousHash !== blocks[i-1].hash) {
valid = false;
break;
}
}
alert(valid ? 'β
BLOCKCHAIN INTEGRITY VERIFIED!' : 'β Blockchain Tampering Detected!');
}
async function exportChain() {
const blocks = await fetch(`${API}/api/blockchain`).then(r => r.json());
const dataStr = JSON.stringify(blocks, null, 2);
const blob = new Blob([dataStr], {type: 'application/json'});
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `enterprise-blockchain-${Date.now()}.json`;
a.click();
}
async function addTestBlock() {
await fetch(`${API}/api/surgery/start`, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
repoUrl: 'https://github.com/enterprise/demo.git',
branchName: 'enterprise',
eliteMode: true,
shiftStrategy: 'enterprise'
})
});
setTimeout(refreshBlockchain, 2000);
}
refreshBlockchain();
setInterval(refreshBlockchain, 5000);
</script>
</body>
</html>