krnl-cli

1.0.1 • Public • Published

KRNL CLI

A command-line interface for the KRNL platform that simplifies deploying and registering smart contracts.

Features

  • Simple, guided setup process
  • Project initialization with contract templates
  • Automated deployment of Token Authority and Main contracts
  • Contract verification on Sourcify and Etherscan
  • Platform registration with the KRNL registry
  • Self-contained with bundled Hardhat - no external dependencies required

Installation

Global Installation

npm install -g krnl-cli

Local Development

# Clone the repository
git clone https://github.com/your-org/krnl-cli.git
cd krnl-cli

# Install dependencies
npm install

# Build the CLI
npm run build

# Create a global link for development
npm link

Usage

Initialize a New Project

# Create a new directory for your project
mkdir my-krnl-project
cd my-krnl-project

# Initialize with KRNL CLI
krnl init

Configure Environment

# Set up environment variables and wallet
krnl setup

Deploy Contracts

# Deploy Token Authority contract
krnl deploy-ta

# Deploy Main contract
krnl deploy-main

# Register contracts with the KRNL platform
krnl register

# Or run the entire process at once
krnl deploy-all

Project Structure

When you initialize a new project with krnl init, it creates the following structure:

my-krnl-project/
├── contracts/
│   ├── TokenAuthority.sol
│   ├── KRNL.sol
│   └── Sample.sol
├── hardhat.config.ts
├── package.json
├── .gitignore
├── .env.example
└── README.md

Configuration

The CLI uses a .env file for configuration. Run krnl setup to create and configure this file. Key configuration options include:

  • PRIVATE_KEY_OASIS: Private key for Oasis Sapphire testnet
  • PRIVATE_KEY_SEPOLIA: Private key for Sepolia testnet
  • KERNEL_ID: Kernel IDs to use for registration
  • ETHERSCAN_API_KEY: API key for contract verification

Commands

  • krnl init [directory] - Initialize a new KRNL project
  • krnl setup - Configure environment variables and create wallets
  • krnl deploy-ta - Deploy Token Authority contract
  • krnl deploy-main - Deploy Main contract
  • krnl register - Register contracts with the KRNL platform
  • krnl deploy-all - Run the entire deployment process

Development

Project Structure

krnl-cli/
├── bin/
│   └── cli.js              # CLI entry point
├── src/
│   ├── commands/           # CLI command implementations
│   ├── core/               # Core blockchain logic
│   └── ui/                 # UI utilities
├── templates/
│   └── project/            # Project templates
│       └── contracts/      # Smart contract templates
├── package.json
└── tsconfig.json

Building

npm run build

Testing

npm test

License

MIT

Package Sidebar

Install

npm i krnl-cli

Weekly Downloads

48

Version

1.0.1

License

MIT

Unpacked Size

227 kB

Total Files

69

Last publish

Collaborators

  • speedkrnl
  • reiss-krnl
  • ash20pk