clique-cli
The Clique Command Line Interface (Clique CLI) is an open-source tool that enables you to develop, build, test, and deploy your tasks to the Clique Network.
Installation
Get Pre-built Executable from Cargo (Recommended)
If you have installed the Rust toolchain already, you can get our pre-built executable from cargo.
Build from Source
You can also build the executable yourself with the following guidelines.
Pre-requisites
- Rust-toolchain
Step-by-step Guide
Clone the Clique CLI from GitHub
Build the Binary with Cargo
Install the Built Executable to System
# Install the binary locally (recommended)
# Or if you want to install it globally
Make sure ~/.local/bin is includes in $PATH environment variable.
Develop Task
Initialize from Template
To initialize a repository, use the following command:
This command will create a project that outputs a Clique Task Manifest file containing a corresponding EVM bytecode (note that the bytecode format is different based on the VM you specify -- we plan to support WASM, RISC V, etc in the future).
How to Use
Before initialization, it is essential to establish an empty directory to serve as your workspace.
Project Structure
After initialization, the project structure is as follows:
/workspace
-- contracts
-- Main.sol
-- manifest.toml
-- foundry.toml
/contracts/Main.solis the primary Solidity smart contract source file. This file contains the core smart contract logic and functionalities within the project.manifest.tomlis a clique task metadata written in TOML, including I/O schemas, proof types, and optional code or task sections depending on the task type.foundry.tomlis a configuration file specific to the Foundry toolkit. You can use Foundry to compile and test your contracts. Foundry will also be required for the subsequent build phase to compile the contracts.
If you haven't set up the Foundry environment yet, run the following command in your terminal, then follow the onscreen instructions:
|
Upon completion of template initialization, you can modify the contract and manifest.toml.
It is important to note that the contract entry point is fixed and must be Main.sol. And the function name must be evaluate. Users can import other contracts into Main.sol.
After modifying the contracts, users should update manifest.toml with new name, input, output, and proof-compability sections according to the changes made to the contracts. The code section should be left empty, as it will be automatically populated by the CLI during build stage.
Build Task
Run the following command to build the developed task.
After build, your workspace structure should look like the following:
/workspace
-- contracts
-- Main.sol
-- tasks
-- manifest.toml
-- manifest.toml
-- foundry.toml
During the development phase, the developer has modified the contract code and manifest.toml, with the code section in manifest.toml left blank.
In the build phase, we will generate a copy of manifest.toml to tasks/manifest.toml and automatically populate the code section. We utilize the Foundry toolkit to compile the contracts and automatically populate the compiled bytecode into the newly copied manifest.toml.
Test Task (TODO: run test locally)
To test the task without publishing, run the following command:
Deploy Task
To deploy the task locally, run the following command.
To publish the task to the Clique network,