This repository was archived by the owner on Jul 4, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
348 lines (312 loc) · 15.7 KB
/
Copy pathindex.html
File metadata and controls
348 lines (312 loc) · 15.7 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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
<!DOCTYPE html>
<html>
<head>
<meta name="robots" content="noindex, nofollow">
<title>FoundryNet Monitor v2 - Mainnet</title>
<style>
* { margin:0; padding:0; box-sizing:border-box; }
body { font-family:'Courier New', monospace; background:#000; color:#0f0; padding:20px; }
h1 { font-size:1.5rem; margin-bottom:20px; border-bottom:2px solid #0f0; padding-bottom:10px; }
h2 { font-size:1.1rem; margin:25px 0 15px 0; border-bottom:1px solid #0f0; padding-bottom:8px; }
.grid { display:grid; grid-template-columns:repeat(auto-fit, minmax(180px,1fr)); gap:12px; margin-bottom:20px; }
.metric { border:1px solid #0f0; padding:12px; background:#001100; }
.metric.mint { border-color:#0ff; background:#001111; }
.metric.ml { border-color:#f0f; background:#110011; }
.metric.warn { border-color:#ff0; background:#111100; }
.metric.danger { border-color:#f00; background:#110000; }
.metric-value { font-size:1.8rem; font-weight:bold; margin:8px 0; }
.metric-label { font-size:0.8rem; opacity:0.7; }
table { width:100%; border-collapse:collapse; margin-top:12px; font-size:0.85rem; }
th,td { text-align:left; padding:8px; border:1px solid #0f0; }
th { background:#001100; }
tr.flagged { background:#220011; }
tr.warning { background:#111100; }
tr.banned { background:#330000; }
.trust-bar { height:8px; background:#110000; border:1px solid #333; margin-top:4px; }
.trust-fill { height:100%; background:#0f0; transition: width 0.3s; }
.trust-fill.medium { background:#ff0; }
.trust-fill.low { background:#f00; }
.confidence-bar { height:6px; background:#001100; border:1px solid #0f0; margin-top:4px; }
.confidence-fill { height:100%; }
.confidence-fill.clean { background:#0f0; }
.confidence-fill.neutral { background:#ff0; }
.confidence-fill.flagged { background:#f00; }
.alert { padding:10px; margin:5px 0; font-size:0.9rem; }
.alert-mint { border:1px solid #0ff; background:#001111; color:#0ff; }
.alert-ml { border:1px solid #f0f; background:#110011; color:#f0f; }
.alert-network { border:1px solid #0f0; background:#001100; color:#0f0; }
#refresh { position:fixed; top:20px; right:20px; background:#0f0; color:#000; border:none; padding:10px 20px; cursor:pointer; font-weight:bold; }
#exportBtn { position:fixed; top:20px; right:140px; background:#f0f; color:#000; border:none; padding:10px 20px; cursor:pointer; font-weight:bold; }
.footer { margin-top:40px; padding-top:20px; border-top:1px solid #0f0; text-align:center; opacity:0.6; font-size:0.8rem; }
.formula { font-family: monospace; background:#001100; padding:15px; border:1px solid #0ff; margin:10px 0; font-size:0.9rem; }
.dispute-btn { background:#333; color:#f0f; border:1px solid #f0f; padding:3px 6px; cursor:pointer; font-size:0.7rem; }
.dispute-btn:hover { background:#f0f; color:#000; }
a { color:#0ff; text-decoration:none; }
a:hover { text-decoration:underline; }
.network-badge { display:inline-block; background:#0f0; color:#000; padding:2px 8px; font-size:0.7rem; font-weight:bold; border-radius:3px; margin-left:10px; }
.tx-link { font-size:0.7rem; color:#0ff; }
.tx-link:hover { color:#fff; }
</style>
</head>
<body>
<button id="refresh" onclick="loadData()">⟳ REFRESH</button>
<button id="exportBtn" onclick="exportData()">📥 CSV</button>
<h1>⚙️ FOUNDRYNET ECONOMIC MONITOR v2 <span class="network-badge">MAINNET</span></h1>
<div class="formula">
<strong>WAGE FORMULA:</strong> reward = duration × 0.005 × normalized_complexity × trust × warmup
<br><br>
<strong>PROGRAM:</strong> <a href="https://solscan.io/account/4ZvTZ3skfeMF3ZGyABoazPa9tiudw2QSwuVKn45t2AKL" target="_blank">4ZvTZ3skfeMF3ZGyABoazPa9tiudw2QSwuVKn45t2AKL</a>
|
<strong>MINT:</strong> <a href="https://solscan.io/token/5Pd4YBgFdih88vAFGAEEsk2JpixrZDJpRynTWvqPy5da" target="_blank">5Pd4YBgFdih88vAFGAEEsk2JpixrZDJpRynTWvqPy5da</a>
</div>
<!-- MINT ECONOMICS -->
<h2 style="border-color:#0ff;color:#0ff;">💰 MINT ECONOMICS</h2>
<div class="grid">
<div class="metric mint">
<div class="metric-label">BASE RATE</div>
<div class="metric-value" id="baseRate">0.005</div>
<div class="metric-label">MINT/second</div>
</div>
<div class="metric mint">
<div class="metric-label">TOTAL MINTED</div>
<div class="metric-value" id="totalMinted">--</div>
<div class="metric-label">MINT</div>
</div>
<div class="metric mint">
<div class="metric-label">NETWORK JOBS</div>
<div class="metric-value" id="networkJobs">--</div>
<div class="metric-label">total processed</div>
</div>
<div class="metric mint">
<div class="metric-label">WORK HOURS</div>
<div class="metric-value" id="totalHours">--</div>
<div class="metric-label">total duration</div>
</div>
</div>
<div class="grid">
<div class="metric mint">
<div class="metric-label">AVG COMPLEXITY</div>
<div class="metric-value" id="avgComplexity">--</div>
<div class="metric-label">7-day network mean</div>
</div>
<div class="metric mint">
<div class="metric-label">AVG DURATION</div>
<div class="metric-value" id="avgDuration">--</div>
<div class="metric-label">seconds/job</div>
</div>
<div class="metric mint">
<div class="metric-label">MACHINES</div>
<div class="metric-value" id="totalMachines">--</div>
<div class="metric-label">registered</div>
</div>
<div class="metric mint">
<div class="metric-label">MINT/HOUR</div>
<div class="metric-value" id="mintPerHour">18.0</div>
<div class="metric-label">at base rate</div>
</div>
</div>
<!-- ML IMMUNE SYSTEM -->
<h2 style="border-color:#f0f;color:#f0f;">🧠 ML IMMUNE SYSTEM</h2>
<div class="grid">
<div class="metric ml">
<div class="metric-label">STATUS</div>
<div class="metric-value" id="mlStatus">--</div>
</div>
<div class="metric ml">
<div class="metric-label">🔴 FLAG STRONG</div>
<div class="metric-value" id="mlFlagStrong">--</div>
</div>
<div class="metric ml">
<div class="metric-label">🟡 FLAG SOFT</div>
<div class="metric-value" id="mlFlagSoft">--</div>
</div>
<div class="metric ml">
<div class="metric-label">✅ CLEAN</div>
<div class="metric-value" id="mlClean">--</div>
</div>
</div>
<div id="alerts"></div>
<!-- MACHINE LEADERBOARD -->
<h2 style="border-color:#0ff;color:#0ff;">🏭 MACHINE EARNINGS</h2>
<table id="machineTable">
<thead>
<tr>
<th>MACHINE</th>
<th>JOBS</th>
<th>EARNED</th>
<th>TRUST</th>
<th>WARMUP</th>
<th>RATE/HR</th>
<th>STATUS</th>
<th>SOLSCAN</th>
</tr>
</thead>
<tbody>
<tr><td colspan="8" style="text-align:center;opacity:0.5">Loading...</td></tr>
</tbody>
</table>
<!-- RECENT SCORES -->
<h2 style="border-color:#f0f;color:#f0f;">📊 RECENT JOBS</h2>
<table id="scoresTable">
<thead>
<tr>
<th>TIME</th>
<th>MACHINE</th>
<th>DUR</th>
<th>CMPLX</th>
<th>BASE</th>
<th>FINAL</th>
<th>ML</th>
<th>ACTION</th>
<th>TX</th>
</tr>
</thead>
<tbody>
<tr><td colspan="9" style="text-align:center;opacity:0.5">Loading...</td></tr>
</tbody>
</table>
<div class="footer">
<div id="lastUpdate">Last update: --</div>
<div>FoundryNet v2 | Wages for Machines | Time Anchor: 0.005 MINT/sec | <a href="https://solscan.io/account/4ZvTZ3skfeMF3ZGyABoazPa9tiudw2QSwuVKn45t2AKL" target="_blank">Mainnet</a></div>
</div>
<script>
const ML_ENDPOINT = 'https://web-production-ea0f1.up.railway.app';
const SOLSCAN_TX = 'https://solscan.io/tx/';
const SOLSCAN_ACCOUNT = 'https://solscan.io/account/';
let disputedJobs = new Set();
async function loadData() {
document.getElementById('refresh').style.opacity = '0.5';
try {
const [health, economy, scores] = await Promise.all([
fetch(`${ML_ENDPOINT}/health`).then(r => r.json()).catch(() => null),
fetch(`${ML_ENDPOINT}/economy`).then(r => r.json()).catch(() => null),
fetch(`${ML_ENDPOINT}/recent-scores`).then(r => r.json()).catch(() => null),
]);
// Economics
if (economy) {
const c = economy.constants || {};
const n = economy.network || {};
document.getElementById('baseRate').textContent = c.base_rate || 0.005;
document.getElementById('mintPerHour').textContent = (c.base_rate_per_hour || 18).toFixed(1);
document.getElementById('totalMinted').textContent = (n.total_mint_minted || 0).toFixed(2);
document.getElementById('networkJobs').textContent = n.total_jobs || 0;
document.getElementById('totalHours').textContent = (n.total_duration_hours || 0).toFixed(1);
document.getElementById('avgComplexity').textContent = (n.avg_complexity_7d || 1.0).toFixed(2);
document.getElementById('avgDuration').textContent = Math.round(n.avg_duration || 300) + 's';
document.getElementById('totalMachines').textContent = n.total_machines || 0;
// Machine table
const tbody = document.querySelector('#machineTable tbody');
tbody.innerHTML = '';
(economy.machines || []).forEach(m => {
const row = tbody.insertRow();
let trustColor = '#0f0', trustClass = '';
if (m.trust <= 0) { trustColor = '#f00'; trustClass = 'banned'; }
else if (m.trust < 50) { trustColor = '#f00'; trustClass = 'flagged'; }
else if (m.trust < 80) { trustColor = '#ff0'; trustClass = 'warning'; }
let status = '✅ Healthy';
if (m.trust <= 0) status = '🚫 BANNED';
else if (m.trust < 50) status = '⛔ Critical';
else if (m.trust < 80) status = '⚠️ Warning';
const warmupPct = Math.round(m.warmup * 100);
const machineId = m.id || m.id_short || '--';
const machineShort = machineId.length > 12 ? machineId.substring(0, 12) + '...' : machineId;
// Get recent TX links
const recentTxs = m.recent_transactions || [];
const latestTx = recentTxs.length > 0 ? recentTxs[recentTxs.length - 1] : null;
row.className = trustClass;
row.innerHTML = `
<td style="font-size:0.75rem" title="${machineId}">${machineShort}</td>
<td>${m.jobs}</td>
<td style="color:#0ff;font-weight:bold">${m.total_earned.toFixed(4)} MINT</td>
<td>
<span style="color:${trustColor};font-weight:bold">${m.trust}</span>
<div class="trust-bar"><div class="trust-fill ${m.trust < 50 ? 'low' : m.trust < 80 ? 'medium' : ''}" style="width:${m.trust}%"></div></div>
</td>
<td>${warmupPct}%</td>
<td>${m.earning_rate_per_hour.toFixed(2)}</td>
<td>${status}</td>
<td>
<a href="${SOLSCAN_ACCOUNT}${machineId}" target="_blank" class="tx-link">📋 Account</a>
${latestTx ? `<br><a href="${latestTx.url || SOLSCAN_TX + latestTx.sig}" target="_blank" class="tx-link">🔗 Latest TX</a>` : ''}
</td>
`;
});
}
// ML Status
if (health) {
document.getElementById('mlStatus').textContent = health.status === 'healthy' ? 'ACTIVE' : 'OFFLINE';
document.getElementById('mlStatus').style.color = health.status === 'healthy' ? '#0f0' : '#f00';
}
// Scores
if (scores && scores.jobs) {
let flagStrong = 0, flagSoft = 0, clean = 0;
scores.jobs.forEach(j => {
if (j.action === 'flag_strong') flagStrong++;
else if (j.action === 'flag_soft') flagSoft++;
else if (j.action === 'clean') clean++;
});
document.getElementById('mlFlagStrong').textContent = flagStrong;
document.getElementById('mlFlagSoft').textContent = flagSoft;
document.getElementById('mlClean').textContent = clean + (scores.jobs.filter(j => j.action === 'neutral').length);
// Alerts
const alertsDiv = document.getElementById('alerts');
alertsDiv.innerHTML = `
<div class="alert alert-network">🌐 Network: Solana Mainnet | Program: 4ZvTZ3...5t2AKL</div>
<div class="alert alert-ml">🧠 ${scores.jobs.length} scored | ${flagStrong} strong flags | ${flagSoft} soft flags | ${clean} clean</div>
`;
// Scores table
const tbody = document.querySelector('#scoresTable tbody');
tbody.innerHTML = '';
scores.jobs.slice().reverse().slice(0, 30).forEach(job => {
const row = tbody.insertRow();
const econ = job.economics || {};
const solscan = job.solscan || {};
if (job.action === 'flag_strong') row.classList.add('flagged');
else if (job.action === 'flag_soft') row.classList.add('warning');
const conf = (job.confidence * 100).toFixed(0);
const confClass = job.confidence > 0.7 ? 'flagged' : job.confidence > 0.5 ? 'neutral' : 'clean';
const actionColor = job.action === 'flag_strong' ? '#f00' : job.action === 'flag_soft' ? '#ff0' : '#0f0';
const machineId = job.machine_id || '--';
const machineShort = machineId.substring(0, 6);
// Build TX links
let txLinks = '';
if (solscan.record) {
txLinks += `<a href="${solscan.record}" target="_blank" class="tx-link" title="Record Job">📝</a> `;
} else if (job.record_tx) {
txLinks += `<a href="${SOLSCAN_TX}${job.record_tx}" target="_blank" class="tx-link" title="Record Job">📝</a> `;
}
if (solscan.settle) {
txLinks += `<a href="${solscan.settle}" target="_blank" class="tx-link" title="Settle Job">💰</a>`;
} else if (job.settle_tx) {
txLinks += `<a href="${SOLSCAN_TX}${job.settle_tx}" target="_blank" class="tx-link" title="Settle Job">💰</a>`;
}
row.innerHTML = `
<td style="font-size:0.7rem">${job.timestamp?.substring(11, 19) || '--'}</td>
<td style="font-size:0.7rem"><a href="${SOLSCAN_ACCOUNT}${machineId}" target="_blank" class="tx-link">${machineShort}...</a></td>
<td>${econ.duration_seconds || job.duration_seconds || '--'}s</td>
<td>${(econ.complexity_claimed || job.complexity_claimed || 0).toFixed(2)}</td>
<td style="color:#888">${(econ.base_reward || 0).toFixed(3)}</td>
<td style="color:#0ff;font-weight:bold">${(econ.final_reward || 0).toFixed(3)}</td>
<td>
<span style="color:${confClass === 'flagged' ? '#f00' : confClass === 'neutral' ? '#ff0' : '#0f0'}">${conf}%</span>
<div class="confidence-bar"><div class="confidence-fill ${confClass}" style="width:${conf}%"></div></div>
</td>
<td style="color:${actionColor}">${job.action || '--'}</td>
<td>${txLinks || '--'}</td>
`;
});
}
document.getElementById('lastUpdate').textContent = `Last update: ${new Date().toLocaleTimeString()}`;
} catch (err) {
console.error('Load error:', err);
}
document.getElementById('refresh').style.opacity = '1';
}
function exportData() {
window.open(`${ML_ENDPOINT}/export-training-data`, '_blank');
}
loadData();
setInterval(loadData, 5000);
</script>
</body>
</html>