Files
aitbc/website/docs/blockchain-node.html

199 lines
7.8 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="css/docs.css">
<link rel="stylesheet" href="/assets/css/site-header.css">
<link rel="preload" href="/assets/css/font-awesome.min.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="/assets/css/font-awesome.min.css"></noscript>
<!-- Font Awesome CDN fallback -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" crossorigin="anonymous" media="print" onload="this.media='all'; this.onload=null;">
</head>
<body>
<div data-global-header></div>
<!-- Main Content -->
<main>
<div class="container">
<!-- Breadcrumb -->
<div class="breadcrumb">
<a href="index.html">Documentation</a>
<span></span>
<a href="components.html">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">
<div class="alert alert-info">
<i class="fas fa-info-circle"></i>
<strong>System Flow:</strong> See the <a href="flowchart.html">complete system flow diagram</a> to understand how the blockchain node interacts with other AITBC components.
</div>
<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://github.com/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>
<script src="js/theme.js"></script>
<script src="/assets/js/global-header.js"></script>
</body>
</html>