Skip to content
This repository was archived by the owner on Jun 16, 2026. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,20 @@
var date = d.activationDate ? d.activationDate.split("T")[0] : "N/A";
var network = d.mainnet ? "Mainnet" : "Testnet only";

marker.bindPopup(
var popupHtml =
"<strong>" + esc(String(d.number).padStart(3, "0") + " " + d.name) + "</strong><br>" +
"Hash: <code>" + esc(hashTrunc) + "</code><br>" +
"Activated: " + esc(date) + "<br>" +
"Network: " + esc(network)
);
"Network: " + esc(network);

if (d.voting) {
popupHtml += "<br>Voted: Epoch " + esc(String(d.voting.epoch)) +
" \u2014 " + esc(d.voting.result) +
"<br>Ballots: " + d.voting.yayBallots + " yay, " +
d.voting.nayBallots + " nay, " + d.voting.passBallots + " pass";
}
Comment on lines +84 to +88

marker.bindPopup(popupHtml);

trailCoords.push([d.lat, d.lon]);
});
Expand Down
74 changes: 73 additions & 1 deletion scripts/update_gpx.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def sort_key(wpt_block):
def write_gpx(existing_text, wpt_blocks):
"""Write the GPX file with sorted waypoints, preserving header/footer."""
header = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
header += '<gpx version="1.1" creator="Tezos Protocols Maps (by Copolycube)">\n'
header += '<gpx version="1.1" creator="Tezos Protocol Map">\n'
footer = "</gpx>\n"

sorted_blocks = sorted(wpt_blocks, key=sort_key)
Expand Down Expand Up @@ -286,6 +286,63 @@ def build_protocols_json(scraped, tzkt_data, gpx_coords, testnet_info=None):
return result


def fetch_voting_epochs():
"""Fetch historical voting epoch data from TzKT. Returns dict keyed by proposal hash."""
try:
resp = requests.get(
f"{TZKT_API}/voting/epochs",
params={"limit": 100, "sort.desc": "id"},
timeout=30,
)
resp.raise_for_status()
raw = resp.json()
except (requests.RequestException, ValueError) as exc:
print(f" WARNING: TzKT voting API unreachable ({exc}).", file=sys.stderr)
return {}

if not isinstance(raw, list):
return {}

epochs = {}
for epoch in raw:
if not isinstance(epoch, dict):
continue
proposals = epoch.get("proposals")
if not proposals or not isinstance(proposals, list):
continue
for proposal in proposals:
if not isinstance(proposal, dict):
continue
prop_hash = proposal.get("hash")
if not prop_hash:
continue
status = epoch.get("status") or "unknown"
periods = epoch.get("periods")
# Extract ballot data from the last period (promotion vote).
yay = 0
nay = 0
pas = 0
if isinstance(periods, list):
for period in reversed(periods):
if not isinstance(period, dict):
continue
if period.get("kind") in ("promotion", "exploration"):
yay = period.get("yayBallots") or 0
nay = period.get("nayBallots") or 0
pas = period.get("passBallots") or 0
break

epochs[prop_hash] = {
"epoch": epoch.get("index"),
"result": status,
"yayBallots": yay,
"nayBallots": nay,
"passBallots": pas,
}
Comment on lines +335 to +341

return epochs


def write_protocols_json(protocols_data):
"""Write protocols.json and protocol-count.json."""
with open(PROTOCOLS_JSON_PATH, "w", encoding="utf-8") as f:
Expand Down Expand Up @@ -398,6 +455,21 @@ def main():

gpx_coords = gpx_coords_for_protocols(scraped, final_text)
protocols_data = build_protocols_json(scraped, tzkt_data, gpx_coords, testnet_info)

# Enrich with historical voting data.
print("Fetching voting epoch data from TzKT...")
voting_epochs = fetch_voting_epochs()
if voting_epochs:
matched = 0
for proto in protocols_data.values():
proto_hash = proto.get("hash")
if proto_hash and proto_hash in voting_epochs:
proto["voting"] = voting_epochs[proto_hash]
matched += 1
print(f" Matched voting data for {matched} protocols.")
else:
print(" No voting data available.")

write_protocols_json(protocols_data)


Expand Down
2 changes: 1 addition & 1 deletion tezos.gpx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<gpx version="1.1" creator="Tezos Protocols Maps (by Copolycube)">
<gpx version="1.1" creator="Tezos Protocol Map">
<wpt lat="37.9838" lon="23.7275">
<name>Athens, Greece</name>
<desc>Capital of Greece</desc>
Expand Down