Skip to content

Query 13 - Lattice Output Assets

Result

ADA and USDM quantities are decimal units. The long hex row is another native asset id and is shown in raw units.

assetId outputEntries totalQuantity
ada 429 118438513.316450
e0302560ced2fdcbfcb2602697df970cd0d6a38f94b32703f51c312b000de14064f35d26b237ad58e099041bc14c687ea7fdc58969d7d5b66e2540ef 51 51
usdm 116 26505269.191536

What

This query lists the asset classes present in outputs emitted by the 85-transaction lattice.

It is a gross output-surface query. It does not compute final balances and it does not net spent outputs away.

Why

Before interpreting token-specific accounting, it helps to know the asset universe in the emitted outputs. In this graph, output entries contain ADA, USDM, and one additional native asset class.

The gross USDM total is much larger than the final treasury remainder because the same value can move through multiple outputs as transactions roll state forward.

Diagram

flowchart LR
  outputs[429 outputs]
  assets[Asset entries]
  ada[ADA]
  usdm[USDM]
  other[Other native asset]

  outputs --> assets
  assets --> ada
  assets --> usdm
  assets --> other

How

The query unions ADA output amounts with native asset entries from cardano:hasAssetValue.

Native assets are restricted to identifiers whose leaf type is AssetClass. That keeps typed datum or redeemer byte fields out of the asset table. The USDM asset id is displayed as usdm; other native assets keep their raw asset id.

Run

From the repository root, run this query through the tutorial setup script:

bash docs/may-2026-amaru-lattice/setup.sh \
  docs/may-2026-amaru-lattice/lattice-boundary-and-shape/13-lattice-output-assets.rq

SPARQL

PREFIX cardano: <https://lambdasistemi.github.io/cardano-knowledge-maps/vocab/cardano#>
PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd:     <http://www.w3.org/2001/XMLSchema#>

# Asset quantities emitted by outputs in the 85-tx lattice.
SELECT ?assetId (COUNT(?out) AS ?outputEntries) (SUM(?quantity) AS ?totalQuantity)
WHERE {
  {
    ?tx cardano:hasOutput ?out .
    ?out cardano:lovelace ?rawQuantity .
    BIND("ada" AS ?assetId)
    BIND(xsd:decimal(?rawQuantity) / 1000000 AS ?quantity)
  }
  UNION
  {
    ?tx cardano:hasOutput ?out .
    ?out cardano:hasAssetValue/rdf:rest*/rdf:first ?asset .
    ?asset cardano:hasIdentifier ?assetIdentifier ;
           cardano:quantity ?rawQuantity .
    ?assetIdentifier cardano:leafType "AssetClass" ;
                     cardano:bytesHex ?rawAssetId .
    FILTER(STRLEN(?rawAssetId) > 0)
    BIND(STR(?rawAssetId) AS ?rawAssetText)
    BIND(IF(?rawAssetText = "c48cbb3d5e57ed56e276bc45f99ab39abe94e6cd7ac39fb402da47ad0014df105553444d", "usdm", ?rawAssetText) AS ?assetId)
    BIND(IF(?rawAssetText = "c48cbb3d5e57ed56e276bc45f99ab39abe94e6cd7ac39fb402da47ad0014df105553444d", xsd:decimal(?rawQuantity) / 1000000, xsd:decimal(?rawQuantity)) AS ?quantity)
  }
}
GROUP BY ?assetId
ORDER BY ?assetId