Overview
Developers debugging Stellar transaction failures often need to compare two transaction envelopes — a failed XDR against a known-good one, a before-and-after after modifying an operation, or two competing path payment routes. There is currently no tooling anywhere in the Stellar ecosystem that decodes two XDR envelopes simultaneously and surfaces the structural diff at the field level. This tool must decode both envelopes completely, walk the operation tree recursively, and annotate every changed, added, and removed field — including nested types like PathPayment, ManageOffer, and SetOptions with their inner structs.
What needs to be built
apps/api/src/modules/transaction/diff.service.ts
-
POST /transaction/diff — accepts { xdrA: string, xdrB: string, type: 'envelope' | 'result' | 'meta' }:
- Decodes both XDR strings using the Stellar SDK's
xdr namespace
- Walks both decoded trees in parallel using a recursive diffing algorithm — handles nested objects, arrays (operations list, signers list, path hops), and primitive fields
- Returns a structured
DiffResult: { summary: { added, removed, changed }, fields: DiffField[] } where each DiffField = { path: string, type: 'added' | 'removed' | 'changed' | 'unchanged', valueA: string | null, valueB: string | null, humanLabel: string }
humanLabel maps raw field names to English descriptions: source_account → "Source Account", destination_min → "Minimum Destination Amount", fee → "Transaction Fee (stroops)"
- Array diff uses sequence alignment (LCS algorithm) to match operations by type before diffing fields — avoids false positives when operations are reordered
-
GET /transaction/diff/fields — returns the full field label map as JSON — used by the frontend to render tooltips
apps/web/src/app/inspector/diff/
-
Two Monaco editors side by side — left (XDR A), right (XDR B); both accept raw XDR or a tx hash (auto-fetched from Horizon)
-
XDR type selector: Envelope / Result / Meta
-
"Compare" button — calls the diff endpoint and renders the result below
-
Diff output panel:
- Summary bar: X changed, Y added, Z removed
- Field tree — hierarchical: Transaction → Operation 1 → fields; each field row shows left value, right value, and change type badge (colour-coded)
- Filter toggles: show only changed, show only added/removed, show unchanged
- "Copy diff as JSON" button
-
Deep-link support: ?xdrA=...&xdrB=... pre-populates and auto-runs the diff on page load
Acceptance criteria
Overview
Developers debugging Stellar transaction failures often need to compare two transaction envelopes — a failed XDR against a known-good one, a before-and-after after modifying an operation, or two competing path payment routes. There is currently no tooling anywhere in the Stellar ecosystem that decodes two XDR envelopes simultaneously and surfaces the structural diff at the field level. This tool must decode both envelopes completely, walk the operation tree recursively, and annotate every changed, added, and removed field — including nested types like
PathPayment,ManageOffer, andSetOptionswith their inner structs.What needs to be built
apps/api/src/modules/transaction/diff.service.tsPOST /transaction/diff— accepts{ xdrA: string, xdrB: string, type: 'envelope' | 'result' | 'meta' }:xdrnamespaceDiffResult:{ summary: { added, removed, changed }, fields: DiffField[] }where eachDiffField={ path: string, type: 'added' | 'removed' | 'changed' | 'unchanged', valueA: string | null, valueB: string | null, humanLabel: string }humanLabelmaps raw field names to English descriptions:source_account→ "Source Account",destination_min→ "Minimum Destination Amount",fee→ "Transaction Fee (stroops)"GET /transaction/diff/fields— returns the full field label map as JSON — used by the frontend to render tooltipsapps/web/src/app/inspector/diff/Two Monaco editors side by side — left (XDR A), right (XDR B); both accept raw XDR or a tx hash (auto-fetched from Horizon)
XDR type selector: Envelope / Result / Meta
"Compare" button — calls the diff endpoint and renders the result below
Diff output panel:
Deep-link support:
?xdrA=...&xdrB=...pre-populates and auto-runs the diff on page loadAcceptance criteria
destination_minon aPathPaymentStrictReceiveoperation — including correct LCS-based operation matching when the operation order differs between the two envelopeshumanLabelis present for every field in a standard Payment, PathPayment, CreateAccount, and SetOptions operation — no raw field names shown in the UI?xdrA&xdrBauto-runs the diff without requiring a button click