Are durableHandle
s superior over plain strings when used as "key" in store?
#9663
-
Let's say we have some durable objects that we need store in a Zoe contract. I'm struggling to determine the form of the key to be used when storing those objects. The usual suspects are;
One advantage I can think of for using cc @dckc |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
As you point out, there are advantages and disadvantages to each; it's not the case that handles are always superior to strings as keys. The terminology we use to talk about the distinction is: strings are forgeable identities, and handles are unforgeable. strings can be effectively unforgeable in some senses, if sufficient entropy is used to allocate them; but since the operation of the chain and the JS VM are visible to anyone running a node, they could take that string and use it in a contract. This is not so for unforgeable objects. Even if you have all sorts of knowledge about the identity, there's no way to break ocap access rules and get a reference in a contract. cc @Jovonni |
Beta Was this translation helpful? Give feedback.
As you point out, there are advantages and disadvantages to each; it's not the case that handles are always superior to strings as keys.
The terminology we use to talk about the distinction is: strings are forgeable identities, and handles are unforgeable.
strings can be effectively unforgeable in some senses, if sufficient entropy is used to allocate them; but since the operation of the chain and the JS VM are visible to anyone running a node, they could take that string and use it in a contract. This is not so for unforgeable objects. Even if you have all sorts of knowledge about the identity, there's no way to break ocap access rules and get a reference in a contract.
cc @Jovonni