Skip to content

Commit

Permalink
WIP: ETH Solo Staking and Online Security
Browse files Browse the repository at this point in the history
  • Loading branch information
auto-call committed Oct 8, 2023
1 parent 3018b9a commit 9b09b19
Show file tree
Hide file tree
Showing 12 changed files with 173 additions and 206 deletions.
7 changes: 7 additions & 0 deletions 404.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
layout: default
title: 404
nav_exclude: true
---

Page not found.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ gem "jekyll", "~> 4.3.2" # installed by `gem jekyll`

gem "just-the-docs", "0.6.2" # pinned to the current release
# gem "just-the-docs" # always download the latest release

gem "jekyll-target-blank"
10 changes: 9 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ GEM
sass-embedded (~> 1.54)
jekyll-seo-tag (2.8.0)
jekyll (>= 3.8, < 5.0)
jekyll-target-blank (2.0.2)
jekyll (>= 3.0, < 5.0)
nokogiri (~> 1.10)
jekyll-watch (2.2.1)
listen (~> 3.0)
just-the-docs (0.6.2)
Expand All @@ -53,18 +56,22 @@ GEM
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
nokogiri (1.15.4-x86_64-linux)
racc (~> 1.4)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (5.0.3)
racc (1.7.1)
rake (13.0.6)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
ffi (~> 1.0)
rexml (3.2.6)
rouge (4.1.3)
safe_yaml (1.0.5)
sass-embedded (1.67.0-x86_64-linux-gnu)
sass-embedded (1.68.0)
google-protobuf (~> 3.23)
rake (>= 13.0.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.4.2)
Expand All @@ -75,6 +82,7 @@ PLATFORMS

DEPENDENCIES
jekyll (~> 4.3.2)
jekyll-target-blank
just-the-docs (= 0.6.2)

BUNDLED WITH
Expand Down
175 changes: 3 additions & 172 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,174 +1,5 @@
# just-the-docs-template
# auto-call.github.io

This is a *bare-minimum* template to create a [Jekyll] site that:
My home for tutorials and projects.

- uses the [Just the Docs] theme;
- can be built and published on [GitHub Pages];
- can be built and previewed locally, and published on other platforms.

More specifically, the created site:

- uses a gem-based approach, i.e. uses a `Gemfile` and loads the `just-the-docs` gem;
- uses the [GitHub Pages / Actions workflow] to build and publish the site on GitHub Pages.

To get started with creating a site, simply:

1. click "[use this template]" to create a GitHub repository
2. go to Settings > Pages > Build and deployment > Source, and select GitHub Actions

If you want to maintain your docs in the `docs` directory of an existing project repo, see [Hosting your docs from an existing project repo](#hosting-your-docs-from-an-existing-project-repo).

After completing the creation of your new site on GitHub, update it as needed:

## Replace the content of the template pages

Update the following files to your own content:

- `index.md` (your new home page)
- `README.md` (information for those who access your site repo on GitHub)

## Changing the version of the theme and/or Jekyll

Simply edit the relevant line(s) in the `Gemfile`.

## Adding a plugin

The Just the Docs theme automatically includes the [`jekyll-seo-tag`] plugin.

To add an extra plugin, you need to add it in the `Gemfile` *and* in `_config.yml`. For example, to add [`jekyll-default-layout`]:

- Add the following to your site's `Gemfile`:

```ruby
gem "jekyll-default-layout"
```

- And add the following to your site's `_config.yml`:

```yaml
plugins:
- jekyll-default-layout
```
Note: If you are using a Jekyll version less than 3.5.0, use the `gems` key instead of `plugins`.

## Publishing your site on GitHub Pages

1. If your created site is `YOUR-USERNAME/YOUR-SITE-NAME`, update `_config.yml` to:

```yaml
title: YOUR TITLE
description: YOUR DESCRIPTION
theme: just-the-docs
url: https://YOUR-USERNAME.github.io/YOUR-SITE-NAME
aux_links: # remove if you don't want this link to appear on your pages
Template Repository: https://github.com/YOUR-USERNAME/YOUR-SITE-NAME
```

2. Push your updated `_config.yml` to your site on GitHub.

3. In your newly created repo on GitHub:
- go to the `Settings` tab -> `Pages` -> `Build and deployment`, then select `Source`: `GitHub Actions`.
- if there were any failed Actions, go to the `Actions` tab and click on `Re-run jobs`.

## Building and previewing your site locally

Assuming [Jekyll] and [Bundler] are installed on your computer:

1. Change your working directory to the root directory of your site.

2. Run `bundle install`.

3. Run `bundle exec jekyll serve` to build your site and preview it at `localhost:4000`.

The built site is stored in the directory `_site`.

## Publishing your built site on a different platform

Just upload all the files in the directory `_site`.

## Customization

You're free to customize sites that you create with this template, however you like!

[Browse our documentation][Just the Docs] to learn more about how to use this theme.

## Hosting your docs from an existing project repo

You might want to maintain your docs in an existing project repo. Instead of creating a new repo using the [just-the-docs template](https://github.com/just-the-docs/just-the-docs-template), you can copy the template files into your existing repo and configure the template's Github Actions workflow to build from a `docs` directory. You can clone the template to your local machine or download the `.zip` file to access the files.

### Copy the template files

1. Create a `.github/workflows` directory at your project root if your repo doesn't already have one. Copy the `pages.yml` file into this directory. GitHub Actions searches this directory for workflow files.

2. Create a `docs` directory at your project root and copy all remaining template files into this directory.

### Modify the GitHub Actions workflow

The GitHub Actions workflow that builds and deploys your site to Github Pages is defined by the `pages.yml` file. You'll need to edit this file to that so that your build and deploy steps look to your `docs` directory, rather than the project root.

1. Set the default `working-directory` param for the build job.

```yaml
build:
runs-on: ubuntu-latest
defaults:
run:
working-directory: docs
```

2. Set the `working-directory` param for the Setup Ruby step.

```yaml
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
cache-version: 0
working-directory: '${{ github.workspace }}/docs'
```

3. Set the path param for the Upload artifact step:

```yaml
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: "docs/_site/"
```

4. Modify the trigger so that only changes within the `docs` directory start the workflow. Otherwise, every change to your project (even those that don't affect the docs) would trigger a new site build and deploy.

```yaml
on:
push:
branches:
- "main"
paths:
- "docs/**"
```

## Licensing and Attribution

This repository is licensed under the [MIT License]. You are generally free to reuse or extend upon this code as you see fit; just include the original copy of the license (which is preserved when you "make a template"). While it's not necessary, we'd love to hear from you if you do use this template, and how we can improve it for future use!

The deployment GitHub Actions workflow is heavily based on GitHub's mixed-party [starter workflows]. A copy of their MIT License is available in [actions/starter-workflows].

----

[^1]: [It can take up to 10 minutes for changes to your site to publish after you push the changes to GitHub](https://docs.github.com/en/pages/setting-up-a-github-pages-site-with-jekyll/creating-a-github-pages-site-with-jekyll#creating-your-site).

[Jekyll]: https://jekyllrb.com
[Just the Docs]: https://just-the-docs.github.io/just-the-docs/
[GitHub Pages]: https://docs.github.com/en/pages
[GitHub Pages / Actions workflow]: https://github.blog/changelog/2022-07-27-github-pages-custom-github-actions-workflows-beta/
[Bundler]: https://bundler.io
[use this template]: https://github.com/just-the-docs/just-the-docs-template/generate
[`jekyll-default-layout`]: https://github.com/benbalter/jekyll-default-layout
[`jekyll-seo-tag`]: https://jekyll.github.io/jekyll-seo-tag
[MIT License]: https://en.wikipedia.org/wiki/MIT_License
[starter workflows]: https://github.com/actions/starter-workflows/blob/main/pages/jekyll.yml
[actions/starter-workflows]: https://github.com/actions/starter-workflows/blob/main/LICENSE
Created using [Just the Docs](https://just-the-docs.github.io/just-the-docs/)
23 changes: 19 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
title: Just the Docs Template
description: A starter template for a Jeykll site using the Just the Docs theme!
title: Autocall
description: Autocall's home for tutorials and projects
theme: just-the-docs

url: https://just-the-docs.github.io
baseurl: ""
url: https://auto-call.github.io

permalink: pretty

aux_links:
Template Repository: https://github.com/just-the-docs/just-the-docs-template
My GitHub: https://github.com/auto-call
aux_links_new_tab: true

favicon_ico: "/assets/images/favicon.png"

back_to_top: true
back_to_top_text: "Back to top"

last_edit_timestamp: true
last_edit_time_format: "%b %e, %Y"

plugins:
- jekyll-target-blank
18 changes: 18 additions & 0 deletions _includes/components/footer.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{% if site.last_edit_timestamp or site.gh_edit_link %}
<hr>
<footer>
{% if site.back_to_top %}
<p><a href="#top" id="back-to-top">{{ site.back_to_top_text }}</a></p>
{% endif %}

{% if site.last_edit_timestamp or site.gh_edit_link %}
<div class="d-flex mt-2">
{% if site.last_edit_timestamp and site.last_edit_time_format and page.last_modified_date %}
<p class="text-small text-grey-dk-000 mb-0 mr-2">
Page last modified: <span class="d-inline-block">{{ page.last_modified_date | date: site.last_edit_time_format }}</span>.
</p>
{% endif %}
</div>
{% endif %}
</footer>
{% endif %}
3 changes: 3 additions & 0 deletions _includes/footer_custom.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{%- if site.footer_content -%}
<p class="text-small text-grey-dk-100 mb-0">{{ site.footer_content }}</p>
{%- endif -%}
Binary file added assets/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/ubuntu_install_options.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions docs/ethstaking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
---
title: ETH Solo Staking
layout: default
nav_order: 2
last_modified_date: 2023/09/24
---

# ETH Solo Staking
{: .no_toc }

ETH Staking is the action of committing ETH to the Beacon chain in order to run a validator for the Ethereum network. When you commit ETH to the Beacon chain, you no longer have direct control on it (ie, you cannot spend it). However, it's possible to request for your validator to be removed from the network, in which case the associated 32 ETH will be returned to an address you control. You can exit whenever you like.

During the whole process, no one can mess with your 32 ETH unless they gain access to your validator credentials **and** your withdrawal address.

As a reward for running a validator, you receive ETH from two streams:
- **Execution**: receive tips from transactions.
- **Issuance**: receive rewards for proposing a new block and participating in Sync committees. These rewards are much higher but happen rarely, as just a few validators are chosen to participate in committees for each block.

This tutorial is primarily based on the excellent [CoinCashew's Guide](https://www.coincashew.com/coins/overview-eth/guide-or-how-to-setup-a-validator-on-eth2-mainnet). I really recommend going through this guide if you want to solo stake. My tutorial is a small addition to it, with some tips on steps for which the guide is lacking details.

Note that there are other ways to stake ETH, but they all involve giving up at least some control to a third party over your validator credentials or your ETH. You can check the options on the [official Ethereum page](https://ethereum.org/en/staking/#how-to-stake-your-eth).

**Disclaimer**: I am neither an employee of, nor associated in any way with any company or product mentioned on this page. The content of this page is not an investment advice.

## Table of contents
{: .no_toc .text-delta .fs-6 }
- TOC
{:toc}

# Requirements

In order to solo stake ETH, you need:
- Control of an ETH address with at least 32 ETH (in practice, 32 + some change for gas fees when transfering your 32 ETH to the Beacon Deposit Contract).
- Hardware powerful enough to run the ETH execution/consensus/validator software, and that can stay up almost 24/7. You can either use your own (see [Hardware](#hardware-setup) for recommendations), or use cloud based solutions such as AWS.
- Fast and reliable Internet connection.
- Some know-how with Linux and the command line. Some execution/consensus clients provide MacOS or Windows versions of their software, but most resources are for Linux. This tutorial covers Linux tools only.

# Hardware Setup

Ideally, you want to have a machine that is dedicated to ETH staking. Contrarily to PoW mining, PoS staking is not massively computationally consuming, and there is no need for a GPU. However, you still need a decent CPU, quite a lot of RAM, and a lot of disk space. Using an NVMe SSD is advised.

[Intel NUC](https://www.intel.fr/content/www/fr/fr/products/details/nuc.html) or similar hardware is a reasonable choice. Personally, I built my own machine with the following components:
- **Motherboard & CPU**: [Intel NUC13ANBi7](https://www.intel.fr/content/www/fr/fr/products/sku/233114/intel-nuc-13-pro-board-nuc13anbi7/specifications.html). This is probably overkill as my CPU is underused. An i5 would certainly do just fine.
- **RAM**: [Crucial 32GB Kit (2 x 16GB) DDR4-3200 SODIMM](https://www.crucial.fr/memory/ddr4/ct2k16g4sfra32a). I recommend having 32 GB of RAM. With a single validator running, my RAM usage is typically around 20GB.
- **SSD**: [FireCuda 530 4 TB](https://www.seagate.com/fr/fr/products/gaming-drives/pc-gaming/firecuda-530-ssd/). Again, 4TB is probably overkill, but the blockchain does grow fast, typically 1GB/day. At the time of writing this, I have not fully explored options in the execution client to prune the database, but it seems like it's possible, at the cost of going offline for a day or two. Anyhow, I recommend having at least 2TB.
- **AC Power Adapter**: [Delippo 120W 19V 6.32A](https://www.amazon.fr/dp/B07MV6C89N?psc=1&ref=ppx_yo2ov_dt_b_product_details).
- **Case**: [Maxwell Pro Fanless Mini-ITX case](https://akasa.co.uk/update.php?tpl=product/product.detail.tpl&model=A-ITX48-M1B). CPU and disk usage can be pretty heavy when running the validator, so you need some cooling. As my machine is sitting in my living room, I didn't want to have constant fan noise, so I chose this fanless case that dissipates heat with copper tubes and various thermal modules. You can buy it [here](https://www.cartft.com/catalog/il/3459).

# Linux installation

The easiest way to go is to install Ubuntu. You can follow the official installation guide. At this step I recommend choosing `Minimal installation`, and leaving `Install third party software` option unchecked. Running your staking node will not require any of this additional software, and you can always install additional software later if needed.

![Ubuntu install options](/assets/images/ubuntu_install_options.png)

# Setting up your node

Follow the steps from CoinCashew's guide, from [Step 2](https://www.coincashew.com/coins/overview-eth/guide-or-how-to-setup-a-validator-on-eth2-mainnet/part-i-installation/step-2-configuring-node) to [Step 4](https://www.coincashew.com/coins/overview-eth/guide-or-how-to-setup-a-validator-on-eth2-mainnet/part-i-installation/step-4-installing-consensus-client). You will have to choose an *execution client* and a *consensus client*. There are a few options for each. It is recommended to use a *minority client*, ie one that is used by a small percentage of nodes. Theoretically, this helps with ETH network resilience as an issue with a minority client would impact a smaller part of the network than an issue on a client everyone uses.

You can check current client distribution estimates [here](https://clientdiversity.org/). Personally, I chose *Besu* as execution client and *Teku* as consensus. So far, they have been running fine, although Besu database seems to be growing quite fast.

## Port forwarding

It is recommended to set up port forwarding on your router for your execution and consensus clients. To my understanding, it is not mandatory for your clients to run correctly, but it will help you have optimal connectivity to peers on the ETH network.

What does port forwarding mean? Your clients communicate with the external world through specific ports (you should have gone through this at [Step 2](https://www.coincashew.com/coins/overview-eth/guide-or-how-to-setup-a-validator-on-eth2-mainnet/part-i-installation/step-2-configuring-node)). By default, your home router will typically block traffic from the external world to your home network through these ports. You need to explicitly allow relevant ports in your router interface. My router is a Orange Livebox 5, if you have a different one, refer to your Internet provider instructions to adapt the steps below.

### DHCP Setup

toto

### NAT Setup

toto

# Adding a validator to your node

**This is the most critical step, be extra careful**.

# Monitoring your node

## NoIP

# Setting up downtime alerts for your node

# Further fail-safing your setup

## Uninterruptible Power Supply

## Automatic reboot
18 changes: 18 additions & 0 deletions docs/onlinesecurity.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
title: Online Security
layout: default
nav_order: 3
last_modified_date: 2023/09/24
---

# Online Security
{: .no_toc }

On this page, I lay out my personal online security setup, with some recommendations covering general online activity, and some specific to crypto currency.

**Disclaimer**: I am neither an employee of nor associated in any way with any company or product mentioned on this page.

- TOC
{:toc}

# Passwords
Loading

0 comments on commit 9b09b19

Please sign in to comment.