From a9f9003ad18166061ea39fd24406ac24581b97a3 Mon Sep 17 00:00:00 2001 From: oib Date: Wed, 11 Feb 2026 20:59:05 +0100 Subject: [PATCH] docs: update documentation links to use relative paths and add system flow references - Replace absolute aitbc.bubuit.net URLs with relative paths in documentation pages - Update markdown documentation links from /main/ to /master/ branch - Add system flow diagram references to component documentation pages - Remove redundant "Also available in Markdown" notices from HTML docs - Update Font Awesome CDN link in index.html - Simplify quick links section and remove unused tutorial/video guide plac --- SECURITY_CLEANUP_GUIDE.md | 158 +++ scripts/start_mock_blockchain.sh | 87 ++ tests/mock_blockchain_node.py | 96 ++ website/docs/api.html | 375 +++++++ website/docs/blockchain-node.html | 6 +- website/docs/browser-wallet.html | 6 +- website/docs/client-documentation-md.html | 4 +- website/docs/components-md.html | 9 +- website/docs/components.html | 15 +- website/docs/coordinator-api.html | 6 +- website/docs/css/docs.css | 6 + website/docs/developer-documentation-md.html | 633 ++++++++++++ website/docs/docs-clients.html | 6 +- website/docs/docs-developers.html | 4 - website/docs/docs-miners.html | 6 +- website/docs/explorer-web.html | 422 ++++++++ website/docs/flowchart.html | 753 ++++++++++++++ website/docs/full-documentation-md.html | 643 ++++++++++++ website/docs/full-documentation.html | 4 - website/docs/index.html | 92 +- website/docs/marketplace-web.html | 973 ++++++++----------- website/docs/miner-documentation-md.html | 585 +++++++++++ website/docs/pool-hub.html | 478 +++++++++ website/docs/trade-exchange.html | 6 +- website/docs/wallet-daemon.html | 428 ++++++++ 25 files changed, 5146 insertions(+), 655 deletions(-) create mode 100644 SECURITY_CLEANUP_GUIDE.md create mode 100644 scripts/start_mock_blockchain.sh create mode 100644 tests/mock_blockchain_node.py create mode 100644 website/docs/api.html create mode 100644 website/docs/developer-documentation-md.html create mode 100644 website/docs/explorer-web.html create mode 100644 website/docs/flowchart.html create mode 100644 website/docs/full-documentation-md.html create mode 100644 website/docs/miner-documentation-md.html create mode 100644 website/docs/pool-hub.html create mode 100644 website/docs/wallet-daemon.html diff --git a/SECURITY_CLEANUP_GUIDE.md b/SECURITY_CLEANUP_GUIDE.md new file mode 100644 index 00000000..742482ab --- /dev/null +++ b/SECURITY_CLEANUP_GUIDE.md @@ -0,0 +1,158 @@ +# AITBC Security Cleanup & GitHub Setup Guide + +## 🔐 SECURITY FINDINGS + +### Files Currently Tracked That Should Be Removed + +**High Priority - Remove Immediately:** +1. `.windsurf/` - Entire IDE configuration directory + - Contains local IDE settings, skills, and workflows + - Should never be in a public repository + +2. **Infrastructure secrets files:** + - `infra/k8s/sealed-secrets.yaml` - Contains sealed secrets configuration + - `infra/terraform/environments/secrets.tf` - References AWS Secrets Manager + +### Files With Hardcoded Credentials (Documentation/Examples) + +**Low Priority - These are examples but should be cleaned:** +- `website/docs/coordinator-api.html` - Contains `SECRET_KEY=your-secret-key` +- `website/docs/wallet-daemon.html` - Contains `password="password"` +- `website/docs/pool-hub.html` - Contains `POSTGRES_PASSWORD=pass` + +## 🚨 IMMEDIATE ACTIONS REQUIRED + +### 1. Remove Sensitive Files from Git History +```bash +# Remove .windsurf directory completely +git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch .windsurf/' --prune-empty --tag-name-filter cat -- --all + +# Remove infrastructure secrets files +git filter-branch --force --index-filter 'git rm -rf --cached --ignore-unmatch infra/k8s/sealed-secrets.yaml infra/terraform/environments/secrets.tf' --prune-empty --tag-name-filter cat -- --all + +# Clean up +git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin +git reflog expire --expire=now --all && git gc --prune=now --aggressive +``` + +### 2. Update .gitignore +Add these lines to `.gitignore`: +``` +# IDE configurations +.windsurf/ +.snapshots/ +.vscode/ +.idea/ + +# Additional security +*.env +*.env.* +*.key +*.pem +*.crt +*.p12 +secrets/ +credentials/ +infra/k8s/sealed-secrets.yaml +infra/terraform/environments/secrets.tf +``` + +### 3. Replace Hardcoded Examples +Replace documentation examples with placeholder variables: +- `SECRET_KEY=your-secret-key` → `SECRET_KEY=${SECRET_KEY}` +- `password="password"` → `password="${DB_PASSWORD}"` +- `POSTGRES_PASSWORD=pass` → `POSTGRES_PASSWORD=${POSTGRES_PASSWORD}` + +## 🐙 GITHUB REPOSITORY SETUP + +### Repository Description +``` +AITBC - AI Trusted Blockchain Computing Platform +A comprehensive blockchain-based marketplace for AI computing services with zero-knowledge proof verification and confidential transaction support. +``` + +### Recommended Topics +``` +blockchain ai-computing marketplace zero-knowledge-proofs confidential-transactions web3 python fastapi react typescript kubernetes terraform helm decentralized gpu-computing zk-proofs cryptography smart-contracts +``` + +### Repository Settings to Configure + +**Security Settings:** +- ✅ Enable "Security advisories" +- ✅ Enable "Dependabot alerts" +- ✅ Enable "Dependabot security updates" +- ✅ Enable "Code security" (GitHub Advanced Security if available) +- ✅ Enable "Secret scanning" + +**Branch Protection:** +- ✅ Require pull request reviews +- ✅ Require status checks to pass +- ✅ Require up-to-date branches +- ✅ Include administrators +- ✅ Require conversation resolution + +**Integration Settings:** +- ✅ Enable "Issues" +- ✅ Enable "Projects" +- ✅ Enable "Wikis" +- ✅ Enable "Discussions" +- ✅ Enable "Packages" + +## 📋 FINAL CHECKLIST + +### Before Pushing to GitHub: +- [ ] Remove `.windsurf/` directory from git history +- [ ] Remove `infra/k8s/sealed-secrets.yaml` from git history +- [ ] Remove `infra/terraform/environments/secrets.tf` from git history +- [ ] Update `.gitignore` with all exclusions +- [ ] Replace hardcoded credentials in documentation +- [ ] Scan for any remaining sensitive files +- [ ] Test that the repository still builds/works + +### After GitHub Setup: +- [ ] Configure repository settings +- [ ] Set up branch protection rules +- [ ] Enable security features +- [ ] Add README with proper setup instructions +- [ ] Add SECURITY.md for vulnerability reporting +- [ ] Add CONTRIBUTING.md for contributors + +## 🔍 TOOLS FOR VERIFICATION + +### Scan for Credentials: +```bash +# Install truffleHog +pip install trufflehog + +# Scan repository +trufflehog filesystem --directory /path/to/repo + +# Alternative: git-secrets +git secrets --scan -r +``` + +### Git History Analysis: +```bash +# Check for large files +git rev-list --objects --all | git cat-file --batch-check='%(objecttype) %(objectname) %(objectsize) %(rest)' | sed -n 's/^blob //p' | sort -n --key=2 | tail -20 + +# Check for sensitive patterns +git log -p --all | grep -E "(password|secret|key|token)" | head -20 +``` + +## ⚠️ IMPORTANT NOTES + +1. **Force Push Required**: After removing files from history, you'll need to force push: + ```bash + git push origin --force --all + git push origin --force --tags + ``` + +2. **Team Coordination**: Notify all team members before force pushing as they'll need to re-clone the repository. + +3. **Backup**: Create a backup of the current repository before making these changes. + +4. **CI/CD Updates**: Update any CI/CD pipelines that might reference the removed files. + +5. **Documentation**: Update deployment documentation to reflect the changes in secrets management. diff --git a/scripts/start_mock_blockchain.sh b/scripts/start_mock_blockchain.sh new file mode 100644 index 00000000..8c97c0f8 --- /dev/null +++ b/scripts/start_mock_blockchain.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# Start mock blockchain nodes for testing +# This script sets up the required mock servers on ports 8081 and 8082 + +set -e + +echo "🚀 Starting Mock Blockchain Nodes for Testing" +echo "=============================================" + +# Colors +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +NC='\033[0m' + +print_status() { + echo -e "${GREEN}[INFO]${NC} $1" +} + +print_warning() { + echo -e "${YELLOW}[WARN]${NC} $1" +} + +# Check if required ports are available +check_port() { + local port=$1 + if curl -s "http://127.0.0.1:$port/health" >/dev/null 2>&1; then + print_warning "Port $port is already in use" + return 1 + fi + return 0 +} + +# Stop any existing mock servers +stop_existing_servers() { + print_status "Stopping existing mock servers..." + pkill -f "mock_blockchain_node.py" 2>/dev/null || true + sleep 1 +} + +# Start mock servers +start_mock_servers() { + print_status "Starting mock blockchain node on port 8081..." + cd "$(dirname "$0")/.." + python3 tests/mock_blockchain_node.py 8081 > /tmp/mock_node_8081.log 2>&1 & + local pid1=$! + + print_status "Starting mock blockchain node on port 8082..." + python3 tests/mock_blockchain_node.py 8082 > /tmp/mock_node_8082.log 2>&1 & + local pid2=$! + + # Wait for servers to start + sleep 2 + + # Verify servers are running + if curl -s "http://127.0.0.1:8081/health" >/dev/null 2>&1 && \ + curl -s "http://127.0.0.1:8082/health" >/dev/null 2>&1; then + print_status "✅ Mock blockchain nodes are running!" + echo "" + echo "Node 1: http://127.0.0.1:8082" + echo "Node 2: http://127.0.0.1:8081" + echo "" + echo "To run tests:" + echo " python -m pytest tests/test_blockchain_nodes.py -v" + echo "" + echo "To stop servers:" + echo " pkill -f 'mock_blockchain_node.py'" + echo "" + echo "Log files:" + echo " Node 1: /tmp/mock_node_8082.log" + echo " Node 2: /tmp/mock_node_8081.log" + else + print_warning "❌ Failed to start mock servers" + echo "Check log files:" + echo " Node 1: /tmp/mock_node_8082.log" + echo " Node 2: /tmp/mock_node_8081.log" + exit 1 + fi +} + +# Main execution +main() { + stop_existing_servers + start_mock_servers +} + +# Run main function +main "$@" diff --git a/tests/mock_blockchain_node.py b/tests/mock_blockchain_node.py new file mode 100644 index 00000000..dc751bac --- /dev/null +++ b/tests/mock_blockchain_node.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python3 +""" +Mock blockchain node server for testing purposes. +Implements the minimal API endpoints required by the test suite. +""" + +import json +import threading +import time +from typing import Dict, Any + +from fastapi import FastAPI +from fastapi.responses import JSONResponse +import uvicorn + +# Create FastAPI app +app = FastAPI(title="Mock Blockchain Node", version="0.1.0") + +# Mock state +mock_chain_state = { + "height": 100, + "hash": "0xabcdef1234567890", + "balances": { + "aitbc1alice00000000000000000000000000000000000": 1000, + "aitbc1bob0000000000000000000000000000000000000": 500, + "aitbc1charl0000000000000000000000000000000000": 100 + }, + "transactions": [] +} + +@app.get("/openapi.json") +async def openapi(): + """Return OpenAPI spec""" + return { + "openapi": "3.0.0", + "info": { + "title": "AITBC Blockchain API", + "version": "0.1.0" + }, + "paths": {} + } + +@app.get("/rpc/head") +async def get_chain_head(): + """Get current chain head""" + return JSONResponse(mock_chain_state) + +@app.get("/rpc/getBalance/{address}") +async def get_balance(address: str): + """Get balance for an address""" + balance = mock_chain_state["balances"].get(address, 0) + return JSONResponse({"balance": balance}) + +@app.post("/rpc/admin/mintFaucet") +async def mint_faucet(request: Dict[str, Any]): + """Mint tokens to an address (devnet only)""" + address = request.get("address") + amount = request.get("amount", 0) + + if address in mock_chain_state["balances"]: + mock_chain_state["balances"][address] += amount + else: + mock_chain_state["balances"][address] = amount + + return JSONResponse({"success": True, "new_balance": mock_chain_state["balances"][address]}) + +@app.post("/rpc/sendTx") +async def send_transaction(request: Dict[str, Any]): + """Send a transaction""" + # Generate mock transaction hash + tx_hash = f"0x{hash(str(request)) % 1000000000000000000000000000000000000000000000000000000000000000:x}" + + # Add to transactions list + mock_chain_state["transactions"].append({ + "hash": tx_hash, + "type": request.get("type", "TRANSFER"), + "sender": request.get("sender"), + "timestamp": time.time() + }) + + return JSONResponse({"tx_hash": tx_hash, "status": "pending"}) + +@app.get("/health") +async def health(): + """Health check endpoint""" + return JSONResponse({"status": "ok", "height": mock_chain_state["height"]}) + +def run_mock_server(port: int): + """Run the mock server on specified port""" + uvicorn.run(app, host="127.0.0.1", port=port, log_level="warning") + +if __name__ == "__main__": + import sys + port = int(sys.argv[1]) if len(sys.argv) > 1 else 8081 + print(f"Starting mock blockchain node on port {port}") + run_mock_server(port) diff --git a/website/docs/api.html b/website/docs/api.html new file mode 100644 index 00000000..47cd9fe5 --- /dev/null +++ b/website/docs/api.html @@ -0,0 +1,375 @@ + + + + + + API Documentation - AITBC + + + + +
+ +
+ +
+
+ + + + Back to Documentation + + + +
+

API Documentation

+

Complete API reference for the AITBC platform. All APIs are RESTful and use JSON for request/response format.

+
+ + +
+ +
+

Client API

+

Endpoints for job submission, status checking, and receipt retrieval.

+ +
+ POST/v1/jobs +
+

Submit a new AI compute job

+ +
+ GET/v1/jobs/{job_id} +
+

Get job status and results

+ +
+ GET/v1/jobs/{job_id}/receipt +
+

Get computation receipt

+
+ + +
+

Miner API

+

Endpoints for miner registration, job assignment, and result submission.

+ +
+ POST/v1/miners/register +
+

Register as a miner

+ +
+ POST/v1/miners/{address}/heartbeat +
+

Send miner heartbeat

+ +
+ POST/v1/jobs/{job_id}/complete +
+

Submit job results

+
+ + +
+

Admin API

+

Administrative endpoints for system management and monitoring.

+ +
+ GET/v1/admin/miners +
+

List all registered miners

+ +
+ GET/v1/admin/jobs +
+

List all jobs in system

+ +
+ GET/v1/admin/stats +
+

Get system statistics

+
+ + +
+

Marketplace API

+

Endpoints for the compute marketplace and trading functionality.

+ +
+ GET/v1/marketplace/offers +
+

List available compute offers

+ +
+ POST/v1/marketplace/offers +
+

Create a new compute offer

+ +
+ POST/v1/marketplace/trades +
+

Execute a trade

+
+ + +
+

Exchange API

+

Endpoints for token exchange and trading operations.

+ +
+ GET/v1/exchange/ticker +
+

Get current ticker prices

+ +
+ GET/v1/exchange/orderbook +
+

Get order book

+ +
+ POST/v1/exchange/orders +
+

Place a new order

+
+ + +
+

Explorer API

+

Endpoints for blockchain exploration and data retrieval.

+ +
+ GET/v1/explorer/blocks +
+

List recent blocks

+ +
+ GET/v1/explorer/transactions +
+

List recent transactions

+ +
+ GET/v1/explorer/address/{address} +
+

Get address details

+
+
+ + +
+

Authentication

+

All API requests must include an API key in the header:

+
X-Api-Key: your_api_key_here
+ +

Getting API Keys

+
    +
  • Clients: Register through the web interface or contact support
  • +
  • Miners: Generated upon registration
  • +
  • Admin: Pre-configured secure keys
  • +
+
+ + +
+

Base URL

+

All API endpoints are relative to the base URL:

+
https://aitbc.bubuit.net/api
+ +

For development:

+
http://localhost:18000
+
+ + +
+

WebSocket API

+

Real-time updates are available through WebSocket connections:

+
ws://aitbc.bubuit.net:18001/ws
+ +

Subscribe to events:

+
{
+  "method": "subscribe",
+  "params": ["job_updates", "miner_heartbeats"]
+}
+
+
+
+ + + + diff --git a/website/docs/blockchain-node.html b/website/docs/blockchain-node.html index b87ef334..60a7e2c3 100644 --- a/website/docs/blockchain-node.html +++ b/website/docs/blockchain-node.html @@ -300,9 +300,9 @@
-
- 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. +
+ + System Flow: See the complete system flow diagram to understand how the blockchain node interacts with other AITBC components.

Overview

diff --git a/website/docs/browser-wallet.html b/website/docs/browser-wallet.html index 884bd72a..a54f5f93 100644 --- a/website/docs/browser-wallet.html +++ b/website/docs/browser-wallet.html @@ -106,11 +106,7 @@
-
- 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. -
- +

Why Choose AITBC Wallet?

diff --git a/website/docs/client-documentation-md.html b/website/docs/client-documentation-md.html index f45208be..c0daa6d5 100644 --- a/website/docs/client-documentation-md.html +++ b/website/docs/client-documentation-md.html @@ -333,7 +333,7 @@ chmod +x aitbc-cli.sh ./aitbc-cli.sh submit "Your prompt here" --model llama3.2

Web Interface

-

Visit aitbc.bubuit.net/marketplace to access the web interface.

+

Visit the marketplace to access the web interface.

@@ -554,7 +554,7 @@ curl -X GET https://aitbc.bubuit.net/api/v1/jobs/JOB_ID \
  • Documentation: Full API reference
  • Community: Join our Discord
  • Email: aitbc@bubuit.net
  • -
  • Status: System status
  • +
  • Status: System status available in monitoring dashboard
  • Tutorials

    diff --git a/website/docs/components-md.html b/website/docs/components-md.html index b67616e1..7fe0b44b 100644 --- a/website/docs/components-md.html +++ b/website/docs/components-md.html @@ -430,19 +430,19 @@

    Quick Links

    diff --git a/website/docs/components.html b/website/docs/components.html index 41504459..0ffe20fa 100644 --- a/website/docs/components.html +++ b/website/docs/components.html @@ -291,11 +291,12 @@
    -
    - 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. +
    + + System Flow: See the complete system flow diagram to understand how all components interact in the AITBC architecture.
    +
    @@ -429,16 +430,16 @@

    Quick Links

    diff --git a/website/docs/coordinator-api.html b/website/docs/coordinator-api.html index 979cfb26..b5b46c98 100644 --- a/website/docs/coordinator-api.html +++ b/website/docs/coordinator-api.html @@ -300,9 +300,9 @@
    -
    - 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. +
    + + System Flow: See the complete system flow diagram to understand how the coordinator API fits into the overall AITBC architecture.

    Overview

    diff --git a/website/docs/css/docs.css b/website/docs/css/docs.css index bfd7d8bb..fcef56af 100644 --- a/website/docs/css/docs.css +++ b/website/docs/css/docs.css @@ -1074,6 +1074,8 @@ footer p { .reader-card.client::before { background: var(--success-color); } .reader-card.developer::before { background: var(--warning-color); } .reader-card.full-doc::before { background: var(--danger-color); } +.reader-card.components::before { background: #8b5cf6; } +.reader-card.flow::before { background: #06b6d4; } .reader-card:hover { transform: translateY(-10px); @@ -1096,6 +1098,8 @@ footer p { .reader-card.client .reader-icon { background: var(--success-color); } .reader-card.developer .reader-icon { background: var(--warning-color); } .reader-card.full-doc .reader-icon { background: var(--danger-color); } +.reader-card.components .reader-icon { background: #8b5cf6; } +.reader-card.flow .reader-icon { background: #06b6d4; } .reader-card h3 { font-size: 1.8rem; @@ -1137,6 +1141,8 @@ footer p { .reader-card.client .btn { background: var(--success-color); } .reader-card.developer .btn { background: var(--warning-color); } .reader-card.full-doc .btn { background: var(--danger-color); } +.reader-card.components .btn { background: #8b5cf6; } +.reader-card.flow .btn { background: #06b6d4; } /* ============================================ Page-Specific: Search Bar (Index) diff --git a/website/docs/developer-documentation-md.html b/website/docs/developer-documentation-md.html new file mode 100644 index 00000000..94549df7 --- /dev/null +++ b/website/docs/developer-documentation-md.html @@ -0,0 +1,633 @@ + + + + + + Developer Documentation - AITBC + + + + +
    + +
    + +
    +
    + + + + + + + Back to Documentation + + + +
    +

    Developer Documentation

    +

    Build on AITBC and contribute to the protocol. Designed for developers wanting to extend the platform or integrate with it.

    +
    + + +
    +

    Technology Stack

    +

    AITBC is built with modern technologies to ensure performance, security, and developer productivity.

    + +
    +
    +
    + +
    +
    Python
    +
    +
    +
    + +
    +
    Rust
    +
    +
    +
    + +
    +
    TypeScript
    +
    +
    +
    + +
    +
    PostgreSQL
    +
    +
    +
    + +
    +
    Docker
    +
    +
    +
    + +
    +
    Kubernetes
    +
    +
    +
    + + +
    +

    Getting Started

    +

    Ready to contribute? Here's how to get started with AITBC development.

    + +

    Development Environment Setup

    +
    + Prerequisites: Python 3.9+, Node.js 18+, Docker, Git +
    + +
    # Fork & Clone
    +git clone https://gitea.bubuit.net/YOUR_USERNAME/aitbc.git
    +cd aitbc
    +
    +# Set up Python environment
    +python -m venv venv
    +source venv/bin/activate  # On Windows: venv\Scripts\activate
    +pip install -r requirements.txt
    +
    +# Set up frontend
    +cd website
    +npm install
    +npm run dev
    + +

    Project Structure

    +
    aitbc/
    +├── blockchain/          # Blockchain node (Rust)
    +├── coordinator/         # Coordinator API (Python/FastAPI)
    +├── miner/              # Miner daemon (Python)
    +├── wallet/             # Wallet daemon (Python)
    +├── website/            # Frontend applications
    +│   ├── marketplace/    # Marketplace UI (React/TypeScript)
    +│   ├── explorer/       # Blockchain explorer
    +│   └── exchange/       # Trade exchange
    +├── docker-compose.yml  # Development environment
    +└── docs/              # Documentation
    +
    + + +
    +

    Contributing

    +

    We welcome contributions from the community! Here's how you can help:

    + +

    Contribution Areas

    +
    +
    +

    Bug Fixes

    +

    Find and fix bugs in any component

    +
    +
    +

    New Features

    +

    Implement new functionality

    +
    +
    +

    Documentation

    +

    Improve documentation and examples

    +
    +
    +

    Testing

    +

    Write tests and improve coverage

    +
    +
    + +

    Pull Request Process

    +
      +
    1. Create an issue describing your proposed change
    2. +
    3. Fork the repository and create a feature branch
    4. +
    5. Make your changes with proper tests
    6. +
    7. Ensure all tests pass and code follows style guidelines
    8. +
    9. Submit a pull request with detailed description
    10. +
    11. Respond to code review feedback
    12. +
    +
    + + +
    +

    Bounty Program

    +

    Earn AITBC tokens by contributing to the platform through our bounty program.

    + +
    +
    +

    Critical Bug

    +
    1000-5000 AITBC
    +

    Security vulnerabilities or critical issues

    +
    +
    +

    Feature Implementation

    +
    500-2000 AITBC
    +

    New features as outlined in issues

    +
    +
    +

    Documentation

    +
    100-500 AITBC
    +

    Comprehensive guides and tutorials

    +
    +
    +

    Performance

    +
    300-1500 AITBC
    +

    Optimizations and improvements

    +
    +
    + +

    How to Participate

    +
      +
    • Check the Issues page for bounty-labeled items
    • +
    • Claim an issue by commenting on it
    • +
    • Complete the work and submit a PR
    • +
    • Receive bounty upon merge
    • +
    +
    + + +
    +

    APIs & SDKs

    +

    Integrate AITBC into your applications using our APIs and SDKs.

    + +

    REST APIs

    +
      +
    • Coordinator API: Job submission and management
    • +
    • Blockchain RPC: Blockchain interaction
    • +
    • Wallet API: Wallet operations
    • +
    • Pool Hub API: Miner coordination
    • +
    + +

    SDKs

    +
      +
    • Python SDK: pip install aitbc-client
    • +
    • JavaScript SDK: npm install @aitbc/client
    • +
    • Rust Crate: cargo add aitbc-rust
    • +
    • Go Client: go get github.com/aitbc/go-client
    • +
    + +

    Example: Submitting a Job

    +
    from aitbc import AITBCClient
    +
    +client = AITBCClient(api_key="your-key")
    +
    +# Submit inference job
    +job = client.submit_job(
    +    type="inference",
    +    model="llama3.2",
    +    prompt="Explain AI in simple terms",
    +    max_tokens=500
    +)
    +
    +# Wait for result
    +result = client.wait_for_job(job.id)
    +print(result.output)
    +
    + + +
    +

    Example: Adding an API Endpoint

    +

    Here's how to add a new endpoint to the Coordinator API:

    + +

    1. Define the Endpoint

    +
    # coordinator/api/endpoints/jobs.py
    +from fastapi import APIRouter, Depends
    +from ..dependencies import get_current_user
    +from ..schemas import JobResponse
    +
    +router = APIRouter(prefix="/jobs", tags=["jobs"])
    +
    +@router.get("/stats", response_model=JobStats)
    +async def get_job_stats(
    +    current_user: User = Depends(get_current_user)
    +):
    +    """Get job statistics for current user"""
    +    stats = await job_service.get_user_stats(current_user.id)
    +    return stats
    + +

    2. Add Tests

    +
    # tests/api/test_jobs.py
    +async def test_get_job_stats(client, auth_headers):
    +    response = await client.get(
    +        "/api/jobs/stats",
    +        headers=auth_headers
    +    )
    +    assert response.status_code == 200
    +    assert "total_jobs" in response.json()
    + +

    3. Update Documentation

    +
    # docs/api/jobs.md
    +## Job Statistics
    +
    +Get statistics about your submitted jobs.
    +
    +### Request
    +```
    +GET /api/jobs/stats
    +Authorization: Bearer YOUR_TOKEN
    +```
    +
    +### Response
    +```json
    +{
    +  "total_jobs": 42,
    +  "completed_jobs": 38,
    +  "failed_jobs": 2,
    +  "pending_jobs": 2
    +}
    +```
    +
    + + +
    +

    Development Tools

    + +

    Local Development

    +
    # Start all services
    +docker-compose up -d
    +
    +# View logs
    +docker-compose logs -f coordinator
    +
    +# Run tests
    +pytest tests/
    +
    +# Lint code
    +flake8 coordinator/
    +black coordinator/
    + +

    Debugging

    +
      +
    • Use VS Code with Python and Rust extensions
    • +
    • Enable debug mode: DEBUG=true python -m coordinator.main
    • +
    • Use the built-in admin dashboard at /admin
    • +
    +
    + + +
    +

    Community & Support

    + +

    Get in Touch

    + + +

    Developer Events

    +
      +
    • Weekly dev standups - Tuesdays 14:00 UTC
    • +
    • Monthly hackathons - First weekend of each month
    • +
    • Quarterly roadmap reviews
    • +
    +
    + + +
    +

    Additional Resources

    + +
    +
    +
    + +
    +
    +

    © 2025 AITBC. All rights reserved.

    +
    +
    + + diff --git a/website/docs/docs-clients.html b/website/docs/docs-clients.html index 0c7d4321..5ba881f0 100644 --- a/website/docs/docs-clients.html +++ b/website/docs/docs-clients.html @@ -67,9 +67,9 @@
    -
    - 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. +
    + + System Flow: See the complete system flow diagram to understand how client requests flow through the AITBC system.

    Getting Started

    diff --git a/website/docs/docs-developers.html b/website/docs/docs-developers.html index 70c504d9..d5aad869 100644 --- a/website/docs/docs-developers.html +++ b/website/docs/docs-developers.html @@ -95,10 +95,6 @@
    -
    - 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. -

    Getting Started

    Ready to contribute? Here's how to get started with AITBC development.

    diff --git a/website/docs/docs-miners.html b/website/docs/docs-miners.html index fefee9e2..e82a9439 100644 --- a/website/docs/docs-miners.html +++ b/website/docs/docs-miners.html @@ -58,9 +58,9 @@
    -
    - 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. +
    + + System Flow: See the complete system flow diagram to understand how miners receive and process jobs in the AITBC system.

    Getting Started

    diff --git a/website/docs/explorer-web.html b/website/docs/explorer-web.html new file mode 100644 index 00000000..18a9b2d6 --- /dev/null +++ b/website/docs/explorer-web.html @@ -0,0 +1,422 @@ + + + + + + Explorer Web - AITBC Documentation + + + + +
    + +
    + +
    +
    + + + + + + + Back to Components + + + +
    +

    Explorer Web

    +

    Full-featured blockchain explorer with blocks, transactions, addresses, and receipts tracking. Responsive design with live data.

    + ● Live +
    + + +
    +

    Overview

    +

    The AITBC Explorer Web provides a comprehensive view of the blockchain, allowing users to track blocks, transactions, addresses, and AI computation receipts in real-time.

    + +

    Key Features

    +
      +
    • Real-time block and transaction tracking
    • +
    • Address balance and transaction history
    • +
    • AI computation receipt verification
    • +
    • Search functionality for blocks, transactions, and addresses
    • +
    • Responsive design for all devices
    • +
    • Live data updates via WebSocket
    • +
    +
    + + +
    +

    Architecture

    +

    The explorer is built as a modern single-page application:

    + +
    +
    +

    Frontend

    +

    React with TypeScript for type safety

    +
    +
    +

    API Integration

    +

    Direct blockchain RPC API connection

    +
    +
    +

    Real-time Updates

    +

    WebSocket for live block updates

    +
    +
    + Responsive +

    Mobile-first responsive design

    +
    +
    +
    + + +
    +

    Features

    + +

    Block Explorer

    +
      +
    • Latest blocks list with timestamps
    • +
    • Detailed block view with transactions
    • +
    • Block validation status
    • +
    • Block size and gas metrics
    • +
    + +

    Transaction Tracker

    +
      +
    • Transaction details and status
    • +
    • Input/output addresses
    • +
    • Gas fees and confirmations
    • +
    • Transaction mempool status
    • +
    + +

    Address Viewer

    +
      +
    • Address balance and history
    • +
    • Transaction list per address
    • +
    • QR code generation
    • +
    • Address labeling
    • +
    + +

    AI Receipt Explorer

    +
      +
    • Computation receipt details
    • +
    • ZK-proof verification
    • +
    • Job metadata and results
    • +
    • Miner rewards tracking
    • +
    +
    + + +
    +

    API Integration

    +

    The explorer connects directly to the blockchain node RPC API:

    + +
    // Get latest blocks
    +GET /rpc/get_latest_blocks?limit=50
    +
    +// Get block by height
    +GET /rpc/get_block/{height}
    +
    +// Get transaction by hash
    +GET /rpc/get_transaction/{hash}
    +
    +// Get address info
    +GET /rpc/get_address/{address}
    +
    +// WebSocket subscription
    +ws://localhost:9081/ws
    +{
    +  "method": "subscribe",
    +  "params": ["new_blocks", "new_transactions"]
    +}
    +
    + + +
    +

    Deployment

    + +

    Docker Deployment

    +
    # Build explorer image
    +docker build -t aitbc/explorer-web .
    +
    +# Run with nginx
    +docker run -d \
    +  -p 80:80 \
    +  -e API_URL=http://blockchain-node:9080 \
    +  -e WS_URL=ws://blockchain-node:9081 \
    +  aitbc/explorer-web
    + +

    Configuration

    +
    # Environment variables
    +API_URL=http://localhost:9080
    +WS_URL=ws://localhost:9081
    +NETWORK_NAME=mainnet
    +CACHE_TTL=300
    +
    + + +
    +

    Development

    + +

    Local Development

    +
    # Install dependencies
    +npm install
    +
    +# Start development server
    +npm run dev
    +
    +# Build for production
    +npm run build
    +
    +# Run tests
    +npm test
    + +

    Project Structure

    +
    explorer-web/
    +├── src/
    +│   ├── components/     # React components
    +│   ├── pages/         # Page components
    +│   ├── hooks/         # Custom hooks
    +│   ├── services/      # API services
    +│   └── utils/         # Utilities
    +├── public/
    +├── package.json
    +└── Dockerfile
    +
    +
    +
    + +
    +
    +

    © 2025 AITBC. All rights reserved.

    +
    +
    + + diff --git a/website/docs/flowchart.html b/website/docs/flowchart.html new file mode 100644 index 00000000..bae1cae2 --- /dev/null +++ b/website/docs/flowchart.html @@ -0,0 +1,753 @@ + + + + + + System Flow - AITBC Documentation + + + + +
    + +
    + +
    +
    + + + + + + + Back to Documentation + + + +
    +

    AITBC System Flow

    +

    Complete flow of a job submission through the CLI client, detailing each system component, message, RPC call, and port involved.

    +
    + + +
    +

    Overview Diagram

    +
    +
    +
    CLI Wrapper
    +
    +
    Client Python
    +
    +
    Coordinator
    +
    +
    Blockchain
    +
    +
    Miner
    +
    +
    Ollama
    +
    +
    +
    (aitbc-cli.sh) → (client.py) → (port 18000) → (RPC:26657) → (port 18001) → (port 11434)
    +
    +
    + +

    Component Interactions

    +
    +
    +

    1. Job Submission

    +

    User submits CLI command → Python client formats request → HTTP POST to Coordinator

    +
    +
    +

    2. Job Processing

    +

    Coordinator validates → Creates blockchain transaction → Queues for miner

    +
    +
    +

    3. AI Inference

    +

    Miner receives job → Sends to Ollama → Processes on GPU → Returns result

    +
    +
    +

    4. Verification

    +

    Result verified → Receipt generated → Recorded on blockchain → Client notified

    +
    +
    +
    + + +
    +

    Detailed Flow Sequence

    + +

    1. CLI Wrapper Execution

    +

    User Command:

    +
    ./scripts/aitbc-cli.sh submit inference --prompt "What is machine learning?" --model llama3.2:latest
    + +

    Internal Process:

    +
      +
    1. Bash script (aitbc-cli.sh) parses arguments
    2. +
    3. Sets environment variables: +
        +
      • AITBC_URL=http://127.0.0.1:18000
      • +
      • CLIENT_KEY=REDACTED_CLIENT_KEY
      • +
      +
    4. +
    5. Calls Python client: python3 cli/client.py --url $AITBC_URL --api-key $CLIENT_KEY submit inference --prompt "..."
    6. +
    + +

    2. Python Client Processing

    +

    File: /cli/client.py

    + +

    Steps:

    +
      +
    1. Parse command-line arguments
    2. +
    3. Prepare job submission payload: +
      {
      +  "type": "inference",
      +  "prompt": "What is machine learning?",
      +  "model": "llama3.2:latest",
      +  "client_key": "REDACTED_CLIENT_KEY",
      +  "timestamp": "2025-01-29T14:50:00Z"
      +}
      +
    4. +
    + +

    3. Coordinator API Call

    +
    +

    HTTP Request:

    +
    POST /v1/jobs
    +Host: 127.0.0.1:18000
    +Content-Type: application/json
    +X-Api-Key: REDACTED_CLIENT_KEY
    +
    +{
    +  "type": "inference",
    +  "prompt": "What is machine learning?",
    +  "model": "llama3.2:latest"
    +}
    +
    + +

    Coordinator Service (Port 18000):

    +
      +
    1. Receives HTTP request
    2. +
    3. Validates API key and job parameters
    4. +
    5. Generates unique job ID: job_123456
    6. +
    7. Creates job record in database
    8. +
    9. Returns initial response: +
      {
      +  "job_id": "job_123456",
      +  "status": "pending",
      +  "submitted_at": "2025-01-29T14:50:01Z"
      +}
      +
    10. +
    + +

    4. Blockchain Transaction

    +

    Coordinator → Blockchain Node (RPC Port 26657):

    + +
      +
    1. Coordinator creates blockchain transaction: +
      {
      +  "type": "submit_job",
      +  "job_id": "job_123456",
      +  "client": "REDACTED_CLIENT_KEY",
      +  "payload_hash": "abc123...",
      +  "reward": "100aitbc"
      +}
      +
    2. +
    3. RPC Call to blockchain node: +
      curl -X POST http://127.0.0.1:26657 \
      +  -d '{
      +    "jsonrpc": "2.0",
      +    "method": "broadcast_tx_sync",
      +    "params": {"tx": "base64_encoded_transaction"}
      +  }'
      +
    4. +
    5. Blockchain validates and includes transaction in next block
    6. +
    7. Transaction hash returned: 0xdef456...
    8. +
    + +

    5. Job Queue and Miner Assignment

    +

    Coordinator Internal Processing:

    +
      +
    1. Job added to pending queue (Redis/Database)
    2. +
    3. Miner selection algorithm runs: +
        +
      • Check available miners
      • +
      • Select based on stake, reputation, capacity
      • +
      +
    4. +
    5. Selected miner: REDACTED_MINER_KEY
    6. +
    + +
    +

    Coordinator → Miner Daemon (Port 18001):

    +
    POST /v1/jobs/assign
    +Host: 127.0.0.1:18001
    +Content-Type: application/json
    +X-Api-Key: REDACTED_ADMIN_KEY
    +
    +{
    +  "job_id": "job_123456",
    +  "job_data": {
    +    "type": "inference",
    +    "prompt": "What is machine learning?",
    +    "model": "llama3.2:latest"
    +  },
    +  "reward": "100aitbc"
    +}
    +
    + +

    6. Miner Processing

    +

    Miner Daemon (Port 18001):

    +
      +
    1. Receives job assignment
    2. +
    3. Updates job status to running
    4. +
    5. Notifies coordinator: +
      POST /v1/jobs/job_123456/status
      +{"status": "running", "started_at": "2025-01-29T14:50:05Z"}
      +
    6. +
    + +

    7. Ollama Inference Request

    +
    +

    Miner → Ollama Server (Port 11434):

    +
    POST /api/generate
    +Host: 127.0.0.1:11434
    +Content-Type: application/json
    +
    +{
    +  "model": "llama3.2:latest",
    +  "prompt": "What is machine learning?",
    +  "stream": false,
    +  "options": {
    +    "temperature": 0.7,
    +    "num_predict": 500
    +  }
    +}
    +
    + +

    Ollama Processing:

    +
      +
    1. Loads model into GPU memory
    2. +
    3. Processes prompt through neural network
    4. +
    5. Generates response text
    6. +
    7. Returns result: +
      {
      +  "model": "llama3.2:latest",
      +  "response": "Machine learning is a subset of artificial intelligence...",
      +  "done": true,
      +  "total_duration": 12500000000,
      +  "prompt_eval_count": 15,
      +  "eval_count": 150
      +}
      +
    8. +
    + +

    8. Result Submission to Coordinator

    +
    +

    Miner → Coordinator (Port 18000):

    +
    POST /v1/jobs/job_123456/complete
    +Host: 127.0.0.1:18000
    +Content-Type: application/json
    +X-Miner-Key: REDACTED_MINER_KEY
    +
    +{
    +  "job_id": "job_123456",
    +  "result": "Machine learning is a subset of artificial intelligence...",
    +  "metrics": {
    +    "compute_time": 12.5,
    +    "tokens_generated": 150,
    +    "gpu_utilization": 0.85
    +  },
    +  "proof": {
    +    "hash": "hash_of_result",
    +    "signature": "miner_signature"
    +  }
    +}
    +
    + +

    9. Receipt Generation

    +

    Coordinator Processing:

    +
      +
    1. Verifies miner's proof
    2. +
    3. Calculates payment: 12.5 seconds × 0.02 AITBC/second = 0.25 AITBC
    4. +
    5. Creates receipt: +
      {
      +  "receipt_id": "receipt_789",
      +  "job_id": "job_123456",
      +  "client": "REDACTED_CLIENT_KEY",
      +  "miner": "REDACTED_MINER_KEY",
      +  "amount_paid": "0.25aitbc",
      +  "result_hash": "hash_of_result",
      +  "block_height": 12345,
      +  "timestamp": "2025-01-29T14:50:18Z"
      +}
      +
    6. +
    + +

    10. Blockchain Receipt Recording

    +
    Coordinator → Blockchain (RPC Port 26657):
    +{
    +  "type": "record_receipt",
    +  "receipt": {
    +    "receipt_id": "receipt_789",
    +    "job_id": "job_123456",
    +    "payment": "0.25aitbc"
    +  }
    +}
    + +

    11. Client Polling for Result

    +

    CLI Client Status Check:

    +
    ./scripts/aitbc-cli.sh status job_123456
    + +
    +

    HTTP Request:

    +
    GET /v1/jobs/job_123456
    +Host: 127.0.0.1:18000
    +X-Api-Key: REDACTED_CLIENT_KEY
    + +

    Response:

    +
    {
    +  "job_id": "job_123456",
    +  "status": "completed",
    +  "result": "Machine learning is a subset of artificial intelligence...",
    +  "receipt_id": "receipt_789",
    +  "completed_at": "2025-01-29T14:50:18Z"
    +}
    +
    + +

    12. Final Output to User

    +

    CLI displays:

    +
    Job ID: job_123456
    +Status: completed
    +Result: Machine learning is a subset of artificial intelligence...
    +Receipt: receipt_789
    +Completed in: 17 seconds
    +Cost: 0.25 AITBC
    +
    + + +
    +

    System Components Summary

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    ComponentPortProtocolResponsibility
    CLI WrapperN/ABashUser interface, argument parsing
    Client PythonN/APythonHTTP client, job formatting
    Coordinator18000HTTP/RESTJob management, API gateway
    Blockchain Node26657JSON-RPCTransaction processing, consensus
    Miner Daemon18001HTTP/RESTJob execution, GPU management
    Ollama Server11434HTTP/RESTAI model inference
    +
    + + +
    +

    Message Flow Timeline

    +
    0s: User submits CLI command +└─> 0.1s: Python client called + └─> 0.2s: HTTP POST to Coordinator (port 18000) + └─> 0.3s: Coordinator validates and creates job + └─> 0.4s: RPC to Blockchain (port 26657) + └─> 0.5s: Transaction in mempool + └─> 1.0s: Job queued for miner + └─> 2.0s: Miner assigned (port 18001) + └─> 2.1s: Miner accepts job + └─> 2.2s: Ollama request (port 11434) + └─> 14.7s: Inference complete (12.5s processing) + └─> 14.8s: Result to Coordinator + └─> 15.0s: Receipt generated + └─> 15.1s: Receipt on Blockchain + └─> 17.0s: Client polls and gets result
    +
    + + +
    +

    Error Handling Paths

    + +
    +

    1. Invalid Prompt

    +
      +
    • Coordinator returns 400 error
    • +
    • CLI displays error message
    • +
    +
    + +
    +

    2. Miner Unavailable

    +
      +
    • Job stays in queue
    • +
    • Timeout after 60 seconds
    • +
    • Job marked as failed
    • +
    +
    + +
    +

    3. Ollama Error

    +
      +
    • Miner reports failure to Coordinator
    • +
    • Job marked as failed
    • +
    • No payment deducted
    • +
    +
    + +
    +

    4. Network Issues

    +
      +
    • Client retries with exponential backoff
    • +
    • Maximum 3 retries before giving up
    • +
    +
    +
    + + +
    +

    Security Considerations

    +
      +
    • API Keys: Each request authenticated with X-Api-Key header
    • +
    • Proof of Work: Miner provides cryptographic proof of computation
    • +
    • Payment Escrow: Tokens held in smart contract until completion
    • +
    • Rate Limiting: Coordinator limits requests per client
    • +
    +
    + + +
    +

    Related Documentation

    + +
    + + +
    +

    Monitoring Points

    +
      +
    • Coordinator logs all API calls to /var/log/aitbc/coordinator.log
    • +
    • Miner logs GPU utilization to /var/log/aitbc/miner.log
    • +
    • Blockchain logs all transactions to /var/log/aitbc/node.log
    • +
    • Prometheus metrics available at http://localhost:9090/metrics
    • +
    +
    +
    +
    + +
    +
    +

    © 2025 AITBC. All rights reserved.

    +
    +
    + + diff --git a/website/docs/full-documentation-md.html b/website/docs/full-documentation-md.html new file mode 100644 index 00000000..1a8cec90 --- /dev/null +++ b/website/docs/full-documentation-md.html @@ -0,0 +1,643 @@ + + + + + + Full Documentation - AITBC + + + + +
    + +
    + +
    +
    + + + + + + + Back to Documentation + + + +
    +

    AITBC Full Documentation

    +

    Complete technical documentation for the AI Training & Blockchain Computing platform

    +
    + + + + + +
    +

    1. Introduction

    +

    AITBC (AI Training & Blockchain Computing) is a decentralized platform that combines blockchain technology with AI/ML computing resources. It enables privacy-preserving AI computations with verifiable results on the blockchain.

    + +

    Key Features

    +
      +
    • Privacy-preserving AI computations with zero-knowledge proofs
    • +
    • Decentralized GPU marketplace for AI/ML workloads
    • +
    • Blockchain-based verification and receipt system
    • +
    • Hybrid Proof-of-Authority/Proof-of-Stake consensus
    • +
    • Native token (AITBC) for payments and staking
    • +
    + +

    Use Cases

    +
      +
    • Private AI inference without data exposure
    • +
    • Verifiable ML model training
    • +
    • Decentralized GPU resource sharing
    • +
    • Cryptographic proof of computation
    • +
    +
    + + +
    +

    2. Architecture

    +

    AITBC consists of multiple components working together to provide a complete AI blockchain computing solution.

    + +

    System Architecture

    +
    ┌─────────────┐     ┌──────────────┐     ┌─────────────┐
    +│   Clients   │────▶│ Coordinator  │────▶│ Blockchain  │
    +│             │     │     API      │     │    Node     │
    +└─────────────┘     └──────────────┘     └─────────────┘
    +       │                     │                     │
    +       ▼                     ▼                     ▼
    +┌─────────────┐     ┌──────────────┐     ┌─────────────┐
    +│   Wallet    │     │   Pool Hub   │     │   Miners    │
    +│   Daemon    │     │              │     │             │
    +└─────────────┘     └──────────────┘     └─────────────┘
    + +

    Core Components

    +
      +
    • Blockchain Node: Distributed ledger with PoA/PoS consensus
    • +
    • Coordinator API: Job orchestration and management
    • +
    • Wallet Daemon: Secure wallet management
    • +
    • Miner Daemon: GPU compute provider
    • +
    • Pool Hub: Miner coordination and matching
    • +
    • Marketplace Web: GPU compute marketplace UI
    • +
    • Trade Exchange: Token trading platform
    • +
    +
    + + +
    +

    3. Installation

    + +

    Prerequisites

    +
      +
    • Docker & Docker Compose
    • +
    • Python 3.9+ (for development)
    • +
    • Node.js 18+ (for frontend development)
    • +
    • Rust 1.70+ (for blockchain node)
    • +
    + +

    Quick Start with Docker

    +
    # Clone the repository
    +git clone https://gitea.bubuit.net/oib/aitbc.git
    +cd aitbc
    +
    +# Start all services
    +docker-compose up -d
    +
    +# Check status
    +docker-compose ps
    + +

    Development Setup

    +
    # Backend services
    +cd coordinator
    +pip install -r requirements.txt
    +python -m coordinator.main
    +
    +# Frontend
    +cd website/marketplace
    +npm install
    +npm run dev
    +
    +# Blockchain node
    +cd blockchain
    +cargo run
    +
    + + +
    +

    4. APIs

    + +

    Coordinator API

    +

    RESTful API for job submission and management

    +
    # Submit a job
    +POST /api/v1/jobs
    +{
    +  "type": "inference",
    +  "model": "llama3.2",
    +  "input": {
    +    "prompt": "Hello, AITBC!"
    +  }
    +}
    +
    +# Get job status
    +GET /api/v1/jobs/{job_id}
    +
    +# Get job result
    +GET /api/v1/jobs/{job_id}/result
    + +

    Blockchain RPC

    +

    JSON-RPC API for blockchain interaction

    +
    # Get latest block
    +curl -X POST http://localhost:9080 \
    +  -H "Content-Type: application/json" \
    +  -d '{"jsonrpc":"2.0","method":"get_head","params":[],"id":1}'
    +
    +# Submit transaction
    +curl -X POST http://localhost:9080 \
    +  -H "Content-Type: application/json" \
    +  -d '{"jsonrpc":"2.0","method":"send_tx","params":[tx],"id":1}'
    + +

    WebSocket API

    +

    Real-time updates for blocks, transactions, and jobs

    +
    # Connect to WebSocket
    +ws://localhost:9081/ws
    +
    +# Subscribe to events
    +{
    +  "method": "subscribe",
    +  "params": ["new_blocks", "job_updates"]
    +}
    +
    + + +
    +

    5. Components

    + +
    +
    +

    Blockchain Node

    +

    PoA/PoS consensus blockchain with REST/WebSocket RPC, real-time gossip layer, and comprehensive observability.

    + Learn more → +
    + +
    +

    Coordinator API

    +

    FastAPI service for job submission, miner registration, and receipt management with SQLite persistence.

    + Learn more → +
    + +
    +

    Marketplace Web

    +

    Vite/TypeScript marketplace with offer/bid functionality, stats dashboard, and mock/live data toggle.

    + Learn more → +
    + +
    +

    Wallet Daemon

    +

    Encrypted keystore with Argon2id + XChaCha20-Poly1305, REST/JSON-RPC APIs, and receipt verification.

    + Learn more → +
    + +
    +

    Trade Exchange

    +

    Bitcoin-to-AITBC exchange with QR payments, user management, and real-time trading capabilities.

    + Learn more → +
    + +
    +

    Pool Hub

    +

    Miner registry with scoring engine, Redis/PostgreSQL backing, and comprehensive metrics.

    + Learn more → +
    +
    +
    + + +
    +

    6. Guides

    + +

    Client Guide

    +

    Learn how to use AITBC as a client:

    + + +

    Miner Guide

    +

    Learn how to become a miner:

    + + +

    Developer Guide

    +

    Learn how to build on AITBC:

    + +
    + + +
    +

    7. Advanced Topics

    + +

    Zero-Knowledge Proofs

    +

    AITBC uses zk-SNARKs to provide privacy-preserving computations:

    +
      +
    • Input privacy: Your data never leaves your device
    • +
    • Computation verification: Proofs are verified on-chain
    • +
    • Efficient verification: Sub-second proof verification
    • +
    + +

    Consensus Mechanism

    +

    Hybrid PoA/PoS consensus provides:

    +
      +
    • Fast finality: Blocks confirmed in seconds
    • +
    • Energy efficiency: No proof-of-work mining
    • +
    • Security: Multi-layer validation
    • +
    + +

    Tokenomics

    +

    AITBC token utilities:

    +
      +
    • Payment for AI computations
    • +
    • Staking for network security
    • +
    • Governance voting rights
    • +
    • Reward distribution
    • +
    +
    + + +
    +

    8. Troubleshooting

    + +

    Common Issues

    + +
    + Node not syncing? Check peer connections and network connectivity. +
    + +
      +
    1. Connection Issues +
        +
      • Verify all services are running: docker-compose ps
      • +
      • Check logs: docker-compose logs [service]
      • +
      • Ensure ports are not blocked by firewall
      • +
      +
    2. + +
    3. Job Submission Fails +
        +
      • Check API key is valid
      • +
      • Verify model is available
      • +
      • Check wallet balance
      • +
      +
    4. + +
    5. GPU Mining Issues +
        +
      • Install latest NVIDIA drivers
      • +
      • Verify CUDA installation
      • +
      • Check GPU memory availability
      • +
      +
    6. +
    +
    + + +
    +

    9. Security

    + +

    Security Features

    +
      +
    • End-to-end encryption for all data
    • +
    • Zero-knowledge proofs for privacy
    • +
    • Multi-signature wallet support
    • +
    • Hardware wallet integration
    • +
    • Audited smart contracts
    • +
    + +

    Best Practices

    +
      +
    • Keep private keys secure
    • +
    • Use hardware wallets for large amounts
    • +
    • Enable two-factor authentication
    • +
    • Regular security updates
    • +
    + +

    Reporting Issues

    +
    + For security issues, please email: aitbc@bubuit.net +
    +
    +
    +
    + +
    +
    +

    © 2025 AITBC. All rights reserved.

    +
    +
    + + diff --git a/website/docs/full-documentation.html b/website/docs/full-documentation.html index 811f5825..5281dac0 100644 --- a/website/docs/full-documentation.html +++ b/website/docs/full-documentation.html @@ -471,10 +471,6 @@
    -
    - 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. -

    AITBC Full Documentation

    Complete technical documentation for the AI Training & Blockchain Computing platform

    diff --git a/website/docs/index.html b/website/docs/index.html index 5d51526b..a2010cf9 100644 --- a/website/docs/index.html +++ b/website/docs/index.html @@ -5,7 +5,7 @@ Documentation - AITBC - + @@ -42,7 +42,7 @@
    - +
    @@ -50,7 +50,7 @@
    - +

    Miners

    Learn how to mine AITBC tokens and contribute to network security. Perfect for those looking to earn rewards through staking or providing compute power.

    @@ -101,7 +101,7 @@
    - +

    Full Documentation

    Complete technical documentation covering all aspects of the AITBC platform including architecture, APIs, deployment, and advanced features.

    @@ -114,6 +114,42 @@ View Full Documentation
    + + +
    +
    + +
    +

    System Components

    +

    Explore the 7 core components that make up the AITBC platform. Understand how each part works together to create a complete AI blockchain computing solution.

    +
      +
    • Blockchain Node with PoA/PoS consensus
    • +
    • Coordinator API for job orchestration
    • +
    • Wallet Daemon for secure key management
    • +
    • Miner Daemon for GPU compute
    • +
    • Marketplace Web for compute trading
    • +
    • Explorer Web for blockchain viewing
    • +
    • Pool Hub for miner coordination
    • +
    + View Components +
    + + +
    +
    + +
    +

    System Flow

    +

    Visualize the complete flow of a job submission through the CLI client, detailing each system component, message, RPC call, and port involved.

    +
      +
    • End-to-end job submission flow
    • +
    • Component interaction diagrams
    • +
    • API call sequences
    • +
    • Error handling paths
    • +
    • Performance monitoring points
    • +
    + View System Flow +
    @@ -124,7 +160,7 @@ Full Documentation - + Markdown Docs @@ -144,51 +180,7 @@ Support - - - Tutorials - - - - Video Guides - -
    -
    - - -
    -

    📚 Documentation Formats

    -

    Choose your preferred documentation format:

    - -

    - HTML: Original documentation with interactive features | - Web: Clean, fast-loading web format -

    +
    diff --git a/website/docs/marketplace-web.html b/website/docs/marketplace-web.html index 09c62abb..5e6e30f7 100644 --- a/website/docs/marketplace-web.html +++ b/website/docs/marketplace-web.html @@ -3,641 +3,492 @@ - Documentation - AITBC - + Marketplace Web - AITBC Documentation + + + .content-section { + margin-bottom: 3rem; + } + + .content-section h2 { + font-size: 1.8rem; + margin-bottom: 1.5rem; + color: var(--text-dark); + border-bottom: 2px solid var(--border-color); + padding-bottom: 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-dark); + } + + .content-section ul { + margin-bottom: 1rem; + padding-left: 2rem; + } + + .content-section li { + margin-bottom: 0.5rem; + } + + .tech-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 1rem; + margin: 2rem 0; + } + + .tech-item { + background: var(--bg-light); + padding: 1rem; + border-radius: 8px; + text-align: center; + } + + .tech-item strong { + display: block; + color: var(--primary-color); + margin-bottom: 0.5rem; + } + + pre { + background: #1f2937; + color: #f9fafb; + padding: 1.5rem; + border-radius: 8px; + overflow-x: auto; + margin: 1rem 0; + } + + code { + font-family: 'Courier New', Courier, monospace; + font-size: 0.9rem; + } + + pre code { + background: none; + padding: 0; + } + + .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); + } + + .alert { + background: #dbeafe; + border: 1px solid #3b82f6; + border-radius: 8px; + padding: 1rem; + margin: 1rem 0; + } + + .alert-info { + background: #dbeafe; + border-color: #3b82f6; + color: #1e40af; + } + + footer { + background: var(--text-dark); + color: white; + padding: 2rem 0; + text-align: center; + margin-top: 4rem; + } + + @media (max-width: 768px) { + .nav-links { + display: none; + } + + .doc-header h1 { + font-size: 2rem; + } + } + - -
    -
    -
    -
    - -

    AITBC

    -
    - -
    -
    +
    +
    -
    + + + + + + + Back to Components + + +
    -

    Documentation

    -

    Choose your reader level to access tailored documentation for your needs

    +

    Marketplace Web

    +

    Vite/TypeScript marketplace with offer/bid functionality, stats dashboard, and mock/live data toggle. Production UI ready.

    + ● Live
    - -
    - - + +
    + + Documentation Format: View this documentation in markdown format for easier contribution and version control.
    - -
    -
    - 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. -
    + +
    +

    Overview

    +

    The Marketplace Web is the primary interface for clients to submit AI compute jobs and for miners to offer their services. It provides a real-time trading platform with comprehensive job management and analytics.

    - -
    -
    - -
    -

    Miners

    -

    Learn how to mine AITBC tokens and contribute to network security. Perfect for those looking to earn rewards through staking or providing compute power.

    -
      -
    • Mining setup and configuration
    • -
    • Hardware requirements
    • -
    • Profit calculations
    • -
    • Security best practices
    • -
    • Troubleshooting guide
    • -
    - Miner Documentation -
    +

    Key Features

    +
      +
    • Real-time job marketplace with offer/bid functionality
    • +
    • Interactive statistics dashboard
    • +
    • Mock/live data toggle for development
    • +
    • Responsive design for all devices
    • +
    • WebSocket integration for live updates
    • +
    • Wallet integration for seamless payments
    • +
    +
    - -
    -
    - + +
    +

    Technology Stack

    +
    +
    + Framework + Vite 4.x
    -

    Clients

    -

    Use AITBC for your AI/ML workloads with privacy and verifiable computation. Ideal for businesses and developers using AI services.

    -
      -
    • Quick start guide
    • -
    • API and SDK documentation
    • -
    • Use case examples
    • -
    • Pricing information
    • -
    • Privacy & security features
    • -
    - Client Documentation -
    - - -
    -
    - +
    + Language + TypeScript 5.x
    -

    Developers

    -

    Build on AITBC and contribute to the protocol. Designed for developers wanting to extend the platform or integrate with it.

    -
      -
    • Development setup
    • -
    • Contribution guidelines
    • -
    • API reference
    • -
    • Bounty programs
    • -
    • Community resources
    • -
    - Developer Documentation -
    - - -
    -
    - +
    + UI + TailwindCSS + Headless UI +
    +
    + State Management + Zustand +
    +
    + Charts + Chart.js +
    +
    + WebSocket + Native WebSocket API +
    +
    + Icons + Lucide React
    -

    Full Documentation

    -

    Complete technical documentation covering all aspects of the AITBC platform including architecture, APIs, deployment, and advanced features.

    -
      -
    • Architecture overview
    • -
    • Complete API reference
    • -
    • Deployment guides
    • -
    • Security documentation
    • -
    • Advanced configurations
    • -
    - View Full Documentation -
    -
    - - - - -
    -

    Need Help?

    -

    Can't find what you're looking for? Our community is here to help!

    - + +
    +

    Getting Started

    + +

    Prerequisites

    +
      +
    • Node.js 18+
    • +
    • npm or yarn
    • +
    + +

    Installation

    +
    # Clone the repository
    +git clone https://gitea.bubuit.net/oib/aitbc.git
    +cd aitbc/apps/marketplace-web
    +
    +# Install dependencies
    +npm install
    +
    +# Start development server
    +npm run dev
    +
    +# Build for production
    +npm run build
    +
    +# Preview production build
    +npm run preview
    + +

    Environment Configuration

    +
    # .env.local
    +VITE_API_URL=http://localhost:18000
    +VITE_WS_URL=ws://localhost:18001
    +VITE_NETWORK=mainnet
    +VITE_MOCK_DATA=false
    +
    + + +
    +

    Features

    + +

    Job Marketplace

    +
      +
    • Submit AI compute jobs with custom parameters
    • +
    • Browse available miner offers
    • +
    • Real-time price discovery
    • +
    • Job history and tracking
    • +
    + +

    Statistics Dashboard

    +
      +
    • Real-time network metrics
    • +
    • Job completion rates
    • +
    • GPU utilization charts
    • +
    • Price trends analysis
    • +
    + +

    Wallet Integration

    +
      +
    • Connect wallet via private key or keystore
    • +
    • View balance and transaction history
    • +
    • Sign transactions for job submissions
    • +
    • Receipt verification
    • +
    +
    + + +
    +

    API Integration

    + +

    Coordinator API

    +
    // Job submission
    +POST /v1/jobs
    +{
    +  "type": "inference",
    +  "prompt": "Your prompt here",
    +  "model": "llama3.2:latest",
    +  "max_price": "100aitbc"
    +}
    +
    +// WebSocket for live updates
    +ws://localhost:18001/ws
    + +

    Blockchain RPC

    +
    // Get transaction status
    +curl -X POST http://localhost:26657 \
    +  -d '{
    +    "jsonrpc": "2.0",
    +    "method": "tx",
    +    "params": ["0x..."]
    +  }'
    +
    + + +
    +

    Development

    + +

    Project Structure

    +
    marketplace-web/
    +├── src/
    +│   ├── components/     # Reusable UI components
    +│   ├── pages/         # Page components
    +│   ├── hooks/         # Custom React hooks
    +│   ├── stores/        # Zustand stores
    +│   ├── services/      # API services
    +│   ├── types/         # TypeScript definitions
    +│   └── utils/         # Utility functions
    +├── public/
    +├── package.json
    +└── vite.config.ts
    + +

    Mock Data

    +

    Toggle mock data mode for development without a running backend:

    +
    // In .env.local
    +VITE_MOCK_DATA=true
    + +

    Building for Production

    +
    # Build optimized bundle
    +npm run build
    +
    +# Output in dist/ directory
    +# Deploy to any static hosting service
    +
    + + +
    +

    Deployment

    + +

    Docker Deployment

    +
    # Build image
    +docker build -t aitbc/marketplace-web .
    +
    +# Run with nginx
    +docker run -d \
    +  -p 80:80 \
    +  -e VITE_API_URL=http://api.aitbc.bubuit.net \
    +  aitbc/marketplace-web
    + +

    Environment Variables

    +
      +
    • VITE_API_URL - Coordinator API endpoint
    • +
    • VITE_WS_URL - WebSocket endpoint
    • +
    • VITE_NETWORK - Network name (mainnet/testnet)
    • +
    • VITE_MOCK_DATA - Enable/disable mock data
    • +
    +
    + + +
    +

    Support

    +

    For marketplace-specific issues:

    +
    -

    © 2025 AITBC. All rights reserved.

    - - - - + diff --git a/website/docs/miner-documentation-md.html b/website/docs/miner-documentation-md.html new file mode 100644 index 00000000..6626e437 --- /dev/null +++ b/website/docs/miner-documentation-md.html @@ -0,0 +1,585 @@ + + + + + + Miner Documentation - AITBC + + + + +
    + +
    + +
    +
    + + + + + + + Back to Documentation + + + +
    +

    Miner Documentation

    +

    Learn how to mine AITBC tokens and contribute to network security. Perfect for those looking to earn rewards through staking or providing compute power.

    +
    + + +
    +
    +
    100K+
    +
    AITBC Staked
    +
    +
    +
    30+
    +
    Active Miners
    +
    +
    +
    0.02
    +
    AITBC/GPU Second
    +
    +
    +
    Low
    +
    Hardware Requirements
    +
    +
    + + +
    +

    Getting Started

    +

    AITBC mining combines Proof of Authority and Proof of Stake, offering multiple ways to participate and earn rewards.

    + +

    Mining Options

    +
      +
    • Authority Mining: Become a trusted authority node (invitation only)
    • +
    • Stake Mining: Stake AITBC tokens and earn rewards
    • +
    • GPU Mining: ✅ OPERATIONAL - Provide compute power for AI/ML workloads via Ollama (RTX 4060 Ti tested)
    • +
    • Hybrid Mining: Combine staking with compute provision
    • +
    + +

    Requirements

    +
    +
    +

    Minimum Stake

    +

    10,000 AITBC tokens

    +
    +
    +

    CPU

    +

    4+ cores (8+ recommended for GPU mining)

    +
    +
    +

    RAM

    +

    8GB minimum (16GB+ for GPU mining)

    +
    +
    +

    Storage

    +

    100GB SSD (500GB+ for full node)

    +
    +
    +

    Network

    +

    Stable broadband (100Mbps+)

    +
    +
    +

    GPU (Optional)

    +

    ✅ Tested: NVIDIA RTX 4060 Ti (16GB)

    +
    +
    +
    + + +
    +

    Quick Start

    + +

    1. Download & Install

    +

    Get the AITBC mining software for your platform

    +
    # Linux/macOS
    +curl -O https://gitea.bubuit.net/oib/aitbc/releases/download/latest/aitbc-miner-linux-amd64.tar.gz
    +tar -xzf aitbc-miner-linux-amd64.tar.gz
    +cd aitbc-miner
    +
    +# Windows
    +# Download from https://gitea.bubuit.net/oib/aitbc/releases
    + +

    2. Configure Your Node

    +

    Set up your mining configuration

    +
    # Create configuration
    +./aitbc-miner init
    +
    +# Edit config file
    +nano ~/.aitbc/miner/config.toml
    + +

    3. Start Mining

    +
    # Start the miner
    +./aitbc-miner start
    +
    +# Check status
    +./aitbc-miner status
    +
    +# View logs
    +./aitbc-miner logs
    +
    + + +
    +

    Configuration

    + +

    Basic Configuration

    +

    Edit ~/.aitbc/miner/config.toml:

    +
    # Network settings
    +[network]
    +rpc_url = "https://aitbc.bubuit.net"
    +ws_url = "wss://aitbc.bubuit.net/ws"
    +
    +# Mining settings
    +[mining]
    +stake_amount = 10000
    +compute_enabled = true
    +gpu_devices = [0]  # GPU indices to use
    +
    +# Wallet settings
    +[wallet]
    +address = "your-wallet-address"
    +private_key = "your-private-key"
    +
    +# Performance settings
    +[performance]
    +max_concurrent_jobs = 2
    +memory_limit = "8GB"
    + +

    GPU Configuration

    +
    # GPU mining settings
    +[gpu]
    +enabled = true
    +devices = [0]  # Use first GPU
    +memory_fraction = 0.8  # Use 80% of GPU memory
    +models = ["llama3.2", "mistral", "deepseek"]  # Supported models
    +
    + + +
    +

    Mining Operations

    + +

    Stake Mining

    +
      +
    • Stake your AITBC tokens to participate in consensus
    • +
    • Earn rewards from transaction fees
    • +
    • No hardware requirements beyond basic node
    • +
    • Rewards proportional to stake amount
    • +
    + +

    GPU Mining

    +
      +
    • Provide AI/ML compute power to the network
    • +
    • Process inference jobs and earn AITBC
    • +
    • Supports 13+ Ollama models
    • +
    • Earnings: 0.02 AITBC per GPU second
    • +
    + +

    Monitoring

    +
    # Real-time monitoring
    +./aitbc-miner monitor
    +
    +# Check earnings
    +./aitbc-miner earnings
    +
    +# Performance metrics
    +./aitbc-miner metrics
    +
    + + +
    +

    Troubleshooting

    + +

    Common Issues

    + +
    + GPU not detected? Ensure NVIDIA drivers are installed and CUDA is available. +
    + +
      +
    1. Connection Issues +
        +
      • Check internet connectivity
      • +
      • Verify RPC endpoint is accessible
      • +
      • Check firewall settings
      • +
      +
    2. +
    3. Low Performance +
        +
      • Reduce concurrent jobs
      • +
      • Check GPU memory usage
      • +
      • Monitor system resources
      • +
      +
    4. +
    5. Sync Issues +
        +
      • Wait for initial sync to complete
      • +
      • Check blockchain status
      • +
      • Restart miner if needed
      • +
      +
    6. +
    + +

    Getting Help

    +
      +
    • Check the logs: ./aitbc-miner logs
    • +
    • Visit our Discord community
    • +
    • Search issues on Gitea
    • +
    • Email support: aitbc@bubuit.net
    • +
    +
    + + +
    +

    Frequently Asked Questions

    + +

    How much can I earn mining AITBC?

    +

    Earnings vary based on: + - Stake amount (for stake mining) + - GPU performance and availability (for GPU mining) + - Network demand and transaction volume + - Current reward rates: 0.02 AITBC/GPU second

    + +

    What are the minimum requirements?

    +

    Basic stake mining requires: + - 10,000 AITBC tokens minimum stake + - Stable internet connection + - Basic computer (4GB RAM, dual-core CPU) + + GPU mining requires: + - NVIDIA GPU with 8GB+ VRAM + - 16GB+ RAM recommended + - Stable high-speed internet

    + +

    Is mining profitable?

    +

    Profitability depends on: + - AITBC token value + - Electricity costs (for GPU mining) + - Network activity + - Your stake amount or GPU capabilities

    + +

    How do I become an authority node?

    +

    Authority nodes require invitation based on community contribution, technical expertise, and stake amount. Apply through the community forum.

    +
    + + +
    +

    Additional Resources

    + +
    +
    +
    + +
    +
    +

    © 2025 AITBC. All rights reserved.

    +
    +
    + + diff --git a/website/docs/pool-hub.html b/website/docs/pool-hub.html new file mode 100644 index 00000000..82826783 --- /dev/null +++ b/website/docs/pool-hub.html @@ -0,0 +1,478 @@ + + + + + + Pool Hub - AITBC Documentation + + + + +
    + +
    + +
    +
    + + + + + + + Back to Components + + + +
    +

    Pool Hub

    +

    Miner registry with scoring engine, Redis/PostgreSQL backing, and comprehensive metrics. Live matching API deployed.

    + ● Live +
    + + +
    +

    Overview

    +

    The AITBC Pool Hub serves as the central coordination service for miners, providing efficient job matching, reputation scoring, and performance tracking.

    + +

    Key Features

    +
      +
    • Miner registry with comprehensive metadata
    • +
    • Dynamic scoring engine based on performance
    • +
    • Redis for fast caching and PostgreSQL for persistence
    • +
    • Real-time job matching API
    • +
    • Comprehensive metrics and monitoring
    • +
    • Load balancing and failover support
    • +
    +
    + + +
    +

    Architecture

    +

    The Pool Hub is designed for high availability and performance:

    + +
    +
    +

    Data Layer

    +

    Redis for hot data, PostgreSQL for historical records

    +
    +
    +

    Scoring Engine

    +

    Dynamic scoring based on success rate, latency, and availability

    +
    +
    +

    Matching API

    +

    RESTful API for real-time job-to-miner matching

    +
    +
    +

    Monitoring

    +

    Prometheus metrics and Grafana dashboards

    +
    +
    +
    + + +
    +

    API Reference

    + +

    Miner Registration

    +
    # Register miner
    +POST /api/v1/miners/register
    +{
    +  "address": "0x...",
    +  "endpoint": "http://miner.example.com:8080",
    +  "capabilities": {
    +    "models": ["llama3.2", "mistral"],
    +    "gpu_memory": 16384,
    +    "max_concurrent_jobs": 4
    +  },
    +  "stake": 10000
    +}
    + +

    Job Matching

    +
    # Find suitable miners
    +POST /api/v1/match
    +{
    +  "job_type": "inference",
    +  "model": "llama3.2",
    +  "requirements": {
    +    "min_gpu_memory": 8192,
    +    "max_latency": 5000
    +  }
    +}
    +
    +# Response
    +{
    +  "miners": [
    +    {
    +      "address": "0x...",
    +      "endpoint": "http://miner1.example.com",
    +      "score": 0.95,
    +      "estimated_time": 2000
    +    }
    +  ]
    +}
    + +

    Miner Status

    +
    # Update miner status
    +POST /api/v1/miners/{address}/status
    +{
    +  "available": true,
    +  "current_load": 2,
    +  "gpu_utilization": 0.75,
    +  "temperature": 65
    +}
    +
    + + +
    +

    Scoring System

    +

    The scoring engine evaluates miners based on multiple factors:

    + +

    Scoring Factors

    +
      +
    • Success Rate (40%): Job completion success percentage
    • +
    • Latency (25%): Average response time
    • +
    • Availability (20%): Uptime percentage
    • +
    • Reputation (15%): Historical performance and stake amount
    • +
    + +

    Score Calculation

    +
    score = (success_rate * 0.4) +
    +        (latency_score * 0.25) +
    +        (availability * 0.2) +
    +        (reputation_score * 0.15)
    +
    + + +
    +

    Configuration

    + +

    Environment Variables

    +
    # Database
    +REDIS_URL=redis://localhost:6379
    +DATABASE_URL=postgresql://user:pass@localhost/poolhub
    +
    +# API
    +API_HOST=0.0.0.0
    +API_PORT=8000
    +
    +# Scoring
    +SCORE_UPDATE_INTERVAL=60
    +MAX_MINER_SCORE=1.0
    +MIN_SUCCESS_RATE=0.8
    +
    +# Monitoring
    +METRICS_PORT=9090
    +LOG_LEVEL=info
    + +

    Scoring Configuration

    +
    # config/scoring.toml
    +[scoring]
    +update_interval = 60  # seconds
    +decay_factor = 0.95   # daily decay
    +
    +[weights]
    +success_rate = 0.4
    +latency = 0.25
    +availability = 0.2
    +reputation = 0.15
    +
    +[thresholds]
    +min_success_rate = 0.8
    +max_latency = 5000
    +min_availability = 0.95
    +
    + + +
    +

    Deployment

    + +

    Docker Compose

    +
    version: '3.8'
    +services:
    +  pool-hub:
    +    image: aitbc/pool-hub:latest
    +    ports:
    +      - "8000:8000"
    +      - "9090:9090"
    +    environment:
    +      - REDIS_URL=redis://redis:6379
    +      - DATABASE_URL=postgresql://postgres:pass@db:5432/poolhub
    +    depends_on:
    +      - redis
    +      - db
    +
    +  redis:
    +    image: redis:7-alpine
    +    volumes:
    +      - redis_data:/data
    +
    +  db:
    +    image: postgres:15
    +    environment:
    +      - POSTGRES_DB=poolhub
    +      - POSTGRES_USER=postgres
    +      - POSTGRES_PASSWORD=pass
    +    volumes:
    +      - db_data:/var/lib/postgresql/data
    +
    + + +
    +

    Monitoring

    + +

    Key Metrics

    +
      +
    • poolhub_miners_total - Total registered miners
    • +
    • poolhub_jobs_matched_total - Total jobs matched
    • +
    • poolhub_match_duration - Match operation duration
    • +
    • poolhub_miner_score - Individual miner scores
    • +
    • poolhub_api_requests_total - API request count
    • +
    + +

    Health Checks

    +
    # Health endpoint
    +GET /health
    +
    +# Detailed status
    +GET /api/v1/status
    +
    +# Metrics endpoint
    +GET /metrics
    +
    +
    +
    + +
    +
    +

    © 2025 AITBC. All rights reserved.

    +
    +
    + + diff --git a/website/docs/trade-exchange.html b/website/docs/trade-exchange.html index c872c4b7..4c8f33ff 100644 --- a/website/docs/trade-exchange.html +++ b/website/docs/trade-exchange.html @@ -326,11 +326,7 @@
    -
    - 📚 Also available in Markdown: - View this documentation in markdown format for easier contribution and version control. -
    - +

    Overview

    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.

    diff --git a/website/docs/wallet-daemon.html b/website/docs/wallet-daemon.html new file mode 100644 index 00000000..c1c658d4 --- /dev/null +++ b/website/docs/wallet-daemon.html @@ -0,0 +1,428 @@ + + + + + + Wallet Daemon - AITBC Documentation + + + + +
    + +
    + +
    +
    + + + + + + + Back to Components + + + +
    +

    Wallet Daemon

    +

    Encrypted keystore with Argon2id + XChaCha20-Poly1305, REST/JSON-RPC APIs, and receipt verification capabilities

    + ● Live +
    + + +
    +

    Overview

    +

    The AITBC Wallet Daemon provides secure wallet management with enterprise-grade encryption and multiple API interfaces for seamless integration.

    + +

    Key Features

    +
      +
    • Encrypted keystore with Argon2id + XChaCha20-Poly1305
    • +
    • REST and JSON-RPC APIs
    • +
    • Receipt verification capabilities
    • +
    • Hardware wallet support
    • +
    • Multi-signature wallet support
    • +
    +
    + + +
    +

    Architecture

    +

    The wallet daemon is built with security as the primary focus:

    + +
    +
    +

    Encryption

    +

    Argon2id key derivation with XChaCha20-Poly1305 AEAD encryption

    +
    +
    +

    Key Management

    +

    Hierarchical deterministic (HD) wallets with BIP44 support

    +
    +
    +

    API Layer

    +

    REST and JSON-RPC APIs for easy integration

    +
    +
    +

    Security

    +

    Sandboxed execution and memory protection

    +
    +
    +
    + + +
    +

    API Reference

    + +

    REST API

    +
    # Create wallet
    +POST /api/v1/wallet/create
    +{
    +  "name": "my-wallet",
    +  "password": "strong-password"
    +}
    +
    +# Unlock wallet
    +POST /api/v1/wallet/unlock
    +{
    +  "name": "my-wallet",
    +  "password": "strong-password"
    +}
    +
    +# Get address
    +GET /api/v1/wallet/address
    +
    +# Send transaction
    +POST /api/v1/wallet/send
    +{
    +  "to": "0x...",
    +  "amount": 1000,
    +  "fee": 10
    +}
    + +

    JSON-RPC API

    +
    # Get balance
    +curl -X POST http://localhost:8545 \
    +  -H "Content-Type: application/json" \
    +  -d '{
    +    "jsonrpc": "2.0",
    +    "method": "get_balance",
    +    "params": [],
    +    "id": 1
    +  }'
    +
    +# Sign transaction
    +curl -X POST http://localhost:8545 \
    +  -H "Content-Type: application/json" \
    +  -d '{
    +    "jsonrpc": "2.0",
    +    "method": "sign_transaction",
    +    "params": [tx_data],
    +    "id": 1
    +  }'
    +
    + + +
    +

    Configuration

    +

    The wallet daemon can be configured via environment variables or config file:

    + +
    # Configuration file: ~/.aitbc/wallet/config.toml
    +
    +[wallet]
    +keystore_path = "~/.aitbc/wallet/keystore"
    +default_network = "mainnet"
    +
    +[api]
    +rest_host = "127.0.0.1"
    +rest_port = 8545
    +rpc_host = "127.0.0.1"
    +rpc_port = 8546
    +
    +[security]
    +argon2_time = 3
    +argon2_memory = 67108864  # 64MB
    +argon2_parallelism = 4
    +
    + + +
    +

    Security Features

    +
      +
    • Memory Encryption: All sensitive data encrypted in memory
    • +
    • Secure Erasure: Memory zeroized after use
    • +
    • Access Control: API key authentication
    • +
    • Audit Logging: All operations logged securely
    • +
    • Hardware Support: Ledger and Trezor integration
    • +
    +
    + + +
    +

    Integration Examples

    + +

    Python Integration

    +
    from aitbc_wallet import WalletClient
    +
    +client = WalletClient("http://localhost:8545")
    +
    +# Create wallet
    +wallet = client.create_wallet("my-wallet", "password")
    +print(f"Address: {wallet.address}")
    +
    +# Send transaction
    +tx = client.send_transaction(
    +    to="0x123...",
    +    amount=1000,
    +    password="password"
    +)
    +print(f"Transaction hash: {tx.hash}")
    + +

    JavaScript Integration

    +
    const { WalletClient } = require('@aitbc/wallet');
    +
    +const client = new WalletClient('http://localhost:8545');
    +
    +// Create wallet
    +const wallet = await client.createWallet('my-wallet', 'password');
    +console.log('Address:', wallet.address);
    +
    +// Get balance
    +const balance = await client.getBalance();
    +console.log('Balance:', balance);
    +
    +
    +
    + + + +