Skip to content

[Feature]: Blockchain Event Listener Service #34

@SudiptaPaul-31

Description

@SudiptaPaul-31

🔍 Problem Statement

📖 Description

Develop a background worker service that listens to Stellar blockchain events and keeps the application state in sync. This service will update escrow statuses and milestone progress in the database based on real-time blockchain activity.

Expected Behavior

  • Listen to Stellar Events:

    • Subscribe to relevant Stellar network events (e.g., contract execution, escrow updates).
    • Continuously monitor for changes without blocking main application flow.
  • Update Escrow Status in DB:

    • Reflect escrow deposits, releases, and refunds in the database.
    • Ensure consistency between blockchain state and application state.
  • Sync Milestone Updates:

    • Update milestone status when blockchain events confirm completion or payment release.
    • Trigger notifications for clients and freelancers when milestones change state.

🛠 Technical Notes

  • Implement as a background worker (e.g., Node.js worker, queue consumer, or cron job).
  • Use Stellar SDK or Soroban APIs for event subscription and parsing.
  • Ensure idempotent updates to prevent duplicate records.
  • Maintain secure error handling and logging.
  • Optimize for scalability to handle multiple contracts and milestones concurrently.
  • Ensure compatibility with existing Postgres schema (projects, milestones, contracts, disputes).

✅ Acceptance Criteria

  • Worker successfully subscribes to Stellar events.
  • Escrow status updates are reflected in the database in real time.
  • Milestone progress is synced correctly with blockchain confirmations.
  • Notifications are triggered for relevant updates.
  • Service runs reliably in background without blocking API routes.
  • npm run lint and npm run build succeed.
  • No regression in authentication, wallet connection, or dashboard features.

📈 Expected Impact

High — Would significantly improve user experience

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions