Saltar al contenido principal

Trustlines Snapshot

Table Metadata​

PropertyConfiguration
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
Documentationdbt docs

Column Details​

NameDescriptionData TypeDomain ValuesRequired?Notes
ledger_keyUnique ledger key when the trust line state last changed.STRINGYesNatural Key.
account_idUnique identifier of the account.STRINGYes
asset_typeType of asset code: 4-char, 12-char, or native (XLM).STRING
  • credit_alphanum4
  • credit_alphanum12
  • native
YesXLM has no issuer or asset code, shown as native.
asset_issuerAccount address of the original asset issuer.STRINGNo
asset_code4- or 12-character code of the asset.STRINGNoAsset uniqueness = code + issuer + type.
asset_idEncoded asset identifier.INTEGERNoDerived from asset code + issuer + type.
liquidity_pool_idUnique identifier for a liquidity pool.STRINGYesNatural Key. Cluster Field.
balanceNumber of units of asset held by this account.FLOATYes
trust_line_limitMaximum amount of this asset that the account accepts.INTEGERYesSet when opening trust line.
buying_liabilitiesSum of buy offers owned by this account (XLM only).FLOATYesOther assets reported in trust_lines.
selling_liabilitiesSum of sell offers owned by this account (XLM only).FLOATYesOther assets reported in trust_lines.
flagsIssuer privilege flags applied to the asset.INTEGER
  • 0 - None, Default
  • 1 - Authorized
  • 2 - Authorized to Maintain Liabilities
  • 4 - Clawback Enabled
YesFlags originate from issuer account.
last_modified_ledgerLedger sequence number when entry was last modified.INTEGERYesNatural Key. Cluster Field. Not a proxy for deletion.
ledger_entry_changeCode for ledger entry change type.INTEGER
  • 0 - Ledger Entry Created
  • 1 - Ledger Entry Updated
  • 2 - Ledger Entry Deleted
  • 3 - Ledger Entry State (value of the entry)
YesSome ledger entries cannot be updated.
deletedIndicates if the ledger entry was deleted.BOOLEANtrue, falseYesDeleted entries remain in history.
sponsorAccount paying reserves for this ledger entry.STRINGNoCan sponsor accounts, signers, claimable balances, trust lines.
batch_idString 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 capabilitiesstringYes
batch_run_dateStart date of batch interval.DATETIMEYesProxy for closed_at.
closed_atLedger close timestamp in UTC.TIMESTAMPYesLedgers close ~every 5s.
ledger_sequenceSequence number of this ledger.INTEGERYesCluster Field. Unique, increments per ledger.
batch_insert_tsUTC timestamp when batch of records was inserted.TIMESTAMPYesFor engineering/backfill analysis only.
airflow_start_tsAirflow task start timestamp.STRINGYes
valid_fromTimestamp when row became effective.TIMESTAMPYesTracks historical changes.
valid_toTimestamp when row is no longer valid.TIMESTAMPNoNull = currently active.

Example Business Questions​

  1. What was the balance of each account’s trustlines on a given date?
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;