Blocks API

Endpoints for querying block data on RougeChain.

Get Blocks

GET /api/blocks?limit=50

Query Parameters

ParameterTypeDefaultDescription
pagenumber-Page number (1-based); enables paginated mode
per_pagenumber10Blocks per page (used with page)
limitnumber100 (1000 with from_height)Maximum blocks to return (max 100, up to 1000 with from_height)
from_heightnumber-Start from this block height (used for P2P sync)

Response

{
  "blocks": [
    {
      "version": 1,
      "header": {
        "version": 1,
        "chain_id": "rougechain-devnet-1",
        "height": 42,
        "time": 1706745600000,
        "prev_hash": "abc123...",
        "tx_hash": "def456...",
        "proposer_pub_key": "ghi789...",
        "state_root": "...",
        "parent_commit": { "...": "..." }
      },
      "txs": [...],
      "proposer_sig": "...",
      "hash": "xyz..."
    }
  ],
  "total_height": 12345,
  "page": 1,
  "total_pages": 1235
}

total_height, page and total_pages are only returned in paginated mode (when page is supplied); with limit or from_height the response contains only blocks.

Block Fields

FieldTypeDescription
versionnumberBlock format version
header.chain_idstringChain identifier
header.heightnumberBlock number
header.timenumberTimestamp (ms since epoch)
header.prev_hashstringHash of previous block
header.tx_hashstringSHA-256 over the concatenated encoded transactions, in block order (not a Merkle root)
header.proposer_pub_keystringValidator who proposed this block
header.state_rootstringPost-state root of the balance ledger (omitted before its activation height)
header.parent_commitobjectFinality certificate for the parent block (omitted before FINALITY_V2 activation)
txsarrayTransactions included in this block
proposer_sigstringML-DSA-65 signature by the proposer
hashstringSHA-256 of the JSON-encoded header followed by proposer_sig

Block Summary

GET /api/blocks/summary

Returns time-bucketed block/transaction counts, suitable for charts and dashboards.

Query Parameters

ParameterTypeDefaultDescription
rangestring24hTime range: 1h, 24h, or 7d

Response

{
  "success": true,
  "range": "24h",
  "intervalMs": 3600000,
  "startTime": 1706659200000,
  "endTime": 1706745600000,
  "points": [
    {
      "timestamp": 1706742000000,
      "blocks": 42,
      "transactions": 137
    }
  ]
}

Import Block (P2P)

Used by peer nodes to propagate blocks.

POST /api/blocks/import
Content-Type: application/json

See Peers API for details.


Block Verification

Every block is verified by receiving nodes:

  1. Hash check — Recompute the block hash and compare
  2. Signature check — Verify ML-DSA-65 signature against the proposer's public key
  3. Height check — Must extend the current chain tip by exactly 1
  4. Previous hash — Must reference the current tip's hash
  5. Designated proposer — The proposer must be the designated proposer for that height (largest eligible stake; ties → lowest public key)
  6. Parent commit — The parent must carry a ⅔-stake finality certificate (parent_commit)
  7. Transaction validity — All transactions must have valid signatures and sufficient balances
  8. State root — The post-state must match state_root