Skip to content

Ledger APIs ​

These 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 first existing keylet strictly after lo and no later than hi.
  • ../../README — documentation index.
  • Overview — hook execution model and lifecycle.
  • Glossary — full error-code and term reference.
  • Helper Macros — SBUF, GUARD, and buffer helpers.
  • Best Practices — slot budgets and iterating ledger objects.
  • Slot APIs — slot_set, slot_subfield, meta_slot, xpop_slot, and the rest of the slot family.
  • Control APIs — hook_again and the strong/weak execution model.
  • Transaction APIs — otxn_slot, otxn_field, and originating-txn access.
  • Emit APIs — etxn_fee_base, etxn_nonce, and emission.
  • Utility APIs — util_keylet for building the keylets slot_set/ledger_keylet consume.