Overview

KRNL CLI Overview

KRNL CLI is a command-line tool for developing, compiling, and deploying smart contracts using the KRNL Protocol. It simplifies project setup, manages Foundry installation, and provides commands for verification attestors.

Key Features

  • Project initialization with Foundry setup

  • Smart contract compilation with auto-detected directories

  • Deployment via Forge scripts with network detection and optional verification

  • Attestor creation for verification and proof workflows

Installation

Install globally using npm:

npm install -g @krnl-dev/krnl-cli

Quick Start

# Initialize a new KRNL project
krnl init --name my-project

# Compile contracts
krnl compile

# Deploy to a network
krnl deploy --network sepolia

KRNL CLI Commands

krnl init – Initialize a project

Creates a new KRNL project with the default template. Sets up Foundry, installs dependencies, and generates .env.

Options:

Flag
Description
Default

-t, --template <template>

Template to use

default

-n, --name <name>

Project name

Example:

krnl init --name my-krnl-project
cd my-krnl-project

krnl compile – Compile contracts

Compiles smart contracts with auto-detection of source and output directories.

Options:

Flag
Description

-c, --contracts <path>

Contracts directory (optional)

-o, --output <path>

Output directory (optional)

-p, --project-dir <path>

Project root (optional)

Example:

krnl compile
krnl compile -c ./src -o ./out

krnl deploy – Deploy contracts

Deploys contracts using Foundry scripts. Auto-detects network from .env and foundry.toml. Supports optional verification.

Options:

Flag
Description
Default

-n, --network <network>

Deployment network

localhost

--script <pathOrTarget>

Forge script path

script/Deploy.s.sol

--verify

Verify contract on explorer

Example:

krnl deploy --network sepolia
krnl deploy --network sepolia --verify
krnl deploy --network sepolia --script script/DeployCustom.s.sol

KRNL CLI: Create Attestor

krnl create-attestor – Generate a verification attestor

Creates a Docker-based attestor for contract verification. Attestors are required to submit proof-enabled actions on KRNL Protocol workflows.

Usage:

krnl create-attestor

This command executes the included create-attestor-standalone.sh script.

Notes:

  • Requires Docker installed and running

  • Automatically sets up the attestor environment for standalone usage

  • Can be used in CI/CD pipelines for automated attestor generation

Last updated