Page cover

TFHE Programs with Sunscreen

circle-info

Looking for a quick start? To run the complete flow end-to-end using example code, follow the Demo Tutorial.

The page below describes each step in detail and links to the relevant documentation.

Prerequisites

Lattica's documentation assumes you have already compiled a TFHE program using Sunscreen.

triangle-exclamation

Lattica helps deploy a TFHE program, control who can use it, and run it on workers so that your users can submit encrypted queries and receive encrypted results.

circle-exclamation

Who Does What?

Program Owner (you / your team)

1

Creates a Lattica account (credits + billing + ownership)

  1. Sign-up/sign-inarrow-up-right to the Lattica Console (your team’s admin should do this).

  2. In the Console, locate and download/copy your licensearrow-up-right.

  3. Store it securely (Management Client and Query Client use depends on it).

circle-info

Finance and account management are handled in the Console. Most technical operations can be done either in the Console or via the Management Client.

2

Deploys the compiled program

circle-exclamation
3

Creates access tokens for users

Access tokensarrow-up-right are for users to use in the Query Client. Tokens are:

  • Model/program-specific. Each token grants permission to run queries on a specific program.

  • Time-limited (currently 30 days).

  • Not retrievable later (copy and store them securely when created).

Create tokens here: How‑To: Create User Access Token.arrow-up-right

circle-info

Treat tokens like passwords. Distribute them over a secure channel (never hard-code in public client apps).

4

Buys credits (for workers to run)

Lattica uses a credit system:

  • Credits are consumed based on worker active runtime.

  • Workers stop when credits run out.

Start with:

See Pricing for current compute rates and available packages.

5

Starts/stops workers (required to process queries)

Your program can process queries only when a worker is running. Start instructions: How‑To: Start Worker.arrow-up-right

6

Stops workers when idle (to control cost)

Because billing is runtime-based, you should stop workers when they’re not needed.

Stop instructions: How‑To: Stop Worker.arrow-up-right

circle-info

Rule of thumb: If there are no queries expected for a while → stop the worker → start it again before next usage.

End User (your customer / your app / your users)

circle-info

Two things must be true before a user can run a query:

  1. The user has an access token for this program.

  2. At least one worker is running (and your account has enough credits).

1

Installs the Query Client (once)

Using an access token you provide.

Install instructions: How‑To: Install Query Client.arrow-up-right

2

Generates keys locally (secret key stay local)

Each user generates:

  • A Secret Key (stays on the user's machine).

  • An Evaluation Key (uploaded to Lattica so encrypted computation can run).

This is a one-time setup per user/program in normal usage.

Follow: How‑To: Upload Evaluation Key.arrow-up-right

3

Runs encrypted queries (encrypt → execute → decrypt)

For each query, the client performs the following steps:

  1. Encrypts arrow-up-rightthe input locally.

  2. Executes arrow-up-rightthe encrypted query on the Lattica backend.

  3. Decrypts arrow-up-rightthe encrypted result locally.

These three steps can be executed either separately or as a single commandarrow-up-right, depending on integration needs.

For a high-level view of how the client and backend interact, see: Query Submission (workflow overview)arrow-up-right

Last updated