Astraea API Server 0.6.1
An XRP Ledger API server with history you can check.

API

Astraea serves JSON-RPC over HTTP POST / and WebSocket on the same address, like Clio and rippled. Requests and responses follow Clio 2.x, including error tokens and codes, so existing client libraries work unchanged. Both API versions 1 and 2 are accepted (api_version), and version 2 is the default; Clio and xrpld default to version 1, so a client that relies on version 1 shapes, such as ledger_index as a string in a ledger header, should send api_version: 1.

Every response carries a warning that Astraea serves validated data only:

{"id": 2001, "message": "This is an Astraea server. It serves only validated data."}

§Ledger range

server_info reports complete_ledgers as one range. It goes down as far as there is cold history with indexes that joins up with the hot store without a gap, and up to the last ledger the Proof Engine has confirmed by quorum. A ledger that was loaded but isn’t confirmed yet is not served.

Ledgers outside the range get lgrNotFound, as on any server that doesn’t have them. For account_tx with explicit bounds outside the range, version 2 returns lgrIdxMalformed like Clio.

account_tx and nft_history refuse a marker past the last ledger with invalidParams and the message markerOutOfRange, on every API version. Such a marker comes from a server further ahead, for example after a client failed over to this one. An empty page without a marker would read as “no more transactions”. This has not been compared with Clio.

A successful account_tx covers only what ledger_index_min and ledger_index_max in the answer say. With ledger_index_max of -1, or on version 1 with a higher bound, that ends at this server’s last ledger, which can be behind a live stream from another server. A client catching up must take its progress from ledger_index_max in the answer, not from the ledger it asked for or saw in the stream.

§Methods

§History

MethodNotes
ledgerby ledger_index or ledger_hash, with transactions, expand and binary
txby hash or by ctid; binary supported
account_txfull range, both directions, markers; limit defaults to 200, at most 1000. tx_type and mpt_issuance_id filter as in Clio 2.8: after the page is read, so a page can hold fewer than limit transactions and still carry a marker
book_changesby ledger_index or ledger_hash, over the full range; volumes and rates match xrpld to the last digit
nft_historya token’s transactions over the full range, as in Clio: limit 1 to 100 (default 50); going forward, the marker is the position right after the last transaction returned

These work over the whole range, hot and cold. Paging with markers is continuous across the hot/cold boundary and between cold partitions.

§State

MethodNotes
account_infosigner_lists supported
account_lines, account_objects, account_offerslimit 10 to 400, default 200
ledger_entryevery selector of Clio 2.8: index, account_root, amendments, amm, bridge with bridge_account, check, credential, delegate, deposit_preauth (with authorized or authorized_credentials), did, directory, escrow, fee, hashes, loan, loan_broker, mpt_issuance, mptoken, nft_offer, nft_page, nunl, offer, oracle, payment_channel, permissioned_domain, ripple_state, signer_list, ticket, vault, xchain_owned_claim_id, xchain_owned_create_account_claim_id. A hex string in any of them is the object key, and the object must be of that type. Params are checked as Clio 2.8 checks them, field by field in its order, and a malformed one gets Clio’s error and message. With more than one selector the answer follows Clio’s order of preference too; xrpld 3.0 and later answer invalidParams there instead. include_deleted returns a deleted object as it was before the deleting ledger, with deleted_ledger_index
ledger_dataup to 256 objects per page in JSON, 2048 in binary
mpt_holdersas in Clio
account_mptoken_issuances, account_mptokensas in Clio: the account’s MPT issuances or balances from its owner directory, limit 10 to 400 (default 200, counting every entry walked), flags spelled out (mpt_can_transfer, mpt_immutable_require_auth…). mpt_issuance_id is the 24-byte MPTID, as in Clio 2.9; Clio 2.8 printed the issuance object’s key there
vault_infoas in Clio: the Vault by vault_id, or by owner and seq, with its share issuance under shares, at any ledger with state. Errors and their codes are Clio’s. Clio ignores ledger_hash here and answers from its latest ledger; Astraea honours it
featureas in Clio: every amendment the server knows, or one by feature (its name or ID), with enabled from the Amendments object of the ledger asked and supported. The list is xrpld 3.4.1’s, the same release as the binary format, plus nine amendments older releases knew and dropped, which Clio 2.8 also lists, as not supported. Clio 2.8 was built with an older libxrpl, so its list lacks fixBatchV1_2 (enabled on mainnet) and fixCleanup3_4_0, and it does not support LendingProtocolV1_1. vetoed is refused with noPermission; ledger_index current or closed goes to the node
account_nftsas in Clio: limit counts NFT pages (20 to 400, default 100), and the marker is the key of the next page
nft_buy_offers, nft_sell_offerslimit 50 to 500, default 250; the marker is the first offer of the next page
nft_infoa token’s owner, whether it is burned, and its URI at any ledger in the range
nfts_by_issueran issuer’s tokens by taxon and ID, each as of the ledger asked; limit 1 to 100 (default 50); a token minted after that ledger is left out but counts toward the page, as in Clio

State exists from the hot store’s snapshot onward. A state query for an older ledger returns lgrNotFound, unless the server was started with a version index over cold history (--old-state): then account_info, ledger_entry, account_lines, account_objects, vault_info and feature also answer on the ledgers it covers, which server_info gives as astraea.old_state_ledgers. Other state methods, and every request to a public listener, still get lgrNotFound there.

§NFT index

nft_info, nft_history and nfts_by_issuer read an index built from the NFT transactions of every ledger, by the rules Clio uses: the minted token is the one added to the NFT pages, a burn takes the owner from the page that held the token, an accepted offer takes the buyer, or the new holder’s page when only a sell offer is given. Only successful transactions count. On mainnet the index starts at ledger 75,443,457, where NonFungibleTokensV1_1 was enabled. A server that adds the index fills the earlier ledgers in the background; until that is done these three methods answer notReady.

Where the answers differ from Clio’s:

§Server

server_info and ping are answered locally. server_info includes Clio’s fields plus a few of Astraea’s own:

FieldMeaning
astraea, astraea_versionserver identification
confirmed_ledgernewest ledger confirmed by validator quorum
loaded_ledgernewest ledger loaded and checked, possibly not confirmed yet
confirmation_rulethe quorum rule in force
state_root_checkedwhether the state root is checked on every ledger

load_factor and rippled_version are taken from a node when forwarding is configured. server_info never waits for a node: it uses the node’s last answer, refreshed in the background. If no node has answered for 10 seconds, or none has yet since the start, rippled_version is left out and load_factor is 1, so a load_factor of 1 does not by itself mean the network’s fees are at their base level.

§Forwarded to a node

When the server is started with --forward-rpc, these go to the node the way Clio sends them:

Nothing else is forwarded, whatever its parameters say, and admin methods return unknownCmd. Forwarded answers carry "forwarded": true. A forwarded request has 8 seconds over all nodes, and a node that just failed is tried last. If all nodes fail, the server answers failedToForward at once for the next 5 seconds instead of waiting on a dead node.

submit and simulate are forwarded only on a server started with --forward-submissions, and never on a public listener; otherwise they return unknownCmd, or notSupported on a public listener. The node never signs for a client: submit takes only a signed tx_blob, and a request with secret, seed, seed_hex, passphrase or key_type gets invalidParams with the message signingNotSupported.

submit is not cached. Another node is tried only when the first can’t have received the transaction, because sending it again could give tefPAST_SEQ for a transaction that in fact went through. A failedToForward whose message says the transaction may have been sent means the outcome is unknown: look it up by hash before sending it again.

§Subscriptions (WebSocket)

subscribe and unsubscribe support the ledger, transactions, book_changes, validations and manifests streams and accounts. A ledger’s bookChanges message comes after its transactions, as in Clio. Validation and manifest messages are the nodes’ own, passed on as received, as Clio does; Astraea listens to several nodes, and a message that comes from more than one is sent once. The streams Clio offers that Astraea doesn’t (transactions_proposed, accounts_proposed, books) return notSupported instead of a silent subscription.

§Lending dashboards

A service that shows vaults, loan brokers and loans (a dashboard, an explorer, a risk monitor) needs the same few requests, and Astraea answers each of them as Clio does: vault_info for a vault with its share issuance, ledger_entry by index for a LoanBroker or a Loan, account_objects with type vault, loan_broker or loan for one owner, ledger with transactions and expand for the changes in a ledger, and feature to tell whether SingleAssetVault and LendingProtocol are enabled. The lending group of the Clio check sends them in these shapes (running.md). Vaults and lending gives the whole picture: the objects, their shares, and proving their state.

The one request that does not scale is listing every object of a type with ledger_data and type. The server walks the whole state tree in key order, up to 256 objects a page in JSON, and a page holds only the matches in the slice it walked, often none; only a page without marker ends the list. On mainnet that is tens of thousands of pages, hours of requests, on any server. A few capped pages give a sample, not a list.

To know every vault, loan broker and loan, follow ledgers instead, from the ledger where SingleAssetVault was enabled: no lending object can exist before it, so each one appears as a CreatedNode in the metadata of a transaction after it, and its changes and deletion follow in later ledgers. One ledger request with transactions and expand per ledger, or the transactions stream, keeps the list complete; current values come by ID from vault_info and ledger_entry.

Requests without api_version get version 2 (see above). A client that reads both shapes takes the transaction from tx_json or the top level, the metadata from meta or metaData, and the hash, ledger_index and close time from the envelope in version 2. ledger_data and an expanded ledger count 5 requests against the limits below, so a backend that polls should be whitelisted by the server’s operator.

§Limits

A server can limit each client’s requests, response bytes and open connections, like Clio’s DOS guard; a client over its limit gets slowDown (error_code 10), over HTTP with status 503. See running.md.

HTTP answers carry Cache-Control: public, max-age=86400, immutable for answers that can never change (a transaction, anything about a ledger named by sequence or hash), no-store for the rest.

Each request has 10 seconds, 5 on a public listener. The loops whose length depends on the request (owner directory pages, ledger_data objects, cold index partitions, the transactions of a page or a ledger) check the time, and a request past it ends with tooBusy instead of holding one of the request slots. Most requests take well under a second; the slowest, a full binary ledger_data page, about 0.7 s. A request that waits for a slot longer than 5 seconds, 0.5 on a public listener, also ends with tooBusy.

§Health

GET /health answers 200 with {"status": "ok", "ledger": <last ledger>, "age": <seconds since it closed>} while the last ledger is at most 60 seconds old. Past that it answers 503 with "status": "lagging", and with "status": "noLedger" when there is no ledger to serve yet.

§Proofs

MethodParametersProves
proof_ledgerledger_index or ledger_hashthe header and its hash were validated by quorum
proof_txtransaction (hash)the transaction with this metadata is in a validated ledger
proof_entrythe same selectors as ledger_entry, and ledger_index or ledger_hashthe object exists with this content, or does not exist, in the state of that ledger (the latest by default)

The response holds the package under proof, the anchor ledger, and two plain lists: what the package proves and what it does not (for example, a transaction proof says nothing about server-derived fields like delivered_amount).

proof_ledger and proof_tx work for any ledger the server holds, back to ledger 32570. A target within 512 ledgers of an anchor is linked to it by a header chain (target_confirmed_by is quorum or hash-chain). An older one is reached through a skip list (skip-list, package format xrpl-witness/evidence/4): the latest state holds the hash of every 256th ledger since the start of history, so the package proves that list in the state of a recent ledger and adds at most 256 headers from the target up to the ledger in the list. proof_entry works on the latest state and on earlier ledgers back to the state snapshot: the server keeps, per ledger, the hashes of the state subtrees at depth 3 that changed, and rebuilds the path from those and the object versions. A ledger before the snapshot has no state and gets lgrNotFound; while a server is still rebuilding its tree history, a ledger below the rebuilt part gets noEvidence.

Check a package offline. By default the verifier trusts the same two UNL publishers as xrpld’s default configuration; --publisher <hex key> replaces them, --threshold sets how many lists must include a validator, and --trust <n9… key> adds a directly trusted validator.

witness-verify evidence package.json