Wallet utxo covenant id lookup

Is there a lookup way to get (if exist) all the utxo of a specific covenant?

Currently I simply look on each tx of the a utxo to know of it’s belong to my covenant or not

@daniel not yet. it is planned to be a required effort, right after the utxo index storage rework that is in progress (that will allow pagination and DAA filters on UTXOs).

cool man, good that it is planned

Now I thought about it and it might not be clear enough.
there are 2 lookup needed:

  1. wallet lookup by covenant id → gives us all the utxo if exist of a covenant id inside a wallet.
  2. UTXO by covenant id → gives us all the utxo which was an output for a covenant id

are both of them planned? only one? I would like to know the current plan

1 Like

we first have to define what “covenant belongs to a wallet” means.

kcc-2 establish an ownership model where a covenant state roughly contains:

"owner_type": "p2pk",
"owner": "kaspa:qzxrs..." // in reality the pubkey is inscribed here

please see kcc2 here. after that you’ll note that owner can be of different form and not only ‘classic’ p2pk. this allows powerful composition where Bob is owner of NFT_A, NFT_A is owner of NFT_B and so by extension, Bob can prove ownership of NFT_B, indirectly.

i imagine a future wallet scan flow as:

  1. get Bob public keys (remember one wallet manages multiple public keys: multiple account, and multiple addresses derivation for each account)
  2. query an indexer with these identities, it will answer all of the covenant Bob is owner of
  3. for each covenant, recursively continue 2. with covenant identity (covenant_id): here we discover NFT_B
  4. wallet now it able to show every covenant Bob can interact with

another more sovereign flow would be: Bob knows (or wallet knows) which covenant he is owner of, and so he already has the covenant_id, from which he can query his own node, get the UTXOs back, and then ask indexer about these specific covenant UTXOs to get the state (so he can build the transactions/transitions)

edit: i use the term indexer here, but it can be replaced with any other entities, not necessarily an indexer.

1 Like

Ok thanks buddy, I will take a look at kcc2

Hey @daniel , KasCov can do both of these today with its free public API. No key needed, and it works on mainnet and testnet-10. I run it, so ping me if anything’s unclear.

1. What a wallet holds
https://kascov.io/data/mainnet/addr/<kaspa address>.json
This lists every token the address owns, with balances. As @IzioDev explained, ownership is read from inside the covenant state (the KCC-2 model), not from who holds the UTXO.
To see the actual UTXOs, https://kascov.io/data/mainnet/token/<covenant id>/cells lists every live cell of a token with its owner.

2. Every UTXO a covenant ever created
https://kascov.io/data/mainnet/c/<covenant id>.json
This works for any covenant, not just tokens. It gives the full story from genesis: every output with its outpoint, whether it’s still unspent, and every transaction. Very large covenants are cut off at 500 entries per response.
Example: https://kascov.io/data/mainnet/c/bed3c81787e07988c6d5792fb02324bfd11b980a123f87a28eb177eeec6084a0.json

There’s also a live feed per covenant: https://kascov.io/data/mainnet/stream?covenant=<covenant id>

You don’t have to take our word for it. Token cells come with their program bytes, and those bytes have to hash to the UTXO’s script, so you can check them against your own node. Once the node gets its own covenant ID lookup, you can pull the UTXOs yourself and use KasCov just to decode the state.

All endpoints: https://kascov.io/openapi.json