GithubHelp home page GithubHelp logo

renovate-tests / eth1-mock-rpc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prysmaticlabs/eth1-mock-rpc

0.0 0.0 0.0 114 KB

Provides a mocked eth1 RPC endpoint for eth2 clients to facilitate listening to chain events and deposits

License: Apache License 2.0

Python 21.70% Go 78.30%

eth1-mock-rpc's Introduction

Eth1 Mock RPC

Discord Gitter

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.

Why do we need this?

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.

Installation

To run the tool, you'll need to install:

  • The latest release of Bazel
  • A modern GNU/Linux operating system

Build the Mock ETH1 RPC Server

  1. Open a terminal window. Ensure you are running the most recent version of Bazel by issuing the command:
bazel version
  1. Clone this repository and enter the directory:
git clone https://github.com/prysmaticlabs/eth1-mock-rpc
cd eth1-mock-rpc
  1. Build the project:
bazel build //...

Bazel will automatically pull and install any dependencies as well, including Go and necessary compilers.

Build the Prysm Project

Running the Mock ETH1 RPC Server

Validator Private Keys

You'll need a file of unencrypted validator private keys to use for triggering mock deposits. You can use unencrypted_keys.json at the root of this directory for this purpose. You can then run the mock using:

bazel run //:eth1-mock-rpc -- --genesis-deposits 64 --unencrypted-keys /path/to/unencrypted_keys.json

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

License

Apache License, Version 2.0

eth1-mock-rpc's People

Contributors

ansermino avatar kivutar avatar nisdas avatar prestonvanloon avatar rauljordan avatar renovate-bot avatar renovate-tests avatar terencechain avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.