CLI
The Protokit CLI is a comprehensive command-line interface for managing Protokit applications, environments, and blockchain interactions. It provides tools for development, deployment, and network operations.
Installation
# Install the CLI globally
pnpm add -g @proto-kit/cli
# Install the CLI locally in your project
pnpm add @proto-kit/cliUsage:
- Global:
protokit <command> - Local:
pnpm protokit <command> - Without installation:
pnpm dlx @proto-kit/cli <command>
Note: When you create a new project using the
initcommand or clone the starter-kit, the CLI comes pre-installed in the root directory. In this case, usepnpm protokit <command>to run CLI commands.
Environment Configuration
The CLI supports three methods for passing environment variables and configuration. If none is specified, it defaults to the development environment.
--env-path (File-based)
Load environment variables from environment file. If this is not specified, the CLI will first try to load scripts.env, and if not found, will fall back to .env:
protokit settlement deploy --env-path ./my-config/.envExample .env file:
PROTOKIT_SETTLEMENT_CONTRACT_PRIVATE_KEY=EK...
MINA_NETWORK=lightnet
PROTOKIT_FAUCET_KEY=EK...Help & Support
View help for any command:
# General help
protokit --help
# Command-specific help
protokit <command> --helpCommands
Environment & Setup
init [name]
Creates a new Protokit project from the starter-kit template.
Parameters:
[name]- Directory name for the new project (default:starter-kit)
Examples:
# Create project in ./starter-kit directory
protokit init
# Create project in ./my-app directory
protokit init my-appwizard
Creates a new environment configuration with an interactive guided setup wizard.
protokit wizardNote: This command must be run inside a starter-kit instance.
Network & Development Tools
run generate-keys [count]
Generates private/public key pairs for development and testing.
Parameters:
[count]- Number of key pairs to generate (default: 1)
Examples:
# Generate 1 key pair
protokit run generate-keys
# Generate 2 key pairs
protokit run generate-keys 2Output format:
Generated 2 keys for development purposes:
----------------------------------------------------------------------
Private key: EKEQVH5EfLP8rnN2kD3qR2YpkBKyTjWrSjUwMBBJjRVzKZgKCXw2
Public key: B62qjS4gJFf38pRxSogswg5A6e7gLLaFr7cpXr62KnXb8Ykwsnpu9uB
----------------------------------------------------------------------
Private key: EKDnWXkKTN4sAgejDX97Ryynj9RfrRpPjTYjwqhYtY45ZRcVa2UD
Public key: B62qqaPbdLYnzdw4pYCLrQ6ZM4cUeoPGd9MudGXUrAysSjGspGncDm1
----------------------------------------------------------------------lightnet
Utilities for working with Lightnet (Mina’s local network environment).
lightnet wait
Waits for the Lightnet network to be ready before proceeding with other operations.
protokit lightnet waitUseful when starting Lightnet in a separate process and need to ensure it’s fully initialized before running tests or deployments.
Bridge Operations
Bridge commands handle token transfers between chains.
bridge deposit <tokenId> <fromKey> <toKey> <amount>
Deposits tokens to the bridge contract.
Parameters:
<tokenId>- Token identifier<fromKey>- Sender’s private key (or environment variable name)<toKey>- Recipient’s public key (or environment variable name)<amount>- Amount to deposit
Example:
protokit bridge deposit 1 SENDER_KEY RECIPIENT_KEY 100Settlement
Settlement commands handle contract deployment and token management for settlement operations.
settlement deploy
Deploys the necessary settlement contracts required for your app-chain to interact with settlement layers.
protokit settlement deployExplorer
See the dedicated Explorer documentation for detailed setup and configuration instructions.
explorer start
Starts the Protokit Explorer web interface.
Options:
-p, --port- Port to run on (default: 5003)--indexer-url- GraphQL endpoint URL for the indexer--dashboard-title- Title for the explorer dashboard--dashboard-slogan- Slogan for the explorer--explorer-image- Docker image to use for explorer UI
Examples:
# Start on default port with default indexer
protokit explorer start
# Custom port and indexer URL
protokit explorer start -p 3000 --indexer-url http://localhost:8081/graphql
# Full customization
protokit explorer start \
-p 3000 \
--indexer-url http://localhost:8081/graphql \
--dashboard-title "My Explorer" \
--dashboard-slogan "Explore my app-chain"Developer Utilities
summary
Displays a summary of circuits in your app-chain.
Note: This command must be run inside a starter-kit instance.
protokit summaryUseful for understanding the structure and configuration of your compiled circuits.
generate-gql-docs
Generates GraphQL documentation for the GraphQL queries and mutations exposed by your sequencer.
protokit generate-gql-docs