neo-project / proposals

NEO Enhancement Proposals
Creative Commons Attribution 4.0 International
136 stars 113 forks source link

Need token standard that mandates storage format #86

Open jsolman opened 5 years ago

jsolman commented 5 years ago

The NEP-5 token standard does not mandate a storage key format or expose a mandatory method to get the prefix or or format of storage keys for the contract. We need this in the token standard in order to be able to use Patricia Tree in Neo 3.0 to validate balances. Also we need it to track token balance changes more efficiently.

erikzhang commented 5 years ago

Even if you specify the format of the key, the value may be a serialized struct.

jsolman commented 5 years ago

The value needs to be mandated also in the standard. It could support more than one type as long as the standard defines it sufficiently to it determine the balance programmatically.

erikzhang commented 5 years ago

Values can be difficult to be mandated because they are business related. Even some of the contract balances are calculated, not directly stored.

jsolman commented 5 years ago

Then it needs to mandate a key that will exist if there is a non-zero balance for an address if the storage does not conform to the standard format. It would be acceptable if there were some false positives.

I should note though that the Patricia tree will not really help validate a balance if the balance value format is not defined in a standard way.

erikzhang commented 5 years ago

Maybe it can be another NEP? Example: NEP: Verifiable Token Standard.

jsolman commented 5 years ago

@erikzhang Yes, I expected it will need to be an additional NEP; native NEO and GAS assets should use it.

roman-khimov commented 2 years ago

151 can help with this.