Overview
The NestJS backend (backend/src/stellar/stellar.service.ts) anchors document hashes using Stellar's ManageData operation and reads them via account.data_attr. The Rust microservice (contract/src/stellar.rs) currently reads via the memo field of a transaction. These two approaches are mutually incompatible — a document anchored by the NestJS backend cannot be verified by the Rust verifier, and vice versa.
Background
NestJS writes: ManageData op with key "doc_" + hash[:58], stored in account.data_attr
Rust reads: transaction memo field via Horizon /transactions endpoint
Files involved:
backend/src/stellar/stellar.service.ts — anchorHash() and verifyHash() (NestJS)
contract/src/stellar.rs — StellarClient.verify_hash() (Rust)
Decision needed: Pick one canonical approach for both services. The recommended standard is the ManageData approach (used by NestJS) because:
- It is account-scoped (data survives independent of transaction lookup)
- It supports updates and revocations (via subsequent ManageData calls)
- It is the more commonly used pattern for on-chain metadata
Work required:
- Update
contract/src/stellar.rs verify_hash() to read from account.data_attr instead of memo
- Update
GET /verify/:hash response to match the NestJS verification record format
- Ensure
GET /verify/:hash/history reads all ManageData transfer entries (CT-03)
- Add a migration note in the README if existing testnet anchors used the memo approach
Acceptance Criteria
Overview
The NestJS backend (
backend/src/stellar/stellar.service.ts) anchors document hashes using Stellar'sManageDataoperation and reads them viaaccount.data_attr. The Rust microservice (contract/src/stellar.rs) currently reads via thememofield of a transaction. These two approaches are mutually incompatible — a document anchored by the NestJS backend cannot be verified by the Rust verifier, and vice versa.Background
NestJS writes:
ManageDataop with key"doc_" + hash[:58], stored inaccount.data_attrRust reads: transaction
memofield via Horizon/transactionsendpointFiles involved:
backend/src/stellar/stellar.service.ts—anchorHash()andverifyHash()(NestJS)contract/src/stellar.rs—StellarClient.verify_hash()(Rust)Decision needed: Pick one canonical approach for both services. The recommended standard is the
ManageDataapproach (used by NestJS) because:Work required:
contract/src/stellar.rsverify_hash()to read fromaccount.data_attrinstead ofmemoGET /verify/:hashresponse to match the NestJS verification record formatGET /verify/:hash/historyreads allManageDatatransfer entries (CT-03)Acceptance Criteria
ManageData/data_attrapproachPOST /api/documents/:id/verifycan be verified by the RustGET /verify/:hashPOST /submit(CT-01) can be verified byGET /api/documents/:id/verificationin NestJScontract/src/stellar.rsis removedGET /verify/:hash/historyin Rust returns transfer records written by the NestJS transfer endpoint (or Rust CT-03)