Skip to content

Query 01 - Network Compliance Touch Summary

Result

touchKind txs
consumes-and-produces 31
produces-only 54

What

This query classifies every transaction that touches the amaru-treasury.network_compliance address.

A transaction is produces-only when it creates a network_compliance output and does not spend a previous one in the loaded lattice. A transaction is consumes-and-produces when it spends a resolved network_compliance output and emits a new one.

Why

This tells us how the address state evolves inside the 85 transactions. The 54 produces-only transactions introduce outputs at the treasury address. The 31 consumes-and-produces transactions roll an existing treasury UTxO forward.

There are no consumes-only rows in this result, which is consistent with the later terminal-state proof: every in-scope treasury spend also produces a replacement or payment/change shape visible in the graph.

Diagram

flowchart LR
  producer[produces-only tx]
  rolling[consumes-and-produces tx]
  treasury[network_compliance UTxO set]

  producer --> treasury
  treasury --> rolling
  rolling --> treasury

How

The query resolves the network_compliance bech32 address from rules.yaml, then computes two boolean tests per transaction.

The first test checks whether the transaction emits an output at that address. The second test follows each input reference back to a loaded output and checks whether the source output was at the same address.

The final touchKind is derived from those two tests.

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/01-network-compliance-touch-summary.rq

SPARQL

PREFIX cardano: <https://lambdasistemi.github.io/cardano-knowledge-maps/vocab/cardano#>
PREFIX rdfs:    <http://www.w3.org/2000/01/rdf-schema#>

# Classify how transactions touch network_compliance.
#
# A transaction can produce an output at the treasury, consume a previous
# treasury output, or do both. The source side is proven by resolving the input
# reference back to an output in the loaded lattice.
SELECT ?touchKind (COUNT(?tx) AS ?txs)
WHERE {
  ?networkCompliance rdfs:label "amaru-treasury.network_compliance" ;
                     cardano:bech32 ?networkComplianceBech32 .

  ?tx cardano:hasTxId/cardano:bytesHex ?txId .
  BIND(EXISTS {
    ?tx cardano:hasOutput ?out .
    ?out cardano:atAddress/cardano:bech32 ?networkComplianceBech32 .
  } AS ?producesTreasuryOutput)
  BIND(EXISTS {
    ?tx cardano:hasInput ?input .
    ?input cardano:fromTxOutRef ?ref .
    ?ref cardano:hasTxId/cardano:bytesHex ?sourceTxId ;
         cardano:hasIndex ?sourceIx .
    ?sourceTx cardano:hasTxId/cardano:bytesHex ?sourceTxId ;
              cardano:hasOutput ?sourceOut .
    ?sourceOut cardano:hasIndex ?sourceIx ;
               cardano:atAddress/cardano:bech32 ?networkComplianceBech32 .
  } AS ?consumesTreasuryOutput)

  FILTER(?producesTreasuryOutput || ?consumesTreasuryOutput)
  BIND(
    IF(
      ?producesTreasuryOutput && ?consumesTreasuryOutput,
      "consumes-and-produces",
      IF(?producesTreasuryOutput, "produces-only", "consumes-only")
    ) AS ?touchKind
  )
}
GROUP BY ?touchKind
ORDER BY ?touchKind