Last active
December 26, 2023 22:42
-
-
Save metachris/d76560ea1e0c58e47b16583fad2de9f8 to your computer and use it in GitHub Desktop.
Print mev-boost bids with increasing value over time per slot, over a range of slots
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
# Script to print mev-boost bids with increasing value over time per slot, over a range of slots | |
# | |
# - Output format: slot \t ms_sice_first_bid \t value | |
# - Example output: | |
# | |
# 5796970 0 5449783315635486 | |
# 5796970 382 5846633010618753 | |
# 5796970 383 10851145321068865 | |
# 5796970 905 11416821942543104 | |
# | |
# Note/caveat: the ms_since_first_bid_value value is starting at the first submission, not actually at the beginning of the slot. | |
# | |
import requests | |
url = "https://boost-relay.flashbots.net/relay/v1/data/bidtraces/builder_blocks_received?slot=" | |
slot_start = 5796966 | |
slot_count = 5 | |
for i in range(slot_count): | |
slot = slot_start + i | |
r = requests.get(url + str(slot)) | |
if r.status_code != 200: | |
continue | |
res = r.json() | |
if len(res) == 0: | |
continue | |
res.sort(key=lambda x: x["timestamp_ms"], reverse=False) | |
first_timestamp_ms = 0 | |
last_val = 0 | |
print("") | |
for bid in res: | |
val = int(bid["value"]) | |
if val > last_val: | |
last_val = val | |
if first_timestamp_ms == 0: | |
first_timestamp_ms = int(bid["timestamp_ms"]) | |
time_passed = int(bid["timestamp_ms"]) - first_timestamp_ms | |
# print("%s\t%s\t%s\t%s\t%s" % (slot, bid["timestamp_ms"], bid["timestamp"], time_passed, val)) | |
print("%s\t%s\t%s" % (slot, time_passed, val)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment