Main Site

Chronicle API

GET /api/citizen/chronicle

개인 Chronicle 조회

요청

GET /api/citizen/chronicle?limit=50
Headers:
  X-Wallet-Address: 0x1234...

응답

{
  "entries": [
    {
      "id": 1,
      "event_type": "ritual_completed",
      "event_data": { "era": 1, "ritual": "declaration" },
      "created_at": 1234567890
    }
  ]
}

GET /api/chronicle/nation

국가 Chronicle 조회 (상위 5% 사건)

요청

GET /api/chronicle/nation?limit=50&anonymize=true

쿼리 파라미터

  • limit: 최대 반환 개수 (기본: 50)
  • anonymize: 주소 익명화 여부 (true/false)

응답

{
  "entries": [
    {
      "id": 1,
      "wallet_address": "0x1234..." or "0x1234...5678" (anonymize=true),
      "event_type": "era_completed",
      "event_data": { "era": 1 },
      "created_at": 1234567890
    }
  ]
}

POST /api/chronicle/record

Chronicle 항목 기록

요청

POST /api/chronicle/record
Headers:
  X-Wallet-Address: 0x1234...
  Content-Type: application/json

Body:
{
  "eventType": "test_event",
  "eventData": { "test": true }
}

응답

{
  "success": true
}

POST /api/chronicle/anchor

Chronicle Anchor 생성 (Architect only)

요청

POST /api/chronicle/anchor
Headers:
  Content-Type: application/json

Body:
{
  "era": 1
}

응답

{
  "success": true,
  "anchor": {
    "era": 1,
    "rootHash": "0x...",
    "entryCount": 100,
    "txHash": "0x..."
  }
}

GET /api/chronicle/anchor/:era

특정 Era의 Anchor 조회

요청

GET /api/chronicle/anchor/1

응답

{
  "anchor": {
    "era": 1,
    "root_hash": "0x...",
    "entry_count": 100,
    "created_at": 1234567890
  }
}