Skip to main content
Generate proving and verifying keys for a program’s functions. This command is used to pre-generate cryptographic keys that can be reused for creating zero-knowledge proofs.

Usage

Arguments

string
required
The name of the program to synthesize, e.g., helloworld.aleo

Options

boolean
Use the local Leo project. Builds the project before synthesizing.
string[]
Skip functions that contain any of the given substrings. Can be specified multiple times.
string
Directory path to save the generated keys. Keys are not saved if not specified.
string
default:"testnet"
Network to use (mainnet, testnet, canary)
string
API endpoint URL for querying network data
string
Private key for the account (can also use PRIVATE_KEY environment variable)

Examples

Synthesize local program

Synthesize with key saving

This saves keys in the format:

Skip specific functions

Synthesize from network

Output Information

For each function, the command displays:

Key Files

When --save is specified, three files are generated per function:
  1. Prover Key - Used to generate proofs
    • Filename: {network}.{program}.{function}.{edition}.prover.{timestamp}
    • Large file (MB to GB range)
  2. Verifier Key - Used to verify proofs
    • Filename: {network}.{program}.{function}.{edition}.verifier.{timestamp}
    • Small file (KB range)
  3. Metadata - Contains checksums and sizes
    • Filename: {network}.{program}.{function}.{edition}.metadata.{timestamp}
    • JSON format

Metadata Format

Use Cases

Pre-generate Keys for Production

Generate keys once and reuse them:

Key Distribution

Distribute verifier keys to validators:

Performance Testing

Measure circuit complexity:

Performance Considerations

Key synthesis can be time and memory intensive for complex programs. Large programs may require:
  • Several GB of RAM
  • Minutes to hours of processing time
  • Multiple GB of disk space for keys
Use --skip to avoid synthesizing test or debug functions in production.

Circuit Metrics

The output provides important metrics for understanding program complexity:
  • Public Inputs - Number of public values the function accepts
  • Variables - Total circuit variables (indicates memory usage)
  • Constraints - Number of R1CS constraints (indicates proof size/time)
  • Non-Zero Entries - Sparsity of constraint matrices
  • Build - Compile programs before synthesis
  • Deploy - Deploy programs to network
  • Execute - Execute programs with proofs

Troubleshooting

Out of memory during synthesis

For large programs, increase available memory or skip functions:

Program not found on network

If synthesizing from network, ensure program is deployed:

Keys directory not writable

Ensure the save directory exists and has write permissions: