Lux CLI is a command line tool that gives developers access to everything Lux. This release specializes in helping developers develop and test subnets.
The tool has been tested on Linux and Mac. Windows is currently not supported.
To download a binary for the latest release, run:
curl -sSfL https://raw.githubusercontent.com/luxfi/cli/main/scripts/install.sh | sh -sThe binary will be installed inside the ~/bin directory.
To add the binary to your path, run
export PATH=~/bin:$PATHTo add it to your path permanently, add an export command to your shell initialization script (ex: .bashrc).
To download the binary into a specific directory, run:
curl -sSfL https://raw.githubusercontent.com/luxfi/cli/main/scripts/install.sh | sh -s -- -b <relative directory>
After installing, launch your own custom subnet:
lux subnet create <subnetName>
lux subnet deploy <subnetName>Shut down your local deployment with:
lux network stopManage validator nodes with flexible wallet configurations:
# Add a validator
lux node validator add --name mainnet-0 --seed "your seed phrase" --account 0
# Start validator
lux node validator start --name mainnet-0
# Check status
lux node validator status
# Stop validator
lux node validator stop --name mainnet-0For detailed validator management, see CLI Validator Guide.
Restart your local deployment (from where you left off) with:
lux network start- Creation of Lux EVM, and custom virtual machine subnet configurations
- Precompile integration and configuration
- Local deployment of subnets for development and rapid prototyping
- Testnet and Lux Mainnet deployment of subnets
- Ledger support
- Lux Package Manager Integration
You can provide a global node config to edit the way your local node nodes perform under the hood. To provide such a config, you need to create an cli config file. By default, a config file is read in from $HOME/.cli.json. If none exists, no error will occur. To provide a config from a custom location, run any command with the flag --config <pathToConfig>.
To specify the global node config, provide it as a body for the node-config key. Ex:
{
"network-peer-list-gossip-frequency":"250ms",
"network-max-reconnect-delay":"1s",
"public-ip":"127.0.0.1",
"health-check-frequency":"2s",
"api-admin-enabled":true,
"api-ipcs-enabled":true,
"index-enabled":true
}You may wish to deploy your subnet on a cloud instance and access it remotely. If you'd like to do so, use this as your node config:
{
"node-config": {
"http-host": "0.0.0.0"
}
}To build Lux CLI, you'll first need to install golang. Follow the instructions here: https://go.dev/doc/install.
Once golang is installed, run:
./scripts/build.shThe binary will be called ./bin/lux.
To make Lux CLI work in a docker container, add this
{
"ipv6": true,
"fixed-cidr-v6": "fd00::/80"
}to /etc/docker/daemon.json on the host, then restart the docker service. This is because ipv6 is used to resolve local bootstrap IPs, and it is not enabled on a docker container by default.
To run our suite of end-to-end tests, you'll need to install Node-JS and yarn. You can follow instructions to do that here and here.
To run the tests, execute the following command from the repo's root directory:
./scripts/run.e2e.shNetwork snapshots are used by the CLI in order to keep track of blockchain state, and to improve performance of local deployments.
They are the main way to persist subnets, blockchains, and blockchain operations, among different executions of the tool.
Three different kinds of snapshots are used:
- The
bootstrap snapshotis provided as the starting network state. It is never modified by CLI usage. Designed for fast deploys. Enables full reset of the blockchain state. - The
default snapshotis the main way to keep track of blockchain state. Used by default in the tools. It is initialized from thebootstrap snapshot, and after that is updated from CLI operations. custom snapshotscan be specified by the user, to save and restore particular states. Only changed if explicitly asked to do so.
Usage of local networks:
- The local network will be started in the background only if it is not already running
- If the network is not running, both
network startandsubnet deploywill start it from thedefault snapshot.subnet deploywill also do the deploy on the started network. - If the network is running,
network startwill do nothing, andsubnet deploywill use the running one to do the deploy. - The local network will run until calling
network stop,network clean, or until machine reboot
How the CLI commands affect the default snapshot:
- First call of
network startorsubnet deploywill initializedefault snapshotfrom thebootstrap snapshot - Subsequent calls to
subnet deploydo not change the snapshot, only the running network network stoppersist the running network into thedefault snapshotnetwork cleancopy again thebootstrap snapshotinto thedefault snapshot, doing a reset of the state
So typically a user will want to do the deploy she needs, change the blockchain state in a specific way, and
after that execute network stop to preserve all the state. In a different session, network start or subnet deploy
will recover that state.
How the CLI commands affect the custom snapshots:
network stopcan be given an optional snapshot name. This will then be used instead of the default one to save the statenetwork startcan be given an optional snapshot name. This will then be used instead of the default one to save the statesubnet deploywill take a running network if it is available, so there is a need to usenetwork startpreviously to do deploys, if wanting to use custom snapshotsnetwork cleandoes not change custom snapshots
So typically a user who wants to use a custom snapshot will do the deploy she needs, change the blockchain state in a specific way, and
after that execute network stop with --snapshot-name flag to preserve all the state into the desired snapshot.
In a different session, network start with --snapshot-name flag will be called to load that specific snapshot, and after that
subnet deploy can be used on top of it. Notice that you need to continue giving --snapshot-name flag to those commands if you
continue saving/restoring to it, if not, default snapshot will be used.
~/.cli/snapshotwill contain all saved snapshots, which can for example be used to pass work around
More detailed information on how to use Lux CLI can be found at here.