# Lodestar Setup for Kiln🔥🧱 Public Testnet
Setting up Lodestar for the Kiln testnet is as simple as configuring a variable file and running a setup command. Our setup script will take care of most of the configuration for you.
Reference: https://github.com/ChainSafe/lodestar/tree/master/kiln/devnets
## Setup Instructions
### Prerequistes
You will need to have the following installed:
1. Docker
2. Git
3. Bash shell
### Install Docker Engine (if required)
We must install Docker Engine to run the images on your local machine.
```
sudo apt-get install ca-certificates curl gnupg lsb-release
```
```
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
```
```
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
```
```
sudo apt-get update
```
```
sudo apt-get install docker-ce docker-ce-cli containerd.io
```
If you're prompted to add new packages, press `y`.
```
sudo docker run hello-world
```
### Clone our Repository
```
git clone https://github.com/ChainSafe/lodestar.git
```
### Edit the Kiln variables file
Navigate to the kiln.vars file
```
cd lodestar/kiln/devnets
```
Use a text editor like `nano` to edit the kiln.vars file
```bash=
nano kiln.vars
```
Inside the kiln.vars file, you can add, remove or modify configurations related to the execution layer client you intend to use, Lodestar beacon configurations and the validator configurations.
### If running validators (optional)
Ensure you edit the `LODESTAR_VALIDATOR_ARGS=` by replacing the mnemonic under `--fromMnemonic` and the `--mnemonicIndexes` in the format that is provided.
## Startup Instructions
### Run the script with arguments
```bash=
cd kiln/devnets
./setup.sh --dataDir kiln-data --elClient geth --devnetVars ./kiln.vars [--dockerWithSudo --withTerminal "gnome-terminal --disable-factory --" --withValidator]
```
##### Example scenarios
1. Run with separate terminals launched & attached (best for testing in local) :
`./setup.sh --dataDir kiln-data --elClient nethermind --devnetVars ./kiln.vars --withTerminal "gnome-terminal --disable-factory --" --dockerWithSudo `
2. Run _in-terminal_ attached with logs interleaved (best for testing in remote shell) :
`./setup.sh --dataDir kiln-data --elClient nethermind --devnetVars ./kiln.vars --dockerWithSudo`
3. Run detached (best for leaving it to run, typically after testing 1 or 2):
`./setup.sh --dataDir kiln-data --elClient nethermind --devnetVars ./kiln.vars --detached --dockerWithSudo`
You can alternate between `geth` and `nethermind` to experiment with the ELs being out of sync ( and catching up) with `lodestar`.
## Script Parameters Help
1. `dataDir`: Where you want the script and client's configuration data to be setup. Should be non-existent one for the first run. (The directory if already present will skip fetching the configuration, assuming it has done previously). You can also clean indivizual directories of CL/EL between the re-runs.
2. `elClient`: Which EL client you want, currently working with `geth` or `nethermind` or `ethereumjs`
3. `devnetVars`: Contains the configuration specific to a devnet, like images, or urls for EL/CL to interact. Will be updated with new vars.
4. `dockerWithSudo`(optional): Provide this argument if your docker needs a sudo prefix
5. `--withTerminal`(optional): Provide the terminal command prefix for CL and EL processes to run in your favourite terminal.
You may use an alias or a terminal launching script as long as it waits for the command it runs till ends and then closes.If not provided, it will launch the docker processes in _in-terminal_ mode.
6. `--detached`(optional): By default the script will wait for processes and use user input (ctrl +c) to end the processes, however you can pass this option to skip this behavior and just return, for e.g. in case you just want to leave it running.
7. `--withValidator` (optional): Launch a validator client using `LODESTAR_VALIDATOR_ARGS` as set in the devnet vars file.
Only one of `--withTerminal` or `--detached` should be provided.