This is a Go tool that mocks the basics of Ethereum 1.0 RPC server for usage as an endpoint for Ethereum 2.0. Created by the Prysmatic Labs team, building a production client for Ethereum 2.0 called Prysm. WARNING: This is NOT a generic Ethereum mock RPC server, as it's only purpose is to serve Ethereum 2.0 clients.
Ethereum 2.0 is an entirely new blockchain protocol which will bring much needed scalability and security upgrades to the current Ethereum ecosystem. Contrary to being a hard fork, Ethereum 2.0 will be a separate system built from scratch running Proof of Stake consensus. Participants in consensus are known as validators, and they join the network by depositing 32 ETH into a validator deposit contract deployed on the current Ethereum Proof of Work chain. Nodes running Ethereum 2.0 need to listen to these deposit contract events in order to kick-off the chain and onboard new validators.
This project serves as a mock server that simulates that deposit functionality without the need to run a real Ethereum network, making it easier to run local testnets for Ethereum 2.0. It is meant to be used alongside an Ethereum 2.0 client such as Prysm.
To run the tool, you'll need to install:
- The latest release of Bazel
- A modern GNU/Linux operating system
- Open a terminal window. Ensure you are running the most recent version of Bazel by issuing the command:
bazel version
- Clone this repository and enter the directory:
git clone https://github.com/prysmaticlabs/eth1-mock-rpc
cd prysm
- Build the project:
bazel build ///...
Bazel will automatically pull and install any dependencies as well, including Go and necessary compilers.
Instructions on downloading and building Prysm for local use can be found in the latest Prysm README.md.
You'll need to generate a bunch of validator private keys so that the mock ETH1 server can simulate enough validator deposits. Navigate to the Prysm repository locally, and run:
bazel run //validator -- accounts create --password PASSWORD --keystore-path /path/to/keystore
This will generate a single validator in your local keystore. You'll need 64 minimum to reach genesis in Prysm. Now, using that same keystore you just created, in a separate terminal window, navigate to the eth1-mock-rpc
project and launch the eth1 mock RPC:
bazel run //:eth1-mock-rpc -- --password PASSWORD --keystore-path /path/to/keystore
Once your server is running, it will launch an HTTP and websocket listener at http://localhost:7777 and http://localhost:7778 respectively. You can now launch the Prysm project and point it to these endpoints to receive mock data:
bazel run //beacon-chain -- \
--no-discovery \
--http-web3provider http://localhost:7777 \
--web3provider ws://localhost:7778 \
--clear-db \
--verbosity debug