o1-labs / o1-labs/Archive-Node-API
Extend GraphQL schema so Archive-Node-API can back the full Rosetta history interface (MinaMesh)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 19
- Forks
- 9
- Avg merge
- 14h 20m
- Merged PRs (30d)
- 8
Description
Context
MinaMesh (the Rosetta/Coinbase-Mesh implementation for Mina) is adding a pluggable history backend abstraction — one MinaArchive trait with interchangeable adapters — so a single MinaMesh binary can serve whichever data source a given deployment has:
PostgresArchive— raw Mina archive Postgres (the original rosetta SQL)IndexerArchive—mina-indexerGraphQLArchiveNodeApiArchive— this repo's GraphQL
The adapter for Archive-Node-API already exists, but it can only implement part of the interface today, because the GraphQL schema doesn't expose several things the Rosetta history surface needs — even though the underlying archive Postgres already contains all of this data. This issue tracks the schema additions needed to make Archive-Node-API a full history backend (feature-parity with the indexer / raw SQL paths).
The interface Archive-Node-API needs to satisfy
| MinaArchive method | Rosetta endpoint | Archive-Node-API today |
|---|---|---|
block(by height) |
/block |
✅ blocks(query: { blockHeight_gte/_lt, canonical }) |
block(by state hash) |
/block |
❌ no stateHash filter |
tip / oldest_block |
/network/status |
✅ blocks(sortBy: BLOCKHEIGHT_*) |
| block correctness (coinbase, creation fees, snark) | /block |
⚠️ partial — see below |
historical_balance |
/account/balance (with block) |
❌ no ledger-account query |
search_transactions |
/search/transactions |
❌ no account-scoped tx query |
account_nonce |
/construction/metadata |
❌ no account query |
payment_in_history (dup detect) |
/construction/submit |
❌ no tx-by-hash query |
Requested schema additions
Each item lists the current schema, the proposed addition, and the mina-indexer equivalent as a proven reference shape (MinaMesh's IndexerArchive already consumes these).
1. Block lookup by state hash
BlockQueryInput filters on height only. Add a stateHash filter so a block can be fetched by hash.
input BlockQueryInput {
# ...existing...
stateHash: String
}
2. Coinbase receiver + account-creation-fee flags (block correctness)
Right now BlockTransactions.coinbase is an amount with no receiver, so it can't be turned into a Rosetta operation at all, and there are no account-creation-fee flags — so /block balances don't reconcile against the other backends.
type BlockTransactions {
coinbase: String!
coinbaseReceiver: String # NEW — required to emit the coinbase operation
coinbaseReceiverAccountCreationFeePaid: Boolean # NEW
# ...
}
type UserCommand {
# ...existing...
receiverAccountCreationFeePaid: Boolean # NEW — 1 MINA creation fee attribution
}
3. SNARK-work fees on blocks
To report internal-command amounts net of SNARK fees (the producer pays them out of its fee pool), the block needs its snark jobs. Indexer exposes snarkJobs { fee prover }.
type Block {
# ...
snarkJobs: [SnarkJob!]! # NEW: { fee: Int!, prover: String! }
}
4. Historical ledger-account query (biggest gap)
There is no way to read an account's balance/nonce at a past block. Needed for historical /account/balance. Indexer reference:
stagedLedgerAccounts(query: { publicKey, blockchain_length, token }) {
balance_nano # nanomina
nonce
token
}
5. Account-scoped transaction search (+ tx-by-hash)
/search/transactions and submit duplicate-detection need to find user commands touching an account (as from or to) at/below a height, plus a single-tx-by-hash lookup, each with block context. Indexer reference:
transactions(query: { from | to | hash, blockHeight_lte }, limit, sortBy: BLOCKHEIGHT_DESC) {
amount fee from to nonce memo hash kind failureReason isApplied canonical blockHeight
receiver_account_creation_fee_paid
block { stateHash dateTime }
}
6. Account nonce / existence
/construction/metadata needs the sender's current nonce and whether the receiver exists (⇒ account-creation fee). Indexer reference:
accounts(query: { publicKey }, limit: 1) { nonce }
Priority
- #4 historical ledger-account query and #5 account-scoped tx search — these unblock whole Rosetta endpoints (
/account/balancehistorical,/search/transactions) that currently return an "unsupported" error. - #2 / #3 — needed for
/blockcorrectness (balance reconciliation). - #1 stateHash filter and #6 account nonce — smaller, unblock
/block-by-hash and/construction/metadata.
All of this data is already in the archive Postgres this API queries — the ask is to surface it through the GraphQL schema.
/cc — filed from MinaMesh's backend-unification work; happy to share the MinaArchive trait + the current partial adapter for exact field shapes.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the GraphQL schema definitions for BlockQueryInput, BlockTransactions, UserCommand, and Block, then trace the existing blocks query into its archive Postgres data. Review how stagedLedgerAccounts, transactions, and accounts would expose the requested fields and filters. Done means the six requested additions are queryable so MinaMesh can implement the listed history methods without unsupported responses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, postgresql, typescript
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100