Created
May 6, 2023 08:48
-
-
Save pietjepuk2/f0fb4288440d8f9b3244db1829b31118 to your computer and use it in GitHub Desktop.
Compare bids of MEV relays
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
GENESIS_TIME = 1606824000 + 23 | |
# https://raw.githubusercontent.com/remyroy/ethstaker/main/MEV-relay-list.md | |
relay_list = [ | |
("Aestus", "https://aestus.live"), | |
("Agnostic Gnosis", "https://agnostic-relay.net"), | |
("Blocknative", "https://builder-relay-mainnet.blocknative.com"), | |
("bloXroute Ethical", "https://bloxroute.ethical.blxrbdn.com"), | |
("bloXroute Max-profit", "https://bloxroute.max-profit.blxrbdn.com"), | |
("bloXroute Regulated", "https://bloxroute.regulated.blxrbdn.com"), | |
("Eden Network", "https://relay.edennetwork.io"), | |
("Flashbots", "https://boost-relay.flashbots.net"), | |
("Manifold", "https://mainnet-relay.securerpc.com"), | |
("Ultra Sound", "https://relay.ultrasound.money"), | |
] | |
slot = int(input("Enter slot to compare: ")) | |
bids = [] | |
for relay, relay_url in relay_list: | |
highest_bid = 0 | |
highest_bid_before_slot_start = 0 | |
try: | |
response = requests.get(f"{relay_url}/relay/v1/data/bidtraces/builder_blocks_received?slot={slot}").json() | |
highest_bid = max(int(b["value"]) for b in response) | |
highest_bid_before_slot_start = max(int(b["value"]) for b in response if int(b["timestamp_ms"]) <= (GENESIS_TIME + slot * 12) * 1000) | |
except Exception: | |
pass | |
bids.append((relay, highest_bid / 1E18, highest_bid_before_slot_start / 1E18)) | |
bids = sorted(bids, key=lambda x: -x[1]) | |
print(f"Relay {'':25s} overall at slot start") | |
for relay, bid, bid_before_slot_start in bids: | |
print(f"{relay}:{' ' * (25 - len(relay))} {bid:10.5f} ETH {bid_before_slot_start:10.5f} ETH") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment