Files
aitbc/website/docs/blockchain-node.html
oib ff5486fe08 ```
chore: refactor logging module, update genesis timestamp, remove model relationships, and reorganize routers

- Rename logging.py to logger.py and update import paths in poa.py and main.py
- Update devnet genesis timestamp to 1766828620
- Remove SQLModel Relationship declarations from Block, Transaction, and Receipt models
- Add SessionDep type alias and get_session dependency in coordinator-api deps
- Reorganize coordinator-api routers: replace explorer/registry with exchange, users, marketplace
2025-12-28 21:05:53 +01:00

450 lines
14 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Blockchain Node - AITBC Documentation</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-color: #2563eb;
--secondary-color: #1e40af;
--accent-color: #3b82f6;
--success-color: #10b981;
--warning-color: #f59e0b;
--danger-color: #ef4444;
--text-dark: #1f2937;
--text-light: #6b7280;
--bg-light: #f9fafb;
--bg-white: #ffffff;
--border-color: #e5e7eb;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
line-height: 1.6;
color: var(--text-dark);
background: var(--bg-light);
}
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
}
/* Header */
header {
background: var(--bg-white);
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
position: fixed;
width: 100%;
top: 0;
z-index: 1000;
}
nav {
display: flex;
justify-content: space-between;
align-items: center;
padding: 1rem 0;
}
.logo {
font-size: 1.5rem;
font-weight: bold;
color: var(--primary-color);
text-decoration: none;
}
.nav-links {
display: flex;
gap: 2rem;
list-style: none;
}
.nav-links a {
color: var(--text-dark);
text-decoration: none;
transition: color 0.3s;
}
.nav-links a:hover,
.nav-links a.active {
color: var(--primary-color);
}
/* Main Content */
main {
margin-top: 80px;
padding: 40px 0;
}
.doc-header {
background: var(--bg-white);
padding: 3rem 0;
margin-bottom: 2rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.doc-header h1 {
font-size: 2.5rem;
color: var(--text-dark);
margin-bottom: 1rem;
}
.doc-header p {
color: var(--text-light);
font-size: 1.1rem;
}
.breadcrumb {
margin-bottom: 2rem;
}
.breadcrumb a {
color: var(--primary-color);
text-decoration: none;
}
.breadcrumb span {
color: var(--text-light);
margin: 0 0.5rem;
}
/* Content Sections */
.content-section {
background: var(--bg-white);
padding: 2.5rem;
margin-bottom: 2rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.content-section h2 {
font-size: 1.8rem;
margin-bottom: 1.5rem;
color: var(--text-dark);
display: flex;
align-items: center;
gap: 0.5rem;
}
.content-section h3 {
font-size: 1.4rem;
margin: 2rem 0 1rem;
color: var(--text-dark);
}
.content-section p {
margin-bottom: 1rem;
color: var(--text-light);
}
.content-section ul {
margin-left: 2rem;
margin-bottom: 1rem;
}
.content-section li {
margin-bottom: 0.5rem;
color: var(--text-light);
}
.content-section code {
background: var(--bg-light);
padding: 0.2rem 0.4rem;
border-radius: 4px;
font-family: 'Courier New', monospace;
color: var(--primary-color);
}
.content-section pre {
background: var(--bg-light);
padding: 1rem;
border-radius: 8px;
overflow-x: auto;
margin: 1rem 0;
}
.content-section pre code {
background: none;
padding: 0;
color: var(--text-dark);
}
/* Feature Grid */
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
margin: 2rem 0;
}
.feature-card {
padding: 1.5rem;
border: 1px solid var(--border-color);
border-radius: 8px;
background: var(--bg-light);
}
.feature-card h4 {
color: var(--primary-color);
margin-bottom: 0.5rem;
}
/* API Endpoints */
.api-endpoint {
background: var(--bg-light);
padding: 1rem;
border-radius: 8px;
margin: 1rem 0;
border-left: 4px solid var(--primary-color);
}
.api-endpoint code {
display: block;
font-weight: bold;
margin-bottom: 0.5rem;
}
/* Status Badge */
.status-badge {
display: inline-block;
padding: 0.25rem 0.75rem;
border-radius: 20px;
font-size: 0.875rem;
font-weight: 600;
}
.status-badge.live {
background: #10b98120;
color: var(--success-color);
}
/* Back Button */
.back-button {
display: inline-flex;
align-items: center;
gap: 0.5rem;
color: var(--primary-color);
text-decoration: none;
margin-bottom: 2rem;
font-weight: 600;
}
.back-button:hover {
color: var(--secondary-color);
}
/* Responsive */
@media (max-width: 768px) {
.nav-links {
display: none;
}
.doc-header h1 {
font-size: 2rem;
}
.content-section {
padding: 1.5rem;
}
}
</style>
</head>
<body>
<!-- Header -->
<header>
<nav class="container">
<a href="../index.html" class="logo">AITBC</a>
<ul class="nav-links">
<li><a href="../index.html">Home</a></li>
<li><a href="index.html" class="active">Documentation</a></li>
<li><a href="mailto:aitbc@bubuit.net">Contact</a></li>
</ul>
</nav>
</header>
<!-- Main Content -->
<main>
<div class="container">
<!-- Breadcrumb -->
<div class="breadcrumb">
<a href="index.html">Documentation</a>
<span></span>
<a href="#">Components</a>
<span></span>
<span>Blockchain Node</span>
</div>
<!-- Back Button -->
<a href="components.html" class="back-button">
<i class="fas fa-arrow-left"></i>
Back to Components
</a>
<!-- Header -->
<div class="doc-header">
<h1><i class="fas fa-cube"></i> Blockchain Node</h1>
<p>PoA/PoS consensus blockchain with REST/WebSocket RPC, real-time gossip layer, and comprehensive observability</p>
<span class="status-badge live">● Live</span>
</div>
<!-- Overview -->
<section class="content-section">
<h2>Overview</h2>
<p>The AITBC Blockchain Node is the core infrastructure component that maintains the distributed ledger. It implements a hybrid Proof-of-Authority/Proof-of-Stake consensus mechanism with fast finality and supports high throughput for AI workload transactions.</p>
<h3>Key Features</h3>
<ul>
<li>Hybrid PoA/PoS consensus with sub-second finality</li>
<li>REST and WebSocket RPC APIs</li>
<li>Real-time gossip protocol for block propagation</li>
<li>Comprehensive observability with Prometheus metrics</li>
<li>SQLModel-based data persistence</li>
<li>Built-in devnet tooling and scripts</li>
</ul>
</section>
<!-- Architecture -->
<section class="content-section">
<h2>Architecture</h2>
<p>The blockchain node is built with a modular architecture separating concerns for consensus, storage, networking, and API layers.</p>
<div class="feature-grid">
<div class="feature-card">
<h4>Consensus Engine</h4>
<p>Hybrid PoA/PoS with proposer rotation and validator sets</p>
</div>
<div class="feature-card">
<h4>Storage Layer</h4>
<p>SQLModel with SQLite/PostgreSQL support</p>
</div>
<div class="feature-card">
<h4>Networking</h4>
<p>WebSocket gossip + REST API</p>
</div>
<div class="feature-card">
<h4>Observability</h4>
<p>Prometheus metrics + structured logging</p>
</div>
</div>
</section>
<!-- API Reference -->
<section class="content-section">
<h2>API Reference</h2>
<p>The blockchain node exposes both REST and WebSocket APIs for interaction.</p>
<h3>REST Endpoints</h3>
<div class="api-endpoint">
<code>GET /rpc/get_head</code>
<p>Get the latest block header</p>
</div>
<div class="api-endpoint">
<code>POST /rpc/send_tx</code>
<p>Submit a new transaction</p>
</div>
<div class="api-endpoint">
<code>GET /rpc/get_balance/{address}</code>
<p>Get account balance</p>
</div>
<div class="api-endpoint">
<code>GET /rpc/get_block/{height}</code>
<p>Get block by height</p>
</div>
<h3>WebSocket Subscriptions</h3>
<ul>
<li><code>new_blocks</code> - Real-time block notifications</li>
<li><code>new_transactions</code> - Transaction pool updates</li>
<li><code>consensus_events</code> - Consensus round updates</li>
</ul>
</section>
<!-- Configuration -->
<section class="content-section">
<h2>Configuration</h2>
<p>The node can be configured via environment variables or configuration file.</p>
<h3>Key Settings</h3>
<pre><code># Database
DATABASE_URL=sqlite:///blockchain.db
# Network
RPC_HOST=0.0.0.0
RPC_PORT=9080
WS_PORT=9081
# Consensus
CONSENSUS_MODE=poa
VALIDATOR_ADDRESS=0x...
BLOCK_TIME=1s
# Observability
METRICS_PORT=9090
LOG_LEVEL=info</code></pre>
</section>
<!-- Deployment -->
<section class="content-section">
<h2>Deployment</h2>
<p>The blockchain node runs on the host machine with GPU access requirements.</p>
<h3>System Requirements</h3>
<ul>
<li>CPU: 4+ cores recommended</li>
<li>RAM: 8GB minimum</li>
<li>Storage: 100GB+ SSD</li>
<li>Network: 1Gbps+ for gossip</li>
</ul>
<h3>Installation</h3>
<pre><code># Clone repository
git clone https://gitea.bubuit.net/oib/aitbc.git
cd aitbc/apps/blockchain-node
# Install dependencies
pip install -r requirements.txt
# Run node
python -m aitbc_chain.node</code></pre>
</section>
<!-- Monitoring -->
<section class="content-section">
<h2>Monitoring & Observability</h2>
<p>The node provides comprehensive monitoring capabilities out of the box.</p>
<h3>Metrics Available</h3>
<ul>
<li>Block production rate and intervals</li>
<li>Transaction pool size and latency</li>
<li>Network gossip metrics</li>
<li>Consensus health indicators</li>
<li>Resource utilization</li>
</ul>
<h3>Grafana Dashboard</h3>
<p>A pre-built Grafana dashboard is available at <code>/observability/grafana/</code></p>
</section>
</div>
</main>
<script>
// Add any interactive functionality here
</script>
</body>
</html>