Skip to content

ApiliumCode/bootstrap-aingle

Repository files navigation

AIngle Logo

bootstrap-aingle

CloudFlare Worker bootstrap service for AIngle networks

CI Status License Node.js


Overview

A CloudFlare Worker that enables AIngle networks to bootstrap securely. This service allows new nodes to discover existing peers and join the distributed network while mitigating eclipse attacks.

Why Bootstrap?

AIngle uses a distributed Semantic Graph Data (SGD) architecture where:

  • Data is distributed across all nodes on the network
  • Nodes communicate peer-to-peer without central servers
  • New nodes need a way to find honest peers initially

The bootstrap service provides a secure entry point by:

  • Accepting signed agent information via POST API
  • Storing data in CloudFlare's key/value store with automatic expiration
  • Returning random agents to prevent targeted attacks
  • Verifying all cryptographic signatures

Installation

# Install dependencies
npm install

# Install wrangler (CloudFlare CLI)
npm install -g @cloudflare/wrangler
# or via Cargo
cargo install wrangler

# Run development server
wrangler dev

# Run tests (requires running wrangler dev)
npm test

API Reference

All API requests use HTTP POST with MessagePack binary serialization.

Operations

Op Header Description Request Response
put Store signed agent info AgentInfoSigned null
random Get random agents {space, limit} AgentInfoSigned[]
now Get server timestamp (none) number (ms)

Health Check

# GET request returns "OK"
curl https://your-worker.workers.dev

Data Structures

// Signed agent information
interface AgentInfoSigned {
  signature: Uint8Array;  // Ed25519 signature (64 bytes)
  agent: Uint8Array;      // Public key (32 bytes)
  agent_info: Uint8Array; // Serialized AgentInfo
}

// Inner agent info (after validation)
interface AgentInfo {
  space: Uint8Array;      // SGD/SAF hash
  agent: Uint8Array;      // Public key
  urls: string[];         // Network locations
  signed_at_ms: number;   // Unix timestamp
  expires_after_ms: number;
}

Security Considerations

Mitigations Included

  • Cryptographic verification - Ed25519 signatures on all data
  • Automatic expiration - Agent info expires (1 min - 1 hour)
  • Random selection - Prevents targeted eclipse attacks
  • CloudFlare protection - Built-in DDoS mitigation

Future Enhancements

  • Trust delegation model (developer-approved keys)
  • DPKI integration for identity verification
  • Audit logging for cross-reference

Deployment

  1. Fork this repository
  2. Configure wrangler.toml with your CloudFlare account
  3. Deploy: wrangler publish
  4. Point AIngle conductors to your bootstrap URL

Part of AIngle

This service is part of the AIngle ecosystem - a Semantic DAG framework for IoT and distributed AI applications.

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.


Maintained by Apilium Technologies - Tallinn, Estonia

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors