Skip to content

Ledger APIs

These six APIs read ledger-level data — the current ledger's sequence and base fee, the last-closed ledger's time and hash, a general-purpose nonce, and keylet range enumeration. They were originally documented together with the slot family on a single "Ledger and Slot APIs" page; that page has been split in two, and this page covers the ledger-info half.

All signatures are copied verbatim from hook/extern.h. Return codes reference the shared error table in ../../glossary; values come from hook/error.h. The implementation is split between core lookup/read logic and the WASM-facing wrappers that marshal arguments across the guest boundary.


Index

FunctionPurpose
fee_baseBase fee (drops) of the current ledger.
ledger_seqCurrent ledger sequence number.
ledger_last_timeClose time of the last closed ledger.
ledger_last_hashHash of the last closed ledger.
ledger_nonceA unique per-call nonce.
ledger_keyletEnumerate the next keylet in a lo..hi range.
  • ../../README — documentation index.
  • ../../overview — hook execution model and lifecycle.
  • ../../glossary — full error-code and term reference.
  • ../../macrosSBUF, GUARD, and buffer helpers.
  • ../../best-practices — slot budgets and iterating ledger objects.
  • Slot APIsslot_set, slot_subfield, meta_slot, xpop_slot, and the rest of the slot family.
  • controlhook_again and the strong/weak execution model.
  • transactionotxn_slot, otxn_field, and originating-txn access.
  • emit-and-etxnetxn_fee_base, etxn_nonce, and emission.
  • utilityutil_keylet for building the keylets slot_set/ledger_keylet consume.