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-cliQuick Start
# Initialize a new KRNL project
krnl init --name my-project
# Compile contracts
krnl compile
# Deploy to a network
krnl deploy --network sepoliaKRNL CLI Commands
krnl init – Initialize a project
krnl init – Initialize a projectCreates a new KRNL project with the default template. Sets up Foundry, installs dependencies, and generates .env.
Options:
-t, --template <template>
Template to use
default
-n, --name <name>
Project name
—
Example:
krnl init --name my-krnl-project
cd my-krnl-projectkrnl compile – Compile contracts
krnl compile – Compile contractsCompiles smart contracts with auto-detection of source and output directories.
Options:
-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 ./outkrnl deploy – Deploy contracts
krnl deploy – Deploy contractsDeploys contracts using Foundry scripts. Auto-detects network from .env and foundry.toml. Supports optional verification.
Options:
-n, --network <network>
Deployment network
localhost
--script <pathOrTarget>
Forge script path
script/Deploy.s.sol
--verify
Verify contract on explorer. requires --contract
—
--verify-all
Verify all the contract being deployed using the script on explorer
—
--contract <name>
Contract name to verify (required with --verify and --script)
—
--constructor-args <args>
Constructor arguments for verification (if needed)
—
Example:
# Deploy using default script to sepolia
krnl deploy --network sepolia
# Deploy with verification of a specific contract
krnl deploy --network sepolia --verify --contract RealEstateInvestment
# Deploy with verification of all contracts in script
krnl deploy --network sepolia --verify --verify-all
# Use custom script with specific contract target
krnl deploy --network sepolia --script "script/Deploy.s.sol:DeployRealEstateScript" --verify --contract RealEstateInvestment
# Use custom script and verify all the contracts
krnl deploy --network sepolia --script "script/Deploy.s.sol:DeployRealEstateScript" --verify-all
# Deploy to localhost (requires Anvil running)
krnl deploy --network localhostKRNL CLI: Create Attestor
krnl create-attestor – Generate a verification attestor
krnl create-attestor – Generate a verification attestorCreates a Docker-based attestor for contract verification. Attestors are required to submit proof-enabled actions on KRNL Protocol workflows.
Usage:
krnl create-attestorThis 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

