# Setting Up a Validator on the Ethereum Prater Testnet
###### tags: `tutorials` `prater` `ethereum` `validator`
We are going to be setting up both the consensus and validator layers on the Ethereum Prater Testnet. This tutorial assumes that you have a fully working / synced execution client (I’ll be using the Nethermind Client in this scenario) . If you do not have a fully-synced execution client…make sure to do that prior to following the rest of this tutorial. It may take a few days to sync 😢
- - - -
## Prerequisites
* Docker and docker-compose fully installed and working
* Fully synced / working execution layer client on the Goerli testnet (such as Nethermind or Geth)
* 32 gETH on the Goerli testnet
* This is required for your validator keys. Each validator setup needs to have its own validator keys with 32 gETH each.
* Linux host with at least 150GB of storage
* I’m using an Ubuntu 20.04 LTS instance with 8GB RAM and 160GB HDD
- - - -
## Setting Up Validator Keys
For setting up validator keys, we will be using the [ETH 2.0 Deposit CLI](https://github.com/ethereum/eth2.0-deposit-cli/releases). This creates a key-store that you will be sending your 32 gETH to be able to participate in the ETH PoS prater testnet. You will be using the files generated from this application to power your validator.
1. Visit the [releases page](https://github.com/ethereum/eth2.0-deposit-cli/releases)on the [ETH 2.0 Deposit CLI Github](https://github.com/ethereum/eth2.0-deposit-cli) and download the release that fits your machine. In my case, I'll be choosing the tarball for macOS (darwin amd64)
2. Extract the download and `cd` into the directory
1. `tar -xvf staking_deposit-cli-e2a7c94-darwin-amd64.tar.gz`
2. `cd staking_deposit-cli-e2a7c94-darwin-amd64`
3. Run the CLI tool to create a new mnemonic / key pair
1. `./deposit new-mnemonic`
2. Hit enter for English, or choose another language
3. Choose how many validators you’re going to run. Remember: you’ll need 32 gETH per validator.
4. Choose the `prater` testnet
5. Create a password you’ll be using to protect this key pair
6. It will then show you a mnemonic. Make **SURE** to write this down and save it in a safe space!
7. Enter the mnemonic that you just wrote down
8. It will then generate and save your keys within a `validator_keys` folder. We will be using the files within this folder later when setting up a validator.
- - - -
## Depositing ETH To Validator Keys
Once you have created your validator keys, you’re going to need to fill them up with 32 ETH. To do that, you will have to go through the prater staking tutorial found on [Ethereum’s own website](https://prater.launchpad.ethereum.org/en/)
After going through their tutorial, it will have you upload the deposit data for your validator keys. You can find this `.json` file in the `validator_keys` folder created in the previous step.
It will then have you connect a wallet to send 32 gETH to the prater testnet deposit contract. I personally used MetaMask, but feel free to use whatever wallet suits your fancy.
One deposited and confirmed, your validator keys are ready to go! 😄
Below you will find separate instructions based on which validator / consensus client you choose. Your keys will work with any validator, it’s completely up to you based on which one you choose.
- - - -
## Lighthouse
Before we continue with setting up the lighthouse client, we need to set some environment variables on the host machine. These environment variables will be used within the `docker-compose` file. Feel free to hard code these values instead.
### Setting Up The Consensus Client
1. Clone the [eth-docker-compose repo](https://github.com/NethermindEth/eth-docker-compose)
* `git clone https://github.com/NethermindEth/eth-docker-compose`
* Change to the prater branch
* `git checkout prater`
2. CD into the directory and setup environment variable file
* `nano .env` and add the following lines:
* `IMAGE_VERSION=sigp/lighthouse:latest`
* `PEER_COUNT=30`
* `EC_NODE=<your_execution_client_IP>`
* Make sure to enter your execution client’s IP, in my case it is the Nethermind Execution Client I had setup previously
* `LOG_LEVEL=info`
3. Once the docker-compose repo has been cloned, and your environment variables setup, let’s start syncing the beacon chain! This will take quite a while (days to weeks). As the client is syncing, we will continue to setup the validator and validator keys.
* `docker-compose up -d consensus`
* If you see something along the lines of `INFO Syncing est_time: 1 week 3 days, speed: 2.67 slots/sec` then you’re all set! Eventually it will finish syncing and be up-to-date. This syncing process may take a lot of storage, so make sure you check the logs of this docker-compose to see if it is running into any errors.
### Import Validator Keys
For this portion, we will be using the `.json` files found within the `validator_keys` folder that was created previously in the `Setting Up Validator Keys` step.
1. `cd` into Lighthouse folder where the `docker-compose.yml` file is stored
2. Create two directories: `keys` and `validators`
* `mkdir keys`
* `mkdir validators`
3. Setup `keystore_password`
* `cd keys`
* Create a text file at the root of the `keys` folder: `nano keystore_password.txt`
* Enter the validator key password you created in the `Setting Up Validator Keys` step above. The password should be the only text in the `.txt` file
4. Setup `validator_keys`
* Within the `keys` directory, create another directory named `validator_keys`
* `cd validator_keys`
* Move the `keystore… .json` files from the folder you made in the `Setting Up Validator Keys` step above into this folder.
5. The `keys` directory should look like the following:
* `keys/keystore_password.txt`
* `keys/validator_keys/`
* `keystore… .json`
6. Start up the `validator-import` service to see if everything is setup correctly
* `cd` to where the `docker-compose.yml` file for Lighthouse is located
* `docker-compose up validator-import`
* This will start up _only_ the `validator-import` service, testing to see if you have setup the files / directories correctly.
* You will see something along the lines `Successfully imported 0 validators` if you have done it correctly.
* If you are running into issues, double check the directory structure with the listed directories under the `validator-import` section of the `docker-compose.yml` file.
### Setup and Start Validator
_This step will only work if your consensus client has fully synced and your keys have been successfully imported_
1. Change the Validator’s graffiti to anything you’d like. This essentially tags the blocks that your validator proposes.
* Change line `55` in the `docker-compose.yml` file to your chosen graffiti
2. `cd` to the root of the directory where the `docker-compose.yml` is found
* `docker-compose down`
* `docker-compose up -d` to start all services (including the validator)
3. Your `validator` service will fail until the consensus client fully starts back up (this takes a minute or so). Once the concuss client service has fully started up, your validator service will connect to the client and start validating blocks on the prater testnet! 😄
4. You can view the validator’s current status on prater.beaconch.in and searching for your validator’s public key. This website may take a few minutes to update after your validator shows that it is attesting blocks in `docker-compose` logs
* Your validator’s key can be found within the `keystore… .json` file in the `validator_keys` folder configured previously. Your validator’s public key is the value for the `pubkey` attribute within the `.json` file.