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
- Executor holds encrypted strategy bounds (ciphertexts only)
- Oracle price encoded and compared homomorphically
- Encrypted result bit returned to client
- Browser decrypts with FHE client key
- User signs execution authorization if triggered
Note lifecycle
Notes use three-state spent tracking: false → pending → true
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.