GenLayer CLI Reference
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...]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.2Commands 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
 
EXAMPLES:
   genlayer init
   genlayer init --numValidators 10 --headless --reset-db --localnet-version v0.10.2Start 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)
 
EXAMPLES:
   genlayer up
   genlayer up --reset-validators --numValidators 8 --headless --reset-dbStop GenLayer environment
Stops all running GenLayer Localnet services.
USAGE:
   genlayer stopCreate 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 --overwriteManage 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 keyPairPathDeploy and Call Intelligent Contracts
Deploy and interact with intelligent contracts.
USAGE:
   genlayer deploy [options]
   genlayer call <contractAddress> <method> [options]
   genlayer write <contractAddress> <method> [options]
   genlayer schema <contractAddress> [options]
 
OPTIONS (deploy):
   --contract <contractPath>  (Optional) Path to the intelligent contract to deploy
   --args <args...>           Positional arguments for the contract (space-separated, use quotes for multi-word arguments)
   --rpc <rpcUrl>             RPC URL for the network
 
OPTIONS (call):
   --args <args...>           Positional arguments for the method (space-separated, use quotes for multi-word arguments)
   --rpc <rpcUrl>             RPC URL for the network
 
OPTIONS (write):
   --args <args...>           Positional arguments for the method (space-separated, use quotes for multi-word arguments)
   --rpc <rpcUrl>             RPC URL for the network
 
OPTIONS (schema):
   --rpc <rpcUrl>             RPC URL for the network
 
EXAMPLES:
   genlayer deploy
   genlayer deploy --contract ./my_contract.gpy
   genlayer call 0x123456789abcdef greet --args "Hello World!"
   genlayer write 0x123456789abcdef setValue --args 42 "New Value"
   genlayer schema 0x123456789abcdefDeploy Behavior
- If --contractis specified, the command will deploy the given contract.
- If --contractis omitted, the CLI will search for scripts inside thedeployfolder, sort them, and execute them sequentially.
Call vs Write
- call: Read-only operations that don't modify contract state.
- write: Operations that modify contract state and require transaction confirmation.
Schema Command
- Retrieve the contract schema showing all available methods and their parameters.
Transaction Management
Manage and query transaction receipts and appeals.
USAGE:
   genlayer receipt <txId> [options]
   genlayer appeal <txId> [options]
 
OPTIONS (receipt):
   --status <status>       Transaction status to wait for (default: "FINALIZED")
                           Valid values: UNINITIALIZED, PENDING, PROPOSING, COMMITTING, 
                           REVEALING, ACCEPTED, UNDETERMINED, FINALIZED, CANCELED, 
                           APPEAL_REVEALING, APPEAL_COMMITTING, READY_TO_FINALIZE, 
                           VALIDATORS_TIMEOUT, LEADER_TIMEOUT
   --retries <retries>     Maximum number of retry attempts (default: 100)
   --interval <interval>   Interval between retries in milliseconds (default: 5000)
   --rpc <rpcUrl>          RPC URL for the network
 
OPTIONS (appeal):
   --rpc <rpcUrl>          RPC URL for the network
 
EXAMPLES:
   genlayer receipt 0x1234567890abcdef
   genlayer receipt 0x1234567890abcdef --status ACCEPTED
   genlayer receipt 0x1234567890abcdef --status FINALIZED --retries 50 --interval 3000
   genlayer receipt 0x1234567890abcdef --rpc http://localhost:8545
   
   genlayer appeal 0x1234567890abcdef
   genlayer appeal 0x1234567890abcdef --rpc http://localhost:8545Network Management
Configure network settings.
USAGE:
   genlayer network [network]
 
ARGUMENTS:
   [network]  Optional network name or alias to set. If omitted, displays an interactive selection menu.
              Valid options: localnet, studionet, testnet-asimov
 
EXAMPLES:
   genlayer network                    # Interactive selection menu
   genlayer network localnet           # Set network to localnet
   genlayer network studionet          # Set network to studionet  
   genlayer network testnet-asimov     # Set network to testnet-asimovKeypair 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 --overwriteUpdate 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 --removeLocalnet Validator Management
Manage localnet validator operations.
USAGE:
   genlayer localnet 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 localnet validators get
   genlayer localnet validators get --address 0x123456789abcdef
 
   genlayer localnet validators count
   genlayer localnet validators delete --address 0x123456789abcdef
   genlayer localnet validators update 0x123456789abcdef --stake 100 --provider openai --model gpt-4
 
   genlayer localnet validators create
   genlayer localnet validators create --stake 50 --provider openai --model gpt-4
   genlayer localnet validators create-random --count 3 --providers openai --models gpt-4 gpt-4o