<!-- XE-4501 · openapi: /statechain/blocks documents `count` but the node returns `block_count` · testnet -->
*Markdown view of <https://bounty.xe.network/XE-4501>. The page is the record; this is the same page for reading.*

XE-4501 · Bounty

# openapi: /statechain/blocks documents \`count\` but the node returns \`block\_count\`

Closed · duplicate
—claimed Medium
web
filed 2026-11-11 02:26 UTC
by flavyn

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   SDK / docs / web

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-15 17:42 UTC

Told
:   2026-11-15 17:42 UTC

### Patches

None linked.

### History

- [284298](https://bounty.xe.network/log/284298) 2026-11-15 17:42 UTC proposal.adopted
- [284297](https://bounty.xe.network/log/284297) 2026-11-15 17:42 UTC reply.sent
- [284296](https://bounty.xe.network/log/284296) 2026-11-15 17:42 UTC ticket.status new → closed
- [283793](https://bounty.xe.network/log/283793) 2026-11-15 17:42 UTC proposal.adopted
- [283792](https://bounty.xe.network/log/283792) 2026-11-15 17:42 UTC proposal.adopted
- [283791](https://bounty.xe.network/log/283791) 2026-11-15 17:42 UTC ticket.facts
- [283790](https://bounty.xe.network/log/283790) 2026-11-15 17:42 UTC proposal.adopted
- [283789](https://bounty.xe.network/log/283789) 2026-11-15 17:42 UTC ticket.facts
- [283788](https://bounty.xe.network/log/283788) 2026-11-15 17:42 UTC proposal.adopted
- [283787](https://bounty.xe.network/log/283787) 2026-11-15 17:42 UTC ticket.facts
- [283786](https://bounty.xe.network/log/283786) 2026-11-15 17:42 UTC proposal.adopted
- [283785](https://bounty.xe.network/log/283785) 2026-11-15 17:42 UTC ticket.facts

[Full history](https://bounty.xe.network/log?ref=XE-4501) · [JSON](https://bounty.xe.network/v1/tickets/XE-4501) · [markdown](https://bounty.xe.network/XE-4501.md)

### Report

## Summary

`GET /statechain/blocks` is documented in the published OpenAPI with a `count` property.
The node returns `block_count` instead. The documented name does not exist in the shipped
source: `api/handler.go:870` declares `BlockCount uint64` json:"block\_count"\`\`, and
`json:"count"` occurs zero times anywhere in the repository.

## Steps to reproduce (read-only, no auth)

```
curl -s https://ldn.core.test.network/statechain/blocks | python -c "import sys,json;print(list(json.load(sys.stdin)))"
```

Actual: `['block_count', 'blocks']`

Published contract: `https://test.network/openapi.json`, path `/statechain/blocks`,
response 200 -\> `properties: blocks, count`.

## Expected vs actual

- Expected (documented): `count`, the number of blocks in the page.
- Actual: `block_count`.

A client generated from the spec reads `data.count`, gets `undefined`, and treats every page
as empty: pagination stops or arithmetic produces `NaN`. It fails silently, with a 200 and a
well-formed body.

## Not a duplicate (checked)

Scanned all 891 public bounty tickets. Closest matches are XE-0481 (POST /statechain/blocks
maps a retryable ErrGap to HTTP 400 \- status mapping, not a response field) and XE-0063
(openapi: state-chain read schemas wrong for /statechain/kv). Neither covers this field.

## Same class, other sites

I diffed all 21 parameterless GET endpoints in the published spec against the live node;
9 drift. Beyond this one: `/blocks/recent` (filed separately), `/statechain/tip` returns
undocumented `prev_hash`/`signatures`/`timestamp`, `/node` returns undocumented
`delegation_underflows`/`dropped_blocks`/`pending_sends`, and `/delegation` and `/frontiers`
declare fields the node never emits. Root cause looks the same: the spec is maintained by
hand and has drifted from the Go structs it describes.

## Suggested fix

Generate the spec from the handler structs, or rename the documented field to `block_count`.
A CI check that every `json:"..."` tag under `api/` appears in the published schema would
catch this whole class.

### Thread

**Joseph Denne**team2026-11-15 17:42 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the
first verifiable submission, so this one closes as a duplicate. If you believe it is a different
bug, file a new report that links https://bounty.xe.network/XE-4501 and says what differs; it is read like any other.
