# Protocol Berg
Aim: To give people a deep dive into various tooling we have for testnets
Presentation link: https://docs.google.com/presentation/d/1zAixjucJOKIzjx4VFI-XqzBiC3asXQSy/edit?usp=drive_link&ouid=110450674004865651218&rtpof=true&sd=true
Potential attendees:
- DevOps people interested in testing
- EIP prototypers
- Testing teams
The talk is split into 3 parts:
- Part 1: Background (~30mins)
- Part 2a: Kurtosis background (~15mins)
- Part 2b: Kurtosis hands-on docker + kubernetes(~1h)
- Part 3: Intro to terraform/ansible/template-testnet (x mins) + post-workshop video
Cloud credits to try out: https://try.digitalocean.com/ethereum/
## Part 1) Background:
- Talk about Ethereum today and its components
- What do the components need to work? (introduce engineAPI)
- What files are important for us? (genesis.json, .ssz, .txt files for CL, validator keys)
- Deep dive on the files themselves (what do they control, how to read them: e.g parsedGenesis.json)
- What tools we use for generating these
- Ask if someone in the room doesn't know what docker/kubernetes is (give TLDR if so)
- Intro [ethereum-genesis-generator](https://github.com/ethpandaops/ethereum-genesis-generator/)
Contact via DM for questions on this section
## Part 2A) Kurtosis background:
- Explain what kurtosis is
- Why do we use it?
- What can you use it for?
- How is kurtosis run (TLDR)?
- How is kurtosis under the hood?
- Kurtosis SDK intro [video](https://www.loom.com/share/b79dd47f4b0e46a58e923e38770926e9?sid=6bb4702e-8542-49a1-881c-3ba37181d457)
#### Tools
- https://github.com/kurtosis-tech/kurtosis
- https://github.com/kurtosis-tech/eth-network-package
- https://github.com/kurtosis-tech/eth2-package
- https://docs.kurtosis.com
- `kurtosis discord`
## Part 2B) Kurtosis hands-on docker + Kubernetes:
This guide assumes that you are using linux/macos.
Examples:
- 1. Kurtosis with docker (default)
- 2. Kurtosis with docker (basic, stable configured + tooling (eth2-packages))
- 3. Kurtosis with docker (advanced, EIP testing)
- 4. Kurtosis with kubernetes (scaling)
Devnet using docker kurtosis:
1. DigitalOcean sign up - https://try.digitalocean.com/ethereum/
1. Install docker
Linux:
* `curl -fsSL https://get.docker.com -o get-docker.sh`
* `sh get-docker.sh`
Mac: https://docs.docker.com/desktop/install/mac-install/
2. Install kurtosis: https://docs.kurtosis.com/install/
3. create a json file according to https://notes.ethereum.org/87n9xjJtRuiuJ6VqLBnDRQ
4. profit `kurtosis run --enclave ethTestnet github.com/kurtosis-tech/eth2-package "$(cat ./example.json)"`
Devnet using kubernetes kurtosis:
1. Fetch our shared cluster config here: https://protocolberg.fra1.cdn.digitaloceanspaces.com/protocolberg.yaml OR Create a kubernetes cluster with terraform using digitalocean/etc.
2. https://docs.kurtosis.com/k8s/
3. Edit your kurtosis-config.yaml
Example configuration:
```json=
{
"participants": [
{
"el_client_type": "geth",
"cl_client_type": "teku"
},
{
"el_client_type": "nethermind",
"cl_client_type": "prysm"
},
{
"el_client_type": "besu",
"cl_client_type": "nimbus"
},
{
"el_client_type": "erigon",
"cl_client_type": "lighthouse"
},
{
"el_client_type": "reth",
"cl_client_type": "lodestar"
}
],
"network_params": {
"deneb_fork_version": 100
},
"global_client_log_level": "info"
}
```
Contact kurtosis directly for questions on this stage
## Part 3) Intro to EthPandaOps testing stack:
Introduce:
- `ssh keys`
- `gpg/age keys`
- `sops`
- `asdf`
- `ansible`
- `terraform`
- `aws-cli/s3 bucket management`
#### Tools:
- https://github.com/ethpandaops/ansible-collection-general
- https://github.com/ethpandaops/ethereum-helm-charts
- https://github.com/ethpandaops/template-testnet
Devnet using ansible:
1. DigitalOcean sign up - https://try.digitalocean.com/ethereum/
2. Sign up for github (ideally everyone has an account already).
3. Generate an ssh key (ideally you have one already, otherwise `ssh-keygen -t ed25519`
4. Push ssh key (contents of `cat ~/.ssh/id_ed25519.pub`) to your own github account. - https://github.com/settings/keys
5. Fork the repo. - https://github.com/ethpandaops/template-testnet & call it devnet-0.
6. Install asdf
* https://asdf-vm.com/guide/getting-started.html
* `git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.12.0`
* `. "$HOME/.asdf/asdf.sh"` into ~/.bashrc or ~/.zshrc
7. run `./devnet-0/setup.sh`
8. Push your ssh key to Digitalocean https://cloud.digitalocean.com/account/security?i=a4b101
* Add ssh key, call it the same as your github username
9. Create new Digitalocean API key - https://cloud.digitalocean.com/account/api/tokens?i=a4b101
* Generate new token
* export TF_VAR_do_token=yournewtoken into ~/.zshrc or ~/.bashrc
10. Create a new Digitalocean spaces key, same link as above but Spaces Keys tab
* Genereate new key
* `aws configure --profile digitalocean`
* Enter your access key
* Enter your secret key
* export AWS_PROFILE=digitalocean into ~/.zshrc or ~/.bashrc
11. Generate a GPG key or use an existing one (optional)
* [gpg](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key?platform=mac)
* insert the gpg key into .sops
* Install a tool vscode - sops easy edit or something similar
* verify that sops works with `sops hello.enc.yaml`
12. Go to `devnet-0/terraform/devnet-0/main.tf` and edit digitalocean_ssh_key_name to the keyname you called it in step 5, ideally this is now your github username.
13. Modify the validator count to reflect a realistic testnet setup.
14. run `terraform init`
15. run `terraform apply`
16. Verify that your spaces/droplets are created after confirming
17. Edit ansible/group_vars/all/defaults.yaml/bootstrap_default_user_authorized_keys_github and include your github username
18. go to devnet-0/ansible and `./install_dependencies.sh`
* assert ansible version
19. `ansible-playbook playbook.yaml`
20. Happy days.
Create github issues for questions on this stage