GithubHelp home page GithubHelp logo

Comments (5)

erikzhang avatar erikzhang commented on June 12, 2024 1

Why we need to store a string address to storage?

from neo-vm.

erikzhang avatar erikzhang commented on June 12, 2024 1

I don't think it's necessary to translate the address within the contract.
If you want to translate it outside of the contract, it is very easy. See https://github.com/neo-project/neo/blob/master/neo/Wallets/Wallet.cs#L391

from neo-vm.

revett avatar revett commented on June 12, 2024

Thanks for the reply @erikzhang 👍

If you prefix the storage key with the user's address then they cannot alter any other user's storage:

For example:

ALZzNsLg5CaF1Qa2TSdWB1AawLxFUbKhHz.total_tokens => 3485

This is particularly important in NeoAuth where login proofs are being stored in the contract.

You can read more about the issue in NeoAuth here: https://github.com/neoauth/whitepaper#limitations

from neo-vm.

erikzhang avatar erikzhang commented on June 12, 2024

What about just store the ScriptHash?

from neo-vm.

revett avatar revett commented on June 12, 2024

@erikzhang So the storage action would be:

key:       <script_hash>.total_tokens
value:     3485

And then to read the storage value via the getstorage RPC call you would use the following as the key parameter:

<script_hash>.total_tokens

But how can you translate ScriptHash into Address string?

It may be fixed within this feature request: neo-project/neo#128. As prefixes would fix the issue that the NeoAuth contract is having.

from neo-vm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.