94ec3349a4
* Add docs to lc proxy |
||
---|---|---|
.. | ||
docs | ||
rpc | ||
tests | ||
README.md | ||
block_cache.nim | ||
lc_proxy.nim | ||
lc_proxy_conf.nim | ||
nim.cfg | ||
validate_proof.nim |
README.md
Light Client Proxy
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
- MIT license: LICENSE-MIT or http://opensource.org/licenses/MIT
or
- Apache License, Version 2.0, (LICENSE-APACHEv2 or http://www.apache.org/licenses/LICENSE-2.0)
at your option. These files may not be copied, modified, or distributed except according to those terms.