Skip to content

Document the response differences between Horizon and RPC - #2828

Merged
ElliotFriend merged 15 commits into
mainfrom
docs-agent/1621-horizon-rpc-response-differences
Oct 12, 2026
Merged

ElliotFriend merged 15 commits into
mainfrom
docs-agent/1621-horizon-rpc-response-differences

Conversation

@kaankacar

Copy link
Copy Markdown
Contributor

🤖 Automated triage bot, acting for @kaankacar.

Refs #1621. The migration guide maps each Horizon endpoint to an RPC method, but it never said the two responses have different shapes. This adds a Response Differences section that compares GET /accounts/{address} with getLedgerEntries side by side, using real Testnet responses, and covers response shape, raw stroop amounts, XDR encoding, the flags and thresholds fields, and the missing-entry case. It also links the migration guide from the APIs overview, which had no inbound link to it.

This uses "Refs", not "Closes". The issue asks for a comparison of the most-used Horizon endpoints, and this delivers the account endpoint only. Please close the issue when the remaining endpoints are covered.

Verified against live Testnet data and primary sources:

  • Horizon 9009.2998203 XLM equals the account entry's 90092998203 stroops. Horizon 1252.7872975 USDC equals the trustline entry's 12527872975.
  • AccountEntry in stellar-xdr v28.0 has no trustline field and comments int64 balance as "in stroops".
  • The XDR comment on thresholds reads [weight of master|low|medium|high], which matches the live "01000000" next to Horizon's master key signer of weight 1.
  • TrustLineFlags sets AUTHORIZED_FLAG = 1, which matches the live flags: 1 and Horizon's is_authorized.
  • The openrpc spec sets the 200-key limit and warns that the xdrFormat: "json" shape is not stable.
  • A key for an account that does not exist returns HTTP 200 with that key absent from entries. Horizon returns 404 for the same account.

The migration guide maps each Horizon endpoint to an RPC method, but it
never said that the two responses have different shapes. That gap is the
one people hit first: Horizon aggregates an account with its trustlines
and formats amounts to seven decimal places, while getLedgerEntries
returns one raw ledger entry per key with amounts as int64 stroops.

Add a Response Differences section that compares GET /accounts/{address}
with getLedgerEntries side by side, using real Testnet responses. It
covers response shape, raw amounts, XDR encoding, the flags and
thresholds fields, and the fact that a missing entry is a 200 rather
than a 404.

Also link the migration guide from the APIs overview, which had no
inbound link to it.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds documentation to help developers migrating from Horizon to RPC understand and handle the different response shapes—specifically by introducing a side-by-side “Response Differences” section in the migration guide and adding an inbound link from the APIs overview.

Changes:

  • Add an inbound link from the APIs overview to the Horizon→RPC migration guide.
  • Add a “Response Differences” section comparing Horizon GET /accounts/{address} to RPC getLedgerEntries, including worked example responses and guidance on amounts, encoding, flags/thresholds, and missing-entry behavior.
  • Update the endpoint mapping row for GET /accounts/{address} to point readers to the new example section.

Recommendation: NEEDS-CHANGES — the RPC example response should include entry keys (to support the “missing entry” guidance), and the new XDR reference should be consistent with the rest of the RPC docs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
docs/data/apis/README.mdx Adds a direct link to the migration guide from the APIs overview.
docs/data/apis/migrate-from-horizon-to-rpc.mdx Adds a new “Response Differences” section and links it from the endpoint mapping table.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings September 8, 2026 03:07
@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (3)

Previously missed (2) — in code that hasn't changed since the last review.

docs/data/apis/migrate-from-horizon-to-rpc.mdx:24

  • The table says RPC returns a “Signed 64-bit integer”, but in JSON responses these int64 values are typically serialized as strings (as shown in the example snippet). Clarifying this avoids suggesting callers can safely treat the value as a JSON number.

This issue also appears on line 162 of the same file.
docs/data/apis/migrate-from-horizon-to-rpc.mdx:195

  • This row uses “trust line” but the docs elsewhere (including this page’s earlier “trustline entries”) consistently use “trustline” as a single term. Aligning terminology will reduce confusion for readers searching the docs.

docs/data/apis/migrate-from-horizon-to-rpc.mdx:162

  • “RPC returns the integer itself” is a bit misleading in the xdrFormat: "json" context, since int64 amounts are usually returned as JSON strings to preserve precision. Tweaking the wording here will align with the example response and the big-number advice.
Every classic amount on the ledger is a signed 64-bit integer of stroops. Horizon divides it by ten million and returns a string with seven decimal places. RPC returns the integer itself. Divide it in your own code, and use a big-number type so you do not lose precision. See [Amount precision](../../learn/fundamentals/stellar-data-structures/assets.mdx#amount-precision).

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings September 8, 2026 03:13
@kaankacar

Copy link
Copy Markdown
Contributor Author

🤖 Automated message from Kaan's Automated Triage Bot.

Round 2 had no active comments. Three suppressed comments, all accepted and fixed in 5e0dd14.

  • int64 amounts: correct. A live Testnet call returns "balance": "90092998203", a JSON string. The table now says "sent as a string". The Amounts section now says the value is a JSON string, not a JSON number.
  • "trust line" in the mapping table: correct. 88 docs files use "trustline", 11 use "trust line". Changed to "trustline".

@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

Suppressed comments (1)

docs/data/apis/migrate-from-horizon-to-rpc.mdx:166

  • This section describes missing keys as being "left out of entries", but per the RPC OpenRPC schema entries itself may be omitted when no entries are found. Mentioning this avoids clients assuming entries is always an array.
### A Missing Entry Is Not an Error

Horizon answers `404` when a resource does not exist. RPC answers `200` and leaves the key out of `entries`, so a request for two keys can return one entry. Match each returned entry back to its own key with the entry's `keyJson` field, or `key` in the default base64 format. Do not match on the position you sent it in.

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Copilot AI review requested due to automatic review settings September 8, 2026 03:19
@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Sep 8, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Sep 8, 2026
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Recommendation: NEEDS-CHANGES — align the missing-entries guidance with the OpenRPC contract.

Review effort: Balanced
Findings: None

The server always sends entries, as an empty array when nothing is
found, while the OpenRPC specification lists only latestLedger as
required. Say both so clients handle either.
@kaankacar

Copy link
Copy Markdown
Contributor Author

Copilot's last two passes pulled in opposite directions on entries: one said the optional-field claim is stale because the server always sends it, the next said to align with the OpenRPC contract, which lists only latestLedger as required. Both facts are true, so aa22e46 states both: the current server always sends entries, as an empty array when nothing is found, and clients should still treat a missing field as empty because the specification does not require it.

Copilot AI balanced review requested due to automatic review settings October 6, 2026 15:23

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The documentation is accurate, appropriately scoped, and uses valid repository-relative links.

Review effort: Balanced
Findings: None

@github-actions github-actions Bot added the preview Preview builds for PRs by SDF employees. label Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

Horizon sets an account's paging_token to its account ID (resourceadapter/account_entry.go: dest.PT = account.AccountID), and the live Testnet response returns it that way. The row's point stands: the account endpoint is one resource with no paging.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 23:26
@github-actions github-actions Bot removed the preview Preview builds for PRs by SDF employees. label Oct 6, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Recommendation: NEEDS-CHANGES — The balance-key instructions incorrectly imply native XLM uses a trustline.

Review effort: Balanced
Findings: None

Previously missed (1)

In code that hasn't changed since last review

Low severity Clarify trustline keys apply only to non-native balances

docs/​data/​apis/​migrate-from-horizon-to-rpc.mdx:99

XLM is included in Horizon's balances, but it has no trustline; its balance comes from the account entry. Qualify this as one trustline key per non-native balance (including pool-share balances) so readers do not try to construct a trustline key for native XLM.

The native balance lives in the account entry, so only non-native balances need a trustline key. Liquidity pool shares do have trustlines (TrustLineAsset carries ASSET_TYPE_POOL_SHARE), so they count.
Copilot AI balanced review requested due to automatic review settings October 6, 2026 23:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

Recommendation: MERGE-READY — the documentation is accurate, scoped appropriately, and internally consistent.

Review effort: Balanced
Findings: None

@stellar-doxie

stellar-doxie Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🤖 Automated message from the Stellar Triage Bot.

Back on this because new commits and Copilot reviews arrived on a PR I reviewed before.

I pushed two fixes for Copilot's suppressed notes:

  • e15bb49 drops "its paging_token is empty". Live Horizon sets paging_token to the account ID.
  • fc88eea says XLM needs no trustline key, and pool shares do (TrustLineAsset has ASSET_TYPE_POOL_SHARE).

Verified: the example values still match live Testnet, all checks are green, and Copilot's last round has no findings. No live preview was available, so this relies on the green build / build. The section now sits after the endpoint table, as @ElliotFriend asked. Ready to merge.

@ElliotFriend
ElliotFriend merged commit b2cbb26 into main Oct 12, 2026
10 checks passed
@ElliotFriend
ElliotFriend deleted the docs-agent/1621-horizon-rpc-response-differences branch October 12, 2026 16:47
@github-actions

Copy link
Copy Markdown
Contributor

PR Preview: torn down

oceans404 added a commit that referenced this pull request Oct 21, 2026
Adds the Response Differences section and its Account Balances
example, the pointer to it in the intro, the trustline wording and
link in the accounts row, and the AccountEntry reference. The APIs
landing page links to the migration guide from its Horizon warning,
root-relative. Applied hunk by hand because the export's link style
made the three-way merge conflict on unrelated lines.

Checks: parity all upstream lines present (7 differ only by link and
admonition conversion), guard clean, mint validate passed,
broken-links at baseline 8, both pages 200.
ElliotFriend pushed a commit that referenced this pull request Oct 21, 2026
Port of b2cbb26 to the Mintlify tree.

Refs #2828

Co-Authored-By: Claude Opus 5.5 <[email protected]>
ElliotFriend added a commit that referenced this pull request Oct 22, 2026
)

Replaces the Docusaurus site with Mintlify's converted tree (base bcec501),
with tooling trimmed to prettier, husky, redocly, the OpenRPC build, and the
mint CLI. Commits that landed on main after bcec501 were ported by hand.

Ported:
Refs #2448
Refs #2671
Refs #2672
Refs #2727
Refs #2827
Refs #2828
Refs #2837
Refs #2856
Refs #2857
Refs #2869
Refs #2871
Refs #2878
Refs #2880
Refs #2881
Refs #2885
Refs #2886
Refs #2890
Refs #2892
Refs #2893
Refs #2895
Refs #2900
Refs #2901
Refs #2902
Refs #2903
Refs #2905
Refs #2912
Refs #2913
Refs #2915
Refs #2918
Refs #2922

Merged into the branch:
Refs #2936
Refs #2937
Refs #2938
Refs #2940

Co-authored-by: alexistabak-cpu <[email protected]>
Co-authored-by: Emir Ayral <[email protected]>
Co-authored-by: John Wooten <[email protected]>
Co-authored-by: Kaan Kacar <[email protected]>
Co-authored-by: Leigh <[email protected]>
Co-authored-by: maz <[email protected]>
Co-authored-by: Michael Lip <[email protected]>
Co-authored-by: Scopuly <[email protected]>
Co-authored-by: stellar-triage-bot[bot] <333411864+stellar-triage-bot[bot]@users.noreply.github.com>
Co-authored-by: Steph <[email protected]>
Co-authored-by: urvisavla <[email protected]>
Co-authored-by: water-k-max <[email protected]>
Co-authored-by: Wlademyr Mendes <[email protected]>
Co-Authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:ready-to-merge Bot verified and approved; waiting for a maintainer to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants