> ## Documentation Index
> Fetch the complete documentation index at: https://developers.stellar.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Trustlines Snapshot

> Reference documentation for the Trustlines Snapshot table in Hubble's Silver data dictionary.

## Table Metadata

| Property | Configuration |
| - | - |
| Natural Key(s) | account\_id, asset\_type, asset\_issuer, asset\_code, liquidity\_pool\_id, valid\_from |
| Partition Field(s) | valid\_to (MONTH partition) |
| Clustered Field(s) | account\_id, asset\_id |
| Documentation | [dbt docs](http://www.stellar-dbt-docs.com/#!/model/model.stellar_dbt_public.trustlines_snapshot) |

## Column Details

| Name | Description | Data Type | Domain Values | Required? | Notes |
| - | - | - | - | - | - |
| ledger\_key | Unique ledger key when the trust line state last changed. | STRING | | Yes | Natural Key. |
| account\_id | Unique identifier of the account. | STRING | | Yes | |
| asset\_type | Type of asset code held by the trustline: 4-char, 12-char, or a liquidity pool share. | STRING | <ul><li>credit\_alphanum4</li><li>credit\_alphanum12</li><li>pool\_share</li></ul> | Yes | Trustlines never report `native`. XLM is held directly on the account and is reported in the `accounts` table, not here. `pool_share` identifies a trustline holding shares in a liquidity pool. |
| asset\_issuer | Account address of the original asset issuer. | STRING | | No | |
| asset\_code | 4- or 12-character code of the asset. | STRING | | No | Asset uniqueness = `code + issuer + type`. |
| asset\_id | Encoded asset identifier. | INTEGER | | No | Derived from asset code + issuer + type. |
| liquidity\_pool\_id | Unique identifier for a liquidity pool. | STRING | | Yes | Natural Key. Cluster Field. |
| balance | Number of units of asset held by this account. | FLOAT | | Yes | |
| trust\_line\_limit | Maximum amount of this asset that the account accepts. | INTEGER | | Yes | Set when opening trust line. |
| buying\_liabilities | Sum of buy offers owned by this account (XLM only). | FLOAT | | Yes | Other assets reported in `trust_lines`. |
| selling\_liabilities | Sum of sell offers owned by this account (XLM only). | FLOAT | | Yes | Other assets reported in `trust_lines`. |
| flags | Issuer privilege flags applied to the asset. | INTEGER | <ul><li>0 - None, Default</li><li>1 - Authorized</li><li>2 - Authorized to Maintain Liabilities</li><li>4 - Clawback Enabled</li></ul> | Yes | Flags originate from issuer account. |
| last\_modified\_ledger | Ledger sequence number when entry was last modified. | INTEGER | | Yes | Natural Key. Cluster Field. Not a proxy for deletion. |
| ledger\_entry\_change | Code for ledger entry change type. | INTEGER | <ul><li>0 - Ledger Entry Created</li><li>1 - Ledger Entry Updated</li><li>2 - Ledger Entry Deleted</li><li>3 - Ledger Entry State (value of the entry)</li></ul> | Yes | Some ledger entries cannot be updated. |
| deleted | Indicates if the ledger entry was deleted. | BOOLEAN | true, false | Yes | Deleted entries remain in history. |
| sponsor | Account paying reserves for this ledger entry. | STRING | | No | Can sponsor accounts, signers, claimable balances, trust lines. |
| batch\_id | String representation of the run id for a given DAG in Airflow. Takes the form of `scheduled__<batch_end_date>-<dag_alias>`. Batch ids are unique to the batch and help with monitoring and rerun capabilities | string | | Yes | |
| batch\_run\_date | Start date of batch interval. | DATETIME | | Yes | Proxy for `closed_at`. |
| closed\_at | Ledger close timestamp in UTC. | TIMESTAMP | | Yes | Ledgers close \~every 5s. |
| ledger\_sequence | Sequence number of this ledger. | INTEGER | | Yes | Cluster Field. Unique, increments per ledger. |
| batch\_insert\_ts | UTC timestamp when batch of records was inserted. | TIMESTAMP | | Yes | For engineering/backfill analysis only. |
| airflow\_start\_ts | Airflow task start timestamp. | STRING | | Yes | |
| valid\_from | Timestamp when row became effective. | TIMESTAMP | | Yes | Tracks historical changes. |
| valid\_to | Timestamp when row is no longer valid. | TIMESTAMP | | No | Null = currently active. |

## Example Business Questions

1. What was the balance of each account’s trustlines on a given date?

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT
  account_id,
  asset_code,
  asset_issuer,
  balance
FROM `crypto-stellar.snapshots.trustlines_snapshot`
WHERE DATE(valid_from) <= DATE('2025-01-15')
  AND (DATE(valid_to) > DATE('2025-01-15') OR valid_to IS NULL)
  AND deleted = FALSE
  AND liquidity_pool_id = ''
LIMIT 100;
```
