Add: Cross-Check Transaction via Horizon API#79
Open
Osuochasam wants to merge 1 commit into
Open
Conversation
ayshadogo
approved these changes
Jun 22, 2026
Contributor
There was a problem hiding this comment.
Hello @Osuochasam Job well done boss
Please fix the workflow
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Horizon-Based On-Chain Donation Verification Pipeline
Overview
Implemented an on-chain transaction verification workflow that validates submitted donations against the Stellar network before marking them as confirmed. The new verification layer integrates with Horizon to ensure that only successfully finalized transactions are accepted, preventing false confirmations and improving the integrity of the donation system.
This enhancement introduces a secure verification process that checks transaction existence, execution success, ledger inclusion, and transaction metadata before updating donation state.
What Was Implemented
1. Horizon Transaction Verification Service
Added a dedicated verification flow that cross-checks submitted donation transaction hashes against the Stellar Horizon API.
Verification Process
For each pending donation:
This ensures the platform only recognizes transactions that have been successfully committed to the Stellar ledger.
2. Transaction Existence Validation
Integrated Horizon transaction lookup using:
Validation Rules
This prevents invalid or fabricated transaction references from being confirmed.
3. Transaction Result Verification
Implemented transaction outcome validation.
Success Requirement
Only transactions with:
are eligible for confirmation.
Failure Handling
Transactions returning any non-success result code are automatically marked as failed and excluded from confirmation.
This ensures that failed network operations cannot be mistakenly treated as successful donations.
4. Ledger & Timestamp Validation
Added additional integrity checks against Horizon transaction metadata.
Ledger Verification
Confirms:
Timestamp Verification
Validates:
created_atmetadata existsThese checks provide stronger guarantees around transaction authenticity and traceability.
5. Donation State Management
Implemented secure donation lifecycle transitions.
Supported Status Flow
Confirmation Rule
A donation is marked as:
only after all Horizon verification checks succeed.
Failure Rule
A donation is marked as:
when:
This strictly enforces the platform's acceptance criteria.
6. Robust Error Handling
Added defensive handling for external service failures and unexpected verification scenarios.
Covered Scenarios
Transaction Not Found (404)
Handled gracefully by:
Network Timeouts
Implemented retry-safe error handling for temporary Horizon connectivity issues.
Rate Limiting
Added handling for Horizon throttling responses to prevent incorrect state transitions.
Service Unavailability
Protects against accidental confirmation when Horizon cannot be reached.
Unexpected API Responses
Defensive validation prevents malformed or incomplete transaction responses from producing false positives.
7. Race Condition Protection
Implemented safe database update patterns to prevent concurrent verification processes from incorrectly confirming the same donation.
Safeguards
These protections ensure data consistency even under concurrent workloads.
8. Database Integrity Controls
Added secure persistence logic around donation verification.
Features
This guarantees accurate donation lifecycle tracking.
Testing Coverage
Implemented a comprehensive test suite covering both successful and failure scenarios.
Successful Verification Tests
Validated:
txSUCCESSpendingtoconfirmedTransaction Not Found Tests
Validated:
Failed Transaction Tests
Validated:
Network Error Tests
Validated:
Database Update Tests
Validated:
Mock-Based Verification Tests
Created unit tests using mocked:
This enables deterministic testing of all verification paths without requiring live network access.
Security & Reliability Improvements
Prevents False Confirmations
Only verified on-chain transactions are accepted.
Stronger Financial Integrity
Donation records now reflect actual Stellar ledger state.
Improved Auditability
Ledger and timestamp verification provide a clear verification trail.
Resilient External Integration
Robust error handling protects against Horizon outages and transient failures.
Concurrency Safety
Atomic state transitions prevent race-condition-related inconsistencies.
Acceptance Criteria Achieved
txSUCCESSverification enforcedcreated_atvalidation implementedCloses Cross-Check Transaction via Horizon API #53