envoylabs / whoami

An NFT-based user and smart contract nameservice
Apache License 2.0
16 stars 10 forks source link

Global token ID #33

Open the-frey opened 2 years ago

the-frey commented 2 years ago

Thinking longer term and for some of the stuff under #29 we need a URI like way of globally referencing a token ID.

Something like:

chain-id::contract-code::token-name

e.g.

juno-1::1::the-frey

Should it be code? Contract address? i.e. chain-id::contract-addr::token-id What else is available as meta at runtime?

the-frey commented 2 years ago

recent commentary on https://github.com/cosmos/ibc/pull/615 needs reading and parsing when less tired && moar coffee

the-frey commented 2 years ago

Gut feel is the ICS is so geared towards IBC it misses our use case which is the same token ID, on the same chain, from different instances of the same contract.

Welcome any thoughts on this @elsehow - don't want to show any prefix to users but seems like it might be worth writing it to storage and stripping it on read. Maybe exposing via a QueryRaw or similar where you can get non human friendly info. Or return it as a separate meta field.

However, separate fields or relying on the contract meta is less portable than having it all in the ID, as that makes it:

the-frey commented 2 years ago
Screenshot 2021-12-17 at 15 31 51
the-frey commented 2 years ago

I think this probably is an implementation detail though that shouldn't generally be exposed to users, hence the QueryRaw question above

the-frey commented 2 years ago

So, thinking about it contract-code doesn't make sense, as you can instantiate multiple contracts off it. Only contract-addr is guaranteed to be unique (for the purposes of constructing a prefix that is addressable)

the-frey commented 2 years ago
Screenshot 2021-12-17 at 18 35 15
the-frey commented 2 years ago

other thought: the token_id doesn't need to be unique because sending to another variant of this contract, you can't have duplicates, so actually a single dumb string, so long as it is validated #39 is acceptable.

HOWEVER you do still need the meta/global id for provenance. So clearly at mint time the NFT should have an extra field with this. the question is, should it be a straight uuid, or is a compound identifier that contains its own meta acceptable?

I think my preference is probably for chain-id::contract-addr::token-id as it preserves a lot of important info (even if long)

the-frey commented 2 years ago

Okay, so current working plan:

Actually, if this was on its own chain, you could reduce the problem back to an id that was unique at contract level.

the-frey commented 2 years ago

So the addressability issue is actually pushed to HTTP in web2 - because who cares if somebody mints the same name, if they can't route to it?

Which means that at contract level, you're back to network effects I guess. And/or "web of trust" to actually make the service useful.

the-frey commented 2 years ago

It feels like there is a missing primitive here. Or maybe that this is the primitive, but it is still too rudimentary.

the-frey commented 2 years ago

as a wise cat once said to me "this is probably solved by interchain accounts"