Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

genlayer

yeagerai506MIT0.20.0TypeScript support: included

GenLayer Command Line Tool

genlayer, intelligent, contract, simulator, cli

readme

GenLayer CLI

Description

The GenLayer CLI is designed to streamline the setup and local execution of the GenLayer simulator. This tool automates the process of downloading and launching the GenLayer simulator, making it easy to start simulating and testing locally with minimal setup.

Installation

Before installing the GenLayer CLI, ensure you have Node.js installed on your system. You can then install the CLI globally using npm:

npm install -g genlayer

Usage

Each command includes syntax, usage information, and examples to help you effectively use the CLI for interacting with the GenLayer environment.

Command line syntax

General syntax for using the GenLayer CLI:

genlayer command [command options] [arguments...]

Commands and usage

Initialize

Prepares and verifies your environment to run the GenLayer Studio.

USAGE:
   genlayer init [options]

OPTIONS:
   --numValidators <numValidators>       Number of validators (default: "5")
   --headless                            Headless mode (default: false)
   --reset-db                            Reset Database (default: false)
   --localnet-version <localnetVersion>  Select a specific localnet version
   --ollama                              Enable Ollama container (default: false)

EXAMPLES:
   genlayer init
   genlayer init --numValidators 10 --headless --reset-db --localnet-version v0.10.2
   genlayer init --ollama
Version Compatibility

The GenLayer CLI always uses the latest compatible version of the environment, ensuring that you benefit from the most recent features, bug fixes, and optimizations without requiring manual updates. If a specific version is needed, you can specify it using the --localnet-version option when initializing the environment.

genlayer init --localnet-version v0.10.2

Start GenLayer environment

Launches the GenLayer environment and the Studio, initializing a fresh set of database and accounts.

USAGE:
   genlayer up [options]

OPTIONS:
   --reset-validators               Remove all current validators and create new random ones (default: false)
   --numValidators <numValidators>  Number of validators (default: "5")
   --headless                       Headless mode (default: false)
   --reset-db                       Reset Database (default: false)
   --ollama                         Enable Ollama container (default: false)

EXAMPLES:
   genlayer up
   genlayer up --reset-validators --numValidators 8 --headless --reset-db
   genlayer up --ollama

Stop GenLayer environment

Stops all running GenLayer Localnet services.

USAGE:
   genlayer stop

Create a New GenLayer Project

Initialize a new GenLayer project using a local template.

USAGE:
   genlayer new <projectName> [options]

OPTIONS:
   --path <directory>  Specify the directory for the new project (default: ".")
   --overwrite         Overwrite existing directory if it exists (default: false)

EXAMPLES:
   genlayer new myProject
   genlayer new myProject --path ./customDir
   genlayer new myProject --overwrite

Manage CLI Configuration

Configure the GenLayer CLI settings.

USAGE:
   genlayer config <command> [options]

COMMANDS:
   set <key=value>  Set a configuration value
   get [key]        Get the current configuration
   reset <key>      Reset a configuration value to its default

EXAMPLES:
   genlayer config get
   genlayer config get defaultOllamaModel
   genlayer config set defaultOllamaModel=deepseek-r1
   genlayer config reset keyPairPath

Network Management

Set the network to use for contract operations.

USAGE:
   genlayer network [network]

EXAMPLES:
   genlayer network
   genlayer network testnet
   genlayer network mainnet

Deploy and Call Intelligent Contracts

Deploy and interact with intelligent contracts.

USAGE:
   genlayer deploy [options]
   genlayer call <contractAddress> <method> [options]
   genlayer write <contractAddress> <method> [options]

OPTIONS (deploy):
   --contract <contractPath>  (Optional) Path to the intelligent contract to deploy
   --rpc <rpcUrl>             RPC URL for the network
   --args <args...>           Positional arguments for the contract (space-separated, use quotes for multi-word arguments)

OPTIONS (call):
   --rpc <rpcUrl>             RPC URL for the network
   --args <args...>           Positional arguments for the method (space-separated, use quotes for multi-word arguments)

OPTIONS (write):
   --rpc <rpcUrl>             RPC URL for the network
   --args <args...>           Positional arguments for the method (space-separated, use quotes for multi-word arguments)

EXAMPLES:
   genlayer deploy
   genlayer deploy --contract ./my_contract.gpy
   genlayer deploy --contract ./my_contract.gpy --args "arg1" "arg2" 123
   genlayer call 0x123456789abcdef greet --args "Hello World!"
   genlayer write 0x123456789abcdef updateValue --args 42
Deploy Behavior
  • If --contract is specified, the command will deploy the given contract.
  • If --contract is omitted, the CLI will search for scripts inside the deploy folder, sort them, and execute them sequentially.
Call vs Write
  • call - Calls a contract method without sending a transaction or changing the state (read-only)
  • write - Sends a transaction to a contract method that modifies the state

Keypair Management

Generate and manage keypairs.

USAGE:
   genlayer keygen create [options]

OPTIONS:
   --output <path>    Path to save the keypair (default: "./keypair.json")
   --overwrite        Overwrite the existing file if it already exists (default: false)

EXAMPLES:
   genlayer keygen create
   genlayer keygen create --output ./my_key.json --overwrite

Update Resources

Manage and update models or configurations.

USAGE:
   genlayer update ollama [options]

OPTIONS:
   --model [model-name]  Specify the model to update or pull
   --remove              Remove the specified model instead of updating

EXAMPLES:
   genlayer update ollama
   genlayer update ollama --model deepseek-r1
   genlayer update ollama --model deepseek-r1 --remove

Validator Management

Manage validator operations.

USAGE:
   genlayer validators <command> [options]

COMMANDS:
   get [--address <validatorAddress>]     Retrieve details of a specific validator or all validators
   delete [--address <validatorAddress>]  Delete a specific validator or all validators
   count                                  Count all validators
   update <validatorAddress> [options]    Update a validator details
   create-random [options]                Create random validators
   create [options]                       Create a new validator

OPTIONS (update):
   --stake <stake>                        New stake for the validator
   --provider <provider>                  New provider for the validator
   --model <model>                        New model for the validator
   --config <config>                      New JSON config for the validator

OPTIONS (create-random):
   --count <count>                        Number of validators to create (default: "1")
   --providers <providers...>             Space-separated list of provider names (e.g., openai ollama)
   --models <models...>                   Space-separated list of model names (e.g., gpt-4 gpt-4o)

OPTIONS (create):
   --stake <stake>                        Stake amount for the validator (default: "1")
   --config <config>                      Optional JSON configuration for the validator
   --provider <provider>                  Specify the provider for the validator
   --model <model>                        Specify the model for the validator

EXAMPLES:
   genlayer validators get
   genlayer validators get --address 0x123456789abcdef

   genlayer validators count
   genlayer validators delete --address 0x123456789abcdef
   genlayer validators update 0x123456789abcdef --stake 100 --provider openai --model gpt-4

   genlayer validators create
   genlayer validators create --stake 50 --provider openai --model gpt-4
   genlayer validators create-random --count 3 --providers openai --models gpt-4 gpt-4o

Running the CLI from the repository

First, install the dependencies and start the build process

npm install
npm run dev

This will continuously rebuild the CLI from the source

Then in another window execute the CLI commands like so:

node dist/index.js init

Documentation

For detailed information on how to use GenLayer CLI, please refer to our documentation.

Contributing

We welcome contributions to GenLayerJS SDK! Whether it's new features, improved infrastructure, or better documentation, your input is valuable. Please read our CONTRIBUTING guide for guidelines on how to submit your contributions.

License

This project is licensed under the ... License - see the LICENSE file for details.

changelog

Changelog

0.20.0 (2025-07-09)

Features

0.19.0 (2025-07-09)

Features

0.18.5 (2025-07-09)

0.18.4 (2025-06-27)

Bug Fixes

  • refactor log output formatting and address spinner display (#228) (ea0ac10)

0.18.3 (2025-05-29)

0.18.2 (2025-05-29)

0.18.2-beta.0 (2025-05-29)

0.18.0-beta.0 (2025-05-09)

Features

  • separate read and write calls (#222) (fce8904)

    0.18.1 (2025-05-29)

0.18.0 (2025-05-28)

Features

  • using profiles to set frontend and ollama containers (#221) (a3d0d4e)

0.17.0 (2025-05-05)

Features

  • check if the simulator is running before launching it again (#219) (f45e1f7)

0.16.0 (2025-05-02)

Features

0.15.0 (2025-04-29)

Features

  • custom rpc for interacting with contracts (#218) (138babd)

0.14.1 (2025-04-25)

0.14.0 (2025-04-25)

Features

0.13.0 (2025-04-24)

Features

0.12.5 (2025-04-24)

0.12.4 (2025-04-03)

Bug Fixes

0.12.3 (2025-03-07)

Bug Fixes

0.12.2 (2025-03-07)

0.12.1 (2025-02-20)

0.12.0 (2025-02-05)

Features

  • Add stop Command and Improve Docker Container Management (#178) (dbae62c)

0.11.1 (2025-02-05)

0.11.0 (2025-01-31)

Features

  • Enhance Ollama Command Workflow and Default Model Handling (#171) (3dc7a96)

0.10.2 (2025-01-30)

Bug Fixes

0.10.1 (2025-01-29)

Bug Fixes

  • updating studio version and docker compose breaking change (#173) (fb563e6)

0.10.0 (2025-01-28)

Features

  • getting default ollama model from config file (#167) (d9e440d)

0.10.0-beta.0 (2024-12-13)

Features

  • new global var to deal with compatible version (33a4c02)

0.9.1 (2024-12-13)

Bug Fixes

  • removing volumes to stop error when running node without nvm (#156) (189c759)

0.9.0 (2024-12-13)

Features

  • Add Deploy Command and Update Configurations for Compatibility (#153) (8744b2d)

0.8.0 (2024-12-11)

Features

0.7.0 (2024-12-09)

Features

  • adding localnet version option on init (#151) (a7bf419)

0.6.0 (2024-12-03)

Features

0.5.1-beta.0 (2024-12-03)

Bug Fixes

  • merging main and resolving conflicts (df23e36)

0.5.0 (2024-12-03)

Features

0.4.0 (2024-11-22)

Features

0.3.0 (2024-11-15)

Features

0.2.0 (2024-11-14)

Features

0.1.4 (2024-11-12)

Bug Fixes

  • changing linux command to fix display issue and fixing waiting simulator issue (#127) (721eebf)

0.1.3 (2024-11-08)

0.1.2 (2024-11-08)

0.1.1 (2024-11-08)

0.1.0 (2024-11-08)

Features

0.0.34 (2024-10-22)

0.0.33 (2024-10-22)

Bug Fixes

0.0.32-beta.3 (2024-07-26)

0.0.32 (2024-07-15)

0.0.32-beta.2 (2024-07-03)

0.0.32-beta.1 (2024-07-03)

0.0.32-beta.0 (2024-07-03)

0.0.31 (2024-05-27)

Bug Fixes

0.0.30 (2024-05-22)

0.0.29 (2024-05-15)

0.0.28 (2024-05-13)

0.0.27 (2024-05-08)

0.0.26 (2024-05-07)

0.0.25 (2024-05-06)

Bug Fixes

  • OPEN AI .env key renamed in simulator (#21) (676d159)

0.0.24 (2024-05-06)

0.0.23 (2024-05-01)

Bug Fixes

0.0.22 (2024-04-30)

Bug Fixes

0.0.21 (2024-04-30)

0.0.20 (2024-04-26)

0.0.19 (2024-04-26)

0.0.17 (2024-04-23)

0.0.16 (2024-04-23)

0.0.15 (2024-04-23)

0.0.14 (2024-04-23)

0.0.13 (2024-04-23)

0.0.12 (2024-04-23)

0.0.11 (2024-04-23)

0.0.10 (2024-04-23)

0.0.9 (2024-04-23)

0.0.8 (2024-04-23)

0.0.7 (2024-04-23)

0.0.6 (2024-04-23)

0.0.5 (2024-04-23)

0.0.4 (2024-04-23)

0.0.3 (2024-04-23)