```
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
This commit is contained in:
449
website/docs/blockchain-node.html
Normal file
449
website/docs/blockchain-node.html
Normal file
@ -0,0 +1,449 @@
|
||||
<!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>
|
||||
448
website/docs/components.html
Normal file
448
website/docs/components.html
Normal file
@ -0,0 +1,448 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Platform Components - 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;
|
||||
}
|
||||
|
||||
/* Components Grid */
|
||||
.components-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
|
||||
gap: 2rem;
|
||||
margin-bottom: 3rem;
|
||||
}
|
||||
|
||||
.component-card {
|
||||
background: var(--bg-white);
|
||||
border-radius: 15px;
|
||||
padding: 2rem;
|
||||
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
|
||||
transition: all 0.3s;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.component-card::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 4px;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
|
||||
.component-card:hover {
|
||||
transform: translateY(-5px);
|
||||
box-shadow: 0 8px 30px rgba(0,0,0,0.12);
|
||||
}
|
||||
|
||||
.component-icon {
|
||||
width: 70px;
|
||||
height: 70px;
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 1.8rem;
|
||||
color: white;
|
||||
margin-bottom: 1.5rem;
|
||||
background: var(--primary-color);
|
||||
}
|
||||
|
||||
.component-card h3 {
|
||||
font-size: 1.5rem;
|
||||
margin-bottom: 1rem;
|
||||
color: var(--text-dark);
|
||||
}
|
||||
|
||||
.component-card p {
|
||||
color: var(--text-light);
|
||||
margin-bottom: 1.5rem;
|
||||
line-height: 1.8;
|
||||
}
|
||||
|
||||
.component-status {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 20px;
|
||||
font-size: 0.875rem;
|
||||
font-weight: 600;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.component-status.live {
|
||||
background: #10b98120;
|
||||
color: var(--success-color);
|
||||
}
|
||||
|
||||
.component-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
color: var(--primary-color);
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s;
|
||||
}
|
||||
|
||||
.component-link:hover {
|
||||
color: var(--secondary-color);
|
||||
transform: translateX(5px);
|
||||
}
|
||||
|
||||
/* Section */
|
||||
.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);
|
||||
}
|
||||
|
||||
.section h2 {
|
||||
font-size: 1.8rem;
|
||||
margin-bottom: 1.5rem;
|
||||
color: var(--text-dark);
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
.components-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</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>
|
||||
<span>Platform Components</span>
|
||||
</div>
|
||||
|
||||
<!-- Back Button -->
|
||||
<a href="index.html" class="back-button">
|
||||
<i class="fas fa-arrow-left"></i>
|
||||
Back to Documentation
|
||||
</a>
|
||||
|
||||
<!-- Header -->
|
||||
<div class="doc-header">
|
||||
<h1>Platform Components</h1>
|
||||
<p>Explore the 7 core components that make up the AITBC platform</p>
|
||||
</div>
|
||||
|
||||
<!-- Components Grid -->
|
||||
<div class="components-grid">
|
||||
<!-- Blockchain Node -->
|
||||
<div class="component-card">
|
||||
<div class="component-icon">
|
||||
<i class="fas fa-cube"></i>
|
||||
</div>
|
||||
<h3>Blockchain Node</h3>
|
||||
<p>PoA/PoS consensus with REST/WebSocket RPC, real-time gossip layer, and comprehensive observability. Production-ready with devnet tooling.</p>
|
||||
<div class="component-status live">
|
||||
<i class="fas fa-circle"></i> Live
|
||||
</div>
|
||||
<a href="blockchain-node.html" class="component-link">
|
||||
Learn More <i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Coordinator API -->
|
||||
<div class="component-card">
|
||||
<div class="component-icon">
|
||||
<i class="fas fa-server"></i>
|
||||
</div>
|
||||
<h3>Coordinator API</h3>
|
||||
<p>FastAPI service for job submission, miner registration, and receipt management. SQLite persistence with comprehensive endpoints.</p>
|
||||
<div class="component-status live">
|
||||
<i class="fas fa-circle"></i> Live
|
||||
</div>
|
||||
<a href="coordinator-api.html" class="component-link">
|
||||
Learn More <i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Marketplace Web -->
|
||||
<div class="component-card">
|
||||
<div class="component-icon">
|
||||
<i class="fas fa-store"></i>
|
||||
</div>
|
||||
<h3>Marketplace Web</h3>
|
||||
<p>Vite/TypeScript marketplace with offer/bid functionality, stats dashboard, and mock/live data toggle. Production UI ready.</p>
|
||||
<div class="component-status live">
|
||||
<i class="fas fa-circle"></i> Live
|
||||
</div>
|
||||
<a href="marketplace-web.html" class="component-link">
|
||||
Learn More <i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Explorer Web -->
|
||||
<div class="component-card">
|
||||
<div class="component-icon">
|
||||
<i class="fas fa-search"></i>
|
||||
</div>
|
||||
<h3>Explorer Web</h3>
|
||||
<p>Full-featured blockchain explorer with blocks, transactions, addresses, and receipts tracking. Responsive design with live data.</p>
|
||||
<div class="component-status live">
|
||||
<i class="fas fa-circle"></i> Live
|
||||
</div>
|
||||
<a href="explorer-web.html" class="component-link">
|
||||
Learn More <i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Wallet Daemon -->
|
||||
<div class="component-card">
|
||||
<div class="component-icon">
|
||||
<i class="fas fa-wallet"></i>
|
||||
</div>
|
||||
<h3>Wallet Daemon</h3>
|
||||
<p>Encrypted keystore with Argon2id + XChaCha20-Poly1305, REST/JSON-RPC APIs, and receipt verification capabilities.</p>
|
||||
<div class="component-status live">
|
||||
<i class="fas fa-circle"></i> Live
|
||||
</div>
|
||||
<a href="wallet-daemon.html" class="component-link">
|
||||
Learn More <i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Trade Exchange -->
|
||||
<div class="component-card">
|
||||
<div class="component-icon">
|
||||
<i class="fas fa-exchange-alt"></i>
|
||||
</div>
|
||||
<h3>Trade Exchange</h3>
|
||||
<p>Bitcoin-to-AITBC exchange with QR payments, user management, and real-time trading. Buy tokens with BTC instantly.</p>
|
||||
<div class="component-status live">
|
||||
<i class="fas fa-circle"></i> Live
|
||||
</div>
|
||||
<a href="trade-exchange.html" class="component-link">
|
||||
Learn More <i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Pool Hub -->
|
||||
<div class="component-card">
|
||||
<div class="component-icon">
|
||||
<i class="fas fa-swimming-pool"></i>
|
||||
</div>
|
||||
<h3>Pool Hub</h3>
|
||||
<p>Miner registry with scoring engine, Redis/PostgreSQL backing, and comprehensive metrics. Live matching API deployed.</p>
|
||||
<div class="component-status live">
|
||||
<i class="fas fa-circle"></i> Live
|
||||
</div>
|
||||
<a href="pool-hub.html" class="component-link">
|
||||
Learn More <i class="fas fa-arrow-right"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Architecture Overview -->
|
||||
<section class="section">
|
||||
<h2>Architecture Overview</h2>
|
||||
<p>The AITBC platform consists of 7 core components working together to provide a complete AI blockchain computing solution:</p>
|
||||
|
||||
<div style="margin-top: 2rem;">
|
||||
<h3>Infrastructure Layer</h3>
|
||||
<ul style="margin-left: 2rem; color: var(--text-light);">
|
||||
<li><strong>Blockchain Node</strong> - Distributed ledger with PoA/PoS consensus</li>
|
||||
<li><strong>Coordinator API</strong> - Job orchestration and management</li>
|
||||
<li><strong>Wallet Daemon</strong> - Secure wallet management</li>
|
||||
</ul>
|
||||
|
||||
<h3 style="margin-top: 1.5rem;">Application Layer</h3>
|
||||
<ul style="margin-left: 2rem; color: var(--text-light);">
|
||||
<li><strong>Marketplace Web</strong> - GPU compute marketplace</li>
|
||||
<li><strong>Trade Exchange</strong> - Token trading platform</li>
|
||||
<li><strong>Explorer Web</strong> - Blockchain explorer</li>
|
||||
<li><strong>Pool Hub</strong> - Miner coordination service</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Quick Links -->
|
||||
<section class="section">
|
||||
<h2>Quick Links</h2>
|
||||
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-top: 1.5rem;">
|
||||
<a href="https://aitbc.bubuit.net/Exchange/" target="_blank" style="padding: 1rem; background: var(--bg-light); border-radius: 8px; text-decoration: none; color: var(--text-dark); transition: all 0.3s;" onmouseover="this.style.background='var(--primary-color)'; this.style.color='white';" onmouseout="this.style.background='var(--bg-light)'; this.style.color='var(--text-dark)';">
|
||||
<i class="fas fa-exchange-alt"></i> Trade Exchange
|
||||
</a>
|
||||
<a href="https://aitbc.bubuit.net/marketplace/" target="_blank" style="padding: 1rem; background: var(--bg-light); border-radius: 8px; text-decoration: none; color: var(--text-dark); transition: all 0.3s;" onmouseover="this.style.background='var(--primary-color)'; this.style.color='white';" onmouseout="this.style.background='var(--bg-light)'; this.style.color='var(--text-dark)';">
|
||||
<i class="fas fa-store"></i> Marketplace
|
||||
</a>
|
||||
<a href="https://aitbc.bubuit.net/explorer/" target="_blank" style="padding: 1rem; background: var(--bg-light); border-radius: 8px; text-decoration: none; color: var(--text-dark); transition: all 0.3s;" onmouseover="this.style.background='var(--primary-color)'; this.style.color='white';" onmouseout="this.style.background='var(--bg-light)'; this.style.color='var(--text-dark)';">
|
||||
<i class="fas fa-search"></i> Explorer
|
||||
</a>
|
||||
<a href="https://aitbc.bubuit.net/api/docs" target="_blank" style="padding: 1rem; background: var(--bg-light); border-radius: 8px; text-decoration: none; color: var(--text-dark); transition: all 0.3s;" onmouseover="this.style.background='var(--primary-color)'; this.style.color='white';" onmouseout="this.style.background='var(--bg-light)'; this.style.color='var(--text-dark)';">
|
||||
<i class="fas fa-code"></i> API Docs
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
// Add any interactive functionality here
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
501
website/docs/coordinator-api.html
Normal file
501
website/docs/coordinator-api.html
Normal file
@ -0,0 +1,501 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Coordinator API - 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>Coordinator API</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-server"></i> Coordinator API</h1>
|
||||
<p>FastAPI service for job submission, miner registration, and receipt management with SQLite persistence</p>
|
||||
<span class="status-badge live">● Live</span>
|
||||
</div>
|
||||
|
||||
<!-- Overview -->
|
||||
<section class="content-section">
|
||||
<h2>Overview</h2>
|
||||
<p>The Coordinator API is the central orchestration layer that manages job distribution between clients and miners in the AITBC network. It handles job submissions, miner registrations, and tracks all computation receipts.</p>
|
||||
|
||||
<h3>Key Features</h3>
|
||||
<ul>
|
||||
<li>Job submission and tracking</li>
|
||||
<li>Miner registration and heartbeat monitoring</li>
|
||||
<li>Receipt management and verification</li>
|
||||
<li>User management with wallet-based authentication</li>
|
||||
<li>SQLite persistence with SQLModel ORM</li>
|
||||
<li>Comprehensive API documentation with OpenAPI</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- Architecture -->
|
||||
<section class="content-section">
|
||||
<h2>Architecture</h2>
|
||||
<p>The Coordinator API follows a clean architecture with separation of concerns for domain models, API routes, and business logic.</p>
|
||||
|
||||
<div class="feature-grid">
|
||||
<div class="feature-card">
|
||||
<h4>API Layer</h4>
|
||||
<p>FastAPI routers for clients, miners, admin, and users</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4>Domain Models</h4>
|
||||
<p>SQLModel definitions for jobs, miners, receipts, users</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4>Business Logic</h4>
|
||||
<p>Service layer handling job orchestration</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4>Persistence</h4>
|
||||
<p>SQLite database with Alembic migrations</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- API Reference -->
|
||||
<section class="content-section">
|
||||
<h2>API Reference</h2>
|
||||
<p>The Coordinator API provides RESTful endpoints for all major operations.</p>
|
||||
|
||||
<h3>Client Endpoints</h3>
|
||||
<div class="api-endpoint">
|
||||
<code>POST /v1/client/jobs</code>
|
||||
<p>Submit a new computation job</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /v1/client/jobs/{job_id}/status</code>
|
||||
<p>Get job status and progress</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /v1/client/jobs/{job_id}/receipts</code>
|
||||
<p>Retrieve computation receipts</p>
|
||||
</div>
|
||||
|
||||
<h3>Miner Endpoints</h3>
|
||||
<div class="api-endpoint">
|
||||
<code>POST /v1/miner/register</code>
|
||||
<p>Register as a compute provider</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>POST /v1/miner/heartbeat</code>
|
||||
<p>Send miner heartbeat</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /v1/miner/jobs</code>
|
||||
<p>Fetch available jobs</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>POST /v1/miner/result</code>
|
||||
<p>Submit job result</p>
|
||||
</div>
|
||||
|
||||
<h3>User Management</h3>
|
||||
<div class="api-endpoint">
|
||||
<code>POST /v1/users/login</code>
|
||||
<p>Login or register with wallet</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /v1/users/me</code>
|
||||
<p>Get current user profile</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /v1/users/{user_id}/balance</code>
|
||||
<p>Get user wallet balance</p>
|
||||
</div>
|
||||
|
||||
<h3>Exchange Endpoints</h3>
|
||||
<div class="api-endpoint">
|
||||
<code>POST /v1/exchange/create-payment</code>
|
||||
<p>Create Bitcoin payment request</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /v1/exchange/payment-status/{id}</code>
|
||||
<p>Check payment status</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Authentication -->
|
||||
<section class="content-section">
|
||||
<h2>Authentication</h2>
|
||||
<p>The API uses API key authentication for clients and miners, and session-based authentication for users.</p>
|
||||
|
||||
<h3>API Keys</h3>
|
||||
<pre><code>X-Api-Key: your-api-key-here</code></pre>
|
||||
|
||||
<h3>Session Tokens</h3>
|
||||
<pre><code>X-Session-Token: sha256-token-here</code></pre>
|
||||
|
||||
<h3>Example Request</h3>
|
||||
<pre><code>curl -X POST "https://aitbc.bubuit.net/api/v1/client/jobs" \
|
||||
-H "X-Api-Key: your-key" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"job_type": "llm_inference",
|
||||
"parameters": {...}
|
||||
}'</code></pre>
|
||||
</section>
|
||||
|
||||
<!-- Configuration -->
|
||||
<section class="content-section">
|
||||
<h2>Configuration</h2>
|
||||
<p>The Coordinator API can be configured via environment variables.</p>
|
||||
|
||||
<h3>Environment Variables</h3>
|
||||
<pre><code># Database
|
||||
DATABASE_URL=sqlite:///coordinator.db
|
||||
|
||||
# API Settings
|
||||
API_HOST=0.0.0.0
|
||||
API_PORT=8000
|
||||
|
||||
# Security
|
||||
SECRET_KEY=your-secret-key
|
||||
API_KEYS=key1,key2,key3
|
||||
|
||||
# Exchange
|
||||
BITCOIN_ADDRESS=tb1qxy2...
|
||||
BTC_TO_AITBC_RATE=100000</code></pre>
|
||||
</section>
|
||||
|
||||
<!-- Deployment -->
|
||||
<section class="content-section">
|
||||
<h2>Deployment</h2>
|
||||
<p>The Coordinator API runs in a Docker container with nginx proxy.</p>
|
||||
|
||||
<h3>Docker Deployment</h3>
|
||||
<pre><code># Build image
|
||||
docker build -t aitbc-coordinator .
|
||||
|
||||
# Run container
|
||||
docker run -d \
|
||||
--name aitbc-coordinator \
|
||||
-p 8000:8000 \
|
||||
-e DATABASE_URL=sqlite:///data/coordinator.db \
|
||||
-v $(pwd)/data:/app/data \
|
||||
aitbc-coordinator</code></pre>
|
||||
|
||||
<h3>Systemd Service</h3>
|
||||
<pre><code># Start service
|
||||
sudo systemctl start aitbc-coordinator
|
||||
|
||||
# Check status
|
||||
sudo systemctl status aitbc-coordinator
|
||||
|
||||
# View logs
|
||||
sudo journalctl -u aitbc-coordinator -f</code></pre>
|
||||
</section>
|
||||
|
||||
<!-- API Documentation -->
|
||||
<section class="content-section">
|
||||
<h2>Interactive API Documentation</h2>
|
||||
<p>Interactive API documentation is available via Swagger UI and ReDoc.</p>
|
||||
|
||||
<ul>
|
||||
<li><a href="https://aitbc.bubuit.net/api/docs" target="_blank">Swagger UI</a></li>
|
||||
<li><a href="https://aitbc.bubuit.net/api/redoc" target="_blank">ReDoc</a></li>
|
||||
<li><a href="https://aitbc.bubuit.net/api/openapi.json" target="_blank">OpenAPI Spec</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
// Add any interactive functionality here
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
540
website/docs/trade-exchange.html
Normal file
540
website/docs/trade-exchange.html
Normal file
@ -0,0 +1,540 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Trade Exchange - 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);
|
||||
}
|
||||
|
||||
/* CTA Button */
|
||||
.cta-button {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
background: var(--primary-color);
|
||||
color: white;
|
||||
padding: 12px 30px;
|
||||
border-radius: 50px;
|
||||
text-decoration: none;
|
||||
font-weight: 600;
|
||||
transition: all 0.3s;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
|
||||
.cta-button:hover {
|
||||
background: var(--secondary-color);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
||||
}
|
||||
|
||||
/* 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>Trade Exchange</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-exchange-alt"></i> Trade Exchange</h1>
|
||||
<p>AITBC exchange with QR payments, user management, and real-time trading capabilities</p>
|
||||
<span class="status-badge live">● Live</span>
|
||||
<br><br>
|
||||
<a href="https://aitbc.bubuit.net/Exchange/" class="cta-button" target="_blank">
|
||||
<i class="fas fa-external-link-alt"></i>
|
||||
Launch Exchange
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<!-- Overview -->
|
||||
<section class="content-section">
|
||||
<h2>Overview</h2>
|
||||
<p>The AITBC Trade Exchange is a crypto-only platform that enables users to exchange Bitcoin for AITBC tokens. It features a modern, responsive interface with user authentication, wallet management, and real-time trading capabilities.</p>
|
||||
|
||||
<h3>Key Features</h3>
|
||||
<ul>
|
||||
<li>Bitcoin wallet integration with QR code payments</li>
|
||||
<li>User management with wallet-based authentication</li>
|
||||
<li>Real-time payment monitoring and confirmation</li>
|
||||
<li>Individual user wallets and balance tracking</li>
|
||||
<li>Transaction history and receipt management</li>
|
||||
<li>Mobile-responsive design</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- How It Works -->
|
||||
<section class="content-section">
|
||||
<h2>How It Works</h2>
|
||||
<p>The Trade Exchange provides a simple, secure way to acquire AITBC tokens using Bitcoin.</p>
|
||||
|
||||
<div class="feature-grid">
|
||||
<div class="feature-card">
|
||||
<h4><i class="fas fa-wallet"></i> 1. Connect Wallet</h4>
|
||||
<p>Click "Connect Wallet" to generate a unique wallet address and create your account</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4><i class="fas fa-calculator"></i> 2. Select Amount</h4>
|
||||
<p>Enter the amount of AITBC you want to buy or Bitcoin you want to spend</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4><i class="fas fa-qrcode"></i> 3. Make Payment</h4>
|
||||
<p>Scan the QR code or send Bitcoin to the provided address</p>
|
||||
</div>
|
||||
<div class="feature-card">
|
||||
<h4><i class="fas fa-coins"></i> 4. Receive Tokens</h4>
|
||||
<p>AITBC tokens are credited to your wallet after confirmation</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- User Management -->
|
||||
<section class="content-section">
|
||||
<h2>User Management</h2>
|
||||
<p>The exchange uses a wallet-based authentication system that requires no passwords.</p>
|
||||
|
||||
<h3>Authentication Flow</h3>
|
||||
<ul>
|
||||
<li>Users connect with a wallet address (auto-generated for demo)</li>
|
||||
<li>System creates or retrieves user account</li>
|
||||
<li>Session token issued for secure API access</li>
|
||||
<li>24-hour automatic session expiry</li>
|
||||
</ul>
|
||||
|
||||
<h3>User Features</h3>
|
||||
<ul>
|
||||
<li>Unique username and user ID</li>
|
||||
<li>Personal AITBC wallet with balance tracking</li>
|
||||
<li>Complete transaction history</li>
|
||||
<li>Secure logout functionality</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- Exchange API -->
|
||||
<section class="content-section">
|
||||
<h2>Exchange API</h2>
|
||||
<p>The exchange provides RESTful APIs for user management and payment processing.</p>
|
||||
|
||||
<h3>User Management Endpoints</h3>
|
||||
<div class="api-endpoint">
|
||||
<code>POST /api/users/login</code>
|
||||
<p>Login or register with wallet address</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /api/users/me</code>
|
||||
<p>Get current user profile</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /api/users/{id}/balance</code>
|
||||
<p>Get user wallet balance</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>POST /api/users/logout</code>
|
||||
<p>Logout and invalidate session</p>
|
||||
</div>
|
||||
|
||||
<h3>Exchange Endpoints</h3>
|
||||
<div class="api-endpoint">
|
||||
<code>POST /api/exchange/create-payment</code>
|
||||
<p>Create Bitcoin payment request</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /api/exchange/payment-status/{id}</code>
|
||||
<p>Check payment confirmation status</p>
|
||||
</div>
|
||||
|
||||
<div class="api-endpoint">
|
||||
<code>GET /api/exchange/rates</code>
|
||||
<p>Get current exchange rates</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<!-- Security -->
|
||||
<section class="content-section">
|
||||
<h2>Security Features</h2>
|
||||
<p>The exchange implements multiple security measures to protect user funds and data.</p>
|
||||
|
||||
<h3>Authentication Security</h3>
|
||||
<ul>
|
||||
<li>SHA-256 hashed session tokens</li>
|
||||
<li>24-hour automatic session expiry</li>
|
||||
<li>Server-side session validation</li>
|
||||
<li>Secure token invalidation on logout</li>
|
||||
</ul>
|
||||
|
||||
<h3>Payment Security</h3>
|
||||
<ul>
|
||||
<li>Unique payment addresses for each transaction</li>
|
||||
<li>Real-time blockchain monitoring</li>
|
||||
<li>Payment confirmation requirements (1 confirmation)</li>
|
||||
<li>Automatic refund for expired payments</li>
|
||||
</ul>
|
||||
|
||||
<h3>Privacy</h3>
|
||||
<ul>
|
||||
<li>No personal data collection</li>
|
||||
<li>User data isolation</li>
|
||||
<li>GDPR compliant design</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- Configuration -->
|
||||
<section class="content-section">
|
||||
<h2>Configuration</h2>
|
||||
<p>The exchange can be configured for different environments and requirements.</p>
|
||||
|
||||
<h3>Exchange Settings</h3>
|
||||
<pre><code># Exchange Rate
|
||||
BTC_TO_AITBC_RATE=100000
|
||||
|
||||
# Payment Settings
|
||||
MIN_CONFIRMATIONS=1
|
||||
PAYMENT_TIMEOUT=3600 # 1 hour
|
||||
MIN_PAYMENT=0.0001 # BTC
|
||||
MAX_PAYMENT=10 # BTC
|
||||
|
||||
# Bitcoin Network
|
||||
BITCOIN_NETWORK=testnet
|
||||
BITCOIN_RPC_URL=http://localhost:8332
|
||||
BITCOIN_RPC_USER=user
|
||||
BITCOIN_RPC_PASS=password</code></pre>
|
||||
</section>
|
||||
|
||||
<!-- Getting Started -->
|
||||
<section class="content-section">
|
||||
<h2>Getting Started</h2>
|
||||
<p>Start using the Trade Exchange in just a few simple steps.</p>
|
||||
|
||||
<h3>1. Access the Exchange</h3>
|
||||
<p>Visit: <a href="https://aitbc.bubuit.net/Exchange/" target="_blank">https://aitbc.bubuit.net/Exchange/</a></p>
|
||||
|
||||
<h3>2. Connect Your Wallet</h3>
|
||||
<p>Click the "Connect Wallet" button. A unique wallet address will be generated for you.</p>
|
||||
|
||||
<h3>3. Get Testnet Bitcoin</h3>
|
||||
<p>For testing, get free testnet Bitcoin from:
|
||||
<br><a href="https://testnet-faucet.mempool.co/" target="_blank">testnet-faucet.mempool.co</a></p>
|
||||
|
||||
<h3>4. Make Your First Purchase</h3>
|
||||
<ul>
|
||||
<li>Enter the amount of AITBC you want</li>
|
||||
<li>Click "Create Payment Request"</li>
|
||||
<li>Send Bitcoin to the provided address</li>
|
||||
<li>Wait for confirmation</li>
|
||||
<li>Receive your AITBC tokens!</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<!-- Support -->
|
||||
<section class="content-section">
|
||||
<h2>Support & Resources</h2>
|
||||
<p>Find help and additional resources for using the Trade Exchange.</p>
|
||||
|
||||
<h3>Documentation</h3>
|
||||
<ul>
|
||||
<li><a href="trade_exchange.html" target="_blank">Complete Trade Exchange Guide</a></li>
|
||||
<li><a href="https://aitbc.bubuit.net/api/docs" target="_blank">API Documentation</a></li>
|
||||
</ul>
|
||||
|
||||
<h3>Troubleshooting</h3>
|
||||
<ul>
|
||||
<li>Payment not showing? Check for 1 confirmation</li>
|
||||
<li>Can't connect? Enable JavaScript and refresh</li>
|
||||
<li>Balance incorrect? Wait for blockchain sync</li>
|
||||
</ul>
|
||||
|
||||
<h3>Contact</h3>
|
||||
<ul>
|
||||
<li>Email: <a href="mailto:aitbc@bubuit.net">aitbc@bubuit.net</a></li>
|
||||
<li>Discord: <a href="https://discord.gg/aitbc" target="_blank">discord.gg/aitbc</a></li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
</main>
|
||||
|
||||
<script>
|
||||
// Add any interactive functionality here
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user