nimbus-eth1/lc_proxy
KonradStaniec 94ec3349a4
Add docs to lc proxy (#1248)
* Add docs to lc proxy
2022-09-30 12:56:16 +02:00
..
docs Add docs to lc proxy (#1248) 2022-09-30 12:56:16 +02:00
rpc Proxy missing methods (#1246) 2022-09-28 22:43:10 +02:00
tests Add improved mpt trie proof verification (#1223) 2022-09-15 13:04:41 +02:00
README.md Add docs to lc proxy (#1248) 2022-09-30 12:56:16 +02:00
block_cache.nim Add simple block cache. Handle numeric params (#1241) 2022-09-28 10:01:32 +02:00
lc_proxy.nim Add simple block cache. Handle numeric params (#1241) 2022-09-28 10:01:32 +02:00
lc_proxy_conf.nim Use rpcProxy in lc proxy (#1238) 2022-09-24 13:57:27 +02:00
nim.cfg StyleCheck fixes for Fluffy and lcproxy (#1220) 2022-09-10 21:00:27 +02:00
validate_proof.nim Add improved mpt trie proof verification (#1223) 2022-09-15 13:04:41 +02:00

README.md

Light Client Proxy

Light client proxy CI Stability: experimental License: Apache License: MIT

Discord: Nimbus Status: #nimbus-general

Introduction

This folder holds the development of light client proxy. Light client proxy uses the consensus light client to follow the tip of the consensus chain and exposes the standard Ethereum JSON RPC Execution API. The API calls are proxied to a configured web3 data provider and the provider its responses are verified against recent consensus data provided by the light client before returning the result to the caller.

Build light client proxy

git clone git@github.com:status-im/nimbus-eth1.git
cd nimbus-eth1
make lc-proxy

# See available command line options
./build/lc_proxy --help

Important command line options

Most of command line options have reasonable defaults. There are two options which needs to be explicitly configured by user.

--trusted-block-root - option necessary to initialize the consensus light client. The trusted block should be within the weak subjectivity period, and its root should be from a finalized Checkpoint.

--web3-url - as the proxy does not have any storage, it needs to know an endpoint which will provide all the requested data. This can either be a known full node, or an external provider like Alchemy.

First requirement for the external provider is that it must support the standard Ethereum JSON RPC Execution API, and specifically it MUST also support the eth_getProof call. The latter is necessary to validate the provided data against the light client.

The second requirement is that data served from provider needs to be consistent with the configured light client network. By default the light client proxy is configured to work on mainnet. In this case, the configured provider needs to serve mainnet data. This is verified on start-up by querying the provider its eth_chainId endpoint, and comparing the received chain id with the one configured locally. If this validation fails, the light client proxy process will quit.

Detailed document showing how to configure the proxy and pair it with MetaMask.

Update and rebuild light client proxy

# From the nimbus-eth1 repository
git pull
# To bring the git submodules up to date
make update

make lc-proxy

Run light client proxy test suite

# From the nimbus-eth1 repository
make lc-proxy-test

Windows support

Follow the steps outlined here to build light client proxy on Windows.

For Developers

When working on this repository, you can run the env.sh script to run a command with the right environment variables set. This means the vendored Nim and Nim modules will be used, just as when you use make.

E.g.:

# start a new interactive shell with the right env vars set
./env.sh bash

License

Licensed and distributed under either of

or

at your option. These files may not be copied, modified, or distributed except according to those terms.