Skip to content

Spike: Define the on-chain write path for escrow actions (create/release/dispute) #180

Description

@meshackyaro

Description

EscrowService (src/escrow/escrow.service.ts) is a purely in-memory store — create, release, and raiseDispute never build, sign, or submit a Soroban transaction. Meanwhile the event-ingestion pipeline (src/event-ingestion/ledger-cursor.service.ts → event-processor.service.ts) already consumes on-chain Soroban events and applies them to EscrowService, so a read path from chain to API state exists, but no write path from the API back to chain exists at all.

It's unclear whether the intended design is:

  • The backend itself builds/signs/submits transactions server-side (requiring custody of a signing key), or
  • Escrow actions are meant to be client-signed via trustflow-sdk / the frontend, with the backend acting as a pure event-driven read cache and the REST endpoints (POST /escrows, POST /escrows/:id/release, POST /escrows/:id/dispute) only reflecting/validating local state until the on-chain event round-trips back through ingestion.

This ambiguity blocks writing a real implementation ticket, and it directly affects the SDK's TrustFlowEscrowClient (currently mocked) and the contract's missing non-disputed release entrypoint — both flagged in sibling spike issues in their respective repos.

Component

Backend

Difficulty

🟣 Spike — investigation required, scope not yet defined

Tasks

  • Map every escrow action against whether it currently ever touches the chain (it doesn't) vs. whether event-ingestion would eventually observe it
  • Evaluate server-side signing/custody vs. client-signed-only architectures, including security and key-management trade-offs
  • Prototype one end-to-end escrow action (e.g. release) using the chosen approach against Soroban testnet
  • Document how this reconciles with stellar/soroban.helper.ts / stellar/stellar.service.ts, which exist but aren't wired into EscrowService
  • Write up findings with a recommended architecture

Acceptance Criteria

  • A written recommendation covering the chosen write-path architecture and its trade-offs
  • A working prototype (even if not merged) demonstrating one escrow action actually reaching chain
  • Follow-up implementation issue(s) filed based on the conclusion
  • Any blocking unknowns (e.g. key custody, HSM/signing service needs) explicitly flagged

Estimated Time

2-3 days (time-boxed spike)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

GrantFox OSSIssue tracked in GrantFox OSSMaybe RewardedIssue may be eligible for a GrantFox rewardOfficial Campaign | FWC26Campaign: Official Campaign | FWC26Third CampaignCampaign: Third Campaignbackenddifficulty: spikeResearch/investigation issue — scope and approach are not yet definedpriority: highHigh priority issuequestionFurther information is requestedweb3

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions