Klayr-REG is a command-line tool designed to make sidechain registration on Klayr fun again!
- Load configuration from command-line options, config file, or environment variables.
- Prompt the user for missing options interactively.
- Optionally authorize chain-connector plugin (CC).
- Verbose mode for detailed logs.
Ensure that you have the following installed:
- Node.js (>= 14.x)
- NPM (Node Package Manager)
Use Klayr-REG easily using npx
:
npx klayr-reg [options]
Example:
npx klayr-reg --prompt-path --authorize-cc
To install Klayr-REG globally, execute following command:
npm install -g klayr-reg
Once installed globally, you can use the klayr-reg
command without npx
.
Below is a list of all available options and their corresponding environment variables:
Option | Description | Environment Variable |
---|---|---|
-v, --verbose |
Verbose mode for more detailed logs | KLAYR_REG_VERBOSE |
-c, --config <path> |
Config file path | KLAYR_REG_CONFIG |
--side-name <name> |
Sidechain name for registration | KLAYR_REG_SIDECHAIN_NAME |
--keys <path> |
Path to sidechain validators keys | KLAYR_REG_SIDECHAIN_KEYS |
--main-ipc <path> |
Mainchain IPC path | KLAYR_REG_MAINCHAIN_IPC |
--main-ws <url> |
Mainchain WebSocket URL | KLAYR_REG_MAINCHAIN_WS |
--side-ipc <path> |
Sidechain IPC path | KLAYR_REG_SIDECHAIN_IPC |
--side-ws <url> |
Sidechain WebSocket URL | KLAYR_REG_SIDECHAIN_WS |
--authorize-cc |
Authorize chain-connector plugin | KLAYR_REG_AUTHORIZE_CC |
--cc-pass <password> |
CC password for both mainchain and sidechain | KLAYR_REG_CC_PASSWORD |
--main-cc-pass <password> |
CC password for mainchain | KLAYR_REG_MAINCHAIN_CC_PASSWORD |
--side-cc-pass <password> |
CC password for sidechain | KLAYR_REG_SIDECHAIN_CC_PASSWORD |
--relayer-phrase <phrase> |
Relayer phrase for both chains | KLAYR_REG_RELAYER_PHRASE |
--main-relayer-phrase <phrase> |
Relayer phrase for mainchain | KLAYR_REG_MAINCHAIN_RELAYER_PHRASE |
--side-relayer-phrase <phrase> |
Relayer phrase for sidechain | KLAYR_REG_SIDECHAIN_RELAYER_PHRASE |
--prompt-path |
Prompt to set phrase path | KLAYR_REG_PROMPT_PATH |
--phrase-path <path> |
Phrase path for both chains | KLAYR_REG_PHRASE_PATH |
--main-phrase-path <path> |
Phrase path for mainchain | KLAYR_REG_MAINCHAIN_PHRASE_PATH |
--side-phrase-path <path> |
Phrase path for sidechain | KLAYR_REG_SIDECHAIN_PHRASE_PATH |
--register-mainchain-fee <fee> |
Custom registerMainchain transaction fee | KLAYR_REG_REGISTER_MAINCHAIN_FEE |
--register-sidechain-fee <fee> |
Custom registerSidechain transaction fee | KLAYR_REG_REGISTER_SIDECHAIN_FEE |
You can also use a config.json
file to store the options. For example:
{
"mainIpc": "~/.klayr/klayr-core",
"sideIpc": "~/.klayr/swaptoshi-core",
"mainWs": null,
"sideWs": null,
"sideName": "swaptoshi",
"keys": "./keys.json",
"phrasePath": null,
"mainPhrasePath": null,
"sidePhrasePath": null,
"relayerPhrase": null,
"mainRelayerPhrase": "minute omit local rare sword knee banner pair rib museum shadow juice",
"sideRelayerPhrase": "luxury thought scan moral glance thrive hurt cable found twelve share dolphin",
"authorizeCc": true,
"ccPass": "lisk",
"mainCcPass": null,
"sideCcPass": null,
"registerMainchainFee": null,
"registerSidechainFee": "2000000000"
}
Then specify the path to config.json
file using the config flag when you run klayr-reg:
npx klayr-reg -c <path-to-config>
You can use the KLAYR_REG_CONFIG
env variable as well:
KLAYR_REG_CONFIG=<path-to-config> npx klayr-reg
You can also use a .env
file to store the options. For example:
KLAYR_REG_SIDECHAIN_NAME=mySidechain
KLAYR_REG_MAINCHAIN_IPC=/path/to/mainchain/folder
KLAYR_REG_SIDECHAIN_IPC=/path/to/sidechain/folder
KLAYR_REG_SIDECHAIN_KEYS=/path/to/validators_keys.json
KLAYR_REG_AUTHORIZE_CC=true
KLAYR_REG_CC_PASSWORD=myCCPassword
If any of the required options are missing, the CLI will prompt you for input interactively. For example, if no sidechain name is provided, it will ask for one.
For more detailed logs, use the --verbose
flag:
npx klayr-reg --verbose
To build Klayr-REG CLI from source, clone the repository, install dependencies, and install globally:
git clone https://github.com/swaptoshi/klayr-reg
cd klayr-reg
npm install
npm install -g .
Once installed globally, you can use the klayr-reg
command.
This project is licensed under the Apache 2.0 License.