How to Run an Eth2 Node

Elan Halpern
Alchemy
Published in
4 min readNov 26, 2020

A quick guide to setting up a Prysm eth2 node or validator using Alchemy.

If you want general information on Etherum 2.0, we recommend checking out ethereum.org.

You can use Alchemy to support your eth2 project by running a beacon node or running a validator (note if you want to run a validator you’ll have to also run a node to interact with the beacon chain). A beacon node simply maintains a view of the beacon chain and shard chain, while validators actively mine and validate new blocks (earning rewards in the process). In order to become a validator you have to stake 32 Eth. You can learn more about staking on ethereum.org and on EthHub.‌

There are a handful of beacon node clients to choose from, however, in this guide we’ll walk you through setting up a Prysm node. The set up process should not be that different for other node clients!

HINT: If you are just getting started it is highly recommended to run an eth2 testnode prior to jumping into mainnet.

To learn more about Prysm, check out their Eth2 Documentation.

Note: The instructions below were adopted from the Prysm Getting Started Guide.

Running an eth2 node

1. Get Prysm

Follow this guide to install Prysm using an installation script, or if you prefer Docker check out these instructions.‌

2. Connect eth2 node to eth1 node (Alchemy)

During the transition period from eth1 to eth2, beacon nodes will need to monitor the eth1 chain for data. Additionally, eth2 validators are required to “burn” 32 of their ETH into an eth1 smart contract in order to become validators, which requires connection to an eth1 node.

This is where you can connect your eth2 node to Alchemy mainnet or Goerli testnet.‌ You can sign up for a free Alchemy account here.

All you have to do is specify the --http-web3provider flag to your Alchemy HTTP endpoint when running your Prysm node:

Using the Prysm installation script:

Note: This guide is for setting up your Eth2 node using MacOS, for Windows and Arm64, check out the official Prysm documentation.

Mainnet

./prysm.sh beacon-chain --http-web3provider=https://eth-mainnet.alchemyapi.io/v2/YOUR-API-KEY

Testnet

./prysm.sh beacon-chain --http-web3provider=https://eth-goerli.alchemyapi.io/v2/YOUR-API-KEY --pyrmont

Using Docker:

Mainnet

docker run -it -v $HOME/.eth2:/data -p 4000:4000 -p 13000:13000 -p 12000:12000/udp --name beacon-node \
gcr.io/prysmaticlabs/prysm/beacon-chain:stable \
--datadir=/data \
--rpc-host=0.0.0.0 \
--monitoring-host=0.0.0.0 \
--http-web3provider=https://eth-mainnet.alchemyapi.io/v2/YOUR-API-KEY

Testnet

docker run -it -v $HOME/.eth2:/data -p 4000:4000 -p 13000:13000 -p 12000:12000/udp --name beacon-node \
gcr.io/prysmaticlabs/prysm/beacon-chain:stable \
--datadir=/data \
--rpc-host=0.0.0.0 \
--monitoring-host=0.0.0.0 \
--http-web3provider=https://eth-mainnet.alchemyapi.io/v2/YOUR-API-KEY
--pyrmont

Congrats! Now you’ve officially started running an eth2 Beacon node! 🎉

Running an eth 2.0 validator

Complete steps 1 and 2 from above.

For Testnet Validators

If you want to be a validator in the Pyrmont eth2 testnet prior to jumping into mainnet, you’ll still need to stake 32 testnet ETH. You can request testnet ETH by joining the Prysm discord server or requesting from a facet.

1. Follow the official eth2 onboarding

The Eth2 Launchpad has a step by step process for establishing your validator:

2. Import validator accounts into Prysm

Copy the path to the validator_keys folder under the eth2.0-deposit-cli directory you created during the onboarding process. For example, if your eth2.0-deposit-cli installation is in your $HOME (or %LOCALAPPDATA% on Windows) directory, you can then run the following commands for your operating system.

Using the Prysm installation script:

Mainnet

./prysm.sh validator accounts import --keys-dir=$HOME/eth2.0-deposit-cli/validator_keys

Testnet

./prysm.sh validator accounts import --keys-dir=$HOME/eth2.0-deposit-cli/validator_keys --pyrmont

Using Docker:

Mainnet

docker run -it -v $HOME/eth2.0-deposit-cli/validator_keys:/keys \
-v $HOME/Eth2Validators/prysm-wallet-v2:/wallet \
--name validator \
gcr.io/prysmaticlabs/prysm/validator:stable \
accounts import --keys-dir=/keys --wallet-dir=/wallet

Testnet

docker run -it -v $HOME/eth2.0-deposit-cli/validator_keys:/keys \
-v $HOME/Eth2Validators/prysm-wallet-v2:/wallet \
--name validator \
gcr.io/prysmaticlabs/prysm/validator:stable \
accounts import --keys-dir=/keys --wallet-dir=/wallet --pyrmont

3. Run your validator

In a separate terminal window (from your beacon node), start running the validator using the command below.

Using the Prysm installation script

Mainnet

./prysm.sh validator

Testnet

./prysm.sh validator --pyrmont

Using Docker

Mainnet

docker run -it -v $HOME/Eth2Validators/prysm-wallet-v2:/wallet \
-v $HOME/Eth2:/validatorDB \
--network="host" --name validator \
gcr.io/prysmaticlabs/prysm/validator:stable \
--beacon-rpc-provider=127.0.0.1:4000 \
--wallet-dir=/wallet \
--datadir=/validatorDB

Testnet

docker run -it -v $HOME/Eth2Validators/prysm-wallet-v2:/wallet \
-v $HOME/Eth2:/validatorDB \
--network="host" --name validator \
gcr.io/prysmaticlabs/prysm/validator:stable \
--beacon-rpc-provider=127.0.0.1:4000 \
--wallet-dir=/wallet \
--datadir=/validatorDB \
--pyrmont‌

4. Be ready for your validator assignment

Keep both terminal windows running so that your validator can receive tasks and execute validator responsibilities. You should already be aware of all the responsibilities and staking logistics for being a validator.

‌You can check the status of your validator using block explorers: beaconcha.in and beacon.etherscan.io.

You are now officially an Ethereum 2.0 validator, congrats! 🎉

Sign up for a free Alchemy account, join our community discord, and check out our docs.

Alchemy provides the leading blockchain development platform powering millions of users for 99% of countries worldwide. Our mission is to provide developers with the fundamental building blocks they need to create the future of technology, and lower the barrier to entry for developers to build blockchain applications. Alchemy currently powers 70% of the top Ethereum applications and over $15 billion in on-chain transactions, and have been featured on TechCrunch, Wired, Bloomberg and numerous other media outlets. The Alchemy team draws from decades of deep expertise in massively scalable infrastructure, AI, and blockchain from leadership roles at technology pioneers like Google, Microsoft, Facebook, Stanford, and MIT.

Never want to miss an update? Subscribe to our newsletter here! Be sure to also follow our Twitter and join our Discord.

--

--

Elan Halpern
Alchemy

Elan Halpern works on developer experience at Alchemy, the world's leading blockchain developer platform. She received her BS in Computer Science at Stanford.