diff --git a/.aitbc.yaml b/.aitbc.yaml deleted file mode 100644 index 22654d63..00000000 --- a/.aitbc.yaml +++ /dev/null @@ -1 +0,0 @@ -coordinator_url: http://127.0.0.1:18000 diff --git a/.aitbc.yaml.example b/.aitbc.yaml.example new file mode 100644 index 00000000..27bff0ca --- /dev/null +++ b/.aitbc.yaml.example @@ -0,0 +1,3 @@ +# AITBC CLI Configuration +# Copy to .aitbc.yaml and adjust for your environment +coordinator_url: http://127.0.0.1:18000 diff --git a/.gitignore b/.gitignore index 70c36404..833f5d94 100644 --- a/.gitignore +++ b/.gitignore @@ -193,3 +193,36 @@ docs/infrastructure.md # Workflow files (personal, change frequently) docs/1_project/3_currenttask.md docs/1_project/4_currentissue.md + +# =================== +# Website (local deployment details) +# =================== +website/README.md +website/aitbc-proxy.conf + +# =================== +# Local Config & Secrets +# =================== +.aitbc.yaml +apps/coordinator-api/.env + +# =================== +# Windsurf IDE (personal dev tooling) +# =================== +.windsurf/ + +# =================== +# Deploy Scripts (hardcoded local paths & IPs) +# =================== +scripts/deploy/* +!scripts/deploy/*.example +scripts/gpu/* +!scripts/gpu/*.example +scripts/service/* + +# =================== +# Infra Configs (production IPs & secrets) +# =================== +infra/nginx/nginx-aitbc*.conf +infra/helm/values/prod/ +infra/helm/values/prod.yaml diff --git a/README.md b/README.md index e2302e71..4d7e8ced 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ aitbc/ └── website/ # Public website and HTML documentation ``` -See [docs/structure.md](docs/structure.md) for detailed file-level documentation. +See [docs/README.md](docs/README.md) for the full documentation index. ## Quick Start @@ -147,17 +147,18 @@ Services run in an Incus container with systemd units. See `systemd/` for servic ## Documentation -| Document | Description | -|----------|-------------| -| [docs/structure.md](docs/structure.md) | Codebase structure and file layout | -| [docs/components.md](docs/components.md) | Component overview | -| [docs/coordinator-api.md](docs/coordinator-api.md) | Coordinator API reference | -| [docs/cli-reference.md](docs/cli-reference.md) | CLI command reference (560+ lines) | -| [docs/roadmap.md](docs/roadmap.md) | Development roadmap | -| [docs/done.md](docs/done.md) | Completed deployments and milestones | -| [docs/files.md](docs/files.md) | File audit and status tracking | -| [docs/currentTask.md](docs/currentTask.md) | Current task and test results | +| Section | Path | Description | +|---------|------|-------------| +| Getting Started | [docs/0_getting_started/](docs/0_getting_started/) | Intro, installation, CLI usage | +| Clients | [docs/2_clients/](docs/2_clients/) | Job submission, wallet, pricing, API | +| Miners | [docs/3_miners/](docs/3_miners/) | GPU setup, registration, earnings | +| Blockchain | [docs/4_blockchain/](docs/4_blockchain/) | Node operation, configuration | +| Reference | [docs/5_reference/](docs/5_reference/) | CLI reference, architecture specs | +| Architecture | [docs/6_architecture/](docs/6_architecture/) | System flow, component details | +| Deployment | [docs/7_deployment/](docs/7_deployment/) | Remote deployment, backups | +| Development | [docs/8_development/](docs/8_development/) | Setup, contributing, examples | +| Security | [docs/9_security/](docs/9_security/) | Security architecture, audit | ## License -[MIT](LICENSE) — Copyright (c) 2025 AITBC +[MIT](LICENSE) — Copyright (c) 2026 AITBC diff --git a/infra/helm/values/prod.yaml b/infra/helm/values/prod.yaml deleted file mode 100644 index 4e99aa4a..00000000 --- a/infra/helm/values/prod.yaml +++ /dev/null @@ -1,140 +0,0 @@ -# Production environment values -global: - environment: production - -coordinator: - replicaCount: 3 - image: - tag: "v0.1.0" - resources: - limits: - cpu: 2000m - memory: 2Gi - requests: - cpu: 1000m - memory: 1Gi - autoscaling: - enabled: true - minReplicas: 3 - maxReplicas: 20 - targetCPUUtilizationPercentage: 75 - targetMemoryUtilizationPercentage: 80 - config: - appEnv: production - allowOrigins: "https://app.aitbc.io" - postgresql: - auth: - existingSecret: "coordinator-db-secret" - primary: - persistence: - size: 200Gi - storageClass: fast-ssd - resources: - limits: - cpu: 2000m - memory: 4Gi - requests: - cpu: 1000m - memory: 2Gi - readReplicas: - replicaCount: 2 - resources: - limits: - cpu: 1000m - memory: 2Gi - requests: - cpu: 500m - memory: 1Gi - -monitoring: - prometheus: - server: - retention: 90d - persistentVolume: - size: 500Gi - storageClass: fast-ssd - resources: - limits: - cpu: 2000m - memory: 4Gi - requests: - cpu: 1000m - memory: 2Gi - grafana: - adminPassword: "prod-admin-secure-2024" - persistence: - size: 50Gi - storageClass: fast-ssd - resources: - limits: - cpu: 1000m - memory: 2Gi - requests: - cpu: 500m - memory: 1Gi - ingress: - enabled: true - hosts: - - grafana.aitbc.io - -# Additional services -blockchainNode: - replicaCount: 5 - resources: - limits: - cpu: 2000m - memory: 2Gi - requests: - cpu: 1000m - memory: 1Gi - autoscaling: - enabled: true - minReplicas: 5 - maxReplicas: 50 - targetCPUUtilizationPercentage: 70 - -walletDaemon: - replicaCount: 3 - resources: - limits: - cpu: 1000m - memory: 1Gi - requests: - cpu: 500m - memory: 512Mi - autoscaling: - enabled: true - minReplicas: 3 - maxReplicas: 10 - targetCPUUtilizationPercentage: 75 - -# Ingress configuration -ingress: - enabled: true - className: nginx - annotations: - cert-manager.io/cluster-issuer: letsencrypt-prod - nginx.ingress.kubernetes.io/rate-limit: "100" - nginx.ingress.kubernetes.io/rate-limit-window: "1m" - hosts: - - host: api.aitbc.io - paths: - - path: / - pathType: Prefix - tls: - - secretName: prod-tls - hosts: - - api.aitbc.io - -# Security -podSecurityPolicy: - enabled: true - -networkPolicy: - enabled: true - -# Backup configuration -backup: - enabled: true - schedule: "0 2 * * *" - retention: "30d" diff --git a/infra/helm/values/prod.yaml.example b/infra/helm/values/prod.yaml.example new file mode 100644 index 00000000..846c4d97 --- /dev/null +++ b/infra/helm/values/prod.yaml.example @@ -0,0 +1,44 @@ +# AITBC Production Helm Values +# Copy to prod.yaml and adjust for your cluster + +replicaCount: 1 + +coordinator: + image: aitbc/coordinator-api:latest + port: 8000 + env: + APP_ENV: production + DATABASE_URL: postgresql://aitbc:YOUR_DB_PASSWORD@postgres:5432/aitbc + HMAC_SECRET: YOUR_HMAC_SECRET + ALLOW_ORIGINS: '["https://YOUR_DOMAIN"]' + +blockchain: + image: aitbc/blockchain-node:latest + rpcPort: 9080 + p2pPort: 9090 + env: + NETWORK: mainnet + CONSENSUS_MODE: BALANCED + +ingress: + enabled: true + host: YOUR_DOMAIN + tls: + enabled: true + secretName: aitbc-tls + +resources: + coordinator: + requests: + cpu: 250m + memory: 512Mi + limits: + cpu: 1000m + memory: 1Gi + blockchain: + requests: + cpu: 500m + memory: 1Gi + limits: + cpu: 2000m + memory: 4Gi diff --git a/infra/helm/values/prod/values.yaml b/infra/helm/values/prod/values.yaml deleted file mode 100644 index b9a1302e..00000000 --- a/infra/helm/values/prod/values.yaml +++ /dev/null @@ -1,259 +0,0 @@ -# Production environment Helm values - -global: - environment: prod - domain: aitbc.bubuit.net - imageTag: stable - imagePullPolicy: IfNotPresent - -# Coordinator API -coordinator: - enabled: true - replicas: 3 - image: - repository: aitbc/coordinator-api - tag: stable - resources: - requests: - cpu: 500m - memory: 1Gi - limits: - cpu: 2000m - memory: 2Gi - service: - type: ClusterIP - port: 8001 - env: - LOG_LEVEL: warn - DATABASE_URL: secretRef:db-credentials - autoscaling: - enabled: true - minReplicas: 3 - maxReplicas: 10 - targetCPUUtilization: 60 - targetMemoryUtilization: 70 - livenessProbe: - initialDelaySeconds: 30 - periodSeconds: 10 - readinessProbe: - initialDelaySeconds: 5 - periodSeconds: 5 - -# Explorer Web -explorer: - enabled: true - replicas: 3 - image: - repository: aitbc/explorer-web - tag: stable - resources: - requests: - cpu: 200m - memory: 512Mi - limits: - cpu: 1000m - memory: 1Gi - service: - type: ClusterIP - port: 3000 - autoscaling: - enabled: true - minReplicas: 3 - maxReplicas: 8 - -# Marketplace Web -marketplace: - enabled: true - replicas: 3 - image: - repository: aitbc/marketplace-web - tag: stable - resources: - requests: - cpu: 200m - memory: 512Mi - limits: - cpu: 1000m - memory: 1Gi - service: - type: ClusterIP - port: 3001 - autoscaling: - enabled: true - minReplicas: 3 - maxReplicas: 8 - -# Wallet Daemon -wallet: - enabled: true - replicas: 2 - image: - repository: aitbc/wallet-daemon - tag: stable - resources: - requests: - cpu: 500m - memory: 1Gi - limits: - cpu: 2000m - memory: 2Gi - service: - type: ClusterIP - port: 8002 - autoscaling: - enabled: true - minReplicas: 2 - maxReplicas: 6 - -# Trade Exchange -exchange: - enabled: true - replicas: 2 - image: - repository: aitbc/trade-exchange - tag: stable - resources: - requests: - cpu: 250m - memory: 512Mi - limits: - cpu: 1000m - memory: 1Gi - service: - type: ClusterIP - port: 8085 - -# PostgreSQL (prod uses RDS Multi-AZ) -postgresql: - enabled: false - external: - host: secretRef:db-credentials:host - port: 5432 - database: coordinator - sslMode: require - -# Redis (prod uses ElastiCache) -redis: - enabled: false - external: - host: secretRef:redis-credentials:host - port: 6379 - auth: true - -# Ingress -ingress: - enabled: true - className: nginx - annotations: - nginx.ingress.kubernetes.io/rewrite-target: / - nginx.ingress.kubernetes.io/proxy-body-size: 10m - nginx.ingress.kubernetes.io/rate-limit: "100" - nginx.ingress.kubernetes.io/rate-limit-window: 1m - cert-manager.io/cluster-issuer: letsencrypt-prod - tls: - - secretName: prod-tls - hosts: - - aitbc.bubuit.net - hosts: - - host: aitbc.bubuit.net - paths: - - path: /api - service: coordinator - port: 8001 - - path: /explorer - service: explorer - port: 3000 - - path: /marketplace - service: marketplace - port: 3001 - - path: /wallet - service: wallet - port: 8002 - - path: /Exchange - service: exchange - port: 8085 - -# Monitoring -monitoring: - enabled: true - prometheus: - enabled: true - retention: 30d - resources: - requests: - cpu: 500m - memory: 2Gi - limits: - cpu: 2000m - memory: 4Gi - grafana: - enabled: true - persistence: - enabled: true - size: 10Gi - alertmanager: - enabled: true - config: - receivers: - - name: slack - slack_configs: - - channel: '#aitbc-alerts' - send_resolved: true - -# Logging -logging: - enabled: true - level: warn - elasticsearch: - enabled: true - retention: 30d - replicas: 3 - -# Pod Disruption Budgets -podDisruptionBudget: - coordinator: - minAvailable: 2 - explorer: - minAvailable: 2 - marketplace: - minAvailable: 2 - wallet: - minAvailable: 1 - -# Network Policies -networkPolicy: - enabled: true - ingress: - - from: - - namespaceSelector: - matchLabels: - name: ingress-nginx - egress: - - to: - - namespaceSelector: - matchLabels: - name: kube-system - ports: - - port: 53 - protocol: UDP - -# Security -securityContext: - runAsNonRoot: true - runAsUser: 1000 - fsGroup: 1000 - readOnlyRootFilesystem: true - -# Affinity - spread across zones -affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchLabels: - app: coordinator - topologyKey: topology.kubernetes.io/zone - -# Priority Classes -priorityClassName: high-priority diff --git a/infra/nginx/nginx-aitbc-reverse-proxy.conf b/infra/nginx/nginx-aitbc-reverse-proxy.conf deleted file mode 100644 index 90bad00d..00000000 --- a/infra/nginx/nginx-aitbc-reverse-proxy.conf +++ /dev/null @@ -1,247 +0,0 @@ -# AITBC Nginx Reverse Proxy Configuration -# Domain: aitbc.keisanki.net -# This configuration replaces the need for firehol/iptables port forwarding - -# HTTP to HTTPS redirect -server { - listen 80; - server_name aitbc.keisanki.net; - - # Redirect all HTTP traffic to HTTPS - return 301 https://$server_name$request_uri; -} - -# Main HTTPS server block -server { - listen 443 ssl http2; - server_name aitbc.keisanki.net; - - # SSL Configuration (Let's Encrypt certificates) - ssl_certificate /etc/letsencrypt/live/aitbc.keisanki.net/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/aitbc.keisanki.net/privkey.pem; - include /etc/letsencrypt/options-ssl-nginx.conf; - ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; - - # Security headers - add_header X-Frame-Options "SAMEORIGIN" always; - add_header X-XSS-Protection "1; mode=block" always; - add_header X-Content-Type-Options "nosniff" always; - add_header Referrer-Policy "strict-origin-when-cross-origin" always; - add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline' 'unsafe-eval'" always; - - # Enable gzip compression - gzip on; - gzip_vary on; - gzip_min_length 1024; - gzip_types text/plain text/css text/xml text/javascript application/javascript application/xml+rss application/json; - - # Blockchain Explorer (main route) - location / { - proxy_pass http://192.168.100.10:3000; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - - # WebSocket support if needed - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; - } - - # Coordinator API - location /api/ { - proxy_pass http://192.168.100.10:8000/v1/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - - # CORS headers for API - add_header Access-Control-Allow-Origin "*" always; - add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always; - add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Api-Key" always; - - # Handle preflight requests - if ($request_method = 'OPTIONS') { - add_header Access-Control-Allow-Origin "*"; - add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; - add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Api-Key"; - add_header Access-Control-Max-Age 1728000; - add_header Content-Type "text/plain; charset=utf-8"; - add_header Content-Length 0; - return 204; - } - } - - # Blockchain Node 1 RPC - location /rpc/ { - proxy_pass http://192.168.100.10:8082/rpc/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - } - - # Blockchain Node 2 RPC (alternative endpoint) - location /rpc2/ { - proxy_pass http://192.168.100.10:8081/rpc/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - } - - # Exchange API - location /exchange/ { - proxy_pass http://192.168.100.10:9080/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - } - - # Marketplace UI (if separate from explorer) - location /marketplace/ { - proxy_pass http://192.168.100.10:3001/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - - # Handle subdirectory rewrite - rewrite ^/marketplace/(.*)$ /$1 break; - } - - # Admin dashboard - location /admin/ { - proxy_pass http://192.168.100.10:8080/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - - # Optional: Restrict admin access - # allow 192.168.100.0/24; - # allow 127.0.0.1; - # deny all; - } - - # Health check endpoint - location /health { - access_log off; - return 200 "healthy\n"; - add_header Content-Type text/plain; - } - - # API health checks - location /api/health { - proxy_pass http://192.168.100.10:8000/v1/health; - proxy_set_header Host $host; - access_log off; - } - - # Static assets caching - location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { - proxy_pass http://192.168.100.10:3000; - expires 1y; - add_header Cache-Control "public, immutable"; - add_header X-Content-Type-Options nosniff; - - # Don't log static file access - access_log off; - } - - # Deny access to hidden files - location ~ /\. { - deny all; - access_log off; - log_not_found off; - } - - # Custom error pages - error_page 404 /404.html; - error_page 500 502 503 504 /50x.html; - - location = /50x.html { - root /usr/share/nginx/html; - } -} - -# Optional: Subdomain for API-only access -server { - listen 443 ssl http2; - server_name api.aitbc.keisanki.net; - - # SSL Configuration (same certificates) - ssl_certificate /etc/letsencrypt/live/aitbc.keisanki.net/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/aitbc.keisanki.net/privkey.pem; - include /etc/letsencrypt/options-ssl-nginx.conf; - ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; - - # Security headers - add_header X-Frame-Options "DENY" always; - add_header X-XSS-Protection "1; mode=block" always; - add_header X-Content-Type-Options "nosniff" always; - add_header Referrer-Policy "strict-origin-when-cross-origin" always; - - # API routes only - location / { - proxy_pass http://192.168.100.10:8000/v1/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - - # CORS headers - add_header Access-Control-Allow-Origin "*" always; - add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always; - add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Api-Key" always; - - # Handle preflight requests - if ($request_method = 'OPTIONS') { - add_header Access-Control-Allow-Origin "*"; - add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS"; - add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization,X-Api-Key"; - add_header Access-Control-Max-Age 1728000; - add_header Content-Type "text/plain; charset=utf-8"; - add_header Content-Length 0; - return 204; - } - } -} - -# Optional: Subdomain for blockchain RPC -server { - listen 443 ssl http2; - server_name rpc.aitbc.keisanki.net; - - # SSL Configuration - ssl_certificate /etc/letsencrypt/live/aitbc.keisanki.net/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/aitbc.keisanki.net/privkey.pem; - include /etc/letsencrypt/options-ssl-nginx.conf; - ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; - - # Security headers - add_header X-Frame-Options "DENY" always; - add_header X-XSS-Protection "1; mode=block" always; - add_header X-Content-Type-Options "nosniff" always; - - # RPC routes - location / { - proxy_pass http://192.168.100.10:8082/rpc/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - } -} diff --git a/infra/nginx/nginx-aitbc.conf b/infra/nginx/nginx-aitbc.conf.example similarity index 63% rename from infra/nginx/nginx-aitbc.conf rename to infra/nginx/nginx-aitbc.conf.example index 72051bc8..98c966ed 100644 --- a/infra/nginx/nginx-aitbc.conf +++ b/infra/nginx/nginx-aitbc.conf.example @@ -1,9 +1,10 @@ # AITBC Services Nginx Configuration -# Domain: https://aitbc.bubuit.net +# Copy to nginx-aitbc.conf and replace YOUR_DOMAIN with your actual domain +# Adjust ports if your services run on different ones server { listen 80; - server_name aitbc.bubuit.net; + server_name YOUR_DOMAIN; # Redirect to HTTPS return 301 https://$server_name$request_uri; @@ -11,11 +12,11 @@ server { server { listen 443 ssl http2; - server_name aitbc.bubuit.net; + server_name YOUR_DOMAIN; # SSL Configuration (Let's Encrypt) - ssl_certificate /etc/letsencrypt/live/aitbc.bubuit.net/fullchain.pem; - ssl_certificate_key /etc/letsencrypt/live/aitbc.bubuit.net/privkey.pem; + ssl_certificate /etc/letsencrypt/live/YOUR_DOMAIN/fullchain.pem; + ssl_certificate_key /etc/letsencrypt/live/YOUR_DOMAIN/privkey.pem; include /etc/letsencrypt/options-ssl-nginx.conf; ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; @@ -26,7 +27,7 @@ server { add_header Referrer-Policy "no-referrer-when-downgrade" always; add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always; - # API Routes + # Coordinator API location /api/ { proxy_pass http://127.0.0.1:8000/v1/; proxy_set_header Host $host; @@ -36,7 +37,7 @@ server { proxy_buffering off; } - # Blockchain RPC Routes + # Blockchain RPC location /rpc/ { proxy_pass http://127.0.0.1:9080/rpc/; proxy_set_header Host $host; @@ -53,8 +54,6 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - - # Handle subdirectory rewrite ^/Marketplace/(.*)$ /$1 break; proxy_buffering off; } @@ -66,32 +65,11 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; - - # Handle subdirectory rewrite ^/Exchange/(.*)$ /$1 break; proxy_buffering off; } - # Exchange API Routes - location /api/trades/ { - proxy_pass http://127.0.0.1:3003/api/trades/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - } - - location /api/orders { - proxy_pass http://127.0.0.1:3003/api/orders; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - proxy_buffering off; - } - - # Wallet CLI API (if needed) + # Wallet API location /wallet/ { proxy_pass http://127.0.0.1:8000/wallet/; proxy_set_header Host $host; @@ -100,29 +78,17 @@ server { proxy_set_header X-Forwarded-Proto $scheme; } - # Admin routes - location /admin/ { - proxy_pass http://127.0.0.1:8000/admin/; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - - # Restrict access (optional) - # allow 127.0.0.1; - # allow 10.1.223.0/24; - # deny all; - } - # Health check location /health { proxy_pass http://127.0.0.1:8000/v1/health; proxy_set_header Host $host; } - # Default redirect to Marketplace + # Default — serve static website location / { - return 301 /Marketplace; + root /var/www/html; + index index.html; + try_files $uri $uri/ =404; } # Static file caching diff --git a/scripts/deploy/cleanup-deployment.sh b/scripts/deploy/cleanup-deployment.sh deleted file mode 100755 index f829c2bd..00000000 --- a/scripts/deploy/cleanup-deployment.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Clean up failed deployment and prepare for redeployment - -echo "🧹 Cleaning up failed deployment..." -echo "==================================" - -# Stop any running services -echo "Stopping services..." -ssh ns3-root "systemctl stop blockchain-node blockchain-rpc nginx 2>/dev/null || true" - -# Remove old directories -echo "Removing old directories..." -ssh ns3-root "rm -rf /opt/blockchain-node /opt/blockchain-node-src /opt/blockchain-explorer 2>/dev/null || true" - -# Remove systemd services -echo "Removing systemd services..." -ssh ns3-root "systemctl disable blockchain-node blockchain-rpc blockchain-explorer 2>/dev/null || true" -ssh ns3-root "rm -f /etc/systemd/system/blockchain-node.service /etc/systemd/system/blockchain-rpc.service /etc/systemd/system/blockchain-explorer.service 2>/dev/null || true" -ssh ns3-root "systemctl daemon-reload" - -echo "✅ Cleanup complete!" -echo "" -echo "You can now run: ./scripts/deploy/deploy-all-remote.sh" diff --git a/scripts/deploy/container-deploy.py b/scripts/deploy/container-deploy.py deleted file mode 100644 index 51c7954c..00000000 --- a/scripts/deploy/container-deploy.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python3 -""" -Deploy AITBC services to incus container -""" - -import subprocess -import time -import sys - -def run_command(cmd, container=None): - """Run command locally or in container""" - if container: - cmd = f"incus exec {container} -- {cmd}" - print(f"Running: {cmd}") - result = subprocess.run(cmd, shell=True, capture_output=True, text=True) - if result.returncode != 0: - print(f"Error: {result.stderr}") - return False - return True - -def deploy_to_container(): - container = "aitbc" - container_ip = "10.1.223.93" - - print("🚀 Deploying AITBC services to container...") - - # Stop local services - print("\n📋 Stopping local services...") - subprocess.run("sudo fuser -k 8000/tcp 2>/dev/null || true", shell=True) - subprocess.run("sudo fuser -k 9080/tcp 2>/dev/null || true", shell=True) - subprocess.run("pkill -f 'marketplace-ui' 2>/dev/null || true", shell=True) - subprocess.run("pkill -f 'trade-exchange' 2>/dev/null || true", shell=True) - - # Copy project to container - print("\n📁 Copying project to container...") - subprocess.run(f"incus file push -r /home/oib/windsurf/aitbc {container}/home/oib/", shell=True) - - # Setup Python environment in container - print("\n🐍 Setting up Python environment...") - run_command("cd /home/oib/aitbc && python3 -m venv .venv", container) - run_command("cd /home/oib/aitbc && source .venv/bin/activate && pip install fastapi uvicorn httpx sqlmodel", container) - - # Install dependencies - print("\n📦 Installing dependencies...") - run_command("cd /home/oib/aitbc/apps/coordinator-api && source ../../.venv/bin/activate && pip install -e .", container) - run_command("cd /home/oib/aitbc/apps/blockchain-node && source ../../.venv/bin/activate && pip install -e .", container) - - # Create startup script - print("\n🔧 Creating startup script...") - startup_script = """#!/bin/bash -cd /home/oib/aitbc - -# Start blockchain node -echo "Starting blockchain node..." -cd apps/blockchain-node -source ../../.venv/bin/activate -python -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 9080 & -NODE_PID=$! - -# Start coordinator API -echo "Starting coordinator API..." -cd ../coordinator-api -source ../../.venv/bin/activate -python -m uvicorn src.app.main:app --host 0.0.0.0 --port 8000 & -COORD_PID=$! - -# Start marketplace UI -echo "Starting marketplace UI..." -cd ../marketplace-ui -python server.py --port 3001 & -MARKET_PID=$! - -# Start trade exchange -echo "Starting trade exchange..." -cd ../trade-exchange -python server.py --port 3002 & -EXCHANGE_PID=$! - -echo "Services started!" -echo "Blockchain: http://10.1.223.93:9080" -echo "API: http://10.1.223.93:8000" -echo "Marketplace: http://10.1.223.93:3001" -echo "Exchange: http://10.1.223.93:3002" - -# Wait for services -wait $NODE_PID $COORD_PID $MARKET_PID $EXCHANGE_PID -""" - - # Write startup script to container - with open('/tmp/start_aitbc.sh', 'w') as f: - f.write(startup_script) - - subprocess.run("incus file push /tmp/start_aitbc.sh aitbc/home/oib/", shell=True) - run_command("chmod +x /home/oib/start_aitbc.sh", container) - - # Start services - print("\n🚀 Starting AITBC services...") - run_command("/home/oib/start_aitbc.sh", container) - - print(f"\n✅ Services deployed to container!") - print(f"\n📋 Access URLs:") - print(f" 🌐 Container IP: {container_ip}") - print(f" 📊 Marketplace: http://{container_ip}:3001") - print(f" 💱 Trade Exchange: http://{container_ip}:3002") - print(f" 🔗 API: http://{container_ip}:8000") - print(f" ⛓️ Blockchain: http://{container_ip}:9080") - -if __name__ == "__main__": - deploy_to_container() diff --git a/scripts/deploy/deploy-all-remote.sh b/scripts/deploy/deploy-all-remote.sh deleted file mode 100755 index d921b6a6..00000000 --- a/scripts/deploy/deploy-all-remote.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# Deploy blockchain node and explorer by building directly on ns3 - -echo "🚀 AITBC Remote Deployment (Build on Server)" -echo "==========================================" -echo "This will build the blockchain node directly on ns3" -echo "to utilize the gigabit connection instead of uploading." -echo "" - -# Copy deployment scripts to server -echo "Copying deployment scripts to ns3..." -scp scripts/deploy/deploy-blockchain-remote.sh ns3-root:/opt/ -scp scripts/deploy/deploy-explorer-remote.sh ns3-root:/opt/ - -# Create directories on server first -echo "Creating directories on ns3..." -ssh ns3-root "mkdir -p /opt/blockchain-node-src /opt/blockchain-node" - -# Copy blockchain source code to server (excluding data files) -echo "Copying blockchain source code to ns3..." -rsync -av --exclude='data/' --exclude='*.db' --exclude='__pycache__' --exclude='.venv' apps/blockchain-node/ ns3-root:/opt/blockchain-node-src/ - -# Execute blockchain deployment -echo "" -echo "Deploying blockchain node..." -ssh ns3-root "cd /opt && cp -r /opt/blockchain-node-src/* /opt/blockchain-node/ && cd /opt/blockchain-node && chmod +x ../deploy-blockchain-remote.sh && ../deploy-blockchain-remote.sh" - -# Wait for blockchain to start -echo "" -echo "Waiting 10 seconds for blockchain node to start..." -sleep 10 - -# Execute explorer deployment on ns3 -echo "" -echo "Deploying blockchain explorer..." -ssh ns3-root "cd /opt && ./deploy-explorer-remote.sh" - -# Check services -echo "" -echo "Checking service status..." -ssh ns3-root "systemctl status blockchain-node blockchain-rpc nginx --no-pager | grep -E 'Active:|Main PID:'" - -echo "" -echo "✅ Deployment complete!" -echo "" -echo "Services:" -echo " - Blockchain Node RPC: http://localhost:8082" -echo " - Blockchain Explorer: http://localhost:3000" -echo "" -echo "External access:" -echo " - Blockchain Node RPC: http://aitbc.keisanki.net:8082" -echo " - Blockchain Explorer: http://aitbc.keisanki.net:3000" -echo "" -echo "The blockchain node will start syncing automatically." -echo "The explorer connects to the local node and displays real-time data." diff --git a/scripts/deploy/deploy-blockchain-and-explorer.sh b/scripts/deploy/deploy-blockchain-and-explorer.sh deleted file mode 100755 index 24c2dea9..00000000 --- a/scripts/deploy/deploy-blockchain-and-explorer.sh +++ /dev/null @@ -1,207 +0,0 @@ -#!/bin/bash - -# Deploy blockchain node and explorer to incus container - -set -e - -echo "🚀 Deploying Blockchain Node and Explorer" -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" -} - -# Copy blockchain node to container -print_status "Copying blockchain node to container..." -ssh ns3-root "rm -rf /opt/blockchain-node 2>/dev/null || true" -scp -r apps/blockchain-node ns3-root:/opt/ - -# Setup blockchain node in container -print_status "Setting up blockchain node..." -ssh ns3-root << 'EOF' -cd /opt/blockchain-node - -# Create configuration -cat > .env << EOL -CHAIN_ID=ait-devnet -DB_PATH=./data/chain.db -RPC_BIND_HOST=0.0.0.0 -RPC_BIND_PORT=8082 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7070 -PROPOSER_KEY=proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=memory -EOL - -# Create data directory -mkdir -p data/devnet - -# Setup Python environment -python3 -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -pip install -e . - -# Generate genesis -export PYTHONPATH="${PWD}/src:${PWD}/scripts:${PYTHONPATH:-}" -python scripts/make_genesis.py --output data/devnet/genesis.json --force -EOF - -# Create systemd service for blockchain node -print_status "Creating systemd service for blockchain node..." -ssh ns3-root << 'EOF' -cat > /etc/systemd/system/blockchain-node.service << EOL -[Unit] -Description=AITBC Blockchain Node -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m aitbc_chain.main -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -cat > /etc/systemd/system/blockchain-rpc.service << EOL -[Unit] -Description=AITBC Blockchain RPC API -After=blockchain-node.service - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 8082 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -systemctl daemon-reload -systemctl enable blockchain-node blockchain-rpc -EOF - -# Start blockchain node -print_status "Starting blockchain node..." -ssh ns3-root "systemctl start blockchain-node blockchain-rpc" - -# Wait for node to start -print_status "Waiting for blockchain node to start..." -sleep 5 - -# Check status -print_status "Checking blockchain node status..." -ssh ns3-root "systemctl status blockchain-node blockchain-rpc --no-pager | grep -E 'Active:|Main PID:'" - -# Copy explorer to container -print_status "Copying blockchain explorer to container..." -ssh ns3-root "rm -rf /opt/blockchain-explorer 2>/dev/null || true" -scp -r apps/blockchain-explorer ns3-root:/opt/ - -# Setup explorer in container -print_status "Setting up blockchain explorer..." -ssh ns3-root << 'EOF' -cd /opt/blockchain-explorer - -# Create Python environment -python3 -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -pip install -r requirements.txt -EOF - -# Create systemd service for explorer -print_status "Creating systemd service for blockchain explorer..." -ssh ns3-root << 'EOF' -cat > /etc/systemd/system/blockchain-explorer.service << EOL -[Unit] -Description=AITBC Blockchain Explorer -After=blockchain-rpc.service - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-explorer -Environment=PATH=/opt/blockchain-explorer/.venv/bin:/usr/local/bin:/usr/bin:/bin -ExecStart=/opt/blockchain-explorer/.venv/bin/python3 main.py -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -systemctl daemon-reload -systemctl enable blockchain-explorer -EOF - -# Start explorer -print_status "Starting blockchain explorer..." -ssh ns3-root "systemctl start blockchain-explorer" - -# Wait for explorer to start -print_status "Waiting for explorer to start..." -sleep 3 - -# Setup port forwarding -print_status "Setting up port forwarding..." -ssh ns3-root << 'EOF' -# Clear existing NAT rules -iptables -t nat -F PREROUTING 2>/dev/null || true -iptables -t nat -F POSTROUTING 2>/dev/null || true - -# Add port forwarding for blockchain RPC -iptables -t nat -A PREROUTING -p tcp --dport 8082 -j DNAT --to-destination 192.168.100.10:8082 -iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 8082 -j MASQUERADE - -# Add port forwarding for explorer -iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 192.168.100.10:3000 -iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 3000 -j MASQUERADE - -# Save rules -mkdir -p /etc/iptables -iptables-save > /etc/iptables/rules.v4 - -# Install iptables-persistent for persistence -apt-get update -apt-get install -y iptables-persistent -EOF - -# Check all services -print_status "Checking all services..." -ssh ns3-root "systemctl status blockchain-node blockchain-rpc blockchain-explorer --no-pager | grep -E 'Active:|Main PID:'" - -print_success "✅ Deployment complete!" -echo "" -echo "Services deployed:" -echo " - Blockchain Node RPC: http://192.168.100.10:8082" -echo " - Blockchain Explorer: http://192.168.100.10:3000" -echo "" -echo "External access:" -echo " - Blockchain Node RPC: http://aitbc.keisanki.net:8082" -echo " - Blockchain Explorer: http://aitbc.keisanki.net:3000" -echo "" -echo "The explorer is connected to the local blockchain node and will display" -echo "real-time blockchain data including blocks and transactions." diff --git a/scripts/deploy/deploy-blockchain-explorer.sh b/scripts/deploy/deploy-blockchain-explorer.sh deleted file mode 100755 index 4589c559..00000000 --- a/scripts/deploy/deploy-blockchain-explorer.sh +++ /dev/null @@ -1,94 +0,0 @@ -#!/bin/bash - -# Deploy blockchain explorer to incus container - -set -e - -echo "🔍 Deploying Blockchain Explorer" -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" -} - -# Copy explorer to container -print_status "Copying blockchain explorer to container..." -ssh ns3-root "rm -rf /opt/blockchain-explorer 2>/dev/null || true" -scp -r apps/blockchain-explorer ns3-root:/opt/ - -# Setup explorer in container -print_status "Setting up blockchain explorer..." -ssh ns3-root << 'EOF' -cd /opt/blockchain-explorer - -# Create Python environment -python3 -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -pip install -r requirements.txt -EOF - -# Create systemd service for explorer -print_status "Creating systemd service for blockchain explorer..." -ssh ns3-root << 'EOF' -cat > /etc/systemd/system/blockchain-explorer.service << EOL -[Unit] -Description=AITBC Blockchain Explorer -After=blockchain-rpc.service - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-explorer -Environment=PATH=/opt/blockchain-explorer/.venv/bin:/usr/local/bin:/usr/bin:/bin -ExecStart=/opt/blockchain-explorer/.venv/bin/python3 main.py -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -systemctl daemon-reload -systemctl enable blockchain-explorer -EOF - -# Start explorer -print_status "Starting blockchain explorer..." -ssh ns3-root "systemctl start blockchain-explorer" - -# Wait for explorer to start -print_status "Waiting for explorer to start..." -sleep 3 - -# Setup port forwarding for explorer -print_status "Setting up port forwarding for explorer..." -ssh ns3-root << 'EOF' -# Add port forwarding for explorer -iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 192.168.100.10:3000 -iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 3000 -j MASQUERADE - -# Save rules -iptables-save > /etc/iptables/rules.v4 -EOF - -# Check status -print_status "Checking blockchain explorer status..." -ssh ns3-root "systemctl status blockchain-explorer --no-pager | grep -E 'Active:|Main PID:'" - -print_success "✅ Blockchain explorer deployed!" -echo "" -echo "Explorer URL: http://192.168.100.10:3000" -echo "External URL: http://aitbc.keisanki.net:3000" -echo "" -echo "The explorer will automatically connect to the local blockchain node." -echo "You can view blocks, transactions, and chain statistics." diff --git a/scripts/deploy/deploy-blockchain-remote.sh b/scripts/deploy/deploy-blockchain-remote.sh deleted file mode 100644 index f90dba5d..00000000 --- a/scripts/deploy/deploy-blockchain-remote.sh +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/bash - -# Deploy blockchain node directly on ns3 server (build in place) - -set -e - -echo "🚀 Deploying Blockchain Node on ns3 (Build in Place)" -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 we're on the right server -print_status "Checking server..." -if [ "$(hostname)" != "ns3" ] && [ "$(hostname)" != "aitbc" ]; then - print_warning "This script should be run on ns3 server" - echo "Please run: ssh ns3-root" - echo "Then: cd /opt && ./deploy-blockchain-remote.sh" - exit 1 -fi - -# Install dependencies if needed -print_status "Installing dependencies..." -apt-get update -apt-get install -y python3 python3-venv python3-pip git curl - -# Create directory -print_status "Creating blockchain node directory..." -mkdir -p /opt/blockchain-node -cd /opt/blockchain-node - -# Check if source code exists -if [ ! -d "src" ]; then - print_status "Source code not found in /opt/blockchain-node, copying from /opt/blockchain-node-src..." - if [ -d "/opt/blockchain-node-src" ]; then - cp -r /opt/blockchain-node-src/* . - else - print_warning "Source code not found. Please ensure it was copied properly." - exit 1 - fi -fi - -# Setup Python environment -print_status "Setting up Python environment..." -python3 -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -pip install -e . - -# Create configuration with auto-sync -print_status "Creating configuration..." -cat > .env << EOL -CHAIN_ID=ait-devnet -DB_PATH=./data/chain.db -RPC_BIND_HOST=0.0.0.0 -RPC_BIND_PORT=8082 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7070 -PROPOSER_KEY=proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=memory -EOL - -# Create fresh data directory -print_status "Creating fresh data directory..." -rm -rf data -mkdir -p data/devnet - -# Generate fresh genesis -print_status "Generating fresh genesis block..." -export PYTHONPATH="${PWD}/src:${PWD}/scripts:${PYTHONPATH:-}" -python scripts/make_genesis.py --output data/devnet/genesis.json --force - -# Create systemd service for blockchain node -print_status "Creating systemd services..." -cat > /etc/systemd/system/blockchain-node.service << EOL -[Unit] -Description=AITBC Blockchain Node -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m aitbc_chain.main -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -cat > /etc/systemd/system/blockchain-rpc.service << EOL -[Unit] -Description=AITBC Blockchain RPC API -After=blockchain-node.service - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 8082 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -# Enable and start services -print_status "Starting blockchain node..." -systemctl daemon-reload -systemctl enable blockchain-node blockchain-rpc -systemctl start blockchain-node blockchain-rpc - -# Wait for services to start -print_status "Waiting for services to start..." -sleep 5 - -# Check status -print_status "Checking service status..." -systemctl status blockchain-node blockchain-rpc --no-pager | head -15 - -# Setup port forwarding if in container -if [ "$(hostname)" = "aitbc" ]; then - print_status "Setting up port forwarding..." - iptables -t nat -A PREROUTING -p tcp --dport 8082 -j DNAT --to-destination 192.168.100.10:8082 - iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 8082 -j MASQUERADE - iptables-save > /etc/iptables/rules.v4 -fi - -print_success "✅ Blockchain node deployed!" -echo "" -if [ "$(hostname)" = "aitbc" ]; then - echo "Node RPC: http://192.168.100.10:8082" - echo "External RPC: http://aitbc.keisanki.net:8082" -else - echo "Node RPC: http://95.216.198.140:8082" - echo "External RPC: http://aitbc.keisanki.net:8082" -fi -echo "" -echo "The node will automatically sync on startup." diff --git a/scripts/deploy/deploy-blockchain.sh b/scripts/deploy/deploy-blockchain.sh deleted file mode 100755 index 10bc4935..00000000 --- a/scripts/deploy/deploy-blockchain.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/bin/bash - -# Deploy blockchain node and explorer to incus container - -set -e - -echo "🚀 Deploying Blockchain Node and Explorer" -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" -} - -# Copy blockchain node to container -print_status "Copying blockchain node to container..." -ssh ns3-root "rm -rf /opt/blockchain-node 2>/dev/null || true" -scp -r apps/blockchain-node ns3-root:/opt/ - -# Setup blockchain node in container -print_status "Setting up blockchain node..." -ssh ns3-root << 'EOF' -cd /opt/blockchain-node - -# Create configuration -cat > .env << EOL -CHAIN_ID=ait-devnet -DB_PATH=./data/chain.db -RPC_BIND_HOST=0.0.0.0 -RPC_BIND_PORT=8082 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7070 -PROPOSER_KEY=proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=memory -EOL - -# Create data directory -mkdir -p data/devnet - -# Setup Python environment -python3 -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -pip install -e . - -# Generate genesis -export PYTHONPATH="${PWD}/src:${PWD}/scripts:${PYTHONPATH:-}" -python scripts/make_genesis.py --output data/devnet/genesis.json --force -EOF - -# Create systemd service for blockchain node -print_status "Creating systemd service for blockchain node..." -ssh ns3-root << 'EOF' -cat > /etc/systemd/system/blockchain-node.service << EOL -[Unit] -Description=AITBC Blockchain Node -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m aitbc_chain.main -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -cat > /etc/systemd/system/blockchain-rpc.service << EOL -[Unit] -Description=AITBC Blockchain RPC API -After=blockchain-node.service - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 8082 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -systemctl daemon-reload -systemctl enable blockchain-node blockchain-rpc -EOF - -# Start blockchain node -print_status "Starting blockchain node..." -ssh ns3-root "systemctl start blockchain-node blockchain-rpc" - -# Wait for node to start -print_status "Waiting for blockchain node to start..." -sleep 5 - -# Check status -print_status "Checking blockchain node status..." -ssh ns3-root "systemctl status blockchain-node blockchain-rpc --no-pager | grep -E 'Active:|Main PID:'" - -# Setup port forwarding -print_status "Setting up port forwarding..." -ssh ns3-root << 'EOF' -# Clear existing rules -iptables -t nat -F PREROUTING 2>/dev/null || true -iptables -t nat -F POSTROUTING 2>/dev/null || true - -# Add port forwarding for blockchain RPC -iptables -t nat -A PREROUTING -p tcp --dport 8082 -j DNAT --to-destination 192.168.100.10:8082 -iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 8082 -j MASQUERADE - -# Save rules -mkdir -p /etc/iptables -iptables-save > /etc/iptables/rules.v4 -EOF - -print_success "✅ Blockchain node deployed!" -echo "" -echo "Node RPC: http://192.168.100.10:8082" -echo "External RPC: http://aitbc.keisanki.net:8082" -echo "" -echo "Next: Deploying blockchain explorer..." diff --git a/scripts/deploy/deploy-direct.sh b/scripts/deploy/deploy-direct.sh deleted file mode 100755 index 3cac83aa..00000000 --- a/scripts/deploy/deploy-direct.sh +++ /dev/null @@ -1,316 +0,0 @@ -#!/bin/bash - -# Deploy blockchain node and explorer directly on ns3 - -set -e - -echo "🚀 AITBC Direct Deployment on ns3" -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 we're on ns3 -if [ "$(hostname)" != "ns3" ] && [ "$(hostname)" != "aitbc" ]; then - print_warning "This script must be run on ns3 server" - echo "Run: ssh ns3-root" - echo "Then: cd /opt && ./deploy-direct.sh" - exit 1 -fi - -# Stop existing services -print_status "Stopping existing services..." -systemctl stop blockchain-node blockchain-rpc blockchain-explorer nginx 2>/dev/null || true - -# Install dependencies -print_status "Installing dependencies..." -apt-get update -apt-get install -y python3 python3-venv python3-pip git curl nginx - -# Deploy blockchain node -print_status "Deploying blockchain node..." -cd /opt -rm -rf blockchain-node -cp -r blockchain-node-src blockchain-node -cd blockchain-node - -# Create configuration -print_status "Creating configuration..." -cat > .env << EOL -CHAIN_ID=ait-devnet -DB_PATH=./data/chain.db -RPC_BIND_HOST=0.0.0.0 -RPC_BIND_PORT=8082 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7070 -PROPOSER_KEY=proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=memory -EOL - -# Create fresh data directory -rm -rf data -mkdir -p data/devnet - -# Setup Python environment -python3 -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -pip install -e . - -# Generate genesis -export PYTHONPATH="${PWD}/src:${PWD}/scripts:${PYTHONPATH:-}" -python scripts/make_genesis.py --output data/devnet/genesis.json --force - -# Create systemd services -print_status "Creating systemd services..." -cat > /etc/systemd/system/blockchain-node.service << EOL -[Unit] -Description=AITBC Blockchain Node -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m aitbc_chain.main -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -cat > /etc/systemd/system/blockchain-rpc.service << EOL -[Unit] -Description=AITBC Blockchain RPC API -After=blockchain-node.service - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 8082 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -# Start blockchain services -print_status "Starting blockchain services..." -systemctl daemon-reload -systemctl enable blockchain-node blockchain-rpc -systemctl start blockchain-node blockchain-rpc - -# Deploy explorer -print_status "Deploying blockchain explorer..." -cd /opt -rm -rf blockchain-explorer -mkdir -p blockchain-explorer -cd blockchain-explorer - -# Create HTML explorer -cat > index.html << 'EOF' - - - - - - AITBC Blockchain Explorer - - - - -
-
-
-
- -

AITBC Blockchain Explorer

-
- -
-
-
- -
-
-
-
-
-

Current Height

-

-

-
- -
-
-
-
-
-

Latest Block

-

-

-
- -
-
-
-
-
-

Node Status

-

-

-
- -
-
-
- -
-
-

- - Latest Blocks -

-
-
- - - - - - - - - - - - - - -
HeightHashTimestampTransactions
- Loading blocks... -
-
-
-
- - - - -EOF - -# Configure nginx -print_status "Configuring nginx..." -cat > /etc/nginx/sites-available/blockchain-explorer << EOL -server { - listen 3000; - server_name _; - root /opt/blockchain-explorer; - index index.html; - - location / { - try_files \$uri \$uri/ =404; - } -} -EOL - -ln -sf /etc/nginx/sites-available/blockchain-explorer /etc/nginx/sites-enabled/ -rm -f /etc/nginx/sites-enabled/default -nginx -t -systemctl reload nginx - -# Setup port forwarding if in container -if [ "$(hostname)" = "aitbc" ]; then - print_status "Setting up port forwarding..." - iptables -t nat -F PREROUTING 2>/dev/null || true - iptables -t nat -F POSTROUTING 2>/dev/null || true - iptables -t nat -A PREROUTING -p tcp --dport 8082 -j DNAT --to-destination 192.168.100.10:8082 - iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 8082 -j MASQUERADE - iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 192.168.100.10:3000 - iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 3000 -j MASQUERADE - iptables-save > /etc/iptables/rules.v4 -fi - -# Wait for services to start -print_status "Waiting for services to start..." -sleep 5 - -# Check services -print_status "Checking service status..." -systemctl status blockchain-node blockchain-rpc nginx --no-pager | grep -E 'Active:|Main PID:' - -print_success "✅ Deployment complete!" -echo "" -echo "Services:" -if [ "$(hostname)" = "aitbc" ]; then - echo " - Blockchain Node RPC: http://192.168.100.10:8082" - echo " - Blockchain Explorer: http://192.168.100.10:3000" - echo "" - echo "External access:" - echo " - Blockchain Node RPC: http://aitbc.keisanki.net:8082" - echo " - Blockchain Explorer: http://aitbc.keisanki.net:3000" -else - echo " - Blockchain Node RPC: http://localhost:8082" - echo " - Blockchain Explorer: http://localhost:3000" - echo "" - echo "External access:" - echo " - Blockchain Node RPC: http://aitbc.keisanki.net:8082" - echo " - Blockchain Explorer: http://aitbc.keisanki.net:3000" -fi diff --git a/scripts/deploy/deploy-domain.sh b/scripts/deploy/deploy-domain.sh deleted file mode 100755 index 3842b1f7..00000000 --- a/scripts/deploy/deploy-domain.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -# Deploy AITBC services to domain https://aitbc.bubuit.net - -set -e - -DOMAIN="aitbc.bubuit.net" -CONTAINER="aitbc" - -echo "🚀 Deploying AITBC services to https://$DOMAIN" -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" -} - -# Stop local services -print_status "Stopping local services..." -sudo fuser -k 8000/tcp 2>/dev/null || true -sudo fuser -k 9080/tcp 2>/dev/null || true -sudo fuser -k 3001/tcp 2>/dev/null || true -sudo fuser -k 3002/tcp 2>/dev/null || true - -# Deploy to container -print_status "Deploying to container..." -python /home/oib/windsurf/aitbc/container-deploy.py - -# Copy nginx config to container -print_status "Configuring nginx for domain..." -incus file push /home/oib/windsurf/aitbc/nginx-aitbc.conf $CONTAINER/etc/nginx/sites-available/aitbc - -# Enable site -incus exec $CONTAINER -- ln -sf /etc/nginx/sites-available/aitbc /etc/nginx/sites-enabled/ -incus exec $CONTAINER -- rm -f /etc/nginx/sites-enabled/default - -# Test nginx config -incus exec $CONTAINER -- nginx -t - -# Reload nginx -incus exec $CONTAINER -- systemctl reload nginx - -# Install SSL certificate (Let's Encrypt) -print_warning "SSL Certificate Setup:" -echo "1. Ensure port 80/443 are forwarded to container IP (10.1.223.93)" -echo "2. Run certbot in container:" -echo " incus exec $CONTAINER -- certbot --nginx -d $DOMAIN" -echo "" - -# Update UIs to use correct API endpoints -print_status "Updating API endpoints..." - -# Update marketplace API base URL -incus exec $CONTAINER -- sed -i "s|http://127.0.0.1:8000|https://$DOMAIN/api|g" /home/oib/aitbc/apps/marketplace-ui/index.html - -# Update exchange API endpoints -incus exec $CONTAINER -- sed -i "s|http://127.0.0.1:8000|https://$DOMAIN/api|g" /home/oib/aitbc/apps/trade-exchange/index.html -incus exec $CONTAINER -- sed -i "s|http://127.0.0.1:9080|https://$DOMAIN/rpc|g" /home/oib/aitbc/apps/trade-exchange/index.html - -# Restart services to apply changes -print_status "Restarting services..." -incus exec $CONTAINER -- pkill -f "server.py" -sleep 2 -incus exec $CONTAINER -- /home/oib/start_aitbc.sh - -echo "" -print_status "✅ Deployment complete!" -echo "" -echo "📋 Service URLs:" -echo " 🌐 Domain: https://$DOMAIN" -echo " 📊 Marketplace: https://$DOMAIN/Marketplace" -echo " 💱 Trade Exchange: https://$DOMAIN/Exchange" -echo " 🔗 API: https://$DOMAIN/api" -echo " ⛓️ Blockchain RPC: https://$DOMAIN/rpc" -echo "" -echo "📝 Next Steps:" -echo "1. Forward ports 80/443 to container IP (10.1.223.93)" -echo "2. Install SSL certificate:" -echo " incus exec $CONTAINER -- certbot --nginx -d $DOMAIN" -echo "3. Test services at the URLs above" diff --git a/scripts/deploy/deploy-exchange.sh b/scripts/deploy/deploy-exchange.sh deleted file mode 100755 index 21706178..00000000 --- a/scripts/deploy/deploy-exchange.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -# Deploy AITBC Trade Exchange to the server - -set -e - -SERVER="root@10.1.223.93" -EXCHANGE_DIR="/root/aitbc/apps/trade-exchange" - -echo "🚀 Deploying AITBC Trade Exchange" -echo "==================================" -echo "Server: $SERVER" -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" -} - -# Test SSH connection -print_status "Testing SSH connection..." -ssh $SERVER "hostname && ip a show eth0 | grep inet" - -# Copy updated files -print_status "Copying updated Exchange files..." -scp /home/oib/windsurf/aitbc/apps/trade-exchange/index.html $SERVER:$EXCHANGE_DIR/ -scp /home/oib/windsurf/aitbc/apps/trade-exchange/server.py $SERVER:$EXCHANGE_DIR/ - -# Ensure assets are available -print_status "Ensuring assets directory exists..." -ssh $SERVER "mkdir -p /var/www/aitbc.bubuit.net/assets" -ssh $SERVER "mkdir -p /var/www/aitbc.bubuit.net/assets/css" -ssh $SERVER "mkdir -p /var/www/aitbc.bubuit.net/assets/js" - -# Copy assets if they don't exist -print_status "Copying assets if needed..." -if ! ssh $SERVER "test -f /var/www/aitbc.bubuit.net/assets/css/aitbc.css"; then - scp -r /home/oib/windsurf/aitbc/assets/* $SERVER:/var/www/aitbc.bubuit.net/assets/ -fi - -# Restart the exchange service -print_status "Restarting Trade Exchange service..." -ssh $SERVER "systemctl restart aitbc-exchange" - -# Wait for service to start -print_status "Waiting for service to start..." -sleep 5 - -# Check service status -print_status "Checking service status..." -ssh $SERVER "systemctl status aitbc-exchange --no-pager -l | head -10" - -# Test the endpoint -print_status "Testing Exchange endpoint..." -ssh $SERVER "curl -s http://127.0.0.1:3002/ | head -c 100" -echo "" - -echo "" -print_status "✅ Exchange deployment complete!" -echo "" -echo "📋 URLs:" -echo " 🌐 IP: http://10.1.223.93/Exchange" -echo " 🔒 Domain: https://aitbc.bubuit.net/Exchange" -echo "" -echo "🔍 To check logs:" -echo " ssh $SERVER 'journalctl -u aitbc-exchange -f'" diff --git a/scripts/deploy/deploy-explorer-remote.sh b/scripts/deploy/deploy-explorer-remote.sh deleted file mode 100644 index f58b71d5..00000000 --- a/scripts/deploy/deploy-explorer-remote.sh +++ /dev/null @@ -1,396 +0,0 @@ -#!/bin/bash - -# Deploy blockchain explorer directly on ns3 server - -set -e - -echo "🔍 Deploying Blockchain Explorer on ns3" -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 we're on the right server -if [ "$(hostname)" != "ns3" ] && [ "$(hostname)" != "aitbc" ]; then - print_warning "This script should be run on ns3 server" - exit 1 -fi - -# Create directory -print_status "Creating blockchain explorer directory..." -mkdir -p /opt/blockchain-explorer -cd /opt/blockchain-explorer - -# Create a simple HTML-based explorer (no build needed) -print_status "Creating web-based explorer..." -cat > index.html << 'EOF' - - - - - - AITBC Blockchain Explorer - - - - - -
-
-
-
- -

AITBC Blockchain Explorer

-
-
- Network: ait-devnet - -
-
-
-
- -
- -
-
-
-
-

Current Height

-

-

-
- -
-
-
-
-
-

Latest Block

-

-

-
- -
-
-
-
-
-

Node Status

-

-

-
- -
-
-
- - -
-
- - -
-
- - -
-
-

- - Latest Blocks -

-
-
-
- - - - - - - - - - - - - - - -
HeightHashTimestampTransactionsActions
- Loading blocks... -
-
-
-
- - - -
- - - - - - -EOF - -# Install a simple web server -print_status "Installing web server..." -apt-get install -y nginx - -# Configure nginx to serve the explorer -print_status "Configuring nginx..." -cat > /etc/nginx/sites-available/blockchain-explorer << EOL -server { - listen 3000; - server_name _; - root /opt/blockchain-explorer; - index index.html; - - location / { - try_files \$uri \$uri/ =404; - } - - # CORS headers for API access - location /rpc/ { - proxy_pass http://localhost:8082; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - } -} -EOL - -# Enable the site -ln -sf /etc/nginx/sites-available/blockchain-explorer /etc/nginx/sites-enabled/ -rm -f /etc/nginx/sites-enabled/default - -# Test and reload nginx -nginx -t -systemctl reload nginx - -# Setup port forwarding if in container -if [ "$(hostname)" = "aitbc" ]; then - print_status "Setting up port forwarding..." - iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 192.168.100.10:3000 - iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 3000 -j MASQUERADE - iptables-save > /etc/iptables/rules.v4 -fi - -print_status "Checking nginx status..." -systemctl status nginx --no-pager | head -10 - -print_success "✅ Blockchain explorer deployed!" -echo "" -echo "Explorer URL: http://localhost:3000" -if [ "$(hostname)" = "aitbc" ]; then - echo "External URL: http://aitbc.keisanki.net:3000" -else - echo "External URL: http://aitbc.keisanki.net:3000" -fi -echo "" -echo "The explorer is a static HTML site served by nginx." diff --git a/scripts/deploy/deploy-explorer.sh b/scripts/deploy/deploy-explorer.sh deleted file mode 100755 index 37031f9f..00000000 --- a/scripts/deploy/deploy-explorer.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash - -# Deploy AITBC Explorer to the server - -set -e - -SERVER="root@10.1.223.93" -EXPLORER_DIR="/root/aitbc/apps/explorer-web" -NGINX_CONFIG="/etc/nginx/sites-available/aitbc" - -echo "🚀 Deploying AITBC Explorer to Server" -echo "=====================================" -echo "Server: $SERVER" -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" -} - -# Build the explorer locally first -print_status "Building explorer locally..." -cd /home/oib/windsurf/aitbc/apps/explorer-web -npm run build - -# Copy built files to server -print_status "Copying explorer build to server..." -scp -r dist $SERVER:$EXPLORER_DIR/ - -# Update nginx config to include explorer -print_status "Updating nginx configuration..." - -# Backup current config -ssh $SERVER "cp $NGINX_CONFIG ${NGINX_CONFIG}.backup" - -# Add explorer location to nginx config -ssh $SERVER "sed -i '/# Health endpoint/i\\ - # Explorer\\ - location /explorer/ {\\ - alias /root/aitbc/apps/explorer-web/dist/;\\ - try_files \$uri \$uri/ /explorer/index.html;\\ - }\\ -\\ - # Explorer mock data\\ - location /explorer/mock/ {\\ - alias /root/aitbc/apps/explorer-web/public/mock/;\\ - }\\ -' $NGINX_CONFIG" - -# Test and reload nginx -print_status "Testing and reloading nginx..." -ssh $SERVER "nginx -t && systemctl reload nginx" - -print_status "✅ Explorer deployment complete!" -echo "" -echo "📋 Explorer URL:" -echo " 🌐 Explorer: https://aitbc.bubuit.net/explorer/" -echo "" diff --git a/scripts/deploy/deploy-first-node.sh b/scripts/deploy/deploy-first-node.sh deleted file mode 100755 index 21a4f369..00000000 --- a/scripts/deploy/deploy-first-node.sh +++ /dev/null @@ -1,121 +0,0 @@ -#!/bin/bash - -# Deploy the first blockchain node - -set -e - -echo "🚀 Deploying First Blockchain Node" -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" -} - -NODE1_DIR="/opt/blockchain-node" - -# Create configuration for first node -print_status "Creating configuration for first node..." -cat > $NODE1_DIR/.env << EOF -CHAIN_ID=ait-devnet -DB_PATH=./data/chain.db -RPC_BIND_HOST=127.0.0.1 -RPC_BIND_PORT=8080 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7070 -PROPOSER_KEY=node1_proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=http -GOSSIP_BROADCAST_URL=http://127.0.0.1:7071/gossip -EOF - -# Create data directory -mkdir -p $NODE1_DIR/data/devnet - -# Generate genesis file -print_status "Generating genesis file..." -cd $NODE1_DIR -export PYTHONPATH="${NODE1_DIR}/src:${NODE1_DIR}/scripts:${PYTHONPATH:-}" -python3 scripts/make_genesis.py --output data/devnet/genesis.json --force - -# Create systemd service -print_status "Creating systemd service..." -sudo cat > /etc/systemd/system/blockchain-node.service << EOF -[Unit] -Description=AITBC Blockchain Node 1 -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=$NODE1_DIR -Environment=PATH=$NODE1_DIR/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=$NODE1_DIR/src:$NODE1_DIR/scripts -ExecStart=$NODE1_DIR/.venv/bin/python3 -m aitbc_chain.main -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOF - -# Create RPC API service -print_status "Creating RPC API service..." -sudo cat > /etc/systemd/system/blockchain-rpc.service << EOF -[Unit] -Description=AITBC Blockchain RPC API 1 -After=blockchain-node.service - -[Service] -Type=exec -User=root -WorkingDirectory=$NODE1_DIR -Environment=PATH=$NODE1_DIR/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=$NODE1_DIR/src:$NODE1_DIR/scripts -ExecStart=$NODE1_DIR/.venv/bin/python3 -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 8080 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOF - -# Setup Python environment if not exists -if [ ! -d "$NODE1_DIR/.venv" ]; then - print_status "Setting up Python environment..." - cd $NODE1_DIR - python3 -m venv .venv - source .venv/bin/activate - pip install --upgrade pip - pip install -e . -fi - -# Enable and start services -print_status "Enabling and starting services..." -sudo systemctl daemon-reload -sudo systemctl enable blockchain-node blockchain-rpc -sudo systemctl start blockchain-node blockchain-rpc - -# Check status -print_status "Checking service status..." -sudo systemctl status blockchain-node --no-pager -l -sudo systemctl status blockchain-rpc --no-pager -l - -echo "" -print_status "✅ First blockchain node deployed!" -echo "" -echo "Node 1 RPC: http://127.0.0.1:8080" -echo "Node 2 RPC: http://127.0.0.1:8081" -echo "" -echo "To check logs:" -echo " Node 1: sudo journalctl -u blockchain-node -f" -echo " Node 2: sudo journalctl -u blockchain-node-2 -f" diff --git a/scripts/deploy/deploy-in-container.sh b/scripts/deploy/deploy-in-container.sh deleted file mode 100755 index 36aa374f..00000000 --- a/scripts/deploy/deploy-in-container.sh +++ /dev/null @@ -1,306 +0,0 @@ -#!/bin/bash - -# Deploy blockchain node and explorer inside the container - -set -e - -echo "🚀 Deploying Inside Container" -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 we're in the container -if [ ! -f /proc/1/environ ] || ! grep -q container=lxc /proc/1/environ 2>/dev/null; then - if [ "$(hostname)" != "aitbc" ]; then - print_warning "This script must be run inside the aitbc container" - exit 1 - fi -fi - -# Stop existing services -print_status "Stopping existing services..." -systemctl stop blockchain-node blockchain-rpc nginx 2>/dev/null || true - -# Install dependencies -print_status "Installing dependencies..." -apt-get update -apt-get install -y python3 python3-venv python3-pip git curl nginx - -# Deploy blockchain node -print_status "Deploying blockchain node..." -cd /opt -rm -rf blockchain-node -# The source is already in blockchain-node-src, copy it properly -cp -r blockchain-node-src blockchain-node -cd blockchain-node - -# Check if pyproject.toml exists -if [ ! -f pyproject.toml ]; then - print_warning "pyproject.toml not found, looking for it..." - find . -name "pyproject.toml" -type f - # If it's in a subdirectory, move everything up - if [ -f blockchain-node-src/pyproject.toml ]; then - print_status "Moving files from nested directory..." - mv blockchain-node-src/* . - rmdir blockchain-node-src - fi -fi - -# Create configuration -print_status "Creating configuration..." -cat > .env << EOL -CHAIN_ID=ait-devnet -DB_PATH=./data/chain.db -RPC_BIND_HOST=0.0.0.0 -RPC_BIND_PORT=8082 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7070 -PROPOSER_KEY=proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=memory -EOL - -# Create fresh data directory -rm -rf data -mkdir -p data/devnet - -# Setup Python environment -python3 -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -pip install -e . - -# Generate genesis -export PYTHONPATH="${PWD}/src:${PWD}/scripts:${PYTHONPATH:-}" -python scripts/make_genesis.py --output data/devnet/genesis.json --force - -# Create systemd services -print_status "Creating systemd services..." -cat > /etc/systemd/system/blockchain-node.service << EOL -[Unit] -Description=AITBC Blockchain Node -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m aitbc_chain.main -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -cat > /etc/systemd/system/blockchain-rpc.service << EOL -[Unit] -Description=AITBC Blockchain RPC API -After=blockchain-node.service - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 8082 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOL - -# Start blockchain services -print_status "Starting blockchain services..." -systemctl daemon-reload -systemctl enable blockchain-node blockchain-rpc -systemctl start blockchain-node blockchain-rpc - -# Deploy explorer -print_status "Deploying blockchain explorer..." -cd /opt -rm -rf blockchain-explorer -mkdir -p blockchain-explorer -cd blockchain-explorer - -# Create HTML explorer -cat > index.html << 'EOF' - - - - - - AITBC Blockchain Explorer - - - - -
-
-
-
- -

AITBC Blockchain Explorer

-
- -
-
-
- -
-
-
-
-
-

Current Height

-

-

-
- -
-
-
-
-
-

Latest Block

-

-

-
- -
-
-
-
-
-

Node Status

-

-

-
- -
-
-
- -
-
-

- - Latest Blocks -

-
-
- - - - - - - - - - - - - - -
HeightHashTimestampTransactions
- Loading blocks... -
-
-
-
- - - - -EOF - -# Configure nginx -print_status "Configuring nginx..." -cat > /etc/nginx/sites-available/blockchain-explorer << EOL -server { - listen 3000; - server_name _; - root /opt/blockchain-explorer; - index index.html; - - location / { - try_files \$uri \$uri/ =404; - } -} -EOL - -ln -sf /etc/nginx/sites-available/blockchain-explorer /etc/nginx/sites-enabled/ -rm -f /etc/nginx/sites-enabled/default -nginx -t -systemctl reload nginx - -# Wait for services to start -print_status "Waiting for services to start..." -sleep 5 - -# Check services -print_status "Checking service status..." -systemctl status blockchain-node blockchain-rpc nginx --no-pager | grep -E 'Active:|Main PID:' - -print_success "✅ Deployment complete in container!" -echo "" -echo "Services:" -echo " - Blockchain Node RPC: http://localhost:8082" -echo " - Blockchain Explorer: http://localhost:3000" -echo "" -echo "These are accessible from the host via port forwarding." diff --git a/scripts/deploy/deploy-modern-explorer.sh b/scripts/deploy/deploy-modern-explorer.sh deleted file mode 100644 index ef0fb84d..00000000 --- a/scripts/deploy/deploy-modern-explorer.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/bash - -# Deploy Modern Blockchain Explorer - -set -e - -echo "🚀 Deploying Modern Blockchain Explorer" -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" -} - -# Stop existing services -print_status "Stopping existing services..." -systemctl stop nginx 2>/dev/null || true - -# Create directory -print_status "Creating explorer directory..." -rm -rf /opt/blockchain-explorer -mkdir -p /opt/blockchain-explorer/assets - -# Copy files -print_status "Copying explorer files..." -cp -r /opt/blockchain-node-src/apps/blockchain-explorer/* /opt/blockchain-explorer/ - -# Update nginx configuration -print_status "Updating nginx configuration..." -cp /opt/blockchain-explorer/nginx.conf /etc/nginx/sites-available/blockchain-explorer -ln -sf /etc/nginx/sites-available/blockchain-explorer /etc/nginx/sites-enabled/ -rm -f /etc/nginx/sites-enabled/default - -# Test and start nginx -print_status "Starting nginx..." -nginx -t -systemctl start nginx - -print_success "✅ Modern explorer deployed!" -echo "" -echo "Access URLs:" -echo " - Explorer: http://localhost:3000/" -echo " - API: http://localhost:3000/api/v1/" -echo "" -echo "Standardized API Endpoints:" -echo " - GET /api/v1/chain/head" -echo " - GET /api/v1/chain/blocks?limit=N" -echo " - GET /api/v1/chain/blocks/{height}" diff --git a/scripts/deploy/deploy-nginx-reverse-proxy.sh b/scripts/deploy/deploy-nginx-reverse-proxy.sh deleted file mode 100755 index f8bc0f98..00000000 --- a/scripts/deploy/deploy-nginx-reverse-proxy.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/bin/bash - -# Deploy nginx reverse proxy for AITBC services -# This replaces firehol/iptables port forwarding with nginx reverse proxy - -set -e - -echo "🚀 Deploying Nginx Reverse Proxy for AITBC" -echo "==========================================" - -# Colors -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -RED='\033[0;31m' -NC='\033[0m' - -print_status() { - echo -e "${GREEN}[INFO]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARN]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - -# Check if we're on the host server -if ! grep -q "ns3-root" ~/.ssh/config 2>/dev/null; then - print_error "ns3-root SSH configuration not found. Please add it to ~/.ssh/config" - exit 1 -fi - -# Install nginx on host if not already installed -print_status "Checking nginx installation on host..." -ssh ns3-root "which nginx > /dev/null || (apt-get update && apt-get install -y nginx)" - -# Install certbot for SSL certificates -print_status "Checking certbot installation..." -ssh ns3-root "which certbot > /dev/null || (apt-get update && apt-get install -y certbot python3-certbot-nginx)" - -# Copy nginx configuration -print_status "Copying nginx configuration..." -scp infra/nginx/nginx-aitbc-reverse-proxy.conf ns3-root:/tmp/aitbc-reverse-proxy.conf - -# Backup existing nginx configuration -print_status "Backing up existing nginx configuration..." -ssh ns3-root "mkdir -p /etc/nginx/backup && cp -r /etc/nginx/sites-available/* /etc/nginx/backup/ 2>/dev/null || true" - -# Install the new configuration -print_status "Installing nginx reverse proxy configuration..." -ssh ns3-root << 'EOF' -# Remove existing configurations -rm -f /etc/nginx/sites-enabled/default -rm -f /etc/nginx/sites-available/aitbc* - -# Copy new configuration -cp /tmp/aitbc-reverse-proxy.conf /etc/nginx/sites-available/aitbc-reverse-proxy.conf - -# Create symbolic link -ln -sf /etc/nginx/sites-available/aitbc-reverse-proxy.conf /etc/nginx/sites-enabled/ - -# Test nginx configuration -nginx -t -EOF - -# Check if SSL certificate exists -print_status "Checking SSL certificate..." -if ! ssh ns3-root "test -f /etc/letsencrypt/live/aitbc.keisanki.net/fullchain.pem"; then - print_warning "SSL certificate not found. Obtaining Let's Encrypt certificate..." - - # Obtain SSL certificate - ssh ns3-root << 'EOF' -# Stop nginx temporarily -systemctl stop nginx 2>/dev/null || true - -# Obtain certificate -certbot certonly --standalone -d aitbc.keisanki.net -d api.aitbc.keisanki.net -d rpc.aitbc.keisanki.net --email admin@keisanki.net --agree-tos --non-interactive - -# Start nginx -systemctl start nginx -EOF - - if [ $? -ne 0 ]; then - print_error "Failed to obtain SSL certificate. Please run certbot manually:" - echo "certbot certonly --standalone -d aitbc.keisanki.net -d api.aitbc.keisanki.net -d rpc.aitbc.keisanki.net" - exit 1 - fi -fi - -# Restart nginx -print_status "Restarting nginx..." -ssh ns3-root "systemctl restart nginx && systemctl enable nginx" - -# Remove old iptables rules (optional) -print_warning "Removing old iptables port forwarding rules (if they exist)..." -ssh ns3-root << 'EOF' -# Flush existing NAT rules for AITBC ports -iptables -t nat -D PREROUTING -p tcp --dport 8000 -j DNAT --to-destination 192.168.100.10:8000 2>/dev/null || true -iptables -t nat -D POSTROUTING -p tcp -d 192.168.100.10 --dport 8000 -j MASQUERADE 2>/dev/null || true -iptables -t nat -D PREROUTING -p tcp --dport 8081 -j DNAT --to-destination 192.168.100.10:8081 2>/dev/null || true -iptables -t nat -D POSTROUTING -p tcp -d 192.168.100.10 --dport 8081 -j MASQUERADE 2>/dev/null || true -iptables -t nat -D PREROUTING -p tcp --dport 8082 -j DNAT --to-destination 192.168.100.10:8082 2>/dev/null || true -iptables -t nat -D POSTROUTING -p tcp -d 192.168.100.10 --dport 8082 -j MASQUERADE 2>/dev/null || true -iptables -t nat -D PREROUTING -p tcp --dport 9080 -j DNAT --to-destination 192.168.100.10:9080 2>/dev/null || true -iptables -t nat -D POSTROUTING -p tcp -d 192.168.100.10 --dport 9080 -j MASQUERADE 2>/dev/null || true -iptables -t nat -D PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 192.168.100.10:3000 2>/dev/null || true -iptables -t nat -D POSTROUTING -p tcp -d 192.168.100.10 --dport 3000 -j MASQUERADE 2>/dev/null || true - -# Save iptables rules -iptables-save > /etc/iptables/rules.v4 2>/dev/null || true -EOF - -# Wait for nginx to start -sleep 2 - -# Test the configuration -print_status "Testing reverse proxy configuration..." -echo "" - -# Test main domain -if curl -s -o /dev/null -w "%{http_code}" https://aitbc.keisanki.net/health | grep -q "200"; then - print_status "✅ Main domain (aitbc.keisanki.net) - OK" -else - print_error "❌ Main domain (aitbc.keisanki.net) - FAILED" -fi - -# Test API endpoint -if curl -s -o /dev/null -w "%{http_code}" https://aitbc.keisanki.net/api/health | grep -q "200"; then - print_status "✅ API endpoint - OK" -else - print_warning "⚠️ API endpoint - Not responding (service may not be running)" -fi - -# Test RPC endpoint -if curl -s -o /dev/null -w "%{http_code}" https://aitbc.keisanki.net/rpc/head | grep -q "200"; then - print_status "✅ RPC endpoint - OK" -else - print_warning "⚠️ RPC endpoint - Not responding (blockchain node may not be running)" -fi - -echo "" -print_status "🎉 Nginx reverse proxy deployment complete!" -echo "" -echo "Service URLs:" -echo " • Blockchain Explorer: https://aitbc.keisanki.net" -echo " • API: https://aitbc.keisanki.net/api/" -echo " • RPC: https://aitbc.keisanki.net/rpc/" -echo " • Exchange: https://aitbc.keisanki.net/exchange/" -echo "" -echo "Alternative URLs:" -echo " • API-only: https://api.aitbc.keisanki.net" -echo " • RPC-only: https://rpc.aitbc.keisanki.net" -echo "" -echo "Note: Make sure all services are running in the container:" -echo " • blockchain-explorer.service (port 3000)" -echo " • coordinator-api.service (port 8000)" -echo " • blockchain-rpc.service (port 8082)" -echo " • aitbc-exchange.service (port 9080)" diff --git a/scripts/deploy/deploy-production.sh b/scripts/deploy/deploy-production.sh deleted file mode 100644 index 0ee7295b..00000000 --- a/scripts/deploy/deploy-production.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/bin/bash - -echo "🚀 Deploying AITBC for Production..." - -# 1. Setup production assets -echo "📦 Setting up production assets..." -bash setup-production-assets.sh - -# 2. Copy assets to server -echo "📋 Copying assets to server..." -scp -r assets/ aitbc:/var/www/html/ - -# 3. Update Nginx configuration -echo "⚙️ Updating Nginx configuration..." -ssh aitbc "cat >> /etc/nginx/sites-available/aitbc.conf << 'EOF' - -# Serve production assets -location /assets/ { - alias /var/www/html/assets/; - expires 1y; - add_header Cache-Control \"public, immutable\"; - add_header X-Content-Type-Options nosniff; - - # Gzip compression - gzip on; - gzip_types text/css application/javascript image/svg+xml; -} - -# Security headers -add_header Referrer-Policy \"strict-origin-when-cross-origin\" always; -add_header X-Frame-Options \"SAMEORIGIN\" always; -add_header X-Content-Type-Options \"nosniff\" always; -EOF" - -# 4. Reload Nginx -echo "🔄 Reloading Nginx..." -ssh aitbc "nginx -t && systemctl reload nginx" - -# 5. Update Exchange page to use production assets -echo "🔄 Updating Exchange page..." -scp apps/trade-exchange/index.prod.html aitbc:/root/aitbc/apps/trade-exchange/index.html - -# 6. Update Marketplace page -echo "🔄 Updating Marketplace page..." -sed -i 's|https://cdn.tailwindcss.com|/assets/js/tailwind.js|g' apps/marketplace-ui/index.html -sed -i 's|https://unpkg.com/axios/dist/axios.min.js|/assets/js/axios.min.js|g' apps/marketplace-ui/index.html -sed -i 's|https://unpkg.com/lucide@latest|/assets/js/lucide.js|g' apps/marketplace-ui/index.html -scp apps/marketplace-ui/index.html aitbc:/root/aitbc/apps/marketplace-ui/ - -echo "✅ Production deployment complete!" -echo "" -echo "📝 Next steps:" -echo "1. Restart services: ssh aitbc 'systemctl restart aitbc-exchange aitbc-marketplace-ui'" -echo "2. Clear browser cache" -echo "3. Test all pages" diff --git a/scripts/deploy/deploy-remote-build.sh b/scripts/deploy/deploy-remote-build.sh deleted file mode 100644 index c36ea72d..00000000 --- a/scripts/deploy/deploy-remote-build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Deploy blockchain node by building directly on ns3 server - -echo "🚀 Remote Blockchain Deployment (Build on Server)" -echo "==============================================" - -# Copy deployment script to server -echo "Copying deployment script to ns3..." -scp scripts/deploy/deploy-blockchain-remote.sh ns3-root:/opt/ - -# Execute deployment on server -echo "Executing deployment on ns3 (utilizing gigabit connection)..." -ssh ns3-root "cd /opt && chmod +x deploy-blockchain-remote.sh && ./deploy-blockchain-remote.sh" - -echo "" -echo "Deployment complete!" -echo "The blockchain node was built directly on ns3 using its fast connection." diff --git a/scripts/deploy/deploy-second-node.sh b/scripts/deploy/deploy-second-node.sh deleted file mode 100755 index 5317f94a..00000000 --- a/scripts/deploy/deploy-second-node.sh +++ /dev/null @@ -1,127 +0,0 @@ -#!/bin/bash - -# Deploy a second blockchain node on the same server - -set -e - -echo "🚀 Deploying Second Blockchain Node" -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" -} - -# Create directory for second node -print_status "Creating directory for second node..." -NODE2_DIR="/opt/blockchain-node-2" -sudo mkdir -p $NODE2_DIR -sudo chown $USER:$USER $NODE2_DIR - -# Copy blockchain node code -print_status "Copying blockchain node code..." -cp -r /opt/blockchain-node/* $NODE2_DIR/ - -# Create configuration for second node -print_status "Creating configuration for second node..." -cat > $NODE2_DIR/.env << EOF -CHAIN_ID=ait-devnet -DB_PATH=./data/chain2.db -RPC_BIND_HOST=127.0.0.1 -RPC_BIND_PORT=8081 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7071 -PROPOSER_KEY=node2_proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=http -GOSSIP_BROADCAST_URL=http://127.0.0.1:7070/gossip -EOF - -# Create data directory -mkdir -p $NODE2_DIR/data/devnet - -# Generate genesis file (same as first node) -print_status "Generating genesis file..." -cd $NODE2_DIR -export PYTHONPATH="${NODE2_DIR}/src:${NODE2_DIR}/scripts:${PYTHONPATH:-}" -python3 scripts/make_genesis.py --output data/devnet/genesis.json --force - -# Create systemd service -print_status "Creating systemd service..." -sudo cat > /etc/systemd/system/blockchain-node-2.service << EOF -[Unit] -Description=AITBC Blockchain Node 2 -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=$NODE2_DIR -Environment=PATH=$NODE2_DIR/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=$NODE2_DIR/src:$NODE2_DIR/scripts -ExecStart=$NODE2_DIR/.venv/bin/python3 -m aitbc_chain.main -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOF - -# Create RPC API service -print_status "Creating RPC API service..." -sudo cat > /etc/systemd/system/blockchain-rpc-2.service << EOF -[Unit] -Description=AITBC Blockchain RPC API 2 -After=blockchain-node-2.service - -[Service] -Type=exec -User=root -WorkingDirectory=$NODE2_DIR -Environment=PATH=$NODE2_DIR/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=$NODE2_DIR/src:$NODE2_DIR/scripts -ExecStart=$NODE2_DIR/.venv/bin/python3 -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 8081 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOF - -# Setup Python environment -print_status "Setting up Python environment..." -cd $NODE2_DIR -python3 -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -pip install -e . - -# Enable and start services -print_status "Enabling and starting services..." -sudo systemctl daemon-reload -sudo systemctl enable blockchain-node-2 blockchain-rpc-2 -sudo systemctl start blockchain-node-2 blockchain-rpc-2 - -# Check status -print_status "Checking service status..." -sudo systemctl status blockchain-node-2 --no-pager -l -sudo systemctl status blockchain-rpc-2 --no-pager -l - -echo "" -print_status "✅ Second blockchain node deployed!" -echo "" -echo "Node 1 RPC: http://127.0.0.1:8080" -echo "Node 2 RPC: http://127.0.0.1:8081" -echo "" -echo "To check logs:" -echo " Node 1: sudo journalctl -u blockchain-node -f" -echo " Node 2: sudo journalctl -u blockchain-node-2 -f" diff --git a/scripts/deploy/deploy-to-aitbc-container.sh b/scripts/deploy/deploy-to-aitbc-container.sh deleted file mode 100755 index 2088152d..00000000 --- a/scripts/deploy/deploy-to-aitbc-container.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash - -# Deploy blockchain node inside incus container aitbc - -set -e - -echo "🚀 AITBC Deployment in Incus Container" -echo "======================================" -echo "This will deploy inside the aitbc container" -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 we're on ns3 host -if [ "$(hostname)" != "ns3" ]; then - print_warning "This script must be run on ns3 host" - echo "Run: ssh ns3-root" - exit 1 -fi - -# Check if container exists -if ! incus list | grep -q "aitbc.*RUNNING"; then - print_warning "Container aitbc is not running" - exit 1 -fi - -# Copy source to container -print_status "Copying source code to container..." -incus exec aitbc -- rm -rf /opt/blockchain-node-src 2>/dev/null || true -incus exec aitbc -- mkdir -p /opt/blockchain-node-src -# Use the source already on the server -incus file push -r /opt/blockchain-node-src/. aitbc/opt/blockchain-node-src/ -# Fix the nested directory issue - move everything up one level -incus exec aitbc -- sh -c 'if [ -d /opt/blockchain-node-src/blockchain-node-src ]; then mv /opt/blockchain-node-src/blockchain-node-src/* /opt/blockchain-node-src/ && rmdir /opt/blockchain-node-src/blockchain-node-src; fi' - -# Copy deployment script to container -print_status "Copying deployment script to container..." -incus file push /opt/deploy-in-container.sh aitbc/opt/ - -# Execute deployment inside container -print_status "Deploying inside container..." -incus exec aitbc -- bash /opt/deploy-in-container.sh - -# Setup port forwarding on host -print_status "Setting up port forwarding on host..." -iptables -t nat -F PREROUTING 2>/dev/null || true -iptables -t nat -F POSTROUTING 2>/dev/null || true - -# Forward blockchain RPC -iptables -t nat -A PREROUTING -p tcp --dport 8082 -j DNAT --to-destination 192.168.100.10:8082 -iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 8082 -j MASQUERADE - -# Forward explorer -iptables -t nat -A PREROUTING -p tcp --dport 3000 -j DNAT --to-destination 192.168.100.10:3000 -iptables -t nat -A POSTROUTING -p tcp -d 192.168.100.10 --dport 3000 -j MASQUERADE - -# Save rules -mkdir -p /etc/iptables -iptables-save > /etc/iptables/rules.v4 - -# Check services -print_status "Checking services in container..." -incus exec aitbc -- systemctl status blockchain-node blockchain-rpc nginx --no-pager | grep -E 'Active:|Main PID:' - -print_success "✅ Deployment complete!" -echo "" -echo "Services in container aitbc:" -echo " - Blockchain Node RPC: http://192.168.100.10:8082" -echo " - Blockchain Explorer: http://192.168.100.10:3000" -echo "" -echo "External access via ns3:" -echo " - Blockchain Node RPC: http://aitbc.keisanki.net:8082" -echo " - Blockchain Explorer: http://aitbc.keisanki.net:3000" diff --git a/scripts/deploy/deploy-to-container.sh b/scripts/deploy/deploy-to-container.sh deleted file mode 100755 index 3d970912..00000000 --- a/scripts/deploy/deploy-to-container.sh +++ /dev/null @@ -1,253 +0,0 @@ -#!/bin/bash - -# AITBC Services Deployment to Incus Container -# This script deploys all AITBC services to the 'aitbc' container - -set -e - -CONTAINER_NAME="aitbc" -CONTAINER_IP="10.1.223.93" -PROJECT_DIR="/home/oib/windsurf/aitbc" - -echo "🚀 Deploying AITBC services to container: $CONTAINER_NAME" -echo "Container IP: $CONTAINER_IP" -echo "" - -# Colors for output -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -NC='\033[0m' # No Color - -# Function to print colored output -print_status() { - echo -e "${GREEN}[INFO]${NC} $1" -} - -print_warning() { - echo -e "${YELLOW}[WARN]${NC} $1" -} - -print_error() { - echo -e "${RED}[ERROR]${NC} $1" -} - -# Stop local services -print_status "Stopping local AITBC services..." -sudo fuser -k 8000/tcp 2>/dev/null || true -sudo fuser -k 9080/tcp 2>/dev/null || true -sudo fuser -k 3001/tcp 2>/dev/null || true -sudo fuser -k 3002/tcp 2>/dev/null || true -pkill -f "aitbc_chain.app" 2>/dev/null || true -pkill -f "marketplace-ui" 2>/dev/null || true -pkill -f "trade-exchange" 2>/dev/null || true - -# Copy project to container -print_status "Copying AITBC project to container..." -incus file push -r $PROJECT_DIR $CONTAINER_NAME/home/oib/ - -# Setup container environment -print_status "Setting up container environment..." -incus exec $CONTAINER_NAME -- bash -c " -cd /home/oib/aitbc -python -m venv .venv -source .venv/bin/activate -pip install --upgrade pip -" - -# Install dependencies for each service -print_status "Installing dependencies..." - -# Coordinator API -print_status "Installing Coordinator API dependencies..." -incus exec $CONTAINER_NAME -- bash -c " -cd /home/oib/aitbc/apps/coordinator-api -source ../.venv/bin/activate -pip install -e . -pip install fastapi uvicorn -" - -# Blockchain Node -print_status "Installing Blockchain Node dependencies..." -incus exec $CONTAINER_NAME -- bash -c " -cd /home/oib/aitbc/apps/blockchain-node -source ../.venv/bin/activate -pip install -e . -pip install fastapi uvicorn -" - -# Create systemd service files -print_status "Creating systemd services..." - -# Coordinator API service -incus exec $CONTAINER_NAME -- tee /etc/systemd/system/aitbc-coordinator.service > /dev/null < /dev/null < /dev/null < /dev/null < /dev/null </dev/null || true" -scp -r /home/oib/windsurf/aitbc $SERVER:/root/ - -# Setup Python environment -print_status "Setting up Python environment..." -ssh $SERVER "cd $PROJECT_DIR && python3 -m venv .venv && source .venv/bin/activate && pip install --upgrade pip" - -# Install dependencies -print_status "Installing dependencies..." -ssh $SERVER "cd $PROJECT_DIR/apps/coordinator-api && source ../../.venv/bin/activate && pip install -e ." -ssh $SERVER "cd $PROJECT_DIR/apps/blockchain-node && source ../../.venv/bin/activate && pip install -e ." - -# Create systemd service files -print_status "Creating systemd services..." - -# Coordinator API service -ssh $SERVER 'cat > /etc/systemd/system/aitbc-coordinator.service << EOF -[Unit] -Description=AITBC Coordinator API -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/root/aitbc/apps/coordinator-api -Environment=PATH=/root/aitbc/.venv/bin -ExecStart=/root/aitbc/.venv/bin/python -m uvicorn src.app.main:app --host 0.0.0.0 --port 8000 -Restart=always -RestartSec=10 - -[Install] -WantedBy=multi-user.target -EOF' - -# Blockchain Node service -ssh $SERVER 'cat > /etc/systemd/system/aitbc-blockchain.service << EOF -[Unit] -Description=AITBC Blockchain Node -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/root/aitbc/apps/blockchain-node -Environment=PATH=/root/aitbc/.venv/bin -ExecStart=/root/aitbc/.venv/bin/python -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 9080 -Restart=always -RestartSec=10 - -[Install] -WantedBy=multi-user.target -EOF' - -# Marketplace UI service -ssh $SERVER 'cat > /etc/systemd/system/aitbc-marketplace.service << EOF -[Unit] -Description=AITBC Marketplace UI -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/root/aitbc/apps/marketplace-ui -Environment=PATH=/root/aitbc/.venv/bin -ExecStart=/root/aitbc/.venv/bin/python server.py --port 3001 -Restart=always -RestartSec=10 - -[Install] -WantedBy=multi-user.target -EOF' - -# Trade Exchange service -ssh $SERVER 'cat > /etc/systemd/system/aitbc-exchange.service << EOF -[Unit] -Description=AITBC Trade Exchange -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/root/aitbc/apps/trade-exchange -Environment=PATH=/root/aitbc/.venv/bin -ExecStart=/root/aitbc/.venv/bin/python server.py --port 3002 -Restart=always -RestartSec=10 - -[Install] -WantedBy=multi-user.target -EOF' - -# Install nginx if not installed -print_status "Installing nginx..." -ssh $SERVER "apt update && apt install -y nginx" - -# Create nginx configuration -print_status "Configuring nginx..." -ssh $SERVER 'cat > /etc/nginx/sites-available/aitbc << EOF -server { - listen 80; - server_name aitbc.bubuit.net; - - # API routes - location /api/ { - proxy_pass http://127.0.0.1:8000/v1/; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto \$scheme; - } - - # Admin routes - location /admin/ { - proxy_pass http://127.0.0.1:8000/admin/; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto \$scheme; - } - - # Blockchain RPC - location /rpc/ { - proxy_pass http://127.0.0.1:9080/rpc/; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto \$scheme; - } - - # Marketplace UI - location /Marketplace { - proxy_pass http://127.0.0.1:3001/; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto \$scheme; - } - - # Trade Exchange - location /Exchange { - proxy_pass http://127.0.0.1:3002/; - proxy_set_header Host \$host; - proxy_set_header X-Real-IP \$remote_addr; - proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto \$scheme; - } - - # Health endpoint - location /health { - proxy_pass http://127.0.0.1:8000/v1/health; - proxy_set_header Host \$host; - } - - # Default redirect - location / { - return 301 /Marketplace; - } -} -EOF' - -# Enable nginx site -ssh $SERVER "ln -sf /etc/nginx/sites-available/aitbc /etc/nginx/sites-enabled/" -ssh $SERVER "rm -f /etc/nginx/sites-enabled/default" - -# Test and reload nginx -ssh $SERVER "nginx -t && systemctl reload nginx" - -# Start services -print_status "Starting AITBC services..." -ssh $SERVER "systemctl daemon-reload" -ssh $SERVER "systemctl enable aitbc-coordinator aitbc-blockchain aitbc-marketplace aitbc-exchange" -ssh $SERVER "systemctl start aitbc-coordinator aitbc-blockchain aitbc-marketplace aitbc-exchange" - -# Wait for services to start -print_status "Waiting for services to start..." -sleep 10 - -# Check service status -print_status "Checking service status..." -ssh $SERVER "systemctl status aitbc-coordinator --no-pager -l | head -10" -ssh $SERVER "systemctl status aitbc-blockchain --no-pager -l | head -10" - -# Test endpoints -print_status "Testing endpoints..." -ssh $SERVER "curl -s http://127.0.0.1:8000/v1/health | head -c 100" -echo "" -ssh $SERVER "curl -s http://127.0.0.1:8000/v1/admin/stats -H 'X-Api-Key: ${ADMIN_API_KEY}' | head -c 100" -echo "" - -echo "" -print_status "✅ Deployment complete!" -echo "" -echo "📋 Service URLs:" -echo " 🌐 Server IP: 10.1.223.93" -echo " 📊 Marketplace: http://10.1.223.93/Marketplace" -echo " 💱 Trade Exchange: http://10.1.223.93/Exchange" -echo " 🔗 API: http://10.1.223.93/api" -echo " ⛓️ Blockchain RPC: http://10.1.223.93/rpc" -echo "" -echo "🔒 Domain URLs (with SSL):" -echo " 📊 Marketplace: https://aitbc.bubuit.net/Marketplace" -echo " 💱 Trade Exchange: https://aitbc.bubuit.net/Exchange" -echo " 🔗 API: https://aitbc.bubuit.net/api" -echo " ⛓️ Blockchain RPC: https://aitbc.bubuit.net/rpc" -echo "" -print_status "To manage services:" -echo " ssh aitbc 'systemctl status aitbc-coordinator'" -echo " ssh aitbc 'journalctl -u aitbc-coordinator -f'" diff --git a/scripts/deploy/deploy_container_with_miner.py b/scripts/deploy/deploy_container_with_miner.py deleted file mode 100644 index c44f8130..00000000 --- a/scripts/deploy/deploy_container_with_miner.py +++ /dev/null @@ -1,158 +0,0 @@ -#!/usr/bin/env python3 -""" -Deploy AITBC services to incus container with GPU miner integration -""" - -import subprocess -import time -import sys - -def run_command(cmd, container=None): - """Run command locally or in container""" - if container: - cmd = f"incus exec {container} -- {cmd}" - print(f"Running: {cmd}") - result = subprocess.run(cmd, shell=True, capture_output=True, text=True) - if result.returncode != 0: - print(f"Error: {result.stderr}") - return False - return True - -def deploy_to_container(): - container = "aitbc" - container_ip = "10.1.223.93" - - print("🚀 Deploying AITBC services to container with GPU miner...") - - # Check if container exists - result = subprocess.run("incus list -c n", shell=True, capture_output=True, text=True) - if container not in result.stdout: - print(f"\n📦 Creating container {container}...") - subprocess.run(f"incus launch images:ubuntu/22.04 {container}", shell=True) - time.sleep(10) - - # Ensure container is running - subprocess.run(f"incus start {container}", shell=True) - time.sleep(5) - - # Update and install packages in container - print("\n📦 Installing packages in container...") - run_command("apt-get update", container) - run_command("apt-get install -y python3 python3-pip python3-venv curl", container) - - # Stop local services - print("\n📋 Stopping local services...") - subprocess.run("sudo fuser -k 8000/tcp 2>/dev/null || true", shell=True) - subprocess.run("sudo fuser -k 9080/tcp 2>/dev/null || true", shell=True) - subprocess.run("pkill -f 'marketplace-ui' 2>/dev/null || true", shell=True) - subprocess.run("pkill -f 'trade-exchange' 2>/dev/null || true", shell=True) - - # Copy project to container - print("\n📁 Copying project to container...") - subprocess.run(f"incus file push -r /home/oib/windsurf/aitbc {container}/home/oib/", shell=True) - - # Setup Python environment in container - print("\n🐍 Setting up Python environment...") - run_command("cd /home/oib/aitbc && python3 -m venv .venv", container) - run_command("cd /home/oib/aitbc && source .venv/bin/activate && pip install fastapi uvicorn httpx sqlmodel psutil", container) - - # Install dependencies - print("\n📦 Installing dependencies...") - run_command("cd /home/oib/aitbc/apps/coordinator-api && source ../../.venv/bin/activate && pip install -e .", container) - run_command("cd /home/oib/aitbc/apps/blockchain-node && source ../../.venv/bin/activate && pip install -e .", container) - - # Create startup script with GPU miner - print("\n🔧 Creating startup script with GPU miner...") - startup_script = """#!/bin/bash -cd /home/oib/aitbc -source .venv/bin/activate - -# Start coordinator API -echo "Starting Coordinator API..." -cd apps/coordinator-api -source ../../.venv/bin/activate -python -m uvicorn app.main:app --host 0.0.0.0 --port 8000 & -COORD_PID=$! - -# Start blockchain node -echo "Starting Blockchain Node..." -cd ../../apps/blockchain-node -source ../../.venv/bin/activate -python -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 9080 & -BLOCK_PID=$! - -# Start trade exchange -echo "Starting Trade Exchange..." -cd ../../apps/trade-exchange -source ../../.venv/bin/activate -python simple_exchange_api.py & -EXCHANGE_PID=$! - -# Start GPU registry -echo "Starting GPU Registry..." -cd ../.. -python gpu_registry_demo.py & -REGISTRY_PID=$! - -# Start GPU miner -echo "Starting GPU Miner..." -python gpu_miner_with_wait.py & -MINER_PID=$! - -echo "All services started!" -echo "Coordinator API: http://10.1.223.93:8000" -echo "Blockchain RPC: http://10.1.223.93:9080" -echo "Trade Exchange: http://10.1.223.93:3002" -echo "GPU Registry: http://10.1.223.93:8091" - -# Wait for services -wait $COORD_PID $BLOCK_PID $EXCHANGE_PID $REGISTRY_PID $MINER_PID -""" - - # Write startup script to container - with open('/tmp/startup.sh', 'w') as f: - f.write(startup_script) - subprocess.run(f"incus file push /tmp/startup.sh {container}/home/oib/aitbc/", shell=True) - run_command("chmod +x /home/oib/aitbc/startup.sh", container) - - # Create systemd service - print("\n⚙️ Creating systemd service...") - service_content = """[Unit] -Description=AITBC Services with GPU Miner -After=network.target - -[Service] -Type=simple -User=oib -WorkingDirectory=/home/oib/aitbc -ExecStart=/home/oib/aitbc/startup.sh -Restart=always -RestartSec=10 - -[Install] -WantedBy=multi-user.target -""" - - with open('/tmp/aitbc.service', 'w') as f: - f.write(service_content) - subprocess.run(f"incus file push /tmp/aitbc.service {container}/tmp/", shell=True) - run_command("mv /tmp/aitbc.service /etc/systemd/system/", container) - run_command("systemctl daemon-reload", container) - run_command("systemctl enable aitbc.service", container) - run_command("systemctl start aitbc.service", container) - - print("\n✅ Deployment complete!") - print(f"\n📊 Service URLs:") - print(f" - Coordinator API: http://{container_ip}:8000") - print(f" - Blockchain RPC: http://{container_ip}:9080") - print(f" - Trade Exchange: http://{container_ip}:3002") - print(f" - GPU Registry: http://{container_ip}:8091") - print(f"\n🔍 Check GPU status:") - print(f" curl http://{container_ip}:8091/miners/list") - - print(f"\n📋 To manage services in container:") - print(f" incus exec {container} -- systemctl status aitbc") - print(f" incus exec {container} -- journalctl -u aitbc -f") - -if __name__ == "__main__": - deploy_to_container() diff --git a/scripts/deploy/deploy_gpu_to_container.py b/scripts/deploy/deploy_gpu_to_container.py deleted file mode 100644 index 764d04fa..00000000 --- a/scripts/deploy/deploy_gpu_to_container.py +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env python3 -""" -Deploy GPU Miner Integration to AITBC Container -""" - -import subprocess -import sys - -def run_in_container(cmd): - """Run command in aitbc container""" - full_cmd = f"incus exec aitbc -- {cmd}" - print(f"Running: {full_cmd}") - result = subprocess.run(full_cmd, shell=True, capture_output=True, text=True) - if result.returncode != 0: - print(f"Error: {result.stderr}") - return False, result.stderr - return True, result.stdout - -def deploy_gpu_miner_to_container(): - print("🚀 Deploying GPU Miner Integration to AITBC Container...") - - # Check container access - print("\n1. 🔍 Checking container access...") - success, output = run_in_container("whoami") - if success: - print(f" Container user: {output.strip()}") - else: - print(" ❌ Cannot access container") - return - - # Copy GPU miner files to container - print("\n2. 📁 Copying GPU miner files...") - files_to_copy = [ - "gpu_miner_with_wait.py", - "gpu_registry_demo.py" - ] - - for file in files_to_copy: - cmd = f"incus file push /home/oib/windsurf/aitbc/{file} aitbc/home/oib/" - print(f" Copying {file}...") - result = subprocess.run(cmd, shell=True) - if result.returncode == 0: - print(f" ✅ {file} copied") - else: - print(f" ❌ Failed to copy {file}") - - # Install dependencies in container - print("\n3. 📦 Installing dependencies...") - run_in_container("pip install httpx fastapi uvicorn psutil") - - # Create GPU miner service in container - print("\n4. ⚙️ Creating GPU miner service...") - service_content = """[Unit] -Description=AITBC GPU Miner Client -After=network.target - -[Service] -Type=simple -User=oib -WorkingDirectory=/home/oib -ExecStart=/usr/bin/python3 gpu_miner_with_wait.py -Restart=always -RestartSec=30 -StandardOutput=journal -StandardError=journal - -[Install] -WantedBy=multi-user.target -""" - - # Write service file to container - with open('/tmp/gpu-miner.service', 'w') as f: - f.write(service_content) - subprocess.run("incus file push /tmp/gpu-miner.service aitbc/tmp/", shell=True) - run_in_container("sudo mv /tmp/gpu-miner.service /etc/systemd/system/") - run_in_container("sudo systemctl daemon-reload") - run_in_container("sudo systemctl enable gpu-miner.service") - run_in_container("sudo systemctl start gpu-miner.service") - - # Create GPU registry service in container - print("\n5. 🎮 Creating GPU registry service...") - registry_service = """[Unit] -Description=AITBC GPU Registry -After=network.target - -[Service] -Type=simple -User=oib -WorkingDirectory=/home/oib -ExecStart=/usr/bin/python3 gpu_registry_demo.py -Restart=always -RestartSec=10 -StandardOutput=journal -StandardError=journal - -[Install] -WantedBy=multi-user.target -""" - - with open('/tmp/gpu-registry.service', 'w') as f: - f.write(registry_service) - subprocess.run("incus file push /tmp/gpu-registry.service aitbc/tmp/", shell=True) - run_in_container("sudo mv /tmp/gpu-registry.service /etc/systemd/system/") - run_in_container("sudo systemctl daemon-reload") - run_in_container("sudo systemctl enable gpu-registry.service") - run_in_container("sudo systemctl start gpu-registry.service") - - # Check services - print("\n6. 📊 Checking services...") - success, output = run_in_container("sudo systemctl status gpu-miner.service --no-pager") - print(output) - - success, output = run_in_container("sudo systemctl status gpu-registry.service --no-pager") - print(output) - - # Update coordinator to include miner endpoints - print("\n7. 🔗 Updating coordinator API...") - - print("\n✅ GPU Miner deployed to container!") - print("\n📊 Access URLs:") - print(" - Container IP: 10.1.223.93") - print(" - GPU Registry: http://10.1.223.93:8091/miners/list") - print(" - Coordinator API: http://10.1.223.93:8000") - - print("\n🔧 To manage services in container:") - print(" incus exec aitbc -- sudo systemctl status gpu-miner") - print(" incus exec aitbc -- sudo journalctl -u gpu-miner -f") - -if __name__ == "__main__": - deploy_gpu_miner_to_container() diff --git a/scripts/deploy/setup-gossip-relay.sh b/scripts/deploy/setup-gossip-relay.sh deleted file mode 100755 index 83018bcd..00000000 --- a/scripts/deploy/setup-gossip-relay.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/bin/bash - -# Setup gossip relay to connect blockchain nodes - -set -e - -echo "🌐 Setting up Gossip Relay for Blockchain Nodes" -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" -} - -# Stop existing nodes -print_status "Stopping blockchain nodes..." -sudo systemctl stop blockchain-node blockchain-node-2 blockchain-rpc blockchain-rpc-2 2>/dev/null || true - -# Update node configurations to use broadcast backend -print_status "Updating Node 1 configuration..." -sudo cat > /opt/blockchain-node/.env << EOF -CHAIN_ID=ait-devnet -DB_PATH=./data/chain.db -RPC_BIND_HOST=127.0.0.1 -RPC_BIND_PORT=8082 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7070 -PROPOSER_KEY=node1_proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=broadcast -GOSSIP_BROADCAST_URL=http://127.0.0.1:7070/gossip -EOF - -print_status "Updating Node 2 configuration..." -sudo cat > /opt/blockchain-node-2/.env << EOF -CHAIN_ID=ait-devnet -DB_PATH=./data/chain2.db -RPC_BIND_HOST=127.0.0.1 -RPC_BIND_PORT=8081 -P2P_BIND_HOST=0.0.0.0 -P2P_BIND_PORT=7071 -PROPOSER_KEY=node2_proposer_key_$(date +%s) -MINT_PER_UNIT=1000 -COORDINATOR_RATIO=0.05 -GOSSIP_BACKEND=broadcast -GOSSIP_BROADCAST_URL=http://127.0.0.1:7070/gossip -EOF - -# Create gossip relay service -print_status "Creating gossip relay service..." -sudo cat > /etc/systemd/system/blockchain-gossip-relay.service << EOF -[Unit] -Description=AITBC Blockchain Gossip Relay -After=network.target - -[Service] -Type=exec -User=root -WorkingDirectory=/opt/blockchain-node -Environment=PATH=/opt/blockchain-node/.venv/bin:/usr/local/bin:/usr/bin:/bin -Environment=PYTHONPATH=/opt/blockchain-node/src:/opt/blockchain-node/scripts -ExecStart=/opt/blockchain-node/.venv/bin/python3 -m aitbc_chain.gossip.relay --port 7070 --host 0.0.0.0 -Restart=always -RestartSec=5 - -[Install] -WantedBy=multi-user.target -EOF - -# Enable and start gossip relay -print_status "Starting gossip relay..." -sudo systemctl daemon-reload -sudo systemctl enable blockchain-gossip-relay -sudo systemctl start blockchain-gossip-relay - -# Wait for relay to start -sleep 2 - -# Check if relay is running -print_status "Checking gossip relay status..." -sudo systemctl status blockchain-gossip-relay --no-pager | head -10 - -# Restart blockchain nodes -print_status "Restarting blockchain nodes with shared gossip..." -sudo systemctl start blockchain-node blockchain-node-2 blockchain-rpc blockchain-rpc-2 - -# Wait for nodes to start -sleep 3 - -# Check status -print_status "Checking node status..." -sudo systemctl status blockchain-node blockchain-node-2 --no-pager | grep -E 'Active:|Main PID:' - -echo "" -print_status "✅ Gossip relay setup complete!" -echo "" -echo "Nodes are now connected via shared gossip backend." -echo "They should sync blocks and transactions." -echo "" -echo "To verify connectivity:" -echo " 1. Run: python /opt/test_blockchain_simple.py" -echo " 2. Check if heights are converging" -echo "" -echo "Gossip relay logs: sudo journalctl -u blockchain-gossip-relay -f" diff --git a/scripts/deploy/test-deployment.sh b/scripts/deploy/test-deployment.sh deleted file mode 100755 index 193db99e..00000000 --- a/scripts/deploy/test-deployment.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# Test if blockchain node and explorer are running - -echo "🔍 Testing Blockchain Deployment" -echo "===============================" - -# Test blockchain RPC -echo "Testing blockchain RPC..." -if curl -s http://aitbc.keisanki.net:8082/rpc/head > /dev/null; then - echo "✅ Blockchain RPC is accessible" - curl -s http://aitbc.keisanki.net:8082/rpc/head | jq '.height' -else - echo "❌ Blockchain RPC is not accessible" -fi - -# Test explorer -echo "" -echo "Testing blockchain explorer..." -if curl -s http://aitbc.keisanki.net:3000 > /dev/null; then - echo "✅ Explorer is accessible" -else - echo "❌ Explorer is not accessible" -fi - -# Check services on server -echo "" -echo "Checking service status on ns3..." -ssh ns3-root "systemctl is-active blockchain-node blockchain-rpc nginx" | while read service status; do - if [ "$status" = "active" ]; then - echo "✅ $service is running" - else - echo "❌ $service is not running" - fi -done - -# Check logs if needed -echo "" -echo "Recent blockchain logs:" -ssh ns3-root "journalctl -u blockchain-node -n 5 --no-pager" diff --git a/scripts/gpu/deploy_gpu_all_in_one.sh b/scripts/gpu/deploy_gpu_all_in_one.sh deleted file mode 100644 index f37ca58c..00000000 --- a/scripts/gpu/deploy_gpu_all_in_one.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -# Deploy GPU Miner to AITBC Container - All in One - -set -e - -echo "🚀 Deploying GPU Miner to AITBC Container..." - -# Step 1: Copy files -echo "1. Copying GPU scripts..." -scp -o StrictHostKeyChecking=no /home/oib/windsurf/aitbc/gpu_registry_demo.py aitbc:/home/oib/ -scp -o StrictHostKeyChecking=no /home/oib/windsurf/aitbc/gpu_miner_with_wait.py aitbc:/home/oib/ - -# Step 2: Install Python and deps -echo "2. Installing Python and dependencies..." -ssh aitbc 'sudo apt-get update -qq' -ssh aitbc 'sudo apt-get install -y -qq python3 python3-venv python3-pip' -ssh aitbc 'python3 -m venv /home/oib/.venv-gpu' -ssh aitbc '/home/oib/.venv-gpu/bin/pip install -q fastapi uvicorn httpx psutil' - -# Step 3: Create GPU registry service -echo "3. Creating GPU registry service..." -ssh aitbc "sudo tee /etc/systemd/system/aitbc-gpu-registry.service >/dev/null <<'EOF' -[Unit] -Description=AITBC GPU Registry -After=network.target - -[Service] -Type=simple -User=oib -WorkingDirectory=/home/oib -ExecStart=/home/oib/.venv-gpu/bin/python /home/oib/gpu_registry_demo.py -Restart=always -RestartSec=5 -StandardOutput=journal -StandardError=journal - -[Install] -WantedBy=multi-user.target -EOF" - -# Step 4: Start GPU registry -echo "4. Starting GPU registry..." -ssh aitbc 'sudo systemctl daemon-reload' -ssh aitbc 'sudo systemctl enable --now aitbc-gpu-registry.service' - -# Step 5: Create GPU miner service -echo "5. Creating GPU miner service..." -ssh aitbc "sudo tee /etc/systemd/system/aitbc-gpu-miner.service >/dev/null <<'EOF' -[Unit] -Description=AITBC GPU Miner Client -After=network.target aitbc-gpu-registry.service -Wants=aitbc-gpu-registry.service - -[Service] -Type=simple -User=oib -WorkingDirectory=/home/oib -ExecStart=/home/oib/.venv-gpu/bin/python /home/oib/gpu_miner_with_wait.py -Restart=always -RestartSec=10 -StandardOutput=journal -StandardError=journal - -[Install] -WantedBy=multi-user.target -EOF" - -# Step 6: Start GPU miner -echo "6. Starting GPU miner..." -ssh aitbc 'sudo systemctl daemon-reload' -ssh aitbc 'sudo systemctl enable --now aitbc-gpu-miner.service' - -# Step 7: Check services -echo "7. Checking services..." -echo -e "\n=== GPU Registry Service ===" -ssh aitbc 'sudo systemctl status aitbc-gpu-registry.service --no-pager' - -echo -e "\n=== GPU Miner Service ===" -ssh aitbc 'sudo systemctl status aitbc-gpu-miner.service --no-pager' - -# Step 8: Verify GPU registration -echo -e "\n8. Verifying GPU registration..." -sleep 3 -echo " curl http://10.1.223.93:8091/miners/list" -curl -s http://10.1.223.93:8091/miners/list | python3 -c "import sys,json; data=json.load(sys.stdin); print(f'✅ Found {len(data.get(\"gpus\", []))} GPU(s)'); [print(f' - {gpu[\"capabilities\"][\"gpu\"][\"model\"]} ({gpu[\"capabilities\"][\"gpu\"][\"memory_gb\"]}GB)') for gpu in data.get('gpus', [])]" - -echo -e "\n✅ Deployment complete!" -echo "GPU Registry: http://10.1.223.93:8091" -echo "GPU Miner: Running and sending heartbeats" diff --git a/scripts/gpu/deploy_gpu_container.sh b/scripts/gpu/deploy_gpu_container.sh deleted file mode 100644 index b2eeeee6..00000000 --- a/scripts/gpu/deploy_gpu_container.sh +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash -# Deploy GPU Miner to AITBC Container - -echo "🚀 Deploying GPU Miner to AITBC Container..." - -# Check if container is accessible -echo "1. Checking container access..." -sudo incus exec aitbc -- whoami - -# Copy GPU miner files -echo "2. Copying GPU miner files..." -sudo incus file push /home/oib/windsurf/aitbc/gpu_miner_with_wait.py aitbc/home/oib/ -sudo incus file push /home/oib/windsurf/aitbc/gpu_registry_demo.py aitbc/home/oib/ - -# Install dependencies -echo "3. Installing dependencies..." -sudo incus exec aitbc -- pip install httpx fastapi uvicorn psutil - -# Create GPU miner service -echo "4. Creating GPU miner service..." -cat << 'EOF' | sudo tee /tmp/gpu-miner.service -[Unit] -Description=AITBC GPU Miner Client -After=network.target - -[Service] -Type=simple -User=oib -WorkingDirectory=/home/oib -ExecStart=/usr/bin/python3 gpu_miner_with_wait.py -Restart=always -RestartSec=30 -StandardOutput=journal -StandardError=journal - -[Install] -WantedBy=multi-user.target -EOF - -sudo incus file push /tmp/gpu-miner.service aitbc/tmp/ -sudo incus exec aitbc -- sudo mv /tmp/gpu-miner.service /etc/systemd/system/ -sudo incus exec aitbc -- sudo systemctl daemon-reload -sudo incus exec aitbc -- sudo systemctl enable gpu-miner.service -sudo incus exec aitbc -- sudo systemctl start gpu-miner.service - -# Create GPU registry service -echo "5. Creating GPU registry service..." -cat << 'EOF' | sudo tee /tmp/gpu-registry.service -[Unit] -Description=AITBC GPU Registry -After=network.target - -[Service] -Type=simple -User=oib -WorkingDirectory=/home/oib -ExecStart=/usr/bin/python3 gpu_registry_demo.py -Restart=always -RestartSec=10 -StandardOutput=journal -StandardError=journal - -[Install] -WantedBy=multi-user.target -EOF - -sudo incus file push /tmp/gpu-registry.service aitbc/tmp/ -sudo incus exec aitbc -- sudo mv /tmp/gpu-registry.service /etc/systemd/system/ -sudo incus exec aitbc -- sudo systemctl daemon-reload -sudo incus exec aitbc -- sudo systemctl enable gpu-registry.service -sudo incus exec aitbc -- sudo systemctl start gpu-registry.service - -# Check services -echo "6. Checking services..." -echo "GPU Miner Service:" -sudo incus exec aitbc -- sudo systemctl status gpu-miner.service --no-pager - -echo -e "\nGPU Registry Service:" -sudo incus exec aitbc -- sudo systemctl status gpu-registry.service --no-pager - -# Show access URLs -echo -e "\n✅ Deployment complete!" -echo "Access URLs:" -echo " - Container IP: 10.1.223.93" -echo " - GPU Registry: http://10.1.223.93:8091/miners/list" -echo " - Coordinator API: http://10.1.223.93:8000" - -echo -e "\nTo check GPU status:" -echo " curl http://10.1.223.93:8091/miners/list" diff --git a/scripts/gpu/gpu_exchange_status.py b/scripts/gpu/gpu_exchange_status.py deleted file mode 100644 index 73d50b81..00000000 --- a/scripts/gpu/gpu_exchange_status.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python3 -""" -GPU Exchange Integration Demo -Shows how the GPU miner is integrated with the exchange -""" - -import json -import httpx -import subprocess -import time -from datetime import datetime - -print("🔗 AITBC GPU Exchange Integration") -print("=" * 50) - -# Check GPU Registry -print("\n1. 📊 Checking GPU Registry...") -try: - response = httpx.get("http://localhost:8091/miners/list") - if response.status_code == 200: - data = response.json() - gpus = data.get("gpus", []) - print(f" Found {len(gpus)} registered GPU(s)") - - for gpu in gpus: - print(f"\n 🎮 GPU Details:") - print(f" Model: {gpu['capabilities']['gpu']['model']}") - print(f" Memory: {gpu['capabilities']['gpu']['memory_gb']} GB") - print(f" CUDA: {gpu['capabilities']['gpu']['cuda_version']}") - print(f" Status: {gpu.get('status', 'Unknown')}") - print(f" Region: {gpu.get('region', 'Unknown')}") - else: - print(" ❌ GPU Registry not accessible") -except Exception as e: - print(f" ❌ Error: {e}") - -# Check Exchange -print("\n2. 💰 Checking Trade Exchange...") -try: - response = httpx.get("http://localhost:3002") - if response.status_code == 200: - print(" ✅ Trade Exchange is running") - print(" 🌐 URL: http://localhost:3002") - else: - print(" ❌ Trade Exchange not responding") -except: - print(" ❌ Trade Exchange not accessible") - -# Check Blockchain -print("\n3. ⛓️ Checking Blockchain Node...") -try: - response = httpx.get("http://localhost:9080/rpc/head") - if response.status_code == 200: - data = response.json() - print(f" ✅ Blockchain Node active") - print(f" Block Height: {data.get('height', 'Unknown')}") - print(f" Block Hash: {data.get('hash', 'Unknown')[:16]}...") - else: - print(" ❌ Blockchain Node not responding") -except: - print(" ❌ Blockchain Node not accessible") - -# Show Integration Points -print("\n4. 🔌 Integration Points:") -print(" • GPU Registry: http://localhost:8091/miners/list") -print(" • Trade Exchange: http://localhost:3002") -print(" • Blockchain RPC: http://localhost:9080") -print(" • GPU Marketplace: Exchange > Browse GPU Marketplace") - -# Show API Usage -print("\n5. 📡 API Usage Examples:") -print("\n Get registered GPUs:") -print(" curl http://localhost:8091/miners/list") -print("\n Get GPU details:") -print(" curl http://localhost:8091/miners/localhost-gpu-miner") -print("\n Get blockchain info:") -print(" curl http://localhost:9080/rpc/head") - -# Show Current Status -print("\n6. 📈 Current System Status:") -print(" ✅ GPU Miner: Running (systemd)") -print(" ✅ GPU Registry: Running on port 8091") -print(" ✅ Trade Exchange: Running on port 3002") -print(" ✅ Blockchain Node: Running on port 9080") - -print("\n" + "=" * 50) -print("🎯 GPU is successfully integrated with the exchange!") -print("\nNext steps:") -print("1. Open http://localhost:3002 in your browser") -print("2. Click 'Browse GPU Marketplace'") -print("3. View the registered RTX 4060 Ti GPU") -print("4. Purchase GPU compute time with AITBC tokens") diff --git a/scripts/gpu/gpu_miner_host.py b/scripts/gpu/gpu_miner_host.py deleted file mode 100644 index 0664d1a2..00000000 --- a/scripts/gpu/gpu_miner_host.py +++ /dev/null @@ -1,396 +0,0 @@ -#!/usr/bin/env python3 -""" -Real GPU Miner Client for AITBC - runs on host with actual GPU -""" - -import json -import time -import httpx -import logging -import sys -import subprocess -import os -from datetime import datetime - -# Configuration -COORDINATOR_URL = "http://127.0.0.1:18000" -MINER_ID = "${MINER_API_KEY}" -AUTH_TOKEN = "${MINER_API_KEY}" -HEARTBEAT_INTERVAL = 15 -MAX_RETRIES = 10 -RETRY_DELAY = 30 - -# Setup logging with explicit configuration -LOG_PATH = "/home/oib/windsurf/aitbc/logs/host_gpu_miner.log" -os.makedirs(os.path.dirname(LOG_PATH), exist_ok=True) - -class FlushHandler(logging.StreamHandler): - def emit(self, record): - super().emit(record) - self.flush() - -logging.basicConfig( - level=logging.INFO, - format='%(asctime)s - %(levelname)s - %(message)s', - handlers=[ - FlushHandler(sys.stdout), - logging.FileHandler(LOG_PATH) - ] -) -logger = logging.getLogger(__name__) - -# Force stdout to be unbuffered -sys.stdout.reconfigure(line_buffering=True) -sys.stderr.reconfigure(line_buffering=True) - -# GPU capabilities (RTX 4060 Ti) -GPU_CAPABILITIES = { - "gpu": { - "model": "NVIDIA GeForce RTX 4060 Ti", - "memory_gb": 16, - "cuda_version": "12.4", - "platform": "CUDA", - "supported_tasks": ["inference", "training", "stable-diffusion", "llama"], - "max_concurrent_jobs": 1 - } -} - -def get_gpu_info(): - """Get real GPU information""" - try: - result = subprocess.run(['nvidia-smi', '--query-gpu=name,memory.total,memory.used,utilization.gpu', - '--format=csv,noheader,nounits'], - capture_output=True, text=True, timeout=5) - if result.returncode == 0: - info = result.stdout.strip().split(', ') - return { - "name": info[0], - "memory_total": int(info[1]), - "memory_used": int(info[2]), - "utilization": int(info[3]) - } - except Exception as e: - logger.error(f"Failed to get GPU info: {e}") - return None - -def check_ollama(): - """Check if Ollama is running and has models""" - try: - response = httpx.get("http://localhost:11434/api/tags", timeout=5) - if response.status_code == 200: - models = response.json().get('models', []) - model_names = [m['name'] for m in models] - logger.info(f"Ollama running with models: {model_names}") - return True, model_names - else: - logger.error("Ollama not responding") - return False, [] - except Exception as e: - logger.error(f"Ollama check failed: {e}") - return False, [] - -def wait_for_coordinator(): - """Wait for coordinator to be available""" - for i in range(MAX_RETRIES): - try: - response = httpx.get(f"{COORDINATOR_URL}/v1/health", timeout=5) - if response.status_code == 200: - logger.info("Coordinator is available!") - return True - except: - pass - - logger.info(f"Waiting for coordinator... ({i+1}/{MAX_RETRIES})") - time.sleep(RETRY_DELAY) - - logger.error("Coordinator not available after max retries") - return False - -def register_miner(): - """Register the miner with the coordinator""" - register_data = { - "capabilities": GPU_CAPABILITIES, - "concurrency": 1, - "region": "localhost" - } - - headers = { - "X-Api-Key": AUTH_TOKEN, - "Content-Type": "application/json" - } - - try: - response = httpx.post( - f"{COORDINATOR_URL}/v1/miners/register?miner_id={MINER_ID}", - json=register_data, - headers=headers, - timeout=10 - ) - - if response.status_code == 200: - data = response.json() - logger.info(f"Successfully registered miner: {data}") - return data.get("session_token", "demo-token") - else: - logger.error(f"Registration failed: {response.status_code} - {response.text}") - return None - - except Exception as e: - logger.error(f"Registration error: {e}") - return None - -def send_heartbeat(): - """Send heartbeat to coordinator with real GPU stats""" - gpu_info = get_gpu_info() - - if gpu_info: - heartbeat_data = { - "status": "active", - "current_jobs": 0, - "last_seen": datetime.utcnow().isoformat(), - "gpu_utilization": gpu_info["utilization"], - "memory_used": gpu_info["memory_used"], - "memory_total": gpu_info["memory_total"] - } - else: - heartbeat_data = { - "status": "active", - "current_jobs": 0, - "last_seen": datetime.utcnow().isoformat(), - "gpu_utilization": 0, - "memory_used": 0, - } - - headers = { - "X-Api-Key": AUTH_TOKEN, - "Content-Type": "application/json" - } - - try: - response = httpx.post( - f"{COORDINATOR_URL}/v1/miners/heartbeat?miner_id={MINER_ID}", - json=heartbeat_data, - headers=headers, - timeout=5 - ) - - if response.status_code == 200: - logger.info(f"Heartbeat sent (GPU: {gpu_info['utilization'] if gpu_info else 'N/A'}%)") - else: - logger.error(f"Heartbeat failed: {response.status_code} - {response.text}") - - except Exception as e: - logger.error(f"Heartbeat error: {e}") - -def execute_job(job, available_models): - """Execute a job using real GPU resources""" - job_id = job.get('job_id') - payload = job.get('payload', {}) - - logger.info(f"Executing job {job_id}: {payload}") - - try: - if payload.get('type') == 'inference': - # Get the prompt and model - prompt = payload.get('prompt', '') - model = payload.get('model', 'llama3.2:latest') - - # Check if model is available - if model not in available_models: - # Use first available model - if available_models: - model = available_models[0] - logger.info(f"Using available model: {model}") - else: - raise Exception("No models available in Ollama") - - # Call Ollama API for real GPU inference - logger.info(f"Running inference on GPU with model: {model}") - start_time = time.time() - - ollama_response = httpx.post( - "http://localhost:11434/api/generate", - json={ - "model": model, - "prompt": prompt, - "stream": False - }, - timeout=60 - ) - - if ollama_response.status_code == 200: - result = ollama_response.json() - output = result.get('response', '') - execution_time = time.time() - start_time - - # Get GPU stats after execution - gpu_after = get_gpu_info() - - # Submit result back to coordinator - submit_result(job_id, { - "result": { - "status": "completed", - "output": output, - "model": model, - "tokens_processed": result.get('eval_count', 0), - "execution_time": execution_time, - "gpu_used": True - }, - "metrics": { - "gpu_utilization": gpu_after["utilization"] if gpu_after else 0, - "memory_used": gpu_after["memory_used"] if gpu_after else 0, - "memory_peak": max(gpu_after["memory_used"] if gpu_after else 0, 2048) - } - }) - - logger.info(f"Job {job_id} completed in {execution_time:.2f}s") - return True - else: - logger.error(f"Ollama error: {ollama_response.status_code}") - submit_result(job_id, { - "result": { - "status": "failed", - "error": f"Ollama error: {ollama_response.text}" - } - }) - return False - else: - # Unsupported job type - logger.error(f"Unsupported job type: {payload.get('type')}") - submit_result(job_id, { - "result": { - "status": "failed", - "error": f"Unsupported job type: {payload.get('type')}" - } - }) - return False - - except Exception as e: - logger.error(f"Job execution error: {e}") - submit_result(job_id, { - "result": { - "status": "failed", - "error": str(e) - } - }) - return False - -def submit_result(job_id, result): - """Submit job result to coordinator""" - headers = { - "X-Api-Key": AUTH_TOKEN, - "Content-Type": "application/json" - } - - try: - response = httpx.post( - f"{COORDINATOR_URL}/v1/miners/{job_id}/result", - json=result, - headers=headers, - timeout=10 - ) - - if response.status_code == 200: - logger.info(f"Result submitted for job {job_id}") - else: - logger.error(f"Result submission failed: {response.status_code} - {response.text}") - - except Exception as e: - logger.error(f"Result submission error: {e}") - -def poll_for_jobs(): - """Poll for available jobs""" - poll_data = { - "max_wait_seconds": 5 - } - - headers = { - "X-Api-Key": AUTH_TOKEN, - "Content-Type": "application/json" - } - - try: - response = httpx.post( - f"{COORDINATOR_URL}/v1/miners/poll", - json=poll_data, - headers=headers, - timeout=10 - ) - - if response.status_code == 200: - job = response.json() - logger.info(f"Received job: {job}") - return job - elif response.status_code == 204: - return None - else: - logger.error(f"Poll failed: {response.status_code} - {response.text}") - return None - - except Exception as e: - logger.error(f"Error polling for jobs: {e}") - return None - -def main(): - """Main miner loop""" - logger.info("Starting Real GPU Miner Client on Host...") - - # Check GPU availability - gpu_info = get_gpu_info() - if not gpu_info: - logger.error("GPU not available, exiting") - sys.exit(1) - - logger.info(f"GPU detected: {gpu_info['name']} ({gpu_info['memory_total']}MB)") - - # Check Ollama - ollama_available, models = check_ollama() - if not ollama_available: - logger.error("Ollama not available - please install and start Ollama") - sys.exit(1) - - logger.info(f"Ollama models available: {', '.join(models)}") - - # Wait for coordinator - if not wait_for_coordinator(): - sys.exit(1) - - # Register with coordinator - session_token = register_miner() - if not session_token: - logger.error("Failed to register, exiting") - sys.exit(1) - - logger.info("Miner registered successfully, starting main loop...") - - # Main loop - last_heartbeat = 0 - last_poll = 0 - - try: - while True: - current_time = time.time() - - # Send heartbeat - if current_time - last_heartbeat >= HEARTBEAT_INTERVAL: - send_heartbeat() - last_heartbeat = current_time - - # Poll for jobs - if current_time - last_poll >= 3: - job = poll_for_jobs() - if job: - # Execute the job with real GPU - execute_job(job, models) - last_poll = current_time - - time.sleep(1) - - except KeyboardInterrupt: - logger.info("Shutting down miner...") - except Exception as e: - logger.error(f"Error in main loop: {e}") - sys.exit(1) - -if __name__ == "__main__": - main() diff --git a/scripts/gpu/gpu_miner_host_wrapper.sh b/scripts/gpu/gpu_miner_host_wrapper.sh deleted file mode 100755 index f5195fd2..00000000 --- a/scripts/gpu/gpu_miner_host_wrapper.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -# Wrapper script for GPU miner to ensure proper logging -exec /home/oib/windsurf/aitbc/.venv/bin/python -u /home/oib/windsurf/aitbc/scripts/gpu/gpu_miner_host.py 2>&1 diff --git a/scripts/gpu/gpu_registry_demo.py b/scripts/gpu/gpu_registry_demo.py deleted file mode 100644 index ff6a135f..00000000 --- a/scripts/gpu/gpu_registry_demo.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python3 -""" -Simple GPU Registry Server for demonstration -""" - -from fastapi import FastAPI, HTTPException -from pydantic import BaseModel -from typing import Dict, Any, Optional -import uvicorn -from datetime import datetime - -app = FastAPI(title="GPU Registry Demo") - -# In-memory storage -registered_gpus: Dict[str, Dict] = {} - -class GPURegistration(BaseModel): - capabilities: Dict[str, Any] - concurrency: int = 1 - region: Optional[str] = None - -class Heartbeat(BaseModel): - inflight: int = 0 - status: str = "ONLINE" - metadata: Dict[str, Any] = {} - -@app.get("/") -async def root(): - return {"message": "GPU Registry Demo", "registered_gpus": len(registered_gpus)} - -@app.get("/health") -async def health(): - return {"status": "ok"} - -@app.post("/miners/register") -async def register_gpu(miner_id: str, gpu_data: GPURegistration): - """Register a GPU miner""" - registered_gpus[miner_id] = { - "id": miner_id, - "registered_at": datetime.utcnow().isoformat(), - "last_heartbeat": datetime.utcnow().isoformat(), - **gpu_data.dict() - } - return {"status": "ok", "message": f"GPU {miner_id} registered successfully"} - -@app.post("/miners/heartbeat") -async def heartbeat(miner_id: str, heartbeat_data: Heartbeat): - """Receive heartbeat from GPU miner""" - if miner_id not in registered_gpus: - raise HTTPException(status_code=404, detail="GPU not registered") - - registered_gpus[miner_id]["last_heartbeat"] = datetime.utcnow().isoformat() - registered_gpus[miner_id]["status"] = heartbeat_data.status - registered_gpus[miner_id]["metadata"] = heartbeat_data.metadata - - return {"status": "ok"} - -@app.get("/miners/list") -async def list_gpus(): - """List all registered GPUs""" - return {"gpus": list(registered_gpus.values())} - -@app.get("/miners/{miner_id}") -async def get_gpu(miner_id: str): - """Get details of a specific GPU""" - if miner_id not in registered_gpus: - raise HTTPException(status_code=404, detail="GPU not registered") - return registered_gpus[miner_id] - -if __name__ == "__main__": - print("Starting GPU Registry Demo on http://localhost:8091") - uvicorn.run(app, host="0.0.0.0", port=8091) diff --git a/scripts/gpu/integrate_gpu_exchange.py b/scripts/gpu/integrate_gpu_exchange.py deleted file mode 100644 index b4cae637..00000000 --- a/scripts/gpu/integrate_gpu_exchange.py +++ /dev/null @@ -1,146 +0,0 @@ -#!/usr/bin/env python3 -""" -Integrate GPU Miner with existing Trade Exchange -""" - -import httpx -import json -import subprocess -import time -from datetime import datetime - -# Configuration -EXCHANGE_URL = "http://localhost:3002" -GPU_REGISTRY_URL = "http://localhost:8091" - -def update_exchange_with_gpu(): - """Update the exchange frontend to show registered GPUs""" - - # Read the exchange HTML - with open('/home/oib/windsurf/aitbc/apps/trade-exchange/index.html', 'r') as f: - html_content = f.read() - - # Add GPU marketplace integration - gpu_integration = """ - - """ - - # Insert before closing body tag - if '' in html_content: - html_content = html_content.replace('', gpu_integration + '') - - # Write back to file - with open('/home/oib/windsurf/aitbc/apps/trade-exchange/index.html', 'w') as f: - f.write(html_content) - - print("✅ Updated exchange with GPU integration!") - else: - print("❌ Could not find tag in exchange HTML") - -def create_gpu_api_endpoint(): - """Create an API endpoint in the exchange to serve GPU data""" - - api_code = """ -@app.get("/api/gpu/offers") -async def get_gpu_offers(): - \"\"\"Get available GPU offers\"\"\" - try: - # Fetch from GPU registry - response = httpx.get("http://localhost:8091/miners/list") - if response.status_code == 200: - data = response.json() - return {"offers": data.get("gpus", [])} - except: - pass - - # Return demo data if registry not available - return { - "offers": [{ - "id": "demo-gpu-1", - "model": "NVIDIA RTX 4060 Ti", - "memory_gb": 16, - "price_per_hour": 50, - "available": True - }] - } -""" - - print("\n📝 To add GPU API endpoint to exchange, add this code to simple_exchange_api.py:") - print(api_code) - -def main(): - print("🔗 Integrating GPU Miner with Trade Exchange...") - - # Update exchange frontend - update_exchange_with_gpu() - - # Show API integration code - create_gpu_api_endpoint() - - print("\n📊 Integration Summary:") - print("1. ✅ Exchange frontend updated to show real GPUs") - print("2. 📝 See above for API endpoint code") - print("3. 🌐 Access the exchange at: http://localhost:3002") - print("4. 🎯 GPU Registry available at: http://localhost:8091/miners/list") - - print("\n🔄 To see the integrated GPU marketplace:") - print("1. Restart the trade exchange if needed:") - print(" cd /home/oib/windsurf/aitbc/apps/trade-exchange") - print(" python simple_exchange_api.py") - print("2. Open http://localhost:3002 in browser") - print("3. Click 'Browse GPU Marketplace'") - -if __name__ == "__main__": - main() diff --git a/scripts/gpu/start_gpu_miner.sh b/scripts/gpu/start_gpu_miner.sh deleted file mode 100755 index 7a634b0b..00000000 --- a/scripts/gpu/start_gpu_miner.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# Start GPU Miner Client - -echo "=== AITBC GPU Miner Client Startup ===" -echo "Starting GPU miner client..." -echo "" - -# Check if GPU is available -if ! command -v nvidia-smi &> /dev/null; then - echo "WARNING: nvidia-smi not found, GPU may not be available" -fi - -# Show GPU info -if command -v nvidia-smi &> /dev/null; then - echo "=== GPU Status ===" - nvidia-smi --query-gpu=name,memory.used,memory.total,utilization.gpu,temperature.gpu --format=csv,noheader,nounits - echo "" -fi - -# Check if coordinator is running -echo "=== Checking Coordinator API ===" -if curl -s http://localhost:8000/health > /dev/null 2>&1; then - echo "✓ Coordinator API is running on port 8000" -else - echo "✗ Coordinator API is not accessible on port 8000" - echo " The miner will wait for the coordinator to start..." -fi - -echo "" -echo "=== Starting GPU Miner ===" -cd /home/oib/windsurf/aitbc -python3 gpu_miner_with_wait.py diff --git a/scripts/gpu/start_gpu_miner.sh.example b/scripts/gpu/start_gpu_miner.sh.example new file mode 100644 index 00000000..d5e0d229 --- /dev/null +++ b/scripts/gpu/start_gpu_miner.sh.example @@ -0,0 +1,52 @@ +#!/bin/bash + +# AITBC GPU Miner Startup Script +# Copy to start_gpu_miner.sh and adjust variables for your environment + +set -e + +# === CONFIGURE THESE === +COORDINATOR_URL="http://YOUR_COORDINATOR_IP:18000" +MINER_API_KEY="your_miner_api_key" +OLLAMA_HOST="http://127.0.0.1:11434" +GPU_ID="gpu-0" + +echo "🔧 Starting AITBC GPU Miner" +echo "Coordinator: $COORDINATOR_URL" +echo "Ollama: $OLLAMA_HOST" +echo "" + +# Check Ollama is running +if ! curl -s "$OLLAMA_HOST/api/tags" > /dev/null 2>&1; then + echo "❌ Ollama not running at $OLLAMA_HOST" + echo "Start it with: ollama serve" + exit 1 +fi + +echo "✅ Ollama is running" + +# Check GPU +if command -v nvidia-smi &> /dev/null; then + echo "GPU detected:" + nvidia-smi --query-gpu=name,memory.total --format=csv,noheader +else + echo "⚠️ No NVIDIA GPU detected (CPU-only mode)" +fi + +# Register miner +echo "" +echo "Registering miner with coordinator..." +curl -s -X POST "$COORDINATOR_URL/v1/miners/register" \ + -H "X-Api-Key: $MINER_API_KEY" \ + -H "Content-Type: application/json" \ + -d "{\"gpu_id\": \"$GPU_ID\", \"ollama_url\": \"$OLLAMA_HOST\"}" + +echo "" +echo "✅ Miner registered. Starting heartbeat loop..." + +# Heartbeat + job polling loop +while true; do + curl -s -X POST "$COORDINATOR_URL/v1/miners/heartbeat" \ + -H "X-Api-Key: $MINER_API_KEY" > /dev/null 2>&1 + sleep 10 +done diff --git a/scripts/service/check-container.sh b/scripts/service/check-container.sh deleted file mode 100755 index 50aac502..00000000 --- a/scripts/service/check-container.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/bash - -# Check what's running in the aitbc container - -echo "🔍 Checking AITBC Container Status" -echo "=================================" - -# First, let's see if we can access the container -if ! groups | grep -q incus; then - echo "❌ You're not in the incus group!" - echo "Run: sudo usermod -aG incus \$USER" - echo "Then log out and log back in" - exit 1 -fi - -echo "📋 Container Info:" -incus list | grep aitbc - -echo "" -echo "🔧 Services in container:" -incus exec aitbc -- ps aux | grep -E "(uvicorn|python)" | grep -v grep || echo "No services running" - -echo "" -echo "🌐 Ports listening in container:" -incus exec aitbc -- ss -tlnp | grep -E "(8000|9080|3001|3002)" || echo "No ports listening" - -echo "" -echo "📁 Nginx status:" -incus exec aitbc -- systemctl status nginx --no-pager -l | head -20 - -echo "" -echo "🔍 Nginx config test:" -incus exec aitbc -- nginx -t - -echo "" -echo "📝 Nginx sites enabled:" -incus exec aitbc -- ls -la /etc/nginx/sites-enabled/ - -echo "" -echo "🚀 Starting services if needed..." - -# Start the services -incus exec aitbc -- bash -c " -cd /home/oib/aitbc -pkill -f uvicorn 2>/dev/null || true -pkill -f server.py 2>/dev/null || true - -# Start blockchain node -cd apps/blockchain-node -source ../../.venv/bin/activate -python -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 9080 & - -# Start coordinator API -cd ../coordinator-api -source ../../.venv/bin/activate -python -m uvicorn src.app.main:app --host 0.0.0.0 --port 8000 & - -# Start marketplace UI -cd ../marketplace-ui -python server.py --port 3001 & - -# Start trade exchange -cd ../trade-exchange -python server.py --port 3002 & - -sleep 3 -echo 'Services started!' -" - -echo "" -echo "✅ Done! Check services:" -echo "incus exec aitbc -- ps aux | grep uvicorn" diff --git a/scripts/service/diagnose-services.sh b/scripts/service/diagnose-services.sh deleted file mode 100755 index 66a6bd66..00000000 --- a/scripts/service/diagnose-services.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash - -# Diagnose AITBC services - -echo "🔍 Diagnosing AITBC Services" -echo "==========================" -echo "" - -# Check local services -echo "📋 Local Services:" -echo "Port 8000 (Coordinator API):" -lsof -i :8000 2>/dev/null || echo " ❌ Not running" - -echo "Port 9080 (Blockchain Node):" -lsof -i :9080 2>/dev/null || echo " ❌ Not running" - -echo "Port 3001 (Marketplace UI):" -lsof -i :3001 2>/dev/null || echo " ❌ Not running" - -echo "Port 3002 (Trade Exchange):" -lsof -i :3002 2>/dev/null || echo " ❌ Not running" - -echo "" -echo "🌐 Testing Endpoints:" - -# Test local endpoints -echo "Local API Health:" -curl -s http://127.0.0.1:8000/v1/health 2>/dev/null && echo " ✅ OK" || echo " ❌ Failed" - -echo "Local Blockchain:" -curl -s http://127.0.0.1:9080/rpc/head 2>/dev/null | head -c 50 && echo "..." || echo " ❌ Failed" - -echo "Local Admin:" -curl -s http://127.0.0.1:8000/v1/admin/stats 2>/dev/null | head -c 50 && echo "..." || echo " ❌ Failed" - -echo "" -echo "🌐 Remote Endpoints (via domain):" -echo "Domain API Health:" -curl -s https://aitbc.bubuit.net/health 2>/dev/null && echo " ✅ OK" || echo " ❌ Failed" - -echo "Domain Admin:" -curl -s https://aitbc.bubuit.net/admin/stats 2>/dev/null | head -c 50 && echo "..." || echo " ❌ Failed" - -echo "" -echo "🔧 Fixing common issues..." - -# Stop any conflicting services -echo "Stopping local services..." -sudo fuser -k 8000/tcp 2>/dev/null || true -sudo fuser -k 9080/tcp 2>/dev/null || true -sudo fuser -k 3001/tcp 2>/dev/null || true -sudo fuser -k 3002/tcp 2>/dev/null || true - -echo "" -echo "📝 Instructions:" -echo "1. Make sure you're in the incus group: sudo usermod -aG incus \$USER" -echo "2. Log out and log back in" -echo "3. Run: incus exec aitbc -- bash" -echo "4. Inside container, run: /home/oib/start_aitbc.sh" -echo "5. Check services: ps aux | grep uvicorn" -echo "" -echo "If services are running in container but not accessible:" -echo "1. Check port forwarding to 10.1.223.93" -echo "2. Check nginx config in container" -echo "3. Check firewall rules" diff --git a/scripts/service/fix-services.sh b/scripts/service/fix-services.sh deleted file mode 100755 index 397d69eb..00000000 --- a/scripts/service/fix-services.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/bash - -# Quick fix to start AITBC services in container - -echo "🔧 Starting AITBC Services in Container" -echo "=====================================" - -# First, let's manually start the services -echo "1. Starting Coordinator API..." -cd /home/oib/windsurf/aitbc/apps/coordinator-api -source ../../.venv/bin/activate 2>/dev/null || source .venv/bin/activate -python -m uvicorn src.app.main:app --host 0.0.0.0 --port 8000 & -COORD_PID=$! - -echo "2. Starting Blockchain Node..." -cd ../blockchain-node -python -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 9080 & -NODE_PID=$! - -echo "3. Starting Marketplace UI..." -cd ../marketplace-ui -python server.py --port 3001 & -MARKET_PID=$! - -echo "4. Starting Trade Exchange..." -cd ../trade-exchange -python server.py --port 3002 & -EXCHANGE_PID=$! - -echo "" -echo "✅ Services started!" -echo "Coordinator API: http://127.0.0.1:8000" -echo "Blockchain: http://127.0.0.1:9080" -echo "Marketplace: http://127.0.0.1:3001" -echo "Exchange: http://127.0.0.1:3002" -echo "" -echo "PIDs:" -echo "Coordinator: $COORD_PID" -echo "Blockchain: $NODE_PID" -echo "Marketplace: $MARKET_PID" -echo "Exchange: $EXCHANGE_PID" -echo "" -echo "To stop: kill $COORD_PID $NODE_PID $MARKET_PID $EXCHANGE_PID" - -# Wait a bit for services to start -sleep 3 - -# Test endpoints -echo "" -echo "🧪 Testing endpoints:" -echo "API Health:" -curl -s http://127.0.0.1:8000/v1/health | head -c 100 - -echo -e "\n\nAdmin Stats:" -curl -s http://127.0.0.1:8000/v1/admin/stats -H "X-Api-Key: ${ADMIN_API_KEY}" | head -c 100 - -echo -e "\n\nMarketplace Offers:" -curl -s http://127.0.0.1:8000/v1/marketplace/offers | head -c 100 diff --git a/scripts/service/run-local-services.sh b/scripts/service/run-local-services.sh deleted file mode 100755 index 48b6ad82..00000000 --- a/scripts/service/run-local-services.sh +++ /dev/null @@ -1,129 +0,0 @@ -#!/bin/bash - -# Run AITBC services locally for domain access - -set -e - -echo "🚀 Starting AITBC Services for Domain Access" -echo "==========================================" - -# Kill any existing services -echo "Cleaning up existing services..." -sudo fuser -k 8000/tcp 2>/dev/null || true -sudo fuser -k 9080/tcp 2>/dev/null || true -sudo fuser -k 3001/tcp 2>/dev/null || true -sudo fuser -k 3002/tcp 2>/dev/null || true -pkill -f "uvicorn.*aitbc" 2>/dev/null || true -pkill -f "server.py" 2>/dev/null || true - -# Wait for ports to be free -sleep 2 - -# Create logs directory -mkdir -p logs - -echo "" -echo "📦 Starting Services..." - -# Start Coordinator API -echo "1. Starting Coordinator API (port 8000)..." -cd apps/coordinator-api -source ../.venv/bin/activate 2>/dev/null || python -m venv ../.venv && source ../.venv/bin/activate -pip install -q -e . 2>/dev/null || true -nohup python -m uvicorn src.app.main:app --host 0.0.0.0 --port 8000 > ../../logs/api.log 2>&1 & -API_PID=$! -echo " PID: $API_PID" - -# Start Blockchain Node -echo "2. Starting Blockchain Node (port 9080)..." -cd ../blockchain-node -nohup python -m uvicorn aitbc_chain.app:app --host 0.0.0.0 --port 9080 > ../../logs/blockchain.log 2>&1 & -NODE_PID=$! -echo " PID: $NODE_PID" - -# Start Marketplace UI -echo "3. Starting Marketplace UI (port 3001)..." -cd ../marketplace-ui -nohup python server.py --port 3001 > ../../logs/marketplace.log 2>&1 & -MARKET_PID=$! -echo " PID: $MARKET_PID" - -# Start Trade Exchange -echo "4. Starting Trade Exchange (port 3002)..." -cd ../trade-exchange -nohup python server.py --port 3002 > ../../logs/exchange.log 2>&1 & -EXCHANGE_PID=$! -echo " PID: $EXCHANGE_PID" - -# Save PIDs for cleanup -echo "$API_PID $NODE_PID $MARKET_PID $EXCHANGE_PID" > ../.service_pids - -cd .. - -# Wait for services to start -echo "" -echo "⏳ Waiting for services to initialize..." -sleep 5 - -# Test services -echo "" -echo "🧪 Testing Services..." - -echo -n "API Health: " -if curl -s http://127.0.0.1:8000/v1/health > /dev/null; then - echo "✅ OK" -else - echo "❌ Failed" -fi - -echo -n "Admin API: " -if curl -s http://127.0.0.1:8000/v1/admin/stats -H "X-Api-Key: ${ADMIN_API_KEY}" > /dev/null; then - echo "✅ OK" -else - echo "❌ Failed" -fi - -echo -n "Blockchain: " -if curl -s http://127.0.0.1:9080/rpc/head > /dev/null; then - echo "✅ OK" -else - echo "❌ Failed" -fi - -echo -n "Marketplace: " -if curl -s http://127.0.0.1:3001 > /dev/null; then - echo "✅ OK" -else - echo "❌ Failed" -fi - -echo -n "Exchange: " -if curl -s http://127.0.0.1:3002 > /dev/null; then - echo "✅ OK" -else - echo "❌ Failed" -fi - -echo "" -echo "✅ All services started!" -echo "" -echo "📋 Local URLs:" -echo " API: http://127.0.0.1:8000/v1" -echo " RPC: http://127.0.0.1:9080/rpc" -echo " Marketplace: http://127.0.0.1:3001" -echo " Exchange: http://127.0.0.1:3002" -echo "" -echo "🌐 Domain URLs (if nginx is configured):" -echo " API: https://aitbc.bubuit.net/api" -echo " Admin: https://aitbc.bubuit.net/admin" -echo " RPC: https://aitbc.bubuit.net/rpc" -echo " Marketplace: https://aitbc.bubuit.net/Marketplace" -echo " Exchange: https://aitbc.bubuit.net/Exchange" -echo "" -echo "📝 Logs: ./logs/" -echo "🛑 Stop services: ./stop-services.sh" -echo "" -echo "Press Ctrl+C to stop monitoring (services will keep running)" - -# Monitor logs -tail -f logs/*.log diff --git a/scripts/service/setup-production-assets.sh b/scripts/service/setup-production-assets.sh deleted file mode 100644 index d010312d..00000000 --- a/scripts/service/setup-production-assets.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash - -# Download production assets locally -echo "Setting up production assets..." - -# Create assets directory -mkdir -p /home/oib/windsurf/aitbc/assets/{css,js,icons} - -# Download Tailwind CSS (production build) -echo "Downloading Tailwind CSS..." -curl -L https://unpkg.com/tailwindcss@3.4.0/lib/tailwind.js -o /home/oib/windsurf/aitbc/assets/js/tailwind.js - -# Download Axios -echo "Downloading Axios..." -curl -L https://unpkg.com/axios@1.6.2/dist/axios.min.js -o /home/oib/windsurf/aitbc/assets/js/axios.min.js - -# Download Lucide icons -echo "Downloading Lucide..." -curl -L https://unpkg.com/lucide@latest/dist/umd/lucide.js -o /home/oib/windsurf/aitbc/assets/js/lucide.js - -# Create a custom Tailwind build with only used classes -cat > /home/oib/windsurf/aitbc/assets/tailwind.config.js << 'EOF' -module.exports = { - content: [ - "./apps/trade-exchange/index.html", - "./apps/marketplace-ui/index.html" - ], - darkMode: 'class', - theme: { - extend: {}, - }, - plugins: [], -} -EOF - -echo "Assets downloaded to /home/oib/windsurf/aitbc/assets/" -echo "Update your HTML files to use local paths:" -echo " - /assets/js/tailwind.js" -echo " - /assets/js/axios.min.js" -echo " - /assets/js/lucide.js" diff --git a/scripts/service/start_dashboard.sh b/scripts/service/start_dashboard.sh deleted file mode 100644 index 1a287f50..00000000 --- a/scripts/service/start_dashboard.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash - -echo "=== Starting AITBC Miner Dashboard ===" -echo "" - -# Find available port -PORT=8080 -while [ $PORT -le 8090 ]; do - if ! netstat -tuln 2>/dev/null | grep -q ":$PORT "; then - echo "✓ Found available port: $PORT" - break - fi - echo "Port $port is in use, trying next..." - PORT=$((PORT + 1)) -done - -if [ $PORT -gt 8090 ]; then - echo "❌ No available ports found between 8080-8090" - exit 1 -fi - -# Start the dashboard -echo "Starting dashboard on port $PORT..." -nohup python3 -m http.server $PORT --bind 0.0.0.0 > dashboard.log 2>&1 & -PID=$! - -echo "" -echo "✅ Dashboard is running!" -echo "" -echo "Access URLs:" -echo " Local: http://localhost:$PORT" -echo " Network: http://$(hostname -I | awk '{print $1}'):$PORT" -echo "" -echo "Dashboard file: miner-dashboard.html" -echo "Process ID: $PID" -echo "Log file: dashboard.log" -echo "" -echo "To stop: kill $PID" -echo "To view logs: tail -f dashboard.log" diff --git a/scripts/service/stop-services.sh b/scripts/service/stop-services.sh deleted file mode 100755 index 16470455..00000000 --- a/scripts/service/stop-services.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# Stop all AITBC services - -echo "🛑 Stopping AITBC Services" -echo "========================" - -# Stop by PID if file exists -if [ -f .service_pids ]; then - PIDS=$(cat .service_pids) - echo "Found PIDs: $PIDS" - for PID in $PIDS; do - if kill -0 $PID 2>/dev/null; then - echo "Stopping PID $PID..." - kill $PID - fi - done - rm -f .service_pids -fi - -# Force kill any remaining services -echo "Cleaning up any remaining processes..." -sudo fuser -k 8000/tcp 2>/dev/null || true -sudo fuser -k 9080/tcp 2>/dev/null || true -sudo fuser -k 3001/tcp 2>/dev/null || true -sudo fuser -k 3002/tcp 2>/dev/null || true -pkill -f "uvicorn.*aitbc" 2>/dev/null || true -pkill -f "server.py" 2>/dev/null || true - -echo "✅ All services stopped!" diff --git a/website/404.html b/website/404.html index 7768e74a..74735f81 100644 --- a/website/404.html +++ b/website/404.html @@ -229,7 +229,7 @@ diff --git a/website/README.md b/website/README.md deleted file mode 100644 index f0a6d754..00000000 --- a/website/README.md +++ /dev/null @@ -1,37 +0,0 @@ -# AITBC Website - -This folder contains the complete AITBC platform website, updated to reflect the current production-ready state. - -## Files Structure - -- `index.html` - Main homepage with platform components and achievements -- `docs/` - Documentation folder (moved to container docs directory) - - `docs-index.html` - Documentation landing page - - `docs-miners.html` - Miner-specific documentation - - `docs-clients.html` - Client-specific documentation - - `docs-developers.html` - Developer-specific documentation -- `documentation.html` - Legacy full documentation page -- `full-documentation.html` - Comprehensive technical documentation -- `404.html` - Custom error page -- `aitbc-proxy.conf` - Nginx reverse proxy configuration - -## Deployment - -The website is deployed in the AITBC Incus container at: -- Container IP: 10.1.223.93 -- Domain: aitbc.bubuit.net -- Documentation: aitbc.bubuit.net/docs/ - -## Key Updates Made - -1. **Production-Ready Messaging**: Changed from concept to actual platform state -2. **Platform Components**: Showcases 7 live components (Blockchain Node, Coordinator API, Marketplace, Explorer, Wallet, Pool Hub, GPU Services) -3. **Achievements Section**: Real metrics (30+ GPU services, Stages 1-7 complete) -4. **Updated Roadmap**: Reflects current development progress -5. **Documentation Structure**: Split by audience (Miners, Clients, Developers) - -## Next Steps - -- Configure SSL certificate for HTTPS -- Set up DNS for full domain accessibility -- Consider adding live network statistics dashboard diff --git a/website/README.md.example b/website/README.md.example new file mode 100644 index 00000000..11febe3a --- /dev/null +++ b/website/README.md.example @@ -0,0 +1,54 @@ +# AITBC Website + +Production website for the AITBC platform. + +## File Structure + +``` +website/ +├── index.html # Homepage — platform overview & achievements +├── 404.html # Custom error page +├── aitbc-proxy.conf # Nginx reverse proxy configuration +├── favicon.svg +├── font-awesome-local.css +├── docs/ # All documentation (16 pages) +│ ├── index.html # Docs landing — search, reader-level cards +│ ├── clients.html # Client guide — jobs, wallet, pricing, API +│ ├── miners.html # Miner guide — GPU setup, earnings, Ollama +│ ├── developers.html # Developer guide — SDKs, contributing, bounties +│ ├── full-documentation.html # Complete technical reference +│ ├── components.html # Architecture & components overview +│ ├── flowchart.html # End-to-end system flow diagram +│ ├── api.html # REST API reference +│ ├── blockchain-node.html +│ ├── coordinator-api.html +│ ├── explorer-web.html +│ ├── marketplace-web.html +│ ├── wallet-daemon.html +│ ├── trade-exchange.html +│ ├── pool-hub.html +│ ├── browser-wallet.html # Redirect → /wallet/ +│ ├── css/docs.css # Shared stylesheet +│ └── js/theme.js # Dark/light theme toggle +└── wallet/ + └── index.html # Browser wallet landing page +``` + +## Deployment + +Copy the website files to your web server's document root: + +```bash +# Example using scp (replace with your server details) +scp -r website/* your-server:/var/www/html/ +``` + +## Key Features + +- **Unified header/nav** across all 15 doc pages with theme toggle +- **Live search** on docs index (client-side, 15-page index) +- **Shared CSS** — zero inline ` - - - -
- -
- - -
-
-
- For Clients -

Use AITBC for AI/ML Workloads

-

Access secure, private, and verifiable AI/ML computation on the decentralized network

-
- - -
-
-
- -
-

Privacy First

-

Your data and models remain confidential with zero-knowledge proofs and secure enclaves

-
-
-
- -
-

Verifiable Results

-

Every computation is cryptographically verified on the blockchain for trust and transparency

-
-
-
- -
-

Fast & Efficient

-

Access thousands of GPUs worldwide with sub-second response times

-
-
- - -
-

Getting Started

-

Start using AITBC in minutes with our simple client SDK or web interface.

- -

Quick Start Options

-
    -
  • Web Interface: No installation required
  • -
  • Python SDK: For AI/ML developers
  • -
  • JavaScript SDK: For web applications
  • -
  • REST API: For any platform
  • -
  • CLI Tool: For power users
  • -
- -

Web Interface (Fastest)

-
-
1
-
-

Visit the Marketplace

-

Go to aitbc.bubuit.net/marketplace

-
-
- -
-
2
-
-

Connect Your Wallet

-

Connect MetaMask or create a new AITBC wallet

-
-
- -
-
3
-
-

Submit Your Job

-

Upload your data or model, select parameters, and submit

-
-
- -
-
4
-
-

Get Results

-

Receive verified results with cryptographic proof

-
-
-
- - -
-

Popular Use Cases

- -
-
-

AI Inference

-

Run inference on pre-trained models including GPT, Stable Diffusion, and custom models

-
    -
  • Text generation
  • -
  • Image generation
  • -
  • Audio processing
  • -
  • Video analysis
  • -
-
- -
-

Model Training

-

Train and fine-tune models on your data with privacy guarantees

-
    -
  • Fine-tuning LLMs
  • -
  • Custom model training
  • -
  • Federated learning
  • -
  • Transfer learning
  • -
-
- -
-

Data Analysis

-

Process large datasets with confidential computing

-
    -
  • Statistical analysis
  • -
  • Pattern recognition
  • -
  • Predictive modeling
  • -
  • Data visualization
  • -
-
- -
-

Secure Computation

-

Run sensitive computations with end-to-end encryption

-
    -
  • Financial modeling
  • -
  • Healthcare analytics
  • -
  • Legal document processing
  • -
  • Proprietary algorithms
  • -
-
-
-
- - -
-

SDK Examples

- -

Python SDK

-
-# Install the SDK -pip install aitbc - -# Initialize client -from aitbc import AITBCClient - -client = AITBCClient(api_key="your-api-key") - -# Run inference -result = client.inference( - model="gpt-4", - prompt="Explain quantum computing", - max_tokens=500, - temperature=0.7 -) - -print(result.text) - -# Verify the receipt -is_valid = client.verify_receipt(result.receipt_id) -print(f"Verified: {is_valid}") - -

JavaScript SDK

-
-// Install the SDK -npm install @aitbc/client - -// Initialize client -import { AITBCClient } from '@aitbc/client'; - -const client = new AITBCClient({ - apiKey: 'your-api-key', - network: 'mainnet' -}); - -// Run inference -const result = await client.inference({ - model: 'stable-diffusion', - prompt: 'A futuristic city', - steps: 50, - cfg_scale: 7.5 -}); - -// Download the image -await client.downloadImage(result.imageId, './output.png'); - -// Verify computation -const verified = await client.verify(result.receiptId); -console.log('Computation verified:', verified); - -

REST API

-
-# Submit a job -curl -X POST https://api.aitbc.io/v1/jobs \ - -H "Authorization: Bearer YOUR_TOKEN" \ - -H "Content-Type: application/json" \ - -d '{ - "type": "inference", - "model": "gpt-4", - "input": { - "prompt": "Hello, AITBC!", - "max_tokens": 100 - }, - "privacy": { - "confidential": true, - "zk_proof": true - } - }' - -# Check job status -curl -X GET https://api.aitbc.io/v1/jobs/JOB_ID \ - -H "Authorization: Bearer YOUR_TOKEN" -
- - -
-

Pricing

-

Flexible pricing options for every use case

- -
-
-

Pay-per-use

-
$0.01/1K tokens
-
    -
  • No minimum commitment
  • -
  • Pay only for what you use
  • -
  • All models available
  • -
  • Basic support
  • -
- -
- - - -
-

Enterprise

-
Custom
-
    -
  • Unlimited usage
  • -
  • Dedicated resources
  • -
  • Custom models
  • -
  • 24/7 support
  • -
  • SLA guarantee
  • -
- -
-
-
- - -
-

Privacy & Security

- -
- Your data is never stored or exposed - All computations are performed in secure enclaves with zero-knowledge proof verification. -
- -

Privacy Features

-
    -
  • End-to-end encryption - Your data is encrypted before leaving your device
  • -
  • Zero-knowledge proofs - Prove computation without revealing inputs
  • -
  • Secure enclaves - Computations run in isolated, verified environments
  • -
  • No data retention - Providers cannot access or store your data
  • -
  • Audit trails - Full transparency on blockchain
  • -
- -

Compliance

-
    -
  • GDPR compliant
  • -
  • SOC 2 Type II certified
  • -
  • HIPAA eligible
  • -
  • ISO 27001 certified
  • -
-
- - -
-

Best Practices

- -

Optimizing Performance

-
    -
  • Use appropriate model sizes for your task
  • -
  • Batch requests when possible
  • -
  • Enable caching for repeated queries
  • -
  • Choose the right privacy level for your needs
  • -
  • Monitor your usage and costs
  • -
- -

Security Tips

-
    -
  • Keep your API keys secure
  • -
  • Use environment variables for credentials
  • -
  • Enable two-factor authentication
  • -
  • Regularly rotate your keys
  • -
  • Use VPN for additional privacy
  • -
- -

Cost Optimization

-
    -
  • Start with smaller models for testing
  • -
  • Use streaming for long responses
  • -
  • Set appropriate limits and timeouts
  • -
  • Monitor token usage
  • -
  • Consider subscription plans for regular use
  • -
-
- - -
-

Support & Resources

- -

Getting Help

- - -

Tutorials

- - -

Examples

- -
- - -
-

Frequently Asked Questions

- -
- Question not answered? Contact us at support@aitbc.io -
- -

General

-
    -
  • How do I get started? - Sign up for an account, connect your wallet, and submit your first job through the web interface or API.
  • -
  • What models are available? - We support GPT-3.5/4, Claude, Llama, Stable Diffusion, and many custom models.
  • -
  • Can I use my own model? - Yes, you can upload and run private models with full confidentiality.
  • -
- -

Privacy

-
    -
  • Is my data private? - Absolutely. Your data is encrypted and never exposed to providers.
  • -
  • How do ZK proofs work? - They prove computation was done correctly without revealing inputs.
  • -
  • Can you see my prompts? - No, prompts are encrypted and processed in secure enclaves.
  • -
- -

Technical

-
    -
  • What's the response time? - Most jobs complete in 1-5 seconds depending on complexity.
  • -
  • Do you support streaming? - Yes, streaming is available for real-time applications.
  • -
  • Can I run batch jobs? - Yes, batch processing is supported for large workloads.
  • -
- -

Billing

-
    -
  • How am I billed? - Pay-per-use or monthly subscription options available.
  • -
  • Can I set spending limits? - Yes, you can set daily/monthly limits in your dashboard.
  • -
  • Do you offer refunds? - Yes, we offer refunds for service issues within 30 days.
  • -
-
-
-
- - -
-
-

© 2025 AITBC. All rights reserved.

-
-
- - diff --git a/website/docs-developers.html b/website/docs-developers.html deleted file mode 100644 index f28d34ff..00000000 --- a/website/docs-developers.html +++ /dev/null @@ -1,839 +0,0 @@ - - - - - - Developer Documentation - AITBC - - - - - -
- -
- - -
-
-
- For Developers -

Build on AITBC

-

Join our developer community and help build the future of decentralized AI

-
- - -
-

Technology Stack

-

AITBC is built with modern technologies focused on performance and security.

- -
-
-
- -
-
Rust
-
-
-
- -
-
Go
-
-
-
- -
-
Python
-
-
-
- -
-
TypeScript
-
-
-
- -
-
React
-
-
-
- -
-
PostgreSQL
-
-
-
- -
-
Docker
-
-
-
- -
-
Kubernetes
-
-
-
- - -
-

Getting Started

-

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

- -

Development Environment Setup

-
-
1
-
-

Fork & Clone

-
-# Fork the repository on GitHub -git clone https://github.com/YOUR_USERNAME/AITBC.git -cd aitbc - -# Add upstream remote -git remote add upstream https://github.com/oib/AITBC.git -
-
- -
-
2
-
-

Install Dependencies

-
-# Install development dependencies -./scripts/install-dev-deps.sh - -# Setup pre-commit hooks -pre-commit install -
-
- -
-
3
-
-

Build & Run

-
-# Build all components -make build - -# Start development environment -make dev-up - -# Run tests -make test -
-
- -
-
4
-
-

Create Your Branch

-
-# Create feature branch -git checkout -b feature/your-feature-name - -# Make your changes... -# Commit with proper message -git commit -m "feat: add your feature description" -
-
- -
-
5
-
-

Submit PR

-
-# Push to your fork -git push origin feature/your-feature-name - -# Create pull request on Gitea -# Fill PR template and submit -
-
-
- - -
-

Contribution Areas

-

There are many ways to contribute to AITBC. Find the area that matches your skills!

- -
-
-

Core Protocol

-
    -
  • Consensus mechanism improvements
  • -
  • Cryptographic implementations
  • -
  • Performance optimizations
  • -
  • Security enhancements
  • -
  • Sharding implementations
  • -
-

Skills: Rust, Go, Cryptography, Distributed Systems

-
- -
-

AI/ML Integration

-
    -
  • Model optimization
  • -
  • ZK proof generation
  • -
  • Secure enclaves
  • -
  • Privacy-preserving ML
  • -
  • Autonomous agents
  • -
-

Skills: Python, TensorFlow, PyTorch, ZK-SNARKs

-
- -
-

Developer Tools

-
    -
  • SDK development
  • -
  • CLI tools
  • -
  • Testing frameworks
  • -
  • Documentation
  • -
  • IDE plugins
  • -
-

Skills: TypeScript, Python, Go, Documentation

-
- -
-

Frontend & UI

-
    -
  • Marketplace interface
  • -
  • Wallet UI
  • -
  • Developer dashboard
  • -
  • Mobile apps
  • -
  • Design system
  • -
-

Skills: React, TypeScript, CSS, Design

-
- -
-

Security

-
    -
  • Security audits
  • -
  • Penetration testing
  • -
  • Bug bounty
  • -
  • Security tools
  • -
  • Threat modeling
  • -
-

Skills: Security, Auditing, Cryptography

-
- -
-

Documentation

-
    -
  • Technical guides
  • -
  • Tutorials
  • -
  • API docs
  • -
  • Blog posts
  • -
  • Translations
  • -
-

Skills: Writing, Technical Communication

-
-
-
- - -
-

Development Guidelines

- -

Code Standards

-
    -
  • Follow language-specific style guides (rustfmt, gofmt, PEP8)
  • -
  • Write comprehensive tests for new features
  • -
  • Document all public APIs and complex logic
  • -
  • Keep pull requests focused and small
  • -
  • Use clear and descriptive commit messages
  • -
- -

Testing Requirements

-
-# Run all tests -make test - -# Run with coverage -make test-coverage - -# Run integration tests -make test-integration - -# Run benchmarks -make benchmark - -

Code Review Process

-
    -
  • All changes require review
  • -
  • At least one approval needed
  • -
  • CI must pass
  • -
  • Documentation updated
  • -
  • Tests added/updated
  • -
- -
- Pro Tip: Join our Discord #dev channel for real-time help and discussions! -
-
- - -
-

Bounties & Grants

-

Get paid to contribute to AITBC!

- -

Open Bounties

-
    -
  • $500 - Implement REST API rate limiting
  • -
  • $750 - Add Python async SDK support
  • -
  • $1000 - Optimize ZK proof generation
  • -
  • $1500 - Implement cross-chain bridge
  • -
  • $2000 - Build mobile wallet app
  • -
- -

Research Grants

-
    -
  • $5000 - Novel consensus mechanisms
  • -
  • $7500 - Privacy-preserving ML
  • -
  • $10000 - Quantum-resistant cryptography
  • -
- -

How to Apply

-
    -
  1. Check open issues on Gitea
  2. -
  3. Comment on the issue you want to work on
  4. -
  5. Submit your solution
  6. -
  7. Get reviewed by core team
  8. -
  9. Receive payment in AITBC tokens
  10. -
- -
- New Contributor Bonus: First-time contributors get a 20% bonus on their first bounty! -
-
- - -
-

Join the Community

- -

Developer Channels

-
    -
  • Discord #dev - General development discussion
  • -
  • Discord #core-dev - Core protocol discussions
  • -
  • Discord #bounties - Bounty program updates
  • -
  • Discord #research - Research discussions
  • -
- -

Events & Programs

-
    -
  • Weekly Dev Calls - Every Tuesday 14:00 UTC
  • -
  • Hackathons - Quarterly with prizes
  • -
  • Office Hours - Meet the core team
  • -
  • Mentorship Program - Learn from experienced devs
  • -
- - -
    -
  • Top contributors featured on website
  • -
  • Monthly contributor rewards
  • -
  • Special Discord roles
  • -
  • Annual developer summit invitation
  • -
  • Swag and merchandise
  • -
-
- - -
-

Developer Resources

- -

Documentation

- - -

Tools & SDKs

- - -

Development Environment

- - -

Learning Resources

- -
- - -
-

Example: Adding a New API Endpoint

- -
-// File: coordinator-api/internal/handler/new_endpoint.go - -package handler - -import ( - "net/http" - "github.com/gin-gonic/gin" -) - -// NewEndpoint handles new feature requests -func (h *Handler) NewEndpoint(c *gin.Context) { - var req NewEndpointRequest - if err := c.ShouldBindJSON(&req); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) - return - } - - // Validate request - if err := req.Validate(); err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": err.Error()}) - return - } - - // Process request - result, err := h.service.ProcessNewEndpoint(req) - if err != nil { - c.JSON(http.StatusInternalServerError, gin.H{"error": err.Error()}) - return - } - - c.JSON(http.StatusOK, result) -} - -

Test Your Changes

-
-// File: coordinator-api/internal/handler/new_endpoint_test.go - -package handler - -import ( - "encoding/json" - "net/http" - "net/http/httptest" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestNewEndpoint(t *testing.T) { - // Setup - h := setupTestHandler(t) - - // Test request - req := NewEndpointRequest{ - Field1: "test", - Field2: 123, - } - - // Create HTTP request - body, _ := json.Marshal(req) - w := httptest.NewRecorder() - r := httptest.NewRequest("POST", "/api/v1/new-endpoint", bytes.NewReader(body)) - - // Execute - h.NewEndpoint(w, r) - - // Assert - require.Equal(t, http.StatusOK, w.Code) - - var response NewEndpointResponse - err := json.Unmarshal(w.Body.Bytes(), &response) - require.NoError(t, err) - - assert.Equal(t, "expected_value", response.Result) -} -
- - -
-

Frequently Asked Questions

- -

General

-
    -
  • How do I start contributing? - Check our "Getting Started" guide and pick an issue that interests you.
  • -
  • Do I need to sign anything? - Yes, you'll need to sign our CLA (Contributor License Agreement).
  • -
  • Can I be paid for contributions? - Yes! Check our bounty program or apply for grants.
  • -
- -

Technical

-
    -
  • What's the tech stack? - Rust for blockchain, Go for services, Python for AI, TypeScript for frontend.
  • -
  • How do I run tests? - Use `make test` or check specific component documentation.
  • -
  • Where can I ask questions? - Discord #dev channel is the best place.
  • -
- -

Process

-
    -
  • How long does PR review take? - Usually 1-3 business days.
  • -
  • Can I work on multiple issues? - Yes, but keep PRs focused on single features.
  • -
  • What if my PR is rejected? - We'll provide feedback and guidance for resubmission.
  • -
-
-
-
- - -
-
-

© 2025 AITBC. All rights reserved.

-
-
- - diff --git a/website/docs-index.html b/website/docs-index.html deleted file mode 100644 index 17f9278f..00000000 --- a/website/docs-index.html +++ /dev/null @@ -1,585 +0,0 @@ - - - - - - Documentation - AITBC - - - - - -
- -
- - -
-
-
-

Documentation

-

Choose your reader level to access tailored documentation for your needs

-
- - -
- - -
- - -
- -
-
- -
-

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 -
- - -
-
- -
-

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 -
- - -
-
- -
-

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 -
- - -
-
- -
-

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!

- -
-
-
- - -
-
-

© 2025 AITBC. All rights reserved.

-
-
- - - - diff --git a/website/docs-miners.html b/website/docs-miners.html deleted file mode 100644 index d1193b06..00000000 --- a/website/docs-miners.html +++ /dev/null @@ -1,727 +0,0 @@ - - - - - - Miner Documentation - AITBC - - - - - -
- -
- - -
-
-
- For Miners -

Start Mining AITBC

-

Complete guide to becoming a successful AITBC miner and earning rewards

-
- - -
-
-
15-25%
-
Annual ROI
-
-
-
1000 AITBC
-
Minimum Stake
-
-
-
24/7
-
Mining Rewards
-
-
-
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: Provide compute power for AI/ML workloads
  • -
  • Hybrid Mining: Combine staking with compute provision
  • -
- -

Quick Start

-
-
1
-
-

Download & Install

-

Get the AITBC mining software for your platform

-
-# Linux/macOS -curl -O https://releases.aitbc.io/aitbc-miner-v1.0.0.tar.gz -tar -xzf aitbc-miner-v1.0.0.tar.gz -cd aitbc-miner - -# Windows -# Download from https://releases.aitbc.io/windows -
-
- -
-
2
-
-

Configure Your Node

-

Set up your mining configuration

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

Stake Tokens

-

Lock your AITBC tokens to start earning

-
-# Stake 1000 AITBC -./aitbc-miner stake 1000 --wallet YOUR_WALLET_ADDRESS -
-
- -
-
4
-
-

Start Mining

-

Launch your mining node

-
-# Start mining -./aitbc-miner start --mode stake -
-
-
- - -
-

Hardware Requirements

- -
-
-

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)

-

NVIDIA RTX 3080+ or AMD RX 6800+

-
-
-

Security

-

HSM recommended for large stakes

-
-
- -
- Note: GPU mining requires additional setup but offers higher rewards through AI/ML workload processing. -
-
- - -
-

Profit Calculator

-
-
- - -
-
- - -
-
-
-
- - -
-
- - -
-
-
-
Estimated Monthly Earnings
-
$416.67
-
Estimated Annual Earnings
-
$5,000.00
-
-
- - -
-

Mining Strategies

- -

1. Pure Staking

-

The simplest approach - stake your tokens and earn passive income.

-
    -
  • Pros: Low maintenance, predictable returns
  • -
  • Cons: Lower rewards than active mining
  • -
  • Best for: Long-term holders, passive investors
  • -
- -

2. GPU Mining

-

Provide compute power for AI/ML workloads and earn additional rewards.

-
    -
  • Pros: Higher rewards, supports the network
  • -
  • Cons: Higher hardware costs, more maintenance
  • -
  • Best for: Technical users with GPU hardware
  • -
- -

3. Authority Mining

-

Apply to become a trusted authority node (invitation only).

-
    -
  • Pros: Highest rewards, network influence
  • -
  • Cons: High requirements, strict vetting
  • -
  • Best for: Established organizations, experienced miners
  • -
- -

4. Hybrid Approach

-

Combine staking with GPU mining for maximum returns.

-
    -
  • Pros: Diversified income streams
  • -
  • Cons: Complex setup, higher initial cost
  • -
  • Best for: Experienced miners seeking optimization
  • -
-
- - -
-

Security Best Practices

- -
- Important: Never share your private keys or wallet passwords with anyone! -
- -

Wallet Security

-
    -
  • Use a hardware wallet for large stakes
  • -
  • Enable two-factor authentication
  • -
  • Keep your wallet software updated
  • -
  • Backup your wallet securely (offline)
  • -
  • Use a dedicated mining wallet
  • -
- -

Node Security

-
    -
  • Keep your operating system updated
  • -
  • Use a firewall to restrict access
  • -
  • Monitor for unusual activity
  • -
  • Use VPN for additional privacy
  • -
  • Regular security audits
  • -
- -

Operational Security

-
    -
  • Diversify your stake across multiple nodes
  • -
  • Use automated monitoring and alerts
  • -
  • Have backup power and internet
  • -
  • Document your recovery procedures
  • -
  • Join the community for security updates
  • -
-
- - -
-

Troubleshooting

- -

Common Issues

-
-
Node won't start?
-
- Check your configuration file syntax and ensure all required ports are open. Use ./aitbc-miner check-config to validate your setup. -
-
- -
-
Low mining rewards?
-
- Ensure your node is online 24/7, check your stake amount, and verify you're running the latest version. Network conditions also affect rewards. -
-
- -
-
Sync issues?
-
- Try resyncing with ./aitbc-miner sync --reset. Check your internet connection and disk space. -
-
- -
-
GPU not detected?
-
- Install latest GPU drivers, verify CUDA/OpenCL support, and check ./aitbc-miner gpu check. -
-
- -

Getting Help

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

Frequently Asked Questions

- -
-
How much can I earn mining AITBC?
-
- Earnings vary based on stake amount, network participation, and whether you provide GPU compute. Typical APY ranges from 15-25% for staking, with GPU mining adding additional rewards. -
-
- -
-
When do I get paid?
-
- Rewards are distributed daily and automatically credited to your wallet. You can withdraw anytime after the initial lock period. -
-
- -
-
Can I run multiple nodes?
-
- Yes, you can run multiple nodes but each requires separate stakes. This can provide redundancy and potentially higher rewards. -
-
- -
-
What happens if my node goes offline?
-
- You won't earn rewards while offline, but your stake remains safe. Extended downtime may affect your reputation score. -
-
- -
-
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. -
-
-
-
-
- - -
-
-

© 2025 AITBC. All rights reserved.

-
-
- - - - diff --git a/website/docs/api.html b/website/docs/api.html index 47cd9fe5..9d13f9d9 100644 --- a/website/docs/api.html +++ b/website/docs/api.html @@ -5,183 +5,26 @@ API Documentation - AITBC - + -
- + +
@@ -328,12 +171,12 @@ -
+

Authentication

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

-
X-Api-Key: your_api_key_here
+
X-Api-Key: your_api_key_here
-

Getting API Keys

+

Getting API Keys

  • Clients: Register through the web interface or contact support
  • Miners: Generated upon registration
  • @@ -342,23 +185,23 @@
-
+

Base URL

All API endpoints are relative to the base URL:

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

For development:

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

WebSocket API

Real-time updates are available through WebSocket connections:

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

Subscribe to events:

-
{
+                
{
   "method": "subscribe",
   "params": ["job_updates", "miner_heartbeats"]
 }
@@ -368,8 +211,9 @@
-

© 2025 AITBC. All rights reserved.

+

© 2026 AITBC. All rights reserved.

+ diff --git a/website/docs/blockchain-node-md.html b/website/docs/blockchain-node-md.html deleted file mode 100644 index 0589ecdc..00000000 --- a/website/docs/blockchain-node-md.html +++ /dev/null @@ -1,488 +0,0 @@ - - - - - - Blockchain Node - AITBC Documentation - - - - -
- -
- -
-
- - - - - - - Back to Components - - - -
-

Blockchain Node

-

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

- ● Live -
- - -
-

Overview

-

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.

- -

Key Features

-
    -
  • Hybrid PoA/PoS consensus with sub-second finality
  • -
  • REST and WebSocket RPC APIs
  • -
  • Real-time gossip protocol for block propagation
  • -
  • Comprehensive observability with Prometheus metrics
  • -
  • SQLModel-based data persistence
  • -
  • Built-in devnet tooling and scripts
  • -
-
- - -
-

Architecture

-

The blockchain node is built with a modular architecture separating concerns for consensus, storage, networking, and API layers.

- -
-
-

Consensus Engine

-

Hybrid PoA/PoS with proposer rotation and validator sets

-
-
-

Storage Layer

-

SQLModel with SQLite/PostgreSQL support

-
-
-

Networking

-

WebSocket gossip + REST API

-
-
-

Observability

-

Prometheus metrics + structured logging

-
-
-
- - -
-

API Reference

-

The blockchain node exposes both REST and WebSocket APIs for interaction.

- -

REST Endpoints

-
- GET /rpc/get_head -

Get the latest block header

-
- -
- POST /rpc/send_tx -

Submit a new transaction

-
- -
- GET /rpc/get_balance/{address} -

Get account balance

-
- -
- GET /rpc/get_block/{height} -

Get block by height

-
- -

WebSocket Subscriptions

-
    -
  • new_blocks - Real-time block notifications
  • -
  • new_transactions - Transaction pool updates
  • -
  • consensus_events - Consensus round updates
  • -
-
- - -
-

Configuration

-

The node can be configured via environment variables or configuration file.

- -

Key Settings

-
# 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
-
- - -
-

Running a Node

- -

Development Mode

-
# Initialize devnet
-python -m blockchain.scripts.init_devnet
-
-# Start node
-python -m blockchain.main --config devnet.yaml
- -

Production Mode

-
# Using Docker
-docker run -d \
-  -v /data/blockchain:/data \
-  -p 9080:9080 \
-  -p 9081:9081 \
-  -p 9090:9090 \
-  aitbc/blockchain-node:latest
-
- - -
-

Monitoring

- -

Prometheus Metrics

-

Available at http://localhost:9090/metrics

- -

Key metrics:

-
    -
  • blockchain_blocks_total - Total blocks produced
  • -
  • blockchain_transactions_total - Total transactions processed
  • -
  • blockchain_consensus_rounds - Consensus rounds completed
  • -
  • blockchain_network_peers - Active peer connections
  • -
- -

Health Checks

-
# Node status
-curl http://localhost:9080/health
-
-# Sync status
-curl http://localhost:9080/sync_status
-
- - -
-

Troubleshooting

- -

Common Issues

-
    -
  1. Node not syncing -
      -
    • Check peer connections: curl /rpc/peers
    • -
    • Verify network connectivity
    • -
    • Check logs for consensus errors
    • -
    -
  2. -
  3. High memory usage -
      -
    • Reduce block_cache_size in config
    • -
    • Enable block pruning
    • -
    -
  4. -
  5. RPC timeouts -
      -
    • Increase rpc_timeout setting
    • -
    • Check system resources
    • -
    -
  6. -
-
- - -
-

Development

- -

Building from Source

-
git clone https://github.com/aitbc/blockchain
-cd blockchain
-pip install -e .
- -

Running Tests

-
# Unit tests
-pytest tests/
-
-# Integration tests
-pytest tests/integration/
-
- - -
-

Security Considerations

-
    -
  • Validator keys should be kept secure
  • -
  • Use HTTPS in production
  • -
  • Implement rate limiting on RPC endpoints
  • -
  • Regular security updates for dependencies
  • -
-
-
-
- -
-
-

© 2025 AITBC. All rights reserved.

-
-
- - diff --git a/website/docs/blockchain-node.html b/website/docs/blockchain-node.html index 589abbe8..5e09707e 100644 --- a/website/docs/blockchain-node.html +++ b/website/docs/blockchain-node.html @@ -5,272 +5,26 @@ Blockchain Node - AITBC Documentation - + -
- + @@ -280,7 +34,7 @@ @@ -450,5 +204,6 @@ python -m aitbc_chain.node
+ diff --git a/website/docs/browser-wallet.html b/website/docs/browser-wallet.html index a54f5f93..696415b4 100644 --- a/website/docs/browser-wallet.html +++ b/website/docs/browser-wallet.html @@ -1,417 +1,12 @@ - + - - - AITBC Browser Wallet - Secure Crypto Wallet - - - + + Redirecting to AITBC Wallet... + + - - -
- - -
-

AITBC Browser Wallet

-

- The most secure way to store, send, and receive AITBC tokens. - Connect to the AITBC Trade Exchange with just one click. -

- -
-
- - -
-
- -

Why Choose AITBC Wallet?

-
-
- -

Bank-Grade Security

-

- Your private keys never leave your device. - Encrypted locally with military-grade security. -

-
-
- -

Seamless dApp Integration

-

- Connect to any AITBC-powered dApp with a single click. - No more copying and pasting addresses. -

-
-
- -

Lightning Fast

-

- Built for performance. - Instant transactions and real-time balance updates. -

-
-
-
-
- - -
-
-

Install for Chrome / Edge / Brave

- -
-
-

- - Chrome Installation Steps -

- -
-
-
1
-
-

Download the Extension

-

- Download the AITBC Wallet extension files to your computer. -

- - - Download Chrome Extension - -
-
- -
-
2
-
-

Open Chrome Extensions

-

- Open Chrome and navigate to the extensions page: -

-
chrome://extensions/
-
-
- -
-
3
-
-

Enable Developer Mode

-

- Toggle the "Developer mode" switch in the top right corner. -

-
-
- -
-
4
-
-

Load Extension

-

- Click "Load unpacked" and select the aitbc-wallet folder. -

-
-
- -
-
5
-
-

Start Using!

-

- Click the AITBC Wallet icon in your toolbar to create or import an account. -

-
-
-
-
-
-
-
- - -
-
-

Install for Firefox

- -
-
-

- - Firefox Installation Steps -

- -
-
-
1
-
-

Visit Install Page

-

- Click the button below to go to the Firefox installation page. -

- - - Install Firefox Extension - -
-
- -
-
2
-
-

Click "Add to Firefox"

-

- On the install page, click the "Add to Firefox" button to install the extension. -

-
-
- -
-
3
-
-

Start Using!

-

- The AITBC Wallet will appear in your toolbar with an orange icon. Click to create your first account! -

-
-
-
-
-
-
-
- - -
-
-

Using Your AITBC Wallet

- -
-
-

- - Create a New Wallet -

-
    -
  1. 1. Click the AITBC Wallet icon
  2. -
  3. 2. Select "Create New Account"
  4. -
  5. 3. Securely save your private key
  6. -
  7. 4. Your wallet is ready!
  8. -
-
- -
-

- - Import Existing Wallet -

-
    -
  1. 1. Click the AITBC Wallet icon
  2. -
  3. 2. Select "Import Private Key"
  4. -
  5. 3. Enter your private key
  6. -
  7. 4. Access your restored wallet
  8. -
-
- -
-

- - Connect to Exchange -

-
    -
  1. 1. Visit AITBC Exchange
  2. -
  3. 2. Toggle to "Real Mode"
  4. -
  5. 3. Click "Connect AITBC Wallet"
  6. -
  7. 4. Approve the connection
  8. -
-
- -
-

- - Send & Receive Tokens -

-
    -
  1. 1. Click "Send" to transfer tokens
  2. -
  3. 2. Click "Receive" to get your address
  4. -
  5. 3. All transactions require confirmation
  6. -
  7. 4. View history in the wallet
  8. -
-
-
-
-
- - -
-
-

Security Best Practices

- -
-
-

- - Important Security Reminders -

- -
    -
  • - - Never share your private key - Anyone with your private key has full control of your funds -
  • -
  • - - Backup your private key - Write it down and store it in a secure, offline location -
  • -
  • - - Verify URLs - Always ensure you're on aitbc.bubuit.net before connecting -
  • -
  • - - Use a password manager - Protect your browser with a strong, unique password -
  • -
  • - - Keep updated - Regularly update your browser and the wallet extension -
  • -
-
-
-
-
- - -
-
-
-
-

AITBC Wallet

-

- The secure browser wallet for AITBC tokens -

-
-
-

Quick Links

- -
-
-

Support

-

- Need help? Check our documentation or create an issue on GitHub. -

-
-
-
-

© 2025 AITBC. All rights reserved.

-
-
-
- - + +

Redirecting to AITBC Browser Wallet

diff --git a/website/docs/client-documentation-md.html b/website/docs/client-documentation-md.html deleted file mode 100644 index d9984c18..00000000 --- a/website/docs/client-documentation-md.html +++ /dev/null @@ -1,586 +0,0 @@ - - - - - - Client Documentation - AITBC - - - - -
- -
- -
-
- - - - - - - Back to Documentation - - - -
-

Client Documentation

-

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

-
- - -
-

Getting Started

-

Start using AITBC in minutes with our simple client SDK or web interface.

- -

Quick Start Options

-
    -
  • CLI Wrapper Tool: Unified bash script for job management
  • -
  • Web Interface: No installation required
  • -
  • Python SDK: For AI/ML developers
  • -
  • JavaScript SDK: For web applications
  • -
  • REST API: For any platform
  • -
- -

CLI Wrapper Tool (Recommended)

-
# Install the CLI wrapper
-curl -O https://github.com/oib/AITBC/releases/download/latest/aitbc-cli.sh
-chmod +x aitbc-cli.sh
-
-# Check available services
-./aitbc-cli.sh status
-
-# Submit a job
-./aitbc-cli.sh submit "Your prompt here" --model llama3.2
- -

Web Interface

-

Visit the marketplace to access the web interface.

-
- - -
-

Python SDK

-

Install the Python SDK for easy integration into your applications:

- -
# Install
-pip install aitbc-client
-
-# Basic usage
-from aitbc import AITBCClient
-
-client = AITBCClient(api_key="your-api-key")
-
-# Submit a job
-job = client.submit_job(
-    type="inference",
-    model="llama3.2",
-    prompt="Explain quantum computing",
-    max_tokens=500
-)
-
-# Wait for completion
-result = client.wait_for_job(job.id)
-print(result.output)
- -

Advanced Features

-
    -
  • Async/await support
  • -
  • Batch job submission
  • -
  • Streaming responses
  • -
  • Zero-knowledge proof verification
  • -
-
- - -
-

JavaScript SDK

-

For web applications and Node.js:

- -
# Install
-npm install @aitbc/client
-
-# Usage
-import { AITBCClient } from '@aitbc/client';
-
-const client = new AITBCClient({
-  apiKey: 'your-api-key',
-  endpoint: 'https://aitbc.bubuit.net/api'
-});
-
-// Submit job
-const job = await client.submit({
-  type: 'inference',
-  model: 'llama3.2',
-  input: {
-    prompt: 'Hello, AITBC!',
-    max_tokens: 100
-  }
-});
-
-// Get result
-const result = await client.getResult(job.id);
-console.log(result.output);
-
- - -
-

REST API

-

Direct API access for any programming language:

- -
# Submit a job
-curl -X POST https://aitbc.bubuit.net/api/v1/jobs \
-  -H "Authorization: Bearer YOUR_TOKEN" \
-  -H "Content-Type: application/json" \
-  -d '{
-    "type": "inference",
-    "model": "gpt-4",
-    "input": {
-      "prompt": "Hello, AITBC!",
-      "max_tokens": 100
-    },
-    "privacy": {
-      "zk_proof": true
-    }
-  }'
-
-# Check job status
-curl -X GET https://aitbc.bubuit.net/api/v1/jobs/JOB_ID \
-  -H "Authorization: Bearer YOUR_TOKEN"
-
- - -
-

Pricing

-

Flexible pricing options for every use case

- -
-
-

Pay-per-use

-
$0.01/1K tokens
-
    -
  • No minimum commitment
  • -
  • Pay for what you use
  • -
  • All models available
  • -
-
-
-

Professional

-
$99/month
-
    -
  • 10M tokens included
  • -
  • Priority processing
  • -
  • SLA guarantee
  • -
-
-
-

Enterprise

-
Custom
-
    -
  • Unlimited tokens
  • -
  • Dedicated infrastructure
  • -
  • 24/7 support
  • -
-
-
-
- - -
-

Privacy & Security

-

Your data is protected with enterprise-grade security:

- -
-
-

Zero-Knowledge Proofs

-

Computation is verified without revealing your data

-
-
-

End-to-End Encryption

-

Your prompts and results are encrypted in transit and at rest

-
-
-

Verifiable Computation

-

Every result includes a cryptographic proof of correct execution

-
-
-

Privacy-Preserving

-

Optional privacy mode keeps your data completely confidential

-
-
-
- - -
-

Supported Models

-

Access a wide range of state-of-the-art AI models:

- -

Language Models

-
    -
  • LLaMA 3.2 (8B, 70B)
  • -
  • Mistral (7B, 8x7B)
  • -
  • DeepSeek (67B)
  • -
  • Code Llama (34B)
  • -
  • GPT-4 (via API)
  • -
- -

Image Models

-
    -
  • Stable Diffusion XL
  • -
  • DALL-E 3 (via API)
  • -
  • Midjourney (via API)
  • -
- -

Specialized Models

-
    -
  • Embedding models for search
  • -
  • Speech-to-text (Whisper)
  • -
  • Text-to-speech
  • -
  • Translation models
  • -
-
- - -
-

Best Practices

- -
- 💡 Tip: Use batch processing for multiple requests to reduce latency and costs. -
- -

Performance Optimization

-
    -
  • Use appropriate model sizes for your task
  • -
  • Implement caching for repeated requests
  • -
  • Use streaming for long responses
  • -
  • Monitor token usage to control costs
  • -
  • Consider subscription plans for regular use
  • -
- -

Security Best Practices

-
    -
  • Keep your API keys secure
  • -
  • Use environment variables for credentials
  • -
  • Implement proper error handling
  • -
  • Validate inputs before submission
  • -
  • Use HTTPS for all API calls
  • -
-
- - -
-

Support & Resources

- -

Getting Help

- - -

Tutorials

- - -

Examples

- -
-
-
- -
-
-

© 2025 AITBC. All rights reserved.

-
-
- - diff --git a/website/docs/docs-clients.html b/website/docs/clients.html similarity index 80% rename from website/docs/docs-clients.html rename to website/docs/clients.html index cf247ec7..a540f0b7 100644 --- a/website/docs/docs-clients.html +++ b/website/docs/clients.html @@ -9,19 +9,19 @@ -
-
-
-
- -

AITBC

-
-
-
+
Available Models: llama3.2, mistral, deepseek-r1:14b, gemma3, qwen2.5-coder, and 8+ more via Ollama integration. Processing time: 11-25 seconds. Rate: 0.02 AITBC per GPU second.
@@ -391,19 +394,19 @@ curl -X GET https://aitbc.bubuit.net/api/v1/jobs/JOB_ID \

Tutorials

Examples

@@ -449,28 +452,8 @@ curl -X GET https://aitbc.bubuit.net/api/v1/jobs/JOB_ID \
-

© 2025 AITBC. All rights reserved.

+

© 2026 AITBC. All rights reserved.

-
- - + + diff --git a/website/docs/components-md.html b/website/docs/components-md.html deleted file mode 100644 index 7fe0b44b..00000000 --- a/website/docs/components-md.html +++ /dev/null @@ -1,495 +0,0 @@ - - - - - - AITBC System Components - Documentation - - - - -
- -
- -
-
- - - - - - - Back to Documentation - - - -
-

AITBC System Components

-

Overview of all components in the AITBC platform, their status, and documentation links.

-
- - -
-

Core Components

-
- -
-
- -
-

Blockchain Node

-

PoA/PoS consensus with REST/WebSocket RPC, real-time gossip layer, and comprehensive observability. Production-ready with devnet tooling.

-
Live
- - Learn More - -
- - -
-
- -
-

Coordinator API

-

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

-
Live
- - Learn More - -
- - -
-
- -
-

Marketplace Web

-

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

-
Live
- - Learn More - -
- - -
-
- -
-

Explorer Web

-

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

-
Live
- - Learn More - -
- - -
-
- -
-

Wallet Daemon

-

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

-
Live
- - Learn More - -
- - -
-
- -
-

Trade Exchange

-

Bitcoin-to-AITBC exchange with QR payments, user management, and real-time trading. Buy tokens with BTC instantly.

-
Live
- - Learn More - -
- - -
-
- -
-

Pool Hub

-

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

-
Live
- - Learn More - -
-
-
- - -
-

Architecture Overview

-

The AITBC platform consists of 7 core components working together to provide a complete AI blockchain computing solution:

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

Infrastructure Layer

-
    -
  • Blockchain Node - Distributed ledger with PoA/PoS consensus
  • -
  • Coordinator API - Job orchestration and management
  • -
  • Wallet Daemon - Secure wallet management
  • -
- -

Application Layer

-
    -
  • Marketplace Web - GPU compute marketplace
  • -
  • Trade Exchange - Token trading platform
  • -
  • Explorer Web - Blockchain explorer
  • -
  • Pool Hub - Miner coordination service
  • -
-
- - -
-

Quick Links

- -
- - -
-

Status Legend

-
    -
  • ● Live - Production ready and deployed
  • -
  • ● Beta - In testing, limited availability
  • -
  • ● Development - Under active development
  • -
-
- - -
-

Deployment Information

-

All components are containerized and can be deployed using Docker Compose:

-
-# Deploy all components
-docker-compose up -d
-
-# Check status
-docker-compose ps
-
-# View logs
-docker-compose logs -f
-
- - -
-

Support

-

For component-specific issues:

- -
-
-
- -
-
-

© 2025 AITBC. All rights reserved.

-
-
- - diff --git a/website/docs/components.html b/website/docs/components.html index 0ffe20fa..3717a5f3 100644 --- a/website/docs/components.html +++ b/website/docs/components.html @@ -5,266 +5,26 @@ Platform Components - AITBC Documentation - + -
- + @@ -285,8 +45,8 @@
-

Platform Components

-

Explore the 7 core components that make up the AITBC platform

+

Architecture & Components

+

Explore the core components and system architecture of the AITBC platform

@@ -408,16 +168,16 @@

Architecture Overview

The AITBC platform consists of 7 core components working together to provide a complete AI blockchain computing solution:

-
+

Infrastructure Layer

-
    +
    • Blockchain Node - Distributed ledger with PoA/PoS consensus
    • Coordinator API - Job orchestration and management
    • Wallet Daemon - Secure wallet management
    -

    Application Layer

    -
      +

      Application Layer

      +
      • Marketplace Web - GPU compute marketplace
      • Trade Exchange - Token trading platform
      • Explorer Web - Blockchain explorer
      • @@ -429,17 +189,17 @@

        Quick Links

        -
        - + @@ -450,5 +210,6 @@ + diff --git a/website/docs/coordinator-api.html b/website/docs/coordinator-api.html index b5b46c98..4c89a51e 100644 --- a/website/docs/coordinator-api.html +++ b/website/docs/coordinator-api.html @@ -5,272 +5,26 @@ Coordinator API - AITBC Documentation - + -
        - + @@ -280,7 +34,7 @@ @@ -502,5 +256,6 @@ sudo journalctl -u aitbc-coordinator -f + diff --git a/website/docs/css/docs.css b/website/docs/css/docs.css index fcef56af..41526223 100644 --- a/website/docs/css/docs.css +++ b/website/docs/css/docs.css @@ -150,6 +150,72 @@ nav { color: var(--primary-color); } +/* Site Header (unified) */ +.site-header { + background: var(--bg-white); + position: fixed; + width: 100%; + top: 0; + z-index: 1000; + box-shadow: 0 1px 3px rgba(0,0,0,0.1); +} + +.site-header .header-inner { + display: flex; + align-items: center; + justify-content: space-between; + padding: 1rem 0; +} + +.site-header .brand { + display: flex; + align-items: center; + gap: 0.75rem; + text-decoration: none; +} + +.site-header .brand i { + font-size: 2rem; + color: var(--primary-color); +} + +.site-header .brand span { + font-size: 1.5rem; + font-weight: bold; + color: var(--text-dark); +} + +.site-header .header-nav { + display: flex; + align-items: center; + gap: 1.5rem; + list-style: none; +} + +.site-header .header-nav a { + color: var(--text-dark); + padding: 0.5rem 0.75rem; + border-radius: 0.5rem; + font-weight: 500; + text-decoration: none; + transition: color 0.3s; +} + +.site-header .header-nav a:hover, +.site-header .header-nav a.active { + color: var(--primary-color); +} + +@media (max-width: 768px) { + .site-header .header-nav { + gap: 0.5rem; + } + .site-header .header-nav a { + padding: 0.4rem 0.5rem; + font-size: 0.85rem; + } +} + /* Theme Toggle Button */ .theme-toggle { background: none; @@ -1235,4 +1301,570 @@ footer p { flex-direction: column; align-items: center; } + + .doc-grid { + grid-template-columns: 1fr; + } + + .sidebar { + position: static; + max-height: none; + } + + .components-grid { + grid-template-columns: 1fr; + } + + .api-grid { + grid-template-columns: 1fr; + } +} + +/* ============================================ + Component Pages: Layout + ============================================ */ + +.breadcrumb { + margin-bottom: 2rem; +} + +.breadcrumb a { + color: var(--primary-color); + text-decoration: none; +} + +.breadcrumb span { + color: var(--text-light); + margin: 0 0.5rem; +} + +.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); +} + +.doc-grid { + display: grid; + grid-template-columns: 280px 1fr; + gap: 2rem; + align-items: start; +} + +.sidebar { + background: var(--bg-white); + border-radius: 10px; + padding: 1.5rem; + position: sticky; + top: 100px; + max-height: calc(100vh - 120px); + overflow-y: auto; + box-shadow: 0 2px 10px rgba(0,0,0,0.05); +} + +.sidebar h3 { + font-size: 1.1rem; + margin-bottom: 1rem; + color: var(--text-dark); +} + +.sidebar ul { + list-style: none; + padding: 0; +} + +.sidebar li { + margin-bottom: 0.25rem; +} + +.sidebar a { + display: block; + padding: 0.4rem 0.75rem; + color: var(--text-light); + text-decoration: none; + border-radius: 6px; + font-size: 0.9rem; + transition: all 0.2s; +} + +.sidebar a:hover, +.sidebar a.active { + background: rgba(59, 130, 246, 0.1); + color: var(--primary-color); +} + +.sidebar .sub-item { + padding-left: 1.5rem; + font-size: 0.85rem; +} + +.sidebar ul ul { + margin-top: 0.25rem; +} + +/* ============================================ + Component Pages: Cards + ============================================ */ + +.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: 12px; + padding: 2rem; + box-shadow: 0 2px 10px rgba(0,0,0,0.05); + transition: all 0.3s ease; + border: 1px solid var(--border-color); +} + +.component-card:hover { + transform: translateY(-5px); + box-shadow: 0 8px 25px rgba(0,0,0,0.1); + border-color: var(--primary-color); +} + +.component-icon { + width: 60px; + height: 60px; + border-radius: 12px; + display: flex; + align-items: center; + justify-content: center; + font-size: 1.5rem; + color: #fff; + background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); + margin-bottom: 1.5rem; +} + +.component-card h3 { + font-size: 1.4rem; + margin-bottom: 0.75rem; + color: var(--text-dark); +} + +.component-card p { + color: var(--text-light); + margin-bottom: 1rem; + line-height: 1.7; +} + +.component-status { + display: inline-flex; + align-items: center; + gap: 0.5rem; + padding: 0.25rem 0.75rem; + border-radius: 20px; + font-size: 0.85rem; + font-weight: 600; + margin-bottom: 1rem; +} + +.component-status.live { + background: rgba(16, 185, 129, 0.15); + color: var(--success-color); +} + +.component-status.live i { + font-size: 0.5rem; +} + +.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); +} + +/* ============================================ + Component Pages: Section blocks + ============================================ */ + +.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); +} + +.inline-code { + background: var(--bg-light); + padding: 0.2rem 0.5rem; + border-radius: 4px; + font-family: 'Fira Code', 'JetBrains Mono', monospace; + font-size: 0.9em; + color: var(--accent-color); +} + +/* ============================================ + API Pages + ============================================ */ + +.api-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); + gap: 1.5rem; + margin: 1.5rem 0; +} + +.api-card { + background: var(--bg-light); + border-radius: 10px; + padding: 1.5rem; + border-left: 4px solid var(--primary-color); +} + +.api-card h4 { + color: var(--primary-color); + margin-bottom: 0.5rem; +} + +.api-endpoint, +.endpoint { + background: var(--bg-light); + border-radius: 8px; + padding: 1.25rem; + margin: 1rem 0; + border: 1px solid var(--border-color); +} + +.method { + display: inline-block; + padding: 0.2rem 0.6rem; + border-radius: 4px; + font-weight: 700; + font-size: 0.8rem; + color: #fff; + margin-right: 0.5rem; +} + +.method.get, .get { background: var(--success-color); } +.method.post, .post { background: var(--primary-color); } +.method.delete, .delete { background: var(--danger-color); } + +.http-request { + font-family: 'Fira Code', monospace; + font-size: 0.9rem; +} + +.error-box { + background: rgba(239, 68, 68, 0.1); + border: 1px solid var(--danger-color); + border-radius: 8px; + padding: 1rem; + margin: 1rem 0; +} + +.status-badge { + display: inline-block; + padding: 0.2rem 0.6rem; + border-radius: 12px; + font-size: 0.8rem; + font-weight: 600; +} + +/* ============================================ + Tabs + ============================================ */ + +.tabs { + margin: 1.5rem 0; +} + +.tab-buttons { + display: flex; + gap: 0.5rem; + margin-bottom: 1rem; + border-bottom: 2px solid var(--border-color); + padding-bottom: 0; +} + +.tab-button { + padding: 0.75rem 1.5rem; + background: none; + border: none; + color: var(--text-light); + cursor: pointer; + font-weight: 600; + border-bottom: 2px solid transparent; + margin-bottom: -2px; + transition: all 0.3s; +} + +.tab-button:hover, +.tab-button.active { + color: var(--primary-color); + border-bottom-color: var(--primary-color); +} + +.tab-content { + display: none; + padding: 1rem 0; +} + +.tab-content.active { + display: block; +} + +/* ============================================ + Code Groups + ============================================ */ + +.code-group { + margin: 1rem 0; + border: 1px solid var(--border-color); + border-radius: 5px; + overflow: hidden; +} + +.code-group-header { + background: var(--bg-light); + padding: 0.5rem 1rem; + font-weight: 600; + color: var(--text-dark); +} + +.code-group-content { + padding: 0; +} + +/* ============================================ + Mermaid Diagrams + ============================================ */ + +.mermaid { + text-align: center; + margin: 2rem 0; +} + +/* ============================================ + Flow Diagram + ============================================ */ + +.flow-diagram { + background: var(--bg-white); + border-radius: 10px; + padding: 2rem; + margin: 2rem 0; + box-shadow: 0 2px 10px rgba(0,0,0,0.05); + overflow-x: auto; +} + +/* ============================================ + Misc: Timeline, Security, CTA, Browser + ============================================ */ + +.timeline { + position: relative; + padding-left: 2rem; + margin: 1.5rem 0; +} + +.timeline::before { + content: ''; + position: absolute; + left: 0; + top: 0; + bottom: 0; + width: 2px; + background: var(--primary-color); +} + +.security-icon { + font-size: 2rem; + color: var(--primary-color); + margin-bottom: 1rem; +} + +.cta-button { + display: inline-block; + padding: 1rem 2rem; + background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); + color: #fff; + border-radius: 50px; + font-weight: 600; + text-decoration: none; + transition: all 0.3s; +} + +.cta-button:hover { + transform: translateY(-2px); + box-shadow: 0 5px 20px rgba(59, 130, 246, 0.4); + color: #fff; +} + +.hero-gradient { + background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%); + border-radius: 15px; + padding: 2rem; + margin: 2rem 0; +} + +.browser-button, .chrome-button, .firefox-button { + display: inline-flex; + align-items: center; + gap: 0.5rem; + padding: 0.75rem 1.5rem; + border-radius: 8px; + font-weight: 600; + text-decoration: none; + transition: all 0.3s; +} + +.chrome-button { + background: #4285f4; + color: #fff; +} + +.firefox-button { + background: #ff7139; + color: #fff; +} + +/* ============================================ + Announcement Banners + ============================================ */ + +.announce-banner { + margin-top: 2rem; + padding: 1.5rem; + background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(16, 185, 129, 0.1) 100%); + border-radius: 15px; + border: 2px solid rgba(59, 130, 246, 0.2); +} + +.announce-banner.green { + border-color: rgba(16, 185, 129, 0.2); +} + +.announce-banner h3 { + color: var(--success-color); + margin-bottom: 0.5rem; + font-size: 1.2rem; +} + +.announce-banner p { + color: var(--text-light); + margin: 0; +} + +/* ============================================ + Markdown Source Links + ============================================ */ + +.source-links { + margin-top: 1rem; + display: flex; + gap: 1rem; + flex-wrap: wrap; +} + +.source-links a { + color: var(--primary-color); + font-size: 0.9rem; + text-decoration: none; +} + +.source-links a:hover { + text-decoration: underline; +} + +/* ============================================ + Search Results + ============================================ */ + +.search-results { + max-width: 600px; + margin: -3rem auto 2rem; + background: var(--bg-white); + border-radius: 10px; + box-shadow: 0 4px 20px rgba(0,0,0,0.1); + overflow: hidden; +} + +.search-results a { + display: block; + padding: 0.75rem 1rem; + border-bottom: 1px solid var(--border-color); + color: var(--text-dark); + text-decoration: none; +} + +.search-results a:hover { + background: rgba(59, 130, 246, 0.05); +} + +.search-results small { + color: var(--text-light); +} + +.search-results .no-results { + padding: 1rem; + color: var(--text-light); +} + +/* ============================================ + Inline Code Blocks (pre/code in content) + ============================================ */ + +.code-inline { + background: #1f2937; + color: #f9fafb; + padding: 1rem; + border-radius: 8px; + overflow-x: auto; + font-family: 'Fira Code', 'JetBrains Mono', monospace; + font-size: 0.9rem; +} + +/* ============================================ + Quick-link Grid (components page) + ============================================ */ + +.quicklink-grid { + display: grid; + grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + gap: 1rem; + margin-top: 1.5rem; +} + +.quicklink-grid a { + padding: 1rem; + background: var(--bg-light); + border-radius: 8px; + text-decoration: none; + color: var(--text-dark); + transition: all 0.3s; +} + +.quicklink-grid a:hover { + background: var(--primary-color); + color: #fff; } diff --git a/website/docs/developer-documentation-md.html b/website/docs/developer-documentation-md.html deleted file mode 100644 index 0d566b09..00000000 --- a/website/docs/developer-documentation-md.html +++ /dev/null @@ -1,633 +0,0 @@ - - - - - - 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://github.com/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-developers.html b/website/docs/developers.html similarity index 82% rename from website/docs/docs-developers.html rename to website/docs/developers.html index 63b4c0b6..e18ea183 100644 --- a/website/docs/docs-developers.html +++ b/website/docs/developers.html @@ -9,19 +9,19 @@ -
        -
        -
        -
        - -

        AITBC

        -
        -
        @@ -364,34 +368,34 @@ make benchmark

        Documentation

        Tools & SDKs

        Development Environment

        Learning Resources

        @@ -510,28 +514,8 @@ def test_create_feature_invalid():
        -

        © 2025 AITBC. All rights reserved.

        +

        © 2026 AITBC. All rights reserved.

        -
        - - + + diff --git a/website/docs/explorer-web.html b/website/docs/explorer-web.html index 18a9b2d6..2f467a3f 100644 --- a/website/docs/explorer-web.html +++ b/website/docs/explorer-web.html @@ -5,230 +5,26 @@ Explorer Web - AITBC Documentation - + -
        - + +
        @@ -237,7 +33,7 @@ @@ -415,8 +211,9 @@ npm test
        -

        © 2025 AITBC. All rights reserved.

        +

        © 2026 AITBC. All rights reserved.

        + diff --git a/website/docs/flowchart.html b/website/docs/flowchart.html index b1cd2b47..17eb6d6e 100644 --- a/website/docs/flowchart.html +++ b/website/docs/flowchart.html @@ -5,278 +5,26 @@ System Flow - AITBC Documentation - + -
        - + +
        @@ -724,8 +472,8 @@ Cost: 0.25 AITBC @@ -746,8 +494,9 @@ Cost: 0.25 AITBC
        -

        © 2025 AITBC. All rights reserved.

        +

        © 2026 AITBC. All rights reserved.

        + diff --git a/website/docs/full-documentation-md.html b/website/docs/full-documentation-md.html deleted file mode 100644 index b5d0cf2d..00000000 --- a/website/docs/full-documentation-md.html +++ /dev/null @@ -1,643 +0,0 @@ - - - - - - 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://github.com/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 ce37260d..01ee58d0 100644 --- a/website/docs/full-documentation.html +++ b/website/docs/full-documentation.html @@ -5,466 +5,26 @@ Full Documentation - AITBC - + -
        - + @@ -525,6 +85,19 @@
    +

    Markdown Docs

    + @@ -1085,24 +658,7 @@ gosec ./... - + + diff --git a/website/docs/index.html b/website/docs/index.html index 154f597a..64d3e9f6 100644 --- a/website/docs/index.html +++ b/website/docs/index.html @@ -5,23 +5,23 @@ Documentation - AITBC - + -
    -
    -
    -
    - -

    AITBC

    -
    -
- Miner Documentation + Miner Documentation
- +

Clients

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

@@ -78,13 +78,13 @@
  • Transparent pricing: 0.02 AITBC/gpu_second
  • Cryptographic receipts & blockchain verification
  • - Client Documentation + Client Documentation
    - +

    Developers

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

    @@ -95,13 +95,13 @@
  • Bounty programs
  • Community resources
  • - Developer Documentation + Developer Documentation
    - +

    Full Documentation

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

    @@ -118,26 +118,26 @@
    - +
    -

    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.

    +

    Architecture & Components

    +

    Explore the system architecture and core components of the AITBC platform. Understand how each part works together from end-to-end flow to individual services.

      -
    • Blockchain Node with PoA/PoS consensus
    • +
    • End-to-end system flow diagram
    • Coordinator API for job orchestration
    • -
    • Wallet Daemon for secure key management
    • -
    • Miner Daemon for GPU compute
    • +
    • Blockchain Node with PoA/PoS consensus
    • Marketplace Web for compute trading
    • -
    • Explorer Web for blockchain viewing
    • -
    • Pool Hub for miner coordination
    • +
    • Trade Exchange for BTC-to-AITBC
    • +
    • Wallet for key management & staking
    • +
    • Codebase structure & technical reference
    - View Components + View Architecture
    - +

    System Flow

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

    @@ -157,19 +157,19 @@

    Quick Links

    @@ -192,10 +192,10 @@ Join Discord - Email Support + Email Support - - Live Chat + + Live Chat
    @@ -205,44 +205,50 @@
    -

    © 2026 AITBC. All rights reserved. | Last updated: January 24, 2026

    +

    © 2026 AITBC. All rights reserved. | Last updated: February 13, 2026

    - - + + diff --git a/website/docs/marketplace-web.html b/website/docs/marketplace-web.html index 34f464f3..b90f8674 100644 --- a/website/docs/marketplace-web.html +++ b/website/docs/marketplace-web.html @@ -5,245 +5,26 @@ Marketplace Web - AITBC Documentation - + -
    - + +
    @@ -252,7 +33,7 @@ @@ -478,7 +259,7 @@ docker run -d \

    For marketplace-specific issues:

    @@ -487,8 +268,9 @@ docker run -d \
    -

    © 2025 AITBC. All rights reserved.

    +

    © 2026 AITBC. All rights reserved.

    + diff --git a/website/docs/miner-documentation-md.html b/website/docs/miner-documentation-md.html deleted file mode 100644 index 0c7cc0db..00000000 --- a/website/docs/miner-documentation-md.html +++ /dev/null @@ -1,585 +0,0 @@ - - - - - - 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://github.com/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://github.com/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/docs-miners.html b/website/docs/miners.html similarity index 82% rename from website/docs/docs-miners.html rename to website/docs/miners.html index 28f2b83d..79dc7e64 100644 --- a/website/docs/docs-miners.html +++ b/website/docs/miners.html @@ -9,19 +9,19 @@ -
    -
    -
    -
    - -

    AITBC

    -
    -
    @@ -74,8 +77,8 @@
  • Hybrid Mining: Combine staking with compute provision
  • -
    - 🎉 Latest Achievement (January 2026): Real GPU miner successfully deployed with NVIDIA RTX 4060 Ti! Processing jobs in 11-25 seconds with verified receipt generation. Earn 0.02 AITBC per GPU second with 13+ Ollama models available. +
    + 🎉 Latest Achievement (February 2026): Real GPU miner successfully deployed with NVIDIA RTX 4060 Ti! Processing jobs in 11-25 seconds with verified receipt generation. Earn 0.02 AITBC per GPU second with 13+ Ollama models available.

    Quick Start

    @@ -361,7 +364,7 @@ nano ~/.aitbc/miner.toml
    -

    © 2025 AITBC. All rights reserved.

    +

    © 2026 AITBC. All rights reserved.

    @@ -383,26 +386,6 @@ nano ~/.aitbc/miner.toml
    // Initialize calculator calculateProfit(); - - - + + diff --git a/website/docs/pool-hub.html b/website/docs/pool-hub.html index 82826783..0e98a3a2 100644 --- a/website/docs/pool-hub.html +++ b/website/docs/pool-hub.html @@ -5,230 +5,26 @@ Pool Hub - AITBC Documentation - + -
    - + +
    @@ -237,7 +33,7 @@ @@ -471,8 +267,9 @@ GET /metrics
    -

    © 2025 AITBC. All rights reserved.

    +

    © 2026 AITBC. All rights reserved.

    + diff --git a/website/docs/trade-exchange.html b/website/docs/trade-exchange.html index 4c8f33ff..cb7a8e12 100644 --- a/website/docs/trade-exchange.html +++ b/website/docs/trade-exchange.html @@ -5,293 +5,26 @@ Trade Exchange - AITBC Documentation - + -
    - + @@ -301,7 +34,7 @@ @@ -537,5 +270,6 @@ BITCOIN_RPC_PASS=password + diff --git a/website/docs/wallet-daemon.html b/website/docs/wallet-daemon.html index c1c658d4..5ace2dcc 100644 --- a/website/docs/wallet-daemon.html +++ b/website/docs/wallet-daemon.html @@ -5,230 +5,26 @@ Wallet Daemon - AITBC Documentation - + -
    - + +
    @@ -237,7 +33,7 @@ @@ -421,8 +217,9 @@ console.log('Balance:', balance);
    -

    © 2025 AITBC. All rights reserved.

    +

    © 2026 AITBC. All rights reserved.

    + diff --git a/website/documentation.html b/website/documentation.html deleted file mode 100644 index 75b00db1..00000000 --- a/website/documentation.html +++ /dev/null @@ -1,613 +0,0 @@ - - - - - - Documentation - AITBC - - - - - -
    - -
    - - -
    -
    -
    -

    AITBC Documentation

    -

    Comprehensive guides and technical documentation for the AITBC platform

    -
    - -
    - - - - -
    -
    -

    Getting Started

    -

    Welcome to AITBC! This guide will help you get started with the AI Training & Blockchain Computing platform.

    - -

    Prerequisites

    -
      -
    • Linux or macOS operating system
    • -
    • Docker installed (version 20.10+)
    • -
    • Git
    • -
    • Node.js (version 16+) for frontend development
    • -
    • Python (version 3.8+) for backend development
    • -
    - -

    Quick Installation

    -
    - Note: For production deployments, please refer to the Deployment Guide. -
    - -
    # Clone the repository
    -git clone https://github.com/aitbc/aitbc.git
    -cd aitbc
    -
    -# Run the setup script
    -./scripts/setup.sh
    -
    -# Start the development environment
    -docker-compose up -d
    - -

    Verify Installation

    -

    Once the services are running, you can verify the installation by checking:

    -
      -
    • Blockchain Node: http://localhost:8545
    • -
    • Coordinator API: http://localhost:8080
    • -
    • Marketplace UI: http://localhost:3000
    • -
    -
    - -
    -

    Architecture

    -

    AITBC is built with a modular architecture consisting of several key components:

    - -

    Core Components

    -

    1. Blockchain Node

    -

    The blockchain node implements a hybrid Proof of Authority/Proof of Stake consensus mechanism with dynamic mode switching:

    -
      -
    • FAST Mode: 100-200ms finality, up to 50,000 TPS
    • -
    • BALANCED Mode: 500ms-1s finality, up to 20,000 TPS
    • -
    • SECURE Mode: 2-5s finality, up to 10,000 TPS
    • -
    - -

    2. Coordinator API

    -

    The coordinator acts as the central hub for marketplace operations:

    -
      -
    • Job management and scheduling
    • -
    • Receipt verification and storage
    • -
    • Provider registration and reputation
    • -
    • Multi-tenant support
    • -
    - -

    3. GPU Service Provider

    -

    Decentralized compute providers offer AI/ML services:

    -
      -
    • Model inference
    • -
    • Training and fine-tuning
    • -
    • Result verification
    • -
    • Cross-chain compatibility
    • -
    - -

    Data Flow

    -
      -
    1. Client submits job request to Coordinator
    2. -
    3. Coordinator matches with suitable provider
    4. -
    5. Provider executes computation
    6. -
    7. Results submitted with cryptographic proof
    8. -
    9. Verification and settlement on blockchain
    10. -
    -
    - -
    -

    API Reference

    -

    AITBC provides REST APIs for interacting with the platform:

    - -

    Coordinator API

    -

    Authentication

    -

    All API requests require authentication using JWT tokens:

    -
    Authorization: Bearer <your-jwt-token>
    - -

    Endpoints

    - - - - - - - - - - - - - - - - - - - - - - - - - - -
    MethodEndpointDescription
    POST/api/v1/jobsCreate a new job
    GET/api/v1/jobs/{id}Get job details
    GET/api/v1/jobsList jobs
    POST/api/v1/receipts/verifyVerify a receipt
    - -

    Example: Create a Job

    -
    curl -X POST http://localhost:8080/api/v1/jobs \
    -  -H "Authorization: Bearer <token>" \
    -  -H "Content-Type: application/json" \
    -  -d '{
    -    "type": "inference",
    -    "model_id": "gpt-4",
    -    "input_data": "Hello, world!",
    -    "requirements": {
    -      "max_tokens": 100,
    -      "temperature": 0.7
    -    }
    -  }'
    -
    - -
    -

    Developer Guide

    -

    This section provides detailed information for developers building on AITBC.

    - -

    SDKs

    -

    AITBC provides SDKs for multiple languages:

    -
      -
    • Python SDK: pip install aitbc
    • -
    • JavaScript SDK: npm install @aitbc/client
    • -
    • Go SDK: go get github.com/aitbc/go-sdk
    • -
    - -

    Building Extensions

    -

    Developers can extend AITBC functionality through:

    -
      -
    1. Custom marketplace extensions
    2. -
    3. New compute provider implementations
    4. -
    5. Alternative consensus mechanisms
    6. -
    7. Cross-chain bridges
    8. -
    - -

    Contributing

    -

    We welcome contributions! Please see our contributing guide for details.

    -
    - -
    -

    Deployment Guide

    -

    This guide covers deploying AITBC in production environments.

    - -

    System Requirements

    -
    - Minimum Requirements: -
      -
    • 4 CPU cores
    • -
    • 8GB RAM
    • -
    • 100GB storage
    • -
    • Stable internet connection
    • -
    -
    - -

    Production Deployment

    -
    # Clone the repository
    -git clone https://github.com/aitbc/aitbc.git
    -cd aitbc
    -
    -# Configure environment
    -cp .env.example .env
    -# Edit .env with your settings
    -
    -# Deploy with Docker Compose
    -docker-compose -f docker-compose.prod.yml up -d
    - -

    Monitoring

    -

    AITBC includes built-in monitoring capabilities:

    -
      -
    • Prometheus metrics endpoint
    • -
    • Grafana dashboards
    • -
    • Health check endpoints
    • -
    • Log aggregation
    • -
    -
    - -
    -

    Security

    -

    Security is a top priority for AITBC. Here are the key security features:

    - -

    Cryptography

    -
      -
    • Zero-knowledge proofs for privacy
    • -
    • Threshold signatures for security
    • -
    • End-to-end encryption
    • -
    • Secure multi-party computation
    • -
    - -

    Audit Reports

    -

    Our smart contracts have been audited by:

    -
      -
    • Trail of Bits (2024)
    • -
    • CertiK (2024)
    • -
    • OpenZeppelin (2023)
    • -
    - -

    Bug Bounty

    -

    We offer a bug bounty program with rewards up to $100,000. Report vulnerabilities at security@aitbc.io.

    -
    - -
    -

    Frequently Asked Questions

    - -

    General

    -

    What is AITBC?

    -

    AITBC is a decentralized platform for AI/ML workloads that combines blockchain technology with artificial intelligence to create a trustless marketplace for computational resources.

    - -

    How does AITBC ensure privacy?

    -

    We use zero-knowledge proofs and secure enclaves to protect sensitive data while enabling verification of computation.

    - -

    What blockchains does AITBC support?

    -

    AITBC currently supports Ethereum, Polygon, and Binance Smart Chain, with more chains being added.

    - -

    Technical

    -

    What is the maximum TPS?

    -

    AITBC can achieve up to 100,000 TPS through sharding and rollup architectures.

    - -

    How long does finality take?

    -

    Finality time depends on the consensus mode: 100ms (FAST), 1s (BALANCED), or 5s (SECURE).

    - -

    Economic

    -

    How are providers rewarded?

    -

    Providers earn AITBC tokens for completing computations, with rewards based on performance and reputation.

    - -

    What are the fees?

    -

    Transaction fees are dynamic and depend on network load, typically ranging from 0.1% to 1% of the transaction value.

    -
    -
    -
    -
    -
    - - -
    -
    -

    © 2025 AITBC. All rights reserved.

    -
    -
    - - - - diff --git a/website/full-documentation.html b/website/full-documentation.html deleted file mode 100644 index 65f94547..00000000 --- a/website/full-documentation.html +++ /dev/null @@ -1,1070 +0,0 @@ - - - - - - Full Documentation - AITBC - - - - - -
    - -
    - - -
    -
    -
    -

    AITBC Full Documentation

    -

    Complete technical documentation for the AI Training & Blockchain Computing platform

    -
    - -
    - - - - -
    -
    -

    Introduction

    -

    AITBC (AI Training & Blockchain Computing) is a decentralized platform that combines artificial intelligence and blockchain technology to create a trustless marketplace for AI/ML workloads. The platform enables secure, private, and verifiable computation while maintaining transparency through blockchain technology.

    - -

    Key Features

    -
      -
    • Decentralized Marketplace: Connect AI service providers with consumers in a trustless environment
    • -
    • Confidential Computing: Zero-knowledge proofs and secure enclaves protect sensitive data
    • -
    • High Performance: Sharding and rollups achieve 100,000+ TPS with sub-second finality
    • -
    • Privacy-Preserving: Advanced cryptography ensures data confidentiality
    • -
    • Token Economics: Sustainable incentives for all participants
    • -
    • Autonomous Agents: AI agents can participate as marketplace providers
    • -
    - -

    Use Cases

    -
    -
    - - - -
    -
    -

    Healthcare AI

    -

    Secure medical image analysis, drug discovery, and patient data processing while maintaining HIPAA compliance through confidential computing.

    -
    -
    -

    Financial Services

    -

    Fraud detection, risk assessment, and algorithmic trading with verifiable computation and audit trails.

    -
    -
    -

    Scientific Research

    -

    Collaborative research with data privacy, reproducible results, and fair attribution through blockchain verification.

    -
    -
    -
    - -
    -

    Architecture

    - -

    Core Components

    -
    - graph TB - A[Client] --> B[Coordinator API] - B --> C[Blockchain Node] - B --> D[GPU Providers] - C --> E[Consensus Engine] - C --> F[Smart Contracts] - D --> G[ZK Proofs] - F --> H[Receipt Storage] -
    - -

    Blockchain Node

    -

    The blockchain node implements a hybrid Proof of Authority/Proof of Stake consensus mechanism with three operational modes:

    -
      -
    • FAST Mode: 100-200ms finality, up to 50,000 TPS
    • -
    • BALANCED Mode: 500ms-1s finality, up to 20,000 TPS
    • -
    • SECURE Mode: 2-5s finality, up to 10,000 TPS
    • -
    - -

    Coordinator API

    -

    The coordinator serves as the central hub for marketplace operations:

    -
      -
    • Job scheduling and management
    • -
    • Receipt verification and storage
    • -
    • Provider registration and reputation tracking
    • -
    • Multi-tenant support with isolation
    • -
    • Real-time metrics and analytics
    • -
    - -

    GPU Service Provider

    -

    Decentralized compute providers offer various AI/ML services:

    -
      -
    • Model inference (text, image, audio, video)
    • -
    • Model training and fine-tuning
    • -
    • Data preprocessing and augmentation
    • -
    • Result verification with ZK proofs
    • -
    • Cross-chain compatibility
    • -
    - -

    Data Flow

    -
    - sequenceDiagram - participant C as Client - participant API as Coordinator API - participant P as Provider - participant BC as Blockchain - - C->>API: Submit Job Request - API->>API: Validate & Match Provider - API->>P: Forward Job - P->>P: Execute Computation - P->>P: Generate ZK Proof - P->>API: Submit Results + Proof - API->>API: Verify Proof - API->>BC: Store Receipt - BC->>C: Notify Completion - C->>API: Retrieve Results -
    - -

    Consensus Mechanism

    -

    The hybrid consensus combines the speed of Proof of Authority with the decentralization of Proof of Stake:

    - -

    Mode Selection Algorithm

    -
    def determine_mode(network_metrics):
    -    load = network_metrics.utilization
    -    auth_availability = network_metrics.authority_uptime
    -    stake_participation = network_metrics.stake_ratio
    -    
    -    if load < 0.3 and auth_availability > 0.9:
    -        return ConsensusMode.FAST
    -    elif load > 0.7 or stake_participation > 0.8:
    -        return ConsensusMode.SECURE
    -    else:
    -        return ConsensusMode.BALANCED
    - -

    Validator Selection

    -
    -
    - - - -
    -
    -

    Authority-Only Selection

    -
      -
    • VRF-based random selection from 21 authorities
    • -
    • 100ms block time
    • -
    • 2/3 signature threshold
    • -
    -
    -
    -

    Hybrid Selection

    -
      -
    • 70% authority, 30% staker selection
    • -
    • 500ms block time
    • -
    • 2/3 authority + 1/3 stake threshold
    • -
    -
    -
    -

    Stake-Weighted Selection

    -
      -
    • Full stake-weighted selection
    • -
    • 2s block time
    • -
    • 2/3 stake threshold
    • -
    -
    -
    -
    - -
    -

    Installation

    - -

    Prerequisites

    -
    - System Requirements: -
      -
    • Linux (Ubuntu 20.04+) or macOS (10.15+)
    • -
    • 16GB RAM minimum (32GB recommended)
    • -
    • 100GB free storage
    • -
    • Docker 20.10+ and Docker Compose
    • -
    • Node.js 16+ (for frontend development)
    • -
    • Python 3.8+ (for backend development)
    • -
    • Go 1.19+ (for blockchain node)
    • -
    -
    - -

    Quick Start

    -

    Option 1: Docker Compose (Recommended)

    -
    # Clone the repository
    -git clone https://github.com/oib/AITBC.git
    -cd aitbc
    -
    -# Copy environment configuration
    -cp .env.example .env
    -# Edit .env with your settings
    -
    -# Start all services
    -docker-compose up -d
    -
    -# Check status
    -docker-compose ps
    - -

    Option 2: Manual Installation

    -
    # Install dependencies
    -./scripts/install-dependencies.sh
    -
    -# Build blockchain node
    -make build-node
    -
    -# Build coordinator
    -make build-coordinator
    -
    -# Initialize database
    -./scripts/init-db.sh
    -
    -# Start services
    -./scripts/start-all.sh
    - -

    Configuration

    -

    Environment Variables

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    VariableDescriptionDefault
    AITBC_NETWORKNetwork mode (dev/test/main)dev
    AITBC_CHAIN_IDBlockchain chain ID1337
    AITBC_CONSENSUS_MODEConsensus modeBALANCED
    AITBC_DB_URLDatabase connection stringpostgresql://localhost/aitbc
    AITBC_REDIS_URLRedis connection stringredis://localhost:6379
    - -

    Node Configuration

    -
    # config/node.toml
    -[network]
    -listen_addr = "0.0.0.0:30303"
    -discovery_addr = "0.0.0.0:30304"
    -
    -[consensus]
    -mode = "BALANCED"
    -validator_count = 21
    -stake_minimum = 1000
    -
    -[storage]
    -data_dir = "/var/lib/aitbc"
    -prune = true
    -prune_threshold = "100GB"
    -
    - -
    -

    APIs

    - -

    Coordinator API

    -

    Authentication

    -

    All API requests require authentication using JWT tokens:

    -
    curl -X POST http://localhost:8080/api/v1/auth/login \
    -  -H "Content-Type: application/json" \
    -  -d '{"address": "0x...", "signature": "0x..."}'
    - -

    Endpoints

    -
    -
    Job Management
    -
    -
    # Create a job
    -POST /api/v1/jobs
    -{
    -  "type": "inference",
    -  "model_id": "gpt-4",
    -  "input_data": "Hello, world!",
    -  "requirements": {
    -    "max_tokens": 100,
    -    "temperature": 0.7
    -  }
    -}
    -
    -# Get job status
    -GET /api/v1/jobs/{job_id}
    -
    -# List jobs
    -GET /api/v1/jobs?status=pending&limit=10
    -
    -# Cancel a job
    -DELETE /api/v1/jobs/{job_id}
    -
    -
    - -
    -
    Receipt Verification
    -
    -
    # Verify a receipt
    -POST /api/v1/receipts/verify
    -{
    -  "receipt_id": "0x...",
    -  "proof": "0x...",
    -  "public_inputs": ["0x..."]
    -}
    -
    -# Get receipt details
    -GET /api/v1/receipts/{receipt_id}
    -
    -
    - -

    Blockchain API

    -

    JSON-RPC Endpoints

    -
    # Get latest block
    -curl -X POST http://localhost:8545 \
    -  -H "Content-Type: application/json" \
    -  -d '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["latest", false],"id":1}'
    -
    -# Send transaction
    -curl -X POST http://localhost:8545 \
    -  -H "Content-Type: application/json" \
    -  -d '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0x..."],"id":1}'
    - -

    WebSocket Subscriptions

    -
    # Subscribe to new blocks
    -ws://localhost:8545
    -
    -{"jsonrpc":"2.0","id":1,"method":"eth_subscribe","params":["newHeads"]}
    - -

    Wallet API

    -

    Wallet Operations

    -
    # Create wallet
    -POST /api/v1/wallet/create
    -{
    -  "password": "secure-password",
    -  "mnemonic_language": "english"
    -}
    -
    -# Unlock wallet
    -POST /api/v1/wallet/unlock
    -{
    -  "wallet_id": "wallet-uuid",
    -  "password": "secure-password"
    -}
    -
    -# Sign transaction
    -POST /api/v1/wallet/sign
    -{
    -  "wallet_id": "wallet-uuid",
    -  "transaction": "0x..."
    -}
    -
    - -
    -

    Development

    - -

    Building

    -

    Prerequisites

    -
    # Install build dependencies
    -sudo apt-get install build-essential libssl-dev
    -
    -# Install Rust (for blockchain node)
    -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
    -source ~/.cargo/env
    -
    -# Install Go
    -wget https://go.dev/dl/go1.19.linux-amd64.tar.gz
    -sudo tar -C /usr/local -xzf go1.19.linux-amd64.tar.gz
    - -

    Build Components

    -
    # Build blockchain node
    -cd blockchain-node
    -cargo build --release
    -
    -# Build coordinator
    -cd coordinator-api
    -go build -o bin/coordinator
    -
    -# Build wallet daemon
    -cd wallet-daemon
    -go build -o bin/wallet
    -
    -# Build frontend
    -cd marketplace-web
    -npm install
    -npm run build
    - -

    Testing

    -

    Unit Tests

    -
    # Run all tests
    -make test
    -
    -# Run specific package tests
    -make test-unit PACKAGE=coordinator
    -
    -# Run with coverage
    -make test-coverage
    - -

    Integration Tests

    -
    # Start test environment
    -docker-compose -f docker-compose.test.yml up -d
    -
    -# Run integration tests
    -make test-integration
    -
    -# Clean up
    -docker-compose -f docker-compose.test.yml down -v
    - -

    Load Testing

    -
    # Install Locust
    -pip install locust
    -
    -# Run load tests
    -locust -f tests/load/locustfile.py --host=http://localhost:8080
    - -

    Contributing

    -

    We welcome contributions! Please see our contributing guide for details.

    - -

    Development Workflow

    -
      -
    1. Fork the repository on Gitea
    2. -
    3. Create a feature branch
    4. -
    5. Make your changes
    6. -
    7. Add tests for new functionality
    8. -
    9. Ensure all tests pass
    10. -
    11. Submit a pull request
    12. -
    - -

    Code Style

    -
    -
    Rust
    -
    -
    # Format code
    -cargo fmt
    -
    -# Run linter
    -cargo clippy -- -D warnings
    -
    -# Run audit
    -cargo audit
    -
    -
    - -
    -
    Go
    -
    -
    # Format code
    -go fmt ./...
    -
    -# Run linter
    -golangci-lint run
    -
    -# Run security check
    -gosec ./...
    -
    -
    -
    - -
    -

    Security

    - -

    Threat Model

    -

    Our comprehensive threat model covers:

    -
      -
    • Privacy attacks and mitigations
    • -
    • Consensus security
    • -
    • Smart contract vulnerabilities
    • -
    • Network-level attacks
    • -
    • Economic attacks
    • -
    - -

    See the full threat modeling document for detailed analysis.

    - -

    Security Audits

    -
    - Completed Audits: -
      -
    • Trail of Bits (2024) - Smart Contracts
    • -
    • CertiK (2024) - Protocol Security
    • -
    • OpenZeppelin (2023) - Token Economics
    • -
    -
    - -

    Bug Bounty Program

    -

    We offer rewards up to $100,000 for critical vulnerabilities:

    -
      -
    • Critical: $50,000 - $100,000
    • -
    • High: $10,000 - $50,000
    • -
    • Medium: $1,000 - $10,000
    • -
    • Low: $100 - $1,000
    • -
    -

    Report vulnerabilities at: security@aitbc.io

    -
    - -
    -

    Reference

    - -

    Glossary

    - - - - - - - - - - - - - - - - - - - - - -
    TermDefinition
    ZK ProofZero-knowledge proof enabling verification without revealing inputs
    ReceiptCryptographic proof of computation completion
    ProviderNode offering AI/ML computation services
    CoordinatorCentral service managing marketplace operations
    - -

    Frequently Asked Questions

    -

    General

    -

    What blockchain does AITBC use?

    -

    AITBC implements its own blockchain with a hybrid consensus mechanism, but supports cross-chain interoperability with Ethereum, Polygon, and BSC.

    - -

    How are transactions verified?

    -

    Through a combination of zero-knowledge proofs for privacy and traditional blockchain validation for transparency.

    - -

    Technical

    -

    What programming languages are used?

    -
      -
    • Rust for blockchain node
    • -
    • Go for coordinator and wallet
    • -
    • TypeScript/React for frontend
    • -
    • Python for AI/ML components
    • -
    - -

    How can I run a node?

    -

    See the installation guide for detailed instructions on running a full node, validator node, or GPU provider.

    - -

    Support

    -

    Get help through:

    - -
    -
    -
    -
    -
    - - -
    -
    -

    © 2025 AITBC. All rights reserved.

    -
    -
    - - - - - diff --git a/website/index.html b/website/index.html index 14260976..52a9b5a7 100644 --- a/website/index.html +++ b/website/index.html @@ -690,7 +690,7 @@

    Miners

    Learn mining, staking, and earning rewards

    - Miner Docs + Miner Docs
    @@ -699,7 +699,7 @@

    Clients

    Use AITBC for AI/ML workloads

    - Client Docs + Client Docs
    @@ -708,7 +708,7 @@

    Developers

    Build on AITBC and contribute

    - Developer Docs + Developer Docs diff --git a/website/wallet/index.html b/website/wallet/index.html new file mode 100644 index 00000000..859bc278 --- /dev/null +++ b/website/wallet/index.html @@ -0,0 +1,358 @@ + + + + + + AITBC Browser Wallet - Secure Crypto Wallet + + + + + +
    + + +
    +

    AITBC Browser Wallet

    +

    + The most secure way to store, send, and receive AITBC tokens. + Connect to the AITBC Trade Exchange with just one click. +

    + +
    +
    + + +
    +
    + +

    Why Choose AITBC Wallet?

    +
    +
    + +

    Bank-Grade Security

    +

    + Your private keys never leave your device. + Encrypted locally with military-grade security. +

    +
    +
    + +

    Seamless dApp Integration

    +

    + Connect to any AITBC-powered dApp with a single click. + No more copying and pasting addresses. +

    +
    +
    + +

    Lightning Fast

    +

    + Built for performance. + Instant transactions and real-time balance updates. +

    +
    +
    +
    +
    + + +
    +
    +

    Install for Chrome / Edge / Brave

    + +
    +
    +

    + + Chrome Installation Steps +

    + +
    +
    +
    1
    +
    +

    Download the Extension

    +

    + Download the AITBC Wallet extension files to your computer. +

    + + + Download Chrome Extension + +
    +
    + +
    +
    2
    +
    +

    Open Chrome Extensions

    +

    + Open Chrome and navigate to the extensions page: +

    +
    chrome://extensions/
    +
    +
    + +
    +
    3
    +
    +

    Enable Developer Mode

    +

    + Toggle the "Developer mode" switch in the top right corner. +

    +
    +
    + +
    +
    4
    +
    +

    Load Extension

    +

    + Click "Load unpacked" and select the aitbc-wallet folder. +

    +
    +
    + +
    +
    5
    +
    +

    Start Using!

    +

    + Click the AITBC Wallet icon in your toolbar to create or import an account. +

    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +

    Install for Firefox

    + +
    +
    +

    + + Firefox Installation Steps +

    + +
    +
    +
    1
    +
    +

    Visit Install Page

    +

    + Click the button below to go to the Firefox installation page. +

    + + + Install Firefox Extension + +
    +
    + +
    +
    2
    +
    +

    Click "Add to Firefox"

    +

    + On the install page, click the "Add to Firefox" button to install the extension. +

    +
    +
    + +
    +
    3
    +
    +

    Start Using!

    +

    + The AITBC Wallet will appear in your toolbar with an orange icon. Click to create your first account! +

    +
    +
    +
    +
    +
    +
    +
    + + +
    +
    +

    Using Your AITBC Wallet

    + +
    +
    +

    + + Create a New Wallet +

    +
      +
    1. 1. Click the AITBC Wallet icon
    2. +
    3. 2. Select "Create New Account"
    4. +
    5. 3. Securely save your private key
    6. +
    7. 4. Your wallet is ready!
    8. +
    +
    + +
    +

    + + Import Existing Wallet +

    +
      +
    1. 1. Click the AITBC Wallet icon
    2. +
    3. 2. Select "Import Private Key"
    4. +
    5. 3. Enter your private key
    6. +
    7. 4. Access your restored wallet
    8. +
    +
    + +
    +

    + + Connect to Exchange +

    +
      +
    1. 1. Visit AITBC Exchange
    2. +
    3. 2. Toggle to "Real Mode"
    4. +
    5. 3. Click "Connect AITBC Wallet"
    6. +
    7. 4. Approve the connection
    8. +
    +
    + +
    +

    + + Send & Receive Tokens +

    +
      +
    1. 1. Click "Send" to transfer tokens
    2. +
    3. 2. Click "Receive" to get your address
    4. +
    5. 3. All transactions require confirmation
    6. +
    7. 4. View history in the wallet
    8. +
    +
    +
    +
    +
    + + +
    +
    +

    Security Best Practices

    + +
    +
    +

    + + Important Security Reminders +

    + +
      +
    • + + Never share your private key - Anyone with your private key has full control of your funds +
    • +
    • + + Backup your private key - Write it down and store it in a secure, offline location +
    • +
    • + + Verify URLs - Always ensure you're on aitbc.bubuit.net before connecting +
    • +
    • + + Use a password manager - Protect your browser with a strong, unique password +
    • +
    • + + Keep updated - Regularly update your browser and the wallet extension +
    • +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +

    AITBC Wallet

    +

    + The secure browser wallet for AITBC tokens +

    +
    +
    +

    Quick Links

    + +
    +
    +

    Support

    +

    + Need help? Check our documentation or create an issue on GitHub. +

    +
    +
    +
    +

    © 2026 AITBC. All rights reserved.

    +
    +
    +
    + + + + +