> **Can't find what you're looking for?** Use `search_docs` on the docs MCP server at `https://docs.ampdb.io/api/mcp` to find what you need.

# Stellar Tables

Every Stellar [raw dataset](/datasets/raw-datasets) (`"kind": "stellar"`) has these tables: [`ledgers`](/datasets/tables/stellar#ledgers), [`transactions`](/datasets/tables/stellar#transactions), and [`events`](/datasets/tables/stellar#events). Query one through its dataset's name, like `SELECT * FROM "acme/stellar_mainnet".ledgers`. Column types are [Arrow types](/datasets/manifests#data-types), and a nullable column can be `NULL`.

:::warning
In v0.0.42, every query of a Stellar dataset fails with `blocks table 'blocks' not found`: the query server looks for a `blocks` table, and Stellar's ledgers are in `ledgers`. See [the error](/providers/stellar#blocks-table-blocks-not-found-in-dataset).
:::

## `ledgers`

One row per ledger. A ledger is Stellar's equivalent of a block: the network closes one every few seconds, applying a set of transactions.

| Column                                               | Type                            | Nullable | Description                                                                                                                                                                                                                                                                  |
| ---------------------------------------------------- | ------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_block_num`                                         | `UInt64`                        | No       | The sequence number of the ledger the row comes from, Stellar's equivalent of a block number. Amp adds it to every raw table, and uses it to order the data, split it into files, and track which ledgers it has.                                                            |
| `_ts`                                                | `Timestamp(Nanosecond, +00:00)` | No       | The time the ledger the row comes from closed, in UTC, to the second.                                                                                                                                                                                                        |
| `sequence`                                           | `UInt64`                        | No       | The ledger's sequence number, which goes up by one with each ledger. The same as `_block_num`.                                                                                                                                                                               |
| `closed_at`                                          | `Timestamp(Nanosecond, +00:00)` | No       | When the ledger closed, in UTC, to the second. The same as `_ts`.                                                                                                                                                                                                            |
| `hash`                                               | `FixedSizeBinary(32)`           | No       | The ledger's hash (the hash of its header), which identifies it.                                                                                                                                                                                                             |
| `header_history_ext_version`                         | `UInt32`                        | No       | The version of the header entry's extension, which is reserved for future use: `0`.                                                                                                                                                                                          |
| `previous_hash`                                      | `FixedSizeBinary(32)`           | No       | The hash of the previous ledger.                                                                                                                                                                                                                                             |
| `ledger_version`                                     | `UInt32`                        | No       | The protocol version the network ran for the ledger, like `23`.                                                                                                                                                                                                              |
| `tx_set_result_hash`                                 | `FixedSizeBinary(32)`           | No       | The hash of the results of the ledger's transactions.                                                                                                                                                                                                                        |
| `bucket_list_hash`                                   | `FixedSizeBinary(32)`           | No       | The hash of the network's state after the ledger: every account, balance, offer, and contract entry.                                                                                                                                                                         |
| `ledger_seq`                                         | `UInt32`                        | No       | The ledger's sequence number as its header records it. The same as `sequence`.                                                                                                                                                                                               |
| `total_coins`                                        | `Int64`                         | No       | How many lumens (XLM, the network's currency) exist, in stroops, the smallest unit: 1 XLM is 10,000,000 stroops.                                                                                                                                                             |
| `fee_pool`                                           | `Int64`                         | No       | The fees the network has collected since inflation last ran, in stroops.                                                                                                                                                                                                     |
| `inflation_seq`                                      | `UInt32`                        | No       | How many times inflation has run. Stellar disabled inflation in protocol 12, so it no longer changes.                                                                                                                                                                        |
| `id_pool`                                            | `UInt64`                        | No       | The last ID the network assigned to a new object, like an offer. It goes up as objects are created.                                                                                                                                                                          |
| `base_fee`                                           | `UInt32`                        | No       | The minimum fee per operation, in stroops. An operation is a single action in a transaction, like a payment or a contract call.                                                                                                                                              |
| `base_reserve`                                       | `UInt32`                        | No       | The base reserve, in stroops: an account must hold two of them, plus one for each entry it owns, like a trustline or an offer.                                                                                                                                               |
| `max_tx_set_size`                                    | `UInt32`                        | No       | The most a ledger's transaction set can hold, in operations (in transactions before protocol 11).                                                                                                                                                                            |
| `skip_list_hashes`                                   | `List(FixedSizeBinary(32))`     | No       | The hashes of four earlier ledgers, which let you jump back through history without walking it ledger by ledger.                                                                                                                                                             |
| `scp_value_tx_set_hash`                              | `FixedSizeBinary(32)`           | No       | The hash of the transaction set the validators agreed to apply, through SCP, the Stellar Consensus Protocol.                                                                                                                                                                 |
| `scp_value_close_time`                               | `UInt64`                        | No       | The close time the validators agreed on, in seconds since `1970-01-01 00:00:00` UTC.                                                                                                                                                                                         |
| `scp_value_upgrades`                                 | `List(Binary)`                  | No       | The network upgrades the validators agreed to apply, like a new protocol version or base fee, each a `LedgerUpgrade` in XDR (Stellar's binary encoding), as raw bytes. Usually empty.                                                                                        |
| `scp_value_upgrade_count`                            | `UInt64`                        | No       | The number of upgrades in `scp_value_upgrades`.                                                                                                                                                                                                                              |
| `scp_value_ext_type`                                 | `Utf8`                          | No       | What the agreed value carries besides the transaction set: `Basic` (nothing), `Signed` (the signature of the validator that proposed it), or `EmptyTxSet` (a proposed value, in the `scp_value_ext_empty_tx_set_*` columns).                                                 |
| `scp_value_ext_signed_node_id`                       | `Utf8`                          | Yes      | The public key (`G…`) of the validator that proposed the agreed value. Null unless `scp_value_ext_type` is `Signed`.                                                                                                                                                         |
| `scp_value_ext_signed_signature`                     | `Binary`                        | Yes      | That validator's signature of the value, as raw bytes. Null unless `scp_value_ext_type` is `Signed`.                                                                                                                                                                         |
| `scp_value_ext_empty_tx_set_hash`                    | `FixedSizeBinary(32)`           | Yes      | The hash of the proposed value's transaction set. Null unless `scp_value_ext_type` is `EmptyTxSet`.                                                                                                                                                                          |
| `scp_value_ext_empty_tx_set_previous_ledger_hash`    | `FixedSizeBinary(32)`           | Yes      | The proposed value's previous ledger hash. Null unless `scp_value_ext_type` is `EmptyTxSet`.                                                                                                                                                                                 |
| `scp_value_ext_empty_tx_set_previous_ledger_version` | `UInt32`                        | Yes      | The proposed value's previous ledger protocol version. Null unless `scp_value_ext_type` is `EmptyTxSet`.                                                                                                                                                                     |
| `scp_value_ext_empty_tx_set_node_id`                 | `Utf8`                          | Yes      | The public key (`G…`) of the validator that signed the proposed value. Null unless `scp_value_ext_type` is `EmptyTxSet`.                                                                                                                                                     |
| `scp_value_ext_empty_tx_set_signature`               | `Binary`                        | Yes      | That validator's signature of the proposed value, as raw bytes. Null unless `scp_value_ext_type` is `EmptyTxSet`.                                                                                                                                                            |
| `header_ext_version`                                 | `UInt32`                        | No       | The version of the header's extension: `0`, or `1` when it carries `header_flags`.                                                                                                                                                                                           |
| `header_flags`                                       | `UInt32`                        | Yes      | The flags set for the ledger, added together: `1` disables liquidity pool trading, `2` deposits, and `4` withdrawals. Null when `header_ext_version` is `0`.                                                                                                                 |
| `header_ext_v1_ext_version`                          | `UInt32`                        | Yes      | The version of the header extension's own extension, which is reserved for future use: `0`. Null when `header_ext_version` is `0`.                                                                                                                                           |
| `metadata_version`                                   | `UInt32`                        | No       | The format version of `metadata_xdr`: `0`, `1`, or `2`.                                                                                                                                                                                                                      |
| `tx_processing_count`                                | `UInt64`                        | No       | The number of transactions the ledger applied.                                                                                                                                                                                                                               |
| `upgrades_processing_count`                          | `UInt64`                        | No       | The number of network upgrades the ledger applied.                                                                                                                                                                                                                           |
| `scp_info_count`                                     | `UInt64`                        | No       | The number of consensus (SCP) history entries in the ledger's metadata.                                                                                                                                                                                                      |
| `total_byte_size_of_live_soroban_state`              | `UInt64`                        | Yes      | The size, in bytes, of the live state of Soroban, Stellar's smart contract platform, which sets what contracts pay for storage. Null when `metadata_version` is `0`.                                                                                                         |
| `evicted_key_count`                                  | `UInt64`                        | Yes      | The number of keys the ledger evicted from the live state when their time to live ran out: contract data and code entries, and the entries tracking their time to live. Null when `metadata_version` is `0`.                                                                 |
| `metadata_xdr`                                       | `Utf8`                          | No       | Everything the ledger did, as base64 `LedgerCloseMeta` XDR: its header, its transactions with their results and changes, and its upgrades. Decode it with [`stellar_xdr_to_json`](/querying/functions/stellar), like `stellar_xdr_to_json(metadata_xdr, 'LedgerCloseMeta')`. |

## `transactions`

One row per transaction in a ledger, successful or failed. A transaction is a set of operations an account signs, which succeed or fail together.

| Column                   | Type                            | Nullable | Description                                                                                                                                                                                                       |
| ------------------------ | ------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_block_num`             | `UInt64`                        | No       | The sequence number of the ledger the row comes from, Stellar's equivalent of a block number. Amp adds it to every raw table, and uses it to order the data, split it into files, and track which ledgers it has. |
| `_ts`                    | `Timestamp(Nanosecond, +00:00)` | No       | The time the ledger the row comes from closed, in UTC, to the second.                                                                                                                                             |
| `ledger`                 | `UInt64`                        | No       | The sequence number of the ledger the row comes from. The same as `_block_num`.                                                                                                                                   |
| `created_at`             | `Timestamp(Nanosecond, +00:00)` | No       | When the ledger that includes the transaction closed, in UTC, to the second. The same as `_ts`.                                                                                                                   |
| `tx_hash`                | `FixedSizeBinary(32)`           | No       | The transaction's hash, which identifies it.                                                                                                                                                                      |
| `status`                 | `Utf8`                          | No       | Whether the transaction succeeded: `SUCCESS` or `FAILED`.                                                                                                                                                         |
| `application_order`      | `UInt32`                        | No       | The transaction's position in the order the ledger applied its transactions, starting at `1`.                                                                                                                     |
| `fee_bump`               | `Boolean`                       | No       | Whether it's a fee-bump transaction, which wraps another transaction so that a different account can pay a higher fee for it.                                                                                     |
| `envelope_type`          | `Utf8`                          | No       | The transaction's format: `Tx`, `TxFeeBump` for a fee-bump transaction, or the older `TxV0`.                                                                                                                      |
| `source_account`         | `Utf8`                          | No       | The account that sent the transaction, as an address: `G…`, or `M…` for a muxed account, which adds an ID to a `G…` address. For a fee-bump transaction, the account that pays the fee.                           |
| `sequence_number`        | `Int64`                         | No       | The transaction's sequence number, which orders the transactions of the account that sent it: each uses the next number. For a fee-bump transaction, the inner transaction's.                                     |
| `fee`                    | `Int64`                         | No       | The most the transaction offers to pay in fees, in stroops. For a fee-bump transaction, the fee-bump's offer, which covers the inner transaction too.                                                             |
| `operation_count`        | `UInt64`                        | No       | The number of operations in the transaction (in the inner transaction, for a fee-bump transaction).                                                                                                               |
| `memo_type`              | `Utf8`                          | No       | The kind of memo attached to the transaction, a note for its recipient like an ID an exchange uses to credit a deposit: `None`, `Text`, `Id`, `Hash`, or `Return`.                                                |
| `result_code`            | `Utf8`                          | No       | The transaction's result, like `TxSuccess`, `TxFailed` (an operation failed), `TxBadSeq` (a wrong sequence number), or, for a fee-bump transaction, `TxFeeBumpInnerSuccess`.                                      |
| `result_fee_charged`     | `Int64`                         | No       | The fee the network charged, in stroops.                                                                                                                                                                          |
| `result_operation_count` | `UInt64`                        | Yes      | The number of operation results in `result_xdr`. Null when the transaction failed before its operations ran, as with `TxBadSeq`.                                                                                  |
| `result_meta_version`    | `UInt32`                        | No       | The format version of `result_meta_xdr`, from `0` to `4`.                                                                                                                                                         |
| `envelope_xdr`           | `Utf8`                          | No       | The transaction as its sender submitted it, with its signatures, as base64 `TransactionEnvelope` XDR.                                                                                                             |
| `result_xdr`             | `Utf8`                          | No       | The transaction's result, with each operation's, as base64 `TransactionResult` XDR.                                                                                                                               |
| `result_meta_xdr`        | `Utf8`                          | No       | What the transaction changed, as base64 `TransactionMeta` XDR: the entries it created, updated, or removed and, for a contract call, its events and return value.                                                 |
| `diagnostic_events_xdr`  | `List(Utf8)`                    | Yes      | The debugging events the transaction's contract calls emitted, each a base64 `DiagnosticEvent` XDR. Null when the provider doesn't return them.                                                                   |
| `transaction_events_xdr` | `List(Utf8)`                    | No       | The events about the transaction as a whole, like its fee, each a base64 `TransactionEvent` XDR. Empty when the provider returns none.                                                                            |
| `contract_events_xdr`    | `List(List(Utf8))`              | No       | The events the transaction's operations emitted: one list per operation, each holding that operation's events as base64 `ContractEvent` XDR. Empty when the provider returns none.                                |

## `events`

One row per event in a ledger, as Stellar RPC's `getEvents` method returns it. Events record what happened during a transaction, like a token transfer. Every transaction also has a `fee` event, for the fee it was charged, and some have a second one, for a refund.

| Column                        | Type                            | Nullable | Description                                                                                                                                                                                                                                                                                                   |
| ----------------------------- | ------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `_block_num`                  | `UInt64`                        | No       | The sequence number of the ledger the row comes from, Stellar's equivalent of a block number. Amp adds it to every raw table, and uses it to order the data, split it into files, and track which ledgers it has.                                                                                             |
| `_ts`                         | `Timestamp(Nanosecond, +00:00)` | No       | The time the ledger the row comes from closed, in UTC, to the second.                                                                                                                                                                                                                                         |
| `ledger`                      | `UInt64`                        | No       | The sequence number of the ledger the row comes from. The same as `_block_num`.                                                                                                                                                                                                                               |
| `ledger_closed_at`            | `Timestamp(Nanosecond, +00:00)` | No       | When the ledger closed, in UTC, to the second. The same as `_ts`.                                                                                                                                                                                                                                             |
| `id`                          | `Utf8`                          | No       | The event's unique ID, like `0270067891464830976-0000000000`. Sorting by it orders events as they happened.                                                                                                                                                                                                   |
| `paging_token`                | `Utf8`                          | No       | Stellar RPC's paging token for the event, the same as `id`. Amp uses `id` when the provider doesn't return one.                                                                                                                                                                                               |
| `type`                        | `Utf8`                          | No       | The kind of event, like `contract` or `system`.                                                                                                                                                                                                                                                               |
| `contract_id`                 | `Utf8`                          | Yes      | The address (`C…`) of the contract that emitted the event. Null when the provider doesn't return one.                                                                                                                                                                                                         |
| `tx_hash`                     | `FixedSizeBinary(32)`           | Yes      | The hash of the transaction that emitted the event, which joins to `transactions.tx_hash`. Null when the provider doesn't return it.                                                                                                                                                                          |
| `transaction_index`           | `UInt32`                        | Yes      | The `application_order` of the transaction that emitted the event, starting at `1`. A `fee` event has `0` for a fee charged before the ledger's transactions ran, and `1048575` for a refund after they all ran. Null when the provider doesn't return it.                                                    |
| `operation_index`             | `UInt32`                        | Yes      | The position in its transaction of the operation that emitted the event, starting at `0`. `0` for `fee` events too. Null when the provider doesn't return it.                                                                                                                                                 |
| `in_successful_contract_call` | `Boolean`                       | Yes      | Whether the contract call that emitted the event succeeded. Null when the provider doesn't return it.                                                                                                                                                                                                         |
| `topics_scval_xdr`            | `List(Utf8)`                    | No       | The event's topics, which say what kind of event it is and whom it involves, like `transfer` and two addresses. Each is a contract value, a base64 `ScVal` XDR: decode one with `stellar_decode_scval`, like `stellar_decode_scval(topics_scval_xdr[1], 'symbol')`.                                           |
| `value_scval_xdr`             | `Utf8`                          | No       | The event's data, as a base64 `ScVal` XDR. Decode it with `stellar_decode_scval`. A transfer's value is its amount, an `I128`, or a map that holds the amount, when it's to a muxed address or its transaction has a memo: see [how to read the amount](/querying/functions/stellar#read-a-transfers-amount). |
