mev-freelay

command module
v0.0.0-...-a1d9a68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 4, 2023 License: UPL-1.0 Imports: 4 Imported by: 0

README

IMPORTANT - Use at Your Own Risk!!!

Please note that this relay has not been subjected to a security audit, and as such, there may exist security or other vulnerabilities that have not been discovered or addressed. By using this relay, there is a risk that your or your clients' assets could be compromised. Therefore, you use this relay at your own risk.

Relays

Code Guides

USP (Unique Selling Points)

  • Use of a single process and embedded pebble database for persistence, leading to lower latency and resource usage for operations
  • Automatic archiving of submitted payloads to S3, which keeps the operation database length constant
  • Simple backup and restore process

Tech Stack

We aimed for a straightforward technology stack that is easy to manage and deploy. We chose pebble as our database due to its fast read speeds and multi threaded writes. Finally, we used go-lean to build the website, which utilizes mustache templating.

Production

Using Dockerfile

DOCKER_BUILDKIT=1 docker build -t mev-freelay .
docker run mev-freelay freelay -e BEACONS <prysm_beacon_url> -e BLOCK_SIM_URL <geth_url> -e SECRET_KEY <generate with keys> -e NETWORK goerli -e DB_PTH dbs/prod_db

Using binary

go build -o mev-freelay .
./mev-freelay freelay --beacons <prysm_beacon_url> --block-sim-url <geth_url> --secret-key <generate with keys> --network goerli --db-pth dbs/prod_db

Development

go run main.go freerelay --beacons <prysm_beacon_url> --block-sim-url <geth_url> --secret-key <generate with keys> --network goerli --db-pth dbs/prod_db

Relay (Proposer, Builder, Data): http://localhost:50051 API (Website): http://localhost:50052 Prometheus: http://localhost:9000 PPROF: http://localhost:6060

Minio S3

make minio

Ingress

We believe that development env should behave the same as production. This is why we are using ingress to route traffic to the local service freelay (web, relay). This is done so we can access relay|eth paths from website that are running on a different domain.

Before starting the ingress you need to make sure that the ports you use for web and relay are also used in the ingress.

# Ingress is running on PORT 50050
make ingress

Debugging

go install github.com/go-delve/delve/cmd/dlv@latest
go install -v golang.org/x/tools/gopls@latest

Format & Lint

make fmt

Documentation

Swagger
make swag

CLI

Generate Keys

go run main.go keys

Backup Database to S3

It is using default AWS credentials. You can override them with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

go run main.go backup --backup-url http://localhost:50052/api/backup --bucket <bucket>

Restore Database from S3

It is using default AWS credentials. You can override them with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

go run main.go restore --db-pth <db_pth> --bucket <bucket>

Purge Database

Archives payloads (executed-payloads, submitted, bid-traces) that are older then 6 hours in a .tar.gz file and uploads it to S3 and deletes them from the database.

It is using default AWS credentials. You can override them with AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

go run main.go purge --archive-url http://localhost:50052/api/archive --prune-url http://localhost:50052/api/prune --bucket <bucket>

Migrate Database (bbolt -> pebble)

go run main.go migrate --bbolt-pth <bbolt_pth> --pebble-pth <pebble_pth>

Import Database (postgres -> pebble)

go run main.go import --db-pth <db_pth> --sql-uri <sql_uri> --sql-table-prefix <dev>

Builder Specs

https://github.com/ethereum/builder-specs

Beacon API

https://ethereum.github.io/beacon-APIs/#/

TODO

  • Replace go-boost-tools with https://github.com/attestantio/go-eth2-client/tree/master/spec

Documentation

Overview

Copyright (c) 2023 Manifold Finance, Inc. The Universal Permissive License (UPL), Version 1.0 Subject to the condition set forth below, permission is hereby granted to any person obtaining a copy of this software, associated documentation and/or data (collectively the “Software”), free of charge and under any and all copyright rights in the Software, and any and all patent rights owned or freely licensable by each licensor hereunder covering either (i) the unmodified Software as contributed to or provided by such licensor, or (ii) the Larger Works (as defined below), to deal in both (a) the Software, and (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if one is included with the Software (each a “Larger Work” to which the Software is contributed by such licensors), without restriction, including without limitation the rights to copy, create derivative works of, display, perform, and distribute the Software and make, use, sell, offer for sale, import, export, have made, and have sold the Software and the Larger Work(s), and to sublicense the foregoing rights on either these or other terms. This license is subject to the following condition: The above copyright notice and either this complete permission notice or at a minimum a reference to the UPL must be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. This script ensures source code files have copyright license headers. See license.sh for more information.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL