Skip to content

[CT-13] Build DocumentExistenceCheckEndpoint #545

Description

@mftee

Problem

The only way to check whether a document hash exists on-chain is through the full verify endpoint, which queries Stellar and returns a large response. There is no lightweight existence check for use in high-frequency polling scenarios.

Proposed Solution

Create a document existence check endpoint inside contract/module/exists/ that returns a minimal boolean response.

Acceptance Criteria

  • GET /module/exists/:hash returns a JSON object with exists (bool) and cached (bool) fields only — no transaction details
  • Checks the Redis cache first using the same key as the verify endpoint
  • Falls back to a Stellar account data_attr lookup if the cache misses
  • Caches positive results (exists=true) with no TTL (document existence is permanent)
  • Caches negative results (exists=false) with a 60-second TTL to allow for recent submissions to appear
  • Validates hash format using HashValidator::validate_sha256 — returns 400 for invalid input
  • Implementation files live inside contract/module/exists/

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions