# Notes about the namespace buzzword

**URL:** <https://forum.anoma.net/t/notes-about-the-namespace-buzzword/601>\
**Category:** Protocol Design\
**Created:** [June 8, 2024, 10:18am UTC](https://forum.anoma.net/t/notes-about-the-namespace-buzzword/601 "2024-06-08T10:18:49Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cwgoes](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.anoma.net/cwgoes/32/22_2.png) [@cwgoes](https://forum.anoma.net/u/cwgoes)\
**Post date:** [July 2, 2024, 8:06am UTC](https://forum.anoma.net/t/notes-about-the-namespace-buzzword/601/2 "2024-07-02T08:06:18Z")

</div>

Without loss of generality, I think we can craft a virtual namespace where we understand _keys_ as predicates over _values_, where a particular value can be checked against a key simply by checking the predicate. Lookups then return sets of values, and we relax slightly referential transparency to simply guarantee that if a particular set `s` is returned at local time `t`, the set returned at `t + n` for any non-negative `n` will include all elements of `s`.

Examples of keys-as-predicates:

- the simple content-addressed predicate `\v -> hash v == h` for some fixed `h`
- an example unspent resource lookup `\v -> let r = asResource v in unspentInController c t r` for a fixed controller `c` and controller-time `t`, where `unspentInController` checks the controller signature, proper format, etc. attesting to the created-but-not-consumed resources at `t`
- a more complex unspent resource lookup which also checks that the resource label is equal to some constant
- a lookup of some particular piece of oracle data, e.g. `\v -> isOracleFormat v t && checkSignature o v` for some fixed oracle `o` and time `t`

A few questions arise here:

- How do we actually encode functions? This one isn’t too difficult; see [here](https://forum.anoma.net/t/use-of-multiformats-in-the-anoma-protocol/665). We can also hash the encoded functions for constant-sized keys.
- How do we actually fetch the right data? Obviously not all functions will be easily computable, and in the limit case, we would have to iterate over _all data_ and test the predicate in order to return, which is infeasible. In practice, only a subset of known predicates will be supported - but the relaxed referential transparency guarantee also always allows us to return `{}` before appropriate indexes for a particular predicate are created. In some cases (e.g. resources at some time), it would be helpful to have affirmative proof that a response is complete.

cc also @mariari @Moonchild

---

_[View the full topic](https://forum.anoma.net/t/notes-about-the-namespace-buzzword/601)._
