Distinguishing between object ID's and addresses

This is a question originally asked in the Suinami Rider’s group

Is there a way to distinguish between object ID’s and addresses? IDs are just addresses stored inside of a struct, and UIDs are just IDs stored inside of a struct.

You cannot distinguish between an address or ID as an external observer looking at a 20 byte value (all 20 byte values are a valid object id or valid address). But there’s no place inside the protocol that conflates them

  • address and UID are different Move types
  • object ownership metadata has separate tagged entries for “owned by address” and owned by object", so it won’t confuse the two even if the address and object ID are the same 20 byte value

This means an address that happens to be the same as an object ID is not a problem. One fun way I’ve seen folks experimenting with this in devnet is sending NFT’s to the address 0x2 (since that happens to be the object ID for the Sui Framework package) to see what happens. What happens is: this object is owned by whoever knows the private key for 0x2 (in all likelihood, no one), and there is no relationship between this object and the Sui Framework package object.

1 Like