# Sepolia beacon chain docs ## Introduction The sepolia beacon chain is a permissioned beacon chain. We achieve this permissioned-ness by using [this](https://github.com/protolambda/testnet-dep-contract/) deposit contract that accepts just a specific token as the deposit. The token is currently controlled purely by EF DevOps, it will be used to onboard new validators as and when needed. The token can be tracked on the page [here](https://sepolia.etherscan.io/token/0x7f02c3e3c98b133055b8b348b2ac625669ed295d). ## How do I become a validator? The sepolia beacon chain will not be a place for home stakers to test their setups. The aim is to have a small validator set that can provide a great UI/UX for dapps to test things on. So the only reason to be a sepolia beacon chain is if you are a node operator or large scale staker and want to partake in the health of a testnet. We expect the following of every validator on Sepolia: - Long term commitment to run validators - High uptime - Quick response for updates as well as TTD co-ordination If the above is acceptible to you and you can prove that you currently run a considerable amount of stake on Ethereum Mainnet, then please do comment in this [Github issue](https://github.com/eth-clients/merge-testnets/issues/20) expressing your interest, reasons for wanting to be one and contact information(with ethereum address, ideally ENS). #### Process: 1. Comment on github issue with required information 2. Allow for existing validators to vet/approve the decision 3. If approved, Request tokens for the deposit contract (ensure the Ethereum address(or ENS) provided is valid) 4. Setup Sepolia EL + CL nodes 5. Perform deposits as described in later sections 6. Wait for deposit processing delays to finish 7. Start validator keys on your machines 8. Monitor validators for performance! 9. If needed! Exit your own validators after discussion with the other validators ## Performing deposits We do not have a launchpad for the Sepolia beacon chain. Since its a small, permissioned chain, we will use CLI tools to perform them. pre-requisites: - eth2-val-tools: https://github.com/protolambda/eth2-val-tools - ethereal: https://github.com/wealdtech/ethereal - Ethereum account with a min. 40 sepolia testnet ether + the tokens needed for deposits (for gas + other requirements of testnet deposit contract) 1. Create a new folder and a file inside that folder called `secrets.env`. The `secrets.env` file will contain our secrets to avoid having to store them in our script directly. You should add this file to your `.gitignore` to avoid committing it by mistake. 2. Fill the `secrets.env` file with the following variables: We can generate the validator and withdrawal mnemonic using `eth2-val-tools`. In your terminal, type out: ``` eth2-val-tools mnemonic ``` The output should contain a list of 24 words. Copy those words into the `secrets.env` file under the variable `VALIDATORS_MNEMONIC`. Don’t forget to wrapthe 24 words inside “”! Repeat the process for `WITHDRAWALS_MNEMONIC`. :::warning Please backup these mnemonics safely! ::: Decide on how many deposits you would like to perform. Generally this would be (amount of testnet tokens you possess). Set the `ACC_START_INDEX` and `ACC_END_INDEX` in `secrets.env` accordingly. Now we can finally add our private key and address from which the deposits will be made. This will be the in metamask, go to the account with the tokens > click on the three dots > click on Account details > click on export private key. We will need the private key in the script to access the funds and perform the deposits, so save this somewhere safely. Fill out `ETH1_FROM_ADDR` and `ETH1_FROM_PRIV` in `secrets.env` accordingly. Don’t forget to wrap both inside “” and they should start with `0x`. We will store the deposit data temporarily to allow us to manually inspect it,enter the full path of where the file should be stored as the variable `DEPOSIT_DATAS_FILE_LOCATION` in `secrets.env` In the end, your `secrets.env` file should look somewhat like this: ``` ACC_START_INDEX=<Start index, usually 0> ACC_END_INDEX=<End index or number of validators wanted> DEPOSIT_AMOUNT=32000000000 FORK_VERSION="0x90000069" VALIDATORS_MNEMONIC=<Enter mnemonic here> WITHDRAWALS_MNEMONIC=<Enter mnemonic here> DEPOSIT_DATAS_FILE_LOCATION=<Enter temp file location> DEPOSIT_CONTRACT_ADDRESS="0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D" ETH1_FROM_ADDR="<Enter Eth address containing tokens>" ETH1_FROM_PRIV="<Enter private key of Eth address containing tokens>" ETH1_NETWORK=https://<Sepolia node RPC endpoint> ``` 3. The scripts are divided into two parts. One part generates the deposit data and the second part performs the deposit. The idea is to split it in two to allow for manual checking of the data. Create a file called `build_deposits.sh` in the same folder as `secrets.env` with the following contents: ``` #!/bin/bash echo "USE AT YOUR OWN RISK" read -p "Are you sure? " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]] then [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 fi source secrets.env eth2-val-tools deposit-data \ --source-min=$ACC_START_INDEX \ --source-max=$ACC_END_INDEX \ --amount=$DEPOSIT_AMOUNT \ --fork-version=$FORK_VERSION \ --withdrawals-mnemonic="$WITHDRAWALS_MNEMONIC" \ --validators-mnemonic="$VALIDATORS_MNEMONIC" > $DEPOSIT_DATAS_FILE_LOCATION.txt ``` The script will read the variables inside secrets.env and build the deposit data for you in a text file stored at `$DEPOSIT_DATAS_FILE_LOCATION`. Run the script using `./build_deposits.sh`. 4. The deposit data will be a bunch of json with the following format: ``` { "account": "m/12381/3600/1/0/0", "deposit_data_root": "", "pubkey": "", "signature": "", "value": 32000000000, "version": 1, "withdrawal_credentials": "" } ``` Manually check if it looks okay to begin with. The account format would be `m/12381/3600/key_number/0/0`. The `key_number` should co-relate to the `ACC_START_INDEX` and `ACC_END_INDEX` entered earlier. 5. Create a file called `exec_deposits.sh` in the same folder as `secrets.env` with the following contents: ``` #!/bin/bash echo "USE AT YOUR OWN RISK" read -p "Are you sure? " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]] then [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 fi source secrets.env if [[ -z "${DEPOSIT_CONTRACT_ADDRESS}" ]]; then echo "need DEPOSIT_CONTRACT_ADDRESS environment var" exit 1 || return 1 fi if [[ -z "${ETH1_FROM_ADDR}" ]]; then echo "need ETH1_FROM_ADDR environment var" exit 1 || return 1 fi if [[ -z "${ETH1_FROM_PRIV}" ]]; then echo "need ETH1_FROM_PRIV environment var" exit 1 || return 1 fi # Iterate through lines, each is a json of the deposit data and some metadata while read x; do account_name="$(echo "$x" | jq '.account')" pubkey="$(echo "$x" | jq '.pubkey')" echo "Sending deposit for validator $account_name $pubkey" ethereal beacon deposit \ --allow-unknown-contract \ --address="$DEPOSIT_CONTRACT_ADDRESS" \ --connection=$ETH1_NETWORK \ --data="$x" \ --value="$DEPOSIT_ACTUAL_VALUE" \ --from="$ETH1_FROM_ADDR" \ --privatekey="$ETH1_FROM_PRIV" echo "Sent deposit for validator $account_name $pubkey" sleep 5 done < "$DEPOSIT_DATAS_FILE_LOCATION.txt" ``` This script will read the values in `secrets.env` and then go through the temporary deposits file specified in `$DEPOSIT_DATAS_FILE_LOCATION`. It will process the json line by line and perform the deposit using the private key. Since we want to perform a large amount of deposits, we ideally want to avoid dos-ing the network all at once. To avoid that, there is a sleep command between each deposit to allow some time between deposits. Note: It is possible that one or more deposits might fail if done too quickly or due to the network state. To avoid this, its best to split up deposits into smaller batches of 10/25 or so - this would also make debugging nonce issues easier. :::warning Perform the deposits! Please be really sure before executing this step! ::: Finally,Run the script using `exec_deposits.sh`. 6. Check the deposit status in an [explorer](https://sepolia.etherscan.io/address/0x7f02C3E3c98b133055B8B348B2Ac625669Ed295D). Huge shoutout to [Protolambda](https://protolambda.com/) and the tool developers for creating both the scripts and the tools! ## Generating keys - Please use the [staking-deposit-cli](https://github.com/ethereum/staking-deposit-cli) to generate the keys after the deposits have been done and import them into your validator client.