diff --git a/examples/README.md b/examples/README.md new file mode 100644 index 00000000..982e9950 --- /dev/null +++ b/examples/README.md @@ -0,0 +1,206 @@ +# AITBC Configuration Examples + +This directory contains example configuration files for setting up AITBC nodes in various scenarios. + +## Quick Start for Open Island + +To quickly join the hub.aitbc.bubuit.net open island: + +```bash +# Copy the pre-configured open island examples +sudo cp /opt/aitbc/examples/blockchain.env.open-island /etc/aitbc/blockchain.env +sudo cp /opt/aitbc/examples/node.env.open-island /etc/aitbc/node.env + +# Start services +sudo systemctl start aitbc-blockchain-node aitbc-blockchain-p2p + +# Verify connection +curl http://localhost:8006/health +``` + +For detailed instructions, see: [Open Island Joining Guide](../docs/hermes/guides/open-island-joining-guide.md) + +## Configuration Files + +### blockchain.env.open-island +Pre-configured blockchain environment file for joining the hub.aitbc.bubuit.net open island. + +**Use case:** Quick setup for nodes joining the open test island. + +**Key settings:** +- Chain ID: `ait-hub.aitbc.bubuit.net` +- P2P peers: `hub.aitbc.bubuit.net:8001` +- Block production: disabled (follower node) +- RPC port: 8006 +- P2P port: 8001 + +**Setup:** +```bash +sudo cp /opt/aitbc/examples/blockchain.env.open-island /etc/aitbc/blockchain.env +``` + +### node.env.open-island +Pre-configured node environment file for joining the hub.aitbc.bubuit.net open island. + +**Use case:** Node-specific configuration for open island nodes. + +**Key settings:** +- Island ID: `ait-hub.aitbc.bubuit.net-island` +- Node role: follower +- P2P bind port: 8001 + +**Setup:** +```bash +sudo cp /opt/aitbc/examples/node.env.open-island /etc/aitbc/node.env +``` + +### blockchain.env.example +General blockchain environment template for custom deployments. + +**Use case:** Custom blockchain deployments with specific requirements. + +**Setup:** +```bash +sudo cp /opt/aitbc/examples/blockchain.env.example /etc/aitbc/blockchain.env +# Edit /etc/aitbc/blockchain.env with your custom settings +``` + +### node.env.example +General node environment template for custom deployments. + +**Use case:** Custom node configurations with specific requirements. + +**Setup:** +```bash +sudo cp /opt/aitbc/examples/node.env.example /etc/aitbc/node.env +# Edit /etc/aitbc/node.env with your custom settings +``` + +### .env.example +Legacy environment file template (deprecated). + +**Note:** AITBC now uses `blockchain.env` and `node.env` instead of `.env`. This file is kept for reference only. + +### deploy.env.example +Deployment-specific environment template. + +**Use case:** Production deployment configurations. + +## Configuration File Structure + +AITBC uses two main configuration files: + +### /etc/aitbc/blockchain.env +Contains blockchain-specific environment variables: +- Chain ID and network configuration +- RPC and P2P binding settings +- Database and Redis connections +- Block production settings +- Gossip and sync configuration + +### /etc/aitbc/node.env +Contains node-specific environment variables: +- Node ID and island ID +- Node role (genesis/follower) +- P2P port configuration +- Node-specific settings + +**Important:** AITBC does NOT use `/etc/aitbc/.env`. All configuration should be in `blockchain.env` and `node.env`. + +## Open Island Configuration + +The hub.aitbc.bubuit.net open island is a test environment for AITBC software. Any agent can join this island to test blockchain functionality, P2P networking, and hermes agent coordination. + +**Hub Details:** +- Host: hub.aitbc.bubuit.net (95.216.198.140) +- Chain ID: `ait-hub.aitbc.bubuit.net` +- Island ID: `ait-hub.aitbc.bubuit.net-island` +- P2P Port: 8001 +- RPC Port: 8006 +- Access: Open - no authentication required + +**Quick Setup:** +```bash +# Clone repository +git clone https://gitea.bubuit.net/oib/aitbc.git /opt/aitbc +cd /opt/aitbc + +# Install dependencies +python3 -m venv venv +source venv/bin/activate +pip install -e cli/ +pip install -e apps/blockchain-node/ + +# Copy open island configuration +sudo cp examples/blockchain.env.open-island /etc/aitbc/blockchain.env +sudo cp examples/node.env.open-island /etc/aitbc/node.env + +# Create keystore +sudo mkdir -p /var/lib/aitbc/keystore +echo 'test123' | sudo tee /var/lib/aitbc/keystore/.password +sudo chmod 600 /var/lib/aitbc/keystore/.password + +# Start services +sudo systemctl start aitbc-blockchain-node aitbc-blockchain-p2p + +# Verify +curl http://localhost:8006/health +``` + +## Documentation + +- [Open Island Joining Guide](../docs/hermes/guides/open-island-joining-guide.md) - Complete guide for joining the open island +- [hermes Agent Guide](../docs/hermes/guides/hermes-open-island-guide.md) - hermes-specific instructions for agents +- [Setup Documentation](../docs/deployment/SETUP.md) - General AITBC setup guide +- [Configuration Files](../docs/deployment/SETUP.md#configuration-files) - Detailed configuration file documentation + +## Security Notes + +- **Test Environment:** The open island is for testing only. Do not use for production. +- **No Real Assets:** Use test wallets only. No real assets should be used. +- **Public Transactions:** All transactions on the open island are public. +- **Authentication:** No authentication required for joining the open island. + +## Troubleshooting + +### Connection Issues +```bash +# Test P2P connectivity +nc -zv hub.aitbc.bubuit.net 8001 + +# Test RPC connectivity +curl http://hub.aitbc.bubuit.net:8006/health +``` + +### Sync Issues +```bash +# Check sync status +curl http://localhost:8006/rpc/head +curl http://hub.aitbc.bubuit.net:8006/rpc/head + +# Force sync +curl -X POST http://localhost:8006/rpc/sync \ + -H "Content-Type: application/json" \ + -d '{"peer":"hub.aitbc.bubuit.net:8006"}' +``` + +### Service Issues +```bash +# Check service status +sudo systemctl status aitbc-blockchain-node +sudo systemctl status aitbc-blockchain-p2p + +# View logs +sudo journalctl -u aitbc-blockchain-node -f +sudo journalctl -u aitbc-blockchain-p2p -f +``` + +## Support + +- **Documentation:** `/opt/aitbc/docs/` +- **Issues:** https://gitea.bubuit.net/oib/aitbc +- **Community:** Join AITBC development discussions + +--- + +**Last Updated:** 2026-05-26 diff --git a/examples/blockchain.env.open-island b/examples/blockchain.env.open-island new file mode 100644 index 00000000..29ac85e1 --- /dev/null +++ b/examples/blockchain.env.open-island @@ -0,0 +1,97 @@ +# AITBC Blockchain Configuration for Open Island - hub.aitbc.bubuit.net +# Copy this file to /etc/aitbc/blockchain.env to join the open island +# This configuration is pre-configured for the hub.aitbc.bubuit.net open island + +# ========================= +# Chain Configuration +# ========================= +# Chain ID for the open island +CHAIN_ID=ait-hub.aitbc.bubuit.net +SUPPORTED_CHAINS=ait-hub.aitbc.bubuit.net + +# ========================= +# RPC Configuration +# ========================= +# RPC binding settings +RPC_BIND_HOST=0.0.0.0 +RPC_BIND_PORT=8006 + +# ========================= +# P2P Configuration +# ========================= +# P2P binding settings +p2p_bind_host=0.0.0.0 +p2p_bind_port=8001 + +# P2P node identity (auto-generated, or set manually) +p2p_node_id=node-$(cat /proc/sys/kernel/random/uuid | tr -d '-') + +# P2P peers - connect to the open island hub +p2p_peers=hub.aitbc.bubuit.net:8001 + +# Genesis node for sync +genesis_node=hub.aitbc.bubuit.net:8006 + +# ========================= +# Block Production +# ========================= +# Set to false for follower nodes (recommended for open island) +ENABLE_BLOCK_PRODUCTION=false + +# Block production chains (only if ENABLE_BLOCK_PRODUCTION=true) +BLOCK_PRODUCTION_CHAINS=ait-hub.aitbc.bubuit.net + +# Proposer ID (only if ENABLE_BLOCK_PRODUCTION=true) +# PROPOSER_ID= + +# ========================= +# Gossip Configuration +# ========================= +# Gossip backend +gossip_backend=broadcast + +# Gossip broadcast URL (local Redis) +GOSSIP_BROADCAST_URL=redis://127.0.0.1:6379 + +# ========================= +# Database Configuration +# ========================= +# Database path +db_path=/var/lib/aitbc/data/ait-hub.aitbc.bubuit.net/chain.db + +# ========================= +# Keystore Configuration +# ========================= +# Keystore path +keystore_path=/var/lib/aitbc/keystore + +# Keystore password file +keystore_password_file=/var/lib/aitbc/keystore/.password + +# ========================= +# Mempool Configuration +# ========================= +# Mempool backend +MEMPOOL_BACKEND=database + +# Mempool database URL (if using database backend) +MEMPOOL_DB_URL=postgresql+psycopg2://aitbc_mempool:aitbc_mempool_password@localhost:5432/aitbc_mempool + +# ========================= +# Setup Instructions +# ========================= +# 1. Copy this template: sudo cp /opt/aitbc/examples/blockchain.env.open-island /etc/aitbc/blockchain.env +# 2. Generate unique p2p_node_id (optional, will be auto-generated if left as-is) +# 3. Set ENABLE_BLOCK_PRODUCTION=true only if you want to be a proposer node +# 4. Ensure Redis is running: sudo systemctl start redis +# 5. Ensure PostgreSQL is running (if using database mempool): sudo systemctl start postgresql +# 6. Restart services: sudo systemctl restart aitbc-blockchain-node aitbc-blockchain-p2p +# 7. Verify connectivity: curl http://localhost:8006/health +# 8. Sync with hub: curl -X POST http://localhost:8006/rpc/sync -H "Content-Type: application/json" -d '{"peer":"hub.aitbc.bubuit.net:8006"}' + +# ========================= +# Additional Resources +# ========================= +# Open Island Guide: /opt/aitbc/docs/hermes/guides/open-island-joining-guide.md +# hermes Agent Guide: /opt/aitbc/docs/hermes/guides/hermes-open-island-guide.md +# Setup Documentation: /opt/aitbc/docs/deployment/SETUP.md diff --git a/examples/node.env.open-island b/examples/node.env.open-island new file mode 100644 index 00000000..52fa67d3 --- /dev/null +++ b/examples/node.env.open-island @@ -0,0 +1,49 @@ +# AITBC Node Configuration for Open Island - hub.aitbc.bubuit.net +# Copy this file to /etc/aitbc/node.env to join the open island +# This configuration is pre-configured for the hub.aitbc.bubuit.net open island + +# ========================= +# Node Identity +# ========================= +# Unique identifier for this node (must be different for each node) +# Auto-generate a unique ID for your node +NODE_ID=test-node-$(hostname) + +# ========================= +# Island Configuration +# ========================= +# Island ID for the open island +ISLAND_ID=ait-hub.aitbc.bubuit.net-island + +# Chain ID (must match blockchain.env) +CHAIN_ID=ait-hub.aitbc.bubuit.net + +# ========================= +# Node Role +# ========================= +# Node role: follower (recommended for open island nodes) +# Set to 'genesis' only if you are running the genesis authority node +NODE_ROLE=follower + +# ========================= +# P2P Configuration +# ========================= +# P2P bind port (must match blockchain.env p2p_bind_port) +P2P_BIND_PORT=8001 + +# ========================= +# Setup Instructions +# ========================= +# 1. Copy this template: sudo cp /opt/aitbc/examples/node.env.open-island /etc/aitbc/node.env +# 2. Edit NODE_ID to be unique for your node (optional, uses hostname by default) +# 3. Keep NODE_ROLE=follower unless you are running a genesis authority node +# 4. Ensure P2P_BIND_PORT matches blockchain.env p2p_bind_port +# 5. Restart services: sudo systemctl restart aitbc-blockchain-node aitbc-blockchain-p2p +# 6. Verify node status: curl http://localhost:8006/rpc/info + +# ========================= +# Additional Resources +# ========================= +# Open Island Guide: /opt/aitbc/docs/hermes/guides/open-island-joining-guide.md +# hermes Agent Guide: /opt/aitbc/docs/hermes/guides/hermes-open-island-guide.md +# Setup Documentation: /opt/aitbc/docs/deployment/SETUP.md