Main Site

Credit API

POST /api/citizen/action

행동 기록 및 Civic Credit 계산

요청

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

Body:
{
  "actionType": "ritual_completed",
  "validationWeight": 1.0,
  "contextMultiplier": 1.0
}

응답

{
  "success": true,
  "creditEarned": 50,
  "actionType": "ritual_completed"
}

에러

  • 429 Too Many Requests: 주간 상한선 도달
  • 400 Bad Request: 잘못된 요청

GET /api/citizen/credit

Civic Credit 및 주간 상태 조회

요청

GET /api/citizen/credit
Headers:
  X-Wallet-Address: 0x1234...

응답

{
  "totalCredit": 500,
  "weeklyCredit": 250,
  "weeklyLimit": 1000,
  "remainingWeeklyLimit": 750,
  "withinLimit": true
}

Civic Credit 계산 공식

Civic Credit = Action Value × Validation Weight × Context Multiplier

- Action Value: 행동 유형별 기본 가치
- Validation Weight: 검증된 행동인지 여부 (0.0 ~ 1.0)
- Context Multiplier: 상황별 배수 (기본 1.0)

주간 상한선

  • 주간 최대 1,000 Civic Credit 획득 가능
  • 상한선 도달 시 추가 Credit 획득 불가
  • 반복 행동은 Credit이 감소 (Spam 방지)