Basic Prover Example

A minimal example of generating a temporal ordering proof.

This example creates a small batch, generates a proof, and prints the proof metadata.

Full example

RUST
use fairseq_sdk::{Config, Prover, Transaction};
use std::time::{SystemTime, UNIX_EPOCH};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = Config::default();
    let prover = Prover::new(config).await?;

    let now = SystemTime::now()
        .duration_since(UNIX_EPOCH)?
        .as_nanos() as u64;

    let transactions = vec![
        Transaction::new("0xabc123", now),
        Transaction::new("0xdef456", now + 100_000_000), // +100ms
        Transaction::new("0x789ghi", now + 200_000_000), // +200ms
    ];

    let proof = prover.prove(transactions).await?;

    println!("Proof ID: {}", proof.id);
    println!("Proof Hash: {}", proof.proof_hash);
    println!("Time beacon anchor: {}", proof.lighthouse_anchor);

    Ok(())
}

Expected output

TEXT
Proof ID: 550e8400-e29b-41d4-a716-446655440000
Proof Hash: 0x...
Time beacon anchor: 0x...

Running the example

BASH
cargo run

What this does

  1. Builds an ordered batch of transactions.
  2. Generates a temporal ordering proof.
  3. Prints the proof identifiers for publishing or verification.
Was this page helpful? /
Back to docs