Skip to main content

Crate blueprint_tangle_aggregation_svc

Crate blueprint_tangle_aggregation_svc 

Source
Expand description

Tangle BLS Signature Aggregation Service

A simple HTTP service that collects BLS signatures from operators, aggregates them once threshold is met, and provides the aggregated result for submission to the Tangle contract.

§Architecture

Operator 1 ──┐
Operator 2 ──┼──▶ Aggregation Service ──▶ Aggregated Result
Operator 3 ──┘         │
                       ▼
                 Tangle Contract

§Usage

§Starting the service

use blueprint_tangle_aggregation_svc::{AggregationService, api, ServiceConfig};
use std::sync::Arc;

#[tokio::main]
async fn main() {
    let service = Arc::new(AggregationService::new(ServiceConfig::default()));
    let app = api::router(service);

    let listener = tokio::net::TcpListener::bind("0.0.0.0:8080").await.unwrap();
    axum::serve(listener, app).await.unwrap();
}

§API Endpoints

  • POST /v1/tasks/init - Initialize an aggregation task
  • POST /v1/tasks/submit - Submit a signature
  • POST /v1/tasks/status - Get task status
  • POST /v1/tasks/aggregate - Get aggregated result

§Operator Flow

  1. Someone (often the first operator) initializes the task
  2. Each operator signs the output and submits their signature
  3. Once threshold is met, anyone can fetch the aggregated result
  4. Submit the aggregated result to the Tangle contract

Re-exports§

pub use persistence::FilePersistence;
pub use persistence::NoPersistence;
pub use persistence::PersistedTaskState;
pub use persistence::PersistedThresholdType;
pub use persistence::PersistenceBackend;
pub use persistence::PersistenceError;
pub use service::create_signing_message;
pub use service::AggregationService;
pub use service::CleanupWorkerHandle;
pub use service::ServiceConfig;
pub use service::ServiceError;
pub use service::ServiceStats;
pub use state::AggregationState;
pub use state::OperatorInfo;
pub use state::TaskConfig;
pub use state::TaskCounts;
pub use state::TaskForAggregation;
pub use state::TaskState;
pub use state::TaskStatus;
pub use state::ThresholdType;
pub use types::*;

Modules§

api
HTTP API endpoints for the aggregation service
persistence
Persistence layer for aggregation state
service
Main aggregation service logic
state
In-memory aggregation state management
types
Request and response types for the aggregation service API

Functions§

run
Run the aggregation service