Siphon Docs
Runtime

Trade Executor & FHE

Off-chain strategy runtime and homomorphic evaluation.

The trade executor (siphon-fhe) is the off-chain runtime for encrypted strategies.

Responsibilities

  • Register strategies after on-chain execution fee payment
  • Poll Pyth price feeds on a schedule
  • Submit encrypted bounds to the FHE engine (Rust / tfhe-rs) for homomorphic comparison
  • Coordinate ZK withdraw, Uniswap swap, and note lifecycle on trigger
  • Store encrypted notes (AES-GCM) and authenticate via wallet signatures
  • Expose /vault-index/* for Merkle leaf and deposit reads

FHE evaluation flow

  1. Executor holds encrypted strategy bounds (ciphertexts only)
  2. Oracle price encoded and compared homomorphically
  3. Encrypted result bit returned to client
  4. Browser decrypts with FHE client key
  5. User signs execution authorization if triggered

Note lifecycle

Notes use three-state spent tracking: falsependingtrue

This prevents double-spend races during asynchronous execution.

Proving relayer

Optional server-side Groth16 proof generation when browser proving is impractical.

Deployment

Typically Docker on AWS alongside Postgres. Shares a database server with the indexer in production.

API authentication

Requests use wallet-signed headers (X-Wallet-Address, X-Signature, X-Timestamp) — private keys never sent to the server.

On this page