Categorygithub.com/flashbots/sync-proxy
modulepackage
0.3.0
Repository: https://github.com/flashbots/sync-proxy.git
Documentation: pkg.go.dev

# README

Goreport status Test status

Flashbots proxy to allow redundant execution client (EL) state sync post merge.

  • Runs a proxy server that proxies requests from a beacon node (BN) to multiple other execution clients
  • Can drive EL sync from multiple BNs for redundancy

Getting Started

  • Run a BN with the execution endpoint pointing to the proxy (default is localhost:25590).
  • Start the proxy with a flag specifying one or multiple EL endpoints (make sure to point to the authenticated port).
git clone https://github.com/flashbots/sync-proxy.git
cd sync-proxy
make build

# Show the help
./sync-proxy -help

To run with multiple EL endpoins:

./sync-proxy -builders="localhost:8551,localhost:8552"

Nginx

The sync proxy can also be used with nginx, with requests proxied from the beacon node to a local execution client and mirrored to multiple sync proxies.

nginx setup overview

An example nginx config like this can be run with the sync proxy:

/etc/nginx/conf.d/sync_proxy.conf
server {
        listen 8552;
        listen [::]:8552;

        server_name _;

        location / {
                mirror /sync_proxy_1;
                mirror /sync_proxy_2;
                mirror /sync_proxy_3;

                proxy_pass http://localhost:8551;
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header Host $host;
                proxy_set_header Referer $http_referer;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }

        #
        # execution nodes
        #
        location = /sync_proxy_1 {
                internal;
                proxy_pass http://sync-proxy-1.local:8552$request_uri;
                proxy_connect_timeout 100ms;
                proxy_read_timeout 100ms;
        }

        location = /sync_proxy_2 {
                internal;
                proxy_pass http://sync-proxy-2.local:8552$request_uri;
                proxy_connect_timeout 100ms;
                proxy_read_timeout 100ms;
        }

        location = /sync_proxy_3 {
                internal;
                proxy_pass http://sync-proxy-3.local:8552$request_uri;
                proxy_connect_timeout 100ms;
                proxy_read_timeout 100ms;
        }

Caveats

The sync proxy attempts to sync to the beacon node with the highest timestamp in the engine_forkchoiceUpdated and engine_newPayload calls and forwards to the execution clients.

The sync proxy also attempts to identify the best beacon node based on the originating host of the request. If you are using the same host for multiple beacon nodes to sync the EL, the sync proxy won't be able to distinguish between the beacon nodes and will proxy all requests from the same host to the configured ELs.

# Functions

No description provided by the author
NewProxyService creates a new ProxyService.
No description provided by the author

# Structs

BeaconEntry consists of a URL from a beacon client and latest timestamp recorded.
No description provided by the author
No description provided by the author
No description provided by the author
ProxyEntry is an entry consisting of a URL and a proxy.
ProxyService is a service that proxies requests from beacon node to builders.
ProxyServiceOpts contains options for the ProxyService.

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author
PayloadID is an identifier of the payload build process.
No description provided by the author