Back to Documentation

# Developer Documentation

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

## Technology Stack

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

Python
Rust
TypeScript
PostgreSQL
Docker
Kubernetes

## Getting Started

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

### Development Environment Setup

Prerequisites: Python 3.9+, Node.js 18+, Docker, Git

    # Fork & Clone
    git clone https://gitea.bubuit.net/YOUR_USERNAME/aitbc.git
    cd aitbc

    # Set up Python environment
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt

    # Set up frontend
    cd website
    npm install
    npm run dev

### Project Structure

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

## Contributing

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

### Contribution Areas

#### Bug Fixes

Find and fix bugs in any component

#### New Features

Implement new functionality

#### Documentation

Improve documentation and examples

#### Testing

Write tests and improve coverage

### Pull Request Process

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

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

- Discord: #dev channel
- GitHub: Create issues
- Email: aitbc@bubuit.net

### Developer Events

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

## Additional Resources

- Blockchain Node Documentation
- Coordinator API Reference
- Full Technical Documentation
- Developer Wiki
- Release Notes