### Install EZKL CLI using Bash Script Source: https://docs.ezkl.xyz/getting-started/installation Installs the EZKL command-line interface binary using a provided bash script. This is a straightforward method for quick setup. ```bash curl https://raw.githubusercontent.com/zkonduit/ezkl/main/install_ezkl_cli.sh | bash ``` -------------------------------- ### Run EZKL Setup using CLI Source: https://docs.ezkl.xyz/getting-started/setup Generates the necessary cryptographic proving and verification keys ('pk.key', 'vk.key') after the circuit has been compiled and settings are configured. This completes the setup phase. ```bash ezkl setup ``` -------------------------------- ### Generate EZKL Settings using CLI Source: https://docs.ezkl.xyz/getting-started/setup Creates a default 'settings.json' configuration file based on the provided ONNX model. This is the first step in the EZKL setup process. ```bash ezkl gen-settings ``` -------------------------------- ### Build EZKL CLI from Source Source: https://docs.ezkl.xyz/getting-started/installation Builds the EZKL command-line interface from its source code. This method involves cloning the repository and using Cargo to install. It requires Rust and Cargo to be installed. ```bash git clone git@github.com:zkonduit/ezkl.git cd ezkl cargo install --force --path . ``` -------------------------------- ### Compile EZKL Circuit using CLI Source: https://docs.ezkl.xyz/getting-started/setup Converts the ONNX model into an optimized format ('network.ezkl') specifically for zero-knowledge proof generation. This is a core step in the EZKL setup. ```bash ezkl compile-circuit ``` -------------------------------- ### Example Solidity Contract for EZKL Verification Source: https://docs.ezkl.xyz/getting-started/verify An example of a Solidity smart contract demonstrating how to integrate and use an EZKL-generated verifier contract. It shows how to initialize the verifier, process a proof with public inputs, and handle the verification result. ```solidity // Example Solidity contract integrating EZKL verification contract MyContract { IEZKLVerifier public verifier; constructor(address _verifierAddress) { verifier = IEZKLVerifier(_verifierAddress); } function processProof(bytes calldata proof, uint256[] calldata publicInputs) external { bool isValid = verifier.verify(proof, publicInputs); require(isValid, "Invalid proof"); // Continue with contract logic for valid proofs // ... } } ``` -------------------------------- ### Lilith REST API: Chain Witness Generation and Proof Source: https://docs.ezkl.xyz/products Provides an example of using the Lilith REST API to chain multiple commands, specifically witness generation and proof creation, in a single request. It also shows how to include new data for processing. ```bash curl -XPOST -H "Content-type: application/json" -d '{ "commands": [ { "ezkl_command": { "GenWitness": { "data": "input.json", "compiled_circuit": "model.compiled", "output": "witness.json" } } }, { "ezkl_command": { "Prove": { "witness": "witness.json", "compiled_circuit": "model.compiled", "pk_path": "pk.key", "proof_path": "proof.json", "proof_type": "Single", "check_mode": "UNSAFE" } } } ], "data": [ { "input_data": [ [1.514470100402832, 1.519423007965088, 1.5182757377624512, 1.5262789726257324, 1.5298409461975098] ] } ] }' 'http:///recipe?callback_url=' ``` -------------------------------- ### Export PyTorch Model to ONNX Source: https://docs.ezkl.xyz/getting-started/setup Exports a PyTorch model to the ONNX format, a prerequisite for EZKL circuit compilation. Requires PyTorch and the model object. Outputs a 'network.onnx' file. ```python import torch.onnx dummy_input = torch.randn(1, 3, 224, 224) # Adjust input dimensions as needed torch.onnx.export(model, dummy_input, "network.onnx", opset_version=10) ``` -------------------------------- ### Calibrate EZKL Settings using CLI Source: https://docs.ezkl.xyz/getting-started/setup Optimizes the 'settings.json' file for either accuracy or resource usage. This step is optional but recommended for performance tuning. Use '--target accuracy' or '--target resources'. ```bash ezkl calibrate-settings ``` -------------------------------- ### Download Structured Reference String (SRS) using EZKL CLI Source: https://docs.ezkl.xyz/getting-started/setup Fetches the public Structured Reference String (SRS) required for EZKL operations using the command-line interface. This SRS is a common cryptographic element. ```bash ezkl get-srs ``` -------------------------------- ### Export TensorFlow Model to ONNX Source: https://docs.ezkl.xyz/getting-started/setup Converts a TensorFlow Keras model to the ONNX format using tf2onnx. This is necessary before compiling the model for EZKL. Requires tf2onnx library. Outputs a 'network.onnx' file. ```python import tf2onnx onnx_model, _ = tf2onnx.convert.from_keras(model) with open("network.onnx", "wb") as f: f.write(onnx_model.SerializeToString()) ``` -------------------------------- ### EZKL Python Bindings for Proof Generation Source: https://docs.ezkl.xyz/index Demonstrates using EZKL's Python library to generate settings, compile an ONNX model into an EZKL-compatible format, and generate a proof. Requires the 'ezkl' Python package. ```python import ezkl settings = ezkl.gen_settings() ezkl.compile_model("model.onnx", "compiled_model.ezkl", settings) proof = ezkl.prove("witness.json", "compiled_model.ezkl", "pk.key") ``` -------------------------------- ### EZKL JavaScript Bindings for Proof Generation Source: https://docs.ezkl.xyz/index Shows how to use EZKL's JavaScript bindings to generate settings, compile a model, and create a proof. Suitable for web developers and Node.js environments. Requires the 'ezkl' npm package. ```javascript const ezkl = require('ezkl'); const settings = await ezkl.genSettings(); await ezkl.compileModel('model.onnx', 'compiled_model.ezkl', settings); const proof = await ezkl.prove('witness.json', 'compiled_model.ezkl', 'pk.key'); ``` -------------------------------- ### Lilith CLI: Prove with Callback URL Source: https://docs.ezkl.xyz/products Demonstrates how to initiate a proof generation with Lilith and specify a callback URL. The proof will be sent to this URL upon completion, avoiding the need for polling. ```bash lilith prove --callback_url ``` -------------------------------- ### EZKL Rust Bindings for Proof Generation Source: https://docs.ezkl.xyz/index Illustrates using EZKL directly within Rust projects for low-level control and maximum performance. This involves generating settings, compiling models, and generating proofs using Rust functions. Requires the 'ezkl' Rust crate. ```rust use ezkl; let settings = ezkl::gen_settings()?; ezkl::compile_model("model.onnx", "compiled_model.ezkl", &settings)?; let proof = ezkl::prove("witness.json", "compiled_model.ezkl", "pk.key")?; ``` -------------------------------- ### EZKL CLI: Generate Witness and Prove Source: https://docs.ezkl.xyz/products Demonstrates the basic command-line interface commands for generating a witness and then proving it using the ezkl library. These commands are typically run locally. ```bash ezkl gen-witness ezkl prove ``` -------------------------------- ### Lilith CLI: Orchestrate Witness Generation and Proof Source: https://docs.ezkl.xyz/products Shows how to use the Lilith CLI to perform equivalent operations to the ezkl CLI, namely generating a witness and proving. Lilith is used for remote, scaled operations. ```bash lilith job gen-witness lilith job prove ``` -------------------------------- ### EZKL CLI Commands Source: https://docs.ezkl.xyz/index Basic EZKL commands for generating settings, compiling models, and creating proofs via the command-line interface. Ideal for scripting and quick operations. ```bash ezkl gen-settings ezkl compile-model ezkl prove ``` -------------------------------- ### Verify EZKL Proof using CLI Source: https://docs.ezkl.xyz/getting-started/verify This command verifies a zero-knowledge proof using the provided artifacts via the EZKL command-line interface. Ensure all necessary files like proof.json, vk.key, settings.json, and kzg.srs are accessible. ```bash ezkl verify ``` -------------------------------- ### Generate EVM Verifier Contract with EZKL Source: https://docs.ezkl.xyz/getting-started/verify Generates a Solidity verifier contract for EVM-compatible chains using the EZKL CLI. This contract can be deployed to verify proofs on-chain. Alternatively, the 'archon' tool can be used for job creation and artifact downloading. ```bash ezkl create-evm-verifier ``` ```bash # you can also run it on the proving cluster archon job -a test create-evm-verifier archon download-artifact -a test -f evm_deploy.sol ``` -------------------------------- ### Handle EZKL Verification Result in Solidity Source: https://docs.ezkl.xyz/getting-started/verify Illustrates how to handle the boolean output from an EZKL verifier contract within a Solidity smart contract. It checks if the proof is valid and proceeds with specific logic or reverts the transaction if the proof is invalid. ```solidity IEZKLVerifier verifier = IEZKLVerifier(verifierAddress); bool isValid = verifier.verify(proof, publicInputs); if (isValid) { // Proof is valid - proceed with contract logic emit ProofVerified(msg.sender); // ... additional logic ... } else { // Proof is invalid - handle accordingly revert("Invalid proof"); } ``` -------------------------------- ### Lilith CLI: Query Job Status Source: https://docs.ezkl.xyz/products Illustrates how to check the status of a job submitted to the Lilith orchestrator using its unique job ID. This is essential for monitoring remote proof generation tasks. ```bash lilith get -i ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.