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 taskPOST /v1/tasks/submit- Submit a signaturePOST /v1/tasks/status- Get task statusPOST /v1/tasks/aggregate- Get aggregated result
§Operator Flow
- Someone (often the first operator) initializes the task
- Each operator signs the output and submits their signature
- Once threshold is met, anyone can fetch the aggregated result
- 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