-
Notifications
You must be signed in to change notification settings - Fork 100
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for querying contracts by ID #339
Comments
@roman-khimov please take a look to #340 I think that it easier for users if the can query contracts by name, instead of by id |
It's a nice extension too, it solves the original problem for sure (and in a bit more friendly fashion as "NEO" is better than "-1"). But at the same time ability to enumerate both native and regular contracts has a value of its own, so maybe we can add support for three types of arguments here --- hash, name and ID? |
I think that Id it's something more "internal" but it's ok for me, the PR was updated. |
I think so too. |
We expose this ID in answers to
So it's available to the general public for use or misuse anyway. |
Summary or problem description
The initial problem that led to this issue was that I wanted to make native contracts be discoverable via RPC. At the moment clients have to have GAS/NEO/Policy hashes to make any queries/transactions using them. Usually of course they don't change and these values can be hardcoded into the client. Still, if we're to make some changes (and to this date there is no preview version of Neo 3 that didn't change them) or if we're to deploy some private network with additional contract there is a question of client updates. The actual data is known to the RPC server, so if it could somehow convey this knowledge to the client that would be solved.
So I thought about some new API like
listnativecontracts
, but then remembered that we actually have now way more stable contract identifies, their ID numbers. And there is a simple scheme of numbering, going down from zero for native contracts and going up for regular ones.Do you have any solution you want to propose?
If we're to enable
getcontractstate
RPC call to accept IDs (along with hashes) then we can make all our contracts easily enumerable and discoverable by clients. So the client may no longer store NEO hash, it can query contract-1
and get it. Same thing for other contracts, native or regular ones.Where in the software does this update applies to?
The text was updated successfully, but these errors were encountered: