Skip to content

Instantly share code, notes, and snippets.

@wschwab
Created October 23, 2023 18:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wschwab/8e05af1f3e2c92fdd68b7267c94931f1 to your computer and use it in GitHub Desktop.
Save wschwab/8e05af1f3e2c92fdd68b7267c94931f1 to your computer and use it in GitHub Desktop.
Fresh Reth install (use after installLighthouse)
# use at your own risk since I'm not very experienced at this
# ASSUMING YOU ARE ROOT
# This script assumes prior usage of the Lighthouse install script
# It assumes that you've already created the user and activated the firewall, etc.
# Install needed stuff and useful stuff
apt update && apt install -y git build-essential curl libclang-dev pkg-config
# Open Reth ports - ufw installed with Lighthouse
ufw allow 30303 #peering
echo "y" | ufw enable
# Username to install under
USERNAME=eth
# Install Rust as user
su ${USERNAME} << EOF
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs |
sh -s -- -y --default-toolchain stable
source $HOME/.cargo/env
EOF
# Clone Reth
cd /home/${USERNAME}/
sudo -u ${USERNAME} mkdir github
cd github/
sudo -u ${USERNAME} git clone https://github.com/paradigmxyz/reth
cd reth/
# Install Reth directly into PATH
cargo install --locked --path /bin/reth --bin reth
# Move JWT secret to convenient location
mv /home/${USERNAME}/.local/share/reth/jwt.hex /home/${USERNAME}/jwtsecret/
cat << EOF > /etc/systemd/system/reth.service
[Unit]
Description=Reth Node
Documentation=https://paradigmxyz.github.io/reth/intro.html
After=network.target
[Service]
User=${USERNAME}
Group=${USERNAME}
WorkingDirectory=/home/${USERNAME}
Restart=on-failure
LimitNOFILE=1000000
ExecStart= /root/.cargo/bin/reth node \\
--authrpc.jwtsecret /home/${USERNAME}/jwtsecret/\\
--authrpc.addr 127.0.0.1 \\
--authrpc.port 8551 \\
--datadir /home/${USERNAME}/datadir \\
--chain mainnet \\
--http \\
--http.addr="0.0.0.0" \\
--http.corsdomain="*" \\
--http.api="eth,admin,debug,net,trace,web3,rpc,reth,ots,txpool" \\
--ws \\
--rpc.gascap="600000000"
[Install]
WantedBy=default.target
EOF
# Enable and start Reth service
systemctl enable reth.service
systemctl start reth.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment