# Run Validator Node ## Prerequisites - [ansible](playbooks/README.md#ansible-installation) - [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) ## Run node - Get your private key from testnet deployment: ```bash laconic-so deployment --dir exec laconicd "laconicd keys export --unarmored-hex --unsafe" ``` NOTE: Store this key securely as it is needed in later steps - Stop the node for SAPO testnet: ```bash laconic-so deployment --dir stop ``` - Fetch the stack: ```bash laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull ``` This command clones the entire repository into the `~/cerc` folder, which includes the genesis file published by the first validator. - Copy the example variables file: ```bash cp ~/cerc/laconicd-stack/playbooks/validator/validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml ``` - Update `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml` with required values: ```bash # Set custom moniker for the node cerc_moniker: "" genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json" staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json" # Set persistent peers (comma-separated list of node IDs and addresses) # You can find the list of available peers in https://git.vdb.to/cerc-io/laconicd-stack/src/branch/main/node-addresses.yml cerc_peers: "@:26656,@:26656" ``` - Export the data directory and mainnet deployment directory as environment variables: ```bash # Parent directory where the deployment directory will live export DATA_DIRECTORY= # Set mainnet deployment directory # for eg: mainnet-laconicd-deployment export MAINNET_DEPLOYMENT_DIR= ``` - Run ansible playbook to set up and start your validator node: ```bash ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/run-validator.yml ``` - Check logs to ensure that node is running: ```bash laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f ``` ## Create Validator - Run these steps in a machine different from the one where the node is running - Export required env vars: ```bash # desired key name export KEY_NAME= export DATA_DIRECTORY= export MAINNET_DEPLOYMENT_DIR= # Set the public IP address of the machine where your node is running export NODE_URL="tcp://PUBLIC_IP_ADDRESS:26657" ``` - Run ansible playbook to create validator on running chain: ```bash ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml ``` - Input private key of the existing account that was exported in previous steps when prompted - Check the validator list: ```bash laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators' ``` ## Register Your Node - Run these steps in a machine where the node is running - Get your node's address: ```bash laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'echo $(laconicd cometbft show-node-id)@YOUR_PUBLIC_IP_ADDRESS:26656' ``` - Add your node's address to the `~/cerc/laconicd-stack/node-addresses.yml` file - Submit a PR to add your node address to the repository