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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="ar" dir="rtl">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>مشروع عملة رقمية - المحاكاة الكاملة | ArabChain</title>
|
| 7 |
+
|
| 8 |
+
<!-- Fonts & Icons -->
|
| 9 |
+
<link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700&display=swap" rel="stylesheet">
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 11 |
+
|
| 12 |
+
<style>
|
| 13 |
+
:root {
|
| 14 |
+
--primary: #00f2ea;
|
| 15 |
+
--secondary: #ff0050;
|
| 16 |
+
--bg-dark: #0b0c15;
|
| 17 |
+
--bg-panel: #151621;
|
| 18 |
+
--text-main: #ffffff;
|
| 19 |
+
--text-muted: #8f90a6;
|
| 20 |
+
--glass: rgba(255, 255, 255, 0.05);
|
| 21 |
+
--border: rgba(255, 255, 255, 0.1);
|
| 22 |
+
--success: #00d26a;
|
| 23 |
+
}
|
| 24 |
+
|
| 25 |
+
* {
|
| 26 |
+
box-sizing: border-box;
|
| 27 |
+
margin: 0;
|
| 28 |
+
padding: 0;
|
| 29 |
+
font-family: 'Tajawal', sans-serif;
|
| 30 |
+
scrollbar-width: thin;
|
| 31 |
+
scrollbar-color: var(--primary) var(--bg-dark);
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
body {
|
| 35 |
+
background-color: var(--bg-dark);
|
| 36 |
+
color: var(--text-main);
|
| 37 |
+
display: flex;
|
| 38 |
+
flex-direction: column;
|
| 39 |
+
height: 100vh;
|
| 40 |
+
overflow: hidden;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
/* Header */
|
| 44 |
+
header {
|
| 45 |
+
height: 60px;
|
| 46 |
+
background: var(--bg-panel);
|
| 47 |
+
border-bottom: 1px solid var(--border);
|
| 48 |
+
display: flex;
|
| 49 |
+
align-items: center;
|
| 50 |
+
justify-content: space-between;
|
| 51 |
+
padding: 0 20px;
|
| 52 |
+
z-index: 100;
|
| 53 |
+
}
|
| 54 |
+
|
| 55 |
+
.brand {
|
| 56 |
+
font-size: 1.5rem;
|
| 57 |
+
font-weight: 700;
|
| 58 |
+
background: linear-gradient(45deg, var(--primary), var(--secondary));
|
| 59 |
+
-webkit-background-clip: text;
|
| 60 |
+
-webkit-text-fill-color: transparent;
|
| 61 |
+
display: flex;
|
| 62 |
+
align-items: center;
|
| 63 |
+
gap: 10px;
|
| 64 |
+
}
|
| 65 |
+
|
| 66 |
+
.anycoder-link {
|
| 67 |
+
color: var(--text-muted);
|
| 68 |
+
text-decoration: none;
|
| 69 |
+
font-size: 0.9rem;
|
| 70 |
+
transition: color 0.3s;
|
| 71 |
+
border: 1px solid var(--border);
|
| 72 |
+
padding: 5px 15px;
|
| 73 |
+
border-radius: 20px;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
.anycoder-link:hover {
|
| 77 |
+
color: var(--primary);
|
| 78 |
+
border-color: var(--primary);
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
/* Layout */
|
| 82 |
+
.main-container {
|
| 83 |
+
display: flex;
|
| 84 |
+
flex: 1;
|
| 85 |
+
overflow: hidden;
|
| 86 |
+
}
|
| 87 |
+
|
| 88 |
+
/* Sidebar */
|
| 89 |
+
aside {
|
| 90 |
+
width: 250px;
|
| 91 |
+
background: var(--bg-panel);
|
| 92 |
+
border-left: 1px solid var(--border);
|
| 93 |
+
display: flex;
|
| 94 |
+
flex-direction: column;
|
| 95 |
+
padding: 20px 0;
|
| 96 |
+
transition: transform 0.3s ease;
|
| 97 |
+
}
|
| 98 |
+
|
| 99 |
+
.nav-item {
|
| 100 |
+
padding: 15px 25px;
|
| 101 |
+
cursor: pointer;
|
| 102 |
+
color: var(--text-muted);
|
| 103 |
+
display: flex;
|
| 104 |
+
align-items: center;
|
| 105 |
+
gap: 15px;
|
| 106 |
+
transition: all 0.3s;
|
| 107 |
+
border-right: 3px solid transparent;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
.nav-item:hover, .nav-item.active {
|
| 111 |
+
background: var(--glass);
|
| 112 |
+
color: var(--primary);
|
| 113 |
+
border-right-color: var(--primary);
|
| 114 |
+
}
|
| 115 |
+
|
| 116 |
+
/* Content Area */
|
| 117 |
+
main {
|
| 118 |
+
flex: 1;
|
| 119 |
+
padding: 30px;
|
| 120 |
+
overflow-y: auto;
|
| 121 |
+
position: relative;
|
| 122 |
+
}
|
| 123 |
+
|
| 124 |
+
.section {
|
| 125 |
+
display: none;
|
| 126 |
+
animation: fadeIn 0.5s ease;
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
+
.section.active {
|
| 130 |
+
display: block;
|
| 131 |
+
}
|
| 132 |
+
|
| 133 |
+
@keyframes fadeIn {
|
| 134 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 135 |
+
to { opacity: 1; transform: translateY(0); }
|
| 136 |
+
}
|
| 137 |
+
|
| 138 |
+
/* Dashboard Cards */
|
| 139 |
+
.stats-grid {
|
| 140 |
+
display: grid;
|
| 141 |
+
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
| 142 |
+
gap: 20px;
|
| 143 |
+
margin-bottom: 30px;
|
| 144 |
+
}
|
| 145 |
+
|
| 146 |
+
.card {
|
| 147 |
+
background: var(--bg-panel);
|
| 148 |
+
border: 1px solid var(--border);
|
| 149 |
+
border-radius: 12px;
|
| 150 |
+
padding: 20px;
|
| 151 |
+
position: relative;
|
| 152 |
+
overflow: hidden;
|
| 153 |
+
}
|
| 154 |
+
|
| 155 |
+
.card::before {
|
| 156 |
+
content: '';
|
| 157 |
+
position: absolute;
|
| 158 |
+
top: 0;
|
| 159 |
+
left: 0;
|
| 160 |
+
width: 100%;
|
| 161 |
+
height: 2px;
|
| 162 |
+
background: linear-gradient(90deg, var(--primary), transparent);
|
| 163 |
+
}
|
| 164 |
+
|
| 165 |
+
.card h3 {
|
| 166 |
+
font-size: 0.9rem;
|
| 167 |
+
color: var(--text-muted);
|
| 168 |
+
margin-bottom: 10px;
|
| 169 |
+
}
|
| 170 |
+
|
| 171 |
+
.card .value {
|
| 172 |
+
font-size: 1.8rem;
|
| 173 |
+
font-weight: 700;
|
| 174 |
+
}
|
| 175 |
+
|
| 176 |
+
.pulse {
|
| 177 |
+
animation: pulse-animation 2s infinite;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
@keyframes pulse-animation {
|
| 181 |
+
0% { box-shadow: 0 0 0 0 rgba(0, 242, 234, 0.4); }
|
| 182 |
+
70% { box-shadow: 0 0 0 10px rgba(0, 242, 234, 0); }
|
| 183 |
+
100% { box-shadow: 0 0 0 0 rgba(0, 242, 234, 0); }
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
/* Blockchain Visualization */
|
| 187 |
+
.blocks-container {
|
| 188 |
+
display: flex;
|
| 189 |
+
gap: 20px;
|
| 190 |
+
overflow-x: auto;
|
| 191 |
+
padding-bottom: 20px;
|
| 192 |
+
align-items: center;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
.block {
|
| 196 |
+
min-width: 220px;
|
| 197 |
+
background: var(--bg-panel);
|
| 198 |
+
border: 1px solid var(--border);
|
| 199 |
+
border-radius: 8px;
|
| 200 |
+
padding: 15px;
|
| 201 |
+
font-family: monospace;
|
| 202 |
+
font-size: 0.85rem;
|
| 203 |
+
position: relative;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
.block-header {
|
| 207 |
+
display: flex;
|
| 208 |
+
justify-content: space-between;
|
| 209 |
+
margin-bottom: 10px;
|
| 210 |
+
color: var(--primary);
|
| 211 |
+
font-weight: bold;
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
.hash {
|
| 215 |
+
white-space: nowrap;
|
| 216 |
+
overflow: hidden;
|
| 217 |
+
text-overflow: ellipsis;
|
| 218 |
+
color: var(--text-muted);
|
| 219 |
+
margin-bottom: 5px;
|
| 220 |
+
}
|
| 221 |
+
|
| 222 |
+
.chain-link {
|
| 223 |
+
min-width: 30px;
|
| 224 |
+
height: 2px;
|
| 225 |
+
background: var(--text-muted);
|
| 226 |
+
}
|
| 227 |
+
|
| 228 |
+
/* Code Editor Simulation */
|
| 229 |
+
.editor-container {
|
| 230 |
+
background: #000;
|
| 231 |
+
border-radius: 8px;
|
| 232 |
+
border: 1px solid var(--border);
|
| 233 |
+
font-family: 'Fira Code', monospace;
|
| 234 |
+
overflow: hidden;
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
.editor-header {
|
| 238 |
+
background: #1e1e1e;
|
| 239 |
+
padding: 10px;
|
| 240 |
+
display: flex;
|
| 241 |
+
gap: 10px;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
.dot { width: 12px; height: 12px; border-radius: 50%; }
|
| 245 |
+
.red { background: #ff5f56; }
|
| 246 |
+
.yellow { background: #ffbd2e; }
|
| 247 |
+
.green { background: #27c93f; }
|
| 248 |
+
|
| 249 |
+
textarea.code-area {
|
| 250 |
+
width: 100%;
|
| 251 |
+
height: 300px;
|
| 252 |
+
background: #0d0d0d;
|
| 253 |
+
color: #d4d4d4;
|
| 254 |
+
border: none;
|
| 255 |
+
padding: 15px;
|
| 256 |
+
resize: none;
|
| 257 |
+
outline: none;
|
| 258 |
+
font-family: monospace;
|
| 259 |
+
}
|
| 260 |
+
|
| 261 |
+
.btn {
|
| 262 |
+
background: var(--primary);
|
| 263 |
+
color: #000;
|
| 264 |
+
border: none;
|
| 265 |
+
padding: 10px 20px;
|
| 266 |
+
border-radius: 6px;
|
| 267 |
+
cursor: pointer;
|
| 268 |
+
font-weight: 600;
|
| 269 |
+
transition: 0.3s;
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
.btn:hover {
|
| 273 |
+
opacity: 0.9;
|
| 274 |
+
transform: translateY(-2px);
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
.btn-outline {
|
| 278 |
+
background: transparent;
|
| 279 |
+
border: 1px solid var(--primary);
|
| 280 |
+
color: var(--primary);
|
| 281 |
+
}
|
| 282 |
+
|
| 283 |
+
/* P2P Network Canvas */
|
| 284 |
+
#networkCanvas {
|
| 285 |
+
width: 100%;
|
| 286 |
+
height: 300px;
|
| 287 |
+
background: #000;
|
| 288 |
+
border-radius: 12px;
|
| 289 |
+
border: 1px solid var(--border);
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
/* Logs */
|
| 293 |
+
.console-log {
|
| 294 |
+
background: #000;
|
| 295 |
+
color: #0f0;
|
| 296 |
+
font-family: monospace;
|
| 297 |
+
height: 200px;
|
| 298 |
+
overflow-y: auto;
|
| 299 |
+
padding: 10px;
|
| 300 |
+
border-radius: 8px;
|
| 301 |
+
border: 1px solid var(--border);
|
| 302 |
+
margin-top: 20px;
|
| 303 |
+
font-size: 0.8rem;
|
| 304 |
+
}
|
| 305 |
+
|
| 306 |
+
/* Wallet UI */
|
| 307 |
+
.wallet-layout {
|
| 308 |
+
display: grid;
|
| 309 |
+
grid-template-columns: 1fr 1fr;
|
| 310 |
+
gap: 20px;
|
| 311 |
+
}
|
| 312 |
+
|
| 313 |
+
.form-group {
|
| 314 |
+
margin-bottom: 15px;
|
| 315 |
+
}
|
| 316 |
+
|
| 317 |
+
.form-group label {
|
| 318 |
+
display: block;
|
| 319 |
+
margin-bottom: 5px;
|
| 320 |
+
color: var(--text-muted);
|
| 321 |
+
}
|
| 322 |
+
|
| 323 |
+
.form-group input {
|
| 324 |
+
width: 100%;
|
| 325 |
+
padding: 10px;
|
| 326 |
+
background: var(--bg-dark);
|
| 327 |
+
border: 1px solid var(--border);
|
| 328 |
+
color: #fff;
|
| 329 |
+
border-radius: 6px;
|
| 330 |
+
}
|
| 331 |
+
|
| 332 |
+
/* Responsive */
|
| 333 |
+
@media (max-width: 768px) {
|
| 334 |
+
.main-container {
|
| 335 |
+
flex-direction: column;
|
| 336 |
+
}
|
| 337 |
+
aside {
|
| 338 |
+
width: 100%;
|
| 339 |
+
flex-direction: row;
|
| 340 |
+
overflow-x: auto;
|
| 341 |
+
padding: 10px;
|
| 342 |
+
border-left: none;
|
| 343 |
+
border-bottom: 1px solid var(--border);
|
| 344 |
+
}
|
| 345 |
+
.nav-item {
|
| 346 |
+
padding: 10px;
|
| 347 |
+
white-space: nowrap;
|
| 348 |
+
border-right: none;
|
| 349 |
+
border-bottom: 3px solid transparent;
|
| 350 |
+
}
|
| 351 |
+
.nav-item:hover, .nav-item.active {
|
| 352 |
+
border-bottom-color: var(--primary);
|
| 353 |
+
}
|
| 354 |
+
.wallet-layout {
|
| 355 |
+
grid-template-columns: 1fr;
|
| 356 |
+
}
|
| 357 |
+
}
|
| 358 |
+
</style>
|
| 359 |
+
</head>
|
| 360 |
+
<body>
|
| 361 |
+
|
| 362 |
+
<header>
|
| 363 |
+
<div class="brand">
|
| 364 |
+
<i class="fa-solid fa-cube"></i> ArabChain Core
|
| 365 |
+
</div>
|
| 366 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="anycoder-link">
|
| 367 |
+
Built with anycoder
|
| 368 |
+
</a>
|
| 369 |
+
</header>
|
| 370 |
+
|
| 371 |
+
<div class="main-container">
|
| 372 |
+
<aside>
|
| 373 |
+
<div class="nav-item active" onclick="showSection('dashboard')">
|
| 374 |
+
<i class="fa-solid fa-chart-line"></i> لوحة التحكم
|
| 375 |
+
</div>
|
| 376 |
+
<div class="nav-item" onclick="showSection('blockchain')">
|
| 377 |
+
<i class="fa-solid fa-link"></i> المستكشف (Explorer)
|
| 378 |
+
</div>
|
| 379 |
+
<div class="nav-item" onclick="showSection('wallet')">
|
| 380 |
+
<i class="fa-solid fa-wallet"></i> المحفظة (Wallet)
|
| 381 |
+
</div>
|
| 382 |
+
<div class="nav-item" onclick="showSection('consensus')">
|
| 383 |
+
<i class="fa-solid fa-users-gear"></i> الإجماع (PoS)
|
| 384 |
+
</div>
|
| 385 |
+
<div class="nav-item" onclick="showSection('smart-contracts')">
|
| 386 |
+
<i class="fa-solid fa-code"></i> العقود الذكية
|
| 387 |
+
</div>
|
| 388 |
+
<div class="nav-item" onclick="showSection('network')">
|
| 389 |
+
<i class="fa-solid fa-network-wired"></i> شبكة P2P
|
| 390 |
+
</div>
|
| 391 |
+
<div class="nav-item" onclick="showSection('docs')">
|
| 392 |
+
<i class="fa-solid fa-book"></i> التوثيق & Docker
|
| 393 |
+
</div>
|
| 394 |
+
</aside>
|
| 395 |
+
|
| 396 |
+
<main>
|
| 397 |
+
<!-- DASHBOARD -->
|
| 398 |
+
<div id="dashboard" class="section active">
|
| 399 |
+
<h2>نظرة عامة على الشبكة (Mainnet)</h2>
|
| 400 |
+
<br>
|
| 401 |
+
<div class="stats-grid">
|
| 402 |
+
<div class="card">
|
| 403 |
+
<h3>رقم الكتلة (Height)</h3>
|
| 404 |
+
<div class="value" id="blockHeight">0</div>
|
| 405 |
+
</div>
|
| 406 |
+
<div class="card">
|
| 407 |
+
<h3>المعاملات (TPS)</h3>
|
| 408 |
+
<div class="value" id="tps">0</div>
|
| 409 |
+
</div>
|
| 410 |
+
<div class="card">
|
| 411 |
+
<h3>العقد النشطة (Peers)</h3>
|
| 412 |
+
<div class="value">1,240</div>
|
| 413 |
+
</div>
|
| 414 |
+
<div class="card">
|
| 415 |
+
<h3>سعر العملة (ARC)</h3>
|
| 416 |
+
<div class="value">$142.50</div>
|
| 417 |
+
</div>
|
| 418 |
+
</div>
|
| 419 |
+
|
| 420 |
+
<h3>سجل النظام (System Logs)</h3>
|
| 421 |
+
<div class="console-log" id="systemLog">
|
| 422 |
+
<div>[SYSTEM] Initializing ArabChain Protocol v1.0...</div>
|
| 423 |
+
<div>[NET] P2P Listener started on port 30303</div>
|
| 424 |
+
<div>[CONSENSUS] Proof of Stake engine initialized.</div>
|
| 425 |
+
</div>
|
| 426 |
+
</div>
|
| 427 |
+
|
| 428 |
+
<!-- BLOCKCHAIN EXPLORER -->
|
| 429 |
+
<div id="blockchain" class="section">
|
| 430 |
+
<div style="display:flex; justify-content:space-between; align-items:center; margin-bottom:20px;">
|
| 431 |
+
<h2>سلسلة الكتل (Blockchain Live)</h2>
|
| 432 |
+
<button class="btn btn-outline" onclick="manualMine()">تعدين كتلة يدوياً</button>
|
| 433 |
+
</div>
|
| 434 |
+
<div class="blocks-container" id="chainContainer">
|
| 435 |
+
<!-- Blocks will be injected here via JS -->
|
| 436 |
+
</div>
|
| 437 |
+
</div>
|
| 438 |
+
|
| 439 |
+
<!-- WALLET -->
|
| 440 |
+
<div id="wallet" class="section">
|
| 441 |
+
<h2>المحفظة الرقمية (Web Wallet)</h2>
|
| 442 |
+
<br>
|
| 443 |
+
<div class="wallet-layout">
|
| 444 |
+
<div class="card">
|
| 445 |
+
<h3>رصيدك الحالي</h3>
|
| 446 |
+
<div class="value" style="color:var(--primary);">2,500.00 ARC</div>
|
| 447 |
+
<p style="color:var(--text-muted); font-size:0.8rem; margin-top:10px;">العنوان: <span id="myAddress">0x7a...3f9</span></p>
|
| 448 |
+
<br>
|
| 449 |
+
<div style="display:flex; gap:10px;">
|
| 450 |
+
<button class="btn"><i class="fa-solid fa-paper-plane"></i> إرسال</button>
|
| 451 |
+
<button class="btn btn-outline"><i class="fa-solid fa-qrcode"></i> استلام</button>
|
| 452 |
+
</div>
|
| 453 |
+
</div>
|
| 454 |
+
<div class="card">
|
| 455 |
+
<h3>إرسال عملات</h3>
|
| 456 |
+
<div class="form-group">
|
| 457 |
+
<label>عنوان المستلم</label>
|
| 458 |
+
<input type="text" placeholder="0x...">
|
| 459 |
+
</div>
|
| 460 |
+
<div class="form-group">
|
| 461 |
+
<label>المبلغ (ARC)</label>
|
| 462 |
+
<input type="number" placeholder="0.00">
|
| 463 |
+
</div>
|
| 464 |
+
<button class="btn" style="width:100%" onclick="simulateTx()">تأكيد المعاملة</button>
|
| 465 |
+
</div>
|
| 466 |
+
</div>
|
| 467 |
+
</div>
|
| 468 |
+
|
| 469 |
+
<!-- CONSENSUS -->
|
| 470 |
+
<div id="consensus" class="section">
|
| 471 |
+
<h2>نظام الإجماع (Proof of Stake)</h2>
|
| 472 |
+
<p style="color:var(--text-muted); margin-bottom:20px;">المصادقون (Validators) النشطون حالياً في الشبكة.</p>
|
| 473 |
+
|
| 474 |
+
<div class="stats-grid">
|
| 475 |
+
<div class="card">
|
| 476 |
+
<h3>إجمالي المخزن (Staked)</h3>
|
| 477 |
+
<div class="value">14M ARC</div>
|
| 478 |
+
</div>
|
| 479 |
+
<div class="card">
|
| 480 |
+
<h3>المصادقون</h3>
|
| 481 |
+
<div class="value">84</div>
|
| 482 |
+
</div>
|
| 483 |
+
</div>
|
| 484 |
+
|
| 485 |
+
<table style="width:100%; text-align:right; border-collapse:collapse; margin-top:20px;">
|
| 486 |
+
<thead>
|
| 487 |
+
<tr style="border-bottom:1px solid var(--border); color:var(--text-muted);">
|
| 488 |
+
<th style="padding:10px;">المصادق (Validator)</th>
|
| 489 |
+
<th>الكمية المخزنة</th>
|
| 490 |
+
<th>الحالة</th>
|
| 491 |
+
<th>الكتل المنتجة</th>
|
| 492 |
+
</tr>
|
| 493 |
+
</thead>
|
| 494 |
+
<tbody id="validatorsTable">
|
| 495 |
+
<!-- JS Populated -->
|
| 496 |
+
</tbody>
|
| 497 |
+
</table>
|
| 498 |
+
</div>
|
| 499 |
+
|
| 500 |
+
<!-- SMART CONTRACTS -->
|
| 501 |
+
<div id="smart-contracts" class="section">
|
| 502 |
+
<h2>محرك العقود الذكية (ArabEVM)</h2>
|
| 503 |
+
<p style="color:var(--text-muted); margin-bottom:15px;">اكتب وانشر العقود الذكية باستخدام لغة Solidity.</p>
|
| 504 |
+
|
| 505 |
+
<div class="editor-container">
|
| 506 |
+
<div class="editor-header">
|
| 507 |
+
<div class="dot red"></div>
|
| 508 |
+
<div class="dot yellow"></div>
|
| 509 |
+
<div class="dot green"></div>
|
| 510 |
+
<span style="margin-right:auto; color:#888; font-size:0.8rem;">Token.sol</span>
|
| 511 |
+
</div>
|
| 512 |
+
<textarea class="code-area" spellcheck="false">
|
| 513 |
+
pragma solidity ^0.8.0;
|
| 514 |
+
|
| 515 |
+
contract ArabToken {
|
| 516 |
+
string public name = "ArabCoin";
|
| 517 |
+
string public symbol = "ARC";
|
| 518 |
+
uint256 public totalSupply = 1000000;
|
| 519 |
+
|
| 520 |
+
mapping(address => uint256) balances;
|
| 521 |
+
|
| 522 |
+
constructor() {
|
| 523 |
+
balances[msg.sender] = totalSupply;
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
function transfer(address to, uint256 amount) external {
|
| 527 |
+
require(balances[msg.sender] >= amount, "No funds");
|
| 528 |
+
balances[msg.sender] -= amount;
|
| 529 |
+
balances[to] += amount;
|
| 530 |
+
}
|
| 531 |
+
}
|
| 532 |
+
</textarea>
|
| 533 |
+
</div>
|
| 534 |
+
<div style="margin-top:15px;">
|
| 535 |
+
<button class="btn" onclick="deployContract()"><i class="fa-solid fa-rocket"></i> نشر العقد (Deploy)</button>
|
| 536 |
+
<span id="deployStatus" style="margin-right:10px; color:var(--success); display:none;">تم النشر بنجاح! Hash: 0x8f...2a</span>
|
| 537 |
+
</div>
|
| 538 |
+
</div>
|
| 539 |
+
|
| 540 |
+
<!-- P2P NETWORK -->
|
| 541 |
+
<div id="network" class="section">
|
| 542 |
+
<h2>شبكة النظير للنظير (P2P Network Visualization)</h2>
|
| 543 |
+
<p style="color:var(--text-muted);">تصور حي لانتشار الكتل والمعاملات بين العقد.</p>
|
| 544 |
+
<br>
|
| 545 |
+
<canvas id="networkCanvas"></canvas>
|
| 546 |
+
</div>
|
| 547 |
+
|
| 548 |
+
<!-- DOCS & DOCKER -->
|
| 549 |
+
<div id="docs" class="section">
|
| 550 |
+
<h2>التوثيق والتشغيل (Documentation)</h2>
|
| 551 |
+
<div class="card" style="margin-top:20px;">
|
| 552 |
+
<h3><i class="fa-brands fa-docker"></i> التشغيل باستخدام Docker</h3>
|
| 553 |
+
<p style="color:var(--text-muted); margin-bottom:10px;">لتشغيل عقدة كاملة (Full Node) محلياً:</p>
|
| 554 |
+
<div class="editor-container">
|
| 555 |
+
<textarea class="code-area" style="height:150px; font-size:0.9rem;" readonly>
|
| 556 |
+
# docker-compose.yml
|
| 557 |
+
version: '3'
|
| 558 |
+
services:
|
| 559 |
+
arabchain-node:
|
| 560 |
+
image: arabchain/core:latest
|
| 561 |
+
ports:
|
| 562 |
+
- "30303:30303" # P2P
|
| 563 |
+
- "8545:8545" # JSON-RPC
|
| 564 |
+
volumes:
|
| 565 |
+
- ./data:/root/.arabchain
|
| 566 |
+
command: --network mainnet --sync-mode full
|
| 567 |
+
</textarea>
|
| 568 |
+
</div>
|
| 569 |
+
</div>
|
| 570 |
+
|
| 571 |
+
<div class="card" style="margin-top:20px;">
|
| 572 |
+
<h3><i class="fa-solid fa-server"></i> JSON-RPC API</h3>
|
| 573 |
+
<p style="color:var(--text-muted);">مثال على طلب رصيد باستخدام cURL:</p>
|
| 574 |
+
<div class="editor-container">
|
| 575 |
+
<textarea class="code-area" style="height:80px; font-size:0.9rem;" readonly>
|
| 576 |
+
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x407d73d8a49eeb85d32cf465507dd71d507100c1", "latest"],"id":1}' -H "Content-Type: application/json" localhost:8545
|
| 577 |
+
</textarea>
|
| 578 |
+
</div>
|
| 579 |
+
</div>
|
| 580 |
+
</div>
|
| 581 |
+
|
| 582 |
+
</main>
|
| 583 |
+
</div>
|
| 584 |
+
|
| 585 |
+
<script>
|
| 586 |
+
// --- Navigation Logic ---
|
| 587 |
+
function showSection(id) {
|
| 588 |
+
document.querySelectorAll('.section').forEach(sec => sec.classList.remove('active'));
|
| 589 |
+
document.getElementById(id).classList.add('active');
|
| 590 |
+
|
| 591 |
+
document.querySelectorAll('.nav-item').forEach(item => item.classList.remove('active'));
|
| 592 |
+
event.currentTarget.classList.add('active');
|
| 593 |
+
|
| 594 |
+
if(id === 'network') initNetworkVis();
|
| 595 |
+
}
|
| 596 |
+
|
| 597 |
+
// --- Blockchain Logic (Simulation) ---
|
| 598 |
+
let blocks = [];
|
| 599 |
+
let blockHeight = 0;
|
| 600 |
+
const maxBlocksDisplay = 5;
|
| 601 |
+
|
| 602 |
+
function generateHash() {
|
| 603 |
+
return '0x' + Array(64).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join('');
|
| 604 |
+
}
|
| 605 |
+
|
| 606 |
+
function createBlock(isManual = false) {
|
| 607 |
+
blockHeight++;
|
| 608 |
+
const prevHash = blocks.length > 0 ? blocks[blocks.length - 1].hash.substring(0, 10) + "..." : "0x000000...";
|
| 609 |
+
const newBlock = {
|
| 610 |
+
height: blockHeight,
|
| 611 |
+
hash: generateHash(),
|
| 612 |
+
prevHash: prevHash,
|
| 613 |
+
txs: Math.floor(Math.random() * 50) + 1,
|
| 614 |
+
validator: "Validator_" + Math.floor(Math.random() * 10),
|
| 615 |
+
time: new Date().toLocaleTimeString()
|
| 616 |
+
};
|
| 617 |
+
|
| 618 |
+
blocks.push(newBlock);
|
| 619 |
+
document.getElementById('blockHeight').innerText = blockHeight;
|
| 620 |
+
|
| 621 |
+
// Update TPS (random fluctuation)
|
| 622 |
+
document.getElementById('tps').innerText = Math.floor(Math.random() * 2000) + 500;
|
| 623 |
+
|
| 624 |
+
renderBlock(newBlock);
|
| 625 |
+
log(`[BLOCKCHAIN] New block #${blockHeight} forged by ${newBlock.validator}`);
|
| 626 |
+
|
| 627 |
+
if (isManual) {
|
| 628 |
+
alert("تم تعدين الكتلة بنجاح!");
|
| 629 |
+
}
|
| 630 |
+
}
|
| 631 |
+
|
| 632 |
+
function renderBlock(block) {
|
| 633 |
+
const container = document.getElementById('chainContainer');
|
| 634 |
+
const blockDiv = document.createElement('div');
|
| 635 |
+
blockDiv.className = 'block';
|
| 636 |
+
blockDiv.innerHTML = `
|
| 637 |
+
<div class="block-header">
|
| 638 |
+
<span>#${block.height}</span>
|
| 639 |
+
<span>${block.time}</span>
|
| 640 |
+
</div>
|
| 641 |
+
<div style="font-size:0.7rem; color:#888;">HASH</div>
|
| 642 |
+
<div class="hash">${block.hash}</div>
|
| 643 |
+
<div style="font-size:0.7rem; color:#888;">PREV HASH</div>
|
| 644 |
+
<div class="hash">${block.prevHash}</div>
|
| 645 |
+
<div style="margin-top:10px; display:flex; justify-content:space-between; font-size:0.8rem;">
|
| 646 |
+
<span><i class="fa-solid fa-list"></i> ${block.txs} Txs</span>
|
| 647 |
+
<span style="color:var(--primary);">${block.validator}</span>
|
| 648 |
+
</div>
|
| 649 |
+
`;
|
| 650 |
+
|
| 651 |
+
// Add link if not first
|
| 652 |
+
if (blocks.length > 1) {
|
| 653 |
+
const link = document.createElement('div');
|
| 654 |
+
link.className = 'chain-link';
|
| 655 |
+
container.prepend(link);
|
| 656 |
+
}
|
| 657 |
+
|
| 658 |
+
container.prepend(blockDiv);
|
| 659 |
+
|
| 660 |
+
// Keep DOM clean
|
| 661 |
+
if (container.children.length > maxBlocksDisplay * 2) {
|
| 662 |
+
container.lastElementChild.remove();
|
| 663 |
+
container.lastElementChild.remove();
|
| 664 |
+
}
|
| 665 |
+
}
|
| 666 |
+
|
| 667 |
+
function log(msg) {
|
| 668 |
+
const logDiv = document.getElementById('systemLog');
|
| 669 |
+
const entry = document.createElement('div');
|
| 670 |
+
entry.innerText = `> ${msg}`;
|
| 671 |
+
logDiv.prepend(entry);
|
| 672 |
+
}
|
| 673 |
+
|
| 674 |
+
function manualMine() {
|
| 675 |
+
createBlock(true);
|
| 676 |
+
}
|
| 677 |
+
|
| 678 |
+
function simulateTx() {
|
| 679 |
+
log("[MEMPOOL] Transaction submitted: 0x" + Math.floor(Math.random()*100000));
|
| 680 |
+
setTimeout(() => alert("تم إرسال المعاملة إلى الشبكة!"), 500);
|
| 681 |
+
}
|
| 682 |
+
|
| 683 |
+
function deployContract() {
|
| 684 |
+
log("[EVM] Compiling Solidity code...");
|
| 685 |
+
setTimeout(() => {
|
| 686 |
+
log("[EVM] Contract deployed at 0x71C...9A");
|
| 687 |
+
document.getElementById('deployStatus').style.display = 'inline-block';
|
| 688 |
+
}, 1500);
|
| 689 |
+
}
|
| 690 |
+
|
| 691 |
+
// --- Validators Mock Data ---
|
| 692 |
+
const validators = [
|
| 693 |
+
{ name: "Binance Node", stake: "2.5M", status: "Active", blocks: 1240 },
|
| 694 |
+
{ name: "ArabChain Foundation", stake: "5M", status: "Active", blocks: 3100 },
|
| 695 |
+
{ name: "Community Node 1", stake: "500K", status: "Active", blocks: 420 },
|
| 696 |
+
{ name: "Kraken Validator", stake: "1.2M", status: "Active", blocks: 890 },
|
| 697 |
+
];
|
| 698 |
+
|
| 699 |
+
const valTable = document.getElementById('validatorsTable');
|
| 700 |
+
validators.forEach(v => {
|
| 701 |
+
const row = `
|
| 702 |
+
<tr style="border-bottom:1px solid rgba(255,255,255,0.05);">
|
| 703 |
+
<td style="padding:15px;">${v.name}</td>
|
| 704 |
+
<td>${v.stake} ARC</td>
|
| 705 |
+
<td style="color:var(--success);"><i class="fa-solid fa-circle" style="font-size:0.5rem"></i> ${v.status}</td>
|
| 706 |
+
<td>${v.blocks}</td>
|
| 707 |
+
</tr>
|
| 708 |
+
`;
|
| 709 |
+
valTable.innerHTML += row;
|
| 710 |
+
});
|
| 711 |
+
|
| 712 |
+
// --- Auto Generate Blocks ---
|
| 713 |
+
setInterval(() => {
|
| 714 |
+
createBlock();
|
| 715 |
+
}, 5000);
|
| 716 |
+
|
| 717 |
+
// --- P2P Canvas Visualization ---
|
| 718 |
+
let canvas, ctx, nodes = [];
|
| 719 |
+
|
| 720 |
+
function initNetworkVis() {
|
| 721 |
+
canvas = document.getElementById('networkCanvas');
|
| 722 |
+
ctx = canvas.getContext('2d');
|
| 723 |
+
canvas.width = canvas.parentElement.offsetWidth;
|
| 724 |
+
canvas.height = 300;
|
| 725 |
+
|
| 726 |
+
nodes = [];
|
| 727 |
+
for(let i=0; i<20; i++) {
|
| 728 |
+
nodes.push({
|
| 729 |
+
x: Math.random() * canvas.width,
|
| 730 |
+
y: Math.random() * canvas.height,
|
| 731 |
+
vx: (Math.random() - 0.5) * 2,
|
| 732 |
+
vy: (Math.random() - 0.5) * 2
|
| 733 |
+
});
|
| 734 |
+
}
|
| 735 |
+
animateNetwork();
|
| 736 |
+
}
|
| 737 |
+
|
| 738 |
+
function animateNetwork() {
|
| 739 |
+
if(!document.getElementById('network').classList.contains('active')) return;
|
| 740 |
+
|
| 741 |
+
ctx.fillStyle = '#000';
|
| 742 |
+
ctx.fillRect(0, 0, canvas.width, canvas.height);
|
| 743 |
+
|
| 744 |
+
// Draw Connections
|
| 745 |
+
ctx.strokeStyle = 'rgba(0, 242, 234, 0.2)';
|
| 746 |
+
ctx.lineWidth = 1;
|
| 747 |
+
for(let i=0; i<nodes.length; i++) {
|
| 748 |
+
for(let j=i+1; j<nodes.length; j++) {
|
| 749 |
+
const dx = nodes[i].x - nodes[j].x;
|
| 750 |
+
const dy = nodes[i].y - nodes[j].y;
|
| 751 |
+
const dist = Math.sqrt(dx*dx + dy*dy);
|
| 752 |
+
if(dist < 100) {
|
| 753 |
+
ctx.beginPath();
|
| 754 |
+
ctx.moveTo(nodes[i].x, nodes[i].y);
|
| 755 |
+
ctx.lineTo(nodes[j].x, nodes[j].y);
|
| 756 |
+
ctx.stroke();
|
| 757 |
+
}
|
| 758 |
+
}
|
| 759 |
+
}
|
| 760 |
+
|
| 761 |
+
// Draw Nodes
|
| 762 |
+
nodes.forEach(node => {
|
| 763 |
+
node.x += node.vx;
|
| 764 |
+
node.y += node.vy;
|
| 765 |
+
|
| 766 |
+
if(node.x < 0 || node.x > canvas.width) node.vx *= -1;
|
| 767 |
+
if(node.y < 0 || node.y > canvas.height) node.vy *= -1;
|
| 768 |
+
|
| 769 |
+
ctx.fillStyle = '#00f2ea';
|
| 770 |
+
ctx.beginPath();
|
| 771 |
+
ctx.arc(node.x, node.y, 3, 0, Math.PI*2);
|
| 772 |
+
ctx.fill();
|
| 773 |
+
});
|
| 774 |
+
|
| 775 |
+
requestAnimationFrame(animateNetwork);
|
| 776 |
+
}
|
| 777 |
+
|
| 778 |
+
// Initialize first block
|
| 779 |
+
createBlock();
|
| 780 |
+
|
| 781 |
+
// Mock Wallet Address
|
| 782 |
+
document.getElementById('myAddress').innerText = '0x' + Array(40).fill(0).map(() => Math.floor(Math.random() * 16).toString(16)).join('');
|
| 783 |
+
|
| 784 |
+
</script>
|
| 785 |
+
</body>
|
| 786 |
+
</html>
|