mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
docs: rework book (#2566)
This commit is contained in:
committed by
GitHub
parent
70bcd76032
commit
52f2bc5ebc
57
book/installation/binaries.md
Normal file
57
book/installation/binaries.md
Normal file
@ -0,0 +1,57 @@
|
||||
# Binaries
|
||||
|
||||
Precompiled binaries are available from the [GitHub releases page](https://github.com/paradigmxyz/reth/releases).
|
||||
These are better managed by using [rethup](#using-rethup).
|
||||
|
||||
## Rethup
|
||||
|
||||
rethup is the Reth installer. It is a wrapper around the GitHub releases page, and allows you to install Reth from a specific branch, commit, or pull request from your terminal, easily.
|
||||
|
||||
Open your terminal and run the following command:
|
||||
|
||||
```sh
|
||||
curl -L https://reth.paradigm.xyz | bash
|
||||
```
|
||||
|
||||
This will install rethup, then simply follow the instructions on-screen,
|
||||
which will make the `rethup` command available in your CLI.
|
||||
|
||||
Running `rethup` by itself will install the latest (nightly) precompiled binary for `reth`.
|
||||
See `rethup --help` for more options, like installing from a specific version or commit.
|
||||
|
||||
> ℹ️ **Note**
|
||||
>
|
||||
> If you're on Windows, you will need to install and use [Git BASH](https://gitforwindows.org/) or [WSL](https://learn.microsoft.com/en-us/windows/wsl/install),
|
||||
> as your terminal, since rethup currently does not support Powershell or Cmd.
|
||||
|
||||
You can use the different rethup flags to install reth from a specific branch, pull request, or path.
|
||||
|
||||
```sh
|
||||
rethup --branch master
|
||||
rethup --path path/to/reth
|
||||
rethup --pr 1234
|
||||
```
|
||||
|
||||
## From Github Releases
|
||||
|
||||
Alternatively, you can download the binaries from the [GitHub releases page](https://github.com/paradigmxyz/reth/releases).
|
||||
|
||||
Binaries are supplied for four platforms:
|
||||
|
||||
- `x86_64-unknown-linux-gnu`: AMD/Intel 64-bit processors (most desktops, laptops, servers)
|
||||
- `x86_64-apple-darwin`: macOS with Intel chips
|
||||
- `aarch64-unknown-linux-gnu`: 64-bit ARM processors (Raspberry Pi 4)
|
||||
- `x86_64-windows`: Windows with 64-bit processors
|
||||
|
||||
Each binary is contained in a `.tar.gz` archive. For this example, lets assume the user needs
|
||||
a `x86_64` binary:
|
||||
1. Go to the [Releases](https://github.com/paradigmxyz/reth/releases) page and
|
||||
select the latest release.
|
||||
1. Download the `reth-${VERSION}-x86_64-unknown-linux-gnu.tar.gz` binary. For example, to obtain the binary file for v0.0.1 (the latest version at the time of writing), a user can run the following commands in a linux terminal:
|
||||
```bash
|
||||
cd ~
|
||||
curl -LO https://github.com/paradigmxyz/reth/releases/download/v0.0.1-alpha/reth-v0.0.1-alpha-x86_64-unknown-linux-gnu.tar.gz
|
||||
tar -xvf reth-v0.0.1-alpha-x86_64-unknown-linux-gnu.tar.gz
|
||||
```
|
||||
1. Test the binary with `./reth --version` (it should print the version).
|
||||
1. (Optional) Move the `reth` binary to a location in your `PATH`, so the `reth` command can be called from anywhere. For example, to copy `reth` from the current directory to `usr/bin`, run `sudo cp reth /usr/bin`.
|
||||
47
book/installation/docker.md
Normal file
47
book/installation/docker.md
Normal file
@ -0,0 +1,47 @@
|
||||
# Docker
|
||||
|
||||
There are two ways to obtain a Reth Docker image:
|
||||
|
||||
1. [Docker Hub](#docker-hub), or
|
||||
2. By [building a Docker image from source](#building-the-docker-image).
|
||||
|
||||
Once you have obtained the docker image via one of these methods, proceed to [Using the Docker
|
||||
image](#using-the-docker-image).
|
||||
|
||||
## Docker Hub
|
||||
|
||||
Reth maintains the [paradigmxyz/reth][docker_hub] Docker Hub repository which provides an easy
|
||||
way to run Reth without building the image yourself.
|
||||
|
||||
Obtain the latest image with:
|
||||
|
||||
```bash
|
||||
docker pull paradigmxyz/reth
|
||||
```
|
||||
|
||||
Download and test the image with:
|
||||
|
||||
```bash
|
||||
docker run paradigmxyz/reth reth --version
|
||||
```
|
||||
|
||||
If you can see the latest [Reth release](https://github.com/paradigmxyz/reth/releases) version
|
||||
(see example below), then you've successfully installed Reth via Docker.
|
||||
|
||||
## Building the Docker Image
|
||||
|
||||
To build the image from source, navigate to
|
||||
the root of the repository and run:
|
||||
|
||||
```bash
|
||||
docker build . -t reth:local
|
||||
```
|
||||
|
||||
The build will likely take several minutes. Once it's built, test it with:
|
||||
|
||||
```bash
|
||||
docker run reth:local reth --help
|
||||
```
|
||||
|
||||
[docker_hub]: https://hub.docker.com/repository/docker/paradigmxyz/reth/
|
||||
|
||||
41
book/installation/installation.md
Normal file
41
book/installation/installation.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Installation
|
||||
|
||||
Reth runs on Linux and macOS (Windows tracked).
|
||||
|
||||
There are three core methods to obtain Reth:
|
||||
* [Pre-built binaries](./binaries.md).
|
||||
* [Docker images](./docker.md).
|
||||
* [Building from source.](./source.md).
|
||||
|
||||
## Hardware Requirements
|
||||
|
||||
The hardware requirements for running Reth depend on the node configuration and can change over time as the network grows or new features are implemented. The most important requirement is by far the disk, whereas CPU and RAM requirements are relatively flexible.
|
||||
|
||||
### Disk
|
||||
|
||||
There are multiple types of disks to sync Reth, with varying size requirements, depending on the [syncing mode](../run/sync-modes.md):
|
||||
|
||||
* Archive Node: At least 2.5TB is required to store
|
||||
* Full Node: TBD
|
||||
|
||||
The time to sync also varies depending on the node type. NVMe drives are recommended for the best performance, however they can get expensive. SSDs are a good alternative, and HDDs are the cheapest option, but they will take the longest to sync.
|
||||
|
||||
### CPU
|
||||
|
||||
Most of the time in Ethereum is spent executing transactions, which is a single-threaded operation due to potential state dependencies of a transaction on previous ones. As a result, the number of cores matters less, but in general higher clock speeds are better. More cores are better for parallelizable [stages, like Senders Recovery, or Bodies](../developers/architecture.md), but these stages are not the bottleneck for syncing.
|
||||
|
||||
### Memory
|
||||
|
||||
It is recommended to use at least 8GB of RAM.
|
||||
|
||||
Most of Reth's components tend to consume a low amount of memory, unless you are under heavy RPC load, so this should matter less than the other requirements.
|
||||
|
||||
Higher memory is generally better as it allows for better caching and less stress on the disk.
|
||||
|
||||
### Bandwidth
|
||||
|
||||
A stable and dependable internet connection is crucial for both syncing a node from genesis and for keeping up with the chain's tip.
|
||||
|
||||
Note that due to Reth's staged sync, you only need an internet connection for the Headers and Bodies stages. This means that the first 1-3 hours (depending on your internet connection) will be online, downloading all necessary data, and the rest will be done offline and does not require an internet connection.
|
||||
|
||||
Once you're synced to the tip you will need a reliable connection, especially if you're operating a validator. A 24MBps connection is recommended, but you can probably get away with less. Make sure your ISP does not cap your bandwidth.
|
||||
121
book/installation/source.md
Normal file
121
book/installation/source.md
Normal file
@ -0,0 +1,121 @@
|
||||
# Build from Source
|
||||
|
||||
You can build Reth on Linux, macOS, and Windows WSL.
|
||||
|
||||
# Dependencies
|
||||
|
||||
First, **install Rust** using [rustup](https://rustup.rs/):
|
||||
|
||||
```bash
|
||||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
||||
```
|
||||
|
||||
The rustup installer provides an easy way to update the Rust compiler, and works on all platforms.
|
||||
|
||||
> Tips:
|
||||
>
|
||||
> - During installation, when prompted, enter `1` for the default installation.
|
||||
> - After Rust installation completes, try running `cargo version` . If it cannot
|
||||
> be found, run `source $HOME/.cargo/env`. After that, running `cargo version` should return the version, for example `cargo 1.68.2`.
|
||||
> - It's generally advisable to append `source $HOME/.cargo/env` to `~/.bashrc`.
|
||||
|
||||
With Rust installed, follow the instructions below to install dependencies relevant to your
|
||||
operating system:
|
||||
|
||||
- **Ubuntu**: `apt-get install libclang-dev pkg-config build-essential`
|
||||
- **macOS**: `brew install llvm pkg-config`
|
||||
|
||||
# Build Reth
|
||||
|
||||
With Rust and the dependencies installed, you're ready to build Reth. First, clone the repository:
|
||||
|
||||
```bash
|
||||
git clone https://github.com/paradigmxyz/reth
|
||||
cd reth
|
||||
```
|
||||
|
||||
Then, install Reth into your path directly via:
|
||||
|
||||
```bash
|
||||
cargo install --locked --path bin/reth --bin reth
|
||||
```
|
||||
|
||||
The binary will now be accessible as `reth` via the command line, and exist under your default `.cargo/bin` folder.
|
||||
|
||||
Alternatively, you can build yourself with:
|
||||
|
||||
```bash
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
This will place the reth binary under `./target/release/reth`, and you can copy it to your directory of preference after that.
|
||||
|
||||
You can also build Reth with the following rustflags for utilizing faster CPU instructions available on your machine:
|
||||
|
||||
```bash
|
||||
RUSTFLAGS="-C target-cpu=native" cargo build --release
|
||||
```
|
||||
|
||||
Compilation may take around 10 minutes. Installation was successful if `reth --help` displays
|
||||
the [command-line documentation](../cli/cli.md).
|
||||
|
||||
If you run into any issues, please check the [Troubleshooting](#troubleshooting) section.
|
||||
out to us on [Telegram](https://t.me/paradigm_reth).
|
||||
|
||||
## Update Reth
|
||||
|
||||
You can update Reth to a specific version by running the commands below. The `reth`
|
||||
directory will be the location you cloned reth to during the installation process.
|
||||
`${VERSION}` will be the version you wish to build in the format `vX.X.X`.
|
||||
|
||||
```bash
|
||||
cd reth
|
||||
git fetch
|
||||
git checkout ${VERSION}
|
||||
cargo build --release
|
||||
```
|
||||
|
||||
## Compilation Profiles
|
||||
|
||||
You can customise the compiler settings used to compile Reth via
|
||||
[Cargo profiles](https://doc.rust-lang.org/cargo/reference/profiles.html).
|
||||
|
||||
Reth includes several profiles which can be selected via the `--profile` cargo parameter.
|
||||
|
||||
* `release`: default for source builds, enables most optimisations while not taking too long to
|
||||
compile.
|
||||
* `maxperf`: default for binary releases, enables aggressive optimisations including full LTO.
|
||||
Although compiling with this profile improves some benchmarks by around 20% compared to `release`,
|
||||
it imposes a _significant_ cost at compile time and is only recommended if you have a fast CPU.
|
||||
|
||||
You can also use `RUSTFLAGS="-C target-cpu=native"` to enable CPU-specific optimisations. In order to get
|
||||
the highest performance out of your build:
|
||||
|
||||
```bash
|
||||
RUSTFLAGS="-C target-cpu=native" cargo build --profile maxperf
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Command is not found
|
||||
|
||||
Reth will be installed to `CARGO_HOME` or `$HOME/.cargo`. This directory
|
||||
needs to be on your `PATH` before you can run `$ reth`.
|
||||
|
||||
See ["Configuring the `PATH` environment variable"](https://www.rust-lang.org/tools/install) for more information.
|
||||
|
||||
### Compilation error
|
||||
|
||||
Make sure you are running the latest version of Rust. If you have installed Rust using rustup, simply run `rustup update`.
|
||||
|
||||
If you can't install the latest version of Rust you can instead compile using the Minimum Supported
|
||||
Rust Version (MSRV) which is listed under the `rust-version` key in Reth's
|
||||
[Cargo.toml](https://github.com/paradigmxyz/reth/blob/main/Cargo.toml).
|
||||
|
||||
If compilation fails with `(signal: 9, SIGKILL: kill)`, this could mean your machine ran out of
|
||||
memory during compilation. If you are on Docker, consider increasing the memory of the container, or use a [pre-built
|
||||
binary](../binaries.md).
|
||||
|
||||
If compilation fails with `error: linking with cc failed: exit code: 1`, try running `cargo clean`.
|
||||
|
||||
_(Thanks to Sigma Prime for this section from [their Lighthouse book](https://lighthouse-book.sigmaprime.io/installation.html)!)_
|
||||
Reference in New Issue
Block a user