Skip to content
Merged
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
13 changes: 12 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ the fields:
| `license` | yes | Free text. Name the data license and, if different, the code license, e.g. `CC0 1.0 (data), MIT (code)`. If there is no license, write `Not specified`. |
| `author` | no | The person, group or project publishing the dataset. |
| `doi` | no | Bare DOI, e.g. `10.5281/zenodo.22667157`. Prefer the concept DOI that resolves to the latest version. |
| `period_start` | no | First time the records are about: `YYYY`, `YYYY-MM`, or `YYYY-MM-DD`. |
| `period_end` | no | Last time the records are about, in the same form. |
| `period_open` | no | `true` when the publisher is still extending the series. Leave `period_end` out in that case. |

The description is exactly three short sentences, about 50 to 70 words in
total. Each answers one question:
Expand All @@ -80,7 +83,15 @@ total. Each answers one question:
Descriptions must be timeless. Do not include dates, time ranges, row or file
counts, sizes, version numbers, update frequencies, or status words such as
"currently", "since", "recently" or "stopped". These facts change and nobody
updates them. Describe what the dataset is, not its state today.
updates them. Describe what the dataset is, not its state today. Put dates in
`period_start`, `period_end`, and `period_open` instead, and leave those keys
out when the dataset's own sources do not state a range. Set `period_open`
only when a source shows the publisher is still adding records, and cite that
source in the pull request. Block heights alone are not dates. When a file
stores a raw block header and no time column, `nTime` is the uint32
little-endian at byte offset 68 of the 80-byte header: use the earliest as
the start and, for a closed series, the latest as the end, written as
`YYYY-MM-DD` UTC.

Write plainly for someone who knows Bitcoin but not this dataset. No marketing
language, no "comprehensive" or "powerful". The index page shows every
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ follow. By hand:
| `license` | yes | Free text, e.g. `CC0 1.0` or `CC0 1.0 (data), MIT (code)`. |
| `author` | no | Person, group or project that publishes the dataset. |
| `doi` | no | Bare DOI like `10.5281/zenodo.22667157`, rendered as a doi.org link. |
| `period_start` | no | First time the records are about: `YYYY`, `YYYY-MM`, or `YYYY-MM-DD`. |
| `period_end` | no | Last time the records are about, in the same form. |
| `period_open` | no | `true` when the publisher is still extending the series. Leave `period_end` out in that case. |

### Writing the description

Expand All @@ -48,6 +51,14 @@ question:
Descriptions are timeless: no dates, counts, sizes, version numbers, update
frequencies or status words such as "currently" or "since". Those change, and
nobody updates them. Describe what the dataset is, not how big it is today.
Put a date range in `period_start`, `period_end`, and `period_open`, and leave
those keys out when the dataset's own sources do not state one. Set
`period_open` only when a source shows the publisher is still adding records,
and cite that source in the pull request. Block heights alone are not dates.
When a file stores a raw block header and no time column, `nTime` is the
uint32 little-endian at byte offset 68 of the 80-byte header: use the earliest
as the start and, for a closed series, the latest as the end, written as
`YYYY-MM-DD` UTC.

### Example

Expand All @@ -59,6 +70,8 @@ format = ["csv", "binary"]
author = "0xB10C and contributors"
license = "CC0 1.0 (data), MIT (code)"
doi = "10.5281/zenodo.22667157"
period_start = "2011-01-10"
period_open = true
description = """
One row per stale block observed on the Bitcoin mainnet ...
"""
Expand Down
118 changes: 114 additions & 4 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
python3 build.py --tags # validate and list existing tags with counts
"""

import calendar
import html
import json
import re
import shutil
import sys
import tomllib
from datetime import date
from pathlib import Path
from string import Template

Expand Down Expand Up @@ -79,6 +81,94 @@ def load_categories():
return categories


def period_bound(value, bound):
"""Expand a stored period string to the first or last calendar day it covers."""
if not isinstance(value, str):
return None
if re.fullmatch(r"\d{4}", value):
year = int(value)
return date(year, 1, 1) if bound == "start" else date(year, 12, 31)
if re.fullmatch(r"\d{4}-\d{2}", value):
year, month = int(value[:4]), int(value[5:7])
if not 1 <= month <= 12:
raise ValueError(month)
if bound == "start":
return date(year, month, 1)
return date(year, month, calendar.monthrange(year, month)[1])
if re.fullmatch(r"\d{4}-\d{2}-\d{2}", value):
return date.fromisoformat(value)
return None


def apply_period(entry, where):
"""Return (start, end, open) from an entry, or raise EntryError."""
start = entry.get("period_start")
end = entry.get("period_end")
period_open = entry.get("period_open", False)
expanded = {}
for key, value, bound in (
("period_start", start, "start"),
("period_end", end, "end"),
):
if key not in entry:
continue
try:
expanded[key] = period_bound(value, bound)
except ValueError:
expanded[key] = None
if expanded[key] is None:
raise EntryError(
f"{where}: '{key}' must be a YYYY, YYYY-MM, or YYYY-MM-DD string"
)
if not isinstance(period_open, bool):
raise EntryError(f"{where}: 'period_open' must be a boolean")
if period_open and "period_end" in entry:
raise EntryError(f"{where}: 'period_open' cannot be combined with 'period_end'")
if (
"period_open" in entry
and not period_open
and "period_start" not in entry
and "period_end" not in entry
):
raise EntryError(f"{where}: period fields record nothing")
if (
"period_start" in entry
and "period_end" in entry
and expanded["period_start"] > expanded["period_end"]
):
raise EntryError(f"{where}: 'period_start' is after 'period_end'")
return start, end, period_open


def period_label(dataset):
"""User-facing period text, or '' when nothing is recorded."""
start = dataset["period_start"]
end = dataset["period_end"]
period_open = dataset["period_open"]
if period_open and start:
return f"{start} \u2013 present"
if period_open:
return "ongoing"
if start and end:
return start if start == end else f"{start} \u2013 {end}"
if start:
return f"from {start}"
if end:
return f"until {end}"
return ""


def temporal_coverage(dataset):
"""schema.org temporalCoverage, or None when the interval is incomplete."""
start = dataset["period_start"]
end = dataset["period_end"]
if dataset["period_open"] and start:
return f"{start}/.."
if start and end:
return start if start == end else f"{start}/{end}"
return None


def require_str(entry, key, where, optional=False):
value = entry.get(key)
if value is None:
Expand All @@ -97,7 +187,10 @@ def load_dataset(path, category_ids):
raise EntryError(f"{where}: filename must be lowercase kebab-case")
entry = load_toml(path)

known = {"name", "category", "tags", "format", "description", "links", "license", "doi", "author"}
known = {
"name", "category", "tags", "format", "description", "links", "license",
"doi", "author", "period_start", "period_end", "period_open",
}
unknown = set(entry) - known
if unknown:
raise EntryError(f"{where}: unknown field(s): {', '.join(sorted(unknown))}")
Expand Down Expand Up @@ -126,6 +219,7 @@ def load_dataset(path, category_ids):
)
if dataset["doi"] and not DOI_RE.match(dataset["doi"]):
raise EntryError(f"{where}: 'doi' must be a bare DOI like 10.5281/zenodo.123456")
dataset["period_start"], dataset["period_end"], dataset["period_open"] = apply_period(entry, where)

tags = entry.get("tags", [])
if not isinstance(tags, list) or not all(isinstance(t, str) for t in tags):
Expand Down Expand Up @@ -224,8 +318,11 @@ def render_dataset_card(d, categories_by_id, root):
meta = [
f'<li><span class="label">Category:</span> {e(categories_by_id[d["category"]]["name"])}</li>',
f'<li><span class="label">Format:</span> {e(format_labels(d))}</li>',
f'<li><span class="label">License:</span> {e(d["license"])}</li>',
]
label = period_label(d)
if label:
meta.append(f'<li><span class="label">Period:</span> {e(label)}</li>')
meta.append(f'<li><span class="label">License:</span> {e(d["license"])}</li>')
if d["author"]:
meta.append(f'<li><span class="label">Author:</span> {e(d["author"])}</li>')
if d["doi"]:
Expand Down Expand Up @@ -277,8 +374,11 @@ def render_dataset_page(d, categories_by_id):
rows = [
("Category", f'<a href="{root}#{e(cat["id"])}">{e(cat["name"])}</a>'),
("Format", e(format_labels(d))),
("License", e(d["license"])),
]
label = period_label(d)
if label:
rows.append(("Period", e(label)))
rows.append(("License", e(d["license"])))
if d["author"]:
rows.append(("Author", e(d["author"])))
if d["doi"]:
Expand Down Expand Up @@ -378,6 +478,9 @@ def dataset_jsonld(d, categories_by_id):
}
if d["author"]:
out["creator"] = {"@type": "Person", "name": d["author"]}
coverage = temporal_coverage(d)
if coverage:
out["temporalCoverage"] = coverage
if d["doi"]:
out["identifier"] = f"https://doi.org/{d['doi']}"
out["sameAs"] = f"https://doi.org/{d['doi']}"
Expand Down Expand Up @@ -416,7 +519,11 @@ def render_llms_txt(datasets, categories):
out.append(f"## {cat['name']}")
out.append("")
for d in members:
out.append(f"- [{d['name']}]({dataset_url(d)}): {first_sentence(d['description'])}")
line = f"- [{d['name']}]({dataset_url(d)}): {first_sentence(d['description'])}"
label = period_label(d)
if label:
line += f" Period: {label}."
out.append(line)
out.append("")
out.append("## Optional")
out.append("")
Expand All @@ -433,6 +540,9 @@ def render_llms_full_txt(datasets, categories_by_id):
out.append(f"URL: {dataset_url(d)}")
out.append(f"Category: {categories_by_id[d['category']]['name']}")
out.append(f"Format: {format_labels(d)}")
label = period_label(d)
if label:
out.append(f"Period: {label}")
if d["tags"]:
out.append(f"Tags: {', '.join(d['tags'])}")
out.append(f"License: {d['license']}")
Expand Down
5 changes: 4 additions & 1 deletion ci/preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ def render(datasets, categories_by_id):
rows = [
("Category", categories_by_id[d["category"]]["name"]),
("Format", build.format_labels(d)),
("License", d["license"]),
]
label = build.period_label(d)
if label:
rows.append(("Period", label))
rows.append(("License", d["license"]))
if d["author"]:
rows.append(("Author", d["author"]))
if d["doi"]:
Expand Down
2 changes: 2 additions & 0 deletions datasets/antulov-transaction-network.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ format = ["text"]
author = "Nino Antulov-Fantulin, Dijana Tolic, Matija Piskorec, Zhang Ce and Irena Vodenska (ETH Zurich)"
license = "CC BY 4.0"
doi = "10.5281/zenodo.3571353"
period_start = "2012"
period_end = "2017"
description = """
A Bitcoin transaction network edge list, one comma-separated line per transfer
with integer source and target node ids, a Unix timestamp and an amount in
Expand Down
2 changes: 2 additions & 0 deletions datasets/asmap-data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags = ["p2p", "asmap", "autonomous-systems", "addresses", "routing"]
format = ["binary", "text"]
author = "ASMap contributors"
license = "MIT"
period_start = "2024-01-05"
period_open = true
description = """
Maps from IP address ranges to autonomous system numbers, encoded for Bitcoin
Core's asmap option, with one filled and one unfilled binary file per run,
Expand Down
2 changes: 2 additions & 0 deletions datasets/bigquery-crypto-bitcoin.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags = ["addresses", "blocks", "fees", "mainnet", "transactions"]
format = ["csv", "jsonl", "parquet"]
author = "Google Cloud Public Dataset Program"
license = "Not specified (bitcoin-etl extraction code is MIT)"
period_start = "2009-01-03"
period_open = true
Comment thread
deadmanoz marked this conversation as resolved.
Resolved
description = """
Two BigQuery tables covering the chain, one row per block and one per
transaction, with each transaction's inputs and outputs nested alongside their
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-brain-drain.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ format = ["csv", "text"]
author = "Marie Vasek, Joseph Bonneau, Ryan Castellucci, Cameron Keith and Tyler Moore (University of Tulsa)"
license = "CC0 1.0"
doi = "10.7910/DVN/RZHL3X"
period_start = "2011-07"
period_end = "2017-02"
description = """
CSV tables covering Bitcoin brain wallets, whose keys come from a password:
transaction inputs and outputs for drained wallets, a brain wallet master
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-dust-transactions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ format = ["text", "csv"]
author = "Matteo Loporchio and Damiano Di Francesco Maesa (University of Pisa)"
license = "CC BY 4.0 (data), not specified (code)"
doi = "10.5281/zenodo.7696453"
period_start = "2009-01-03"
period_end = "2017-08-10"
description = """
Bitcoin transactions creating or spending dust outputs, one text line per
transaction with block time, height, fee, size and each input and output as
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-ml-features.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ format = ["csv", "json"]
author = "Enrico Tedeschi (UiT The Arctic University of Norway)"
license = "CC0 1.0"
doi = "10.18710/8IKVEU"
period_start = "2021-01-01"
period_end = "2021-05-31"
description = """
Separate block and transaction CSV tables, joined on block hash: blocks carry
size, height and creation time, transactions carry fee, size, broadcast time
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-node-census.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags = ["crawler", "mainnet", "nodes", "p2p", "reachable-nodes"]
format = ["jsonl"]
author = "Nick Johnson (nyonson)"
license = "CC0 1.0"
period_start = "2025-06-14"
period_open = true
description = """
One JSON object per crawl, giving reachable node counts with how many support
v2 transport and compact block filters, split by connection type, plus the
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-node-os-fingerprint.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags = ["p2p", "nodes", "reachable-nodes", "operating-systems", "mainnet"]
format = ["csv"]
author = "Vinicius Cestari"
license = "MIT"
period_start = "2026-07-06"
period_open = true
description = """
Guessed operating systems of reachable Bitcoin nodes, one CSV per scan with a
row per host giving IP address, port, OS class, confidence and host state.
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-seeder-data.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags = ["p2p", "dns-seeds", "crawler", "nodes", "addresses", "mainnet"]
format = ["jsonl", "text", "csv", "json"]
author = "Joris Strakeljahn"
license = "Not specified"
period_start = "2026-05-10"
period_open = true
description = """
Answers of Bitcoin's mainnet DNS seeds, one JSON line per query with record
type, status, TTL and returned addresses, plus unmodified seeder and crawler
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-transaction-graphs-labelled-entities.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ format = ["csv", "parquet", "json"]
author = "Hugo Schnoering and Michalis Vazirgiannis (LIX, École Polytechnique)"
license = "CC BY 4.0 (data), not specified (code)"
doi = "10.5281/zenodo.22239037"
period_start = "2019-10-12"
period_end = "2021-09-11"
description = """
Address-transaction graphs for machine learning on Bitcoin: training graphs
with CSV node features, edge features and heuristic clustering labels, plus
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-transaction-list.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ format = ["text", "csv"]
author = "Matteo Loporchio and Damiano Di Francesco Maesa (University of Pisa)"
license = "CC BY 4.0"
doi = "10.5281/zenodo.18938799"
period_start = "2009-01-03"
period_end = "2017-08-10"
description = """
All Bitcoin transactions up to a given block height, one compressed text line
per transaction with block time, height, fee, size and each input and output as
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-transactions-2009-2020.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ format = ["csv"]
author = "Ethan Wood (University College London)"
license = "CC0 1.0"
doi = "10.7910/DVN/ZLBYTZ"
period_start = "2009-01"
period_end = "2020-10"
description = """
Bitcoin value transfers, one row per sender and recipient pair with a Unix
timestamp, the sending address, the receiving address and the amount in
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoin-transcripts.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags = ["archive", "bitcoin-core", "history", "meetings"]
format = ["text"]
author = "Bitcoin Transcripts contributors"
license = "MIT"
period_start = "2014-02-09"
period_open = true
Comment thread
deadmanoz marked this conversation as resolved.
Resolved
description = """
One Markdown file per transcribed talk, podcast episode or developer meeting,
with YAML front matter naming the title, speakers, tags, date, the recording it
Expand Down
1 change: 1 addition & 0 deletions datasets/bitcoin-wiki-dump.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ tags = ["wiki", "history", "archive"]
format = ["text", "binary"]
author = "WikiTeam"
license = "Not specified by the archive item; en.bitcoin.it publishes its pages under CC BY 3.0"
period_end = "2014-02-10"
description = """
A MediaWiki XML export of every page of the en.bitcoin.it wiki with its full
revision history, plus title and image lists and the uploaded images, in one
Expand Down
2 changes: 2 additions & 0 deletions datasets/bitcoincore-meeting-notes.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ tags = ["bitcoin-core", "history", "meetings", "releases"]
format = ["text"]
author = "Bitcoin Core website contributors"
license = "MIT"
period_start = "2015-10-01"
period_end = "2018-11-01"
description = """
One Markdown file per Bitcoin Core development IRC meeting, with YAML front
matter and a prose summary of each topic discussed, linking to the raw channel
Expand Down
Loading
Loading