-
Notifications
You must be signed in to change notification settings - Fork 123
Description
What problem does your feature solve?
There's no easy way to fetch ledger close meta from a network's ledger meta datastore. I have built one-off throw-away tools for this and I noticed @stellar/platform-eng discussing that they'd like a tool for this type of thing too (ref), although they may still build something else that collects the data directly from a stellar-core which isn't what this issue proposes, but regardless there's some evidence at least in my own workflows this would be a useful capability, and should be a very lightweight lift, because we are mostly talking about just downloading a file.
I have considered opening this issue in the past but struggled to imagine where in the cli such a command would fit. The recently added stellar ledger subcommand provides a natural home for this.
What would you like to see?
A new stellar ledger meta fetch subcommand that downloads LedgerCloseMetaBatch from a network's ledger meta datastore (as specified in SEP-54) for a specific ledger or a range of ledgers.
Usage:
# Single ledger
stellar ledger meta fetch --ledger 1000
# Range of ledgers
stellar ledger meta fetch --start 1000 --end 2000
--ledger is mutually exclusive with --start/--end.
Key details:
- Output type:
- Return a
LedgerCloseMetawhen--ledgeris used. - Return a
LedgerCloseMetaBatchwhen--startand--endare used. - Using different types may be a little confusing, but I think the common case looking at my own past usages was to get a single ledgers worth, and in that case it is more convenient to have it as just the
LedgerCloseMeta.
- Return a
- Output format: Support
--outputwith valuesxdr,json, andjson-formatted(consistent with other CLI commands). - Datastore access: The command should download the datastore config, then fetch the required batches over plain HTTP (no S3 SDK). This is important because not all datastores are S3-backed — e.g. Galexie in Quickstart serves over HTTP directly.
- Batch reassembly: The datastore partitions and batches ledgers according to the config file (often one ledger per batch). For the case when the CLI is returning a range, the CLI should download all batches needed to cover the requested range, unpack them, extract the relevant ledgers, and reassemble them into a single
LedgerCloseMetaBatch. Why: This tool isn't for copying a datastore, it's for collecting a range, and that is most useful if it is returned to the user in a single batch.
Network support:
| Network | Datastore URL |
|---|---|
| Mainnet (pubnet) | https://aws-public-blockchain.s3.us-east-2.amazonaws.com/v1.1/stellar/ledgers/pubnet |
| Testnet | https://aws-public-blockchain.s3.us-east-2.amazonaws.com/v1.1/stellar/ledgers/testnet/2025-12-17 |
| Local (Quickstart w/ Galexie) | http://localhost:8000/ledger-meta |
Futurenet does not currently have a ledger meta datastore.
The pubnet and maybe testnet URLs are I think already hardcoded today and are used by the stellar snapshot create command and selected based on the current network. We can do same for this subcommand and consider making it configurable in the future as a separate mini project.
What alternatives are there?
-
Building one-off scripts/tools each time (current state — duplicated effort).
-
⭐ The
stellar ledger fetchcommand pullsLedgerCloseMetafrom RPC. There's an argument I think that the existing ledger fetch command modified to support selecting different sources, because the data is so similar, with the repsonse being limited to meta information if the ledger meta datastore is the specific source. ⭐
Metadata
Metadata
Assignees
Labels
Type
Projects
Status